@apliteni/apliteni-ui 0.45.0 → 0.46.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
package/react/README.md CHANGED
@@ -364,3 +364,28 @@ opens, focus goes to the safe action. It renders an `alertdialog`, named by its
364
364
  and described by its body. Modal also accepts
365
365
  `initialFocusRef` for a mounted, focusable element inside its panel. Without it, Modal
366
366
  uses its normal opening focus.
367
+
368
+ ## Timeline
369
+
370
+ `Timeline` displays a record’s events in the order provided. Pass events from oldest
371
+ to newest, with stable IDs, machine-readable `dateTime` values, and formatted
372
+ `timestamp` text.
373
+ Descriptions should say what changed and to where.
374
+
375
+ ```tsx
376
+ <Timeline aria-label="Record history" events={[
377
+ {
378
+ id: 'created', actor: 'Demo operator', dateTime: '2026-09-01T09:00:00Z',
379
+ timestamp: '1 Sep, 09:00 UTC', description: 'Created the record in Unassigned.',
380
+ meta: 'Batch DEMO-12',
381
+ },
382
+ ]} />
383
+ ```
384
+
385
+ Omit `undo` for read-only events. For a reversible batch, pass
386
+ `undo: { label: 'Undo batch DEMO-12', onUndo }`. The app checks permissions,
387
+ asks for confirmation when the batch affects finalized records, reverses the
388
+ entire batch, and adds a new event. Timeline only calls `onUndo`; it does not
389
+ modify history.
390
+ Import both the kit CSS and React CSS. The Privileged story shows confirmation
391
+ and a reversing event.
@@ -142,3 +142,69 @@
142
142
  display: block;
143
143
  }
144
144
  }
145
+
146
+ /* src/Timeline.css */
147
+ .ui-timeline {
148
+ margin: 0;
149
+ padding: 0;
150
+ list-style: none;
151
+ color: var(--text);
152
+ font-size: var(--text-sm);
153
+ line-height: 1.5;
154
+ }
155
+ .ui-timeline__event {
156
+ position: relative;
157
+ padding-inline-start: var(--space-6);
158
+ padding-block-end: var(--space-6);
159
+ overflow-wrap: anywhere;
160
+ }
161
+ .ui-timeline__event:last-child {
162
+ padding-block-end: 0;
163
+ }
164
+ .ui-timeline__event::before {
165
+ content: "";
166
+ position: absolute;
167
+ inset-inline-start: calc(var(--space-2) / 2);
168
+ inset-block-start: 0.75em;
169
+ inset-block-end: -0.75em;
170
+ width: 1px;
171
+ background: var(--border);
172
+ }
173
+ .ui-timeline__event:last-child::before {
174
+ display: none;
175
+ }
176
+ .ui-timeline__event::after {
177
+ content: "";
178
+ position: absolute;
179
+ inset-inline-start: 0;
180
+ inset-block-start: calc(0.75em - var(--space-2) / 2);
181
+ width: var(--space-2);
182
+ height: var(--space-2);
183
+ border-radius: 50%;
184
+ background: var(--accent);
185
+ }
186
+ .ui-timeline__head,
187
+ .ui-timeline__meta {
188
+ display: flex;
189
+ flex-wrap: wrap;
190
+ align-items: baseline;
191
+ column-gap: var(--space-3);
192
+ row-gap: var(--space-1);
193
+ }
194
+ .ui-timeline__actor {
195
+ font-weight: var(--weight-semibold);
196
+ }
197
+ .ui-timeline__head time,
198
+ .ui-timeline__meta {
199
+ font-size: var(--text-xs);
200
+ }
201
+ .ui-timeline__description {
202
+ margin: var(--space-1) 0;
203
+ }
204
+ .ui-timeline__undo {
205
+ white-space: normal;
206
+ }
207
+ .ui-timeline__undo:hover,
208
+ .ui-timeline__undo:focus-visible {
209
+ color: var(--pink);
210
+ }
@@ -489,7 +489,24 @@ type TabsProps = {
489
489
  };
490
490
  declare function Tabs({ items, value, onChange, label }: TabsProps): react.JSX.Element;
491
491
 
492
+ type TimelineEvent = {
493
+ id: string;
494
+ actor: string;
495
+ dateTime: string;
496
+ timestamp: string;
497
+ description: string;
498
+ meta?: ReactNode;
499
+ undo?: {
500
+ label: string;
501
+ onUndo: () => void;
502
+ };
503
+ };
504
+ type TimelineProps = Omit<ComponentPropsWithoutRef<'ol'>, 'children' | 'reversed' | 'start'> & {
505
+ events: readonly TimelineEvent[];
506
+ };
507
+ declare function Timeline({ events, className, ...rest }: TimelineProps): react.JSX.Element;
508
+
492
509
  declare const PAGE_SIZES: readonly number[];
493
510
  declare const DEFAULT_PAGE_SIZE: number;
494
511
 
495
- export { BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonProps, Card, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, Confirm, type ConfirmProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, DrawerSection, type DrawerSectionProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, type Filter, FilterBar, type FilterBarProps, Icon, KeyValueList, type KeyValueListProps, type KeyValueRow, Modal, type ModalProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, RowIdentity, type RowIdentityProps, type SegmentOption, Segmented, type SegmentedProps, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, Snippet, type SnippetProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, type TabItem, type TableSort, Tabs, type TabsProps, sortTableRows };
512
+ export { BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonProps, Card, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, Confirm, type ConfirmProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, DrawerSection, type DrawerSectionProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, type Filter, FilterBar, type FilterBarProps, Icon, KeyValueList, type KeyValueListProps, type KeyValueRow, Modal, type ModalProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, RowIdentity, type RowIdentityProps, type SegmentOption, Segmented, type SegmentedProps, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, Snippet, type SnippetProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, type TabItem, type TableSort, Tabs, type TabsProps, Timeline, type TimelineEvent, type TimelineProps, sortTableRows };
@@ -1876,6 +1876,22 @@ function Tabs({ items, value, onChange, label }) {
1876
1876
  ] });
1877
1877
  }
1878
1878
 
1879
+ // src/Timeline.tsx
1880
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
1881
+ function Timeline({ events, className, ...rest }) {
1882
+ return /* @__PURE__ */ jsx21("ol", { ...rest, role: "list", className: ["ui-timeline", className].filter(Boolean).join(" "), children: events.map((event) => /* @__PURE__ */ jsxs17("li", { className: "ui-timeline__event", children: [
1883
+ /* @__PURE__ */ jsxs17("div", { className: "ui-timeline__head", children: [
1884
+ /* @__PURE__ */ jsx21("span", { className: "ui-timeline__actor", children: event.actor }),
1885
+ /* @__PURE__ */ jsx21("time", { dateTime: event.dateTime, children: event.timestamp })
1886
+ ] }),
1887
+ /* @__PURE__ */ jsx21("p", { className: "ui-timeline__description", children: event.description }),
1888
+ (event.meta != null || event.undo) && /* @__PURE__ */ jsxs17("div", { className: "ui-timeline__meta", children: [
1889
+ event.meta != null && /* @__PURE__ */ jsx21("span", { children: event.meta }),
1890
+ event.undo && /* @__PURE__ */ jsx21(Button, { variant: "ghost", size: "xs", className: "ui-btn ui-btn--ghost ui-btn--xs ui-timeline__undo", "aria-label": event.undo.label, onClick: event.undo.onUndo, children: "Undo" })
1891
+ ] })
1892
+ ] }, event.id)) });
1893
+ }
1894
+
1879
1895
  // src/index.ts
1880
1896
  var PAGE_SIZES = KIT_PAGE_SIZES;
1881
1897
  var DEFAULT_PAGE_SIZE3 = KIT_DEFAULT_PAGE_SIZE;
@@ -1908,5 +1924,6 @@ export {
1908
1924
  Snippet,
1909
1925
  StatBand,
1910
1926
  Tabs,
1927
+ Timeline,
1911
1928
  sortTableRows
1912
1929
  };