@letterncms/ui 0.0.0-stage → 0.1.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.
Files changed (77) hide show
  1. package/LICENSE.md +21 -0
  2. package/package.json +23 -5
  3. package/src/app/App.d.ts +3 -0
  4. package/src/app/Brand.d.ts +5 -0
  5. package/src/app/CommandPalette.d.ts +4 -0
  6. package/src/app/CustomizeSidebar.d.ts +8 -0
  7. package/src/app/ErrorBoundary.d.ts +16 -0
  8. package/src/app/Root.d.ts +1 -0
  9. package/src/app/Sidebar.d.ts +15 -0
  10. package/src/app/modules.d.ts +21 -0
  11. package/src/app/sidebarStore.d.ts +30 -0
  12. package/src/fields/CommandQueryField.d.ts +3 -0
  13. package/src/fields/FieldsEditor.d.ts +28 -0
  14. package/src/fields/LinkField.d.ts +16 -0
  15. package/src/fields/RichTextField.d.ts +6 -0
  16. package/src/fields/basic.d.ts +17 -0
  17. package/src/fields/complex.d.ts +6 -0
  18. package/src/fields/index.d.ts +6 -0
  19. package/src/lib/icon-data.d.ts +1 -0
  20. package/src/main.d.ts +1 -0
  21. package/src/screens/NotFound.d.ts +1 -0
  22. package/src/screens/auth/AuthScreen.d.ts +4 -0
  23. package/src/ui/Avatar.d.ts +16 -0
  24. package/src/ui/Badge.d.ts +14 -0
  25. package/src/ui/BlueprintEditor.d.ts +48 -0
  26. package/src/ui/Button.d.ts +19 -0
  27. package/src/ui/ComponentBoundary.d.ts +17 -0
  28. package/src/ui/DataCalendar.d.ts +23 -0
  29. package/src/ui/DataGrid.d.ts +22 -0
  30. package/src/ui/DataTable.d.ts +68 -0
  31. package/src/ui/DataView.d.ts +44 -0
  32. package/src/ui/Dialog.d.ts +32 -0
  33. package/src/ui/EmptyState.d.ts +8 -0
  34. package/src/ui/Field.d.ts +12 -0
  35. package/src/ui/Fields.d.ts +18 -0
  36. package/src/ui/Icon.d.ts +8 -0
  37. package/src/ui/Input.d.ts +15 -0
  38. package/src/ui/InspectorPanel.d.ts +11 -0
  39. package/src/ui/Kbd.d.ts +5 -0
  40. package/src/ui/List.d.ts +14 -0
  41. package/src/ui/Marquee.d.ts +5 -0
  42. package/src/ui/Menu.d.ts +37 -0
  43. package/src/ui/Page.d.ts +31 -0
  44. package/src/ui/PagePagination.d.ts +7 -0
  45. package/src/ui/PersonPicker.d.ts +12 -0
  46. package/src/ui/Popover.d.ts +13 -0
  47. package/src/ui/QueryError.d.ts +6 -0
  48. package/src/ui/Segmented.d.ts +36 -0
  49. package/src/ui/Select.d.ts +25 -0
  50. package/src/ui/SelectionBar.d.ts +7 -0
  51. package/src/ui/SidebarRow.d.ts +31 -0
  52. package/src/ui/Slideover.d.ts +21 -0
  53. package/src/ui/SortableTree.d.ts +30 -0
  54. package/src/ui/Spinner.d.ts +7 -0
  55. package/src/ui/Surface.d.ts +8 -0
  56. package/src/ui/SurfaceHost.d.ts +2 -0
  57. package/src/ui/Switch.d.ts +16 -0
  58. package/src/ui/Tooltip.d.ts +10 -0
  59. package/src/ui/ViewControls.d.ts +36 -0
  60. package/src/ui/Widget.d.ts +121 -0
  61. package/src/ui/WidgetSlot.d.ts +7 -0
  62. package/src/ui/calendar.d.ts +10 -0
  63. package/src/ui/cn.d.ts +2 -0
  64. package/src/ui/dateTime.d.ts +6 -0
  65. package/src/ui/entryActions.d.ts +13 -0
  66. package/src/ui/entryDisplay.d.ts +16 -0
  67. package/src/ui/fieldIdentity.d.ts +3 -0
  68. package/src/ui/index.d.ts +72 -0
  69. package/src/ui/overviewSource.d.ts +16 -0
  70. package/src/ui/recordDates.d.ts +13 -0
  71. package/src/ui/recordNavigation.d.ts +10 -0
  72. package/src/ui/shortcuts.d.ts +4 -0
  73. package/src/ui/slugify.d.ts +2 -0
  74. package/src/ui/theme.d.ts +4 -0
  75. package/src/ui/toast.d.ts +14 -0
  76. package/src/ui/viewPrefs.d.ts +17 -0
  77. package/README.md +0 -3
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @letterncms/ui — the admin theme's primitives: components, field editors and the small hooks
3
+ * every screen needs (shortcuts, color scheme, slugs). Shared with every module and plugin
4
+ * through the import map; screens themselves live in modules.
5
+ */
6
+ export { cn } from './cn';
7
+ export { Marquee } from './Marquee';
8
+ export { SidebarRow } from './SidebarRow';
9
+ export type { SidebarRowAction, SidebarRowProps } from './SidebarRow';
10
+ export { Icon } from './Icon';
11
+ export type { IconProps } from './Icon';
12
+ export { Button, IconButton } from './Button';
13
+ export type { ButtonProps, IconButtonProps, ButtonVariant, ButtonSize } from './Button';
14
+ export { Spinner, Skeleton } from './Spinner';
15
+ export { Input, Textarea } from './Input';
16
+ export { Kbd } from './Kbd';
17
+ export { Badge, StatusDot, statusLabel } from './Badge';
18
+ export type { Tone } from './Badge';
19
+ export { Avatar, AvatarStack } from './Avatar';
20
+ export { Tooltip, TooltipProvider } from './Tooltip';
21
+ export { Popover } from './Popover';
22
+ export { Menu, MenuButton, ContextMenu } from './Menu';
23
+ export type { MenuItemDef } from './Menu';
24
+ export { Dialog, confirm, prompt } from './Dialog';
25
+ export { Slideover } from './Slideover';
26
+ export { InspectorPanel, useWideInspector } from './InspectorPanel';
27
+ export { PersonPicker } from './PersonPicker';
28
+ export { QueryError } from './QueryError';
29
+ export { entryActionAvailability } from './entryActions';
30
+ export { fieldControlId } from './fieldIdentity';
31
+ export { Select } from './Select';
32
+ export type { SelectOption } from './Select';
33
+ export { Switch, Checkbox } from './Switch';
34
+ export { Segmented, Tabs } from './Segmented';
35
+ export { Field } from './Field';
36
+ export { EmptyState } from './EmptyState';
37
+ export { Page, Topbar, Section } from './Page';
38
+ export type { Crumb } from './Page';
39
+ export { List, Row } from './List';
40
+ export { Widget, WidgetContext, useWidget, WidgetRow, WidgetMessage, WidgetSkeleton, Stat, Delta, Sparkline, Meter, BarRow, compactNumber } from './Widget';
41
+ export type { WidgetMeta, WidgetProps, WidgetEmpty } from './Widget';
42
+ export { Toaster, toast } from './toast';
43
+ export { Fields } from './Fields';
44
+ export type { FieldsProps } from './Fields';
45
+ export { SortableTree } from './SortableTree';
46
+ export type { SortableTreeProps, TreeItem } from './SortableTree';
47
+ export { useShortcut } from './shortcuts';
48
+ export { slugify } from './slugify';
49
+ export { getThemePreference, setThemePreference } from './theme';
50
+ export type { ThemePreference } from './theme';
51
+ export { BlueprintEditor } from './BlueprintEditor';
52
+ export type { BlueprintKind, BlueprintDefinition } from './BlueprintEditor';
53
+ export { FieldsEditor } from '../fields/FieldsEditor';
54
+ export type { RawField } from '../fields/FieldsEditor';
55
+ export { DataTable, TableFrame, TableRow, TableHeader, TableSkeleton, TableToolbar } from './DataTable';
56
+ export { DataView } from './DataView';
57
+ export { DataCalendar } from './DataCalendar';
58
+ export { calendarRange, calendarDayKey } from './calendar';
59
+ export { useOverviewSource, loadOverviewSource } from './overviewSource';
60
+ export type { OverviewSource } from './overviewSource';
61
+ export { DateCell, longDate, shortDate, recordDateColumnIds, recordDateColumns, withRecordDateColumns } from './recordDates';
62
+ export type { DataColumn, DataSelection } from './DataTable';
63
+ export { DataGrid, DataCard } from './DataGrid';
64
+ export { DisplayOptions, ViewSwitcher, OverviewControls, nextTableSort } from './ViewControls';
65
+ export { readViewPrefs, useViewPrefs } from './viewPrefs';
66
+ export type { ViewPrefs, ViewPrefsChange, CalendarDate } from './viewPrefs';
67
+ export { entryFieldColumns, entrySystemColumns, fieldColumnId, standardEntryColumns } from './entryDisplay';
68
+ export { SelectionBar } from './SelectionBar';
69
+ export { PagePagination } from './PagePagination';
70
+ export { useRecordNavigation } from './recordNavigation';
71
+ export { WidgetSlot } from './WidgetSlot';
72
+ export { Surface } from './SurfaceHost';
@@ -0,0 +1,16 @@
1
+ import { type Page } from '@letterncms/sdk';
2
+ /** Only source data varies by screen; loading every page belongs to the shared view. */
3
+ export interface OverviewSource {
4
+ ability: string;
5
+ input?: Record<string, unknown>;
6
+ perPage?: number;
7
+ }
8
+ /** Preload the same first page used by the calendar, without duplicating query keys. */
9
+ export declare function loadOverviewSource<T>(source: OverviewSource): Promise<Page<T>>;
10
+ export declare function useOverviewSource<T>(source: OverviewSource | undefined, enabled: boolean): {
11
+ items: T[];
12
+ loading: boolean;
13
+ stale: boolean;
14
+ error: boolean;
15
+ retry: () => void;
16
+ };
@@ -0,0 +1,13 @@
1
+ import { type RecordTimestamps } from '@letterncms/sdk';
2
+ import type { DataColumn } from './DataTable';
3
+ /** The same date formatting and metadata columns in every overview. */
4
+ export declare const recordDateColumnIds: readonly ['published', 'updated'];
5
+ export declare function shortDate(iso: string): string;
6
+ export declare function longDate(iso: string): string;
7
+ export declare function DateCell({ iso, relative }: {
8
+ iso: string | null | undefined;
9
+ relative?: boolean;
10
+ }): import("react").JSX.Element;
11
+ export declare function recordDateColumns<T>(dates: (item: T) => Partial<RecordTimestamps>, sort?: Partial<Record<'published' | 'updated', string>>): DataColumn<T>[];
12
+ /** Called by DataView so new screens inherit the metadata without per-screen columns. */
13
+ export declare function withRecordDateColumns<T>(columns: DataColumn<T>[], dates: (item: T) => Partial<RecordTimestamps>, sort?: Partial<Record<'published' | 'updated', string>>): DataColumn<T>[];
@@ -0,0 +1,10 @@
1
+ import { type RefObject } from 'react';
2
+ import type { DataSelection } from './DataTable';
3
+ /** Consistent j/k, x, Enter and Escape behavior in overview tables and cards. */
4
+ export declare function useRecordNavigation<T>({ resetKey, onOpen, selection, enabled, scope }: {
5
+ scope?: RefObject<HTMLElement | null>;
6
+ resetKey: string;
7
+ onOpen?: (id: string) => void;
8
+ selection?: DataSelection<T>;
9
+ enabled?: boolean;
10
+ }): string | null;
@@ -0,0 +1,4 @@
1
+ /** Parse "mod+shift+k" and match a KeyboardEvent. Shift and Option change the character (⇧, gives <), so the key is matched by its position too. */
2
+ export declare function matches(event: KeyboardEvent, combo: string): boolean;
3
+ /** Global keyboard shortcut; ignores plain keys while typing. */
4
+ export declare function useShortcut(combo: string, handler: (e: KeyboardEvent) => void, enabled?: boolean): void;
@@ -0,0 +1,2 @@
1
+ /** A URL-safe slug from any text ("Über uns" → "uber-uns"). While typing, a trailing dash is kept. */
2
+ export declare function slugify(value: string, typing?: boolean): string;
@@ -0,0 +1,4 @@
1
+ export type ThemePreference = 'light' | 'dark' | 'system';
2
+ export declare function getThemePreference(): ThemePreference;
3
+ export declare function setThemePreference(pref: ThemePreference): void;
4
+ export declare function applyTheme(): void;
@@ -0,0 +1,14 @@
1
+ import { toast as sonner } from 'sonner';
2
+ export declare function Toaster(): import("react").JSX.Element;
3
+ /** Toasts. `toast.error(err)` accepts a CmsError and shows its message. */
4
+ export declare const toast: ((message: string, options?: Parameters<typeof sonner>[1]) => string | number) & {
5
+ success: (message: string, options?: Parameters<typeof sonner.success>[1]) => string | number;
6
+ /** Pass `{ id }` to turn a loading toast into the error. */
7
+ error: (error: unknown, options?: string | {
8
+ id?: string | number;
9
+ fallback?: string;
10
+ }) => string | number;
11
+ loading: (message: string, options?: Parameters<typeof sonner.loading>[1]) => string | number;
12
+ promise: <T>(promise: Promise<T> | (() => Promise<T>), options?: Parameters<typeof sonner.promise<T>>[1]) => unknown;
13
+ dismiss: (id?: number | string) => string | number;
14
+ };
@@ -0,0 +1,17 @@
1
+ import type { OverviewView as ListView } from './ViewControls';
2
+ export type CalendarDate = 'published' | 'updated';
3
+ export interface ViewPrefs {
4
+ view: ListView;
5
+ sort: string | null;
6
+ columns: string[] | null;
7
+ calendarDate: CalendarDate;
8
+ }
9
+ export type ViewPrefsChange = Partial<Omit<ViewPrefs, 'view'>> & {
10
+ view?: ListView | null;
11
+ };
12
+ export declare function readViewPrefs(handle: string, fallbackView?: ListView): ViewPrefs;
13
+ /**
14
+ * View, sort and columns of an overview. Changes show at once and are saved
15
+ * to the account a moment later (one save for a burst of clicks).
16
+ */
17
+ export declare function useViewPrefs(handle: string, fallbackView?: ListView): [ViewPrefs, (change: ViewPrefsChange) => void];
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.