@tensor_1/react 2.26.3 → 2.28.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 +74 -0
- package/dist/calendar-model.d.ts +4 -2
- package/dist/components/AppShell.d.ts +1 -1
- package/dist/components/AppShell.js +6 -2
- package/dist/components/Button.d.ts +28 -4
- package/dist/components/Button.js +19 -9
- package/dist/components/Card.d.ts +7 -1
- package/dist/components/Card.js +3 -3
- package/dist/components/Chip.d.ts +43 -0
- package/dist/components/Chip.js +73 -0
- package/dist/components/CollapsibleSection.d.ts +19 -1
- package/dist/components/CollapsibleSection.js +5 -2
- package/dist/components/CollapsibleSectionState.d.ts +11 -0
- package/dist/components/CollapsibleSectionState.js +67 -0
- package/dist/components/CommandPalette.d.ts +1 -1
- package/dist/components/CommandPalette.js +4 -1
- package/dist/components/DateRangePicker.js +3 -1
- package/dist/components/Dialogs.d.ts +54 -3
- package/dist/components/Dialogs.js +167 -6
- package/dist/components/Drawer.d.ts +6 -1
- package/dist/components/Drawer.js +5 -2
- package/dist/components/Kbd.d.ts +27 -0
- package/dist/components/Kbd.js +45 -0
- package/dist/components/Menu.d.ts +51 -0
- package/dist/components/Menu.js +177 -0
- package/dist/components/Modal.d.ts +1 -1
- package/dist/components/Modal.js +4 -1
- package/dist/components/Pagination.d.ts +36 -5
- package/dist/components/Pagination.js +59 -37
- package/dist/components/Peek.d.ts +1 -1
- package/dist/components/Peek.js +6 -1
- package/dist/components/SchedulingCalendar.d.ts +47 -2
- package/dist/components/SchedulingCalendar.js +69 -22
- package/dist/components/SearchSuggest.d.ts +1 -1
- package/dist/components/SearchSuggest.js +4 -1
- package/dist/components/Sidebar.d.ts +7 -2
- package/dist/components/Sidebar.js +15 -4
- package/dist/components/Stat.d.ts +16 -0
- package/dist/components/Stat.js +12 -5
- package/dist/components/Steps.d.ts +48 -0
- package/dist/components/Steps.js +42 -0
- package/dist/components/Toast.d.ts +15 -3
- package/dist/components/Toast.js +158 -9
- package/dist/components/Tooltip.d.ts +10 -4
- package/dist/components/Tooltip.js +2 -2
- package/dist/emoji.cjs +2 -2
- package/dist/index.cjs +2322 -1352
- package/dist/index.d.cts +703 -166
- package/dist/index.d.ts +11 -4
- package/dist/index.js +29 -2
- package/dist/labels-context.d.ts +72 -0
- package/dist/labels-context.js +23 -0
- package/dist/link.d.ts +20 -0
- package/dist/link.js +9 -0
- package/dist/toast-store.d.ts +98 -0
- package/dist/toast-store.js +110 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export { UseTableOptions, UseTableResult, useTable } from './hooks/useTable.js';
|
|
|
4
4
|
export { UseVirtualRowsOptions, UseVirtualRowsResult, useVirtualRows } from './hooks/useVirtualRows.js';
|
|
5
5
|
export { UseAnchoredPositionOptions, useAnchoredPosition } from './hooks/useAnchoredPosition.js';
|
|
6
6
|
export { Align, Placement, PositionOptions, PositionResult, Rect, Side, Size, computePosition } from './overlay-position.js';
|
|
7
|
-
export { Button, ButtonGroup, ButtonGroupProps, ButtonProps } from './components/Button.js';
|
|
7
|
+
export { Button, ButtonGroup, ButtonGroupProps, ButtonLink, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant } from './components/Button.js';
|
|
8
|
+
export { UixLabels, UixLabelsProvider, UixLabelsProviderProps, useUixLabels } from './labels-context.js';
|
|
9
|
+
export { UixLinkProps, UixRenderLink, renderPlainLink } from './link.js';
|
|
8
10
|
export { Input, InputGroup, InputGroupProps, InputProps } from './components/Input.js';
|
|
9
11
|
export { Combobox, ComboboxProps } from './components/Combobox.js';
|
|
10
12
|
export { ComboboxOption, filterComboboxOptions } from './combobox-model.js';
|
|
@@ -17,7 +19,7 @@ export { Radio, RadioGroup, RadioGroupProps, RadioProps } from './components/Rad
|
|
|
17
19
|
export { Switch, SwitchProps } from './components/Switch.js';
|
|
18
20
|
export { Field, FieldProps } from './components/Field.js';
|
|
19
21
|
export { Modal, ModalProps } from './components/Modal.js';
|
|
20
|
-
export { ConfirmDialog, ConfirmDialogProps, PromptDialog, PromptDialogProps } from './components/Dialogs.js';
|
|
22
|
+
export { ConfirmDialog, ConfirmDialogProps, Popconfirm, PopconfirmProps, PromptDialog, PromptDialogProps } from './components/Dialogs.js';
|
|
21
23
|
export { Drawer, DrawerProps } from './components/Drawer.js';
|
|
22
24
|
export { Peek, PeekProps } from './components/Peek.js';
|
|
23
25
|
export { Card, CardLink, CardLinkProps, CardProps } from './components/Card.js';
|
|
@@ -39,6 +41,7 @@ export { NavFavouriteItem, NavFavourites, NavFavouritesLabels, NavFavouritesProp
|
|
|
39
41
|
export { Alert, AlertProps, AlertTone } from './components/Alert.js';
|
|
40
42
|
export { Spinner, SpinnerProps } from './components/Spinner.js';
|
|
41
43
|
export { Toast, ToastProps, ToastTone, Toaster, ToasterProps } from './components/Toast.js';
|
|
44
|
+
export { TOAST_LEAVE_MS, ToastAction, ToastApi, ToastDismissReason, ToastKind, ToastOptions, ToastPromiseMessages, ToastRecord, ToastStore, UndoableToastOptions, createToastApi, createToastStore, toast } from './toast-store.js';
|
|
42
45
|
export { BulkBar, BulkBarProps, CellStrong, CellSub, ExpandToggle, ExpandToggleProps, Highlighted, HighlightedProps, Mark, MarkProps, RowAction, RowActionProps, RowActions, RowActionsProps, SortDirection, Table, TableDensity, TableProps, TableWrap, TableWrapProps, Td, TdProps, Th, ThProps, Tr, TrProps } from './components/Table.js';
|
|
43
46
|
export { ColumnFilter, FilterKind, FilterOp, Primitive, Row, Segment, SelectAllState, SortDir, SortKey, ViewState, VirtualWindow, applyFilters, clampWidth, highlightSegments, matchFilter, mergePinned, multiSort, nextSortDir, parseView, reorder, searchRows, selectAllState, serializeView, shouldVirtualize, toggleId, togglePage, toggleSort, virtualWindow } from './table-engine.js';
|
|
44
47
|
export { DEFAULT_PAGINATION_LABELS, Pagination, PaginationLabels, PaginationProps } from './components/Pagination.js';
|
|
@@ -46,6 +49,9 @@ export { PillTone, PillTreatment, StatusPill, StatusPillProps } from './componen
|
|
|
46
49
|
export { Progress, ProgressProps } from './components/Progress.js';
|
|
47
50
|
export { Meter, MeterProps, MeterTone } from './components/Meter.js';
|
|
48
51
|
export { Stat, StatProps, StatTrend } from './components/Stat.js';
|
|
52
|
+
export { Chip, ChipGroup, ChipGroupProps, ChipProps } from './components/Chip.js';
|
|
53
|
+
export { Kbd, KbdCombo, KbdComboProps, KbdPlatform, KbdProps } from './components/Kbd.js';
|
|
54
|
+
export { DEFAULT_STEP_STATE_LABELS, Step, StepProps, StepState, StepStateLabels, Steps, StepsProps } from './components/Steps.js';
|
|
49
55
|
export { Tooltip, TooltipProps } from './components/Tooltip.js';
|
|
50
56
|
export { InfoTip, InfoTipProps } from './components/InfoTip.js';
|
|
51
57
|
export { AccessStateProps, EmptyState, EmptyStateProps, ErrorState, ErrorStateProps, FilteredEmptyState, ForbiddenState, LoadingState, LoadingStateProps, NotFoundState, Skeleton, SkeletonProps, StateVariant } from './components/States.js';
|
|
@@ -64,6 +70,7 @@ export { Pipeline, PipelineProps, PipelineStage, PipelineStageProps, PipelineSta
|
|
|
64
70
|
export { Flow, FlowNode, FlowNodeProps, FlowNodeState, FlowProps, FlowVariant } from './components/Flow.js';
|
|
65
71
|
export { Note, NoteProps, NoteTone, Prose, ProseProps } from './components/Prose.js';
|
|
66
72
|
export { Popover, PopoverProps } from './components/Popover.js';
|
|
73
|
+
export { Menu, MenuGroup, MenuGroupProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator } from './components/Menu.js';
|
|
67
74
|
export { CommandGroup, CommandGroupProps, CommandItem, CommandItemProps, CommandPalette, CommandPaletteProps } from './components/CommandPalette.js';
|
|
68
75
|
export { Inbox, InboxDetail, InboxDetailProps, InboxItem, InboxItemProps, InboxList, InboxListProps, InboxProps } from './components/Inbox.js';
|
|
69
76
|
export { Kanban, KanbanCard, KanbanCardProps, KanbanColumn, KanbanColumnProps, KanbanMoveDirection, KanbanProps } from './components/Kanban.js';
|
|
@@ -74,9 +81,9 @@ export { JsonPrimitive, JsonValue } from './json-value.js';
|
|
|
74
81
|
export { DEFAULT_RULE_BUILDER_LABELS, RuleActionDefinition, RuleBuilder, RuleBuilderLabels, RuleBuilderProps, RuleFieldDefinition, RuleOperatorDefinition, RuleValueEditorProps } from './components/RuleBuilder.js';
|
|
75
82
|
export { RuleAction, RuleCondition, RuleDefinition, RuleGroup, RuleValidationIssue, appendRuleNode, findRuleNodeDepth, isRuleGroup, mapRuleGroup, moveRuleNode, removeRuleNode, ruleDepth, summarizeRule, validateRuleDefinition } from './rule-builder-model.js';
|
|
76
83
|
export { BuilderCanvas, BuilderCanvasItem, BuilderCanvasLabels, BuilderCanvasProps, BuilderPaletteItem, DEFAULT_BUILDER_CANVAS_LABELS } from './components/BuilderCanvas.js';
|
|
77
|
-
export { DEFAULT_SCHEDULING_CALENDAR_LABELS, SchedulingCalendar, SchedulingCalendarEntry, SchedulingCalendarLabels, SchedulingCalendarOverlay, SchedulingCalendarProps, SchedulingCalendarView, SchedulingEntryState, SchedulingOverlayKind } from './components/SchedulingCalendar.js';
|
|
84
|
+
export { DEFAULT_SCHEDULING_CALENDAR_LABELS, SchedulingCalendar, SchedulingCalendarEntry, SchedulingCalendarLabels, SchedulingCalendarOverlay, SchedulingCalendarProps, SchedulingCalendarView, SchedulingDatePart, SchedulingEntryState, SchedulingOverlayKind } from './components/SchedulingCalendar.js';
|
|
78
85
|
export { DEFAULT_DATE_RANGE_PICKER_LABELS, DateRangePicker, DateRangePickerLabels, DateRangePickerProps } from './components/DateRangePicker.js';
|
|
79
|
-
export { CalendarDay, DateRangeValue, ZonedDateSpan, addCalendarDays, addCalendarMonths, buildMonthGrid, enumerateDateSpan, isDateInRange, isDateUnavailable, selectRangeDate, startOfMonth, toDateKey, zonedDateKey, zonedDateSpan } from './calendar-model.js';
|
|
86
|
+
export { CalendarDay, CalendarWeekday, DateRangeValue, ZonedDateSpan, addCalendarDays, addCalendarMonths, buildMonthGrid, enumerateDateSpan, isDateInRange, isDateUnavailable, selectRangeDate, startOfMonth, toDateKey, zonedDateKey, zonedDateSpan } from './calendar-model.js';
|
|
80
87
|
export { DEFAULT_RELATIONSHIP_GRAPH_LABELS, RelationshipGraph, RelationshipGraphLabels, RelationshipGraphLegendItem, RelationshipGraphProps } from './components/RelationshipGraph.js';
|
|
81
88
|
export { BoundedRelationshipGraph, LayeredColumn, LayeredEdgeClassification, LayeredEdgeKind, LayeredItem, LayeredLayout, LayeredLayoutOptions, LayeredNavigationKey, PositionedRelationshipNode, RelationshipGraphArrow, RelationshipGraphCluster, RelationshipGraphEdge, RelationshipGraphNode, RoutedEdge, boundRelationshipGraph, classifyLayeredEdges, clusterIdFor, layeredNeighbor, layoutLayeredGraph, layoutRelationshipGraph, relationshipNeighbors, traverseRelationshipNode, wrapEdgeLabel } from './relationship-graph-model.js';
|
|
82
89
|
export { DEFAULT_MATCH_REVIEW_LABELS, MatchBulkResult, MatchReview, MatchReviewAction, MatchReviewCandidate, MatchReviewField, MatchReviewLabels, MatchReviewProps } from './components/MatchReview.js';
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,9 @@ import { useTable } from "./hooks/useTable.js";
|
|
|
4
4
|
import { useVirtualRows } from "./hooks/useVirtualRows.js";
|
|
5
5
|
import { useAnchoredPosition } from "./hooks/useAnchoredPosition.js";
|
|
6
6
|
import { computePosition } from "./overlay-position.js";
|
|
7
|
-
import { Button, ButtonGroup } from "./components/Button.js";
|
|
7
|
+
import { Button, ButtonGroup, ButtonLink } from "./components/Button.js";
|
|
8
|
+
import { UixLabelsProvider, useUixLabels } from "./labels-context.js";
|
|
9
|
+
import { renderPlainLink } from "./link.js";
|
|
8
10
|
import { Input, InputGroup } from "./components/Input.js";
|
|
9
11
|
import { Combobox } from "./components/Combobox.js";
|
|
10
12
|
import { filterComboboxOptions } from "./combobox-model.js";
|
|
@@ -17,7 +19,7 @@ import { Radio, RadioGroup } from "./components/Radio.js";
|
|
|
17
19
|
import { Switch } from "./components/Switch.js";
|
|
18
20
|
import { Field } from "./components/Field.js";
|
|
19
21
|
import { Modal } from "./components/Modal.js";
|
|
20
|
-
import { ConfirmDialog, PromptDialog } from "./components/Dialogs.js";
|
|
22
|
+
import { ConfirmDialog, Popconfirm, PromptDialog } from "./components/Dialogs.js";
|
|
21
23
|
import { Drawer } from "./components/Drawer.js";
|
|
22
24
|
import { Peek } from "./components/Peek.js";
|
|
23
25
|
import { Card, CardLink } from "./components/Card.js";
|
|
@@ -39,6 +41,7 @@ import { NavFavourites } from "./components/NavFavourites.js";
|
|
|
39
41
|
import { Alert } from "./components/Alert.js";
|
|
40
42
|
import { Spinner } from "./components/Spinner.js";
|
|
41
43
|
import { Toast, Toaster } from "./components/Toast.js";
|
|
44
|
+
import { toast, createToastStore, createToastApi, TOAST_LEAVE_MS } from "./toast-store.js";
|
|
42
45
|
import {
|
|
43
46
|
TableWrap,
|
|
44
47
|
Table,
|
|
@@ -60,6 +63,9 @@ import { StatusPill } from "./components/StatusPill.js";
|
|
|
60
63
|
import { Progress } from "./components/Progress.js";
|
|
61
64
|
import { Meter } from "./components/Meter.js";
|
|
62
65
|
import { Stat } from "./components/Stat.js";
|
|
66
|
+
import { Chip, ChipGroup } from "./components/Chip.js";
|
|
67
|
+
import { Kbd, KbdCombo } from "./components/Kbd.js";
|
|
68
|
+
import { Steps, Step, DEFAULT_STEP_STATE_LABELS } from "./components/Steps.js";
|
|
63
69
|
import { Tooltip } from "./components/Tooltip.js";
|
|
64
70
|
import { InfoTip } from "./components/InfoTip.js";
|
|
65
71
|
import { EmptyState, ErrorState, ForbiddenState, NotFoundState, FilteredEmptyState, Skeleton, LoadingState } from "./components/States.js";
|
|
@@ -78,6 +84,7 @@ import { Pipeline, PipelineStage } from "./components/Pipeline.js";
|
|
|
78
84
|
import { Flow, FlowNode } from "./components/Flow.js";
|
|
79
85
|
import { Prose, Note } from "./components/Prose.js";
|
|
80
86
|
import { Popover } from "./components/Popover.js";
|
|
87
|
+
import { Menu, MenuItem, MenuGroup, MenuSeparator } from "./components/Menu.js";
|
|
81
88
|
import { CommandPalette, CommandGroup, CommandItem } from "./components/CommandPalette.js";
|
|
82
89
|
import { Inbox, InboxList, InboxItem, InboxDetail } from "./components/Inbox.js";
|
|
83
90
|
import { Kanban, KanbanColumn, KanbanCard } from "./components/Kanban.js";
|
|
@@ -150,11 +157,14 @@ export {
|
|
|
150
157
|
BulkBar,
|
|
151
158
|
Button,
|
|
152
159
|
ButtonGroup,
|
|
160
|
+
ButtonLink,
|
|
153
161
|
Card,
|
|
154
162
|
CardLink,
|
|
155
163
|
CellStrong,
|
|
156
164
|
CellSub,
|
|
157
165
|
Checkbox,
|
|
166
|
+
Chip,
|
|
167
|
+
ChipGroup,
|
|
158
168
|
CollapsibleSection,
|
|
159
169
|
ColorPicker,
|
|
160
170
|
Combobox,
|
|
@@ -180,6 +190,7 @@ export {
|
|
|
180
190
|
DEFAULT_RULE_BUILDER_LABELS,
|
|
181
191
|
DEFAULT_SAVE_STATUS_LABELS,
|
|
182
192
|
DEFAULT_SCHEDULING_CALENDAR_LABELS,
|
|
193
|
+
DEFAULT_STEP_STATE_LABELS,
|
|
183
194
|
DateRangePicker,
|
|
184
195
|
DescriptionItem,
|
|
185
196
|
DescriptionList,
|
|
@@ -211,6 +222,8 @@ export {
|
|
|
211
222
|
Kanban,
|
|
212
223
|
KanbanCard,
|
|
213
224
|
KanbanColumn,
|
|
225
|
+
Kbd,
|
|
226
|
+
KbdCombo,
|
|
214
227
|
Label,
|
|
215
228
|
LicensePositionBar,
|
|
216
229
|
List,
|
|
@@ -218,6 +231,10 @@ export {
|
|
|
218
231
|
LoadingState,
|
|
219
232
|
Mark,
|
|
220
233
|
MatchReview,
|
|
234
|
+
Menu,
|
|
235
|
+
MenuGroup,
|
|
236
|
+
MenuItem,
|
|
237
|
+
MenuSeparator,
|
|
221
238
|
Meter,
|
|
222
239
|
MetricInput,
|
|
223
240
|
Modal,
|
|
@@ -234,6 +251,7 @@ export {
|
|
|
234
251
|
Peek,
|
|
235
252
|
Pipeline,
|
|
236
253
|
PipelineStage,
|
|
254
|
+
Popconfirm,
|
|
237
255
|
Popover,
|
|
238
256
|
Progress,
|
|
239
257
|
PromptDialog,
|
|
@@ -264,8 +282,11 @@ export {
|
|
|
264
282
|
StatLine,
|
|
265
283
|
StatusPill,
|
|
266
284
|
StatusRow,
|
|
285
|
+
Step,
|
|
286
|
+
Steps,
|
|
267
287
|
SubNavItem,
|
|
268
288
|
Switch,
|
|
289
|
+
TOAST_LEAVE_MS,
|
|
269
290
|
Tab,
|
|
270
291
|
TabPanel,
|
|
271
292
|
Table,
|
|
@@ -282,6 +303,7 @@ export {
|
|
|
282
303
|
Tooltip,
|
|
283
304
|
Tr,
|
|
284
305
|
Tree,
|
|
306
|
+
UixLabelsProvider,
|
|
285
307
|
UserChip,
|
|
286
308
|
ViewMenu,
|
|
287
309
|
addCalendarDays,
|
|
@@ -296,6 +318,8 @@ export {
|
|
|
296
318
|
clusterIdFor,
|
|
297
319
|
computePosition,
|
|
298
320
|
contrastRatio,
|
|
321
|
+
createToastApi,
|
|
322
|
+
createToastStore,
|
|
299
323
|
cx,
|
|
300
324
|
enumerateDateSpan,
|
|
301
325
|
filterComboboxOptions,
|
|
@@ -320,6 +344,7 @@ export {
|
|
|
320
344
|
relationshipNeighbors,
|
|
321
345
|
relativeTimeValue,
|
|
322
346
|
removeRuleNode,
|
|
347
|
+
renderPlainLink,
|
|
323
348
|
restoreBrandProfile,
|
|
324
349
|
rgbToHex,
|
|
325
350
|
rgbToHsv,
|
|
@@ -331,11 +356,13 @@ export {
|
|
|
331
356
|
summarizeDiff,
|
|
332
357
|
summarizeRule,
|
|
333
358
|
toDateKey,
|
|
359
|
+
toast,
|
|
334
360
|
traverseRelationshipNode,
|
|
335
361
|
treeNav,
|
|
336
362
|
useAnchoredPosition,
|
|
337
363
|
useDialog,
|
|
338
364
|
useTable,
|
|
365
|
+
useUixLabels,
|
|
339
366
|
useVirtualRows,
|
|
340
367
|
validateRuleDefinition,
|
|
341
368
|
wrapEdgeLabel,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { PaginationLabels } from './components/Pagination.js';
|
|
4
|
+
import { SchedulingCalendarLabels } from './components/SchedulingCalendar.js';
|
|
5
|
+
import { DateRangePickerLabels } from './components/DateRangePicker.js';
|
|
6
|
+
import './link.js';
|
|
7
|
+
import './calendar-model.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Kit chrome strings by component (HAR-1358; TENSOR C20, MOTUS executive summary #3).
|
|
11
|
+
* Each entry overrides that component's English defaults for every instance below the
|
|
12
|
+
* provider; an explicit prop on one instance still wins.
|
|
13
|
+
*
|
|
14
|
+
* Client components read the provider. Server-renderable ones (`Pagination`, `BulkBar`)
|
|
15
|
+
* cannot read context: pass `labels` from `useUixLabels()` in a client parent, or translate
|
|
16
|
+
* on the server.
|
|
17
|
+
*/
|
|
18
|
+
interface UixLabels {
|
|
19
|
+
modal?: {
|
|
20
|
+
close?: string;
|
|
21
|
+
};
|
|
22
|
+
drawer?: {
|
|
23
|
+
close?: string;
|
|
24
|
+
};
|
|
25
|
+
peek?: {
|
|
26
|
+
previous?: string;
|
|
27
|
+
next?: string;
|
|
28
|
+
close?: string;
|
|
29
|
+
};
|
|
30
|
+
toast?: {
|
|
31
|
+
dismiss?: string;
|
|
32
|
+
};
|
|
33
|
+
toaster?: {
|
|
34
|
+
region?: string;
|
|
35
|
+
};
|
|
36
|
+
appShell?: {
|
|
37
|
+
skipToContent?: string;
|
|
38
|
+
exitFocus?: string;
|
|
39
|
+
};
|
|
40
|
+
sidebar?: {
|
|
41
|
+
expand?: string;
|
|
42
|
+
collapse?: string;
|
|
43
|
+
};
|
|
44
|
+
searchSuggest?: {
|
|
45
|
+
clear?: string;
|
|
46
|
+
};
|
|
47
|
+
commandPalette?: {
|
|
48
|
+
input?: string;
|
|
49
|
+
};
|
|
50
|
+
confirmDialog?: {
|
|
51
|
+
typeToConfirm?: string;
|
|
52
|
+
compensation?: string;
|
|
53
|
+
};
|
|
54
|
+
schedulingCalendar?: Partial<SchedulingCalendarLabels>;
|
|
55
|
+
dateRangePicker?: Partial<DateRangePickerLabels>;
|
|
56
|
+
/** Read by `useUixLabels()` callers; `Pagination` itself is server-safe and takes `labels`. */
|
|
57
|
+
pagination?: Partial<PaginationLabels>;
|
|
58
|
+
/** Read by `useUixLabels()` callers; `BulkBar` itself is server-safe and takes `label`. */
|
|
59
|
+
bulkBar?: {
|
|
60
|
+
region?: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
interface UixLabelsProviderProps {
|
|
64
|
+
labels: UixLabels;
|
|
65
|
+
children?: ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/** Translates kit chrome once for a subtree. Nested providers merge per component. */
|
|
68
|
+
declare function UixLabelsProvider({ labels, children }: UixLabelsProviderProps): react.JSX.Element;
|
|
69
|
+
/** The chrome strings in effect here (empty outside a provider). */
|
|
70
|
+
declare function useUixLabels(): UixLabels;
|
|
71
|
+
|
|
72
|
+
export { type UixLabels, UixLabelsProvider, type UixLabelsProviderProps, useUixLabels };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
const UixLabelsContext = createContext({});
|
|
5
|
+
function UixLabelsProvider({ labels, children }) {
|
|
6
|
+
const parent = useContext(UixLabelsContext);
|
|
7
|
+
const value = useMemo(() => {
|
|
8
|
+
const merged = { ...parent };
|
|
9
|
+
for (const [key, entry] of Object.entries(labels)) {
|
|
10
|
+
const inherited = parent[key];
|
|
11
|
+
merged[key] = inherited && entry ? { ...inherited, ...entry } : entry ?? inherited;
|
|
12
|
+
}
|
|
13
|
+
return merged;
|
|
14
|
+
}, [parent, labels]);
|
|
15
|
+
return /* @__PURE__ */ jsx(UixLabelsContext.Provider, { value, children });
|
|
16
|
+
}
|
|
17
|
+
function useUixLabels() {
|
|
18
|
+
return useContext(UixLabelsContext);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
UixLabelsProvider,
|
|
22
|
+
useUixLabels
|
|
23
|
+
};
|
package/dist/link.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a `renderLink` callback receives (HAR-1348). Spread it onto your router's link
|
|
5
|
+
* so it keeps client navigation and prefetch: `renderLink={(p) => <NextLink {...p} />}`.
|
|
6
|
+
* Every UIx component that can render a link (`ButtonLink`, `Stat href`, `Pagination
|
|
7
|
+
* hrefFor`, `DetailPage`) takes the same callback, so one adapter serves them all.
|
|
8
|
+
*/
|
|
9
|
+
interface UixLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
10
|
+
href: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/** Renders a link with the consumer's router. Default: a plain `<a>`. */
|
|
15
|
+
type UixRenderLink = (props: UixLinkProps) => ReactNode;
|
|
16
|
+
declare const renderPlainLink: UixRenderLink;
|
|
17
|
+
/** Calls the consumer's `renderLink`, falling back to a plain `<a>` when it returns nothing. */
|
|
18
|
+
declare function renderUixLink(renderLink: UixRenderLink | undefined, props: UixLinkProps): ReactNode;
|
|
19
|
+
|
|
20
|
+
export { type UixLinkProps, type UixRenderLink, renderPlainLink, renderUixLink };
|
package/dist/link.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const renderPlainLink = (props) => /* @__PURE__ */ jsx("a", { ...props });
|
|
3
|
+
function renderUixLink(renderLink, props) {
|
|
4
|
+
return renderLink?.(props) ?? renderPlainLink(props);
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
renderPlainLink,
|
|
8
|
+
renderUixLink
|
|
9
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The imperative toast queue behind `toast()` (HAR-1363; TENSOR A2/C3, MOTUS A3/A4/C-13).
|
|
5
|
+
* Plain module state, no React: mutation helpers and server-action wrappers can call
|
|
6
|
+
* `toast.success(...)` from anywhere on the client; every mounted `Toaster` subscribed to
|
|
7
|
+
* the store renders it. Timing (auto-dismiss, pause on hover/focus/hidden tab) belongs to the
|
|
8
|
+
* `Toaster`, because it depends on what the user is looking at.
|
|
9
|
+
*/
|
|
10
|
+
type ToastKind = 'success' | 'error' | 'warning' | 'info' | 'loading' | 'default';
|
|
11
|
+
interface ToastAction {
|
|
12
|
+
label: string;
|
|
13
|
+
/** Runs, then the toast closes (reason `"action"`). */
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
}
|
|
16
|
+
/** Why a toast closed. */
|
|
17
|
+
type ToastDismissReason = 'timeout' | 'close' | 'action' | 'programmatic';
|
|
18
|
+
interface ToastOptions {
|
|
19
|
+
/** Reuse an id to replace a toast in place instead of stacking a duplicate. */
|
|
20
|
+
id?: string;
|
|
21
|
+
/** A second, quieter line. */
|
|
22
|
+
description?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Milliseconds on screen while visible and not paused. `null` keeps it until dismissed.
|
|
25
|
+
* Defaults: success/info/default 5 s, warning 8 s, error and loading stay.
|
|
26
|
+
*/
|
|
27
|
+
duration?: number | null;
|
|
28
|
+
action?: ToastAction;
|
|
29
|
+
/** Replaces the tone glyph. */
|
|
30
|
+
icon?: ReactNode;
|
|
31
|
+
/** Called once when the toast closes, with the reason. */
|
|
32
|
+
onDismiss?: (reason: ToastDismissReason) => void;
|
|
33
|
+
}
|
|
34
|
+
interface ToastRecord {
|
|
35
|
+
id: string;
|
|
36
|
+
kind: ToastKind;
|
|
37
|
+
message: ReactNode;
|
|
38
|
+
description?: ReactNode;
|
|
39
|
+
duration: number | null;
|
|
40
|
+
action?: ToastAction;
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
/** Set while the leave animation runs; the record is removed after it. */
|
|
43
|
+
leaving?: boolean;
|
|
44
|
+
/** Bumped on every update, so a Toaster restarts the toast's timer. */
|
|
45
|
+
version: number;
|
|
46
|
+
onDismiss?: (reason: ToastDismissReason) => void;
|
|
47
|
+
}
|
|
48
|
+
interface ToastPromiseMessages<T> {
|
|
49
|
+
loading: ReactNode;
|
|
50
|
+
success: ReactNode | ((value: T) => ReactNode);
|
|
51
|
+
error: ReactNode | ((error: unknown) => ReactNode);
|
|
52
|
+
}
|
|
53
|
+
interface UndoableToastOptions extends Omit<ToastOptions, 'action' | 'onDismiss'> {
|
|
54
|
+
/** The user pressed Undo: revert the optimistic change. `onCommit` is not called. */
|
|
55
|
+
onUndo: () => void;
|
|
56
|
+
/** The toast closed without Undo (timeout, ×, or a later dismiss): make the change final. */
|
|
57
|
+
onCommit: () => void;
|
|
58
|
+
/** Default "Undo". */
|
|
59
|
+
undoLabel?: string;
|
|
60
|
+
}
|
|
61
|
+
interface ToastStore {
|
|
62
|
+
show: (kind: ToastKind, message: ReactNode, options?: ToastOptions) => string;
|
|
63
|
+
update: (id: string, patch: Partial<Omit<ToastRecord, 'id' | 'version'>>) => void;
|
|
64
|
+
dismiss: (id?: string, reason?: ToastDismissReason) => void;
|
|
65
|
+
subscribe: (listener: () => void) => () => void;
|
|
66
|
+
getSnapshot: () => readonly ToastRecord[];
|
|
67
|
+
}
|
|
68
|
+
/** How long the leave animation gets before the record is removed. */
|
|
69
|
+
declare const TOAST_LEAVE_MS = 200;
|
|
70
|
+
/** A separate queue, e.g. per test or per embedded app. Most products use the default `toast`. */
|
|
71
|
+
declare function createToastStore(): ToastStore;
|
|
72
|
+
interface ToastApi {
|
|
73
|
+
(message: ReactNode, options?: ToastOptions): string;
|
|
74
|
+
success: (message: ReactNode, options?: ToastOptions) => string;
|
|
75
|
+
error: (message: ReactNode, options?: ToastOptions) => string;
|
|
76
|
+
warning: (message: ReactNode, options?: ToastOptions) => string;
|
|
77
|
+
info: (message: ReactNode, options?: ToastOptions) => string;
|
|
78
|
+
loading: (message: ReactNode, options?: ToastOptions) => string;
|
|
79
|
+
/** Close one toast, or every toast without an id. */
|
|
80
|
+
dismiss: (id?: string) => void;
|
|
81
|
+
/** Change a toast in place (message, kind, description, duration, action). */
|
|
82
|
+
update: (id: string, patch: Partial<Omit<ToastRecord, 'id' | 'version'>>) => void;
|
|
83
|
+
/** A loading toast that turns into success or error when the promise settles. Returns the promise. */
|
|
84
|
+
promise: <T>(promise: Promise<T>, messages: ToastPromiseMessages<T>, options?: ToastOptions) => Promise<T>;
|
|
85
|
+
/**
|
|
86
|
+
* An optimistic action with an Undo button (TENSOR C2 `useUndoableAction`): `onCommit` runs
|
|
87
|
+
* when the toast closes without Undo; `onUndo` runs instead when Undo is pressed.
|
|
88
|
+
*/
|
|
89
|
+
undoable: (message: ReactNode, options: UndoableToastOptions) => string;
|
|
90
|
+
/** The store this API writes to; pass it to `<Toaster store>` for a non-default queue. */
|
|
91
|
+
store: ToastStore;
|
|
92
|
+
}
|
|
93
|
+
/** Binds the `toast()` API to a store. */
|
|
94
|
+
declare function createToastApi(store: ToastStore): ToastApi;
|
|
95
|
+
/** The default queue; a `<Toaster />` without a `store` prop renders it. */
|
|
96
|
+
declare const toast: ToastApi;
|
|
97
|
+
|
|
98
|
+
export { TOAST_LEAVE_MS, type ToastAction, type ToastApi, type ToastDismissReason, type ToastKind, type ToastOptions, type ToastPromiseMessages, type ToastRecord, type ToastStore, type UndoableToastOptions, createToastApi, createToastStore, toast };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const DEFAULT_DURATION = {
|
|
2
|
+
success: 5e3,
|
|
3
|
+
info: 5e3,
|
|
4
|
+
default: 5e3,
|
|
5
|
+
warning: 8e3,
|
|
6
|
+
error: null,
|
|
7
|
+
loading: null
|
|
8
|
+
};
|
|
9
|
+
const TOAST_LEAVE_MS = 200;
|
|
10
|
+
let counter = 0;
|
|
11
|
+
function createToastStore() {
|
|
12
|
+
let records = [];
|
|
13
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14
|
+
const emit = () => {
|
|
15
|
+
for (const listener of listeners) listener();
|
|
16
|
+
};
|
|
17
|
+
const set = (next) => {
|
|
18
|
+
records = next;
|
|
19
|
+
emit();
|
|
20
|
+
};
|
|
21
|
+
const show = (kind, message, options = {}) => {
|
|
22
|
+
const id = options.id ?? `uix-toast-${++counter}`;
|
|
23
|
+
const record = {
|
|
24
|
+
id,
|
|
25
|
+
kind,
|
|
26
|
+
message,
|
|
27
|
+
description: options.description,
|
|
28
|
+
duration: options.duration === void 0 ? DEFAULT_DURATION[kind] : options.duration,
|
|
29
|
+
action: options.action,
|
|
30
|
+
icon: options.icon,
|
|
31
|
+
onDismiss: options.onDismiss,
|
|
32
|
+
version: 0
|
|
33
|
+
};
|
|
34
|
+
const existing = records.find((r) => r.id === id);
|
|
35
|
+
set(existing ? records.map((r) => r.id === id ? { ...record, version: r.version + 1 } : r) : [...records, record]);
|
|
36
|
+
return id;
|
|
37
|
+
};
|
|
38
|
+
const update = (id, patch) => {
|
|
39
|
+
if (!records.some((r) => r.id === id)) return;
|
|
40
|
+
set(records.map((r) => {
|
|
41
|
+
if (r.id !== id) return r;
|
|
42
|
+
const kind = patch.kind ?? r.kind;
|
|
43
|
+
const duration = "duration" in patch ? patch.duration ?? null : patch.kind ? DEFAULT_DURATION[kind] : r.duration;
|
|
44
|
+
return { ...r, ...patch, kind, duration, leaving: false, version: r.version + 1 };
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
const dismiss = (id, reason = "programmatic") => {
|
|
48
|
+
const closing = records.filter((r) => (id === void 0 || r.id === id) && !r.leaving);
|
|
49
|
+
if (closing.length === 0) return;
|
|
50
|
+
const ids = new Set(closing.map((r) => r.id));
|
|
51
|
+
set(records.map((r) => ids.has(r.id) ? { ...r, leaving: true } : r));
|
|
52
|
+
for (const r of closing) r.onDismiss?.(reason);
|
|
53
|
+
const remove = () => set(records.filter((r) => !(ids.has(r.id) && r.leaving)));
|
|
54
|
+
if (typeof setTimeout === "function") setTimeout(remove, TOAST_LEAVE_MS);
|
|
55
|
+
else remove();
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
show,
|
|
59
|
+
update,
|
|
60
|
+
dismiss,
|
|
61
|
+
subscribe: (listener) => {
|
|
62
|
+
listeners.add(listener);
|
|
63
|
+
return () => {
|
|
64
|
+
listeners.delete(listener);
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
getSnapshot: () => records
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function createToastApi(store) {
|
|
71
|
+
const api = ((message, options) => store.show("default", message, options));
|
|
72
|
+
api.success = (message, options) => store.show("success", message, options);
|
|
73
|
+
api.error = (message, options) => store.show("error", message, options);
|
|
74
|
+
api.warning = (message, options) => store.show("warning", message, options);
|
|
75
|
+
api.info = (message, options) => store.show("info", message, options);
|
|
76
|
+
api.loading = (message, options) => store.show("loading", message, options);
|
|
77
|
+
api.dismiss = (id) => store.dismiss(id, "programmatic");
|
|
78
|
+
api.update = (id, patch) => store.update(id, patch);
|
|
79
|
+
api.promise = (promise, messages, options) => {
|
|
80
|
+
const id = store.show("loading", messages.loading, options);
|
|
81
|
+
promise.then(
|
|
82
|
+
(value) => store.update(id, { kind: "success", message: typeof messages.success === "function" ? messages.success(value) : messages.success }),
|
|
83
|
+
(error) => store.update(id, { kind: "error", message: typeof messages.error === "function" ? messages.error(error) : messages.error })
|
|
84
|
+
);
|
|
85
|
+
return promise;
|
|
86
|
+
};
|
|
87
|
+
api.undoable = (message, { onUndo, onCommit, undoLabel = "Undo", duration = 6e3, ...options }) => {
|
|
88
|
+
let undone = false;
|
|
89
|
+
return store.show("default", message, {
|
|
90
|
+
...options,
|
|
91
|
+
duration,
|
|
92
|
+
action: { label: undoLabel, onClick: () => {
|
|
93
|
+
undone = true;
|
|
94
|
+
onUndo();
|
|
95
|
+
} },
|
|
96
|
+
onDismiss: () => {
|
|
97
|
+
if (!undone) onCommit();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
api.store = store;
|
|
102
|
+
return api;
|
|
103
|
+
}
|
|
104
|
+
const toast = createToastApi(createToastStore());
|
|
105
|
+
export {
|
|
106
|
+
TOAST_LEAVE_MS,
|
|
107
|
+
createToastApi,
|
|
108
|
+
createToastStore,
|
|
109
|
+
toast
|
|
110
|
+
};
|