@tensor_1/react 2.23.0 → 2.25.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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { RefObject, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, AriaAttributes, HTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, AnchorHTMLAttributes, MouseEvent, DetailsHTMLAttributes, TdHTMLAttributes, TableHTMLAttributes, ThHTMLAttributes } from 'react';
2
+ import { RefObject, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, AriaAttributes, HTMLAttributes, Ref, TextareaHTMLAttributes, SelectHTMLAttributes, AnchorHTMLAttributes, MouseEvent, DetailsHTMLAttributes, TdHTMLAttributes, TableHTMLAttributes, ThHTMLAttributes } from 'react';
3
3
  import { P as Placement } from './overlay-position-CEGSz6Z2.cjs';
4
4
  export { A as Align, a as PositionOptions, b as PositionResult, R as Rect, S as Side, c as Size, d as computePosition } from './overlay-position-CEGSz6Z2.cjs';
5
5
 
@@ -250,6 +250,108 @@ interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>
250
250
  /** Searchable single-select combobox with keyboard navigation and no framework dependencies. */
251
251
  declare function Combobox({ options, value, defaultValue, onValueChange, label, placeholder, emptyLabel, name, disabled, className, ...props }: ComboboxProps): react.JSX.Element;
252
252
 
253
+ /** One result row. */
254
+ interface SearchSuggestOption {
255
+ /** Stable id, returned by `onSelect`. */
256
+ id: string;
257
+ /** The result's name. Matched letters are emphasised. */
258
+ title: string;
259
+ /** Where the result lives, outermost first (a breadcrumb). Middle crumbs truncate first. */
260
+ meta?: readonly string[];
261
+ /** One or two lines of context, clamped at two lines. Matched letters are emphasised. */
262
+ description?: string;
263
+ /** Optional leading glyph (decorative). */
264
+ icon?: ReactNode;
265
+ }
266
+ /** A labelled action inside the list (the footer row, the heading action). */
267
+ interface SearchSuggestAction {
268
+ /** Visible text of the action. */
269
+ label: string;
270
+ /** Runs when the action is chosen. */
271
+ onSelect: () => void;
272
+ }
273
+ /** Props of {@link SearchSuggest}. */
274
+ interface SearchSuggestProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'onSelect' | 'title' | 'defaultValue'> {
275
+ /** The text in the field (controlled). */
276
+ value: string;
277
+ /** Called on every edit, and with an empty string when the field is cleared. */
278
+ onValueChange: (value: string) => void;
279
+ /** The suggestions to show, best first. The consumer filters; this component only renders. */
280
+ options: readonly SearchSuggestOption[];
281
+ /** Called when a row is chosen by click or Enter. The list closes afterwards. */
282
+ onSelect: (id: string, option: SearchSuggestOption) => void;
283
+ /** Accessible name of the field (there is no visible label; the placeholder is not a label). */
284
+ label: string;
285
+ placeholder?: string;
286
+ /** Text to emphasise in rows. Defaults to `value`. */
287
+ highlight?: string;
288
+ /** A title above the options, e.g. "Recently opened". */
289
+ heading?: string;
290
+ /** A small action next to the heading, e.g. "Clear". */
291
+ headingAction?: SearchSuggestAction;
292
+ /** A last row after the options, e.g. "Show all 23 results". Reachable by arrow keys. */
293
+ footer?: SearchSuggestAction;
294
+ /** The field is fetching suggestions: a spinner shows in the field and, with no options yet, in the list. */
295
+ loading?: boolean;
296
+ /** Announced while loading, and shown in the list when it has no rows yet. */
297
+ loadingLabel?: string;
298
+ /** Shown when the field has text, nothing is loading and there are no options. */
299
+ empty?: ReactNode;
300
+ /** Shown instead of the empty state when suggestions could not be loaded. */
301
+ error?: ReactNode;
302
+ /** A keyboard hint shown in the empty, unfocused field, e.g. "/". */
303
+ shortcutHint?: string;
304
+ /** Accessible name of the clear button (default "Clear search"). */
305
+ clearLabel?: string;
306
+ /** A polite announcement, e.g. "8 results". Rendered in a visually hidden live region. */
307
+ status?: string;
308
+ /** `lg` for a page-level search (hubs, start pages); `md` for a field in a toolbar or header. */
309
+ size?: 'md' | 'lg';
310
+ /** Controlled open state of the suggestion list (optional). */
311
+ open?: boolean;
312
+ /** Called when the list opens or closes. */
313
+ onOpenChange?: (open: boolean) => void;
314
+ /**
315
+ * `absolute` (default) places the list under the field inside its own box. `fixed` floats it on
316
+ * the viewport, so a clipping ancestor (`overflow: hidden` toolbars and headers) cannot cut it off;
317
+ * it follows the field on scroll and resize and flips above it when there is no room below.
318
+ */
319
+ strategy?: 'absolute' | 'fixed';
320
+ /** Focus the field from outside (e.g. a "/" shortcut). */
321
+ inputRef?: Ref<HTMLInputElement | null>;
322
+ /** Focus the field on mount. */
323
+ autoFocus?: boolean;
324
+ /** Form field name of the input. */
325
+ name?: string;
326
+ }
327
+ /**
328
+ * A search field with a suggestion list underneath: the "search and jump" pattern of Windows
329
+ * Settings, Android Settings and most docs sites. Each row shows a name, where it lives and a line
330
+ * of context. ARIA combobox pattern: focus stays in the field, arrow keys move the active row
331
+ * (`aria-activedescendant`), Enter opens it (the first row when none is active), Escape closes the
332
+ * list and a second Escape clears the text.
333
+ */
334
+ declare function SearchSuggest({ value, onValueChange, options, onSelect, label, placeholder, highlight, heading, headingAction, footer, loading, loadingLabel, empty, error, shortcutHint, clearLabel, status, size, open: openProp, strategy, onOpenChange, inputRef, autoFocus, name, className, onBlur, ...props }: SearchSuggestProps): react.JSX.Element;
335
+
336
+ /** One run of a result's text, emphasised or not. */
337
+ interface SearchSegment {
338
+ text: string;
339
+ match: boolean;
340
+ }
341
+ /** Text folded for matching, with a map back to the original characters. */
342
+ interface FoldedText {
343
+ /** The folded text: lower case, diacritics stripped, ß → ss. */
344
+ text: string;
345
+ /** For each index of `text`, the start index of the original character it came from. */
346
+ source: number[];
347
+ /** For each index of `text`, the end index (exclusive) of that original character. */
348
+ sourceEnd: number[];
349
+ }
350
+ /** Fold `text` for matching and keep a map back to the original indices. */
351
+ declare function foldForSearch(text: string): FoldedText;
352
+ /** Split `text` into matched and unmatched segments for `query`. */
353
+ declare function searchSegments(text: string, query: string): SearchSegment[];
354
+
253
355
  interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
254
356
  invalid?: boolean;
255
357
  }
@@ -289,11 +391,19 @@ interface FieldProps {
289
391
  error?: string;
290
392
  success?: string;
291
393
  required?: boolean;
394
+ /**
395
+ * Plain-text help behind a ? button after the label (before the required marker). Blank
396
+ * lines separate paragraphs; empty, whitespace-only or `null` renders no button. Needs `label`.
397
+ * Keep format or validation instructions in `hint`, where they stay visible.
398
+ */
399
+ help?: string | null;
400
+ /** Accessible name of the ? button. Default `"About: <label>"`; pass a localised one. */
401
+ helpLabel?: string;
292
402
  children: ReactNode;
293
403
  className?: string;
294
404
  htmlFor?: string;
295
405
  }
296
- declare function Field({ label, hint, error, success, required, children, className, htmlFor }: FieldProps): react.JSX.Element;
406
+ declare function Field({ label, hint, error, success, required, help, helpLabel, children, className, htmlFor }: FieldProps): react.JSX.Element;
297
407
 
298
408
  interface ModalProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
299
409
  open: boolean;
@@ -372,11 +482,18 @@ interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
372
482
  /** Element for the title — pick a real heading to slot the card into the page outline (UIX-A11Y-4). Default `div` keeps legacy rendering. */
373
483
  titleAs?: 'h2' | 'h3' | 'h4' | 'div';
374
484
  subtitle?: ReactNode;
485
+ /**
486
+ * Plain-text help behind a ? button after the title. Blank lines separate paragraphs;
487
+ * empty, whitespace-only or `null` renders no button.
488
+ */
489
+ help?: string | null;
490
+ /** Accessible name of the ? button. Default `"About: <title>"` when title is text; pass a localised one. */
491
+ helpLabel?: string;
375
492
  headerAction?: ReactNode;
376
493
  footer?: ReactNode;
377
494
  children?: ReactNode;
378
495
  }
379
- declare function Card({ title, titleAs: TitleTag, subtitle, headerAction, footer, children, className, ...props }: CardProps): react.JSX.Element;
496
+ declare function Card({ title, titleAs: TitleTag, subtitle, help, helpLabel, headerAction, footer, children, className, ...props }: CardProps): react.JSX.Element;
380
497
  interface CardLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'title'> {
381
498
  title?: ReactNode;
382
499
  subtitle?: ReactNode;
@@ -408,14 +525,21 @@ interface PageHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
408
525
  as?: 'h1' | 'h2';
409
526
  /** Supporting copy under the title. */
410
527
  subtitle?: ReactNode;
528
+ /**
529
+ * Plain-text help behind a ? button right after the title. Blank lines separate paragraphs;
530
+ * empty, whitespace-only or `null` renders no button.
531
+ */
532
+ help?: string | null;
533
+ /** Accessible name of the ? button. Default `"About: <title>"` when title is text; pass a localised one. */
534
+ helpLabel?: string;
411
535
  /** Right-aligned action area (buttons, menus). */
412
536
  actions?: ReactNode;
413
537
  }
414
538
  /**
415
- * Page header — eyebrow / title / subtitle + actions row, over `.uix-page-header`.
539
+ * Page header — eyebrow / title (+ optional `help` ?) / subtitle + actions row, over `.uix-page-header`.
416
540
  * The hairline + breathing room below come from the component CSS.
417
541
  */
418
- declare function PageHeader({ eyebrow, title, subtitle, actions, as: TitleTag, className, ...props }: PageHeaderProps): react.JSX.Element;
542
+ declare function PageHeader({ eyebrow, title, subtitle, help, helpLabel, actions, as: TitleTag, className, ...props }: PageHeaderProps): react.JSX.Element;
419
543
 
420
544
  interface DetailLayoutProps extends HTMLAttributes<HTMLDivElement> {
421
545
  /** The narrow trailing column (record meta, side panels). */
@@ -1017,6 +1141,30 @@ interface TooltipProps extends HTMLAttributes<HTMLSpanElement> {
1017
1141
  */
1018
1142
  declare function Tooltip({ label, placement, className, children, ...props }: TooltipProps): react.JSX.Element;
1019
1143
 
1144
+ interface InfoTipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'content' | 'children'> {
1145
+ /**
1146
+ * Help text, rendered as plain text (never HTML). A blank line starts a new paragraph.
1147
+ * Empty or whitespace-only text renders nothing, so a missing help string needs no guard.
1148
+ */
1149
+ content: string;
1150
+ /** Accessible name of the ? button, e.g. "About: Incidents". The consumer localises it. */
1151
+ label: string;
1152
+ /** Preferred panel placement. Default `'bottom-start'`. */
1153
+ placement?: Placement;
1154
+ }
1155
+ /**
1156
+ * A small ? that explains a page, section or field. It is a fixed 9 px glyph, superscript at
1157
+ * the top right of the text it follows (25 px hit area). The panel opens on hover (after a short delay), on
1158
+ * keyboard focus, and on click or tap; a click keeps it open until a second click, Esc or a
1159
+ * click outside. Esc returns focus to the button. The panel is plain text in
1160
+ * the top layer (kit `Popover`, `popover="manual"`, so opening it never closes another popover)
1161
+ * and is the button's `aria-describedby`, so the text is announced on focus.
1162
+ *
1163
+ * Do not put it inside a `<label>`, a heading or a link: `Field`, `PageHeader`, `Card` and
1164
+ * `SectionHead` place it beside those through their `help` prop.
1165
+ */
1166
+ declare function InfoTip({ content, ...props }: InfoTipProps): react.JSX.Element | null;
1167
+
1020
1168
  type StateVariant = 'section' | 'inline' | 'drawer' | 'page' | 'full-page';
1021
1169
  interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
1022
1170
  icon?: ReactNode;
@@ -1268,15 +1416,40 @@ interface ViewMenuColumn {
1268
1416
  label: ReactNode;
1269
1417
  visible: boolean;
1270
1418
  disabled?: boolean;
1419
+ /** Always shown (e.g. the record id): the row has no checkbox and no Hide / Show, its name sits in the checkbox's slot. */
1420
+ required?: boolean;
1421
+ /** Plain-text name for the `{label}` templates in `columnLabels` when `label` is not a string. */
1422
+ textLabel?: string;
1423
+ }
1424
+ /**
1425
+ * Words for the column rows. `{label}` is replaced by the column name; `moved` also gets
1426
+ * `{position}` and `{count}`. Every key has an English default.
1427
+ */
1428
+ interface ViewMenuColumnLabels {
1429
+ /** Name of a row's ⋯ menu button and of the menu. Default `Column actions: {label}`. */
1430
+ rowActions: string;
1431
+ /** Name of a row's drag grip. Default `Drag to reorder: {label}`. */
1432
+ reorder: string;
1433
+ moveUp: string;
1434
+ moveDown: string;
1435
+ hide: string;
1436
+ show: string;
1437
+ /** Tooltip on a required column's name. Default `Always shown`. */
1438
+ required: string;
1439
+ /** Polite announcement after a move. Default `{label} moved to position {position} of {count}`. */
1440
+ moved: string;
1271
1441
  }
1272
1442
  interface ViewMenuProps {
1273
- density: string;
1274
- densityLabel: ReactNode;
1275
- densityOptions: readonly {
1443
+ /** The density section renders when `densityOptions` and `onDensityChange` are given. */
1444
+ density?: string;
1445
+ densityLabel?: ReactNode;
1446
+ densityOptions?: readonly {
1276
1447
  value: string;
1277
1448
  label: ReactNode;
1278
1449
  }[];
1279
- onDensityChange: (value: string) => void;
1450
+ onDensityChange?: (value: string) => void;
1451
+ /** Optional title over the zebra / freeze switches. */
1452
+ displayLabel?: ReactNode;
1280
1453
  zebra?: {
1281
1454
  checked: boolean;
1282
1455
  label: ReactNode;
@@ -1290,9 +1463,23 @@ interface ViewMenuProps {
1290
1463
  columns?: readonly ViewMenuColumn[];
1291
1464
  columnsLabel?: ReactNode;
1292
1465
  onColumnVisibilityChange?: (id: string, visible: boolean) => void;
1466
+ /**
1467
+ * Turns on reordering: every column row gets a drag grip (pointer; ArrowUp / ArrowDown once
1468
+ * focused) and a ⋯ menu with Move up · Move down · Hide / Show, which is the keyboard path.
1469
+ * Receives every column id, first to last. The order is the application's to persist.
1470
+ */
1471
+ onReorder?: (orderedIds: string[]) => void;
1472
+ columnLabels?: Partial<ViewMenuColumnLabels>;
1473
+ /** Pinned under the columns, e.g. a Reset sort `.uix-menu__item` button. */
1474
+ footer?: ReactNode;
1475
+ className?: string;
1293
1476
  }
1294
- /** Controlled table presentation menu; wrap it with Popover when trigger behavior is needed. */
1295
- declare function ViewMenu({ density, densityLabel, densityOptions, onDensityChange, zebra, freeze, columns, columnsLabel, onColumnVisibilityChange }: ViewMenuProps): react.JSX.Element;
1477
+ /**
1478
+ * Controlled table presentation panel with its own surface: density, zebra / freeze and a column
1479
+ * list under sticky section titles. A column row is grip · checkbox · name · ⋯ (grip and ⋯ with
1480
+ * `onReorder`). Usable inside a Popover or any overlay shell, including one that adds no chrome.
1481
+ */
1482
+ declare function ViewMenu({ density, densityLabel, densityOptions, onDensityChange, displayLabel, zebra, freeze, columns, columnsLabel, onColumnVisibilityChange, onReorder, columnLabels, footer, className, }: ViewMenuProps): react.JSX.Element;
1296
1483
  interface FilterOption {
1297
1484
  value: string;
1298
1485
  label: string;
@@ -1694,11 +1881,18 @@ interface SectionHeadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
1694
1881
  title: ReactNode;
1695
1882
  /** id for the `<h2>`, for `aria-labelledby` wiring on the enclosing section. */
1696
1883
  titleId?: string;
1884
+ /**
1885
+ * Plain-text help behind a ? button after the title. Blank lines separate paragraphs;
1886
+ * empty, whitespace-only or `null` renders no button.
1887
+ */
1888
+ help?: string | null;
1889
+ /** Accessible name of the ? button. Default `"About: <title>"` when title is text; pass a localised one. */
1890
+ helpLabel?: string;
1697
1891
  /** Right-aligned slot — a `.uix-section-link` anchor, a button, a pill. */
1698
1892
  action?: ReactNode;
1699
1893
  }
1700
- /** Section head — title row with an optional trailing action (`.uix-section-head`). */
1701
- declare function SectionHead({ title, titleId, action, className, ...props }: SectionHeadProps): react.JSX.Element;
1894
+ /** Section head — title row (+ optional `help` ?) with an optional trailing action (`.uix-section-head`). */
1895
+ declare function SectionHead({ title, titleId, help, helpLabel, action, className, ...props }: SectionHeadProps): react.JSX.Element;
1702
1896
  interface NoticeQueueProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
1703
1897
  /** Leading icon slot. */
1704
1898
  icon?: ReactNode;
@@ -2611,6 +2805,11 @@ declare function summarizeDiff(entries: DiffEntry[], resolutions?: Record<string
2611
2805
  * Every word the diff viewer renders (TENSOR RX-125, UIX-12). `base` / `current` /
2612
2806
  * `incoming` keep their meaning from before; `{path}`, `{version}`, `{resolved}` and
2613
2807
  * `{total}` are placeholders.
2808
+ *
2809
+ * `acceptIncomingFor` / `keepCurrentFor` / `markPendingFor` are the accessible names of
2810
+ * the three action buttons, so a screen reader hears which entry each one resolves. Keep
2811
+ * the visible word inside the translated name (WCAG 2.5.3 Label in Name): speech-input
2812
+ * users say what they see.
2614
2813
  */
2615
2814
  interface DiffViewerLabels {
2616
2815
  base: string;
@@ -2631,6 +2830,9 @@ interface DiffViewerLabels {
2631
2830
  acceptIncoming: string;
2632
2831
  keepCurrent: string;
2633
2832
  markPending: string;
2833
+ acceptIncomingFor: string;
2834
+ keepCurrentFor: string;
2835
+ markPendingFor: string;
2634
2836
  resolutionAccept: string;
2635
2837
  resolutionSkip: string;
2636
2838
  resolutionPending: string;
@@ -2646,10 +2848,16 @@ interface DiffViewerProps {
2646
2848
  resolutions?: Record<string, DiffResolution>;
2647
2849
  onResolutionChange?: (path: string, resolution: DiffResolution) => void;
2648
2850
  labels?: Partial<DiffViewerLabels>;
2851
+ /**
2852
+ * Height of the resolution buttons and the entry disclosure rows. `sm` (the default) is
2853
+ * the compact 28px kit size; `md` follows `--uix-control-h`, so a theme that sets its
2854
+ * own control height (for example 60px touch targets) gets it here too; `lg` is 44px.
2855
+ */
2856
+ controlSize?: 'sm' | 'md' | 'lg';
2649
2857
  className?: string;
2650
2858
  }
2651
2859
  /** Three-way configuration diff with per-entry keyboard-operable resolution. */
2652
- declare function DiffViewer({ base, current, incoming, entries: providedEntries, resolutions: controlledResolutions, onResolutionChange, labels: labelOverrides, className, }: DiffViewerProps): react.JSX.Element;
2860
+ declare function DiffViewer({ base, current, incoming, entries: providedEntries, resolutions: controlledResolutions, onResolutionChange, labels: labelOverrides, controlSize, className, }: DiffViewerProps): react.JSX.Element;
2653
2861
 
2654
2862
  /**
2655
2863
  * Every word the colour picker renders (TENSOR RX-125, UIX-12). `{label}`, `{color}`,
@@ -2706,4 +2914,4 @@ declare function hsvToHex(value: HsvColor): string;
2706
2914
  declare function contrastRatio(background: string, foreground: string): number | undefined;
2707
2915
  declare function meetsContrast(background: string, foreground: string, minimum?: number): boolean;
2708
2916
 
2709
- export { type AccessStateProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, type AppliedBrandProfileSnapshot, type AsyncOperationState, AsyncOperationStatus, type AsyncOperationStatusProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type BoundedRelationshipGraph, type BrandProfile, BrandProfileEditor, type BrandProfileEditorLabels, type BrandProfileEditorProps, type BrandProfileLogo, type BrandProfileTypography, BrandProfiles, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, BuilderCanvas, type BuilderCanvasItem, type BuilderCanvasLabels, type BuilderCanvasProps, type BuilderPaletteItem, BulkBar, type BulkBarProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type CalendarDay, Card, CardLink, type CardLinkProps, type CardProps, CellStrong, CellSub, Checkbox, type CheckboxProps, CollapsibleSection, type CollapsibleSectionProps, ColorPicker, type ColorPickerLabels, type ColorPickerProps, type ColumnFilter, Combobox, type ComboboxOption, type ComboboxProps, CommandGroup, type CommandGroupProps, CommandItem, type CommandItemProps, CommandPalette, type CommandPaletteProps, Comment, type CommentProps, Comments, type CommentsProps, Composer, ComposerBar, type ComposerBarProps, type ComposerProps, ConfirmDialog, type ConfirmDialogProps, ContentList, ContentListItem, type ContentListItemProps, type ContentListProps, CopyButton, type CopyButtonProps, DEFAULT_BRAND_PROFILE_EDITOR_LABELS, DEFAULT_BUILDER_CANVAS_LABELS, DEFAULT_COLOR_PICKER_LABELS, DEFAULT_DATE_RANGE_PICKER_LABELS, DEFAULT_DIFF_VIEWER_LABELS, DEFAULT_MATCH_REVIEW_LABELS, DEFAULT_PAGINATION_LABELS, DEFAULT_RELATIONSHIP_GRAPH_LABELS, DEFAULT_RULE_BUILDER_LABELS, DEFAULT_SAVE_STATUS_LABELS, DEFAULT_SCHEDULING_CALENDAR_LABELS, DateRangePicker, type DateRangePickerLabels, type DateRangePickerProps, type DateRangeValue, DescriptionItem, type DescriptionItemProps, DescriptionList, type DescriptionListItem, type DescriptionListProps, DetailLayout, type DetailLayoutProps, DetailPage, type DetailPageLinkProps, type DetailPageMetric, type DetailPageProps, type DetailPageTab, type DiffEntry, type DiffKind, type DiffResolution, type DiffSummary, DiffViewer, type DiffViewerLabels, type DiffViewerProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, EventRow, type EventRowProps, ExpandToggle, type ExpandToggleProps, FeaturedRundown, FeaturedRundownItem, type FeaturedRundownItemProps, type FeaturedRundownProps, FeaturedStage, type FeaturedStageProps, Field, type FieldProps, type FilterKind, type FilterOp, type FilterOption, FilterPopover, type FilterPopoverProps, FilteredEmptyState, type FlatNode, Flow, FlowNode, type FlowNodeProps, type FlowNodeState, type FlowProps, type FlowVariant, ForbiddenState, Highlighted, type HighlightedProps, type HsvColor, Inbox, InboxDetail, type InboxDetailProps, InboxItem, type InboxItemProps, InboxList, type InboxListProps, type InboxProps, Input, InputGroup, type InputGroupProps, type InputProps, type JsonPrimitive, type JsonValue, Kanban, KanbanCard, type KanbanCardProps, KanbanColumn, type KanbanColumnProps, type KanbanMoveDirection, type KanbanProps, Label, type LabelProps, type LayeredColumn, type LayeredEdgeClassification, type LayeredEdgeKind, type LayeredItem, type LayeredLayout, type LayeredLayoutOptions, type LayeredNavigationKey, LicensePositionBar, type LicensePositionBarProps, List, ListItem, type ListItemProps, type ListProps, LoadingState, type LoadingStateProps, Mark, type MarkProps, type MatchBulkResult, MatchReview, type MatchReviewAction, type MatchReviewCandidate, type MatchReviewField, type MatchReviewLabels, type MatchReviewProps, Meter, type MeterProps, type MeterTone, MetricInput, type MetricInputProps, Modal, type ModalProps, type NavFavouriteItem, NavFavourites, type NavFavouritesLabels, type NavFavouritesProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, NewsLead, type NewsLeadProps, NotFoundState, Note, type NoteProps, type NoteTone, NoticeQueue, type NoticeQueueProps, PageHeader, type PageHeaderProps, PageIntro, type PageIntroProps, Pagination, type PaginationLabels, type PaginationProps, Peek, type PeekProps, type PillTone, type PillTreatment, Pipeline, type PipelineProps, PipelineStage, type PipelineStageProps, type PipelineStageState, Placement, Popover, type PopoverProps, type PositionedRelationshipNode, type Primitive, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Prose, type ProseProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RelatedLinkItem, RelatedLinks, type RelatedLinksProps, RelationshipGraph, type RelationshipGraphArrow, type RelationshipGraphCluster, type RelationshipGraphEdge, type RelationshipGraphLabels, type RelationshipGraphLegendItem, type RelationshipGraphNode, type RelationshipGraphProps, RelativeTime, type RelativeTimeFormatContext, type RelativeTimeProps, type RelativeTimeUnit, type RelativeTimeValue, ResourceGrid, type ResourceGridProps, type RgbColor, type RoutedEdge, type Row, RowAction, type RowActionProps, RowActions, type RowActionsProps, type RuleAction, type RuleActionDefinition, RuleBuilder, type RuleBuilderLabels, type RuleBuilderProps, type RuleCondition, type RuleDefinition, type RuleFieldDefinition, type RuleGroup, type RuleOperatorDefinition, type RuleValidationIssue, type RuleValueEditorProps, SaveStatus, type SaveStatusLabels, type SaveStatusProps, type SaveStatusState, type SavedViewItem, SavedViewMenu, type SavedViewMenuProps, type SavedViewSection, SchedulingCalendar, type SchedulingCalendarEntry, type SchedulingCalendarLabels, type SchedulingCalendarOverlay, type SchedulingCalendarProps, type SchedulingCalendarView, type SchedulingEntryState, type SchedulingOverlayKind, SectionHead, type SectionHeadProps, type Segment, Segmented, SegmentedOption, type SegmentedOptionProps, type SegmentedProps, Select, type SelectAllState, type SelectProps, type ShellNav, Sidebar, type SidebarProps, SidebarSection, type SidebarSectionProps, Skeleton, type SkeletonProps, type SortDir, type SortDirection, type SortKey, Spinner, type SpinnerProps, StarButton, type StarButtonProps, Stat, StatLine, type StatLineItem, type StatLineProps, type StatProps, type StatTrend, type StateVariant, StatusPill, type StatusPillProps, StatusRow, type StatusRowProps, SubNavItem, type SubNavItemProps, Switch, type SwitchProps, Tab, TabPanel, type TabPanelProps, type TabProps, Table, type TableDensity, type TableProps, TableWrap, type TableWrapProps, Tabs, type TabsProps, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Timeline, TimelineItem, type TimelineItemProps, type TimelineProps, Toast, type ToastProps, type ToastTone, Toaster, type ToasterProps, ToggleRow, type ToggleRowProps, Tooltip, type TooltipProps, Tr, type TrProps, Tree, type TreeLike, type TreeNavAction, type TreeNodeData, type TreeNodeProps, type TreeProps, type UseAnchoredPositionOptions, type UseTableOptions, type UseTableResult, type UseVirtualRowsOptions, type UseVirtualRowsResult, UserChip, type UserChipProps, ViewMenu, type ViewMenuColumn, type ViewMenuProps, type ViewState, type VirtualWindow, type ZonedDateSpan, addCalendarDays, addCalendarMonths, appendRuleNode, applyBrandProfile, applyFilters, boundRelationshipGraph, buildMonthGrid, buildThreeWayDiff, clampMetricValue, clampWidth, classifyLayeredEdges, clusterIdFor, contrastRatio, cx, enumerateDateSpan, filterComboboxOptions, findRuleNodeDepth, flattenTree, hexToRgb, highlightSegments, hsvToHex, hsvToRgb, isDateInRange, isDateUnavailable, isRuleGroup, layeredNeighbor, layoutLayeredGraph, layoutRelationshipGraph, mapRuleGroup, matchFilter, meetsContrast, mergePinned, moveRuleNode, multiSort, nextSortDir, normalizeHex, parseDateValue, parseMetricValue, parseView, relationshipNeighbors, relativeTimeValue, removeRuleNode, reorder, restoreBrandProfile, rgbToHex, rgbToHsv, ruleDepth, searchRows, selectAllState, selectRangeDate, serializeView, shouldVirtualize, startOfMonth, stepMetricValue, summarizeDiff, summarizeRule, toDateKey, toggleId, togglePage, toggleSort, traverseRelationshipNode, treeNav, useAnchoredPosition, useDialog, useTable, useVirtualRows, validateRuleDefinition, virtualWindow, wrapEdgeLabel, zonedDateKey, zonedDateSpan };
2917
+ export { type AccessStateProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, type AppliedBrandProfileSnapshot, type AsyncOperationState, AsyncOperationStatus, type AsyncOperationStatusProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type BoundedRelationshipGraph, type BrandProfile, BrandProfileEditor, type BrandProfileEditorLabels, type BrandProfileEditorProps, type BrandProfileLogo, type BrandProfileTypography, BrandProfiles, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, BuilderCanvas, type BuilderCanvasItem, type BuilderCanvasLabels, type BuilderCanvasProps, type BuilderPaletteItem, BulkBar, type BulkBarProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type CalendarDay, Card, CardLink, type CardLinkProps, type CardProps, CellStrong, CellSub, Checkbox, type CheckboxProps, CollapsibleSection, type CollapsibleSectionProps, ColorPicker, type ColorPickerLabels, type ColorPickerProps, type ColumnFilter, Combobox, type ComboboxOption, type ComboboxProps, CommandGroup, type CommandGroupProps, CommandItem, type CommandItemProps, CommandPalette, type CommandPaletteProps, Comment, type CommentProps, Comments, type CommentsProps, Composer, ComposerBar, type ComposerBarProps, type ComposerProps, ConfirmDialog, type ConfirmDialogProps, ContentList, ContentListItem, type ContentListItemProps, type ContentListProps, CopyButton, type CopyButtonProps, DEFAULT_BRAND_PROFILE_EDITOR_LABELS, DEFAULT_BUILDER_CANVAS_LABELS, DEFAULT_COLOR_PICKER_LABELS, DEFAULT_DATE_RANGE_PICKER_LABELS, DEFAULT_DIFF_VIEWER_LABELS, DEFAULT_MATCH_REVIEW_LABELS, DEFAULT_PAGINATION_LABELS, DEFAULT_RELATIONSHIP_GRAPH_LABELS, DEFAULT_RULE_BUILDER_LABELS, DEFAULT_SAVE_STATUS_LABELS, DEFAULT_SCHEDULING_CALENDAR_LABELS, DateRangePicker, type DateRangePickerLabels, type DateRangePickerProps, type DateRangeValue, DescriptionItem, type DescriptionItemProps, DescriptionList, type DescriptionListItem, type DescriptionListProps, DetailLayout, type DetailLayoutProps, DetailPage, type DetailPageLinkProps, type DetailPageMetric, type DetailPageProps, type DetailPageTab, type DiffEntry, type DiffKind, type DiffResolution, type DiffSummary, DiffViewer, type DiffViewerLabels, type DiffViewerProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, EventRow, type EventRowProps, ExpandToggle, type ExpandToggleProps, FeaturedRundown, FeaturedRundownItem, type FeaturedRundownItemProps, type FeaturedRundownProps, FeaturedStage, type FeaturedStageProps, Field, type FieldProps, type FilterKind, type FilterOp, type FilterOption, FilterPopover, type FilterPopoverProps, FilteredEmptyState, type FlatNode, Flow, FlowNode, type FlowNodeProps, type FlowNodeState, type FlowProps, type FlowVariant, type FoldedText, ForbiddenState, Highlighted, type HighlightedProps, type HsvColor, Inbox, InboxDetail, type InboxDetailProps, InboxItem, type InboxItemProps, InboxList, type InboxListProps, type InboxProps, InfoTip, type InfoTipProps, Input, InputGroup, type InputGroupProps, type InputProps, type JsonPrimitive, type JsonValue, Kanban, KanbanCard, type KanbanCardProps, KanbanColumn, type KanbanColumnProps, type KanbanMoveDirection, type KanbanProps, Label, type LabelProps, type LayeredColumn, type LayeredEdgeClassification, type LayeredEdgeKind, type LayeredItem, type LayeredLayout, type LayeredLayoutOptions, type LayeredNavigationKey, LicensePositionBar, type LicensePositionBarProps, List, ListItem, type ListItemProps, type ListProps, LoadingState, type LoadingStateProps, Mark, type MarkProps, type MatchBulkResult, MatchReview, type MatchReviewAction, type MatchReviewCandidate, type MatchReviewField, type MatchReviewLabels, type MatchReviewProps, Meter, type MeterProps, type MeterTone, MetricInput, type MetricInputProps, Modal, type ModalProps, type NavFavouriteItem, NavFavourites, type NavFavouritesLabels, type NavFavouritesProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, NewsLead, type NewsLeadProps, NotFoundState, Note, type NoteProps, type NoteTone, NoticeQueue, type NoticeQueueProps, PageHeader, type PageHeaderProps, PageIntro, type PageIntroProps, Pagination, type PaginationLabels, type PaginationProps, Peek, type PeekProps, type PillTone, type PillTreatment, Pipeline, type PipelineProps, PipelineStage, type PipelineStageProps, type PipelineStageState, Placement, Popover, type PopoverProps, type PositionedRelationshipNode, type Primitive, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Prose, type ProseProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RelatedLinkItem, RelatedLinks, type RelatedLinksProps, RelationshipGraph, type RelationshipGraphArrow, type RelationshipGraphCluster, type RelationshipGraphEdge, type RelationshipGraphLabels, type RelationshipGraphLegendItem, type RelationshipGraphNode, type RelationshipGraphProps, RelativeTime, type RelativeTimeFormatContext, type RelativeTimeProps, type RelativeTimeUnit, type RelativeTimeValue, ResourceGrid, type ResourceGridProps, type RgbColor, type RoutedEdge, type Row, RowAction, type RowActionProps, RowActions, type RowActionsProps, type RuleAction, type RuleActionDefinition, RuleBuilder, type RuleBuilderLabels, type RuleBuilderProps, type RuleCondition, type RuleDefinition, type RuleFieldDefinition, type RuleGroup, type RuleOperatorDefinition, type RuleValidationIssue, type RuleValueEditorProps, SaveStatus, type SaveStatusLabels, type SaveStatusProps, type SaveStatusState, type SavedViewItem, SavedViewMenu, type SavedViewMenuProps, type SavedViewSection, SchedulingCalendar, type SchedulingCalendarEntry, type SchedulingCalendarLabels, type SchedulingCalendarOverlay, type SchedulingCalendarProps, type SchedulingCalendarView, type SchedulingEntryState, type SchedulingOverlayKind, type SearchSegment, SearchSuggest, type SearchSuggestAction, type SearchSuggestOption, type SearchSuggestProps, SectionHead, type SectionHeadProps, type Segment, Segmented, SegmentedOption, type SegmentedOptionProps, type SegmentedProps, Select, type SelectAllState, type SelectProps, type ShellNav, Sidebar, type SidebarProps, SidebarSection, type SidebarSectionProps, Skeleton, type SkeletonProps, type SortDir, type SortDirection, type SortKey, Spinner, type SpinnerProps, StarButton, type StarButtonProps, Stat, StatLine, type StatLineItem, type StatLineProps, type StatProps, type StatTrend, type StateVariant, StatusPill, type StatusPillProps, StatusRow, type StatusRowProps, SubNavItem, type SubNavItemProps, Switch, type SwitchProps, Tab, TabPanel, type TabPanelProps, type TabProps, Table, type TableDensity, type TableProps, TableWrap, type TableWrapProps, Tabs, type TabsProps, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Timeline, TimelineItem, type TimelineItemProps, type TimelineProps, Toast, type ToastProps, type ToastTone, Toaster, type ToasterProps, ToggleRow, type ToggleRowProps, Tooltip, type TooltipProps, Tr, type TrProps, Tree, type TreeLike, type TreeNavAction, type TreeNodeData, type TreeNodeProps, type TreeProps, type UseAnchoredPositionOptions, type UseTableOptions, type UseTableResult, type UseVirtualRowsOptions, type UseVirtualRowsResult, UserChip, type UserChipProps, ViewMenu, type ViewMenuColumn, type ViewMenuColumnLabels, type ViewMenuProps, type ViewState, type VirtualWindow, type ZonedDateSpan, addCalendarDays, addCalendarMonths, appendRuleNode, applyBrandProfile, applyFilters, boundRelationshipGraph, buildMonthGrid, buildThreeWayDiff, clampMetricValue, clampWidth, classifyLayeredEdges, clusterIdFor, contrastRatio, cx, enumerateDateSpan, filterComboboxOptions, findRuleNodeDepth, flattenTree, foldForSearch, hexToRgb, highlightSegments, hsvToHex, hsvToRgb, isDateInRange, isDateUnavailable, isRuleGroup, layeredNeighbor, layoutLayeredGraph, layoutRelationshipGraph, mapRuleGroup, matchFilter, meetsContrast, mergePinned, moveRuleNode, multiSort, nextSortDir, normalizeHex, parseDateValue, parseMetricValue, parseView, relationshipNeighbors, relativeTimeValue, removeRuleNode, reorder, restoreBrandProfile, rgbToHex, rgbToHsv, ruleDepth, searchRows, searchSegments, selectAllState, selectRangeDate, serializeView, shouldVirtualize, startOfMonth, stepMetricValue, summarizeDiff, summarizeRule, toDateKey, toggleId, togglePage, toggleSort, traverseRelationshipNode, treeNav, useAnchoredPosition, useDialog, useTable, useVirtualRows, validateRuleDefinition, virtualWindow, wrapEdgeLabel, zonedDateKey, zonedDateSpan };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,8 @@ export { Button, ButtonGroup, ButtonGroupProps, ButtonProps } from './components
8
8
  export { Input, InputGroup, InputGroupProps, InputProps } from './components/Input.js';
9
9
  export { Combobox, ComboboxProps } from './components/Combobox.js';
10
10
  export { ComboboxOption, filterComboboxOptions } from './combobox-model.js';
11
+ export { SearchSuggest, SearchSuggestAction, SearchSuggestOption, SearchSuggestProps } from './components/SearchSuggest.js';
12
+ export { FoldedText, SearchSegment, foldForSearch, searchSegments } from './search-suggest-model.js';
11
13
  export { Textarea, TextareaProps } from './components/Textarea.js';
12
14
  export { Select, SelectProps } from './components/Select.js';
13
15
  export { Checkbox, CheckboxProps } from './components/Checkbox.js';
@@ -45,6 +47,7 @@ export { Progress, ProgressProps } from './components/Progress.js';
45
47
  export { Meter, MeterProps, MeterTone } from './components/Meter.js';
46
48
  export { Stat, StatProps, StatTrend } from './components/Stat.js';
47
49
  export { Tooltip, TooltipProps } from './components/Tooltip.js';
50
+ export { InfoTip, InfoTipProps } from './components/InfoTip.js';
48
51
  export { AccessStateProps, EmptyState, EmptyStateProps, ErrorState, ErrorStateProps, FilteredEmptyState, ForbiddenState, LoadingState, LoadingStateProps, NotFoundState, Skeleton, SkeletonProps, StateVariant } from './components/States.js';
49
52
  export { RelativeTime, RelativeTimeFormatContext, RelativeTimeProps } from './components/RelativeTime.js';
50
53
  export { RelativeTimeUnit, RelativeTimeValue, parseDateValue, relativeTimeValue } from './relative-time-model.js';
@@ -55,7 +58,7 @@ export { Comment, CommentProps, Comments, CommentsProps } from './components/Com
55
58
  export { DEFAULT_SAVE_STATUS_LABELS, SaveStatus, SaveStatusLabels, SaveStatusProps, SaveStatusState } from './components/SaveStatus.js';
56
59
  export { Composer, ComposerBar, ComposerBarProps, ComposerProps } from './components/Composer.js';
57
60
  export { Segmented, SegmentedOption, SegmentedOptionProps, SegmentedProps } from './components/Segmented.js';
58
- export { FilterOption, FilterPopover, FilterPopoverProps, SavedViewItem, SavedViewMenu, SavedViewMenuProps, SavedViewSection, ViewMenu, ViewMenuColumn, ViewMenuProps } from './components/TableControls.js';
61
+ export { FilterOption, FilterPopover, FilterPopoverProps, SavedViewItem, SavedViewMenu, SavedViewMenuProps, SavedViewSection, ViewMenu, ViewMenuColumn, ViewMenuColumnLabels, ViewMenuProps } from './components/TableControls.js';
59
62
  export { Timeline, TimelineItem, TimelineItemProps, TimelineProps } from './components/Timeline.js';
60
63
  export { Pipeline, PipelineProps, PipelineStage, PipelineStageProps, PipelineStageState } from './components/Pipeline.js';
61
64
  export { Flow, FlowNode, FlowNodeProps, FlowNodeState, FlowProps, FlowVariant } from './components/Flow.js';
package/dist/index.js CHANGED
@@ -8,6 +8,8 @@ import { Button, ButtonGroup } from "./components/Button.js";
8
8
  import { Input, InputGroup } from "./components/Input.js";
9
9
  import { Combobox } from "./components/Combobox.js";
10
10
  import { filterComboboxOptions } from "./combobox-model.js";
11
+ import { SearchSuggest } from "./components/SearchSuggest.js";
12
+ import { searchSegments, foldForSearch } from "./search-suggest-model.js";
11
13
  import { Textarea } from "./components/Textarea.js";
12
14
  import { Select } from "./components/Select.js";
13
15
  import { Checkbox } from "./components/Checkbox.js";
@@ -59,6 +61,7 @@ import { Progress } from "./components/Progress.js";
59
61
  import { Meter } from "./components/Meter.js";
60
62
  import { Stat } from "./components/Stat.js";
61
63
  import { Tooltip } from "./components/Tooltip.js";
64
+ import { InfoTip } from "./components/InfoTip.js";
62
65
  import { EmptyState, ErrorState, ForbiddenState, NotFoundState, FilteredEmptyState, Skeleton, LoadingState } from "./components/States.js";
63
66
  import { RelativeTime } from "./components/RelativeTime.js";
64
67
  import { parseDateValue, relativeTimeValue } from "./relative-time-model.js";
@@ -202,6 +205,7 @@ export {
202
205
  InboxDetail,
203
206
  InboxItem,
204
207
  InboxList,
208
+ InfoTip,
205
209
  Input,
206
210
  InputGroup,
207
211
  Kanban,
@@ -246,6 +250,7 @@ export {
246
250
  SaveStatus,
247
251
  SavedViewMenu,
248
252
  SchedulingCalendar,
253
+ SearchSuggest,
249
254
  SectionHead,
250
255
  Segmented,
251
256
  SegmentedOption,
@@ -296,6 +301,7 @@ export {
296
301
  filterComboboxOptions,
297
302
  findRuleNodeDepth,
298
303
  flattenTree,
304
+ foldForSearch,
299
305
  hexToRgb,
300
306
  hsvToHex,
301
307
  hsvToRgb,
@@ -318,6 +324,7 @@ export {
318
324
  rgbToHex,
319
325
  rgbToHsv,
320
326
  ruleDepth,
327
+ searchSegments,
321
328
  selectRangeDate,
322
329
  startOfMonth,
323
330
  stepMetricValue,
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ /** Blank lines (any whitespace between two line breaks) separate paragraphs; empty paragraphs drop. */
4
+ declare const helpParagraphs: (content: unknown) => string[];
5
+ /** True when `help` would render an InfoTip, so a slot can skip its wrapper row. */
6
+ declare const hasHelp: (help: unknown) => help is string;
7
+ /** Default accessible name for a `help` slot: "About: <title>" for text titles. */
8
+ declare const helpLabelFor: (thing: ReactNode) => string;
9
+
10
+ export { hasHelp, helpLabelFor, helpParagraphs };
@@ -0,0 +1,8 @@
1
+ const helpParagraphs = (content) => typeof content === "string" ? content.replace(/\r\n?/g, "\n").split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean) : [];
2
+ const hasHelp = (help) => helpParagraphs(help).length > 0;
3
+ const helpLabelFor = (thing) => typeof thing === "string" || typeof thing === "number" ? `About: ${thing}` : "More information";
4
+ export {
5
+ hasHelp,
6
+ helpLabelFor,
7
+ helpParagraphs
8
+ };
@@ -732,7 +732,8 @@ var PATHS = {
732
732
  sourceMode: "M10 12.5 8 15l2 2.5M14 12.5l2 2.5-2 2.5M14 2v4a2 2 0 0 0 2 2h4M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",
733
733
  richMode: "M14 2v4a2 2 0 0 0 2 2h4M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7ZM8 13h8M8 17h5",
734
734
  clock: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20ZM12 6v6l4 2",
735
- grip: "M9 5h.01M9 12h.01M9 19h.01M15 5h.01M15 12h.01M15 19h.01"
735
+ grip: "M9 5h.01M9 12h.01M9 19h.01M15 5h.01M15 12h.01M15 19h.01",
736
+ more: "M5 12h.01M12 12h.01M19 12h.01"
736
737
  };
737
738
  function EditorIcon({ name, ...props }) {
738
739
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -0,0 +1,20 @@
1
+ /** One run of a result's text, emphasised or not. */
2
+ interface SearchSegment {
3
+ text: string;
4
+ match: boolean;
5
+ }
6
+ /** Text folded for matching, with a map back to the original characters. */
7
+ interface FoldedText {
8
+ /** The folded text: lower case, diacritics stripped, ß → ss. */
9
+ text: string;
10
+ /** For each index of `text`, the start index of the original character it came from. */
11
+ source: number[];
12
+ /** For each index of `text`, the end index (exclusive) of that original character. */
13
+ sourceEnd: number[];
14
+ }
15
+ /** Fold `text` for matching and keep a map back to the original indices. */
16
+ declare function foldForSearch(text: string): FoldedText;
17
+ /** Split `text` into matched and unmatched segments for `query`. */
18
+ declare function searchSegments(text: string, query: string): SearchSegment[];
19
+
20
+ export { type FoldedText, type SearchSegment, foldForSearch, searchSegments };
@@ -0,0 +1,74 @@
1
+ const COMBINING_MARK = /\p{M}/u;
2
+ function foldForSearch(text) {
3
+ let folded = "";
4
+ const source = [];
5
+ const sourceEnd = [];
6
+ let index = 0;
7
+ for (const char of text) {
8
+ const base = char === "\xDF" || char === "\u1E9E" ? "ss" : char.toLowerCase().normalize("NFD");
9
+ for (const part of base) {
10
+ if (COMBINING_MARK.test(part)) continue;
11
+ folded += part;
12
+ for (let i = 0; i < part.length; i += 1) {
13
+ source.push(index);
14
+ sourceEnd.push(index + char.length);
15
+ }
16
+ }
17
+ index += char.length;
18
+ }
19
+ return { text: folded, source, sourceEnd };
20
+ }
21
+ const isWordStart = (text, at) => at === 0 || /[\s\-_/.,:;()[\]'"›>·|]/u.test(text[at - 1] ?? "");
22
+ function foldedRanges(haystack, query) {
23
+ const whole = query.trim();
24
+ if (!whole) return [];
25
+ const out = [];
26
+ let from = haystack.indexOf(whole);
27
+ if (from !== -1) {
28
+ while (from !== -1) {
29
+ out.push([from, from + whole.length]);
30
+ from = haystack.indexOf(whole, from + whole.length);
31
+ }
32
+ return out;
33
+ }
34
+ for (const token of whole.split(/\s+/)) {
35
+ for (let at = haystack.indexOf(token); at !== -1; at = haystack.indexOf(token, at + 1)) {
36
+ if (isWordStart(haystack, at)) out.push([at, at + token.length]);
37
+ }
38
+ }
39
+ return out;
40
+ }
41
+ function merge(ranges) {
42
+ const sorted = [...ranges].sort((a, b) => a[0] - b[0]);
43
+ const out = [];
44
+ for (const range of sorted) {
45
+ const last = out[out.length - 1];
46
+ if (last && range[0] <= last[1]) last[1] = Math.max(last[1], range[1]);
47
+ else out.push([range[0], range[1]]);
48
+ }
49
+ return out;
50
+ }
51
+ function searchSegments(text, query) {
52
+ const foldedQuery = foldForSearch(query).text;
53
+ if (!text || !foldedQuery.trim()) return [{ text, match: false }];
54
+ const folded = foldForSearch(text);
55
+ const ranges = merge(
56
+ foldedRanges(folded.text, foldedQuery).map(
57
+ ([start, end]) => [folded.source[start] ?? 0, folded.sourceEnd[end - 1] ?? text.length]
58
+ )
59
+ );
60
+ if (ranges.length === 0) return [{ text, match: false }];
61
+ const out = [];
62
+ let cursor = 0;
63
+ for (const [start, end] of ranges) {
64
+ if (start > cursor) out.push({ text: text.slice(cursor, start), match: false });
65
+ out.push({ text: text.slice(start, end), match: true });
66
+ cursor = end;
67
+ }
68
+ if (cursor < text.length) out.push({ text: text.slice(cursor), match: false });
69
+ return out;
70
+ }
71
+ export {
72
+ foldForSearch,
73
+ searchSegments
74
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tensor_1/react",
3
- "version": "2.23.0",
3
+ "version": "2.25.0",
4
4
  "description": "Thin React wrappers over the UIx v2 CSS component library.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",