@tensor_1/react 2.41.0 → 2.43.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 (42) hide show
  1. package/README.md +24 -0
  2. package/dist/components/Button.d.ts +19 -1
  3. package/dist/components/Button.js +13 -8
  4. package/dist/components/DescriptionList.d.ts +11 -0
  5. package/dist/components/DiscardPrompt.d.ts +54 -0
  6. package/dist/components/DiscardPrompt.js +245 -0
  7. package/dist/components/Drawer.d.ts +19 -3
  8. package/dist/components/Drawer.js +60 -21
  9. package/dist/components/EditorialHome.d.ts +1 -1
  10. package/dist/components/Field.d.ts +7 -1
  11. package/dist/components/Field.js +5 -4
  12. package/dist/components/Input.d.ts +5 -0
  13. package/dist/components/Input.js +2 -1
  14. package/dist/components/Kbd.d.ts +20 -1
  15. package/dist/components/Kbd.js +30 -7
  16. package/dist/components/Menu.d.ts +11 -4
  17. package/dist/components/Menu.js +17 -3
  18. package/dist/components/MetricInput.d.ts +8 -1
  19. package/dist/components/MetricInput.js +11 -3
  20. package/dist/components/Modal.d.ts +15 -1
  21. package/dist/components/Modal.js +58 -13
  22. package/dist/components/OrgChart.d.ts +121 -0
  23. package/dist/components/OrgChart.js +683 -0
  24. package/dist/components/SearchBar.d.ts +67 -0
  25. package/dist/components/SearchBar.js +117 -0
  26. package/dist/components/Select.js +5 -4
  27. package/dist/components/ShortcutHint.d.ts +29 -0
  28. package/dist/components/ShortcutHint.js +149 -0
  29. package/dist/components/Tooltip.d.ts +10 -1
  30. package/dist/components/Tooltip.js +15 -4
  31. package/dist/emoji.cjs +108 -31
  32. package/dist/hooks/useAnchoredPosition.d.ts +13 -1
  33. package/dist/hooks/useAnchoredPosition.js +19 -11
  34. package/dist/hooks/useDialog.d.ts +6 -1
  35. package/dist/hooks/useDialog.js +10 -1
  36. package/dist/index.cjs +3911 -2567
  37. package/dist/index.d.cts +340 -39
  38. package/dist/index.d.ts +4 -1
  39. package/dist/index.js +11 -1
  40. package/dist/labels-context.d.ts +11 -0
  41. package/dist/rich-text.cjs +17 -10
  42. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { Input, InputGroup, InputGroupProps, InputProps } from './components/Inp
11
11
  export { Combobox, ComboboxProps } from './components/Combobox.js';
12
12
  export { ComboboxOption, filterComboboxOptions } from './combobox-model.js';
13
13
  export { SearchSuggest, SearchSuggestAction, SearchSuggestOption, SearchSuggestProps } from './components/SearchSuggest.js';
14
+ export { SearchBar, SearchBarLabels, SearchBarProps } from './components/SearchBar.js';
14
15
  export { DEFAULT_ENTITY_PICKER_LABELS, EntityPicker, EntityPickerLabels, EntityPickerProps, EntityPickerSearchResult } from './components/EntityPicker.js';
15
16
  export { FoldedText, SearchSegment, foldForSearch, searchSegments } from './search-suggest-model.js';
16
17
  export { Textarea, TextareaProps } from './components/Textarea.js';
@@ -23,6 +24,7 @@ export { Field, FieldProps } from './components/Field.js';
23
24
  export { Modal, ModalProps } from './components/Modal.js';
24
25
  export { ConfirmDialog, ConfirmDialogProps, Popconfirm, PopconfirmProps, PromptDialog, PromptDialogProps } from './components/Dialogs.js';
25
26
  export { Drawer, DrawerProps } from './components/Drawer.js';
27
+ export { DialogClose, DialogCloseProps, DiscardPromptLabels } from './components/DiscardPrompt.js';
26
28
  export { Peek, PeekProps } from './components/Peek.js';
27
29
  export { DEFAULT_LIGHTBOX_LABELS, Lightbox, LightboxItem, LightboxLabels, LightboxProps } from './components/Lightbox.js';
28
30
  export { Card, CardLink, CardLinkProps, CardProps } from './components/Card.js';
@@ -60,7 +62,7 @@ export { Stat, StatProps, StatTrend } from './components/Stat.js';
60
62
  export { Bullet, BulletProps, DEFAULT_INSIGHT_CARD_LABELS, InsightCard, InsightCardLabels, InsightCardProps, InsightComparison, InsightCoverage, InsightKpi, InsightStatus, InsightStatusTone, InsightTarget } from './components/InsightCard.js';
61
63
  export { ChartStatPoint, LinearFit, PredictionBandPoint, linearFit, normalQuantile, predictionBand, quantiles, studentTQuantile } from './chart-stats.js';
62
64
  export { Chip, ChipGroup, ChipGroupProps, ChipProps } from './components/Chip.js';
63
- export { Kbd, KbdCombo, KbdComboProps, KbdPlatform, KbdProps } from './components/Kbd.js';
65
+ export { Kbd, KbdCombo, KbdComboProps, KbdPlatform, KbdProps, KeyShortcut, ariaKeyShortcuts } from './components/Kbd.js';
64
66
  export { DEFAULT_STEP_STATE_LABELS, Step, StepProps, StepState, StepStateLabels, Steps, StepsProps } from './components/Steps.js';
65
67
  export { Tooltip, TooltipProps } from './components/Tooltip.js';
66
68
  export { InfoTip, InfoTipProps } from './components/InfoTip.js';
@@ -87,6 +89,7 @@ export { CommandGroup, CommandGroupProps, CommandItem, CommandItemProps, Command
87
89
  export { Inbox, InboxDetail, InboxDetailProps, InboxItem, InboxItemProps, InboxList, InboxListProps, InboxProps } from './components/Inbox.js';
88
90
  export { Kanban, KanbanCard, KanbanCardProps, KanbanColumn, KanbanColumnProps, KanbanMoveDirection, KanbanProps } from './components/Kanban.js';
89
91
  export { DEFAULT_TREE_LABELS, Tree, TreeLabels, TreeNodeData, TreeNodeProps, TreeProps } from './components/Tree.js';
92
+ export { DEFAULT_ORG_CHART_LABELS, OrgChart, OrgChartLabels, OrgChartNode, OrgChartProps, orgChartInitials, orgChartZoomStep } from './components/OrgChart.js';
90
93
  export { FlatNode, TreeLike, TreeNavAction, flattenTree, treeNav } from './tree-model.js';
91
94
  export { ContentList, ContentListItem, ContentListItemProps, ContentListProps, EventRow, EventRowProps, FeaturedRundown, FeaturedRundownItem, FeaturedRundownItemProps, FeaturedRundownProps, FeaturedStage, FeaturedStageProps, NewsLead, NewsLeadProps, NoticeQueue, NoticeQueueProps, PageIntro, PageIntroProps, ResourceGrid, ResourceGridProps, SectionHead, SectionHeadProps, StatLine, StatLineItem, StatLineProps, StatusRow, StatusRowProps } from './components/EditorialHome.js';
92
95
  export { JsonPrimitive, JsonValue } from './json-value.js';
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ import { Input, InputGroup } from "./components/Input.js";
11
11
  import { Combobox } from "./components/Combobox.js";
12
12
  import { filterComboboxOptions } from "./combobox-model.js";
13
13
  import { SearchSuggest } from "./components/SearchSuggest.js";
14
+ import { SearchBar } from "./components/SearchBar.js";
14
15
  import { EntityPicker, DEFAULT_ENTITY_PICKER_LABELS } from "./components/EntityPicker.js";
15
16
  import { searchSegments, foldForSearch } from "./search-suggest-model.js";
16
17
  import { Textarea } from "./components/Textarea.js";
@@ -23,6 +24,7 @@ import { Field } from "./components/Field.js";
23
24
  import { Modal } from "./components/Modal.js";
24
25
  import { ConfirmDialog, Popconfirm, PromptDialog } from "./components/Dialogs.js";
25
26
  import { Drawer } from "./components/Drawer.js";
27
+ import { DialogClose } from "./components/DiscardPrompt.js";
26
28
  import { Peek } from "./components/Peek.js";
27
29
  import { Lightbox, DEFAULT_LIGHTBOX_LABELS } from "./components/Lightbox.js";
28
30
  import { Card, CardLink } from "./components/Card.js";
@@ -74,7 +76,7 @@ import { Stat } from "./components/Stat.js";
74
76
  import { Bullet, DEFAULT_INSIGHT_CARD_LABELS, InsightCard } from "./components/InsightCard.js";
75
77
  import { linearFit, normalQuantile, predictionBand, quantiles, studentTQuantile } from "./chart-stats.js";
76
78
  import { Chip, ChipGroup } from "./components/Chip.js";
77
- import { Kbd, KbdCombo } from "./components/Kbd.js";
79
+ import { Kbd, KbdCombo, ariaKeyShortcuts } from "./components/Kbd.js";
78
80
  import { Steps, Step, DEFAULT_STEP_STATE_LABELS } from "./components/Steps.js";
79
81
  import { Tooltip } from "./components/Tooltip.js";
80
82
  import { InfoTip } from "./components/InfoTip.js";
@@ -109,6 +111,7 @@ import { CommandPalette, CommandGroup, CommandItem } from "./components/CommandP
109
111
  import { Inbox, InboxList, InboxItem, InboxDetail } from "./components/Inbox.js";
110
112
  import { Kanban, KanbanColumn, KanbanCard } from "./components/Kanban.js";
111
113
  import { Tree, DEFAULT_TREE_LABELS } from "./components/Tree.js";
114
+ import { OrgChart, DEFAULT_ORG_CHART_LABELS, orgChartInitials, orgChartZoomStep } from "./components/OrgChart.js";
112
115
  import { flattenTree, treeNav } from "./tree-model.js";
113
116
  import {
114
117
  PageIntro,
@@ -269,6 +272,7 @@ export {
269
272
  DEFAULT_INSIGHT_CARD_LABELS,
270
273
  DEFAULT_LIGHTBOX_LABELS,
271
274
  DEFAULT_MATCH_REVIEW_LABELS,
275
+ DEFAULT_ORG_CHART_LABELS,
272
276
  DEFAULT_PAGINATION_LABELS,
273
277
  DEFAULT_PRESENCE_LABELS,
274
278
  DEFAULT_RELATIONSHIP_GRAPH_LABELS,
@@ -290,6 +294,7 @@ export {
290
294
  DescriptionList,
291
295
  DetailLayout,
292
296
  DetailPage,
297
+ DialogClose,
293
298
  DiffViewer,
294
299
  Drawer,
295
300
  EmptyState,
@@ -352,6 +357,7 @@ export {
352
357
  NotFoundState,
353
358
  Note,
354
359
  NoticeQueue,
360
+ OrgChart,
355
361
  PageHeader,
356
362
  PageIntro,
357
363
  Pagination,
@@ -378,6 +384,7 @@ export {
378
384
  SavedViewMenu,
379
385
  SchedulingCalendar,
380
386
  SchedulingTimeline,
387
+ SearchBar,
381
388
  SearchSuggest,
382
389
  SectionHead,
383
390
  Segmented,
@@ -424,6 +431,7 @@ export {
424
431
  addZonedDays,
425
432
  appendRuleNode,
426
433
  applyBrandProfile,
434
+ ariaKeyShortcuts,
427
435
  boundRelationshipGraph,
428
436
  buildMonthGrid,
429
437
  buildThreeWayDiff,
@@ -478,6 +486,8 @@ export {
478
486
  moveRuleNode,
479
487
  normalQuantile,
480
488
  normalizeHex,
489
+ orgChartInitials,
490
+ orgChartZoomStep,
481
491
  packLanes,
482
492
  parseDateInput,
483
493
  parseDateValue,
@@ -13,7 +13,10 @@ import { FileUploadLabels } from './components/FileUpload.js';
13
13
  import { AttachmentLabels } from './attachment-labels.js';
14
14
  import { EntityPickerLabels } from './components/EntityPicker.js';
15
15
  import { TreeLabels } from './components/Tree.js';
16
+ import { OrgChartLabels } from './components/OrgChart.js';
16
17
  import { InlineEditLabels } from './components/InlineEdit.js';
18
+ import { DiscardPromptLabels } from './components/DiscardPrompt.js';
19
+ import { SearchBarLabels } from './components/SearchBar.js';
17
20
  import './link.js';
18
21
  import './calendar-model.js';
19
22
  import './scheduling-calendar-model.js';
@@ -26,6 +29,8 @@ import './json-value.js';
26
29
  import './rule-builder-model.js';
27
30
  import './file-model.js';
28
31
  import './components/SearchSuggest.js';
32
+ import './components/Button.js';
33
+ import './components/Kbd.js';
29
34
 
30
35
  /**
31
36
  * Kit chrome strings by component (HAR-1358; TENSOR C20, MOTUS executive summary #3).
@@ -43,6 +48,8 @@ interface UixLabels {
43
48
  drawer?: {
44
49
  close?: string;
45
50
  };
51
+ /** The "Discard changes?" step of a `dirty` Drawer or Modal (HAR-2029). */
52
+ discardPrompt?: Partial<DiscardPromptLabels>;
46
53
  peek?: {
47
54
  previous?: string;
48
55
  next?: string;
@@ -65,6 +72,8 @@ interface UixLabels {
65
72
  searchSuggest?: {
66
73
  clear?: string;
67
74
  };
75
+ /** `SearchBar` (HAR-2030): the clear button's name and the submit button's text. */
76
+ searchBar?: Partial<SearchBarLabels>;
68
77
  /** `resultsOne` / `resultsMany`: the polite result count; `{count}`. */
69
78
  commandPalette?: {
70
79
  input?: string;
@@ -73,6 +82,8 @@ interface UixLabels {
73
82
  };
74
83
  entityPicker?: Partial<EntityPickerLabels>;
75
84
  tree?: Partial<TreeLabels>;
85
+ /** `OrgChart` (HAR-1807): loading and error rows, the report count, the zoom toolbar. */
86
+ orgChart?: Partial<OrgChartLabels>;
76
87
  inlineEdit?: Partial<InlineEditLabels>;
77
88
  confirmDialog?: {
78
89
  typeToConfirm?: string;
@@ -1373,11 +1373,16 @@ function translationOf(el) {
1373
1373
  if (!t || t === "none" || typeof DOMMatrixReadOnly === "undefined") return { x: 0, y: 0 };
1374
1374
  try {
1375
1375
  const m = new DOMMatrixReadOnly(t);
1376
- return { x: m.m41, y: m.m42 };
1376
+ const z = zoomOf(el);
1377
+ return { x: m.m41 * z, y: m.m42 * z };
1377
1378
  } catch {
1378
1379
  return { x: 0, y: 0 };
1379
1380
  }
1380
1381
  }
1382
+ function zoomOf(el) {
1383
+ const z = el.currentCSSZoom;
1384
+ return typeof z === "number" && Number.isFinite(z) && z > 0 ? z : 1;
1385
+ }
1381
1386
  var signed = (n) => `${n < 0 ? "-" : "+"} ${Math.round(Math.abs(n) * 100) / 100}px`;
1382
1387
  var prepared = /* @__PURE__ */ new WeakSet();
1383
1388
  function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-start", offset = 6, padding = 8, shiftMainAxis = true, capHeight = false, onAnchorHidden }) {
@@ -1402,8 +1407,9 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
1402
1407
  const s = floating.style;
1403
1408
  if (keepPlace && current.anchor.isConnected) {
1404
1409
  const a = current.anchor.getBoundingClientRect();
1405
- s.top = `${Math.round((current.yEdge === "bottom" ? a.bottom : a.top) + current.dy)}px`;
1406
- s.left = `${Math.round((current.xEdge === "right" ? a.right : a.left) + current.dx)}px`;
1410
+ const z = zoomOf(floating);
1411
+ s.top = `${Math.round(((current.yEdge === "bottom" ? a.bottom : a.top) + current.dy) / z)}px`;
1412
+ s.left = `${Math.round(((current.xEdge === "right" ? a.right : a.left) + current.dx) / z)}px`;
1407
1413
  }
1408
1414
  s.removeProperty("position-anchor");
1409
1415
  }
@@ -1431,6 +1437,7 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
1431
1437
  written.current = "";
1432
1438
  }
1433
1439
  const { placement: p, offset: o, padding: pad, shiftMainAxis: keepInView, capHeight: cap } = opts.current;
1440
+ const zoom = floating.getClientRects().length > 0 ? zoomOf(floating) : zoomOf(anchorEl);
1434
1441
  if (cap) {
1435
1442
  if (!heightCap.current) {
1436
1443
  const own = getComputedStyle(floating);
@@ -1444,7 +1451,7 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
1444
1451
  };
1445
1452
  if (setOverflow) s.overflowY = "auto";
1446
1453
  }
1447
- const room = `${Math.max(0, window.innerHeight - 2 * pad)}px`;
1454
+ const room = `${Math.max(0, (window.innerHeight - 2 * pad * zoom) / zoom)}px`;
1448
1455
  const max = heightCap.current.ownMaxHeight ? `min(${room}, ${heightCap.current.ownMaxHeight})` : room;
1449
1456
  if (max !== heightCap.current.written) {
1450
1457
  s.maxHeight = max;
@@ -1454,19 +1461,19 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
1454
1461
  uncap();
1455
1462
  }
1456
1463
  const a = anchorEl.getBoundingClientRect();
1457
- const size = { width: floating.offsetWidth, height: floating.offsetHeight };
1464
+ const size = { width: floating.offsetWidth * zoom, height: floating.offsetHeight * zoom };
1458
1465
  const pos = computePosition(
1459
1466
  { x: a.x, y: a.y, width: a.width, height: a.height },
1460
1467
  size,
1461
1468
  { width: window.innerWidth, height: window.innerHeight },
1462
- { placement: p, offset: o, padding: pad, shiftMainAxis: keepInView, stickySide: side.current ?? void 0 }
1469
+ { placement: p, offset: o * zoom, padding: pad * zoom, shiftMainAxis: keepInView, stickySide: side.current ?? void 0 }
1463
1470
  );
1464
1471
  const measured = size.width > 0 || size.height > 0;
1465
1472
  if (measured && session.current) side.current = pos.side;
1466
1473
  if (floating.dataset.placement !== pos.placement) floating.dataset.placement = pos.placement;
1467
1474
  const writeFixed = (at) => {
1468
- const left2 = `${Math.round(at.x)}px`;
1469
- const top2 = `${Math.round(at.y)}px`;
1475
+ const left2 = `${Math.round(at.x / zoom)}px`;
1476
+ const top2 = `${Math.round(at.y / zoom)}px`;
1470
1477
  const key2 = `fixed ${left2} ${top2}`;
1471
1478
  if (key2 === written.current) return;
1472
1479
  s.left = left2;
@@ -1493,8 +1500,8 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
1493
1500
  current.xEdge = pos.side === "right" ? "right" : "left";
1494
1501
  current.dy = pos.y - (current.yEdge === "bottom" ? a.bottom : a.top);
1495
1502
  current.dx = pos.x - (current.xEdge === "right" ? a.right : a.left);
1496
- const top = `round(anchor(${current.yEdge}) ${signed(current.dy)}, 1px)`;
1497
- const left = `round(anchor(${current.xEdge}) ${signed(current.dx)}, 1px)`;
1503
+ const top = `round(anchor(${current.yEdge}) ${signed(current.dy / zoom)}, 1px)`;
1504
+ const left = `round(anchor(${current.xEdge}) ${signed(current.dx / zoom)}, 1px)`;
1498
1505
  const key = `anchored ${top} ${left}`;
1499
1506
  if (key !== written.current) {
1500
1507
  s.top = top;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tensor_1/react",
3
- "version": "2.41.0",
3
+ "version": "2.43.0",
4
4
  "description": "Thin React wrappers over the UIx v2 CSS component library.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",