@canonical/maas-react-components 1.30.1 → 1.32.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.
- package/dist/@canonical/maas-react-components.es.js +1959 -1631
- package/dist/@canonical/maas-react-components.umd.js +17 -17
- package/dist/maas-react-components.css +1 -1
- package/dist/src/lib/components/GenericTable/GenericTable.d.ts +5 -3
- package/dist/src/lib/components/GenericTable/GenericTable.stories.d.ts +11 -2
- package/dist/src/lib/components/GenericTable/TableCheckbox/TableCheckbox.d.ts +3 -1
- package/dist/src/lib/components/QueryInput/QueryInput.d.ts +50 -0
- package/dist/src/lib/components/QueryInput/QueryInput.stories.d.ts +8 -0
- package/dist/src/lib/components/QueryInput/QueryInput.test.d.ts +1 -0
- package/dist/src/lib/components/QueryInput/index.d.ts +1 -0
- package/dist/src/lib/components/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,7 +5,8 @@ type GenericTableProps<T extends {
|
|
|
5
5
|
id: number | string;
|
|
6
6
|
}> = {
|
|
7
7
|
className?: string;
|
|
8
|
-
canSelect?: boolean;
|
|
8
|
+
canSelect?: boolean | ((row: Row<T>) => boolean);
|
|
9
|
+
disabledSelectionTooltip?: string | ((row: Row<T>) => string);
|
|
9
10
|
columns: ColumnDef<T, Partial<T>>[];
|
|
10
11
|
containerRef?: RefObject<HTMLElement | null>;
|
|
11
12
|
data: T[];
|
|
@@ -35,7 +36,8 @@ type GenericTableProps<T extends {
|
|
|
35
36
|
*
|
|
36
37
|
* @param {Object} props - Component props
|
|
37
38
|
* @param {string} [props.className] - Additional CSS class for the table wrapper
|
|
38
|
-
* @param {boolean} [props.canSelect=false] - Enable row selection with checkboxes
|
|
39
|
+
* @param {boolean | ((row: Row<T>) => boolean)} [props.canSelect=false] - Enable row selection with checkboxes
|
|
40
|
+
* @param {string | ((row: Row<T>) => string)} [props.disabledSelectionTooltip] - Tooltip message or constructor on disabled checkboxes
|
|
39
41
|
* @param {ColumnDef<T, Partial<T>>[]} props.columns - Column definitions
|
|
40
42
|
* @param {RefObject<HTMLElement | null>} [props.containerRef] - Reference to container for size calculations
|
|
41
43
|
* @param {T[]} props.data - Table data array
|
|
@@ -73,5 +75,5 @@ type GenericTableProps<T extends {
|
|
|
73
75
|
*/
|
|
74
76
|
export declare const GenericTable: <T extends {
|
|
75
77
|
id: number | string;
|
|
76
|
-
}>({ className, canSelect, columns: initialColumns, containerRef, data: initialData, filterCells, filterHeaders, groupBy, isLoading, noData, pagination, pinGroup, sortBy, rowSelection, setRowSelection, variant, ...props }: GenericTableProps<T>) => ReactElement;
|
|
78
|
+
}>({ className, canSelect, disabledSelectionTooltip, columns: initialColumns, containerRef, data: initialData, filterCells, filterHeaders, groupBy, isLoading, noData, pagination, pinGroup, sortBy, rowSelection, setRowSelection, variant, ...props }: GenericTableProps<T>) => ReactElement;
|
|
77
79
|
export {};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { GenericTable } from './GenericTable';
|
|
3
|
-
|
|
3
|
+
type Machine = {
|
|
4
|
+
id: number;
|
|
5
|
+
fqdn: string;
|
|
6
|
+
ipAddress: string;
|
|
7
|
+
status: string;
|
|
8
|
+
zone: string;
|
|
9
|
+
pool: string;
|
|
10
|
+
};
|
|
11
|
+
declare const meta: Meta<typeof GenericTable<Machine>>;
|
|
4
12
|
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof GenericTable
|
|
13
|
+
type Story = StoryObj<typeof GenericTable<Machine>>;
|
|
6
14
|
export declare const Default: Story;
|
|
7
15
|
export declare const Loading: Story;
|
|
8
16
|
export declare const Empty: Story;
|
|
9
17
|
export declare const Selectable: Story;
|
|
18
|
+
export declare const ConditionallySelectable: Story;
|
|
10
19
|
export declare const Grouped: Story;
|
|
11
20
|
export declare const GroupedSelectable: Story;
|
|
12
21
|
export declare const Paginated: Story;
|
|
@@ -5,7 +5,9 @@ type TableCheckboxProps<T> = Partial<DetailedHTMLProps<InputHTMLAttributes<HTMLI
|
|
|
5
5
|
table?: Table<T>;
|
|
6
6
|
};
|
|
7
7
|
declare const TableCheckbox: {
|
|
8
|
-
<T>({ row, ...props }: TableCheckboxProps<T>
|
|
8
|
+
<T>({ row, disabledTooltip, ...props }: TableCheckboxProps<T> & {
|
|
9
|
+
disabledTooltip: string | ((row: Row<T>) => string);
|
|
10
|
+
}): ReactElement | null;
|
|
9
11
|
All: <T>({ table, ...props }: TableCheckboxProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
12
|
Group: <T>({ row, ...props }: TableCheckboxProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
13
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ReactElement, DetailedHTMLProps, HTMLAttributes, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export type Suggestion = {
|
|
3
|
+
value: string;
|
|
4
|
+
type: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type QueryInputProps = {
|
|
8
|
+
className?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
search: string;
|
|
11
|
+
setSearch: Dispatch<SetStateAction<string>>;
|
|
12
|
+
context: string;
|
|
13
|
+
setContext: Dispatch<SetStateAction<string>>;
|
|
14
|
+
setToken: Dispatch<SetStateAction<string>>;
|
|
15
|
+
suggestions: Suggestion[];
|
|
16
|
+
isLoading?: boolean;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
} & DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
19
|
+
/**
|
|
20
|
+
* QueryInput - A feature-rich search query constructor for React applications
|
|
21
|
+
*
|
|
22
|
+
* A keyboard-centric search query constructor field with externally controlled
|
|
23
|
+
* assistive suggestion and insertion features
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} props - Component props
|
|
26
|
+
* @param {string} [props.className] - Additional CSS class for the table wrapper
|
|
27
|
+
* @param {disabled} [props.disabled] - Field disabling boolean
|
|
28
|
+
* @param {search} [props.search] - Externally controlled search query string
|
|
29
|
+
* @param {setSearch} [props.setSearch] - Search query string setter
|
|
30
|
+
* @param {context} [props.context] - Externally controlled suggestion context
|
|
31
|
+
* @param {setContext} [props.setContext] - Suggestion context setter
|
|
32
|
+
* @param {setToken} [props.setToken] - Partial token string for autocomplete
|
|
33
|
+
* @param {suggestions} [props.suggestions] - Context-aware suggestions
|
|
34
|
+
* @param {isLoading} [props.isLoading] - Loading suggestion state boolean
|
|
35
|
+
* @param {placeholder} [props.placeholder] - Search field placeholder text
|
|
36
|
+
*
|
|
37
|
+
* @returns {ReactElement} - The rendered query input component
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <QueryInput
|
|
41
|
+
* search={search}
|
|
42
|
+
* setSearch={setSearch}
|
|
43
|
+
* context={context}
|
|
44
|
+
* setContext={setContext}
|
|
45
|
+
* setToken={setToken}
|
|
46
|
+
* suggestions={suggestions}
|
|
47
|
+
* />
|
|
48
|
+
*/
|
|
49
|
+
export declare const QueryInput: ({ className, disabled, search, setSearch, context, setContext, setToken, suggestions, isLoading, placeholder, ...props }: QueryInputProps) => ReactElement;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { QueryInput } from '../..';
|
|
3
|
+
declare const meta: Meta<typeof QueryInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof QueryInput>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Disabled: Story;
|
|
8
|
+
export declare const Loading: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QueryInput';
|
package/package.json
CHANGED