karsten-design-system 2.0.23 → 2.0.26

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 (40) hide show
  1. package/README.md +230 -207
  2. package/dist/components/field-clear-button.d.ts +9 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +605 -168
  5. package/dist/index.js.map +1 -1
  6. package/dist/stories/components/breadcrumb.d.ts +2 -1
  7. package/dist/stories/components/checkbox.d.ts +10 -5
  8. package/dist/stories/components/dropDown.d.ts +2 -1
  9. package/dist/stories/components/header.d.ts +8 -1
  10. package/dist/stories/components/internalMenu.d.ts +2 -1
  11. package/dist/stories/components/multiselect.d.ts +3 -0
  12. package/dist/stories/components/select.d.ts +2 -0
  13. package/dist/stories/components/storybookThemeToggle.d.ts +1 -0
  14. package/dist/stories/components/table.d.ts +53 -2
  15. package/dist/stories/components/tooltip.d.ts +3 -1
  16. package/dist/stories/components/useDropdownPosition.d.ts +24 -0
  17. package/dist/tokens/theme.d.ts +6 -0
  18. package/dist/types/components/field-clear-button.d.ts +9 -0
  19. package/dist/types/index.d.ts +2 -0
  20. package/dist/types/internalMenu.d.ts +3 -0
  21. package/dist/types/stories/components/breadcrumb.d.ts +2 -1
  22. package/dist/types/stories/components/checkbox.d.ts +10 -5
  23. package/dist/types/stories/components/dropDown.d.ts +2 -1
  24. package/dist/types/stories/components/header.d.ts +8 -1
  25. package/dist/types/stories/components/internalMenu.d.ts +2 -1
  26. package/dist/types/stories/components/multiselect.d.ts +3 -0
  27. package/dist/types/stories/components/select.d.ts +2 -0
  28. package/dist/types/stories/components/storybookThemeToggle.d.ts +1 -0
  29. package/dist/types/stories/components/table.d.ts +53 -2
  30. package/dist/types/stories/components/tooltip.d.ts +3 -1
  31. package/dist/types/stories/components/useDropdownPosition.d.ts +24 -0
  32. package/dist/types/table.d.ts +2 -0
  33. package/dist/types/tokens/theme.d.ts +6 -0
  34. package/dist/types/types/internalMenu.d.ts +3 -0
  35. package/dist/types/types/table.d.ts +2 -0
  36. package/dist/types/utils/multiSelectSelection.d.ts +4 -0
  37. package/dist/types/utils/tableSelection.d.ts +11 -0
  38. package/dist/utils/multiSelectSelection.d.ts +4 -0
  39. package/dist/utils/tableSelection.d.ts +11 -0
  40. package/package.json +88 -87
@@ -1,5 +1,6 @@
1
1
  import { BreadcrumpItems } from '../../types';
2
2
  export type BreadcrumbProps = {
3
3
  items: BreadcrumpItems[];
4
+ size?: 'xs' | 'sm' | 'base';
4
5
  };
5
- export declare function Breadcrumb({ items }: BreadcrumbProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Breadcrumb({ items, size }: BreadcrumbProps): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,21 @@
1
- declare const variants: {
2
- white: string;
3
- secondary: string;
1
+ declare const boxSizeClasses: {
2
+ sm: string;
3
+ md: string;
4
+ mdRow: string;
4
5
  };
5
6
  export type CheckboxProps = {
6
- variant?: keyof typeof variants;
7
+ /** Mantido por compatibilidade; o visual usa border fixo. */
8
+ variant?: 'white' | 'secondary';
9
+ size?: keyof typeof boxSizeClasses;
7
10
  label?: string;
8
11
  value?: string;
9
12
  checked: boolean;
10
13
  onChange: (checked: boolean) => void;
11
14
  disabled?: boolean;
12
15
  error?: boolean;
16
+ indeterminate?: boolean;
13
17
  ariaLabel?: string;
18
+ className?: string;
14
19
  };
15
- export declare function Checkbox({ label, value, checked, onChange, disabled, error, variant, ariaLabel, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function Checkbox({ label, value, checked, onChange, disabled, error, indeterminate, size, variant, ariaLabel, className, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
16
21
  export {};
@@ -6,5 +6,6 @@ export type Option = {
6
6
  export type CustomDropdownProps = {
7
7
  width?: string;
8
8
  options: Option[];
9
+ showClear?: boolean;
9
10
  } & Omit<PrimeDropdownProps, 'options'>;
10
- export declare const Dropdown: ({ options, ...props }: CustomDropdownProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Dropdown: ({ options, showClear, clearIcon, ...props }: CustomDropdownProps) => import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,12 @@ export type MenubarProps = {
13
13
  helloTranslation?: string;
14
14
  favoritesTranslation?: string;
15
15
  homeTranslation?: string;
16
+ title?: string;
17
+ titleIcon?: React.ReactNode;
18
+ titleActions?: React.ReactNode;
19
+ titleBreadcrumb?: React.ReactNode;
20
+ hideFavoritesSidebar?: boolean;
21
+ onMenuToggle?: () => void;
22
+ menuOpen?: boolean;
16
23
  };
17
- export declare function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setOpenNotifications, isRenderNotifications, rightActions, rightActionsLogo, redirect, helloTranslation, favoritesTranslation, homeTranslation, }: MenubarProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setOpenNotifications, isRenderNotifications, rightActions, rightActionsLogo, redirect, helloTranslation, favoritesTranslation, homeTranslation, title, titleIcon, titleActions, titleBreadcrumb, hideFavoritesSidebar, onMenuToggle, menuOpen, }: MenubarProps): import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,6 @@ import { InternalMenuItems } from '../../types/internalMenu';
2
2
  export type InternalMenuProp = {
3
3
  item: InternalMenuItems[];
4
4
  isFiltering: boolean;
5
+ className?: string;
5
6
  };
6
- export declare function InternalMenu({ item, isFiltering }: InternalMenuProp): import("react/jsx-runtime").JSX.Element;
7
+ export declare function InternalMenu({ item, isFiltering, className }: InternalMenuProp): import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,8 @@ export type MultiSelectProps = {
13
13
  onInputChange?: (input: string) => void;
14
14
  isLoadingOptions?: boolean;
15
15
  systemLanguage?: 'pt' | 'en' | 'es';
16
+ showClear?: boolean;
17
+ onClear?: () => void;
18
+ showSelectAll?: boolean;
16
19
  };
17
20
  export declare function MultiSelect(props: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,7 @@ export type SingleSelectProps = {
13
13
  onInputChange?: (input: string) => void;
14
14
  isLoadingOptions?: boolean;
15
15
  systemLanguage?: 'pt' | 'en' | 'es';
16
+ showClear?: boolean;
17
+ onClear?: () => void;
16
18
  };
17
19
  export declare function Select(props: SingleSelectProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function StorybookThemeToggle(): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { SortDirection } from '../../types';
2
+ import type { HeaderIconsLayout, RowKey } from '../../types/table';
2
3
  export type FilterType = 'text' | 'select' | 'multiSelect' | 'singleDate' | 'rangeDate';
3
4
  export type Column<T> = {
4
5
  label: string;
@@ -45,7 +46,7 @@ export type SubTableAction<S> = {
45
46
  ariaLabel?: string;
46
47
  render?: boolean | ((item: S) => boolean);
47
48
  };
48
- export type TableProps<T, S> = {
49
+ export type TableCoreProps<T, S> = {
49
50
  columns: Column<T>[];
50
51
  data: T[];
51
52
  totalRecords?: number;
@@ -73,5 +74,55 @@ export type TableProps<T, S> = {
73
74
  subTableActionLabel?: string;
74
75
  subTableActionsHeaderClassName?: string;
75
76
  subTableActionsColumnsClassName?: string;
77
+ /**
78
+ * Identificador das linhas da sub-tabela.
79
+ * Obrigatório quando `subTableSelectable` é true (com `isExpandable`).
80
+ */
81
+ subRowKey?: keyof S | ((row: S) => RowKey);
82
+ /**
83
+ * Checkbox na grid filho (sub-tabela expansível).
84
+ * Independente de `selectable`. Requer `rowKey`, `subRowKey` e `isExpandable`.
85
+ */
86
+ subTableSelectable?: boolean;
87
+ /** Desabilita checkbox de linhas específicas na grid pai (`selectable`). */
88
+ isRowSelectable?: (row: T) => boolean;
89
+ /** Desabilita checkbox de linhas específicas na sub-grid (`subTableSelectable`). */
90
+ isSubRowSelectable?: (row: S) => boolean;
91
+ /** Destaque da linha no hover. Padrão: ativo. Use `false` para desligar. */
92
+ highlightOnHover?: boolean;
93
+ onRowClick?: (row: T, event: React.MouseEvent) => void;
94
+ headerIconsLayout?: HeaderIconsLayout;
95
+ headerCellClassName?: string;
96
+ showGridlines?: boolean;
76
97
  };
77
- export declare function Table<T extends Record<string, any>, S extends Record<string, any>>({ columns, data, totalRecords, actions, actionsHeaderClassName, actionsColumnsClassName, rowsPerPage, onPageChange, onRowsPerPageChange, isPaginated, isLoading, onFilterChange, onSortChange, actionLabel, systemLanguage, isShowCustomizeColumns, onApplyColumns, isPermanentFilterEnabled, localStorageKey, isExpandable, canExpand, subTableColumns, subTableDataKey, subTableActions, subTableActionLabel, subTableActionsHeaderClassName, subTableActionsColumnsClassName, }: TableProps<T, S>): import("react/jsx-runtime").JSX.Element;
98
+ type TableWithSelectionProps<T, S> = {
99
+ /** Checkbox na grid pai. Independente de `subTableSelectable`. */
100
+ selectable: true;
101
+ rowKey: keyof T | ((row: T) => RowKey);
102
+ subTableSelectable?: boolean;
103
+ subRowKey?: keyof S | ((row: S) => RowKey);
104
+ selectedKeys?: RowKey[];
105
+ defaultSelectedKeys?: RowKey[];
106
+ onSelectionChange?: (keys: RowKey[], rows: T[], subRows?: S[]) => void;
107
+ };
108
+ type TableWithSubSelectionOnlyProps<T, S> = {
109
+ selectable?: false;
110
+ subTableSelectable: true;
111
+ rowKey: keyof T | ((row: T) => RowKey);
112
+ subRowKey: keyof S | ((row: S) => RowKey);
113
+ selectedKeys?: RowKey[];
114
+ defaultSelectedKeys?: RowKey[];
115
+ onSelectionChange?: (keys: RowKey[], rows: T[], subRows?: S[]) => void;
116
+ };
117
+ type TableWithoutSelectionProps = {
118
+ selectable?: false;
119
+ subTableSelectable?: false;
120
+ rowKey?: never;
121
+ subRowKey?: never;
122
+ selectedKeys?: never;
123
+ defaultSelectedKeys?: never;
124
+ onSelectionChange?: never;
125
+ };
126
+ export type TableProps<T, S> = TableCoreProps<T, S> & (TableWithSelectionProps<T, S> | TableWithSubSelectionOnlyProps<T, S> | TableWithoutSelectionProps);
127
+ export type { RowKey, HeaderIconsLayout };
128
+ export declare function Table<T extends Record<string, any>, S extends Record<string, any>>({ columns, data, totalRecords, actions, actionsHeaderClassName, actionsColumnsClassName, rowsPerPage, onPageChange, onRowsPerPageChange, isPaginated, isLoading, onFilterChange, onSortChange, actionLabel, systemLanguage, isShowCustomizeColumns, onApplyColumns, isPermanentFilterEnabled, localStorageKey, isExpandable, canExpand, subTableColumns, subTableDataKey, subTableActions, subTableActionLabel, subTableActionsHeaderClassName, subTableActionsColumnsClassName, selectable, subTableSelectable, rowKey, subRowKey, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, isRowSelectable, isSubRowSelectable, highlightOnHover, onRowClick, headerIconsLayout, headerCellClassName, showGridlines, }: TableProps<T, S>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,8 @@
1
+ export type TooltipPlacement = 'top' | 'right' | 'bottom' | 'left';
1
2
  interface TooltipProps {
2
3
  text: string | null | undefined;
3
4
  children: React.ReactNode;
5
+ placement?: TooltipPlacement;
4
6
  }
5
- export declare function Tooltip({ text, children }: TooltipProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Tooltip({ text, children, placement }: TooltipProps): import("react/jsx-runtime").JSX.Element;
6
8
  export {};
@@ -0,0 +1,24 @@
1
+ export type DropdownPlacement = 'bottom' | 'top';
2
+ export type DropdownPosition = {
3
+ top: number;
4
+ left: number;
5
+ width: number;
6
+ placement: DropdownPlacement;
7
+ /** Altura máxima disponível no lado escolhido (px), com folga de 8px. */
8
+ maxHeight: number;
9
+ };
10
+ /**
11
+ * Calcula a posição (fixed) do menu dropdown com base no elemento trigger.
12
+ * Retorna placement 'top' quando não há espaço suficiente abaixo e há mais
13
+ * espaço acima. Recalcula em resize e scroll de qualquer ancestral.
14
+ */
15
+ export declare function useDropdownPosition(triggerRef: React.RefObject<HTMLElement | null>, isOpen: boolean): DropdownPosition | null;
16
+ /**
17
+ * Renderiza children via portal no document.body com position:fixed,
18
+ * usando as coordenadas calculadas por useDropdownPosition.
19
+ * Se position for null (ainda calculando) não renderiza nada.
20
+ */
21
+ export declare function DropdownPortal({ position, children, }: {
22
+ position: DropdownPosition | null;
23
+ children: React.ReactNode;
24
+ }): import("react").ReactPortal | null;
@@ -0,0 +1,6 @@
1
+ export type Theme = 'light' | 'dark';
2
+ export declare const THEMES: Theme[];
3
+ export declare const THEME_BACKGROUNDS: Record<Theme, string>;
4
+ export declare const THEME_ICONS: Record<Theme, string>;
5
+ export declare function cycleTheme(current: Theme): Theme;
6
+ export declare function applyThemeToDocument(theme: Theme): void;
@@ -0,0 +1,9 @@
1
+ export type FieldClearButtonProps = {
2
+ visible: boolean;
3
+ onClear: () => void;
4
+ disabled?: boolean;
5
+ hasError?: boolean;
6
+ systemLanguage?: 'pt' | 'en' | 'es';
7
+ className?: string;
8
+ };
9
+ export declare function FieldClearButton({ visible, onClear, disabled, hasError, systemLanguage, className, }: FieldClearButtonProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,6 @@
1
+ import './tokens/themes.css';
1
2
  import '../.storybook/index.css';
3
+ export * from './tokens/theme';
2
4
  export * from './stories/components/accordion';
3
5
  export * from './stories/components/basicHeader';
4
6
  export * from './stories/components/breadcrumb';
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  export type InternalMenuItems = {
2
3
  id: string;
3
4
  title: string;
@@ -5,11 +6,13 @@ export type InternalMenuItems = {
5
6
  onClick?: () => void;
6
7
  isActive?: boolean;
7
8
  tooltipText?: string | null | undefined;
9
+ icon?: ReactNode;
8
10
  subItem?: {
9
11
  id: string;
10
12
  title: string;
11
13
  path: string;
12
14
  isActive?: boolean;
13
15
  tooltipText?: string | null | undefined;
16
+ icon?: ReactNode;
14
17
  }[];
15
18
  };
@@ -1,5 +1,6 @@
1
1
  import { BreadcrumpItems } from '../../types';
2
2
  export type BreadcrumbProps = {
3
3
  items: BreadcrumpItems[];
4
+ size?: 'xs' | 'sm' | 'base';
4
5
  };
5
- export declare function Breadcrumb({ items }: BreadcrumbProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Breadcrumb({ items, size }: BreadcrumbProps): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,21 @@
1
- declare const variants: {
2
- white: string;
3
- secondary: string;
1
+ declare const boxSizeClasses: {
2
+ sm: string;
3
+ md: string;
4
+ mdRow: string;
4
5
  };
5
6
  export type CheckboxProps = {
6
- variant?: keyof typeof variants;
7
+ /** Mantido por compatibilidade; o visual usa border fixo. */
8
+ variant?: 'white' | 'secondary';
9
+ size?: keyof typeof boxSizeClasses;
7
10
  label?: string;
8
11
  value?: string;
9
12
  checked: boolean;
10
13
  onChange: (checked: boolean) => void;
11
14
  disabled?: boolean;
12
15
  error?: boolean;
16
+ indeterminate?: boolean;
13
17
  ariaLabel?: string;
18
+ className?: string;
14
19
  };
15
- export declare function Checkbox({ label, value, checked, onChange, disabled, error, variant, ariaLabel, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function Checkbox({ label, value, checked, onChange, disabled, error, indeterminate, size, variant, ariaLabel, className, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
16
21
  export {};
@@ -6,5 +6,6 @@ export type Option = {
6
6
  export type CustomDropdownProps = {
7
7
  width?: string;
8
8
  options: Option[];
9
+ showClear?: boolean;
9
10
  } & Omit<PrimeDropdownProps, 'options'>;
10
- export declare const Dropdown: ({ options, ...props }: CustomDropdownProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Dropdown: ({ options, showClear, clearIcon, ...props }: CustomDropdownProps) => import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,12 @@ export type MenubarProps = {
13
13
  helloTranslation?: string;
14
14
  favoritesTranslation?: string;
15
15
  homeTranslation?: string;
16
+ title?: string;
17
+ titleIcon?: React.ReactNode;
18
+ titleActions?: React.ReactNode;
19
+ titleBreadcrumb?: React.ReactNode;
20
+ hideFavoritesSidebar?: boolean;
21
+ onMenuToggle?: () => void;
22
+ menuOpen?: boolean;
16
23
  };
17
- export declare function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setOpenNotifications, isRenderNotifications, rightActions, rightActionsLogo, redirect, helloTranslation, favoritesTranslation, homeTranslation, }: MenubarProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setOpenNotifications, isRenderNotifications, rightActions, rightActionsLogo, redirect, helloTranslation, favoritesTranslation, homeTranslation, title, titleIcon, titleActions, titleBreadcrumb, hideFavoritesSidebar, onMenuToggle, menuOpen, }: MenubarProps): import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,6 @@ import { InternalMenuItems } from '../../types/internalMenu';
2
2
  export type InternalMenuProp = {
3
3
  item: InternalMenuItems[];
4
4
  isFiltering: boolean;
5
+ className?: string;
5
6
  };
6
- export declare function InternalMenu({ item, isFiltering }: InternalMenuProp): import("react/jsx-runtime").JSX.Element;
7
+ export declare function InternalMenu({ item, isFiltering, className }: InternalMenuProp): import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,8 @@ export type MultiSelectProps = {
13
13
  onInputChange?: (input: string) => void;
14
14
  isLoadingOptions?: boolean;
15
15
  systemLanguage?: 'pt' | 'en' | 'es';
16
+ showClear?: boolean;
17
+ onClear?: () => void;
18
+ showSelectAll?: boolean;
16
19
  };
17
20
  export declare function MultiSelect(props: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,7 @@ export type SingleSelectProps = {
13
13
  onInputChange?: (input: string) => void;
14
14
  isLoadingOptions?: boolean;
15
15
  systemLanguage?: 'pt' | 'en' | 'es';
16
+ showClear?: boolean;
17
+ onClear?: () => void;
16
18
  };
17
19
  export declare function Select(props: SingleSelectProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function StorybookThemeToggle(): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { SortDirection } from '../../types';
2
+ import type { HeaderIconsLayout, RowKey } from '../../types/table';
2
3
  export type FilterType = 'text' | 'select' | 'multiSelect' | 'singleDate' | 'rangeDate';
3
4
  export type Column<T> = {
4
5
  label: string;
@@ -45,7 +46,7 @@ export type SubTableAction<S> = {
45
46
  ariaLabel?: string;
46
47
  render?: boolean | ((item: S) => boolean);
47
48
  };
48
- export type TableProps<T, S> = {
49
+ export type TableCoreProps<T, S> = {
49
50
  columns: Column<T>[];
50
51
  data: T[];
51
52
  totalRecords?: number;
@@ -73,5 +74,55 @@ export type TableProps<T, S> = {
73
74
  subTableActionLabel?: string;
74
75
  subTableActionsHeaderClassName?: string;
75
76
  subTableActionsColumnsClassName?: string;
77
+ /**
78
+ * Identificador das linhas da sub-tabela.
79
+ * Obrigatório quando `subTableSelectable` é true (com `isExpandable`).
80
+ */
81
+ subRowKey?: keyof S | ((row: S) => RowKey);
82
+ /**
83
+ * Checkbox na grid filho (sub-tabela expansível).
84
+ * Independente de `selectable`. Requer `rowKey`, `subRowKey` e `isExpandable`.
85
+ */
86
+ subTableSelectable?: boolean;
87
+ /** Desabilita checkbox de linhas específicas na grid pai (`selectable`). */
88
+ isRowSelectable?: (row: T) => boolean;
89
+ /** Desabilita checkbox de linhas específicas na sub-grid (`subTableSelectable`). */
90
+ isSubRowSelectable?: (row: S) => boolean;
91
+ /** Destaque da linha no hover. Padrão: ativo. Use `false` para desligar. */
92
+ highlightOnHover?: boolean;
93
+ onRowClick?: (row: T, event: React.MouseEvent) => void;
94
+ headerIconsLayout?: HeaderIconsLayout;
95
+ headerCellClassName?: string;
96
+ showGridlines?: boolean;
76
97
  };
77
- export declare function Table<T extends Record<string, any>, S extends Record<string, any>>({ columns, data, totalRecords, actions, actionsHeaderClassName, actionsColumnsClassName, rowsPerPage, onPageChange, onRowsPerPageChange, isPaginated, isLoading, onFilterChange, onSortChange, actionLabel, systemLanguage, isShowCustomizeColumns, onApplyColumns, isPermanentFilterEnabled, localStorageKey, isExpandable, canExpand, subTableColumns, subTableDataKey, subTableActions, subTableActionLabel, subTableActionsHeaderClassName, subTableActionsColumnsClassName, }: TableProps<T, S>): import("react/jsx-runtime").JSX.Element;
98
+ type TableWithSelectionProps<T, S> = {
99
+ /** Checkbox na grid pai. Independente de `subTableSelectable`. */
100
+ selectable: true;
101
+ rowKey: keyof T | ((row: T) => RowKey);
102
+ subTableSelectable?: boolean;
103
+ subRowKey?: keyof S | ((row: S) => RowKey);
104
+ selectedKeys?: RowKey[];
105
+ defaultSelectedKeys?: RowKey[];
106
+ onSelectionChange?: (keys: RowKey[], rows: T[], subRows?: S[]) => void;
107
+ };
108
+ type TableWithSubSelectionOnlyProps<T, S> = {
109
+ selectable?: false;
110
+ subTableSelectable: true;
111
+ rowKey: keyof T | ((row: T) => RowKey);
112
+ subRowKey: keyof S | ((row: S) => RowKey);
113
+ selectedKeys?: RowKey[];
114
+ defaultSelectedKeys?: RowKey[];
115
+ onSelectionChange?: (keys: RowKey[], rows: T[], subRows?: S[]) => void;
116
+ };
117
+ type TableWithoutSelectionProps = {
118
+ selectable?: false;
119
+ subTableSelectable?: false;
120
+ rowKey?: never;
121
+ subRowKey?: never;
122
+ selectedKeys?: never;
123
+ defaultSelectedKeys?: never;
124
+ onSelectionChange?: never;
125
+ };
126
+ export type TableProps<T, S> = TableCoreProps<T, S> & (TableWithSelectionProps<T, S> | TableWithSubSelectionOnlyProps<T, S> | TableWithoutSelectionProps);
127
+ export type { RowKey, HeaderIconsLayout };
128
+ export declare function Table<T extends Record<string, any>, S extends Record<string, any>>({ columns, data, totalRecords, actions, actionsHeaderClassName, actionsColumnsClassName, rowsPerPage, onPageChange, onRowsPerPageChange, isPaginated, isLoading, onFilterChange, onSortChange, actionLabel, systemLanguage, isShowCustomizeColumns, onApplyColumns, isPermanentFilterEnabled, localStorageKey, isExpandable, canExpand, subTableColumns, subTableDataKey, subTableActions, subTableActionLabel, subTableActionsHeaderClassName, subTableActionsColumnsClassName, selectable, subTableSelectable, rowKey, subRowKey, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, isRowSelectable, isSubRowSelectable, highlightOnHover, onRowClick, headerIconsLayout, headerCellClassName, showGridlines, }: TableProps<T, S>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,8 @@
1
+ export type TooltipPlacement = 'top' | 'right' | 'bottom' | 'left';
1
2
  interface TooltipProps {
2
3
  text: string | null | undefined;
3
4
  children: React.ReactNode;
5
+ placement?: TooltipPlacement;
4
6
  }
5
- export declare function Tooltip({ text, children }: TooltipProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Tooltip({ text, children, placement }: TooltipProps): import("react/jsx-runtime").JSX.Element;
6
8
  export {};
@@ -0,0 +1,24 @@
1
+ export type DropdownPlacement = 'bottom' | 'top';
2
+ export type DropdownPosition = {
3
+ top: number;
4
+ left: number;
5
+ width: number;
6
+ placement: DropdownPlacement;
7
+ /** Altura máxima disponível no lado escolhido (px), com folga de 8px. */
8
+ maxHeight: number;
9
+ };
10
+ /**
11
+ * Calcula a posição (fixed) do menu dropdown com base no elemento trigger.
12
+ * Retorna placement 'top' quando não há espaço suficiente abaixo e há mais
13
+ * espaço acima. Recalcula em resize e scroll de qualquer ancestral.
14
+ */
15
+ export declare function useDropdownPosition(triggerRef: React.RefObject<HTMLElement | null>, isOpen: boolean): DropdownPosition | null;
16
+ /**
17
+ * Renderiza children via portal no document.body com position:fixed,
18
+ * usando as coordenadas calculadas por useDropdownPosition.
19
+ * Se position for null (ainda calculando) não renderiza nada.
20
+ */
21
+ export declare function DropdownPortal({ position, children, }: {
22
+ position: DropdownPosition | null;
23
+ children: React.ReactNode;
24
+ }): import("react").ReactPortal | null;
@@ -1,6 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
  export type anyType = string | number | boolean | ReactNode;
3
3
  export type SortDirection = 'ASC' | 'DESC' | null;
4
+ export type RowKey = string | number;
5
+ export type HeaderIconsLayout = 'stacked' | 'inline';
4
6
  export type ColumnStyle = {
5
7
  [key: string]: string | ((value: anyType) => string);
6
8
  };
@@ -0,0 +1,6 @@
1
+ export type Theme = 'light' | 'dark';
2
+ export declare const THEMES: Theme[];
3
+ export declare const THEME_BACKGROUNDS: Record<Theme, string>;
4
+ export declare const THEME_ICONS: Record<Theme, string>;
5
+ export declare function cycleTheme(current: Theme): Theme;
6
+ export declare function applyThemeToDocument(theme: Theme): void;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  export type InternalMenuItems = {
2
3
  id: string;
3
4
  title: string;
@@ -5,11 +6,13 @@ export type InternalMenuItems = {
5
6
  onClick?: () => void;
6
7
  isActive?: boolean;
7
8
  tooltipText?: string | null | undefined;
9
+ icon?: ReactNode;
8
10
  subItem?: {
9
11
  id: string;
10
12
  title: string;
11
13
  path: string;
12
14
  isActive?: boolean;
13
15
  tooltipText?: string | null | undefined;
16
+ icon?: ReactNode;
14
17
  }[];
15
18
  };
@@ -1,6 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
  export type anyType = string | number | boolean | ReactNode;
3
3
  export type SortDirection = 'ASC' | 'DESC' | null;
4
+ export type RowKey = string | number;
5
+ export type HeaderIconsLayout = 'stacked' | 'inline';
4
6
  export type ColumnStyle = {
5
7
  [key: string]: string | ((value: anyType) => string);
6
8
  };
@@ -0,0 +1,4 @@
1
+ import { Option } from '../types';
2
+ export declare function isAllOptionsSelected(filteredOptions: Option[], selectedValues: Option[]): boolean;
3
+ export declare function isSomeOptionsSelected(filteredOptions: Option[], selectedValues: Option[]): boolean;
4
+ export declare function toggleSelectAllFiltered(filteredOptions: Option[], selectedValues: Option[], select: boolean): Option[];
@@ -0,0 +1,11 @@
1
+ import type { RowKey } from '../types/table';
2
+ export declare function resolveRowKey<T extends Record<string, unknown>>(row: T, rowKey: keyof T | ((row: T) => RowKey)): RowKey;
3
+ export declare function getSelectablePageKeys<T extends Record<string, unknown>>(rows: T[], rowKey: keyof T | ((row: T) => RowKey), isRowSelectable?: (row: T) => boolean): RowKey[];
4
+ export declare function isAllPageSelected(pageKeys: RowKey[], selectedKeys: RowKey[]): boolean;
5
+ export declare function isSomePageSelected(pageKeys: RowKey[], selectedKeys: RowKey[]): boolean;
6
+ export declare function toggleKeyInSelection(key: RowKey, selectedKeys: RowKey[]): RowKey[];
7
+ export declare function toggleSelectAllPage(pageKeys: RowKey[], selectedKeys: RowKey[], select: boolean): RowKey[];
8
+ export declare function getSelectedRows<T extends Record<string, unknown>>(data: T[], selectedKeys: RowKey[], rowKey: keyof T | ((row: T) => RowKey)): T[];
9
+ export declare function buildSubRowSelectionKey(parentKey: RowKey, subKey: RowKey): string;
10
+ export declare function isSubRowSelectionKey(key: RowKey): boolean;
11
+ export declare function getSelectedSubRows<T extends Record<string, unknown>, S extends Record<string, unknown>>(data: T[], selectedKeys: RowKey[], subTableDataKey: string, parentRowKey: keyof T | ((row: T) => RowKey), subRowKey: keyof S | ((row: S) => RowKey)): S[];
@@ -0,0 +1,4 @@
1
+ import { Option } from '../types';
2
+ export declare function isAllOptionsSelected(filteredOptions: Option[], selectedValues: Option[]): boolean;
3
+ export declare function isSomeOptionsSelected(filteredOptions: Option[], selectedValues: Option[]): boolean;
4
+ export declare function toggleSelectAllFiltered(filteredOptions: Option[], selectedValues: Option[], select: boolean): Option[];
@@ -0,0 +1,11 @@
1
+ import type { RowKey } from '../types/table';
2
+ export declare function resolveRowKey<T extends Record<string, unknown>>(row: T, rowKey: keyof T | ((row: T) => RowKey)): RowKey;
3
+ export declare function getSelectablePageKeys<T extends Record<string, unknown>>(rows: T[], rowKey: keyof T | ((row: T) => RowKey), isRowSelectable?: (row: T) => boolean): RowKey[];
4
+ export declare function isAllPageSelected(pageKeys: RowKey[], selectedKeys: RowKey[]): boolean;
5
+ export declare function isSomePageSelected(pageKeys: RowKey[], selectedKeys: RowKey[]): boolean;
6
+ export declare function toggleKeyInSelection(key: RowKey, selectedKeys: RowKey[]): RowKey[];
7
+ export declare function toggleSelectAllPage(pageKeys: RowKey[], selectedKeys: RowKey[], select: boolean): RowKey[];
8
+ export declare function getSelectedRows<T extends Record<string, unknown>>(data: T[], selectedKeys: RowKey[], rowKey: keyof T | ((row: T) => RowKey)): T[];
9
+ export declare function buildSubRowSelectionKey(parentKey: RowKey, subKey: RowKey): string;
10
+ export declare function isSubRowSelectionKey(key: RowKey): boolean;
11
+ export declare function getSelectedSubRows<T extends Record<string, unknown>, S extends Record<string, unknown>>(data: T[], selectedKeys: RowKey[], subTableDataKey: string, parentRowKey: keyof T | ((row: T) => RowKey), subRowKey: keyof S | ((row: S) => RowKey)): S[];