@worknice/whiteboard 0.53.0 → 0.55.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.
@@ -15,8 +15,33 @@ import * as __WEBPACK_EXTERNAL_MODULE__RichListBulkActionBar_js_d46cecae__ from
15
15
  import * as __WEBPACK_EXTERNAL_MODULE__RichListDisplayModal_js_6277e838__ from "./RichListDisplayModal.js";
16
16
  import * as __WEBPACK_EXTERNAL_MODULE__RichListRow_js_08189b13__ from "./RichListRow.js";
17
17
  import * as __WEBPACK_EXTERNAL_MODULE__RichListToolbar_js_747b658d__ from "./RichListToolbar.js";
18
+ function countColumnFiltersDifferingFromInitial(currentFilters, initialFilters) {
19
+ return initialFilters.filter((initialFilter)=>{
20
+ const currentFilter = currentFilters.find((f)=>f.id === initialFilter.id);
21
+ const currentValue = currentFilter?.value;
22
+ const initialValue = initialFilter.value;
23
+ if (Array.isArray(initialValue) && Array.isArray(currentValue)) return currentValue.length !== initialValue.length || initialValue.some((v, i)=>v !== currentValue[i]);
24
+ return currentValue !== initialValue;
25
+ }).length;
26
+ }
27
+ function stripColumnFilterById(filters, columnId) {
28
+ if (void 0 === columnId) return filters;
29
+ return filters.filter((f)=>f.id !== columnId);
30
+ }
31
+ function mergeInlineSinglePersistedColumnFilters(tableColumnFilters, inlineColumnId, inlineOptionId) {
32
+ if (void 0 === inlineColumnId || void 0 === inlineOptionId) return tableColumnFilters;
33
+ const without = stripColumnFilterById(tableColumnFilters, inlineColumnId);
34
+ return [
35
+ ...without,
36
+ {
37
+ id: inlineColumnId,
38
+ value: inlineOptionId
39
+ }
40
+ ];
41
+ }
18
42
  const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], contentAlignment = "space-evenly", trailingSlot, href, rowActions, bulkActions = [], secondaryBulkActions = [], rowHeight = "medium", csvFilename, fillContainerHeight = false, compactBreakpoint: compactBreakpointProp, enableSorting = false, emptyState = "No results", id, pathName, localStorageSchema, header })=>{
19
43
  const [searchTerm, setSearchTerm] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)("");
44
+ const [inlineSingleSelectChoice, setInlineSingleSelectChoice] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(void 0);
20
45
  const [isFilterModalOpen, setIsFilterModalOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
21
46
  const [isDisplayModalOpen, setIsDisplayModalOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
22
47
  const lastSelectedRowRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(void 0);
@@ -84,6 +109,13 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
84
109
  const entriesWithFilter = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>allEntries.filter((e)=>null !== e && void 0 !== e.filter && e.filter.options.length > 0), [
85
110
  allEntries
86
111
  ]);
112
+ const inlineSingleSelectExcludedFromTableColumnId = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
113
+ if (1 !== entriesWithFilter.length) return;
114
+ if (true === entriesWithFilter[0].filter.isMulti) return;
115
+ return entriesWithFilter[0].id;
116
+ }, [
117
+ entriesWithFilter
118
+ ]);
87
119
  const entriesWithGlobalFilter = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>allEntries.filter((e)=>null !== e && e.globalFiltering && void 0 !== e.value), [
88
120
  allEntries
89
121
  ]);
@@ -104,13 +136,15 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
104
136
  ]);
105
137
  const columnDefs = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
106
138
  const columnHelper = (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.createColumnHelper)();
139
+ const tableFilteringForEntry = (entryId)=>!(void 0 !== inlineSingleSelectExcludedFromTableColumnId && entryId === inlineSingleSelectExcludedFromTableColumnId);
107
140
  const columns = allEntries.filter((e)=>null !== e).map((entry)=>{
141
+ const tableFiltering = !!entry.filter && tableFilteringForEntry(entry.id);
108
142
  if (void 0 === entry.value) return columnHelper.display({
109
143
  id: entry.id,
110
144
  cell: ({ row })=>entry.render(row.original),
111
145
  enableHiding: (0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.isColumnWithVisibilityState)(entry),
112
146
  enableGlobalFilter: false,
113
- enableColumnFilter: void 0 !== entry.filter
147
+ enableColumnFilter: tableFiltering
114
148
  });
115
149
  const value = entry.value;
116
150
  return columnHelper.accessor((row)=>value(row), {
@@ -124,7 +158,7 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
124
158
  } : {
125
159
  enableSorting: false
126
160
  },
127
- filterFn: entry.filter ? (row, _columnId, filterValue)=>{
161
+ filterFn: entry.filter && tableFiltering ? (row, _columnId, filterValue)=>{
128
162
  const filter = entry.filter;
129
163
  if (!filter) return true;
130
164
  if (filter.isMulti && Array.isArray(filterValue)) {
@@ -153,7 +187,8 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
153
187
  }, [
154
188
  allEntries,
155
189
  enableRowSelection,
156
- enableSorting
190
+ enableSorting,
191
+ inlineSingleSelectExcludedFromTableColumnId
157
192
  ]);
158
193
  const columnFiltersInitialState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>entriesWithFilter.map((entry)=>{
159
194
  const filter = entry.filter;
@@ -173,14 +208,59 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
173
208
  id
174
209
  ]);
175
210
  const localStorageData = "undefined" != typeof window && storageKey ? window.localStorage.getItem(storageKey) : null;
176
- let parsedLocalStorage = {};
177
- if (localStorageData && localStorageSchema) try {
178
- parsedLocalStorage = JSON.parse(localStorageData);
179
- localStorageSchema.parse(parsedLocalStorage);
180
- } catch (error) {
181
- console.error("Error parsing localStorage data:", error);
182
- parsedLocalStorage = {};
183
- }
211
+ const parsedLocalStorage = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
212
+ if (!localStorageData || !localStorageSchema) return {};
213
+ try {
214
+ const parsed = JSON.parse(localStorageData);
215
+ localStorageSchema.parse(parsed);
216
+ return parsed;
217
+ } catch (error) {
218
+ console.error("Error parsing localStorage data:", error);
219
+ return {};
220
+ }
221
+ }, [
222
+ localStorageData,
223
+ localStorageSchema
224
+ ]);
225
+ const mergedInitialPersistedColumnFilters = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>parsedLocalStorage.columnFilters ?? columnFiltersInitialState, [
226
+ parsedLocalStorage.columnFilters,
227
+ columnFiltersInitialState
228
+ ]);
229
+ const tableColumnFiltersInitialState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>stripColumnFilterById(mergedInitialPersistedColumnFilters, inlineSingleSelectExcludedFromTableColumnId), [
230
+ mergedInitialPersistedColumnFilters,
231
+ inlineSingleSelectExcludedFromTableColumnId
232
+ ]);
233
+ const modalColumnFiltersBaseline = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>stripColumnFilterById(columnFiltersInitialState, inlineSingleSelectExcludedFromTableColumnId), [
234
+ columnFiltersInitialState,
235
+ inlineSingleSelectExcludedFromTableColumnId
236
+ ]);
237
+ const inlineSingleSelectOptionIdResolved = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
238
+ if (void 0 === inlineSingleSelectExcludedFromTableColumnId) return;
239
+ const entry = entriesWithFilter[0];
240
+ const options = entry.filter.options;
241
+ const isValidOption = (optionId)=>void 0 !== optionId && options.some((o)=>o.id === optionId);
242
+ if (isValidOption(inlineSingleSelectChoice)) return inlineSingleSelectChoice;
243
+ const fromPersisted = mergedInitialPersistedColumnFilters.find((f)=>f.id === inlineSingleSelectExcludedFromTableColumnId)?.value;
244
+ if ("string" == typeof fromPersisted && isValidOption(fromPersisted)) return fromPersisted;
245
+ return entry.filter.options[0].id;
246
+ }, [
247
+ entriesWithFilter,
248
+ inlineSingleSelectExcludedFromTableColumnId,
249
+ inlineSingleSelectChoice,
250
+ mergedInitialPersistedColumnFilters
251
+ ]);
252
+ const tableData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
253
+ if (void 0 === inlineSingleSelectExcludedFromTableColumnId || void 0 === inlineSingleSelectOptionIdResolved) return data;
254
+ const filter = entriesWithFilter[0].filter;
255
+ const option = filter.options.find((o)=>o.id === inlineSingleSelectOptionIdResolved);
256
+ const pred = option?.predicate;
257
+ return pred ? data.filter((row)=>pred(row)) : data;
258
+ }, [
259
+ data,
260
+ entriesWithFilter,
261
+ inlineSingleSelectExcludedFromTableColumnId,
262
+ inlineSingleSelectOptionIdResolved
263
+ ]);
184
264
  const permanentlyHiddenColumnIds = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>new Set(allEntries.filter((e)=>null !== e && "canToggleVisibility" in e && e.hiddenByDefault && !e.canToggleVisibility).map((e)=>e.id)), [
185
265
  allEntries
186
266
  ]);
@@ -212,7 +292,7 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
212
292
  secondaryBulkActions
213
293
  ]);
214
294
  const table = (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.useReactTable)({
215
- data,
295
+ data: tableData,
216
296
  columns: columnDefs,
217
297
  getRowId,
218
298
  getCoreRowModel: (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.getCoreRowModel)(),
@@ -223,7 +303,7 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
223
303
  getColumnCanGlobalFilter: ()=>true,
224
304
  enableRowSelection: enableRowSelection ? isRowSelectable : false,
225
305
  initialState: {
226
- columnFilters: parsedLocalStorage.columnFilters ?? columnFiltersInitialState,
306
+ columnFilters: tableColumnFiltersInitialState,
227
307
  columnVisibility: initialColumnVisibility,
228
308
  globalFilter: "",
229
309
  sorting: parsedLocalStorage.sorting ?? []
@@ -254,31 +334,24 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
254
334
  const rows = table.getRowModel().rows;
255
335
  const filteredSelectedRows = table.getFilteredSelectedRowModel();
256
336
  const throttledSetGlobalFilter = (0, __WEBPACK_EXTERNAL_MODULE__react_hook_throttle_d66151d4__.useThrottleCallback)((value)=>table.setGlobalFilter(value), 4);
257
- const activeFilterCount = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
258
- const currentFilters = tableState.columnFilters;
259
- return columnFiltersInitialState.filter((initialFilter)=>{
260
- const currentFilter = currentFilters.find((f)=>f.id === initialFilter.id);
261
- const currentValue = currentFilter?.value;
262
- const initialValue = initialFilter.value;
263
- if (Array.isArray(initialValue) && Array.isArray(currentValue)) return currentValue.length !== initialValue.length || initialValue.some((v, i)=>v !== currentValue[i]);
264
- return currentValue !== initialValue;
265
- }).length;
266
- }, [
337
+ const activeFilterCount = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>countColumnFiltersDifferingFromInitial(tableState.columnFilters, modalColumnFiltersBaseline), [
267
338
  tableState.columnFilters,
268
- columnFiltersInitialState
339
+ modalColumnFiltersBaseline
269
340
  ]);
270
341
  const showSearchReset = activeFilterCount > 0 || "" !== tableState.globalFilter;
271
342
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
272
343
  if (storageKey) window.localStorage.setItem(storageKey, JSON.stringify({
273
- columnFilters: tableState.columnFilters,
344
+ columnFilters: mergeInlineSinglePersistedColumnFilters(tableState.columnFilters, inlineSingleSelectExcludedFromTableColumnId, inlineSingleSelectOptionIdResolved),
274
345
  columnVisibility: tableState.columnVisibility,
275
346
  sorting: tableState.sorting
276
347
  }));
277
348
  }, [
349
+ storageKey,
278
350
  tableState.columnFilters,
279
351
  tableState.columnVisibility,
280
352
  tableState.sorting,
281
- storageKey
353
+ inlineSingleSelectExcludedFromTableColumnId,
354
+ inlineSingleSelectOptionIdResolved
282
355
  ]);
283
356
  const validPrimaryBulkActions = bulkActions.filter((bulkAction)=>filteredSelectedRows.rows.some((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true));
284
357
  const validSecondaryBulkActions = secondaryBulkActions.filter((bulkAction)=>filteredSelectedRows.rows.some((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true));
@@ -331,13 +404,13 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
331
404
  const actionsByRowId = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
332
405
  const map = new Map();
333
406
  if (!rowActions) return map;
334
- for (const row of data){
407
+ for (const row of tableData){
335
408
  const resolved = rowActions(row).filter((a)=>null !== a).filter((a)=>!a.predicate || a.predicate(row));
336
409
  map.set(getRowId(row), resolved);
337
410
  }
338
411
  return map;
339
412
  }, [
340
- data,
413
+ tableData,
341
414
  rowActions,
342
415
  getRowId
343
416
  ]);
@@ -363,6 +436,30 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
363
436
  })), [
364
437
  entriesWithFilter
365
438
  ]);
439
+ const showFiltersModalButton = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>entriesWithFilter.length > 1 || 1 === entriesWithFilter.length && true === entriesWithFilter[0].filter.isMulti, [
440
+ entriesWithFilter
441
+ ]);
442
+ const inlineSingleSelectFilter = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
443
+ if (void 0 === inlineSingleSelectExcludedFromTableColumnId) return;
444
+ const entry = entriesWithFilter[0];
445
+ const filter = entry.filter;
446
+ const value = void 0 !== inlineSingleSelectOptionIdResolved ? inlineSingleSelectOptionIdResolved : filter.options[0].id;
447
+ return {
448
+ label: filter.label,
449
+ options: filter.options.map((o)=>({
450
+ id: o.id,
451
+ label: o.label
452
+ })),
453
+ value,
454
+ onChange: (optionId)=>{
455
+ setInlineSingleSelectChoice(optionId);
456
+ }
457
+ };
458
+ }, [
459
+ entriesWithFilter,
460
+ inlineSingleSelectExcludedFromTableColumnId,
461
+ inlineSingleSelectOptionIdResolved
462
+ ]);
366
463
  const showBulkBar = validPrimaryBulkActions.length > 0 || validSecondaryBulkActions.length > 0;
367
464
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
368
465
  children: [
@@ -402,8 +499,9 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
402
499
  setSearchTerm(value);
403
500
  throttledSetGlobalFilter(value);
404
501
  },
405
- hasFilters: entriesWithFilter.length > 0,
502
+ hasFilters: showFiltersModalButton,
406
503
  activeFilterCount: activeFilterCount,
504
+ inlineSingleSelectFilter: inlineSingleSelectFilter,
407
505
  onOpenFilterModal: ()=>setIsFilterModalOpen(true),
408
506
  showDisplay: showDisplayButton,
409
507
  onOpenDisplayModal: ()=>setIsDisplayModalOpen(true),
@@ -436,7 +534,7 @@ const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], co
436
534
  }),
437
535
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_2f50b64a__["default"], {
438
536
  onClick: ()=>{
439
- table.setColumnFilters(columnFiltersInitialState);
537
+ table.setColumnFilters(modalColumnFiltersBaseline);
440
538
  table.resetGlobalFilter();
441
539
  setSearchTerm("");
442
540
  },
@@ -21,4 +21,6 @@ export declare const Tables: Story;
21
21
  export declare const Positions: Story;
22
22
  /** Mobile-friendly list of people with actions. */
23
23
  export declare const EmployeePeople: Story;
24
+ /** Performance-style review rows: search, inline status filter, type badges, due dates. */
25
+ export declare const Reviews: Story;
24
26
  export declare const EmptyList: Story;
@@ -13,6 +13,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__stories_PaperworkApprovals_js_59df2dae__
13
13
  import * as __WEBPACK_EXTERNAL_MODULE__stories_PeopleList_js_08c544af__ from "./stories/PeopleList.js";
14
14
  import * as __WEBPACK_EXTERNAL_MODULE__stories_PeopleTags_js_7b425bf0__ from "./stories/PeopleTags.js";
15
15
  import * as __WEBPACK_EXTERNAL_MODULE__stories_Positions_js_26e8c2fc__ from "./stories/Positions.js";
16
+ import * as __WEBPACK_EXTERNAL_MODULE__stories_Reviews_js_1264af6d__ from "./stories/Reviews.js";
16
17
  import * as __WEBPACK_EXTERNAL_MODULE__stories_SavedQuestions_js_d58c31d5__ from "./stories/SavedQuestions.js";
17
18
  import * as __WEBPACK_EXTERNAL_MODULE__stories_Tables_js_73ee4da7__ from "./stories/Tables.js";
18
19
  import * as __WEBPACK_EXTERNAL_MODULE__stories_Tasks_js_9f5cc0bc__ from "./stories/Tasks.js";
@@ -309,6 +310,19 @@ const EmployeePeople = {
309
310
  rowHeight: args.rowHeight
310
311
  })
311
312
  };
313
+ const Reviews = {
314
+ args: {
315
+ rowHeight: "large",
316
+ enableSorting: false,
317
+ compactBreakpoint: 450
318
+ },
319
+ render: (args)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__stories_Reviews_js_1264af6d__["default"], {
320
+ compactBreakpoint: args.compactBreakpoint,
321
+ contentAlignment: args.contentAlignment,
322
+ enableSorting: args.enableSorting,
323
+ rowHeight: args.rowHeight
324
+ })
325
+ };
312
326
  const EmptyList = {
313
327
  render: (args)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__RichList_js_174fa6e8__["default"], {
314
328
  data: [],
@@ -331,4 +345,4 @@ const EmptyList = {
331
345
  }
332
346
  })
333
347
  };
334
- export { ComplianceGroups, CustomFields, EmployeeCompliance, EmployeePaperwork, EmployeePeople, EmptyList, Leave, Paperwork, PaperworkApprovals, PeopleDirectory, PeopleTags, Positions, SavedQuestions, Tables, Tasks, RichList_stories_rslib_entry_ as default };
348
+ export { ComplianceGroups, CustomFields, EmployeeCompliance, EmployeePaperwork, EmployeePeople, EmptyList, Leave, Paperwork, PaperworkApprovals, PeopleDirectory, PeopleTags, Positions, Reviews, SavedQuestions, Tables, Tasks, RichList_stories_rslib_entry_ as default };
@@ -1,3 +1,16 @@
1
+ type ToolbarInlineSingleSelectFilter = {
2
+ /**
3
+ * Optional accessible name for the menu trigger. Never rendered as visible toolbar text
4
+ * (single-select inline filter is intentionally label-less to save space).
5
+ */
6
+ label: string;
7
+ options: Array<{
8
+ id: string;
9
+ label: string;
10
+ }>;
11
+ value: string;
12
+ onChange: (optionId: string) => void;
13
+ };
1
14
  type Props = {
2
15
  hasGlobalSearch: boolean;
3
16
  searchTerm: string;
@@ -5,6 +18,8 @@ type Props = {
5
18
  hasFilters: boolean;
6
19
  activeFilterCount: number;
7
20
  onOpenFilterModal: () => void;
21
+ /** When set, renders an inline single-select `MenuButton` (no visible filter label; optional `aria-label` from `filter.label`). */
22
+ inlineSingleSelectFilter?: ToolbarInlineSingleSelectFilter;
8
23
  showDisplay: boolean;
9
24
  onOpenDisplayModal: () => void;
10
25
  displayActiveCount: number;
@@ -17,5 +32,5 @@ type Props = {
17
32
  selectAllDisabled: boolean;
18
33
  onSelectAllChange: () => void;
19
34
  };
20
- declare const RichListToolbar: ({ hasGlobalSearch, searchTerm, onSearchTermChange, hasFilters, activeFilterCount, onOpenFilterModal, showDisplay, onOpenDisplayModal, displayActiveCount, showCsvExport, onDownloadCsv, showSelectAll, selectAllAllSelected, selectAllSomeSelected, selectAllDisabled, onSelectAllChange, }: Props) => import("react/jsx-runtime").JSX.Element;
35
+ declare const RichListToolbar: ({ hasGlobalSearch, searchTerm, onSearchTermChange, hasFilters, activeFilterCount, onOpenFilterModal, inlineSingleSelectFilter, showDisplay, onOpenDisplayModal, displayActiveCount, showCsvExport, onDownloadCsv, showSelectAll, selectAllAllSelected, selectAllSomeSelected, selectAllDisabled, onSelectAllChange, }: Props) => import("react/jsx-runtime").JSX.Element;
21
36
  export default RichListToolbar;
@@ -1,12 +1,30 @@
1
1
  "use client";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_clsx__ from "clsx";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
5
  import * as __WEBPACK_EXTERNAL_MODULE__controls_Button_js_2f50b64a__ from "../../controls/Button.js";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__controls_MenuButton_js_fa7c5c89__ from "../../controls/MenuButton.js";
5
7
  import * as __WEBPACK_EXTERNAL_MODULE__inputs_CheckboxInput_js_0c849015__ from "../../inputs/CheckboxInput.js";
6
8
  import * as __WEBPACK_EXTERNAL_MODULE__Icon_js_e5f9af80__ from "../Icon.js";
7
9
  import * as __WEBPACK_EXTERNAL_MODULE__RichListToolbar_module_js_e529a068__ from "./RichListToolbar.module.js";
8
- const RichListToolbar = ({ hasGlobalSearch, searchTerm, onSearchTermChange, hasFilters, activeFilterCount, onOpenFilterModal, showDisplay, onOpenDisplayModal, displayActiveCount, showCsvExport, onDownloadCsv, showSelectAll, selectAllAllSelected, selectAllSomeSelected, selectAllDisabled, onSelectAllChange })=>{
10
+ const RichListToolbar = ({ hasGlobalSearch, searchTerm, onSearchTermChange, hasFilters, activeFilterCount, onOpenFilterModal, inlineSingleSelectFilter, showDisplay, onOpenDisplayModal, displayActiveCount, showCsvExport, onDownloadCsv, showSelectAll, selectAllAllSelected, selectAllSomeSelected, selectAllDisabled, onSelectAllChange })=>{
9
11
  const selectAllRevealed = selectAllAllSelected || selectAllSomeSelected;
12
+ const inlineFilterMenuOptions = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
13
+ if (!inlineSingleSelectFilter) return [];
14
+ const { onChange, options } = inlineSingleSelectFilter;
15
+ return options.map((option)=>({
16
+ id: option.id,
17
+ label: option.label,
18
+ type: "onClick",
19
+ onClick: ()=>{
20
+ onChange(option.id);
21
+ }
22
+ }));
23
+ }, [
24
+ inlineSingleSelectFilter
25
+ ]);
26
+ const inlineFilterMenuLabel = inlineSingleSelectFilter?.options.find((option)=>option.id === inlineSingleSelectFilter.value)?.label ?? inlineSingleSelectFilter?.options[0]?.label;
27
+ const inlineFilterAriaLabel = inlineSingleSelectFilter && "" !== inlineSingleSelectFilter.label.trim() ? inlineSingleSelectFilter.label.trim() : void 0;
10
28
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
11
29
  className: __WEBPACK_EXTERNAL_MODULE__RichListToolbar_module_js_e529a068__["default"].toolbar,
12
30
  children: [
@@ -43,6 +61,18 @@ const RichListToolbar = ({ hasGlobalSearch, searchTerm, onSearchTermChange, hasF
43
61
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
44
62
  className: __WEBPACK_EXTERNAL_MODULE__RichListToolbar_module_js_e529a068__["default"].toolbarActions,
45
63
  children: [
64
+ inlineSingleSelectFilter ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_MenuButton_js_fa7c5c89__["default"], {
65
+ ariaLabel: inlineFilterAriaLabel,
66
+ iconRight: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Icon_js_e5f9af80__["default"], {
67
+ size: "small",
68
+ symbol: "ChevronDown"
69
+ }),
70
+ id: "richListToolbarInlineFilter",
71
+ options: inlineFilterMenuOptions,
72
+ size: "small",
73
+ type: "ghost",
74
+ children: inlineFilterMenuLabel
75
+ }) : null,
46
76
  hasFilters ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
47
77
  className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__RichListToolbar_module_js_e529a068__["default"].toolbarFilterButtonWrap, activeFilterCount > 0 && __WEBPACK_EXTERNAL_MODULE__RichListToolbar_module_js_e529a068__["default"].toolbarFilterButtonActive),
48
78
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_2f50b64a__["default"], {
@@ -0,0 +1,19 @@
1
+ import { type CommonProps } from "./shared";
2
+ export type ReviewsRow = {
3
+ id: string;
4
+ cycleName: string;
5
+ reviewBadging: "self" | "peer";
6
+ reviewStatus: "assigned" | "submitted" | "incomplete";
7
+ dueDate: string;
8
+ submittedAt: string | null;
9
+ personName: string;
10
+ personHue: string;
11
+ personImageUrl: string;
12
+ };
13
+ /**
14
+ * Demonstrates toolbar search plus a single single-select filter as an inline menu
15
+ * (see `RichList` / `MenuButton`), with performance-style rows: avatar, cycle title, type badge,
16
+ * due / submitted copy on the trailing edge.
17
+ */
18
+ declare const ReviewsList: ({ compactBreakpoint, contentAlignment, enableSorting, rowHeight, }: CommonProps) => import("react/jsx-runtime").JSX.Element;
19
+ export default ReviewsList;
@@ -0,0 +1,215 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__PersonAvatar_js_0117b3ba__ from "../../PersonAvatar.js";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__PlainText_js_acfb96d1__ from "../../PlainText.js";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__RichList_js_64f3f04c__ from "../RichList.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__ from "./shared.js";
6
+ const formatListDate = (isoDate)=>{
7
+ const d = new Date(`${isoDate}T12:00:00`);
8
+ return new Intl.DateTimeFormat("en-GB", {
9
+ day: "numeric",
10
+ month: "short",
11
+ year: "numeric"
12
+ }).format(d);
13
+ };
14
+ const reviewRows = [
15
+ {
16
+ id: "pr-1",
17
+ cycleName: "2026 Q1 Check-ins",
18
+ reviewBadging: "self",
19
+ reviewStatus: "assigned",
20
+ dueDate: "2026-03-01",
21
+ submittedAt: null,
22
+ personName: "Alex Chen",
23
+ personHue: "220",
24
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(11)
25
+ },
26
+ {
27
+ id: "pr-2",
28
+ cycleName: "2026 Q1 Check-ins",
29
+ reviewBadging: "peer",
30
+ reviewStatus: "assigned",
31
+ dueDate: "2026-03-08",
32
+ submittedAt: null,
33
+ personName: "Jordan Lee",
34
+ personHue: "280",
35
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(22)
36
+ },
37
+ {
38
+ id: "pr-3",
39
+ cycleName: "2026 Mid-year Review",
40
+ reviewBadging: "self",
41
+ reviewStatus: "assigned",
42
+ dueDate: "2026-06-30",
43
+ submittedAt: null,
44
+ personName: "Sam Rivera",
45
+ personHue: "40",
46
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(33)
47
+ },
48
+ {
49
+ id: "pr-4",
50
+ cycleName: "2026 Q1 Check-ins",
51
+ reviewBadging: "self",
52
+ reviewStatus: "submitted",
53
+ dueDate: "2026-03-15",
54
+ submittedAt: "2026-03-10T09:00:00.000Z",
55
+ personName: "Riley Nguyen",
56
+ personHue: "160",
57
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(11)
58
+ },
59
+ {
60
+ id: "pr-5",
61
+ cycleName: "2026 Q1 Check-ins",
62
+ reviewBadging: "peer",
63
+ reviewStatus: "submitted",
64
+ dueDate: "2026-03-20",
65
+ submittedAt: "2026-03-18T14:30:00.000Z",
66
+ personName: "Morgan Blake",
67
+ personHue: "300",
68
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(22)
69
+ },
70
+ {
71
+ id: "pr-6",
72
+ cycleName: "2026 Mid-year Review",
73
+ reviewBadging: "peer",
74
+ reviewStatus: "submitted",
75
+ dueDate: "2026-07-05",
76
+ submittedAt: "2026-06-28T11:15:00.000Z",
77
+ personName: "Casey Park",
78
+ personHue: "100",
79
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(33)
80
+ },
81
+ {
82
+ id: "pr-7",
83
+ cycleName: "2026 End of year",
84
+ reviewBadging: "self",
85
+ reviewStatus: "submitted",
86
+ dueDate: "2026-11-30",
87
+ submittedAt: "2026-11-24T16:45:00.000Z",
88
+ personName: "Taylor Brooks",
89
+ personHue: "20",
90
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(11)
91
+ },
92
+ {
93
+ id: "pr-8",
94
+ cycleName: "2026 End of year",
95
+ reviewBadging: "peer",
96
+ reviewStatus: "submitted",
97
+ dueDate: "2026-11-30",
98
+ submittedAt: "2026-11-29T08:20:00.000Z",
99
+ personName: "Jamie Patel",
100
+ personHue: "200",
101
+ personImageUrl: (0, __WEBPACK_EXTERNAL_MODULE__shared_js_cc7b7cda__.avatarUrl)(22)
102
+ }
103
+ ];
104
+ const renderDueLine = (row)=>{
105
+ switch(row.reviewStatus){
106
+ case "assigned":
107
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_acfb96d1__["default"], {
108
+ font: "small",
109
+ tone: "muted",
110
+ children: [
111
+ "Due ",
112
+ formatListDate(row.dueDate)
113
+ ]
114
+ });
115
+ case "submitted":
116
+ if (!row.submittedAt) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_acfb96d1__["default"], {
117
+ font: "small",
118
+ tone: "muted",
119
+ children: "Submitted"
120
+ });
121
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_acfb96d1__["default"], {
122
+ font: "small",
123
+ tone: "muted",
124
+ children: [
125
+ "Submitted ",
126
+ formatListDate(row.submittedAt.slice(0, 10))
127
+ ]
128
+ });
129
+ case "incomplete":
130
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_acfb96d1__["default"], {
131
+ font: "small",
132
+ tone: "muted",
133
+ children: [
134
+ "Was due ",
135
+ formatListDate(row.dueDate)
136
+ ]
137
+ });
138
+ }
139
+ };
140
+ const avatarSlot = {
141
+ id: "reviewee",
142
+ render: (r)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__PersonAvatar_js_0117b3ba__["default"], {
143
+ hue: r.personHue,
144
+ id: r.id,
145
+ imageUrl: r.personImageUrl,
146
+ name: r.personName,
147
+ size: "small"
148
+ }),
149
+ size: 48
150
+ };
151
+ const primaryField = {
152
+ label: "Review",
153
+ value: (r)=>`${r.cycleName} ${r.personName}`,
154
+ globalFiltering: true,
155
+ render: (r)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_acfb96d1__["default"], {
156
+ font: "regular-bold",
157
+ children: r.cycleName
158
+ })
159
+ };
160
+ const secondaryTypeField = {
161
+ render: (r)=>renderDueLine(r)
162
+ };
163
+ const statusFilterSlot = {
164
+ id: "reviewStatus",
165
+ label: "",
166
+ hiddenByDefault: true,
167
+ value: (r)=>r.reviewStatus,
168
+ globalFiltering: false,
169
+ render: (r)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_acfb96d1__["default"], {
170
+ font: "small",
171
+ tone: "muted",
172
+ children: r.reviewStatus
173
+ }),
174
+ filter: {
175
+ label: "Status",
176
+ options: [
177
+ {
178
+ id: "assigned",
179
+ label: "Assigned",
180
+ predicate: (r)=>"assigned" === r.reviewStatus
181
+ },
182
+ {
183
+ id: "submitted",
184
+ label: "Submitted",
185
+ predicate: (r)=>"submitted" === r.reviewStatus
186
+ },
187
+ {
188
+ id: "incomplete",
189
+ label: "Incomplete",
190
+ predicate: (r)=>"incomplete" === r.reviewStatus
191
+ }
192
+ ]
193
+ }
194
+ };
195
+ const ReviewsList = ({ compactBreakpoint, contentAlignment, enableSorting, rowHeight })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__RichList_js_64f3f04c__["default"], {
196
+ data: reviewRows,
197
+ getRowId: (r)=>r.id,
198
+ fillContainerHeight: true,
199
+ compactBreakpoint: compactBreakpoint,
200
+ contentAlignment: contentAlignment,
201
+ enableSorting: enableSorting,
202
+ rowHeight: rowHeight,
203
+ leadingSlot: avatarSlot,
204
+ mainSlot: {
205
+ size: 380,
206
+ primary: primaryField,
207
+ secondary: secondaryTypeField
208
+ },
209
+ contentSlots: [
210
+ statusFilterSlot
211
+ ],
212
+ href: (r)=>`#review-${r.id}`
213
+ });
214
+ const Reviews_rslib_entry_ = ReviewsList;
215
+ export { Reviews_rslib_entry_ as default };
@@ -71,7 +71,10 @@ export type RichListTextField<Type> = ((row: Type) => ReactNode) | {
71
71
  */
72
72
  label?: string;
73
73
  /**
74
- * If set, this line can appear in the Filters dialog like a table column.
74
+ * If set, this can appear in the Filters dialog.
75
+ * When it is the only filter and a single-select, the toolbar renders an inline
76
+ * `MenuButton` **without** a visible label (`filter.label` is still used in the Filters
77
+ * modal when open, and as `aria-label` on that menu trigger when non-empty).
75
78
  */
76
79
  filter?: Filter<Type>;
77
80
  /**
@@ -147,7 +150,9 @@ type RichListBaseSlotObject<Type> = {
147
150
  */
148
151
  compactSize?: RichListSlotSize;
149
152
  /**
150
- * Column filter for the Filters dialog; needs a clear `label` in the UI.
153
+ * Column filter for the Filters dialog; use a clear `filter.label` where the modal applies.
154
+ * When this is the list’s only single-select filter, the toolbar renders a label-less
155
+ * inline `MenuButton` (same `filter.label` feeds `aria-label` when non-empty).
151
156
  */
152
157
  filter?: Filter<Type>;
153
158
  /**