@ordinatio/ui 1.5.0 → 1.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 +31 -0
- package/dist/index.d.mts +55 -2
- package/dist/index.mjs +158 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,6 +212,37 @@ import { ConfirmAction } from '@ordinatio/ui';
|
|
|
212
212
|
|
|
213
213
|
**Styling**: plain elements with default inline styles. `classNames.<part>` (`trigger`, `group`, `question`, `confirm`, `keep`, `error`) REPLACES that part's defaults entirely, so Tailwind or shadcn consumers restyle everything (including the pending look of the buttons: style `:disabled`).
|
|
214
214
|
|
|
215
|
+
### `ActivityFeedRow`
|
|
216
|
+
|
|
217
|
+
One line of an activity feed that is clickable and readable at a glance. Presentation only: it knows no routes, no database and no framework. The app decides where a line goes (`href`), what else is involved (`chips`), and which tags the thing has now (`tags`).
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import Link from 'next/link';
|
|
221
|
+
import { ActivityFeedRow } from '@ordinatio/ui';
|
|
222
|
+
|
|
223
|
+
<ul>
|
|
224
|
+
<ActivityFeedRow
|
|
225
|
+
sentence="Max added a note to Ann Lee"
|
|
226
|
+
time={entry.createdAt}
|
|
227
|
+
href="/people/p1?note=n9"
|
|
228
|
+
chips={[{ label: 'Ann Lee', href: '/people/p1', kind: 'Person' }]}
|
|
229
|
+
tags={[{ label: 'Hot', href: '/tags/t1', kind: 'Tag' }]}
|
|
230
|
+
actions={<button type="button">Show full note</button>}
|
|
231
|
+
LinkComponent={Link}
|
|
232
|
+
/>
|
|
233
|
+
<ActivityFeedRow sentence="Max deleted Ann Lee" time={t} gone="Person removed" />
|
|
234
|
+
</ul>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Structure (each point is a test):
|
|
238
|
+
- The `<li>` is the row. The sentence is the one link assistive technology reads; its accessible name is the sentence only.
|
|
239
|
+
- The whole row is clickable through an empty, `aria-hidden`, unfocusable anchor stretched over the row. It is a sibling of everything else: no anchor or button is ever inside an anchor.
|
|
240
|
+
- Chips, tag chips and `actions` are siblings stacked above that overlay (`position: relative; z-index: 1`), so clicking one does not follow the row's link. jsdom cannot test stacking: check it once in a real browser.
|
|
241
|
+
- Tab order: the sentence, then the chips, then the actions. The time is a `<time datetime>`.
|
|
242
|
+
- No `href`: a plain row (no link, no overlay, no arrow). `gone="Person removed"`: shows that word (never colour alone), no link, no chips; `actions` stay (a Resolve button).
|
|
243
|
+
- Tags: at most `maxTags` (default 3) then a plain "+N"; the "Tags now" label (`tagsLabel`) shows only when a tag chip shows.
|
|
244
|
+
- `classNames.<part>` REPLACES that part's look (the structural positioning and stacking stay inline). Inline styles cannot express `:hover` or `:focus-visible`: pass them through `classNames` (sentence, chip, tag).
|
|
245
|
+
|
|
215
246
|
## Hooks
|
|
216
247
|
|
|
217
248
|
### `useKeyboardShortcuts()`
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Component, ReactNode, ErrorInfo, ComponentType, CSSProperties, RefObject } from 'react';
|
|
3
|
+
import { Component, ReactNode, ErrorInfo, ComponentType, CSSProperties, ElementType, RefObject } from 'react';
|
|
4
4
|
|
|
5
5
|
interface ErrorBoundaryProps {
|
|
6
6
|
children: ReactNode;
|
|
@@ -198,6 +198,59 @@ interface ConfirmActionProps {
|
|
|
198
198
|
}
|
|
199
199
|
declare function ConfirmAction({ triggerLabel, question, confirmLabel, pendingLabel, keepLabel, onConfirm, errorFallback, disabled, groupLabel, classNames, }: ConfirmActionProps): react_jsx_runtime.JSX.Element;
|
|
200
200
|
|
|
201
|
+
/** A small linked (or plain) label under the sentence: the other thing involved, or a tag. */
|
|
202
|
+
interface ActivityFeedChip {
|
|
203
|
+
/** What it says: "Taft Law", "Hot". */
|
|
204
|
+
label: string;
|
|
205
|
+
/** Where it goes. Without it the chip is plain text. */
|
|
206
|
+
href?: string;
|
|
207
|
+
/** Names the kind for assistive technology: with `kind: 'Company'` the chip reads "Company: Taft Law". */
|
|
208
|
+
kind?: string;
|
|
209
|
+
}
|
|
210
|
+
interface ActivityFeedRowClassNames {
|
|
211
|
+
row?: string;
|
|
212
|
+
main?: string;
|
|
213
|
+
/** The sentence link (or the plain sentence). */
|
|
214
|
+
sentence?: string;
|
|
215
|
+
/** The empty stretched link that makes the whole row clickable. */
|
|
216
|
+
overlay?: string;
|
|
217
|
+
arrow?: string;
|
|
218
|
+
time?: string;
|
|
219
|
+
chips?: string;
|
|
220
|
+
chip?: string;
|
|
221
|
+
tagsLabel?: string;
|
|
222
|
+
tag?: string;
|
|
223
|
+
more?: string;
|
|
224
|
+
gone?: string;
|
|
225
|
+
actions?: string;
|
|
226
|
+
}
|
|
227
|
+
interface ActivityFeedRowProps {
|
|
228
|
+
/** The line: "Max added a note to Ann Lee". */
|
|
229
|
+
sentence: string;
|
|
230
|
+
/** When it happened (a Date or anything `new Date()` accepts). */
|
|
231
|
+
time: Date | string | number;
|
|
232
|
+
/** The time as shown. Default: the date's `toLocaleString()`. */
|
|
233
|
+
timeText?: string;
|
|
234
|
+
/** Where a click goes. Without it the row is plain. */
|
|
235
|
+
href?: string;
|
|
236
|
+
/** What the app calls this: set it when the thing is gone ("Person removed"): shown as a word, no link, no chips. */
|
|
237
|
+
gone?: string;
|
|
238
|
+
/** The other things involved, first the most important ("on Ann Lee", the company). */
|
|
239
|
+
chips?: ActivityFeedChip[];
|
|
240
|
+
/** The tags the thing has now. */
|
|
241
|
+
tags?: ActivityFeedChip[];
|
|
242
|
+
/** How many tag chips show before "+N". Default 3. */
|
|
243
|
+
maxTags?: number;
|
|
244
|
+
/** The label before the tag chips. Default "Tags now". */
|
|
245
|
+
tagsLabel?: string;
|
|
246
|
+
/** Buttons that belong to the row ("Show full note", "Resolve"): siblings above the overlay, never inside a link. */
|
|
247
|
+
actions?: ReactNode;
|
|
248
|
+
/** The component that renders every link (an `a` by default; give Next's Link in a Next app). It receives `href`, `className`, `style`, `children` and the aria props. */
|
|
249
|
+
LinkComponent?: ElementType;
|
|
250
|
+
classNames?: ActivityFeedRowClassNames;
|
|
251
|
+
}
|
|
252
|
+
declare function ActivityFeedRow({ sentence, time, timeText, href, gone, chips, tags, maxTags, tagsLabel, actions, LinkComponent, classNames, }: ActivityFeedRowProps): react_jsx_runtime.JSX.Element;
|
|
253
|
+
|
|
201
254
|
interface EntityPickerClassNames {
|
|
202
255
|
root?: string;
|
|
203
256
|
input?: string;
|
|
@@ -916,4 +969,4 @@ declare const ACTIVITY_ICONS: Record<string, IconComponent>;
|
|
|
916
969
|
/** Return the icon component for a given icon name, or Activity as fallback. */
|
|
917
970
|
declare function resolveActivityIcon(name: string): IconComponent;
|
|
918
971
|
|
|
919
|
-
export { ACTIVITY_ICONS, ALL_SHORTCUT_CONTEXTS, ArchiveButton, type ArchiveButtonProps, CLIENT_PROFILE_SHORTCUTS, type CachedFetchOptions, type ComposeMode, ConfirmAction, type ConfirmActionClassNames, type ConfirmActionProps, type ConfirmActionResult, EmailBodyRenderer, type EmailBodyRendererProps, EmailThreadView, type EmailThreadViewProps, EntityPicker, type EntityPickerClassNames, type EntityPickerProps, ErrorBoundary, type ErrorBoundaryProps, FORM_SHORTCUTS, GLOBAL_SHORTCUTS, INBOX_SHORTCUTS, type KeyboardShortcut, KeyboardShortcutsPanel, RENDER_ERRORS, REPLY_LAYOUT_OPTIONS, type RenderErrorResult, type ReplyLayout, ReplyPanel, type ReplyPanelProps, type ReplySendOverrides, RichTextEditor, type RichTextEditorProps, type SchedulePreset, type ShortcutContext, type ShortcutDefinition, type ThreadMessage, type UseAutoSaveOptions, type UseAutoSaveResult, type UseKeyboardShortcutsOptions, type UsePollingOptions, type UsePollingResult, type UsePreferencesOptions, type UsePreferencesResult, type UseServerSearchOptions, type UseServerSearchResult, cachedFetch, canViewInline, clearCache, formatDateGroup, formatFileSize, formatPhone, formatPhoneInput, getNextMondayMorning, getNextWeekday, getQuickScheduleOptions, getShortcut, getTomorrowMorning, groupByDate, invalidateCache, isAudio, isDocument, isEmptyHtml, isImage, isInlineLayout, isModalLayout, isPdf, isPopoutLayout, isSpreadsheet, isTypingContext, isValidScheduleDate, isVideo, opensInNewTab, parseCustomSchedule, prefetch, renderError, resolveActivityIcon, resolveContentType, stripHtml, stripPhone, truncatePreview, useAutoSave, useContextShortcuts, useIframeFocusReclaim, useKeyboardShortcuts, usePolling, usePreferences, useServerSearch, withErrorBoundary };
|
|
972
|
+
export { ACTIVITY_ICONS, ALL_SHORTCUT_CONTEXTS, type ActivityFeedChip, ActivityFeedRow, type ActivityFeedRowClassNames, type ActivityFeedRowProps, ArchiveButton, type ArchiveButtonProps, CLIENT_PROFILE_SHORTCUTS, type CachedFetchOptions, type ComposeMode, ConfirmAction, type ConfirmActionClassNames, type ConfirmActionProps, type ConfirmActionResult, EmailBodyRenderer, type EmailBodyRendererProps, EmailThreadView, type EmailThreadViewProps, EntityPicker, type EntityPickerClassNames, type EntityPickerProps, ErrorBoundary, type ErrorBoundaryProps, FORM_SHORTCUTS, GLOBAL_SHORTCUTS, INBOX_SHORTCUTS, type KeyboardShortcut, KeyboardShortcutsPanel, RENDER_ERRORS, REPLY_LAYOUT_OPTIONS, type RenderErrorResult, type ReplyLayout, ReplyPanel, type ReplyPanelProps, type ReplySendOverrides, RichTextEditor, type RichTextEditorProps, type SchedulePreset, type ShortcutContext, type ShortcutDefinition, type ThreadMessage, type UseAutoSaveOptions, type UseAutoSaveResult, type UseKeyboardShortcutsOptions, type UsePollingOptions, type UsePollingResult, type UsePreferencesOptions, type UsePreferencesResult, type UseServerSearchOptions, type UseServerSearchResult, cachedFetch, canViewInline, clearCache, formatDateGroup, formatFileSize, formatPhone, formatPhoneInput, getNextMondayMorning, getNextWeekday, getQuickScheduleOptions, getShortcut, getTomorrowMorning, groupByDate, invalidateCache, isAudio, isDocument, isEmptyHtml, isImage, isInlineLayout, isModalLayout, isPdf, isPopoutLayout, isSpreadsheet, isTypingContext, isValidScheduleDate, isVideo, opensInNewTab, parseCustomSchedule, prefetch, renderError, resolveActivityIcon, resolveContentType, stripHtml, stripPhone, truncatePreview, useAutoSave, useContextShortcuts, useIframeFocusReclaim, useKeyboardShortcuts, usePolling, usePreferences, useServerSearch, withErrorBoundary };
|
package/dist/index.mjs
CHANGED
|
@@ -787,10 +787,99 @@ function ConfirmAction({
|
|
|
787
787
|
] });
|
|
788
788
|
}
|
|
789
789
|
|
|
790
|
+
// src/components/activity-feed-row.tsx
|
|
791
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
792
|
+
var defaults2 = {
|
|
793
|
+
row: { position: "relative", display: "flex", flexDirection: "column", gap: "4px", padding: "10px 0", borderBottom: "1px solid #f5f5f5", fontSize: "14px" },
|
|
794
|
+
main: { display: "flex", flexWrap: "wrap", alignItems: "baseline", justifyContent: "space-between", gap: "4px 16px", minWidth: 0 },
|
|
795
|
+
sentence: { color: "#171717", textDecoration: "none", overflowWrap: "anywhere", minWidth: 0 },
|
|
796
|
+
overlay: { position: "absolute", top: 0, right: 0, bottom: 0, left: 0 },
|
|
797
|
+
arrow: { marginLeft: "6px", color: "#737373" },
|
|
798
|
+
time: { flexShrink: 0, fontSize: "12px", color: "#737373" },
|
|
799
|
+
chips: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "6px" },
|
|
800
|
+
chip: { padding: "1px 8px", fontSize: "12px", border: "1px solid #d4d4d4", borderRadius: "999px", color: "#404040", textDecoration: "none", backgroundColor: "#ffffff" },
|
|
801
|
+
tagsLabel: { fontSize: "12px", color: "#737373" },
|
|
802
|
+
tag: { padding: "1px 8px", fontSize: "12px", borderRadius: "999px", color: "#404040", textDecoration: "none", backgroundColor: "#f5f5f5" },
|
|
803
|
+
more: { fontSize: "12px", color: "#737373" },
|
|
804
|
+
gone: { padding: "1px 8px", fontSize: "12px", border: "1px solid #a3a3a3", borderRadius: "4px", color: "#525252" },
|
|
805
|
+
actions: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "8px" }
|
|
806
|
+
};
|
|
807
|
+
var aboveOverlay = { position: "relative", zIndex: 1 };
|
|
808
|
+
var visuallyHidden = { position: "absolute", width: "1px", height: "1px", overflow: "hidden", clip: "rect(0 0 0 0)", whiteSpace: "nowrap" };
|
|
809
|
+
function ActivityFeedRow({
|
|
810
|
+
sentence,
|
|
811
|
+
time,
|
|
812
|
+
timeText,
|
|
813
|
+
href,
|
|
814
|
+
gone,
|
|
815
|
+
chips = [],
|
|
816
|
+
tags = [],
|
|
817
|
+
maxTags = 3,
|
|
818
|
+
tagsLabel = "Tags now",
|
|
819
|
+
actions,
|
|
820
|
+
LinkComponent = "a",
|
|
821
|
+
classNames
|
|
822
|
+
}) {
|
|
823
|
+
const Link = LinkComponent;
|
|
824
|
+
const part = (key, structural) => {
|
|
825
|
+
const className = classNames?.[key];
|
|
826
|
+
if (className) return structural ? { className, style: structural } : { className };
|
|
827
|
+
return { style: structural ? { ...defaults2[key], ...structural } : defaults2[key] };
|
|
828
|
+
};
|
|
829
|
+
const date = new Date(time);
|
|
830
|
+
const valid = !Number.isNaN(date.getTime());
|
|
831
|
+
const shownTime = timeText ?? (valid ? date.toLocaleString() : String(time));
|
|
832
|
+
const isGone = typeof gone === "string" && gone !== "";
|
|
833
|
+
const clickable = !isGone && typeof href === "string" && href !== "";
|
|
834
|
+
const shownTags = isGone ? [] : tags.slice(0, Math.max(0, maxTags));
|
|
835
|
+
const hiddenTags = isGone ? 0 : Math.max(0, tags.length - shownTags.length);
|
|
836
|
+
const shownChips = isGone ? [] : chips;
|
|
837
|
+
const chipNode = (chip, key, slot) => {
|
|
838
|
+
const content = /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
839
|
+
chip.kind ? /* @__PURE__ */ jsxs5("span", { style: visuallyHidden, children: [
|
|
840
|
+
chip.kind,
|
|
841
|
+
": "
|
|
842
|
+
] }) : null,
|
|
843
|
+
chip.label
|
|
844
|
+
] });
|
|
845
|
+
return chip.href ? /* @__PURE__ */ jsx6(Link, { href: chip.href, ...part(slot, aboveOverlay), children: content }, key) : /* @__PURE__ */ jsx6("span", { ...part(slot, aboveOverlay), children: content }, key);
|
|
846
|
+
};
|
|
847
|
+
return /* @__PURE__ */ jsxs5("li", { ...part("row", { position: "relative" }), children: [
|
|
848
|
+
/* @__PURE__ */ jsxs5("div", { ...part("main"), children: [
|
|
849
|
+
/* @__PURE__ */ jsxs5("span", { style: { minWidth: 0 }, children: [
|
|
850
|
+
clickable ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
851
|
+
/* @__PURE__ */ jsx6(Link, { href, ...part("sentence"), children: sentence }),
|
|
852
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", ...part("arrow"), children: "\u2192" })
|
|
853
|
+
] }) : /* @__PURE__ */ jsx6("span", { ...part("sentence"), children: sentence }),
|
|
854
|
+
isGone ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
855
|
+
" ",
|
|
856
|
+
/* @__PURE__ */ jsx6("span", { ...part("gone"), children: gone })
|
|
857
|
+
] }) : null
|
|
858
|
+
] }),
|
|
859
|
+
/* @__PURE__ */ jsx6("time", { dateTime: valid ? date.toISOString() : void 0, ...part("time"), children: shownTime })
|
|
860
|
+
] }),
|
|
861
|
+
shownChips.length > 0 || shownTags.length > 0 || hiddenTags > 0 ? /* @__PURE__ */ jsxs5("div", { ...part("chips", aboveOverlay), children: [
|
|
862
|
+
shownChips.map((chip, index) => chipNode(chip, `chip-${index}`, "chip")),
|
|
863
|
+
shownTags.length > 0 ? /* @__PURE__ */ jsx6("span", { ...part("tagsLabel"), children: tagsLabel }) : null,
|
|
864
|
+
shownTags.map((tag, index) => chipNode(tag, `tag-${index}`, "tag")),
|
|
865
|
+
hiddenTags > 0 ? /* @__PURE__ */ jsxs5("span", { ...part("more"), children: [
|
|
866
|
+
"+",
|
|
867
|
+
hiddenTags,
|
|
868
|
+
/* @__PURE__ */ jsxs5("span", { style: visuallyHidden, children: [
|
|
869
|
+
" more ",
|
|
870
|
+
hiddenTags === 1 ? "tag" : "tags"
|
|
871
|
+
] })
|
|
872
|
+
] }) : null
|
|
873
|
+
] }) : null,
|
|
874
|
+
actions ? /* @__PURE__ */ jsx6("div", { ...part("actions", aboveOverlay), children: actions }) : null,
|
|
875
|
+
clickable ? /* @__PURE__ */ jsx6(Link, { href, "aria-hidden": "true", tabIndex: -1, ...part("overlay", { position: "absolute", top: 0, right: 0, bottom: 0, left: 0 }) }) : null
|
|
876
|
+
] });
|
|
877
|
+
}
|
|
878
|
+
|
|
790
879
|
// src/components/entity-picker.tsx
|
|
791
880
|
import { useCallback as useCallback2, useEffect as useEffect3, useId as useId2, useRef as useRef3, useState as useState4 } from "react";
|
|
792
|
-
import { jsx as
|
|
793
|
-
var
|
|
881
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
882
|
+
var defaults3 = {
|
|
794
883
|
root: { position: "relative", display: "inline-flex", alignItems: "center", gap: "4px", width: "100%" },
|
|
795
884
|
input: { flex: 1, minWidth: 0, padding: "8px 10px", fontSize: "14px", border: "1px solid #d4d4d4", borderRadius: "6px", backgroundColor: "#ffffff", color: "#171717" },
|
|
796
885
|
clear: { padding: "4px 8px", fontSize: "14px", border: "1px solid transparent", borderRadius: "6px", backgroundColor: "transparent", color: "#525252", cursor: "pointer" },
|
|
@@ -801,7 +890,7 @@ var optionDefaults = {
|
|
|
801
890
|
base: { padding: "6px 8px", fontSize: "14px", borderRadius: "4px", cursor: "pointer", color: "#171717" },
|
|
802
891
|
active: { backgroundColor: "#f5f5f5" }
|
|
803
892
|
};
|
|
804
|
-
var
|
|
893
|
+
var visuallyHidden2 = { position: "absolute", width: "1px", height: "1px", margin: "-1px", padding: 0, overflow: "hidden", clip: "rect(0 0 0 0)", whiteSpace: "nowrap", border: 0 };
|
|
805
894
|
function EntityPicker({
|
|
806
895
|
value,
|
|
807
896
|
onChange,
|
|
@@ -937,7 +1026,7 @@ function EntityPicker({
|
|
|
937
1026
|
const partProps = (key) => {
|
|
938
1027
|
const className = classNames?.[key];
|
|
939
1028
|
if (className) return { className, style: key === "root" ? style : void 0 };
|
|
940
|
-
return { style: key === "root" ? { ...
|
|
1029
|
+
return { style: key === "root" ? { ...defaults3.root, ...style } : defaults3[key] };
|
|
941
1030
|
};
|
|
942
1031
|
const optionProps = (active) => {
|
|
943
1032
|
const optionClass = classNames?.option;
|
|
@@ -946,8 +1035,8 @@ function EntityPicker({
|
|
|
946
1035
|
return { className, style: optionClass ? void 0 : { ...optionDefaults.base, ...active && !activeClass ? optionDefaults.active : {} } };
|
|
947
1036
|
};
|
|
948
1037
|
const shown = editing ? text : value ? getLabel(value) : "";
|
|
949
|
-
return /* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
1038
|
+
return /* @__PURE__ */ jsxs6("div", { ...partProps("root"), children: [
|
|
1039
|
+
/* @__PURE__ */ jsx7(
|
|
951
1040
|
"input",
|
|
952
1041
|
{
|
|
953
1042
|
...partProps("input"),
|
|
@@ -979,19 +1068,19 @@ function EntityPicker({
|
|
|
979
1068
|
}
|
|
980
1069
|
}
|
|
981
1070
|
),
|
|
982
|
-
name !== void 0 ? /* @__PURE__ */
|
|
983
|
-
clearable && value && !disabled ? /* @__PURE__ */
|
|
1071
|
+
name !== void 0 ? /* @__PURE__ */ jsx7("input", { type: "hidden", name, value: value ? getKey(value) : "", disabled }) : null,
|
|
1072
|
+
clearable && value && !disabled ? /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": clearLabel, ...partProps("clear"), onClick: () => {
|
|
984
1073
|
onChange(null);
|
|
985
1074
|
inputRef.current?.focus();
|
|
986
1075
|
}, children: "\xD7" }) : null,
|
|
987
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsx7("div", { role: "status", "aria-live": "polite", style: visuallyHidden2, children: announcement }),
|
|
988
1077
|
showPopup ? (
|
|
989
1078
|
// mousedown anywhere in the popup (an option, the scrollbar, a message) must not move focus out of the input, or its
|
|
990
1079
|
// blur would close the list before the click lands (and make a long list impossible to scroll by dragging)
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
showListbox ? /* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ jsxs6("div", { ...partProps("list"), onMouseDown: (event) => event.preventDefault(), children: [
|
|
1081
|
+
showListbox ? /* @__PURE__ */ jsx7("ul", { ref: listRef, id: listId, role: "listbox", "aria-label": ariaLabel, style: { listStyle: "none", margin: 0, padding: 0 }, children: results.map((item, index) => {
|
|
993
1082
|
const active = index === activeIndex;
|
|
994
|
-
return /* @__PURE__ */
|
|
1083
|
+
return /* @__PURE__ */ jsx7(
|
|
995
1084
|
"li",
|
|
996
1085
|
{
|
|
997
1086
|
id: `${listId}-opt-${index}`,
|
|
@@ -1007,9 +1096,9 @@ function EntityPicker({
|
|
|
1007
1096
|
getKey(item)
|
|
1008
1097
|
);
|
|
1009
1098
|
}) }) : null,
|
|
1010
|
-
status === "loading" ? /* @__PURE__ */
|
|
1011
|
-
status === "error" ? /* @__PURE__ */
|
|
1012
|
-
status === "idle" && searched && results.length === 0 ? /* @__PURE__ */
|
|
1099
|
+
status === "loading" ? /* @__PURE__ */ jsx7("div", { "aria-hidden": "true", "data-entity-picker-message": "loading", ...partProps("message"), children: loadingText }) : null,
|
|
1100
|
+
status === "error" ? /* @__PURE__ */ jsx7("div", { "aria-hidden": "true", "data-entity-picker-message": "error", ...partProps("message"), children: errorText }) : null,
|
|
1101
|
+
status === "idle" && searched && results.length === 0 ? /* @__PURE__ */ jsx7("div", { "aria-hidden": "true", "data-entity-picker-message": "empty", ...partProps("message"), children: emptyText }) : null
|
|
1013
1102
|
] })
|
|
1014
1103
|
) : null
|
|
1015
1104
|
] });
|
|
@@ -1069,7 +1158,7 @@ var editableStyle = {
|
|
|
1069
1158
|
};
|
|
1070
1159
|
|
|
1071
1160
|
// src/components/rich-text-editor.tsx
|
|
1072
|
-
import { jsx as
|
|
1161
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1073
1162
|
var TOOLBAR_BUTTONS = [
|
|
1074
1163
|
{ command: "bold", label: "B", ariaLabel: "Bold" },
|
|
1075
1164
|
{ command: "italic", label: "I", ariaLabel: "Italic" },
|
|
@@ -1139,7 +1228,7 @@ function RichTextEditor({
|
|
|
1139
1228
|
runCommand("createLink", url);
|
|
1140
1229
|
}, [runCommand]);
|
|
1141
1230
|
if (!editable) {
|
|
1142
|
-
return /* @__PURE__ */
|
|
1231
|
+
return /* @__PURE__ */ jsx8(
|
|
1143
1232
|
"div",
|
|
1144
1233
|
{
|
|
1145
1234
|
className: [className, "ordinatio-rte", "ordinatio-rte-readonly"].filter(Boolean).join(" "),
|
|
@@ -1148,9 +1237,9 @@ function RichTextEditor({
|
|
|
1148
1237
|
}
|
|
1149
1238
|
);
|
|
1150
1239
|
}
|
|
1151
|
-
return /* @__PURE__ */
|
|
1152
|
-
/* @__PURE__ */
|
|
1153
|
-
TOOLBAR_BUTTONS.map((btn) => /* @__PURE__ */
|
|
1240
|
+
return /* @__PURE__ */ jsxs7("div", { className: [className, "ordinatio-rte"].filter(Boolean).join(" "), style: className ? style : { ...containerStyle, ...style }, children: [
|
|
1241
|
+
/* @__PURE__ */ jsxs7("div", { className: "ordinatio-rte-toolbar", style: toolbarStyle, children: [
|
|
1242
|
+
TOOLBAR_BUTTONS.map((btn) => /* @__PURE__ */ jsx8(
|
|
1154
1243
|
"button",
|
|
1155
1244
|
{
|
|
1156
1245
|
type: "button",
|
|
@@ -1164,7 +1253,7 @@ function RichTextEditor({
|
|
|
1164
1253
|
},
|
|
1165
1254
|
btn.command
|
|
1166
1255
|
)),
|
|
1167
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ jsx8(
|
|
1168
1257
|
"button",
|
|
1169
1258
|
{
|
|
1170
1259
|
type: "button",
|
|
@@ -1177,10 +1266,10 @@ function RichTextEditor({
|
|
|
1177
1266
|
children: "\u{1F517}"
|
|
1178
1267
|
}
|
|
1179
1268
|
),
|
|
1180
|
-
toolbarRight ? /* @__PURE__ */
|
|
1269
|
+
toolbarRight ? /* @__PURE__ */ jsx8("div", { className: "ordinatio-rte-toolbar-right", style: toolbarRightStyle, children: toolbarRight }) : null
|
|
1181
1270
|
] }),
|
|
1182
|
-
linkError ? /* @__PURE__ */
|
|
1183
|
-
/* @__PURE__ */
|
|
1271
|
+
linkError ? /* @__PURE__ */ jsx8("div", { className: "ordinatio-rte-link-error", role: "alert", style: linkErrorStyle, children: linkError }) : null,
|
|
1272
|
+
/* @__PURE__ */ jsxs7("div", { className: "ordinatio-rte-editable-wrap", style: { position: "relative" }, children: [
|
|
1184
1273
|
isEmpty ? (
|
|
1185
1274
|
// Shown while empty REGARDLESS of focus — WorldClass cycle 1:
|
|
1186
1275
|
// the prior `isEmpty && !isFocused` condition hid the
|
|
@@ -1189,7 +1278,7 @@ function RichTextEditor({
|
|
|
1189
1278
|
// the click landed. Matches native `<textarea placeholder>`
|
|
1190
1279
|
// behavior (visible while focused-and-empty, removed only once
|
|
1191
1280
|
// the user types).
|
|
1192
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ jsx8(
|
|
1193
1282
|
"div",
|
|
1194
1283
|
{
|
|
1195
1284
|
"aria-hidden": "true",
|
|
@@ -1199,7 +1288,7 @@ function RichTextEditor({
|
|
|
1199
1288
|
}
|
|
1200
1289
|
)
|
|
1201
1290
|
) : null,
|
|
1202
|
-
/* @__PURE__ */
|
|
1291
|
+
/* @__PURE__ */ jsx8(
|
|
1203
1292
|
"div",
|
|
1204
1293
|
{
|
|
1205
1294
|
ref: editorRef,
|
|
@@ -1311,7 +1400,7 @@ var disabledButtonStyle = {
|
|
|
1311
1400
|
};
|
|
1312
1401
|
|
|
1313
1402
|
// src/components/reply-panel.tsx
|
|
1314
|
-
import { Fragment as
|
|
1403
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1315
1404
|
function ReplyPanel({
|
|
1316
1405
|
mode = "reply",
|
|
1317
1406
|
subject,
|
|
@@ -1390,16 +1479,16 @@ function ReplyPanel({
|
|
|
1390
1479
|
if (isMountedRef.current) setSending(false);
|
|
1391
1480
|
}
|
|
1392
1481
|
};
|
|
1393
|
-
return /* @__PURE__ */
|
|
1482
|
+
return /* @__PURE__ */ jsxs8(
|
|
1394
1483
|
"div",
|
|
1395
1484
|
{
|
|
1396
1485
|
className: [className, "ordinatio-reply-panel"].filter(Boolean).join(" "),
|
|
1397
1486
|
style: className ? style : { display: "flex", flexDirection: "column", gap: "8px", ...style },
|
|
1398
1487
|
children: [
|
|
1399
|
-
/* @__PURE__ */
|
|
1400
|
-
/* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-fields", style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
|
|
1489
|
+
/* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
|
|
1490
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: toId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "To" }),
|
|
1491
|
+
/* @__PURE__ */ jsx9(
|
|
1403
1492
|
"input",
|
|
1404
1493
|
{
|
|
1405
1494
|
id: toId,
|
|
@@ -1427,7 +1516,7 @@ function ReplyPanel({
|
|
|
1427
1516
|
// and aria-controls referenced ids (ccId/bccId) that don't
|
|
1428
1517
|
// exist in the DOM until AFTER this button has already
|
|
1429
1518
|
// unmounted. A one-directional reveal, not a toggle.
|
|
1430
|
-
/* @__PURE__ */
|
|
1519
|
+
/* @__PURE__ */ jsx9(
|
|
1431
1520
|
"button",
|
|
1432
1521
|
{
|
|
1433
1522
|
type: "button",
|
|
@@ -1440,10 +1529,10 @@ function ReplyPanel({
|
|
|
1440
1529
|
)
|
|
1441
1530
|
) : null
|
|
1442
1531
|
] }),
|
|
1443
|
-
showCcBcc ? /* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1532
|
+
showCcBcc ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1533
|
+
/* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
|
|
1534
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: ccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Cc" }),
|
|
1535
|
+
/* @__PURE__ */ jsx9(
|
|
1447
1536
|
"input",
|
|
1448
1537
|
{
|
|
1449
1538
|
id: ccId,
|
|
@@ -1461,9 +1550,9 @@ function ReplyPanel({
|
|
|
1461
1550
|
}
|
|
1462
1551
|
)
|
|
1463
1552
|
] }),
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1466
|
-
/* @__PURE__ */
|
|
1553
|
+
/* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
|
|
1554
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: bccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Bcc" }),
|
|
1555
|
+
/* @__PURE__ */ jsx9(
|
|
1467
1556
|
"input",
|
|
1468
1557
|
{
|
|
1469
1558
|
id: bccId,
|
|
@@ -1482,9 +1571,9 @@ function ReplyPanel({
|
|
|
1482
1571
|
)
|
|
1483
1572
|
] })
|
|
1484
1573
|
] }) : null,
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
1487
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
|
|
1575
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: subjectId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Subject" }),
|
|
1576
|
+
/* @__PURE__ */ jsx9(
|
|
1488
1577
|
"input",
|
|
1489
1578
|
{
|
|
1490
1579
|
id: subjectId,
|
|
@@ -1503,9 +1592,9 @@ function ReplyPanel({
|
|
|
1503
1592
|
)
|
|
1504
1593
|
] })
|
|
1505
1594
|
] }),
|
|
1506
|
-
error ? /* @__PURE__ */
|
|
1507
|
-
sent && resolvedSuccessMessage ? /* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1595
|
+
error ? /* @__PURE__ */ jsx9("div", { className: "ordinatio-reply-error", role: "alert", style: errorStyle, children: error }) : null,
|
|
1596
|
+
sent && resolvedSuccessMessage ? /* @__PURE__ */ jsx9("div", { className: "ordinatio-reply-success", role: "status", style: successStyle, children: resolvedSuccessMessage }) : null,
|
|
1597
|
+
/* @__PURE__ */ jsx9(
|
|
1509
1598
|
RichTextEditor,
|
|
1510
1599
|
{
|
|
1511
1600
|
content: body,
|
|
@@ -1519,8 +1608,8 @@ function ReplyPanel({
|
|
|
1519
1608
|
locked: sending
|
|
1520
1609
|
}
|
|
1521
1610
|
),
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
showCancel && onCancel ? /* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-actions", style: actionsRowStyle, children: [
|
|
1612
|
+
showCancel && onCancel ? /* @__PURE__ */ jsx9(
|
|
1524
1613
|
"button",
|
|
1525
1614
|
{
|
|
1526
1615
|
type: "button",
|
|
@@ -1531,7 +1620,7 @@ function ReplyPanel({
|
|
|
1531
1620
|
children: "Cancel"
|
|
1532
1621
|
}
|
|
1533
1622
|
) : null,
|
|
1534
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ jsx9(
|
|
1535
1624
|
"button",
|
|
1536
1625
|
{
|
|
1537
1626
|
type: "button",
|
|
@@ -1780,7 +1869,7 @@ function getShortcut(context, action) {
|
|
|
1780
1869
|
|
|
1781
1870
|
// src/components/keyboard-shortcuts-panel.tsx
|
|
1782
1871
|
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
1783
|
-
import { Fragment as
|
|
1872
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1784
1873
|
function KeyboardShortcutsPanel({
|
|
1785
1874
|
contexts = ALL_SHORTCUT_CONTEXTS
|
|
1786
1875
|
}) {
|
|
@@ -1802,33 +1891,33 @@ function KeyboardShortcutsPanel({
|
|
|
1802
1891
|
return () => window.removeEventListener("keydown", handleKey);
|
|
1803
1892
|
}, [open]);
|
|
1804
1893
|
if (!open) return null;
|
|
1805
|
-
return /* @__PURE__ */
|
|
1806
|
-
/* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1895
|
+
/* @__PURE__ */ jsx10(
|
|
1807
1896
|
"div",
|
|
1808
1897
|
{
|
|
1809
1898
|
className: "fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",
|
|
1810
1899
|
onClick: () => setOpen(false)
|
|
1811
1900
|
}
|
|
1812
1901
|
),
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1902
|
+
/* @__PURE__ */ jsx10("div", { className: "fixed inset-x-0 top-[10%] z-50 mx-auto w-full max-w-lg", children: /* @__PURE__ */ jsxs9("div", { className: "rounded-xl border bg-background shadow-2xl overflow-hidden", children: [
|
|
1903
|
+
/* @__PURE__ */ jsxs9("div", { className: "px-6 py-4 border-b", children: [
|
|
1904
|
+
/* @__PURE__ */ jsx10("h2", { className: "text-lg font-semibold", children: "Keyboard Shortcuts" }),
|
|
1905
|
+
/* @__PURE__ */ jsxs9("p", { className: "text-sm text-muted-foreground mt-0.5", children: [
|
|
1817
1906
|
"Press ",
|
|
1818
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ jsx10("kbd", { className: "px-1.5 py-0.5 bg-muted rounded text-xs font-mono", children: "?" }),
|
|
1819
1908
|
" to toggle this panel"
|
|
1820
1909
|
] })
|
|
1821
1910
|
] }),
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ jsx10("div", { className: "px-6 py-4 max-h-[60vh] overflow-y-auto space-y-6", children: contexts.map((ctx) => /* @__PURE__ */ jsxs9("div", { children: [
|
|
1912
|
+
/* @__PURE__ */ jsx10("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2", children: ctx.label }),
|
|
1913
|
+
/* @__PURE__ */ jsx10("div", { className: "space-y-1", children: Object.entries(ctx.shortcuts).map(([key, def]) => /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between py-1", children: [
|
|
1914
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm", children: def.description }),
|
|
1915
|
+
/* @__PURE__ */ jsx10("kbd", { className: "px-2 py-0.5 bg-muted rounded text-xs font-mono min-w-[2rem] text-center", children: def.display })
|
|
1827
1916
|
] }, key)) })
|
|
1828
1917
|
] }, ctx.name)) }),
|
|
1829
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ jsxs9("div", { className: "px-6 py-3 border-t bg-muted/30 text-xs text-muted-foreground text-center", children: [
|
|
1830
1919
|
"Press ",
|
|
1831
|
-
/* @__PURE__ */
|
|
1920
|
+
/* @__PURE__ */ jsx10("kbd", { className: "px-1 py-0.5 bg-muted rounded", children: "Esc" }),
|
|
1832
1921
|
" to close"
|
|
1833
1922
|
] })
|
|
1834
1923
|
] }) })
|
|
@@ -2155,9 +2244,9 @@ function clearCache() {
|
|
|
2155
2244
|
import { useState as useState11, useEffect as useEffect12, useCallback as useCallback8 } from "react";
|
|
2156
2245
|
function usePreferences({
|
|
2157
2246
|
endpoint,
|
|
2158
|
-
defaults:
|
|
2247
|
+
defaults: defaults4
|
|
2159
2248
|
}) {
|
|
2160
|
-
const [preferences, setPreferences] = useState11(
|
|
2249
|
+
const [preferences, setPreferences] = useState11(defaults4 ?? null);
|
|
2161
2250
|
const [loading, setLoading] = useState11(true);
|
|
2162
2251
|
const [error, setError] = useState11(null);
|
|
2163
2252
|
const fetchPreferences = useCallback8(async () => {
|
|
@@ -2166,7 +2255,7 @@ function usePreferences({
|
|
|
2166
2255
|
const res = await fetch(endpoint);
|
|
2167
2256
|
if (!res.ok) {
|
|
2168
2257
|
if (res.status === 401) {
|
|
2169
|
-
setPreferences(
|
|
2258
|
+
setPreferences(defaults4 ?? null);
|
|
2170
2259
|
return;
|
|
2171
2260
|
}
|
|
2172
2261
|
throw new Error("Failed to fetch preferences");
|
|
@@ -2178,7 +2267,7 @@ function usePreferences({
|
|
|
2178
2267
|
} finally {
|
|
2179
2268
|
setLoading(false);
|
|
2180
2269
|
}
|
|
2181
|
-
}, [endpoint,
|
|
2270
|
+
}, [endpoint, defaults4]);
|
|
2182
2271
|
useEffect12(() => {
|
|
2183
2272
|
fetchPreferences();
|
|
2184
2273
|
}, [fetchPreferences]);
|
|
@@ -2536,6 +2625,7 @@ function resolveActivityIcon(name) {
|
|
|
2536
2625
|
export {
|
|
2537
2626
|
ACTIVITY_ICONS,
|
|
2538
2627
|
ALL_SHORTCUT_CONTEXTS,
|
|
2628
|
+
ActivityFeedRow,
|
|
2539
2629
|
ArchiveButton,
|
|
2540
2630
|
CLIENT_PROFILE_SHORTCUTS,
|
|
2541
2631
|
ConfirmAction,
|