@jetbrains/ring-ui 8.0.0-beta.3 → 8.0.0-beta.5

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 (89) hide show
  1. package/components/alert/alert-actions.d.ts +4 -0
  2. package/components/alert/alert-actions.js +5 -0
  3. package/components/alert/alert-heading.d.ts +4 -0
  4. package/components/alert/alert-heading.js +6 -0
  5. package/components/alert/alert.css +63 -22
  6. package/components/alert/alert.d.ts +14 -1
  7. package/components/alert/alert.js +34 -19
  8. package/components/alert/container.css +1 -2
  9. package/components/alert-service/alert-service.d.ts +2 -1
  10. package/components/alert-service/alert-service.js +8 -4
  11. package/components/auth/auth-core.d.ts +5 -9
  12. package/components/auth/auth-core.js +56 -15
  13. package/components/button-group/button-group.css +5 -5
  14. package/components/checkbox/checkbox.d.ts +1 -1
  15. package/components/collapsible-group/collapsible-group.css +138 -0
  16. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  17. package/components/collapsible-group/collapsible-group.js +73 -0
  18. package/components/date-picker/consts.d.ts +1 -0
  19. package/components/date-picker/date-input.js +6 -2
  20. package/components/editable-heading/editable-heading.js +14 -14
  21. package/components/expand/collapsible-group.css +23 -89
  22. package/components/expand/collapsible-group.d.ts +8 -20
  23. package/components/expand/collapsible-group.js +14 -73
  24. package/components/global/compose-refs.d.ts +2 -1
  25. package/components/global/compose-refs.js +24 -8
  26. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  27. package/components/global/focus-with-temporary-tabindex.js +21 -0
  28. package/components/global/intersection-observer-context.d.ts +29 -9
  29. package/components/global/intersection-observer-context.js +43 -24
  30. package/components/global/is-within-interactive-element.d.ts +6 -0
  31. package/components/global/is-within-interactive-element.js +26 -0
  32. package/components/global/is-within-navigable-element.d.ts +6 -0
  33. package/components/global/is-within-navigable-element.js +27 -0
  34. package/components/global/parse-css-duration.d.ts +5 -0
  35. package/components/global/parse-css-duration.js +13 -0
  36. package/components/global/schedule-with-cleanup.d.ts +12 -0
  37. package/components/global/schedule-with-cleanup.js +34 -0
  38. package/components/global/table-selection.js +1 -1
  39. package/components/header/header.css +3 -3
  40. package/components/http/http.d.ts +2 -2
  41. package/components/http/http.js +2 -2
  42. package/components/i18n/i18n.d.ts +1 -0
  43. package/components/i18n/messages.json +1 -0
  44. package/components/input/input.d.ts +1 -1
  45. package/components/legacy-table/row.d.ts +1 -1
  46. package/components/popup/popup.d.ts +2 -0
  47. package/components/popup/popup.js +2 -2
  48. package/components/select/select-popup.d.ts +1 -1
  49. package/components/select/select.d.ts +1 -1
  50. package/components/table/default-item-renderer.d.ts +29 -10
  51. package/components/table/default-item-renderer.js +53 -19
  52. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  53. package/components/table/internal/reorder-animation-context.js +60 -0
  54. package/components/table/internal/reorder-handle.d.ts +9 -0
  55. package/components/table/internal/reorder-handle.js +334 -0
  56. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  57. package/components/table/internal/reorder-layout-context.js +69 -0
  58. package/components/table/internal/table-header.d.ts +1 -0
  59. package/components/table/internal/table-header.js +143 -0
  60. package/components/table/internal/virtualization.d.ts +41 -0
  61. package/components/table/{table-virtualize.js → internal/virtualization.js} +74 -37
  62. package/components/table/item-virtualization.d.ts +37 -0
  63. package/components/table/item-virtualization.js +26 -0
  64. package/components/table/reorder-animation.d.ts +37 -0
  65. package/components/table/reorder-animation.js +11 -0
  66. package/components/table/reorder-item-layout.d.ts +32 -0
  67. package/components/table/reorder-item-layout.js +23 -0
  68. package/components/table/table-const.d.ts +8 -6
  69. package/components/table/table-const.js +7 -5
  70. package/components/table/table-primitives.d.ts +52 -16
  71. package/components/table/table-primitives.js +15 -60
  72. package/components/table/table-props.d.ts +304 -0
  73. package/components/table/table-props.js +1 -0
  74. package/components/table/table.css +179 -67
  75. package/components/table/table.d.ts +231 -209
  76. package/components/table/table.js +327 -2
  77. package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
  78. package/components/util-stories.d.ts +26 -0
  79. package/components/util-stories.js +61 -0
  80. package/package.json +35 -36
  81. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  82. package/components/date-picker/use-intersection-observer.js +0 -48
  83. package/components/global/composeRefs.d.ts +0 -6
  84. package/components/global/composeRefs.js +0 -7
  85. package/components/table/table-component.d.ts +0 -80
  86. package/components/table/table-component.js +0 -130
  87. package/components/table/table-row-focus.d.ts +0 -4
  88. package/components/table/table-row-focus.js +0 -42
  89. package/components/table/table-virtualize.d.ts +0 -32
@@ -1,66 +1,13 @@
1
- import { use, useCallback } from 'react';
2
1
  import classNames from 'classnames';
3
- import unsortedIcon from '@jetbrains/icons/unsorted-12px';
4
- import arrowDownIcon from '@jetbrains/icons/arrow-12px-down';
5
- import arrowUpIcon from '@jetbrains/icons/arrow-12px-up';
6
- import trashIcon from '@jetbrains/icons/trash-12px';
7
- import Icon from '../icon/icon';
8
- import { ColumnIndexContext, TablePropsContext } from './table-const';
9
- import { keyboardFocusableAttrName } from './table-row-focus';
2
+ import { ReorderHandle } from './internal/reorder-handle';
10
3
  import styles from './table.css';
11
4
  /**
12
- * Include it in a column header to make the column sortable.
13
- * Handle clicks with {@link TableProps.onSort}.
5
+ * @internal
14
6
  */
15
- export function SortButton({ className, children, onClick, ...restProps }) {
16
- const tableProps = use(TablePropsContext);
17
- const columnIndex = use(ColumnIndexContext);
18
- const column = tableProps?.columns[columnIndex];
19
- const sortOrder = column?.sortOrder ?? 'none';
20
- // eslint-disable-next-line no-nested-ternary, prettier/prettier
21
- const glyph = sortOrder === 'none' ? unsortedIcon
22
- : sortOrder === 'ascending' ? arrowUpIcon
23
- : arrowDownIcon;
24
- const handleClick = useCallback((e) => {
25
- onClick?.(e);
26
- if (!e.defaultPrevented) {
27
- const sequence = ['none', 'ascending', 'descending'];
28
- const nextOrder = sequence[(sequence.indexOf(sortOrder) + 1) % sequence.length];
29
- tableProps.onSort?.(columnIndex, nextOrder, tableProps.columns);
30
- }
31
- }, [columnIndex, onClick, sortOrder, tableProps]);
32
- if (!tableProps || !column) {
33
- return null;
34
- }
35
- return (<button type='button' className={classNames(styles.headerButton, className)} onClick={handleClick} {...restProps}>
36
- {children} <Icon glyph={glyph} aria-hidden/>
37
- </button>);
38
- }
39
- /**
40
- * Include it in a column header to make the column deletable.
41
- * Beware that `column.name ?? String(column.key)` is used in the aria-label.
42
- * Handle clicks with {@link TableProps.onColumnDelete}.
43
- */
44
- export function DeleteColumnButton({ className, onClick, ...restProps }) {
45
- const tableProps = use(TablePropsContext);
46
- const columnIndex = use(ColumnIndexContext);
47
- const column = tableProps?.columns[columnIndex];
48
- const handleClick = useCallback((e) => {
49
- onClick?.(e);
50
- if (!e.defaultPrevented) {
51
- tableProps.onColumnDelete?.(columnIndex, tableProps.columns);
52
- }
53
- }, [columnIndex, onClick, tableProps]);
54
- if (!tableProps || !column) {
55
- return null;
56
- }
57
- return (<button type='button' className={classNames(styles.headerButton, styles.deleteColumnButton, className)} onClick={handleClick} aria-label={`Delete column ${column.name ?? String(column.key)}`} {...restProps}>
58
- <Icon glyph={trashIcon}/>
59
- </button>);
60
- }
7
+ export const keyboardFocusableAttrName = 'data-keyboard-focusable';
61
8
  /**
62
- * A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
63
- * Applies the standard row classnames.
9
+ * A helper `<tr>` component for custom {@link TableProps.renderItem} implementations.
10
+ * Applies the standard row class names.
64
11
  */
65
12
  export function TableRow(props) {
66
13
  const { keyboardFocusable, className, ...restProps } = props;
@@ -69,11 +16,19 @@ export function TableRow(props) {
69
16
  return <tr className={classes} {...trRestProps}/>;
70
17
  }
71
18
  /**
72
- * A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
73
- * Applies the standard cell classnames, but not data-dependent `tdClassName`.
19
+ * A helper `<td>` component for custom {@link TableProps.renderItem} implementations.
20
+ * Applies the standard cell class names, but not data-dependent `tdClassName`.
74
21
  */
75
22
  export function TableCell(props) {
76
23
  const { className, ...restProps } = props;
77
24
  const classes = classNames(styles.cell, className);
78
25
  return <td className={classes} {...restProps}/>;
79
26
  }
27
+ /**
28
+ * A drag handle that allows the user to reorder the row. Place it anywhere
29
+ * inside a row renderer.
30
+ * Use {@link TableProps.canReorderItem} and {@link TableProps.onItemReorder}.
31
+ */
32
+ export function ItemReorderHandle({ index, ...restProps }) {
33
+ return <ReorderHandle direction='items' index={index} {...restProps}/>;
34
+ }
@@ -0,0 +1,304 @@
1
+ import type { AriaAttributes, ReactNode, RefObject } from 'react';
2
+ export interface TableProps<T> {
3
+ /**
4
+ * The data items to render. `null` and `undefined` items are not supported.
5
+ * Referentially identical items are not supported either.
6
+ */
7
+ data: readonly T[];
8
+ /**
9
+ * Column definitions.
10
+ */
11
+ columns: readonly Column<T>[];
12
+ /**
13
+ * Used as a key in the items list.
14
+ */
15
+ getKey: (item: T, index: number, items: readonly T[]) => React.Key;
16
+ /**
17
+ * If `true`, the table header will not be rendered.
18
+ *
19
+ * Note that this may impact accessibility. If necessary, provide additional
20
+ * information via `aria-label` or `aria-description` on the `Table` element.
21
+ */
22
+ noHeader?: boolean;
23
+ /**
24
+ * If true, renders a sticky header.
25
+ */
26
+ stickyHeader?: boolean;
27
+ /**
28
+ * Called when the user clicks the sort button in a column header.
29
+ * The client is expected to update the `columns` prop with the new
30
+ * sort order for the corresponding column, and update the data accordingly.
31
+ */
32
+ onSort?: (columnIndex: number, newOrder: SortOrder, columns: readonly Column<T>[]) => void;
33
+ /**
34
+ * Called when the user clicks on a column delete button in the header.
35
+ * The client is expected to update the `columns` prop with the column removed.
36
+ */
37
+ onColumnDelete?: (column: Column<T>, columnIndex: number, columns: readonly Column<T>[]) => void;
38
+ /**
39
+ * Called when the user reorders columns by dragging a column.
40
+ * The `insertionIndex` parameter represents an insertion position in the original,
41
+ * unchanged `columns` array before the column is removed.
42
+ *
43
+ * One possible implementation is:
44
+ *
45
+ * ```ts
46
+ * columns.splice(fromIndex, 1);
47
+ * columns.splice(fromIndex < insertionIndex ? insertionIndex - 1 : insertionIndex, 0, columnBeingReordered);
48
+ * ```
49
+ *
50
+ * The callback is not called when the reorder operation would not change the
51
+ * column order, i.e. when
52
+ * `insertionIndex === fromIndex || insertionIndex === fromIndex + 1`.
53
+ */
54
+ onColumnReorder?: (columnBeingReordered: Column<T>, fromIndex: number, insertionIndex: number, columns: readonly Column<T>[]) => void;
55
+ /**
56
+ * By default, when a column is reordered, the moved column is highlighted
57
+ * with a temporary background color. Set `true` to disable this animation.
58
+ */
59
+ noColumnReorderAnimation?: boolean;
60
+ /**
61
+ * If defined, determines whether an item may be reordered to a specific insertion position.
62
+ * If not defined, any item may be reordered to any position.
63
+ */
64
+ canReorderItem?: (itemBeingReordered: T, fromIndex: number, insertionIndex: number, items: readonly T[]) => boolean;
65
+ /**
66
+ * Called when the user reorders items by dragging a handle.
67
+ * The `insertionIndex` parameter represents an insertion position in the original,
68
+ * unchanged `data` array before the item is removed. See {@link TableProps.onColumnReorder}
69
+ * for an example implementation.
70
+ *
71
+ * To make reorder possible, render `ItemReorderHandle` (from `table-primitives`)
72
+ * anywhere in a row.
73
+ *
74
+ * The callback is not called when the reorder operation would not change the
75
+ * item order, i.e. when
76
+ * `insertionIndex === fromIndex || insertionIndex === fromIndex + 1`.
77
+ */
78
+ onItemReorder?: (itemBeingReordered: T, fromIndex: number, insertionIndex: number, items: readonly T[]) => void;
79
+ /**
80
+ * By default, when an item is reordered, the moved item is highlighted
81
+ * with a temporary background color. Set `true` to disable this animation.
82
+ */
83
+ noItemReorderAnimation?: boolean;
84
+ /**
85
+ * Customizes how an item is rendered.
86
+ *
87
+ * Return `DefaultItemRenderer` to configure row-specific behavior such as
88
+ * `clickable`, `keyboardFocusable`, event handlers, `className`, or `ref`.
89
+ *
90
+ * You can also return custom row(s) instead. See the `Table` documentation
91
+ * for details.
92
+ */
93
+ renderItem?: (item: T, index: number, items: readonly T[]) => ReactNode;
94
+ /**
95
+ * Only renders rows near the viewport.
96
+ *
97
+ * Rows may transition between two states:
98
+ * - materialized: rendered as actual table rows. This happens when
99
+ * the corresponding spacer approaches the viewport, as specified by
100
+ * `lookaheadPx`.
101
+ * - virtualized: replaced with spacer rows of the same height. This happens
102
+ * when the row moves sufficiently far from the viewport, as specified by
103
+ * `retentionMarginPx`.
104
+ *
105
+ * Toggling this prop should normally work as expected, but a seamless
106
+ * transition is not guaranteed: the scroll position may reset to the top.
107
+ * However, if row height estimates are accurate and the data has not
108
+ * changed, the browser may apply scroll anchoring, resulting in a smoother
109
+ * transition, possibly with brief flickering but without scroll jumps.
110
+ */
111
+ virtualizeRows?: boolean;
112
+ /**
113
+ * Used with `virtualizeRows` as the source of scroll events, the target of
114
+ * `ResizeObserver`, and the root of `IntersectionObserver`. Required when
115
+ * the scrollable container is not the whole document.
116
+ *
117
+ * If not set:
118
+ * - the scroll listener is attached to `window`
119
+ * - `ResizeObserver` observes `document.body`
120
+ * - `IntersectionObserver` has no root (i.e. the viewport is used)
121
+ *
122
+ * Note that if this scroller is nested inside another scrollable container,
123
+ * the outer container is not tracked. As a result, items may not materialize
124
+ * until the inner scroller is scrolled.
125
+ *
126
+ * Support for nested scroll containers may be added in the future.
127
+ */
128
+ scrollerRef?: RefObject<HTMLElement | null>;
129
+ /**
130
+ * Used with `virtualizeRows` to estimate the height of items that have not
131
+ * been rendered yet. The function should be fast and side-effect free.
132
+ * Do not measure the DOM here. Once a row is rendered, its actual height
133
+ * will be measured and used instead of this estimate.
134
+ *
135
+ * Note the effects of imprecise estimates:
136
+ * - When the height is underestimated, the table may materialize more rows
137
+ * than specified by `lookaheadPx`. If the resulting rows extend beyond
138
+ * `retentionMarginPx`, they will be virtualized again. If this causes
139
+ * relayout flickering, increase `retentionMarginPx`.
140
+ * - When the height is overestimated, the table may materialize fewer rows
141
+ * than specified by `lookaheadPx`, which may leave a spacer partially
142
+ * visible. To avoid this, increase `lookaheadPx` (and `retentionMarginPx`
143
+ * accordingly, since it should be greater than `lookaheadPx`).
144
+ *
145
+ * Default: 37px = 16px padding + 20px line height + 1px border.
146
+ */
147
+ estimateHeight?: (item: T, index: number, items: readonly T[]) => number;
148
+ /**
149
+ * When using `virtualizeRows`, the number of pixels above and below
150
+ * the viewport to materialize in advance.
151
+ *
152
+ * Increase this value if blank space becomes visible during fast scrolling.
153
+ *
154
+ * Default: 400px.
155
+ */
156
+ lookaheadPx?: number;
157
+ /**
158
+ * Used with `virtualizeRows`. Additional margin around the viewport before
159
+ * materialized rows become eligible for virtualization.
160
+ *
161
+ * Increasing this value reduces row churn when heights are underestimated.
162
+ * In that case, the table may materialize more rows than needed and then
163
+ * immediately virtualize them again. A larger margin keeps such rows
164
+ * rendered for longer, at the cost of rendering more rows overall.
165
+ *
166
+ * This value should be greater than `lookaheadPx`. Increase it if you notice
167
+ * table relayouts during initial render or scrolling.
168
+ *
169
+ * Default: 450px.
170
+ */
171
+ retentionMarginPx?: number;
172
+ /**
173
+ * When using `virtualizeRows`, ignore scroll and resize position changes
174
+ * smaller than this value.
175
+ *
176
+ * Measurement inaccuracies and rounding artifacts may slightly change the
177
+ * table layout during materialization and virtualization. With scroll
178
+ * anchoring enabled (the default browser behavior), the browser may then
179
+ * adjust the scroll position, triggering additional scroll or resize events.
180
+ * Small deltas are ignored to prevent such feedback loops from causing
181
+ * oscillations at virtualization boundaries.
182
+ *
183
+ * Increase if you expect high inaccuracy in height measurements, or if you
184
+ * notice oscillations at virtualization boundaries.
185
+ *
186
+ * Default: 50px.
187
+ */
188
+ minScrollAndResizeDeltaPx?: number;
189
+ /**
190
+ * "Column editing mode" is a mode in which controls that are normally hidden
191
+ * become visible, such as column reorder and delete buttons.
192
+ *
193
+ * When this prop is `undefined`, the component manages the mode internally.
194
+ * Users can toggle it by tapping the table header on mobile or by clicking
195
+ * the column edit button, if enabled. Since tapping the table header is not
196
+ * discoverable by assistive technologies, it's recommended to enable
197
+ * `columnEditButton` when using the internal mode.
198
+ *
199
+ * Alternatively, pass `true` or `false` to control the mode externally.
200
+ */
201
+ columnEditing?: boolean;
202
+ /**
203
+ * Called when the user requests to enter or leave column editing mode.
204
+ *
205
+ * The `source` parameter indicates what triggered the request.
206
+ *
207
+ * When `columnEditing` is not controlled, the component automatically
208
+ * applies the requested change internally.
209
+ *
210
+ * When `columnEditing` is controlled externally and you still want to
211
+ * respond to user requests, use this callback to decide whether to
212
+ * update the mode.
213
+ */
214
+ onColumnEditingRequest?: (editing: boolean, source: 'header' | 'edit-button') => void;
215
+ /**
216
+ * Whether to show a small gear button in the top-right corner that
217
+ * toggles column editing mode.
218
+ *
219
+ * For accessibility, it's recommended to enable this button unless you
220
+ * provide an external control for toggling column editing mode.
221
+ */
222
+ columnEditButton?: boolean;
223
+ /**
224
+ * Applied to the `<thead>` element.
225
+ */
226
+ theadClassName?: string;
227
+ /**
228
+ * Applied to the only `<tr>` element within the `<thead>`.
229
+ */
230
+ theadTrClassName?: string;
231
+ /**
232
+ * Applied to the `<tbody>` element.
233
+ */
234
+ tbodyClassName?: string;
235
+ }
236
+ export type SortOrder = Extract<AriaAttributes['aria-sort'], 'none' | 'ascending' | 'descending'>;
237
+ /**
238
+ * The column specification.
239
+ */
240
+ export interface Column<T> {
241
+ /**
242
+ * Used as a key in the columns list.
243
+ */
244
+ key: React.Key;
245
+ /**
246
+ * Used in `aria-label`s of column controls which do not contain text,
247
+ * such as the delete column button. If not set, the `String(key)` is used.
248
+ */
249
+ name?: string;
250
+ /**
251
+ * Renders the content of the column header, excluding controls such as
252
+ * the sort and delete buttons. If not specified, the default behavior is
253
+ * `name ?? String(key)`.
254
+ */
255
+ renderHeader?: () => ReactNode;
256
+ /**
257
+ * Renders the value of a single cell. If not specified, the default
258
+ * behavior is:
259
+ *
260
+ * - If `item` is an `Array`, renders `String(item[columnIndex])`
261
+ * - If `item` is an `Object`, renders `String(item[String(columnKey)])`
262
+ * - Otherwise:
263
+ * - The first column renders `String(item)`
264
+ * - Other columns render an empty string
265
+ */
266
+ renderCell?: (item: T, index: number, items: readonly T[]) => ReactNode;
267
+ /**
268
+ * If the column gets an indent when `DefaultItemRendererProps.level` returns
269
+ * a positive number.
270
+ */
271
+ indent?: boolean;
272
+ /**
273
+ * If set, displays sort button and includes `aria-sort` in the column header.
274
+ * Handle clicks with {@link TableProps.onSort}.
275
+ */
276
+ sortOrder?: AriaAttributes['aria-sort'];
277
+ /**
278
+ * Whether to display a delete button in the column header.
279
+ * Handle delete requests with {@link TableProps.onColumnDelete}.
280
+ * Make sure {@link Column.name} or {@link Column.key} is meaningful,
281
+ * as it will be included in the `aria-label` of the delete button.
282
+ */
283
+ deletable?: boolean;
284
+ /**
285
+ * Displays a reorder handle in the column header.
286
+ * Handle reorder requests with {@link TableProps.onColumnReorder}.
287
+ * If a function is provided, it determines whether the column may be moved
288
+ * to the specified insertion position.
289
+ *
290
+ * Make sure {@link Column.name} or {@link Column.key} is meaningful,
291
+ * as it will be included in the `aria-label` of the reorder button.
292
+ */
293
+ canReorder?: boolean | ((columnBeingReordered: Column<T>, fromIndex: number, insertionIndex: number, columns: readonly Column<T>[]) => boolean);
294
+ /**
295
+ * The class name to apply to the `th` element inside `table > thead`.
296
+ */
297
+ thClassName?: string;
298
+ /**
299
+ * The class name to apply to the `td` element inside `table > tbody`.
300
+ * If a custom `TableProps.renderItem` is provided, this prop is not used,
301
+ * unless the custom renderer falls back to the `DefaultItemRenderer`.
302
+ */
303
+ tdClassName?: string | ((item: T, index: number, items: readonly T[]) => string | undefined);
304
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,91 +1,73 @@
1
1
  @import '../global/variables.css';
2
2
 
3
3
  .table {
4
+ --reorder-animation-fade-out-duration: 600ms;
5
+
4
6
  width: 100%;
5
7
 
6
- border-collapse: collapse;
8
+ border-spacing: 0;
9
+
7
10
  border-style: none;
8
11
  }
9
12
 
10
- .headerRow {
11
- border-bottom: 1px solid var(--ring-line-color);
13
+ .stickyHeader {
14
+ position: sticky;
15
+ z-index: var(--ring-overlay-z-index);
16
+
17
+ top: 0;
18
+
19
+ background-color: rgba(var(--ring-content-background-components), 0.85);
20
+ backdrop-filter: blur(8px);
21
+ }
22
+
23
+ @property --header-cell-shadow-color {
24
+ syntax: '<color>';
25
+ inherits: true;
26
+ initial-value: transparent;
12
27
  }
13
28
 
14
29
  .headerCell {
15
- position: relative;
30
+ margin: 0;
16
31
 
17
32
  padding: calc(var(--ring-unit) * 0.75) var(--ring-unit);
18
33
 
19
- transition: background-color var(--ring-fast-ease), border-color var(--ring-fast-ease);
20
-
21
- text-align: left;
34
+ transition: background-color var(--ring-fast-ease), --header-cell-shadow-color var(--ring-fast-ease);
22
35
 
23
- color: var(--ring-secondary-color);
24
- border-left: 1px solid transparent;
36
+ border-bottom: 1px solid var(--ring-line-color);
25
37
 
26
- font-size: var(--ring-font-size-smaller);
27
- font-weight: normal;
28
-
29
- &:last-child {
30
- border-right: 1px solid transparent;
31
- }
38
+ box-shadow: inset 1px 0 0 var(--header-cell-shadow-color), 1px 0 0 var(--header-cell-shadow-color);
32
39
 
33
40
  &:hover {
34
- border-left-color: var(--ring-line-color);
35
- background-color: var(--ring-grey-container-light-color);
36
-
37
- &:last-child {
38
- border-right-color: var(--ring-line-color);
39
- }
41
+ --header-cell-shadow-color: var(--ring-line-color);
40
42
 
41
- & + .headerCell {
42
- border-left-color: var(--ring-line-color);
43
+ &:not(.reorderAnimationInitial, .reorderAnimationFadeOut) {
44
+ background-color: var(--ring-grey-container-light-color);
43
45
  }
44
46
  }
45
47
  }
46
48
 
47
- .spacerRow {
48
- margin: 0;
49
- padding: 0;
50
-
51
- border: 0;
52
- }
49
+ .headerCellInnerWrapper {
50
+ display: flex;
51
+ justify-content: start;
53
52
 
54
- .spacerCell {
55
- margin: 0;
56
- padding: 0;
53
+ color: var(--ring-secondary-color);
57
54
 
58
- border: 0;
59
- }
55
+ font-size: var(--ring-font-size-smaller);
56
+ font-weight: normal;
60
57
 
61
- .row {
62
- border-bottom: 1px solid var(--ring-line-color);
58
+ .sortAndHeader {
59
+ flex-grow: 1;
63
60
 
64
- &:focus {
65
- border-radius: var(--ring-border-radius);
66
- outline: 2px solid var(--ring-button-focus-border-color);
61
+ text-align: left;
62
+ white-space: nowrap;
67
63
  }
68
- }
69
64
 
70
- .clickableRow {
71
- cursor: pointer;
72
-
73
- transition: background-color var(--ring-fast-ease);
74
-
75
- &:not(.selectedRow):hover {
76
- background-color: var(--ring-hover-background-color);
65
+ .rightButtons {
66
+ margin-left: 4px;
77
67
  }
78
68
  }
79
69
 
80
- .selectedRow {
81
- background-color: var(--ring-selected-background-color);
82
- }
83
-
84
- .cell {
85
- padding: var(--ring-unit);
86
- }
87
-
88
- .headerButton {
70
+ .tableButton {
89
71
  margin: unset;
90
72
  padding: unset;
91
73
 
@@ -108,30 +90,160 @@
108
90
  border-radius: 2px;
109
91
  outline: 2px solid var(--ring-button-focus-border-color);
110
92
  }
93
+
94
+ &:focus-within {
95
+ color: var(--ring-main-hover-color);
96
+ }
111
97
  }
112
98
 
113
99
  .deleteColumnButton {
114
- float: right;
115
-
116
100
  pointer-events: none;
117
101
 
118
102
  color: transparent;
119
103
 
120
- }
121
-
122
- .headerCell:hover .deleteColumnButton {
123
- pointer-events: all;
104
+ .theadColumnEditing &,
105
+ .headerCell:hover &,
106
+ &:focus {
107
+ pointer-events: unset;
108
+ }
124
109
 
125
- color: unset;
110
+ /* stylelint-disable-next-line selector-max-specificity */
111
+ .theadColumnEditing &:not(:focus),
112
+ /* stylelint-disable-next-line selector-max-specificity */
113
+ .headerCell:hover &:not(:focus) {
114
+ color: unset;
115
+ }
126
116
 
127
117
  /* stylelint-disable-next-line selector-max-specificity */
128
- &:hover {
118
+ .headerCell:hover &:hover:not(:focus),
119
+ &:focus {
129
120
  color: var(--ring-main-hover-color);
130
121
  }
131
122
  }
132
123
 
133
- .deleteColumnButton:focus-within {
134
- pointer-events: all;
124
+ .columnReorderHandle {
125
+ overflow: hidden;
126
+
127
+ width: 0;
128
+
129
+ cursor: grab;
130
+
131
+ transition: color var(--ring-fast-ease), width var(--ring-fast-ease), margin-right var(--ring-fast-ease);
132
+
133
+ border-radius: var(--ring-border-radius);
134
+ touch-action: none;
135
+ }
136
+
137
+ .itemReorderHandle {
138
+ cursor: grab;
139
+
140
+ color: var(--ring-secondary-color);
141
+
142
+ border-radius: var(--ring-border-radius);
143
+ touch-action: none;
144
+ }
145
+
146
+ .theadColumnEditing .columnReorderHandle,
147
+ .headerCell:hover .columnReorderHandle,
148
+ .columnReorderHandle:focus-visible {
149
+ width: 12px;
150
+ margin-right: 4px;
151
+ }
152
+
153
+ .columnReorderHandleMirror {
154
+ display: inline-block;
155
+
156
+ width: 12px;
157
+ margin-left: 4px;
158
+
159
+ transition: width var(--ring-fast-ease), margin-left var(--ring-fast-ease);
160
+ }
161
+
162
+ .theadColumnEditing .columnReorderHandleMirror,
163
+ .headerCell:hover .columnReorderHandleMirror,
164
+ .columnReorderHandle:focus-visible ~ .columnReorderHandleMirror {
165
+ width: 0;
166
+ margin-left: 0;
167
+ }
168
+
169
+ .editColumnsButton {
170
+ & svg {
171
+ transition: transform var(--ring-fast-ease);
172
+ }
173
+
174
+ .theadColumnEditing & svg {
175
+ transform: rotate(90deg);
176
+ }
177
+ }
178
+
179
+ .dragFrame {
180
+ position: fixed;
181
+
182
+ z-index: var(--ring-overlay-z-index);
183
+
184
+ pointer-events: none;
185
+
186
+ border: 2px solid var(--ring-border-accent-color);
187
+ border-radius: calc(2 * var(--ring-border-radius));
188
+
189
+ background-color: rgba(var(--ring-border-accent-components), 0.06);
190
+ }
191
+
192
+ .insertionIndicator {
193
+ position: fixed;
194
+
195
+ z-index: var(--ring-overlay-z-index);
196
+
197
+ background-color: var(--ring-main-color);
198
+ }
199
+
200
+ .reorderAnimationInitial {
201
+ transition: none;
202
+
203
+ background-color: rgba(var(--ring-border-accent-components), 0.12);
204
+ }
205
+
206
+ .reorderAnimationFadeOut {
207
+ transition: background-color var(--reorder-animation-fade-out-duration) ease-out;
208
+
209
+ background-color: transparent;
210
+ }
135
211
 
136
- color: var(--ring-main-hover-color);
212
+ .spacerRow {
213
+ margin: 0;
214
+ padding: 0;
215
+
216
+ border: 0;
217
+ }
218
+
219
+ .spacerCell {
220
+ margin: 0;
221
+ padding: 0;
222
+
223
+ border: 0;
224
+ }
225
+
226
+ .row:focus {
227
+ border-radius: var(--ring-border-radius);
228
+ outline: 2px solid var(--ring-button-focus-border-color);
229
+ }
230
+
231
+ .clickableRow {
232
+ cursor: pointer;
233
+
234
+ transition: background-color var(--ring-fast-ease);
235
+
236
+ &:not(.selectedRow):hover {
237
+ background-color: var(--ring-hover-background-color);
238
+ }
239
+ }
240
+
241
+ .selectedRow {
242
+ background-color: var(--ring-selected-background-color);
243
+ }
244
+
245
+ .cell {
246
+ padding: var(--ring-unit);
247
+
248
+ border-bottom: 1px solid var(--ring-line-color);
137
249
  }