@kenlo/kdls-design-system 2.7.0 → 2.9.1

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -12,6 +12,11 @@ export interface HeaderNavItem {
12
12
  href?: string;
13
13
  onClick?: () => void;
14
14
  }[];
15
+ /** Adds a search field to this item's dropdown and filters its children by it.
16
+ * Use when the list is long enough that scanning it beats reading it. */
17
+ searchable?: boolean;
18
+ /** Floating label of that search field. Default: 'Buscar' */
19
+ searchLabel?: string;
15
20
  onClick?: () => void;
16
21
  }
17
22
  export interface HeaderNotification {
@@ -36,6 +41,16 @@ export interface HeaderProfileMenuItem {
36
41
  export interface HeaderProps {
37
42
  /** Kenlo product that determines the logo */
38
43
  product?: KenloLogoProduct;
44
+ /** Where the logo links to — normally the product's home. Always the consumer's to
45
+ * set: the DS is used by Kenlo products, by the CMS and by products carrying their
46
+ * own brand (Vira), and each one's home is somewhere else. */
47
+ logoHref?: string;
48
+ /** Called when the logo is clicked — use instead of logoHref with a client-side
49
+ * router, or alongside it to intercept the navigation. */
50
+ onLogoClick?: () => void;
51
+ /** Accessible name of the logo link, read out in place of the image. Default:
52
+ * 'Página inicial' */
53
+ logoLabel?: string;
39
54
  /** Main navigation items */
40
55
  navItems?: HeaderNavItem[];
41
56
  /** Active items (by label) */
@@ -62,7 +62,9 @@ interface SelectBase {
62
62
  menuClassName?: string;
63
63
  /** Additional CSS classes applied to the wrapper */
64
64
  className?: string;
65
- /** Maximum menu height in pixels (plain number, no unit) — default 360 */
65
+ /** Overrides the menu's max height in pixels (plain number, no unit). Omit to use
66
+ * the design system's own cap of 7.5 option rows, which is what every menu, select
67
+ * and dropdown uses — see tokens-reference.md § Menu sizing. */
66
68
  menuMaxHeight?: number;
67
69
  }
68
70
  /**
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import './Table.css';
3
3
  import '../../foundations/Scrollbar/Scrollbar.css';
4
4
  import { type PaginationProps } from '../Pagination';
5
+ import { TableColumnPicker } from './TableColumnPicker';
5
6
  export interface TableColumn<T = Record<string, unknown>> {
6
7
  /** Unique key — matches the row object's property and identifies the column */
7
8
  key: string;
@@ -61,6 +62,13 @@ export interface TableProps<T extends Record<string, unknown> = Record<string, u
61
62
  selectedIds?: string[];
62
63
  /** Fired when checking or unchecking rows */
63
64
  onSelectionChange?: (ids: string[]) => void;
65
+ /**
66
+ * How sortable headers show the sort mark. `'always'` draws the up/down pair on every
67
+ * sortable header, the active direction in primary. `'hover'` keeps unsorted headers clean —
68
+ * their pair shows only on hover and focus, in the same space — and gives the sorted header a
69
+ * single filled chevron in primary. No effect in the mobile layout, where sorting is a picker.
70
+ */
71
+ sortIndicator?: 'always' | 'hover';
64
72
  /** Controlled sorting — { key, direction } or null (no sorting) */
65
73
  sort?: TableSort | null;
66
74
  /** Initial sorting — uncontrolled mode */
@@ -73,6 +81,8 @@ export interface TableProps<T extends Record<string, unknown> = Record<string, u
73
81
  onRowClick?: (row: T) => void;
74
82
  /** Pagination config — passed straight through to the Pagination component, rendered below the list */
75
83
  pagination?: Omit<PaginationProps, 'className'>;
84
+ /** Keeps the current rows on screen, dimmed, while new ones load (e.g. a new sort order from the backend) — marks the table aria-busy */
85
+ loading?: boolean;
76
86
  className?: string;
77
87
  }
78
88
  export interface TableHeaderProps {
@@ -98,5 +108,6 @@ export declare const TableCell: React.FC<TableCellProps>;
98
108
  export interface TableComponent {
99
109
  <T extends Record<string, unknown>>(props: TableProps<T>): React.ReactElement;
100
110
  Header: typeof TableHeader;
111
+ ColumnPicker: typeof TableColumnPicker;
101
112
  }
102
113
  export declare const Table: TableComponent;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import './Table.css';
3
+ import '../../foundations/Scrollbar/Scrollbar.css';
4
+ export interface TableColumnPickerOption {
5
+ /** Column key — the same `key` the column has in the Table's `columns` */
6
+ key: string;
7
+ /** Text next to the checkbox */
8
+ label: string;
9
+ /** Helper text under the label — e.g. why the column can't be chosen */
10
+ hint?: string;
11
+ /** Keeps the column listed but not selectable — say why in `hint` */
12
+ disabled?: boolean;
13
+ }
14
+ export interface TableColumnPickerGroup {
15
+ /** Group heading — omit it for a plain list */
16
+ title?: string;
17
+ /** The group's columns, in display order */
18
+ columns: TableColumnPickerOption[];
19
+ }
20
+ export interface TableColumnPickerProps {
21
+ /** Trigger text and panel title */
22
+ label?: string;
23
+ /** Choosable columns, in groups */
24
+ groups: TableColumnPickerGroup[];
25
+ /** Keys of the visible columns — controlled */
26
+ value: string[];
27
+ /** Fired on every check and uncheck with the new keys, in the groups' order — keys that no group lists stay at the end */
28
+ onChange: (value: string[]) => void;
29
+ /** Shows a "Restaurar padrão" link at the bottom and fires when it's clicked */
30
+ onReset?: () => void;
31
+ /** Additional CSS classes applied to the trigger */
32
+ className?: string;
33
+ }
34
+ export declare const TableColumnPicker: React.FC<TableColumnPickerProps>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
1
  export * from './Table';
2
+ export * from './TableColumnPicker';
Binary file
Binary file