@ordinatio/ui 1.5.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md 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,100 @@ 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 aboveOverlayShrunk = { ...aboveOverlay, width: "fit-content", maxWidth: "100%" };
809
+ var visuallyHidden = { position: "absolute", width: "1px", height: "1px", overflow: "hidden", clip: "rect(0 0 0 0)", whiteSpace: "nowrap" };
810
+ function ActivityFeedRow({
811
+ sentence,
812
+ time,
813
+ timeText,
814
+ href,
815
+ gone,
816
+ chips = [],
817
+ tags = [],
818
+ maxTags = 3,
819
+ tagsLabel = "Tags now",
820
+ actions,
821
+ LinkComponent = "a",
822
+ classNames
823
+ }) {
824
+ const Link = LinkComponent;
825
+ const part = (key, structural) => {
826
+ const className = classNames?.[key];
827
+ if (className) return structural ? { className, style: structural } : { className };
828
+ return { style: structural ? { ...defaults2[key], ...structural } : defaults2[key] };
829
+ };
830
+ const date = new Date(time);
831
+ const valid = !Number.isNaN(date.getTime());
832
+ const shownTime = timeText ?? (valid ? date.toLocaleString() : String(time));
833
+ const isGone = typeof gone === "string" && gone !== "";
834
+ const clickable = !isGone && typeof href === "string" && href !== "";
835
+ const shownTags = isGone ? [] : tags.slice(0, Math.max(0, maxTags));
836
+ const hiddenTags = isGone ? 0 : Math.max(0, tags.length - shownTags.length);
837
+ const shownChips = isGone ? [] : chips;
838
+ const chipNode = (chip, key, slot) => {
839
+ const content = /* @__PURE__ */ jsxs5(Fragment2, { children: [
840
+ chip.kind ? /* @__PURE__ */ jsxs5("span", { style: visuallyHidden, children: [
841
+ chip.kind,
842
+ ": "
843
+ ] }) : null,
844
+ chip.label
845
+ ] });
846
+ return chip.href ? /* @__PURE__ */ jsx6(Link, { href: chip.href, ...part(slot, aboveOverlay), children: content }, key) : /* @__PURE__ */ jsx6("span", { ...part(slot, aboveOverlay), children: content }, key);
847
+ };
848
+ return /* @__PURE__ */ jsxs5("li", { ...part("row", { position: "relative" }), children: [
849
+ /* @__PURE__ */ jsxs5("div", { ...part("main"), children: [
850
+ /* @__PURE__ */ jsxs5("span", { style: { minWidth: 0 }, children: [
851
+ clickable ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
852
+ /* @__PURE__ */ jsx6(Link, { href, ...part("sentence"), children: sentence }),
853
+ /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", ...part("arrow"), children: "\u2192" })
854
+ ] }) : /* @__PURE__ */ jsx6("span", { ...part("sentence"), children: sentence }),
855
+ isGone ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
856
+ " ",
857
+ /* @__PURE__ */ jsx6("span", { ...part("gone"), children: gone })
858
+ ] }) : null
859
+ ] }),
860
+ /* @__PURE__ */ jsx6("time", { dateTime: valid ? date.toISOString() : void 0, ...part("time"), children: shownTime })
861
+ ] }),
862
+ shownChips.length > 0 || shownTags.length > 0 || hiddenTags > 0 ? /* @__PURE__ */ jsxs5("div", { ...part("chips", aboveOverlayShrunk), children: [
863
+ shownChips.map((chip, index) => chipNode(chip, `chip-${index}`, "chip")),
864
+ shownTags.length > 0 ? /* @__PURE__ */ jsx6("span", { ...part("tagsLabel"), children: tagsLabel }) : null,
865
+ shownTags.map((tag, index) => chipNode(tag, `tag-${index}`, "tag")),
866
+ hiddenTags > 0 ? /* @__PURE__ */ jsxs5("span", { ...part("more"), children: [
867
+ "+",
868
+ hiddenTags,
869
+ /* @__PURE__ */ jsxs5("span", { style: visuallyHidden, children: [
870
+ " more ",
871
+ hiddenTags === 1 ? "tag" : "tags"
872
+ ] })
873
+ ] }) : null
874
+ ] }) : null,
875
+ actions ? /* @__PURE__ */ jsx6("div", { ...part("actions", aboveOverlayShrunk), children: actions }) : null,
876
+ clickable ? /* @__PURE__ */ jsx6(Link, { href, "aria-hidden": "true", tabIndex: -1, ...part("overlay", { position: "absolute", top: 0, right: 0, bottom: 0, left: 0 }) }) : null
877
+ ] });
878
+ }
879
+
790
880
  // src/components/entity-picker.tsx
791
881
  import { useCallback as useCallback2, useEffect as useEffect3, useId as useId2, useRef as useRef3, useState as useState4 } from "react";
792
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
793
- var defaults2 = {
882
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
883
+ var defaults3 = {
794
884
  root: { position: "relative", display: "inline-flex", alignItems: "center", gap: "4px", width: "100%" },
795
885
  input: { flex: 1, minWidth: 0, padding: "8px 10px", fontSize: "14px", border: "1px solid #d4d4d4", borderRadius: "6px", backgroundColor: "#ffffff", color: "#171717" },
796
886
  clear: { padding: "4px 8px", fontSize: "14px", border: "1px solid transparent", borderRadius: "6px", backgroundColor: "transparent", color: "#525252", cursor: "pointer" },
@@ -801,7 +891,7 @@ var optionDefaults = {
801
891
  base: { padding: "6px 8px", fontSize: "14px", borderRadius: "4px", cursor: "pointer", color: "#171717" },
802
892
  active: { backgroundColor: "#f5f5f5" }
803
893
  };
804
- var visuallyHidden = { position: "absolute", width: "1px", height: "1px", margin: "-1px", padding: 0, overflow: "hidden", clip: "rect(0 0 0 0)", whiteSpace: "nowrap", border: 0 };
894
+ 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
895
  function EntityPicker({
806
896
  value,
807
897
  onChange,
@@ -937,7 +1027,7 @@ function EntityPicker({
937
1027
  const partProps = (key) => {
938
1028
  const className = classNames?.[key];
939
1029
  if (className) return { className, style: key === "root" ? style : void 0 };
940
- return { style: key === "root" ? { ...defaults2.root, ...style } : defaults2[key] };
1030
+ return { style: key === "root" ? { ...defaults3.root, ...style } : defaults3[key] };
941
1031
  };
942
1032
  const optionProps = (active) => {
943
1033
  const optionClass = classNames?.option;
@@ -946,8 +1036,8 @@ function EntityPicker({
946
1036
  return { className, style: optionClass ? void 0 : { ...optionDefaults.base, ...active && !activeClass ? optionDefaults.active : {} } };
947
1037
  };
948
1038
  const shown = editing ? text : value ? getLabel(value) : "";
949
- return /* @__PURE__ */ jsxs5("div", { ...partProps("root"), children: [
950
- /* @__PURE__ */ jsx6(
1039
+ return /* @__PURE__ */ jsxs6("div", { ...partProps("root"), children: [
1040
+ /* @__PURE__ */ jsx7(
951
1041
  "input",
952
1042
  {
953
1043
  ...partProps("input"),
@@ -979,19 +1069,19 @@ function EntityPicker({
979
1069
  }
980
1070
  }
981
1071
  ),
982
- name !== void 0 ? /* @__PURE__ */ jsx6("input", { type: "hidden", name, value: value ? getKey(value) : "", disabled }) : null,
983
- clearable && value && !disabled ? /* @__PURE__ */ jsx6("button", { type: "button", "aria-label": clearLabel, ...partProps("clear"), onClick: () => {
1072
+ name !== void 0 ? /* @__PURE__ */ jsx7("input", { type: "hidden", name, value: value ? getKey(value) : "", disabled }) : null,
1073
+ clearable && value && !disabled ? /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": clearLabel, ...partProps("clear"), onClick: () => {
984
1074
  onChange(null);
985
1075
  inputRef.current?.focus();
986
1076
  }, children: "\xD7" }) : null,
987
- /* @__PURE__ */ jsx6("div", { role: "status", "aria-live": "polite", style: visuallyHidden, children: announcement }),
1077
+ /* @__PURE__ */ jsx7("div", { role: "status", "aria-live": "polite", style: visuallyHidden2, children: announcement }),
988
1078
  showPopup ? (
989
1079
  // mousedown anywhere in the popup (an option, the scrollbar, a message) must not move focus out of the input, or its
990
1080
  // blur would close the list before the click lands (and make a long list impossible to scroll by dragging)
991
- /* @__PURE__ */ jsxs5("div", { ...partProps("list"), onMouseDown: (event) => event.preventDefault(), children: [
992
- showListbox ? /* @__PURE__ */ jsx6("ul", { ref: listRef, id: listId, role: "listbox", "aria-label": ariaLabel, style: { listStyle: "none", margin: 0, padding: 0 }, children: results.map((item, index) => {
1081
+ /* @__PURE__ */ jsxs6("div", { ...partProps("list"), onMouseDown: (event) => event.preventDefault(), children: [
1082
+ 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
1083
  const active = index === activeIndex;
994
- return /* @__PURE__ */ jsx6(
1084
+ return /* @__PURE__ */ jsx7(
995
1085
  "li",
996
1086
  {
997
1087
  id: `${listId}-opt-${index}`,
@@ -1007,9 +1097,9 @@ function EntityPicker({
1007
1097
  getKey(item)
1008
1098
  );
1009
1099
  }) }) : null,
1010
- status === "loading" ? /* @__PURE__ */ jsx6("div", { "aria-hidden": "true", "data-entity-picker-message": "loading", ...partProps("message"), children: loadingText }) : null,
1011
- status === "error" ? /* @__PURE__ */ jsx6("div", { "aria-hidden": "true", "data-entity-picker-message": "error", ...partProps("message"), children: errorText }) : null,
1012
- status === "idle" && searched && results.length === 0 ? /* @__PURE__ */ jsx6("div", { "aria-hidden": "true", "data-entity-picker-message": "empty", ...partProps("message"), children: emptyText }) : null
1100
+ status === "loading" ? /* @__PURE__ */ jsx7("div", { "aria-hidden": "true", "data-entity-picker-message": "loading", ...partProps("message"), children: loadingText }) : null,
1101
+ status === "error" ? /* @__PURE__ */ jsx7("div", { "aria-hidden": "true", "data-entity-picker-message": "error", ...partProps("message"), children: errorText }) : null,
1102
+ status === "idle" && searched && results.length === 0 ? /* @__PURE__ */ jsx7("div", { "aria-hidden": "true", "data-entity-picker-message": "empty", ...partProps("message"), children: emptyText }) : null
1013
1103
  ] })
1014
1104
  ) : null
1015
1105
  ] });
@@ -1069,7 +1159,7 @@ var editableStyle = {
1069
1159
  };
1070
1160
 
1071
1161
  // src/components/rich-text-editor.tsx
1072
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1162
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1073
1163
  var TOOLBAR_BUTTONS = [
1074
1164
  { command: "bold", label: "B", ariaLabel: "Bold" },
1075
1165
  { command: "italic", label: "I", ariaLabel: "Italic" },
@@ -1139,7 +1229,7 @@ function RichTextEditor({
1139
1229
  runCommand("createLink", url);
1140
1230
  }, [runCommand]);
1141
1231
  if (!editable) {
1142
- return /* @__PURE__ */ jsx7(
1232
+ return /* @__PURE__ */ jsx8(
1143
1233
  "div",
1144
1234
  {
1145
1235
  className: [className, "ordinatio-rte", "ordinatio-rte-readonly"].filter(Boolean).join(" "),
@@ -1148,9 +1238,9 @@ function RichTextEditor({
1148
1238
  }
1149
1239
  );
1150
1240
  }
1151
- return /* @__PURE__ */ jsxs6("div", { className: [className, "ordinatio-rte"].filter(Boolean).join(" "), style: className ? style : { ...containerStyle, ...style }, children: [
1152
- /* @__PURE__ */ jsxs6("div", { className: "ordinatio-rte-toolbar", style: toolbarStyle, children: [
1153
- TOOLBAR_BUTTONS.map((btn) => /* @__PURE__ */ jsx7(
1241
+ return /* @__PURE__ */ jsxs7("div", { className: [className, "ordinatio-rte"].filter(Boolean).join(" "), style: className ? style : { ...containerStyle, ...style }, children: [
1242
+ /* @__PURE__ */ jsxs7("div", { className: "ordinatio-rte-toolbar", style: toolbarStyle, children: [
1243
+ TOOLBAR_BUTTONS.map((btn) => /* @__PURE__ */ jsx8(
1154
1244
  "button",
1155
1245
  {
1156
1246
  type: "button",
@@ -1164,7 +1254,7 @@ function RichTextEditor({
1164
1254
  },
1165
1255
  btn.command
1166
1256
  )),
1167
- /* @__PURE__ */ jsx7(
1257
+ /* @__PURE__ */ jsx8(
1168
1258
  "button",
1169
1259
  {
1170
1260
  type: "button",
@@ -1177,10 +1267,10 @@ function RichTextEditor({
1177
1267
  children: "\u{1F517}"
1178
1268
  }
1179
1269
  ),
1180
- toolbarRight ? /* @__PURE__ */ jsx7("div", { className: "ordinatio-rte-toolbar-right", style: toolbarRightStyle, children: toolbarRight }) : null
1270
+ toolbarRight ? /* @__PURE__ */ jsx8("div", { className: "ordinatio-rte-toolbar-right", style: toolbarRightStyle, children: toolbarRight }) : null
1181
1271
  ] }),
1182
- linkError ? /* @__PURE__ */ jsx7("div", { className: "ordinatio-rte-link-error", role: "alert", style: linkErrorStyle, children: linkError }) : null,
1183
- /* @__PURE__ */ jsxs6("div", { className: "ordinatio-rte-editable-wrap", style: { position: "relative" }, children: [
1272
+ linkError ? /* @__PURE__ */ jsx8("div", { className: "ordinatio-rte-link-error", role: "alert", style: linkErrorStyle, children: linkError }) : null,
1273
+ /* @__PURE__ */ jsxs7("div", { className: "ordinatio-rte-editable-wrap", style: { position: "relative" }, children: [
1184
1274
  isEmpty ? (
1185
1275
  // Shown while empty REGARDLESS of focus — WorldClass cycle 1:
1186
1276
  // the prior `isEmpty && !isFocused` condition hid the
@@ -1189,7 +1279,7 @@ function RichTextEditor({
1189
1279
  // the click landed. Matches native `<textarea placeholder>`
1190
1280
  // behavior (visible while focused-and-empty, removed only once
1191
1281
  // the user types).
1192
- /* @__PURE__ */ jsx7(
1282
+ /* @__PURE__ */ jsx8(
1193
1283
  "div",
1194
1284
  {
1195
1285
  "aria-hidden": "true",
@@ -1199,7 +1289,7 @@ function RichTextEditor({
1199
1289
  }
1200
1290
  )
1201
1291
  ) : null,
1202
- /* @__PURE__ */ jsx7(
1292
+ /* @__PURE__ */ jsx8(
1203
1293
  "div",
1204
1294
  {
1205
1295
  ref: editorRef,
@@ -1311,7 +1401,7 @@ var disabledButtonStyle = {
1311
1401
  };
1312
1402
 
1313
1403
  // src/components/reply-panel.tsx
1314
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1404
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1315
1405
  function ReplyPanel({
1316
1406
  mode = "reply",
1317
1407
  subject,
@@ -1390,16 +1480,16 @@ function ReplyPanel({
1390
1480
  if (isMountedRef.current) setSending(false);
1391
1481
  }
1392
1482
  };
1393
- return /* @__PURE__ */ jsxs7(
1483
+ return /* @__PURE__ */ jsxs8(
1394
1484
  "div",
1395
1485
  {
1396
1486
  className: [className, "ordinatio-reply-panel"].filter(Boolean).join(" "),
1397
1487
  style: className ? style : { display: "flex", flexDirection: "column", gap: "8px", ...style },
1398
1488
  children: [
1399
- /* @__PURE__ */ jsxs7("div", { className: "ordinatio-reply-fields", style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
1400
- /* @__PURE__ */ jsxs7("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1401
- /* @__PURE__ */ jsx8("label", { htmlFor: toId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "To" }),
1402
- /* @__PURE__ */ jsx8(
1489
+ /* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-fields", style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
1490
+ /* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1491
+ /* @__PURE__ */ jsx9("label", { htmlFor: toId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "To" }),
1492
+ /* @__PURE__ */ jsx9(
1403
1493
  "input",
1404
1494
  {
1405
1495
  id: toId,
@@ -1427,7 +1517,7 @@ function ReplyPanel({
1427
1517
  // and aria-controls referenced ids (ccId/bccId) that don't
1428
1518
  // exist in the DOM until AFTER this button has already
1429
1519
  // unmounted. A one-directional reveal, not a toggle.
1430
- /* @__PURE__ */ jsx8(
1520
+ /* @__PURE__ */ jsx9(
1431
1521
  "button",
1432
1522
  {
1433
1523
  type: "button",
@@ -1440,10 +1530,10 @@ function ReplyPanel({
1440
1530
  )
1441
1531
  ) : null
1442
1532
  ] }),
1443
- showCcBcc ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
1444
- /* @__PURE__ */ jsxs7("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1445
- /* @__PURE__ */ jsx8("label", { htmlFor: ccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Cc" }),
1446
- /* @__PURE__ */ jsx8(
1533
+ showCcBcc ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
1534
+ /* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1535
+ /* @__PURE__ */ jsx9("label", { htmlFor: ccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Cc" }),
1536
+ /* @__PURE__ */ jsx9(
1447
1537
  "input",
1448
1538
  {
1449
1539
  id: ccId,
@@ -1461,9 +1551,9 @@ function ReplyPanel({
1461
1551
  }
1462
1552
  )
1463
1553
  ] }),
1464
- /* @__PURE__ */ jsxs7("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1465
- /* @__PURE__ */ jsx8("label", { htmlFor: bccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Bcc" }),
1466
- /* @__PURE__ */ jsx8(
1554
+ /* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1555
+ /* @__PURE__ */ jsx9("label", { htmlFor: bccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Bcc" }),
1556
+ /* @__PURE__ */ jsx9(
1467
1557
  "input",
1468
1558
  {
1469
1559
  id: bccId,
@@ -1482,9 +1572,9 @@ function ReplyPanel({
1482
1572
  )
1483
1573
  ] })
1484
1574
  ] }) : null,
1485
- /* @__PURE__ */ jsxs7("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1486
- /* @__PURE__ */ jsx8("label", { htmlFor: subjectId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Subject" }),
1487
- /* @__PURE__ */ jsx8(
1575
+ /* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1576
+ /* @__PURE__ */ jsx9("label", { htmlFor: subjectId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Subject" }),
1577
+ /* @__PURE__ */ jsx9(
1488
1578
  "input",
1489
1579
  {
1490
1580
  id: subjectId,
@@ -1503,9 +1593,9 @@ function ReplyPanel({
1503
1593
  )
1504
1594
  ] })
1505
1595
  ] }),
1506
- error ? /* @__PURE__ */ jsx8("div", { className: "ordinatio-reply-error", role: "alert", style: errorStyle, children: error }) : null,
1507
- sent && resolvedSuccessMessage ? /* @__PURE__ */ jsx8("div", { className: "ordinatio-reply-success", role: "status", style: successStyle, children: resolvedSuccessMessage }) : null,
1508
- /* @__PURE__ */ jsx8(
1596
+ error ? /* @__PURE__ */ jsx9("div", { className: "ordinatio-reply-error", role: "alert", style: errorStyle, children: error }) : null,
1597
+ sent && resolvedSuccessMessage ? /* @__PURE__ */ jsx9("div", { className: "ordinatio-reply-success", role: "status", style: successStyle, children: resolvedSuccessMessage }) : null,
1598
+ /* @__PURE__ */ jsx9(
1509
1599
  RichTextEditor,
1510
1600
  {
1511
1601
  content: body,
@@ -1519,8 +1609,8 @@ function ReplyPanel({
1519
1609
  locked: sending
1520
1610
  }
1521
1611
  ),
1522
- /* @__PURE__ */ jsxs7("div", { className: "ordinatio-reply-actions", style: actionsRowStyle, children: [
1523
- showCancel && onCancel ? /* @__PURE__ */ jsx8(
1612
+ /* @__PURE__ */ jsxs8("div", { className: "ordinatio-reply-actions", style: actionsRowStyle, children: [
1613
+ showCancel && onCancel ? /* @__PURE__ */ jsx9(
1524
1614
  "button",
1525
1615
  {
1526
1616
  type: "button",
@@ -1531,7 +1621,7 @@ function ReplyPanel({
1531
1621
  children: "Cancel"
1532
1622
  }
1533
1623
  ) : null,
1534
- /* @__PURE__ */ jsx8(
1624
+ /* @__PURE__ */ jsx9(
1535
1625
  "button",
1536
1626
  {
1537
1627
  type: "button",
@@ -1780,7 +1870,7 @@ function getShortcut(context, action) {
1780
1870
 
1781
1871
  // src/components/keyboard-shortcuts-panel.tsx
1782
1872
  import { useEffect as useEffect7, useState as useState7 } from "react";
1783
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1873
+ import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1784
1874
  function KeyboardShortcutsPanel({
1785
1875
  contexts = ALL_SHORTCUT_CONTEXTS
1786
1876
  }) {
@@ -1802,33 +1892,33 @@ function KeyboardShortcutsPanel({
1802
1892
  return () => window.removeEventListener("keydown", handleKey);
1803
1893
  }, [open]);
1804
1894
  if (!open) return null;
1805
- return /* @__PURE__ */ jsxs8(Fragment3, { children: [
1806
- /* @__PURE__ */ jsx9(
1895
+ return /* @__PURE__ */ jsxs9(Fragment4, { children: [
1896
+ /* @__PURE__ */ jsx10(
1807
1897
  "div",
1808
1898
  {
1809
1899
  className: "fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",
1810
1900
  onClick: () => setOpen(false)
1811
1901
  }
1812
1902
  ),
1813
- /* @__PURE__ */ jsx9("div", { className: "fixed inset-x-0 top-[10%] z-50 mx-auto w-full max-w-lg", children: /* @__PURE__ */ jsxs8("div", { className: "rounded-xl border bg-background shadow-2xl overflow-hidden", children: [
1814
- /* @__PURE__ */ jsxs8("div", { className: "px-6 py-4 border-b", children: [
1815
- /* @__PURE__ */ jsx9("h2", { className: "text-lg font-semibold", children: "Keyboard Shortcuts" }),
1816
- /* @__PURE__ */ jsxs8("p", { className: "text-sm text-muted-foreground mt-0.5", children: [
1903
+ /* @__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: [
1904
+ /* @__PURE__ */ jsxs9("div", { className: "px-6 py-4 border-b", children: [
1905
+ /* @__PURE__ */ jsx10("h2", { className: "text-lg font-semibold", children: "Keyboard Shortcuts" }),
1906
+ /* @__PURE__ */ jsxs9("p", { className: "text-sm text-muted-foreground mt-0.5", children: [
1817
1907
  "Press ",
1818
- /* @__PURE__ */ jsx9("kbd", { className: "px-1.5 py-0.5 bg-muted rounded text-xs font-mono", children: "?" }),
1908
+ /* @__PURE__ */ jsx10("kbd", { className: "px-1.5 py-0.5 bg-muted rounded text-xs font-mono", children: "?" }),
1819
1909
  " to toggle this panel"
1820
1910
  ] })
1821
1911
  ] }),
1822
- /* @__PURE__ */ jsx9("div", { className: "px-6 py-4 max-h-[60vh] overflow-y-auto space-y-6", children: contexts.map((ctx) => /* @__PURE__ */ jsxs8("div", { children: [
1823
- /* @__PURE__ */ jsx9("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2", children: ctx.label }),
1824
- /* @__PURE__ */ jsx9("div", { className: "space-y-1", children: Object.entries(ctx.shortcuts).map(([key, def]) => /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between py-1", children: [
1825
- /* @__PURE__ */ jsx9("span", { className: "text-sm", children: def.description }),
1826
- /* @__PURE__ */ jsx9("kbd", { className: "px-2 py-0.5 bg-muted rounded text-xs font-mono min-w-[2rem] text-center", children: def.display })
1912
+ /* @__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: [
1913
+ /* @__PURE__ */ jsx10("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2", children: ctx.label }),
1914
+ /* @__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: [
1915
+ /* @__PURE__ */ jsx10("span", { className: "text-sm", children: def.description }),
1916
+ /* @__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
1917
  ] }, key)) })
1828
1918
  ] }, ctx.name)) }),
1829
- /* @__PURE__ */ jsxs8("div", { className: "px-6 py-3 border-t bg-muted/30 text-xs text-muted-foreground text-center", children: [
1919
+ /* @__PURE__ */ jsxs9("div", { className: "px-6 py-3 border-t bg-muted/30 text-xs text-muted-foreground text-center", children: [
1830
1920
  "Press ",
1831
- /* @__PURE__ */ jsx9("kbd", { className: "px-1 py-0.5 bg-muted rounded", children: "Esc" }),
1921
+ /* @__PURE__ */ jsx10("kbd", { className: "px-1 py-0.5 bg-muted rounded", children: "Esc" }),
1832
1922
  " to close"
1833
1923
  ] })
1834
1924
  ] }) })
@@ -2155,9 +2245,9 @@ function clearCache() {
2155
2245
  import { useState as useState11, useEffect as useEffect12, useCallback as useCallback8 } from "react";
2156
2246
  function usePreferences({
2157
2247
  endpoint,
2158
- defaults: defaults3
2248
+ defaults: defaults4
2159
2249
  }) {
2160
- const [preferences, setPreferences] = useState11(defaults3 ?? null);
2250
+ const [preferences, setPreferences] = useState11(defaults4 ?? null);
2161
2251
  const [loading, setLoading] = useState11(true);
2162
2252
  const [error, setError] = useState11(null);
2163
2253
  const fetchPreferences = useCallback8(async () => {
@@ -2166,7 +2256,7 @@ function usePreferences({
2166
2256
  const res = await fetch(endpoint);
2167
2257
  if (!res.ok) {
2168
2258
  if (res.status === 401) {
2169
- setPreferences(defaults3 ?? null);
2259
+ setPreferences(defaults4 ?? null);
2170
2260
  return;
2171
2261
  }
2172
2262
  throw new Error("Failed to fetch preferences");
@@ -2178,7 +2268,7 @@ function usePreferences({
2178
2268
  } finally {
2179
2269
  setLoading(false);
2180
2270
  }
2181
- }, [endpoint, defaults3]);
2271
+ }, [endpoint, defaults4]);
2182
2272
  useEffect12(() => {
2183
2273
  fetchPreferences();
2184
2274
  }, [fetchPreferences]);
@@ -2536,6 +2626,7 @@ function resolveActivityIcon(name) {
2536
2626
  export {
2537
2627
  ACTIVITY_ICONS,
2538
2628
  ALL_SHORTCUT_CONTEXTS,
2629
+ ActivityFeedRow,
2539
2630
  ArchiveButton,
2540
2631
  CLIENT_PROFILE_SHORTCUTS,
2541
2632
  ConfirmAction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ordinatio/ui",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Reusable React components and hooks for Ordinatio applications",