@luzmo/lucero 2.4.1 → 2.5.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 (129) hide show
  1. package/components/action-menu/index.cjs +1 -1
  2. package/components/action-menu/index.js +1 -1
  3. package/components/{action-menu-CwzRbF61.cjs → action-menu-BNZWjeDd.cjs} +1 -1
  4. package/components/{action-menu-C0sHNsjG.js → action-menu-D1hTsg9A.js} +1 -1
  5. package/components/chat-message/index.cjs +1 -1
  6. package/components/chat-message/index.js +1 -1
  7. package/components/chat-message-BDfomRm-.cjs +148 -0
  8. package/components/{chat-message-T6QIK2Bl.js → chat-message-D6U-sprD.js} +562 -526
  9. package/components/checkbox/index.cjs +1 -1
  10. package/components/checkbox/index.js +1 -1
  11. package/components/{checkbox-BEjvkjfc.js → checkbox-CydI9yXG.js} +1 -1
  12. package/components/{checkbox-ClVrkeLp.cjs → checkbox-JCvBro0K.cjs} +1 -1
  13. package/components/index.cjs +1 -1
  14. package/components/index.js +13 -12
  15. package/components/match-media-B_0cVVtk.cjs +18 -0
  16. package/components/match-media-C5X2OZiD.js +34 -0
  17. package/components/picker/index.cjs +1 -1
  18. package/components/picker/index.js +1 -1
  19. package/components/picker-COeWCv60.cjs +124 -0
  20. package/components/{picker-D0fMBZLb.js → picker-uKcRswTQ.js} +6 -5
  21. package/components/progress-steps/index.cjs +1 -1
  22. package/components/progress-steps/index.js +1 -1
  23. package/components/progress-steps/progress-steps.d.ts +9 -20
  24. package/components/progress-steps-BvCzsq9Z.js +368 -0
  25. package/components/progress-steps-CvdQQwHc.cjs +98 -0
  26. package/components/question-box/index.cjs +1 -1
  27. package/components/question-box/index.js +1 -1
  28. package/components/{question-box-D7YSi_6c.js → question-box-Bcm-P-UV.js} +1 -1
  29. package/components/{question-box-Bdtsgv1k.cjs → question-box-DZnuGMBB.cjs} +1 -1
  30. package/components/select/index.cjs +1 -1
  31. package/components/select/index.js +1 -1
  32. package/components/{select-BUgHi69P.js → select-B86uAHme.js} +5 -4
  33. package/components/select-CKMCEJf7.cjs +158 -0
  34. package/components/strategies-Bb7zEjrU.cjs +18 -0
  35. package/components/{strategies-Cl59wdNZ.js → strategies-COS7mShJ.js} +11 -24
  36. package/components/table/controllers/table-announcer.d.ts +12 -0
  37. package/components/table/controllers/table-column-resize.d.ts +41 -0
  38. package/components/table/controllers/table-grid-navigation.d.ts +28 -0
  39. package/components/table/controllers/table-layout.d.ts +55 -0
  40. package/components/table/controllers/table-row-expansion.d.ts +45 -0
  41. package/components/table/controllers/table-virtualizer.d.ts +42 -0
  42. package/components/table/index.cjs +18 -0
  43. package/components/table/index.d.ts +32 -0
  44. package/components/table/index.js +20 -0
  45. package/components/table/table-body.d.ts +24 -0
  46. package/components/table/table-cell.d.ts +27 -0
  47. package/components/table/table-checkbox-cell.d.ts +41 -0
  48. package/components/table/table-columns.d.ts +45 -0
  49. package/components/table/table-disclosure-cell.d.ts +21 -0
  50. package/components/table/table-head-cell.d.ts +77 -0
  51. package/components/table/table-head.d.ts +34 -0
  52. package/components/table/table-model.d.ts +56 -0
  53. package/components/table/table-row-details.d.ts +29 -0
  54. package/components/table/table-row.d.ts +64 -0
  55. package/components/table/table-styles.d.ts +9 -0
  56. package/components/table/table-templates.d.ts +41 -0
  57. package/components/table/table.d.ts +197 -0
  58. package/components/table/types.d.ts +81 -0
  59. package/components/table-B75GjBhD.js +1592 -0
  60. package/components/table-CHrAaVU1.cjs +180 -0
  61. package/custom-elements.json +1 -1
  62. package/index.d.ts +1 -0
  63. package/package.json +9 -1
  64. package/standalone/accordion.js +1 -1
  65. package/standalone/action-bar.js +1 -1
  66. package/standalone/action-button.js +1 -1
  67. package/standalone/action-menu.js +1 -1
  68. package/standalone/avatar.js +1 -1
  69. package/standalone/calendar.js +1 -1
  70. package/standalone/chat-message.js +27 -27
  71. package/standalone/checkbox.js +1 -1
  72. package/standalone/chunks/{action-button-BzzPBqt5.js → action-button-FSsfXYe9.js} +1 -1
  73. package/standalone/chunks/{button-Dykw3TSO.js → button-Q1n9DH9a.js} +1 -1
  74. package/standalone/chunks/{calendar-ZwUYkzVq.js → calendar-DcFjY2tw.js} +1 -1
  75. package/standalone/chunks/{checkbox-OQtakoP8.js → checkbox-DQ4wPgG_.js} +2 -2
  76. package/standalone/chunks/{clear-button-pVGfwye8.js → clear-button-3zpCVxG5.js} +1 -1
  77. package/standalone/chunks/{close-button-RpPiwBdf.js → close-button-C96dazyi.js} +1 -1
  78. package/standalone/chunks/{color-field-CrCF4kqZ.js → color-field-BFvUGE4L.js} +1 -1
  79. package/standalone/chunks/{color-menu-B5UOMYmX.js → color-menu-BIKuitbH.js} +2 -2
  80. package/standalone/chunks/{icon-Dy6J1QeX.js → icon-BypO7M7G.js} +1 -1
  81. package/standalone/chunks/luzmo-icons-B-pCv-xg.js +13 -0
  82. package/standalone/chunks/match-media-BMi7j6hf.js +2 -0
  83. package/standalone/chunks/{menu-nolJetlp.js → menu-DSMoQt1w.js} +1 -1
  84. package/standalone/chunks/{number-field-C3DYfl1s.js → number-field-B6BDXkL7.js} +3 -3
  85. package/standalone/chunks/{options-BjRSj630.js → options-CkmITqgV.js} +5 -5
  86. package/standalone/chunks/picker-FCQK0vdE.js +108 -0
  87. package/standalone/chunks/{picker-button-BeXTIgUt.js → picker-button-BZWqDoNQ.js} +1 -1
  88. package/standalone/chunks/{segments-factory-Ch3AAizU.js → segments-factory-eS38mJRz.js} +1 -1
  89. package/standalone/chunks/strategies-C-vW4MlK.js +2 -0
  90. package/standalone/chunks/{swatch-m_4GcO2_.js → swatch-CGR_GWqO.js} +1 -1
  91. package/standalone/chunks/{text-field-BnZtyodU.js → text-field-4OKvLOXG.js} +1 -1
  92. package/standalone/chunks/{text-field-BrlDeJsx.js → text-field-C2oROxum.js} +1 -1
  93. package/standalone/clear-button.js +1 -1
  94. package/standalone/close-button.js +1 -1
  95. package/standalone/color-field.js +1 -1
  96. package/standalone/color-menu.js +1 -1
  97. package/standalone/color-picker.js +1 -1
  98. package/standalone/date-range-picker.js +1 -1
  99. package/standalone/date-time-picker.js +1 -1
  100. package/standalone/icon.js +1 -1
  101. package/standalone/manifest.json +22 -20
  102. package/standalone/menu.js +1 -1
  103. package/standalone/multi-language-field.js +1 -1
  104. package/standalone/notice.js +1 -1
  105. package/standalone/number-field.js +1 -1
  106. package/standalone/options.js +1 -1
  107. package/standalone/picker-button.js +1 -1
  108. package/standalone/picker.js +1 -1
  109. package/standalone/progress-steps.js +4 -4
  110. package/standalone/prompt-box.js +9 -9
  111. package/standalone/question-box.js +1 -1
  112. package/standalone/search.js +1 -1
  113. package/standalone/select.js +2 -2
  114. package/standalone/slider.js +1 -1
  115. package/standalone/swatch.js +1 -1
  116. package/standalone/table.js +185 -0
  117. package/standalone/tabs.js +1 -1
  118. package/standalone/tags.js +1 -1
  119. package/standalone/text-field.js +1 -1
  120. package/standalone/toast.js +1 -1
  121. package/components/chat-message-Dgo6h0rD.cjs +0 -148
  122. package/components/picker-BliQJlY_.cjs +0 -124
  123. package/components/progress-steps-BIbj8x8S.js +0 -383
  124. package/components/progress-steps-upJp8wl3.cjs +0 -98
  125. package/components/select-DsGVB01K.cjs +0 -158
  126. package/components/strategies-BwNbUXYS.cjs +0 -18
  127. package/standalone/chunks/luzmo-icons-CJa-aByT.js +0 -13
  128. package/standalone/chunks/picker-hbMQOkUX.js +0 -108
  129. package/standalone/chunks/strategies-kad_0dTB.js +0 -2
@@ -0,0 +1,41 @@
1
+ import { TemplateResult } from 'lit';
2
+ import type { ElementSize } from '../../utils/sized-mixin';
3
+ import { TableRecord, TableSort } from './table-model';
4
+ import { TableColumn, TableItemLabel, TableRenderDetails, TableRenderItem, TableSelects } from './types';
5
+ export declare const columnSortKey: (column: TableColumn) => string;
6
+ export declare const renderDataHead: (columns: TableColumn[], sort: TableSort | undefined, options: {
7
+ expandable: boolean;
8
+ resizeLabel: (header: string) => string;
9
+ }) => TemplateResult;
10
+ export interface DataRowsOptions {
11
+ rows: {
12
+ record: TableRecord;
13
+ position: number;
14
+ }[];
15
+ /** Number of data rows, including rows the virtualizer has not mounted. */
16
+ rowCount: number;
17
+ columns: TableColumn[];
18
+ renderItem?: TableRenderItem;
19
+ itemLabel?: TableItemLabel;
20
+ selectRowLabel: string;
21
+ selects?: TableSelects;
22
+ isSelected: (value: string) => boolean;
23
+ emphasized: boolean;
24
+ checkboxSize: ElementSize;
25
+ /** `aria-rowindex` of the first data row, or `undefined` when not virtualized. */
26
+ rowIndexOffset?: number;
27
+ paddingStart: number;
28
+ paddingEnd: number;
29
+ expandable: boolean;
30
+ isExpanded: (value: string) => boolean;
31
+ expandLabel: (record: TableRecord, position: number) => string;
32
+ renderDetails?: TableRenderDetails;
33
+ /** Data-row indexes whose details are playing their close animation. */
34
+ closing: ReadonlySet<string>;
35
+ /** Virtualized tables pass explicit row and details indexes. */
36
+ ariaIndexes?: Map<string, {
37
+ row: number;
38
+ details?: number;
39
+ }>;
40
+ }
41
+ export declare const renderDataBody: (options: DataRowsOptions) => TemplateResult;
@@ -0,0 +1,197 @@
1
+ import { CSSResultArray, PropertyValues, TemplateResult } from 'lit';
2
+ import { LuzmoElement } from '../../utils/base';
3
+ import './table-row-details';
4
+ import { TableColumn, TableDensity, TableItem, TableItemLabel, TableItemValue, TableLabels, TableRenderDetails, TableRenderItem, TableSelects } from './types';
5
+ declare const LuzmoTable_base: typeof LuzmoElement & {
6
+ new (...args: any[]): import("../..").SizedElementInterface;
7
+ prototype: import("../..").SizedElementInterface;
8
+ };
9
+ /**
10
+ * @element luzmo-table
11
+ *
12
+ * A grid of rows and columns. Slot `luzmo-table-head` and `luzmo-table-body`
13
+ * for declarative markup, or set `items` to render rows from data, sorted
14
+ * by TanStack Table and optionally virtualized with TanStack Virtual.
15
+ *
16
+ * @slot - `luzmo-table-head` and `luzmo-table-body`.
17
+ *
18
+ * @fires change - `selected` changed. Cancel it to keep the previous selection.
19
+ * @fires luzmo-table-sorted - A sortable header was activated. `detail` is `{ sortKey, sortDirection }`. Cancel it in data mode to skip the client sort.
20
+ * @fires luzmo-table-row-toggle - A row's details were expanded or collapsed. `detail` is `{ value, expanded }`. Cancel it to keep the previous state.
21
+ * @fires luzmo-column-resized - A column resize committed. `detail` is `{ columnId, width, columnWidths }`.
22
+ * @fires luzmo-range-changed - The mounted window of a virtualized table changed. `detail` is `{ first, last }`.
23
+ *
24
+ * @attr select-all-label - Accessible name of the select-all checkbox.
25
+ *
26
+ * @cssprop --luzmo-table-background-color - Background of the table.
27
+ * @cssprop --luzmo-table-border-color - Border and row divider color.
28
+ * @cssprop --luzmo-table-border-radius - Corner radius of the table.
29
+ * @cssprop --luzmo-table-column-divider-width - Width of the divider between columns.
30
+ * @cssprop --luzmo-table-column-divider-color - Color of the divider between columns.
31
+ * @cssprop --luzmo-table-row-min-block-size - Minimum block size of rows.
32
+ * @cssprop --luzmo-table-cell-padding-inline - Inline padding of cells.
33
+ * @cssprop --luzmo-table-row-selected-background-color - Background of selected rows.
34
+ * @cssprop --luzmo-table-scrollbar-width - Scrollbar size of a scrolling body.
35
+ * @cssprop --luzmo-table-scrollbar-track-background - Scrollbar track background.
36
+ * @cssprop --luzmo-table-scrollbar-track-border-radius - Scrollbar track radius.
37
+ * @cssprop --luzmo-table-scrollbar-thumb-background - Scrollbar thumb background.
38
+ * @cssprop --luzmo-table-scrollbar-thumb-border-radius - Scrollbar thumb radius.
39
+ * @cssprop --luzmo-table-scrollbar-thumb-hover-background - Scrollbar thumb background on hover.
40
+ */
41
+ export declare class LuzmoTable extends LuzmoTable_base {
42
+ static get styles(): CSSResultArray;
43
+ role: string;
44
+ /**
45
+ * Row density. Unset is regular.
46
+ */
47
+ density: TableDensity | undefined;
48
+ /**
49
+ * Use the accent color for selected rows and checkboxes.
50
+ */
51
+ emphasized: boolean;
52
+ /**
53
+ * Remove the outer border and background.
54
+ */
55
+ quiet: boolean;
56
+ /**
57
+ * Scroll the body inside the table's block size, keeping the head in view.
58
+ */
59
+ scroller: boolean;
60
+ /**
61
+ * Row selection mode. Unset disables selection.
62
+ */
63
+ selects: TableSelects | undefined;
64
+ /**
65
+ * Selected row values.
66
+ */
67
+ selected: string[];
68
+ /**
69
+ * Accessible name of the select-all checkbox. Overrides `labels.selectAll`.
70
+ */
71
+ selectAllLabel: string | undefined;
72
+ /**
73
+ * Row records. Setting an array switches the table to data mode.
74
+ */
75
+ items: TableItem[] | undefined;
76
+ /**
77
+ * Stable, unique selection value of a data-mode row. Defaults to the item
78
+ * index.
79
+ */
80
+ itemValue: TableItemValue | undefined;
81
+ /**
82
+ * Accessible name of a data-mode row checkbox. Defaults to the first
83
+ * column's text, then `labels.selectRow`.
84
+ */
85
+ itemLabel: TableItemLabel | undefined;
86
+ /**
87
+ * Cell content of a data-mode row. Return `luzmo-table-cell` elements.
88
+ */
89
+ renderItem: TableRenderItem | undefined;
90
+ /**
91
+ * Expanded row values. Setting `renderDetails` enables data-mode
92
+ * disclosure.
93
+ */
94
+ expanded: string[];
95
+ /**
96
+ * Details content of a data-mode row. Its presence enables row disclosure
97
+ * for every non-information row.
98
+ */
99
+ renderDetails: TableRenderDetails | undefined;
100
+ /**
101
+ * Resized column widths, in pixels, keyed by column id. A resize updates
102
+ * this map without changing `columns`.
103
+ */
104
+ columnWidths: Record<string, number>;
105
+ /**
106
+ * Data-mode columns, used when no `luzmo-table-head` is slotted.
107
+ */
108
+ columns: TableColumn[];
109
+ /**
110
+ * Mount only the visible rows. Data mode only; needs a bounded block size.
111
+ */
112
+ virtualized: boolean;
113
+ /**
114
+ * Translatable copy.
115
+ */
116
+ labels: TableLabels;
117
+ private _sort;
118
+ private _clientSort;
119
+ private _mode;
120
+ private _rows;
121
+ private _rowKeys;
122
+ private _activeCell?;
123
+ private _warnedSlottedRows;
124
+ private readonly model;
125
+ private readonly language;
126
+ private readonly announcer;
127
+ private readonly layout;
128
+ private readonly resize;
129
+ private readonly expansion;
130
+ private _lightDomVersion;
131
+ private _modelSynced;
132
+ private readonly lightObserver;
133
+ private readonly directionManaged;
134
+ private readonly directionObserver;
135
+ private readonly navigation;
136
+ private readonly virtualizer;
137
+ constructor();
138
+ private get _isDataMode();
139
+ /**
140
+ * Moves focus to the grid's current cell.
141
+ */
142
+ focus(options?: FocusOptions): void;
143
+ /**
144
+ * Scrolls the row at `index` in the current order into view.
145
+ */
146
+ scrollToIndex(index: number): void;
147
+ /**
148
+ * Child elements take the table's direction, so `dir` on the table applies
149
+ * to its rows and cells as well.
150
+ * @internal
151
+ */
152
+ startManagingContentDirection(element: HTMLElement): void;
153
+ /** @internal */
154
+ stopManagingContentDirection(element: HTMLElement): void;
155
+ connectedCallback(): void;
156
+ disconnectedCallback(): void;
157
+ protected willUpdate(changes: PropertyValues<this>): void;
158
+ protected render(): TemplateResult;
159
+ protected updated(changes: PropertyValues<this>): void;
160
+ private _renderData;
161
+ private _syncDirection;
162
+ private _rowLabel;
163
+ private _ariaIndexes;
164
+ private _owns;
165
+ private _initialSort;
166
+ private _createRecords;
167
+ private _slottedHead;
168
+ private _declarativeRows;
169
+ private _head;
170
+ private _rowElements;
171
+ private _gridRows;
172
+ private _gridEntryIndex;
173
+ private _virtualNavigationTarget;
174
+ private _virtualDataIndex;
175
+ private _focusVirtualCell;
176
+ private _mountedVirtualRow;
177
+ /**
178
+ * Header cells and their resize separators stay outside the body grid, so
179
+ * each one keeps its own tab stop. Arrow, Home, and End movement in the
180
+ * body belongs to the grid navigation controller.
181
+ */
182
+ private _gridCells;
183
+ private _warnSlottedRows;
184
+ private _refreshNavigation;
185
+ private _commitSelection;
186
+ private _toggleRow;
187
+ private _toggleAll;
188
+ private _activateCell;
189
+ private _cellFromPath;
190
+ private handleChange;
191
+ private handleClick;
192
+ private handleFocusin;
193
+ private handleKeydown;
194
+ private _gridElementFromPath;
195
+ private handleSorted;
196
+ }
197
+ export {};
@@ -0,0 +1,81 @@
1
+ export type TableItem = Record<string, unknown>;
2
+ export type TableSelects = 'single' | 'multiple';
3
+ export type TableDensity = 'compact' | 'spacious';
4
+ export type TableSortDirection = 'asc' | 'desc';
5
+ /**
6
+ * Row type brand for data-mode items. Spectrum's numeric `_$rowType$` brand
7
+ * (`1` for information) is accepted as well.
8
+ */
9
+ export type TableRowType = 'item' | 'information';
10
+ export interface TableColumn<T extends TableItem = TableItem> {
11
+ /** Stable column identifier. */
12
+ id: string;
13
+ /** Header content. */
14
+ header: unknown;
15
+ /** Item key rendered as plain text when `cell` is not provided. */
16
+ accessorKey?: string;
17
+ /** Cell content for this column. */
18
+ cell?: (item: T, index: number) => unknown;
19
+ /** Whether the column header sorts the table. */
20
+ sortable?: boolean;
21
+ /** Item key the column sorts by. Defaults to `accessorKey`, then `id`. */
22
+ sortKey?: string;
23
+ /** Initial sort direction. */
24
+ sortDirection?: TableSortDirection;
25
+ /** Fixed column width, in pixels. */
26
+ width?: number;
27
+ /** Minimum column width, in pixels. */
28
+ minWidth?: number;
29
+ /** Maximum column width, in pixels. */
30
+ maxWidth?: number;
31
+ /**
32
+ * Whether the column header exposes a resize handle. Defaults to true,
33
+ * including for the last column. Set false to opt out.
34
+ */
35
+ resizable?: boolean;
36
+ /**
37
+ * Maximum number of text lines before the header and cells truncate.
38
+ * Unset wraps. A cell `lineClamp` overrides this default.
39
+ */
40
+ lineClamp?: number;
41
+ }
42
+ export type TableRenderItem<T extends TableItem = TableItem> = (item: T, index: number) => unknown;
43
+ export type TableItemValue<T extends TableItem = TableItem> = (item: T, index: number) => string;
44
+ export type TableItemLabel<T extends TableItem = TableItem> = (item: T, index: number) => string;
45
+ export type TableRenderDetails<T extends TableItem = TableItem> = (item: T, index: number) => unknown;
46
+ export interface TableSortedDetail {
47
+ sortKey: string;
48
+ sortDirection: TableSortDirection;
49
+ }
50
+ export interface TableRangeChangedDetail {
51
+ first: number;
52
+ last: number;
53
+ }
54
+ export interface TableRowToggleDetail {
55
+ value: string;
56
+ expanded: boolean;
57
+ }
58
+ export interface TableColumnResizedDetail {
59
+ columnId: string;
60
+ width: number;
61
+ columnWidths: Record<string, number>;
62
+ }
63
+ export type TableLabels = {
64
+ /** Accessible name of the select-all checkbox. */
65
+ selectAll?: string;
66
+ /** Fallback accessible name of a data-mode row checkbox. `{index}` is the 1-based row number. */
67
+ selectRow?: string;
68
+ /** Announced after an ascending sort. `{column}` is the header text. */
69
+ sortAscending?: string;
70
+ /** Announced after a descending sort. `{column}` is the header text. */
71
+ sortDescending?: string;
72
+ /** Accessible name of a row disclosure button. `{label}` is the row name and `{index}` is the 1-based row number. */
73
+ expandRow?: string;
74
+ /** Accessible name of a row disclosure button while the row is expanded. `{label}` is the row name and `{index}` is the 1-based row number. */
75
+ collapseRow?: string;
76
+ /** Accessible name of a column resize handle. `{column}` is the header text. */
77
+ resizeColumn?: string;
78
+ /** Announced after a column resize. `{column}` is the header text and `{width}` is the pixel width. */
79
+ columnWidth?: string;
80
+ };
81
+ export declare const DEFAULT_TABLE_LABELS: Required<TableLabels>;