@canonical/maas-react-components 1.30.0 → 1.31.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 +1869 -1583
- package/dist/@canonical/maas-react-components.umd.js +17 -17
- package/dist/maas-react-components.css +1 -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
|
@@ -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