@ethlete/components 1.0.0-next.89 → 1.0.0-next.90

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 (65) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/design/sdk/components/accent-on-light/accent-on-light.ts +1 -0
  3. package/design/sdk/components/action-sheet/action-sheet.ts +25 -1
  4. package/design/sdk/components/anchored-dialog/anchored-dialog.css +2 -5
  5. package/design/sdk/components/anchored-dialog/anchored-dialog.ts +13 -8
  6. package/design/sdk/components/badge/badge.css +18 -0
  7. package/design/sdk/components/badge/badge.ts +27 -3
  8. package/design/sdk/components/banner/banner.ts +32 -1
  9. package/design/sdk/components/bracket/bracket.ts +1 -0
  10. package/design/sdk/components/breadcrumb/breadcrumb.ts +1 -1
  11. package/design/sdk/components/button/button.ts +1 -0
  12. package/design/sdk/components/calendar/calendar.ts +31 -4
  13. package/design/sdk/components/card/card.ts +41 -1
  14. package/design/sdk/components/carousel/carousel.ts +35 -5
  15. package/design/sdk/components/chart/chart.ts +8 -2
  16. package/design/sdk/components/checkbox/checkbox.ts +11 -2
  17. package/design/sdk/components/chip/chip.ts +2 -9
  18. package/design/sdk/components/copy-button/copy-button.ts +4 -1
  19. package/design/sdk/components/dialog/dialog.ts +58 -1
  20. package/design/sdk/components/empty-state/empty-state.ts +1 -0
  21. package/design/sdk/components/floating-action/floating-action.ts +1 -0
  22. package/design/sdk/components/form-field/form-field.ts +9 -16
  23. package/design/sdk/components/grid/grid.ts +4 -1
  24. package/design/sdk/components/match/match.ts +1 -0
  25. package/design/sdk/components/menu/menu.ts +1 -0
  26. package/design/sdk/components/notification/notification.ts +1 -0
  27. package/design/sdk/components/pagination/pagination.ts +1 -1
  28. package/design/sdk/components/progress-steps/progress-steps.ts +1 -0
  29. package/design/sdk/components/query-error/query-error.ts +4 -1
  30. package/design/sdk/components/radio-group/radio-group.ts +1 -0
  31. package/design/sdk/components/scheduler/scheduler.ts +22 -1
  32. package/design/sdk/components/scrollable/scrollable.ts +28 -2
  33. package/design/sdk/components/scrollbar/scrollbar.css +1 -1
  34. package/design/sdk/components/scrollbar/scrollbar.ts +13 -0
  35. package/design/sdk/components/select/select.ts +9 -0
  36. package/design/sdk/components/select/shared/select-part.ts +4 -12
  37. package/design/sdk/components/select-panel/select-panel.ts +1 -0
  38. package/design/sdk/components/standings/standings.ts +4 -1
  39. package/design/sdk/components/stream/stream.ts +12 -3
  40. package/design/sdk/components/switch/switch.ts +10 -4
  41. package/design/sdk/components/table/table.ts +94 -12
  42. package/design/sdk/components/tabs/tabs.ts +1 -1
  43. package/design/sdk/components/textarea/textarea.ts +31 -2
  44. package/design/sdk/components/toolbar/toolbar.ts +1 -0
  45. package/design/sdk/components/tree/tree.ts +8 -1
  46. package/design/sdk/foundations/elevation/elevation.ts +1 -0
  47. package/design/sdk/ready.json +334 -87
  48. package/design/sdk/rule-baseline.json +48 -0
  49. package/design/table.ts +11 -4
  50. package/design/tooltip.ts +7 -1
  51. package/fesm2022/ethlete-components.mjs +438 -73
  52. package/fesm2022/ethlete-components.mjs.map +1 -1
  53. package/package.json +1 -1
  54. package/src/lib/bracket/bracket.component.css +4 -1
  55. package/src/lib/forms/choice-field/choice-field.component.css +4 -2
  56. package/src/lib/forms/dropzone/dropzone-crop.component.css +21 -0
  57. package/src/lib/forms/select/select-option-styles.component.css +1 -0
  58. package/src/lib/match/match-card.component.css +8 -2
  59. package/src/lib/match/match-participant.component.css +21 -1
  60. package/src/lib/stream/consent/stream-consent.component.css +1 -0
  61. package/src/lib/stream/error/stream-player-error.component.css +1 -0
  62. package/src/lib/stream/stream-overlay-card-styles.component.css +9 -3
  63. package/src/lib/table/table.component.css +1 -0
  64. package/types/ethlete-components.d.ts +111 -11
  65. package/design/sdk/components/switch/switch.css +0 -37
@@ -4,14 +4,17 @@ import frame from './table.css?inline';
4
4
 
5
5
  type Interaction = 'hover' | 'active' | 'focus-visible';
6
6
 
7
+ type Selection = 'some' | 'row-added' | 'row-removed' | 'all' | 'none';
8
+
7
9
  type Props = {
8
10
  appearance?: TableMockOptions['appearance'];
9
11
  sort?: 'asc' | 'desc';
10
12
  header?: Interaction;
11
13
  row?: Interaction;
12
14
  cell?: 'focus-visible';
13
- selection?: boolean;
15
+ selection?: Selection;
14
16
  expanded?: boolean;
17
+ collapsed?: boolean;
15
18
  expander?: Interaction;
16
19
  groups?: boolean;
17
20
  cellError?: boolean;
@@ -38,18 +41,33 @@ const PLAYERS: [string, string, string, string][] = [
38
41
 
39
42
  const LONG = 'Hoffmann-Wiesenthal-Brandenburger-Lindqvist-Oberhausen';
40
43
 
44
+ const SORT = 'data-et-action="emit:sortChange"';
45
+
46
+ const action = (state: string) => `data-et-action="${state}"`;
47
+
48
+ const SELECTED: Record<Selection, number[]> = {
49
+ some: [1, 2],
50
+ 'row-added': [0, 1, 2],
51
+ 'row-removed': [2],
52
+ all: [0, 1, 2, 3],
53
+ none: [],
54
+ };
55
+
56
+ const selectAll = (selection: Selection): TableMockOptions['selection'] =>
57
+ selection === 'all' ? 'checked' : selection === 'none' ? 'unchecked' : 'mixed';
58
+
41
59
  const columns = (
42
60
  sort: Props['sort'],
43
61
  header: Props['header'],
44
62
  align: TableColumnMock['align'] = 'end',
45
63
  ): TableColumnMock[] => [
46
- { header: 'Player', sortable: true, sort: sort ?? 'asc' },
64
+ { header: 'Player', sortable: true, sort: sort ?? 'asc', labelAttributes: SORT },
47
65
  {
48
66
  header: 'Team',
49
67
  sortable: true,
50
- labelAttributes: header ? `data-et-force="${header}"` : undefined,
68
+ labelAttributes: header ? `${SORT} data-et-force="${header}"` : SORT,
51
69
  },
52
- { header: 'Goals', sortable: true, align },
70
+ { header: 'Goals', sortable: true, align, labelAttributes: SORT },
53
71
  { header: 'Assists', align },
54
72
  ];
55
73
 
@@ -66,7 +84,13 @@ const wideTable = (scrolled: boolean) =>
66
84
  errorColor: 'danger',
67
85
  tracks: '140px 132px repeat(5, 96px)',
68
86
  columns: [
69
- { header: 'Player', sortable: true, sort: 'asc', sticky: scrolled ? { side: 'start', offset: 0 } : undefined },
87
+ {
88
+ header: 'Player',
89
+ sortable: true,
90
+ sort: 'asc',
91
+ labelAttributes: SORT,
92
+ sticky: scrolled ? { side: 'start', offset: 0 } : undefined,
93
+ },
70
94
  ...WIDE_HEADERS.map((header, index) => ({ header, align: index === 0 ? undefined : ('end' as const) })),
71
95
  ],
72
96
  rows: WIDE.map((cells, index) => ({ cells: [PLAYERS[index]?.[0] ?? '', ...cells] })),
@@ -74,6 +98,8 @@ const wideTable = (scrolled: boolean) =>
74
98
  attributes: scrolled ? 'data-scrolled' : undefined,
75
99
  });
76
100
 
101
+ const expandable = (props: Props) => props.expanded || props.collapsed || props.expander !== undefined;
102
+
77
103
  const rows = (props: Props): TableRowMock[] =>
78
104
  PLAYERS.slice(props.stickyHeader ? 3 : 0, props.stickyHeader ? 8 : 4).map((cells, index) => {
79
105
  const row: TableRowMock = { cells: [...cells] };
@@ -84,12 +110,18 @@ const rows = (props: Props): TableRowMock[] =>
84
110
  }
85
111
  if (props.cell && index === 1) row.cells[1] = { value: cells[1], attributes: `data-et-force="${props.cell}"` };
86
112
  if (props.row && index === 1) row.attributes = `data-et-force="${props.row}"`;
87
- if (props.selection) row.selected = index === 1 || index === 2;
113
+ if (props.selection) {
114
+ row.selected = SELECTED[props.selection].includes(index);
115
+ row.selectAttributes = action(row.selected ? 'selection-removed' : 'selection-added');
116
+ }
88
117
  if (props.expanded && index === 1) {
89
118
  row.detail = `<div class="t-detail"><span>Club since 2021</span><span>Left foot</span><span>2 hat-tricks this season</span></div>`;
90
119
  }
91
- if (props.expander && index === 1) row.expanderAttributes = `data-et-force="${props.expander}"`;
92
- if (props.expanded && index === 3) row.noExpander = true;
120
+ if (expandable(props)) {
121
+ const force = props.expander && index === 1 ? ` data-et-force="${props.expander}"` : '';
122
+ row.expanderAttributes = `${action(row.detail === undefined ? 'expanded' : 'collapsed')}${force}`;
123
+ }
124
+ if (expandable(props) && index === 3) row.noExpander = true;
93
125
 
94
126
  return row;
95
127
  });
@@ -104,8 +136,11 @@ const render = (props: Props) => {
104
136
  density: props.density,
105
137
  columns: columns(props.sort, props.header, props.center ? 'center' : undefined),
106
138
  rows: rows(props),
107
- selection: props.selection ? 'mixed' : undefined,
108
- expandable: props.expanded || props.expander !== undefined,
139
+ selection: props.selection ? selectAll(props.selection) : undefined,
140
+ selectAllAttributes: props.selection
141
+ ? action(props.selection === 'all' ? 'selection-none' : 'selection-all')
142
+ : undefined,
143
+ expandable: expandable(props),
109
144
  groups: props.groups ? [{ span: 2 }, { label: 'Season', span: 2 }] : undefined,
110
145
  message: props.message,
111
146
  placeholder: props.loading ? { rows: 4, widths: [70, 55, 30, 30] } : undefined,
@@ -132,9 +167,14 @@ export default definePart({
132
167
  zebra: { appearance: 'zebra' },
133
168
  grid: { appearance: 'grid' },
134
169
  bare: { appearance: 'bare' },
135
- selection: { selection: true },
136
- 'selection-hover': { selection: true, row: 'hover' },
170
+ selection: { selection: 'some' },
171
+ 'selection-hover': { selection: 'some', row: 'hover' },
172
+ 'selection-added': { selection: 'row-added' },
173
+ 'selection-removed': { selection: 'row-removed' },
174
+ 'selection-all': { selection: 'all' },
175
+ 'selection-none': { selection: 'none' },
137
176
  expanded: { expanded: true },
177
+ collapsed: { collapsed: true },
138
178
  'expander-hover': { expanded: true, expander: 'hover' },
139
179
  'expander-focus-visible': { expanded: true, expander: 'focus-visible' },
140
180
  'group-header': { groups: true },
@@ -167,8 +207,13 @@ export default definePart({
167
207
  selection: 'A selection column with two rows selected; check the mixed header checkbox and the selected row tint.',
168
208
  'selection-hover':
169
209
  'The selection table with the selected second row hovered; check that hover and selection both read.',
210
+ 'selection-added': 'Lena selected on top of the selection; check her checkbox and row tint, header still mixed.',
211
+ 'selection-removed': 'Mara cleared from the selection; only Ida stays selected and the header stays mixed.',
212
+ 'selection-all': 'Every row selected; check that the header checkbox is checked and all four rows tint.',
213
+ 'selection-none': 'No row selected; check that every checkbox, the header one too, is empty and no row tints.',
170
214
  expanded:
171
215
  'The second row expanded with its detail; check that the detail sits under the row and Pia has no expander.',
216
+ collapsed: 'The expander column with every row collapsed; check the closed chevrons and that Pia has no expander.',
172
217
  'expander-hover': 'The second row expander hovered; check that only the expander button shows hover.',
173
218
  'expander-focus-visible': 'The second row expander focused by keyboard; check that the ring wraps the expander.',
174
219
  'group-header': 'A Season group over Goals and Assists; check that the group label spans its two columns.',
@@ -186,7 +231,44 @@ export default definePart({
186
231
  'align-center': 'Goals and Assists centered; check that numbers and headers sit in the middle of their columns.',
187
232
  },
188
233
  widths: [480],
234
+ motions: {
235
+ expand: { from: 'collapsed', to: 'expanded' },
236
+ collapse: { from: 'expanded', to: 'collapsed' },
237
+ },
238
+ unreachable: [
239
+ {
240
+ from: 'rest',
241
+ to: 'collapsed',
242
+ reason: 'The collapsed table has an expander column the rest table lacks; no step adds or drops that column.',
243
+ },
244
+ {
245
+ from: 'collapsed',
246
+ to: 'rest',
247
+ reason: 'The collapsed table has an expander column the rest table lacks; no step adds or drops that column.',
248
+ },
249
+ {
250
+ from: 'loading',
251
+ to: 'collapsed',
252
+ reason: 'The loading table draws placeholder rows without an expander column; no step adds that column.',
253
+ },
254
+ {
255
+ from: 'collapsed',
256
+ to: 'loading',
257
+ reason: 'The loading table draws placeholder rows without an expander column; no step drops that column.',
258
+ },
259
+ {
260
+ from: 'busy',
261
+ to: 'collapsed',
262
+ reason: 'The busy table has no expander column, the collapsed one has; no step adds that column.',
263
+ },
264
+ {
265
+ from: 'collapsed',
266
+ to: 'busy',
267
+ reason: 'The busy table has no expander column, the collapsed one has; no step drops that column.',
268
+ },
269
+ ],
189
270
  frame: (body) => `<div class="t-frame">${body}</div>`,
271
+ scrolls: ['wide-scroll', 'sticky-column'],
190
272
  render: (props: Props) =>
191
273
  drawing({
192
274
  body: render(props),
@@ -89,7 +89,7 @@ export default definePart({
89
89
  triggerAttributes: forced
90
90
  ? { ...props.triggerAttributes, [forced.tab]: `data-et-force="${forced.interaction}"` }
91
91
  : props.triggerAttributes,
92
- }).replaceAll('role="tab"', 'data-et-control="tab" role="tab"'),
92
+ }).replaceAll('role="tab"', 'data-et-control="tab" data-et-action="emit:selectedIndexChange" role="tab"'),
93
93
  styles: [tabsStyles, edge].join('\n'),
94
94
  }),
95
95
  });
@@ -20,6 +20,12 @@ const INVALID = {
20
20
  errorColor: 'danger',
21
21
  } satisfies Partial<TextareaFieldMockOptions>;
22
22
 
23
+ const markControl = (markup: string) =>
24
+ markup
25
+ .replace('<et-form-field ', '<et-form-field data-et-control="textarea" ')
26
+ .replace('<div class="et-form-field-control-frame"', '$& data-et-control-part')
27
+ .replace('<textarea ', '<textarea data-et-control-part ');
28
+
23
29
  export default definePart({
24
30
  note: 'scale of the decided shape, Q182, lead merge',
25
31
  madeBy: ['claude-opus-5-5', 'claude-sonnet-5-5', 'design check'],
@@ -86,12 +92,35 @@ export default definePart({
86
92
  'size-lg': 'The filled textarea at size lg; check that padding and text grow together.',
87
93
  },
88
94
  widths: [320, 360, 640],
95
+ controls: {
96
+ textarea: { kind: 'field', part: 'components/form-field', disabled: true },
97
+ },
98
+ motions: {
99
+ 'hover-in': { from: 'empty', to: 'hover' },
100
+ 'hover-out': { from: 'hover', to: 'empty' },
101
+ 'hover-in-filled': { from: 'filled', to: 'hover-filled' },
102
+ 'hover-out-filled': { from: 'hover-filled', to: 'filled' },
103
+ 'hover-in-invalid': { from: 'invalid', to: 'invalid-hover' },
104
+ 'hover-out-invalid': { from: 'invalid-hover', to: 'invalid' },
105
+ disable: { from: 'empty', to: 'disabled' },
106
+ enable: { from: 'disabled', to: 'empty' },
107
+ 'disable-hovered': { from: 'hover', to: 'disabled' },
108
+ 'enable-hovered': { from: 'disabled', to: 'hover' },
109
+ 'disable-filled': { from: 'filled', to: 'disabled-filled' },
110
+ 'enable-filled': { from: 'disabled-filled', to: 'filled' },
111
+ 'disable-hovered-filled': { from: 'hover-filled', to: 'disabled-filled' },
112
+ 'enable-hovered-filled': { from: 'disabled-filled', to: 'hover-filled' },
113
+ },
89
114
  frame: (body, props) => `<div class="t-frame ${props.scrolled ? 't-scrolled' : ''}">${body}</div>`,
115
+ scrolls: ['long-max-rows', 'manual-resize-overflow'],
90
116
  render: (props: Props) =>
91
117
  drawing({
92
118
  body: props.scrolled
93
- ? textareaField(props.field).replace('<div class="et-form-field-control-frame"', '$& data-et-skip="CLIPPED"')
94
- : textareaField(props.field),
119
+ ? markControl(textareaField(props.field)).replace(
120
+ '<div class="et-form-field-control-frame"',
121
+ '$& data-et-skip="CLIPPED"',
122
+ )
123
+ : markControl(textareaField(props.field)),
95
124
  styles: [textareaFieldStyles, frame].join('\n'),
96
125
  }),
97
126
  });
@@ -61,6 +61,7 @@ const render = (props: Props) => {
61
61
 
62
62
  export default definePart({
63
63
  note: 'scale of the decided shape, Q182, lead merge',
64
+ consumerAction: 'its buttons run the commands the consumer binds',
64
65
  madeBy: ['claude-opus-5-5'],
65
66
  states: {
66
67
  default: {},
@@ -28,6 +28,8 @@ const FILES: TreeMockItem[] = [
28
28
  { label: 'package.json' },
29
29
  ];
30
30
 
31
+ const SELECT = 'data-et-action="emit:valueChange"';
32
+
31
33
  const SHORT: TreeMockItem[] = [{ label: 'docs' }, { label: 'notes.md' }, { label: 'README.md' }];
32
34
 
33
35
  const { states, grid } = interactionRows(
@@ -76,7 +78,12 @@ export default definePart({
76
78
  ...props,
77
79
  label: 'Files',
78
80
  rowAttributes: forced && { [forced.row]: `data-et-force="${forced.interaction}"` },
79
- }).replaceAll('role="treeitem"', 'data-et-control="row" role="treeitem"'),
81
+ }).replace(/<div [^>]*role="treeitem"[^>]*>/g, (row) =>
82
+ row.replace(
83
+ 'role="treeitem"',
84
+ `data-et-control="row"${row.includes('aria-disabled') ? '' : ` ${SELECT}`} role="treeitem"`,
85
+ ),
86
+ ),
80
87
  styles: [treeStyles, selectedTint].join('\n'),
81
88
  }),
82
89
  });
@@ -4,6 +4,7 @@ import edge from './elevation.css?inline';
4
4
 
5
5
  export default definePart<ElevationProps>({
6
6
  note: 'How the SDK lifts things off the base surface: a card, an elevated panel and an overlay pane (the select panel mock), side by side and as a pane over a panel. Fills come from the elevated surface tokens; no background colour differs from the product. In the dark scheme a 1 px ring in --et-surface-ring-solid (24 % --et-surface-color-solid over the fill) replaces the border colour. The token is defined here; the generator does not emit it yet.',
7
+ consumerAction: 'a showcase whose select the consumer binds',
7
8
  madeBy: ['claude-opus-5-5'],
8
9
  states: ELEVATION_STATES,
9
10
  describe: {