@cloudwick/astral-ui 8.3.0 → 8.5.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.
Files changed (59) hide show
  1. package/README.md +2 -2
  2. package/dist/components/adpIcon/adpIcon.d.ts +7 -2
  3. package/dist/components/button/button.d.ts +9 -7
  4. package/dist/components/card/card.d.ts +5 -0
  5. package/dist/components/card/cardVariants.d.ts +3 -0
  6. package/dist/components/dataTable/dataTable.d.ts +1 -137
  7. package/dist/components/dataTable/deriveConfiguredColumns.d.ts +7 -0
  8. package/dist/components/dataTable/index.d.ts +2 -2
  9. package/dist/components/dataTable/types.d.ts +135 -2
  10. package/dist/components/emptyState/emptyStateContent.d.ts +6 -0
  11. package/dist/components/modal/index.d.ts +1 -1
  12. package/dist/components/modal/modal.d.ts +29 -6
  13. package/dist/components/modal/modalContext.d.ts +22 -0
  14. package/dist/components/modal/modalTitle.d.ts +21 -0
  15. package/dist/components/modal/modalVariants.d.ts +18 -3
  16. package/dist/components/multiSelectTransfer/multiSelectTransferDropdown.d.ts +8 -6
  17. package/dist/components/multiSelectTransfer/multiSelectTransferModal.d.ts +4 -1
  18. package/dist/components/multiSelectTransfer/multiSelectTransferOptionRow.d.ts +5 -4
  19. package/dist/components/multiSelectTransfer/multiSelectTransferVariants.d.ts +18 -0
  20. package/dist/components/multiSelectTransfer/types.d.ts +16 -0
  21. package/dist/components/multiSelectTransfer/useMultiSelectTransferDropdownDraft.d.ts +34 -0
  22. package/dist/components/panel/panelContext.d.ts +7 -0
  23. package/dist/components/scrollbar/index.d.ts +2 -1
  24. package/dist/components/scrollbar/scrollbar.d.ts +1 -51
  25. package/dist/components/scrollbar/types.d.ts +52 -0
  26. package/dist/components/scrollbar/utils.d.ts +28 -0
  27. package/dist/components/select/selectComponents.d.ts +2 -3
  28. package/dist/components/select/selectKeyboard.d.ts +1 -1
  29. package/dist/components/select/types.d.ts +48 -9
  30. package/dist/components/select/useSelectComponents.d.ts +18 -0
  31. package/dist/components/select/useSelectDraft.d.ts +53 -0
  32. package/dist/components/select/useSelectOptionPool.d.ts +27 -0
  33. package/dist/components/select/utils.d.ts +9 -1
  34. package/dist/components/textField/textField.d.ts +5 -7
  35. package/dist/components/toggle/toggle.d.ts +1 -1
  36. package/dist/components/tooltip/tooltip.d.ts +8 -0
  37. package/dist/components/transferList/transferListItem.d.ts +6 -1
  38. package/dist/components/transferList/transferListPanel.d.ts +2 -58
  39. package/dist/components/transferList/types.d.ts +76 -1
  40. package/dist/components/transferList/useTransferList.d.ts +14 -5
  41. package/dist/components/transferList/useTransferListLimit.d.ts +24 -0
  42. package/dist/components/transferList/useTransferListPanelKeys.d.ts +7 -1
  43. package/dist/css/index.min.css +1 -1
  44. package/dist/hooks/index.d.ts +4 -0
  45. package/dist/hooks/useDeprecationWarning.d.ts +4 -0
  46. package/dist/hooks/useLiveAnnouncement.d.ts +13 -0
  47. package/dist/hooks/usePartRegistration.d.ts +10 -0
  48. package/dist/hooks/useSelectionLimit.d.ts +37 -0
  49. package/dist/index.cjs.js +4 -4
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.esm.js +5 -5
  52. package/dist/utils/devWarn.d.ts +8 -2
  53. package/dist/utils/elementUtils.d.ts +9 -0
  54. package/dist/utils/index.d.ts +1 -0
  55. package/dist/utils/optionText.d.ts +10 -0
  56. package/dist/utils/stringUtils/index.d.ts +2 -0
  57. package/dist/utils/stringUtils/optionToggled.d.ts +12 -0
  58. package/dist/utils/stringUtils/selectionLimitReached.d.ts +8 -0
  59. package/package.json +4 -3
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  UI Library for Cloudwick
4
4
 
5
- Version - 8.3.0
5
+ Version - 8.5.0
6
6
 
7
7
  ## Installation
8
8
 
@@ -27,7 +27,7 @@ This package has the following peer dependencies:
27
27
  Astral UI provides the following components:
28
28
 
29
29
  - Accordion
30
- - ADPIcon
30
+ - ADPIcon (deprecated, removed in the next major; use `@cloudwick/icons`)
31
31
  - Avatar
32
32
  - AvatarGroup
33
33
  - Badge
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { type IIconDetails, type TIconType, iconList } from "./svgObjects";
3
- export { iconList };
3
+ export { iconList, type TIconType };
4
4
  /**
5
5
  * Icon component for ADP icons
6
6
  *
@@ -54,9 +54,14 @@ export interface IADPIconProps extends Omit<React.SVGAttributes<SVGSVGElement>,
54
54
  */
55
55
  customSVG?: IIconDetails;
56
56
  }
57
+ /**
58
+ * Renders an SVG icon from the set of predefined icons or a custom SVG object. Library components
59
+ * render this directly; consumers get it through the deprecated `ADPIcon`.
60
+ */
61
+ export declare const ADPIconBase: React.ForwardRefExoticComponent<IADPIconProps & React.RefAttributes<SVGSVGElement>>;
57
62
  /**
58
63
  * Astral UI Icon component
59
64
  *
60
- * This component renders an SVG icon from the set of predefined icons or a custom SVG object.
65
+ * @deprecated Use an icon from `@cloudwick/icons` instead. `ADPIcon` will be removed in the next major.
61
66
  */
62
67
  export declare const ADPIcon: React.ForwardRefExoticComponent<IADPIconProps & React.RefAttributes<SVGSVGElement>>;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { Placement } from "@floating-ui/react";
3
- import { type TIconType } from "../adpIcon";
3
+ import { type TIconType } from "../adpIcon/adpIcon";
4
4
  export declare const colors: readonly ["primary", "secondary", "success", "warning", "error"];
5
5
  export declare const variants: readonly ["filled", "outline", "shade", "text"];
6
6
  export declare enum ESizes {
@@ -39,17 +39,15 @@ export interface IButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButton
39
39
  /**
40
40
  * Icon to be displayed before the button's content.
41
41
  * @description
42
- * This prop accepts either an IconType (string) or a ReactNode.
43
- * - If an IconType is provided, it will render an ADPIcon component.
44
- * - If a ReactNode is provided, it will be rendered as-is.
42
+ * Pass an icon from `@cloudwick/icons`; the node is rendered as-is. A string icon name
43
+ * (`TIconType`) still renders an ADPIcon but is deprecated and will be removed in the next major.
45
44
  */
46
45
  prefixIcon?: TIconType | React.ReactNode;
47
46
  /**
48
47
  * Icon to be displayed after the button's content.
49
48
  * @description
50
- * This prop accepts either an IconType (string) or a ReactNode.
51
- * - If an IconType is provided, it will render an ADPIcon component.
52
- * - If a ReactNode is provided, it will be rendered as-is.
49
+ * Pass an icon from `@cloudwick/icons`; the node is rendered as-is. A string icon name
50
+ * (`TIconType`) still renders an ADPIcon but is deprecated and will be removed in the next major.
53
51
  */
54
52
  suffixIcon?: TIconType | React.ReactNode;
55
53
  /**
@@ -58,6 +56,8 @@ export interface IButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButton
58
56
  * This prop accepts a ReactNode, if this is passed then the button will render
59
57
  * tooltip on hover of the button.
60
58
  * This tooltip is only on hover and not on click.
59
+ * A string tooltip on a button without text also becomes the button's `aria-label`, unless
60
+ * `aria-label` or `aria-labelledby` is passed.
61
61
  */
62
62
  tooltip?: React.ReactNode;
63
63
  /**
@@ -67,6 +67,8 @@ export interface IButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButton
67
67
  tooltipPlacement?: Placement;
68
68
  }
69
69
  export declare const ButtonSizeToSpinnerMap: Record<TSize, "xxs" | "xs" | "sm" | "md" | "lg" | "xl">;
70
+ /** The icon Button renders for a string icon name on a button of `size`. */
71
+ export declare function buttonIcon(icon: TIconType, size?: TSize): React.ReactElement;
70
72
  /**
71
73
  * Button component with multiple variants, colors, and sizes.
72
74
  *
@@ -30,6 +30,11 @@ export interface ICardHeaderProps extends Omit<React.HTMLAttributes<HTMLDivEleme
30
30
  * Title of the card
31
31
  */
32
32
  title?: React.ReactNode;
33
+ /**
34
+ * Renders the title as a heading (`h1`–`h6`) at this level. Choose the level that fits the page outline.
35
+ * Without it the title is a plain `div`. Same values as the exported `THeadingLevel`.
36
+ */
37
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
33
38
  /**
34
39
  * Props for the CTAGroup component. Pass an object with the props for the CTAGroup.
35
40
  */
@@ -12,6 +12,7 @@ export declare const cardVariants: import("tailwind-variants").TVReturnType<{
12
12
  }, {
13
13
  base: string;
14
14
  header: string;
15
+ title: string;
15
16
  body: string;
16
17
  footer: string;
17
18
  }, undefined, {
@@ -28,6 +29,7 @@ export declare const cardVariants: import("tailwind-variants").TVReturnType<{
28
29
  }, {
29
30
  base: string;
30
31
  header: string;
32
+ title: string;
31
33
  body: string;
32
34
  footer: string;
33
35
  }, import("tailwind-variants").TVReturnType<{
@@ -44,6 +46,7 @@ export declare const cardVariants: import("tailwind-variants").TVReturnType<{
44
46
  }, {
45
47
  base: string;
46
48
  header: string;
49
+ title: string;
47
50
  body: string;
48
51
  footer: string;
49
52
  }, undefined, unknown, unknown, undefined>>;
@@ -1,143 +1,7 @@
1
- import * as React from "react";
2
1
  import { type ReactNode } from "react";
3
- import { type SortingState, type OnChangeFn } from "@tanstack/react-table";
4
- import type { TColumn, TFilterItem, TAdvancedFilterItem, TFilters } from "./types";
5
- interface ISearchProps {
6
- placeholder?: string;
7
- hidden?: boolean;
8
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
9
- value?: string;
10
- /**
11
- * Props to control the onSearch function debounceTime
12
- */
13
- debounceTime?: number;
14
- /**
15
- * Attach the debounced search function
16
- */
17
- onSearch?: (value: string) => void;
18
- }
19
- interface IPaginationProps {
20
- onPageSizeChange?: (args: number) => void;
21
- onPageChange?: (args: number) => void;
22
- totalRecords?: number;
23
- offset?: number;
24
- pageSize?: number;
25
- }
26
- export interface IDataTableProps<T> {
27
- /**
28
- * Defines the column structure for the Data Table, including column headers,
29
- * accessors, and any additional configurations.
30
- */
31
- columns: TColumn[];
32
- /**
33
- * The array of data objects that will populate the rows of the Data Table.
34
- */
35
- data: T[];
36
- /**
37
- * Optional: Provide custom class names as a space-separated
38
- * string to override the default Data Table styling.
39
- */
40
- className?: string;
41
- /**
42
- * Configuration for applying advanced filters to the Data Table.
43
- * Allows complex filtering logic and customization.
44
- */
45
- advancedFilters?: TAdvancedFilterItem[];
46
- /**
47
- * Configuration for applying basic filters to the Data Table.
48
- * Enables simple filtering by key-value pairs.
49
- * Showing maximum 3 basic filters in the table.
50
- */
51
- basicFilters?: TFilterItem[];
52
- /**
53
- * Allows to set filters by key-value pairs.
54
- */
55
- filters?: TFilters;
56
- /**
57
- * A callback function used to update the list of applied filters.
58
- */
59
- setFilters?: (filters: TFilters) => void;
60
- /**
61
- * Boolean value to display a loading state in the Data Table,
62
- * typically while loading or processing data.
63
- * @default false
64
- */
65
- loading?: boolean;
66
- /**
67
- * A callback function triggered to refresh the Data Table,
68
- * typically re-fetching or updating the data.
69
- */
70
- onRefresh?: () => void;
71
- /**
72
- * To adjust the width of the columns
73
- * @default false
74
- */
75
- resizable?: boolean;
76
- /**
77
- * To adding virtualization for column in the data table
78
- * @default true
79
- */
80
- columnVirtualization?: boolean;
81
- /**
82
- * To adding virtualization for row in the data table
83
- * @default true
84
- */
85
- rowVirtualization?: boolean;
86
- /**
87
- * To pin the first columns of the data table
88
- * @default true
89
- */
90
- pinnedFirstColumn?: boolean;
91
- /**
92
- * To make the row selectable by showing checkboxes
93
- * @default false
94
- */
95
- selectable?: boolean;
96
- /**
97
- * Callback function triggered on row selection.
98
- * @param selectedRows - Index List of the selected rows
99
- */
100
- onRowSelection?: (selectedRows: object) => void;
101
- /**
102
- * Allows to set sort by using key-value pair.
103
- */
104
- sorting?: SortingState;
105
- /**
106
- * Callback function triggered on row sorting.
107
- * @param sortState - Index List of the selected rows
108
- */
109
- setSorting?: OnChangeFn<SortingState> | undefined;
110
- /**
111
- * Allows to set pagination props.
112
- */
113
- paginationProps?: IPaginationProps;
114
- /**
115
- * To Adjust the height of the table.
116
- * @default 100%
117
- */
118
- height?: string;
119
- /**
120
- * To set the page size option
121
- * @default PAGE_SIZE_OPTIONS
122
- */
123
- pageSizeOptions?: number[];
124
- /**
125
- * To add the custom CTAs
126
- */
127
- customCTAs?: ReactNode;
128
- /**
129
- * Callback function triggered on change of Column Preferences.
130
- * @param columns - columns array with updated order and selected key value
131
- */
132
- setColumns: (columns: TColumn[]) => void;
133
- /**
134
- * Allows to set search textfield props.
135
- */
136
- searchProps?: ISearchProps;
137
- }
2
+ import type { IDataTableProps } from "./types";
138
3
  /**
139
4
  * DataTable is a powerful component that displays tabular data with advanced features
140
5
  * like filtering, sorting, pagination, and row selection.
141
6
  */
142
7
  export declare const DataTable: <T extends object>({ advancedFilters, basicFilters, className, columns, data, filters, loading, paginationProps, resizable, selectable, pinnedFirstColumn, rowVirtualization, columnVirtualization, sorting, height, customCTAs, searchProps, pageSizeOptions, setFilters, setSorting, onRefresh, onRowSelection, setColumns }: IDataTableProps<T>) => ReactNode;
143
- export {};
@@ -0,0 +1,7 @@
1
+ import { type ColumnHelper } from "@tanstack/react-table";
2
+ import type { TColumn } from "./types";
3
+ /**
4
+ * The TanStack columns for a DataTable: the row-selection checkbox column when `selectable`, then the
5
+ * consumer's columns with fixed ones first and deselected ones dropped.
6
+ */
7
+ export declare const deriveConfiguredColumns: (rawColumns: TColumn[], selectable: boolean, columnHelper: ColumnHelper<any>) => import("@tanstack/react-table").AccessorKeyColumnDef<any, any>[];
@@ -1,5 +1,5 @@
1
- export { DataTable, type IDataTableProps } from "./dataTable";
2
- export { type TColumn, type TFilterItem, type TAdvancedFilterItem, type TFilters } from "./types";
1
+ export { DataTable } from "./dataTable";
2
+ export { type IDataTableProps, type TColumn, type TFilterItem, type TAdvancedFilterItem, type TFilters } from "./types";
3
3
  export { AdvancedFilters } from "./advancedFilters";
4
4
  export { DataTableColumnSettings } from "./DataTableColumnSettings";
5
5
  export { PageSizeModal } from "./pageSizeModal";
@@ -1,5 +1,5 @@
1
- import type { ReactNode } from "react";
2
- import type { CellContext, SortingFnOption } from "@tanstack/react-table";
1
+ import type { ChangeEvent, ReactNode } from "react";
2
+ import type { CellContext, OnChangeFn, SortingFnOption, SortingState } from "@tanstack/react-table";
3
3
  import type { TIconType } from "../adpIcon";
4
4
  import type { IOption } from "../select";
5
5
  /**
@@ -58,3 +58,136 @@ export type TAdvancedFilterItem = {
58
58
  * Filters record type
59
59
  */
60
60
  export type TFilters = Record<string, any>;
61
+ export interface ISearchProps {
62
+ placeholder?: string;
63
+ hidden?: boolean;
64
+ onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
65
+ value?: string;
66
+ /**
67
+ * Props to control the onSearch function debounceTime
68
+ */
69
+ debounceTime?: number;
70
+ /**
71
+ * Attach the debounced search function
72
+ */
73
+ onSearch?: (value: string) => void;
74
+ }
75
+ export interface IPaginationProps {
76
+ onPageSizeChange?: (args: number) => void;
77
+ onPageChange?: (args: number) => void;
78
+ totalRecords?: number;
79
+ offset?: number;
80
+ pageSize?: number;
81
+ }
82
+ export interface IDataTableProps<T> {
83
+ /**
84
+ * Defines the column structure for the Data Table, including column headers,
85
+ * accessors, and any additional configurations.
86
+ */
87
+ columns: TColumn[];
88
+ /**
89
+ * The array of data objects that will populate the rows of the Data Table.
90
+ */
91
+ data: T[];
92
+ /**
93
+ * Optional: Provide custom class names as a space-separated
94
+ * string to override the default Data Table styling.
95
+ */
96
+ className?: string;
97
+ /**
98
+ * Configuration for applying advanced filters to the Data Table.
99
+ * Allows complex filtering logic and customization.
100
+ */
101
+ advancedFilters?: TAdvancedFilterItem[];
102
+ /**
103
+ * Configuration for applying basic filters to the Data Table.
104
+ * Enables simple filtering by key-value pairs.
105
+ * Showing maximum 3 basic filters in the table.
106
+ */
107
+ basicFilters?: TFilterItem[];
108
+ /**
109
+ * Allows to set filters by key-value pairs.
110
+ */
111
+ filters?: TFilters;
112
+ /**
113
+ * A callback function used to update the list of applied filters.
114
+ */
115
+ setFilters?: (filters: TFilters) => void;
116
+ /**
117
+ * Boolean value to display a loading state in the Data Table,
118
+ * typically while loading or processing data.
119
+ * @default false
120
+ */
121
+ loading?: boolean;
122
+ /**
123
+ * A callback function triggered to refresh the Data Table,
124
+ * typically re-fetching or updating the data.
125
+ */
126
+ onRefresh?: () => void;
127
+ /**
128
+ * To adjust the width of the columns
129
+ * @default false
130
+ */
131
+ resizable?: boolean;
132
+ /**
133
+ * To adding virtualization for column in the data table
134
+ * @default true
135
+ */
136
+ columnVirtualization?: boolean;
137
+ /**
138
+ * To adding virtualization for row in the data table
139
+ * @default true
140
+ */
141
+ rowVirtualization?: boolean;
142
+ /**
143
+ * To pin the first columns of the data table
144
+ * @default true
145
+ */
146
+ pinnedFirstColumn?: boolean;
147
+ /**
148
+ * To make the row selectable by showing checkboxes
149
+ * @default false
150
+ */
151
+ selectable?: boolean;
152
+ /**
153
+ * Callback function triggered on row selection.
154
+ * @param selectedRows - Index List of the selected rows
155
+ */
156
+ onRowSelection?: (selectedRows: object) => void;
157
+ /**
158
+ * Allows to set sort by using key-value pair.
159
+ */
160
+ sorting?: SortingState;
161
+ /**
162
+ * Callback function triggered on row sorting.
163
+ * @param sortState - Index List of the selected rows
164
+ */
165
+ setSorting?: OnChangeFn<SortingState> | undefined;
166
+ /**
167
+ * Allows to set pagination props.
168
+ */
169
+ paginationProps?: IPaginationProps;
170
+ /**
171
+ * To Adjust the height of the table.
172
+ * @default 100%
173
+ */
174
+ height?: string;
175
+ /**
176
+ * To set the page size option
177
+ * @default [ 25, 50, 100, 200, 500, 1000 ]
178
+ */
179
+ pageSizeOptions?: number[];
180
+ /**
181
+ * To add the custom CTAs
182
+ */
183
+ customCTAs?: ReactNode;
184
+ /**
185
+ * Callback function triggered on change of Column Preferences.
186
+ * @param columns - columns array with updated order and selected key value
187
+ */
188
+ setColumns: (columns: TColumn[]) => void;
189
+ /**
190
+ * Allows to set search textfield props.
191
+ */
192
+ searchProps?: ISearchProps;
193
+ }
@@ -4,6 +4,12 @@ export interface IEmptyStateContentProps extends React.HTMLAttributes<HTMLDivEle
4
4
  className?: string;
5
5
  /** Content title */
6
6
  title?: string;
7
+ /**
8
+ * Renders the title as a heading (`h1`–`h6`) at this level. Set it only when the empty state starts a
9
+ * section of the page, at the level that fits the page outline. Without it the title is a `p`. Same values
10
+ * as the exported `THeadingLevel`.
11
+ */
12
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
7
13
  /** Content children */
8
14
  children?: React.ReactNode;
9
15
  }
@@ -1,2 +1,2 @@
1
- export { Modal, ModalHeader, ModalBody, type IModalProps, type IModalHeaderProps, type IModalBodyProps } from "./modal";
1
+ export { Modal, ModalHeader, ModalTitle, ModalBody, type IModalProps, type IModalHeaderProps, type IModalTitleProps, type IModalBodyProps } from "./modal";
2
2
  export { modalVariants } from "./modalVariants";
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { ModalTitle, type IModalTitleProps } from "./modalTitle";
2
3
  export interface IModalProps {
3
4
  /**
4
5
  * Control modal's visibility
@@ -40,10 +41,24 @@ export interface IModalProps {
40
41
  */
41
42
  onHide?: () => void;
42
43
  /**
43
- * Accessible name for the dialog. Takes precedence over the name derived from Modal.Header, so use it
44
- * when the header holds no title text (an icon, a search input) or when no header is rendered.
44
+ * Accessible name for the dialog. Takes precedence over the name derived from Modal.Title or Modal.Header,
45
+ * so use it when the header holds no title text (an icon, a search input) or when no header is rendered.
45
46
  */
46
47
  "aria-label"?: string;
48
+ /**
49
+ * Id of the element that names the dialog. Takes precedence over Modal.Title, Modal.Header and `aria-label`.
50
+ */
51
+ "aria-labelledby"?: string;
52
+ /**
53
+ * Id of the element that describes the dialog, or `false` for no description.
54
+ * @default the id of the rendered Modal.Body, unless it contains the Modal.Title
55
+ */
56
+ "aria-describedby"?: string | false;
57
+ /**
58
+ * Accessible name of the built-in close button
59
+ * @default "Close"
60
+ */
61
+ closeButtonLabel?: string;
47
62
  }
48
63
  export interface IModalHeaderProps {
49
64
  /**
@@ -79,6 +94,7 @@ export interface IModalBodyProps {
79
94
  }
80
95
  type TModalCompoundComponent = React.ForwardRefExoticComponent<React.PropsWithoutRef<IModalProps> & React.RefAttributes<HTMLDivElement>> & {
81
96
  Header: typeof ModalHeader;
97
+ Title: typeof ModalTitle;
82
98
  Body: typeof ModalBody;
83
99
  };
84
100
  /**
@@ -87,18 +103,24 @@ type TModalCompoundComponent = React.ForwardRefExoticComponent<React.PropsWithou
87
103
  * @example
88
104
  * ```tsx
89
105
  * <Modal showModal={modalVisible} onHide={() => setModalVisible(false)}>
90
- * <Modal.Header>Modal Title</Modal.Header>
106
+ * <Modal.Header>
107
+ * <Modal.Title>Modal Title</Modal.Title>
108
+ * </Modal.Header>
91
109
  * <Modal.Body>Modal content goes here</Modal.Body>
92
110
  * </Modal>
93
111
  * ```
94
112
  */
95
113
  export declare const Modal: TModalCompoundComponent;
96
114
  /**
97
- * Modal header component for rendering the title in the Modal.
115
+ * Modal header component. With a Modal.Title inside, it is a layout row for the title and any actions;
116
+ * without one, the whole header is the dialog's heading and name.
98
117
  *
99
118
  * @example
100
119
  * ```tsx
101
- * <Modal.Header>Modal Title</Modal.Header>
120
+ * <Modal.Header>
121
+ * <Modal.Title>Modal Title</Modal.Title>
122
+ * <Button aria-label="Download" prefixIcon="download" />
123
+ * </Modal.Header>
102
124
  * ```
103
125
  */
104
126
  declare const ModalHeader: React.ForwardRefExoticComponent<IModalHeaderProps & React.RefAttributes<HTMLDivElement>>;
@@ -115,4 +137,5 @@ declare const ModalHeader: React.ForwardRefExoticComponent<IModalHeaderProps & R
115
137
  * ```
116
138
  */
117
139
  declare const ModalBody: React.ForwardRefExoticComponent<IModalBodyProps & React.RefAttributes<HTMLDivElement>>;
118
- export { ModalHeader, ModalBody };
140
+ export { ModalHeader, ModalTitle, ModalBody };
141
+ export type { IModalTitleProps };
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ export interface IModalContext {
3
+ labelId: string;
4
+ descId: string;
5
+ closeButton: boolean;
6
+ titleRendered: boolean;
7
+ setHeaderMounted: (mounted: boolean) => void;
8
+ setTitleMounted: (mounted: boolean) => void;
9
+ setTitleInBodyMounted: (mounted: boolean) => void;
10
+ setBodyMounted: (mounted: boolean) => void;
11
+ }
12
+ export declare const ModalContext: React.Context<IModalContext | null>;
13
+ /**
14
+ * True inside Modal.Body. A Modal.Title there would otherwise be both the dialog's name and part of its
15
+ * description, which describes the dialog with the whole body.
16
+ */
17
+ export declare const ModalBodyContext: React.Context<boolean>;
18
+ /**
19
+ * Development warnings for a dialog with no accessible name, and for a heading that contains controls,
20
+ * which then become part of the heading and of the dialog's name. Warns once per Modal instance.
21
+ */
22
+ export declare function useModalNameWarnings(dialog: HTMLElement | null, labelId: string, named: boolean, titleRendered: boolean): void;
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ export interface IModalTitleProps {
3
+ /**
4
+ * Title text of the Modal
5
+ */
6
+ children?: React.ReactNode;
7
+ /**
8
+ * Dynamically updates the classes applied to the component
9
+ */
10
+ className?: string;
11
+ }
12
+ /**
13
+ * Modal title component. It is the dialog's heading and names the dialog, so the header's actions stay
14
+ * out of the name. Place it inside Modal.Header, or in Modal.Body for dialogs that show the title there.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <Modal.Title>Modal Title</Modal.Title>
19
+ * ```
20
+ */
21
+ export declare const ModalTitle: React.ForwardRefExoticComponent<IModalTitleProps & React.RefAttributes<HTMLHeadingElement>>;
@@ -1,28 +1,43 @@
1
1
  export declare const modalVariants: import("tailwind-variants").TVReturnType<{
2
2
  headerless: {
3
+ true: {};
4
+ };
5
+ closeButton: {
3
6
  true: {
4
- modal: string;
7
+ header: string;
5
8
  };
6
9
  };
7
10
  }, {
8
11
  container: string[];
9
12
  modal: string[];
13
+ header: string;
14
+ title: string;
10
15
  }, undefined, {
11
16
  headerless: {
17
+ true: {};
18
+ };
19
+ closeButton: {
12
20
  true: {
13
- modal: string;
21
+ header: string;
14
22
  };
15
23
  };
16
24
  }, {
17
25
  container: string[];
18
26
  modal: string[];
27
+ header: string;
28
+ title: string;
19
29
  }, import("tailwind-variants").TVReturnType<{
20
30
  headerless: {
31
+ true: {};
32
+ };
33
+ closeButton: {
21
34
  true: {
22
- modal: string;
35
+ header: string;
23
36
  };
24
37
  };
25
38
  }, {
26
39
  container: string[];
27
40
  modal: string[];
41
+ header: string;
42
+ title: string;
28
43
  }, undefined, unknown, unknown, undefined>>;
@@ -3,6 +3,8 @@ import { type TSentinelRef } from "@hooks";
3
3
  import type { TTransferListValue } from "../transferList/types";
4
4
  import type { TMultiSelectTransferOption, TMultiSelectTransferSize } from "./types";
5
5
  interface IMultiSelectTransferDropdownProps {
6
+ /** Opened from the keyboard, so the active row starts with the keyboard highlight. */
7
+ openedByKeyboard: boolean;
6
8
  error?: boolean;
7
9
  size: TMultiSelectTransferSize;
8
10
  disabled?: boolean;
@@ -21,17 +23,17 @@ interface IMultiSelectTransferDropdownProps {
21
23
  hasSelectAll: boolean;
22
24
  areAllSelected: boolean;
23
25
  onSelectAll: () => void;
26
+ /** Cannot be ticked now: its own `isDisabled` or the limit. Arrow keys and Enter skip only the former. */
27
+ isOptionDisabled: (option: TMultiSelectTransferOption) => boolean;
28
+ /** The last toggle (and the limit, when it reached it), spoken through its own polite region. */
29
+ announcement?: string;
24
30
  /** Escape from anywhere in the dropdown: discard the draft and close. */
25
31
  onCancel: () => void;
26
32
  /** Tab out of the dropdown's last (or Shift+Tab out of its first) control: commit and close. */
27
33
  onCommit: () => void;
28
34
  /** Any load in flight; renders the loader row below the list. */
29
35
  isLoading?: boolean;
30
- /**
31
- * Loader (or error) takes the rows' place rather than appending below them. Required, and supplied
32
- * by the option source rather than re-derived here, so the hook is the single source of this
33
- * predicate — two components deriving it differently is how they drifted.
34
- */
36
+ /** Loader (or error) takes the rows' place rather than appending. Supplied by the option source, its one owner. */
35
37
  isSearchFetch: boolean;
36
38
  sentinelRef: TSentinelRef;
37
39
  /** Replaces the rows when set: the whole list failed to load. */
@@ -49,7 +51,7 @@ interface IMultiSelectTransferDropdownProps {
49
51
  * The open-state dropdown for MultiSelectTransfer: an optional search input, an optional "Select All"
50
52
  * row, the (draft-checked) option list, and the infinite-scroll sentinel.
51
53
  */
52
- export declare function MultiSelectTransferDropdown({ error, size, disabled, searchable, filterQuery, onFilterInput, onFilterKeyDown, onFilterKeyUp, onFilterBlur, searchPlaceholder, options, selectedValues, onOptionToggle, hasSelectAll, areAllSelected, onSelectAll, onCancel, onCommit, isLoading, isSearchFetch, sentinelRef, loadError, loadMoreError, onRetryLoadMore, retryLabel, reloadTooltip, onReload, isReloading }: IMultiSelectTransferDropdownProps): React.ReactElement;
54
+ export declare function MultiSelectTransferDropdown({ openedByKeyboard, error, size, disabled, searchable, filterQuery, onFilterInput, onFilterKeyDown, onFilterKeyUp, onFilterBlur, searchPlaceholder, options, selectedValues, onOptionToggle, hasSelectAll, areAllSelected, onSelectAll, isOptionDisabled, announcement, onCancel, onCommit, isLoading, isSearchFetch, sentinelRef, loadError, loadMoreError, onRetryLoadMore, retryLabel, reloadTooltip, onReload, isReloading }: IMultiSelectTransferDropdownProps): React.ReactElement;
53
55
  export declare namespace MultiSelectTransferDropdown {
54
56
  var displayName: string;
55
57
  }