@shlinkio/shlink-frontend-kit 1.4.0 → 1.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.
- package/README.md +25 -1
- package/dist/content/Details.d.ts +9 -0
- package/dist/content/Details.stories.d.ts +11 -0
- package/dist/content/Listbox.d.ts +25 -0
- package/dist/content/Table.d.ts +33 -0
- package/dist/content/Table.stories.d.ts +20 -0
- package/dist/content/index.d.ts +3 -0
- package/dist/feedback/CardModal.d.ts +40 -0
- package/dist/feedback/CardModal.stories.d.ts +25 -0
- package/dist/feedback/Message.d.ts +11 -0
- package/dist/feedback/Message.stories.d.ts +11 -0
- package/dist/feedback/ModalDialog.d.ts +8 -0
- package/dist/feedback/Result.d.ts +11 -0
- package/dist/feedback/Result.stories.d.ts +12 -0
- package/dist/feedback/Tooltip.d.ts +897 -0
- package/dist/feedback/Tooltip.stories.d.ts +10 -0
- package/dist/feedback/index.d.ts +5 -0
- package/dist/form/BooleanControl.d.ts +6 -0
- package/dist/form/Button.d.ts +17 -0
- package/dist/form/Button.stories.d.ts +26 -0
- package/dist/form/Checkbox.d.ts +4 -0
- package/dist/form/Checkbox.stories.d.ts +9 -0
- package/dist/form/CloseButton.d.ts +11 -0
- package/dist/form/CloseButton.stories.d.ts +12 -0
- package/dist/form/FormControlWithFeedback.d.ts +12 -0
- package/dist/form/Input.d.ts +16 -0
- package/dist/form/Input.stories.d.ts +20 -0
- package/dist/form/Label.d.ts +5 -0
- package/dist/form/Label.stories.d.ts +9 -0
- package/dist/form/LabelledInput.d.ts +14 -0
- package/dist/form/LabelledInput.stories.d.ts +12 -0
- package/dist/form/LabelledRevealablePasswordInput.d.ts +14 -0
- package/dist/form/LabelledRevealablePasswordInput.stories.d.ts +8 -0
- package/dist/form/LabelledSelect.d.ts +11 -0
- package/dist/form/LabelledSelect.stories.d.ts +15 -0
- package/dist/form/RevealablePasswordInput.d.ts +9 -0
- package/dist/form/RevealablePasswordInput.stories.d.ts +8 -0
- package/dist/form/SearchCombobox.d.ts +35 -0
- package/dist/form/SearchCombobox.stories.d.ts +15 -0
- package/dist/form/SearchInput.d.ts +15 -0
- package/dist/form/SearchInput.stories.d.ts +19 -0
- package/dist/form/Select.d.ts +8 -0
- package/dist/form/Select.stories.d.ts +17 -0
- package/dist/form/TagsAutocomplete.d.ts +33 -0
- package/dist/form/TagsAutocomplete.stories.d.ts +14 -0
- package/dist/form/ToggleSwitch.d.ts +4 -0
- package/dist/form/ToggleSwitch.stories.d.ts +9 -0
- package/dist/form/index.d.ts +14 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/normalize-tag.d.ts +4 -0
- package/dist/helpers/numbers.d.ts +2 -0
- package/dist/helpers/pagination.d.ts +8 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/use-arrow-key-navigation.d.ts +18 -0
- package/dist/hooks/use-go-back.d.ts +1 -0
- package/dist/hooks/use-parsed-query.d.ts +1 -0
- package/dist/hooks/use-tags-search.d.ts +34 -0
- package/dist/hooks/use-timeout-toggle.d.ts +14 -0
- package/dist/hooks/use-timeout.d.ts +15 -0
- package/dist/hooks/use-toggle.d.ts +7 -0
- package/dist/index.d.ts +11 -1645
- package/dist/index.js +1311 -1639
- package/dist/navigation/Dropdown.d.ts +32 -0
- package/dist/navigation/Dropdown.stories.d.ts +36 -0
- package/dist/navigation/LinkButton.d.ts +8 -0
- package/dist/navigation/LinkButton.stories.d.ts +10 -0
- package/dist/navigation/Menu.d.ts +35 -0
- package/dist/navigation/Menu.stories.d.ts +16 -0
- package/dist/navigation/NavBar.d.ts +16 -0
- package/dist/navigation/NavBar.stories.d.ts +18 -0
- package/dist/navigation/NavPills.d.ts +10 -0
- package/dist/navigation/NavPills.stories.d.ts +13 -0
- package/dist/navigation/Paginator.d.ts +10 -0
- package/dist/navigation/Paginator.stories.d.ts +18 -0
- package/dist/navigation/RowDropdown.d.ts +11 -0
- package/dist/navigation/RowDropdown.stories.d.ts +24 -0
- package/dist/navigation/index.d.ts +7 -0
- package/dist/ordering/OrderingDropdown.d.ts +12 -0
- package/dist/ordering/OrderingDropdown.stories.d.ts +17 -0
- package/dist/ordering/index.d.ts +2 -0
- package/dist/ordering/ordering.d.ts +25 -0
- package/dist/surfaces/Card.d.ts +7 -0
- package/dist/surfaces/Card.stories.d.ts +12 -0
- package/dist/surfaces/SimpleCard.d.ts +16 -0
- package/dist/surfaces/SimpleCard.stories.d.ts +11 -0
- package/dist/surfaces/index.d.ts +2 -0
- package/dist/theme/index.d.ts +15 -0
- package/dist/types.d.ts +3 -0
- package/dist/utils/CopyToClipboardButton.d.ts +13 -0
- package/dist/utils/CopyToClipboardButton.stories.d.ts +8 -0
- package/dist/utils/colors.d.ts +9 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/query.d.ts +12 -0
- package/package.json +25 -20
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
component: import('react').FC<import('./Tooltip').TooltipProps>;
|
|
3
|
+
tags: string[];
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const AutoTooltip: () => import("react").JSX.Element;
|
|
7
|
+
export declare const BottomTooltip: () => import("react").JSX.Element;
|
|
8
|
+
export declare const TopTooltip: () => import("react").JSX.Element;
|
|
9
|
+
export declare const LeftTooltip: () => import("react").JSX.Element;
|
|
10
|
+
export declare const RightTooltip: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChangeEvent, FC, HTMLProps, Ref } from 'react';
|
|
2
|
+
export type BooleanControlProps = Omit<HTMLProps<HTMLInputElement>, 'type' | 'onChange' | 'value' | 'defaultValue'> & {
|
|
3
|
+
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
|
4
|
+
ref?: Ref<HTMLInputElement>;
|
|
5
|
+
};
|
|
6
|
+
export declare const BooleanControl: FC<BooleanControlProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC, HTMLProps, PropsWithChildren, Ref } from 'react';
|
|
2
|
+
import { LinkProps } from 'react-router';
|
|
3
|
+
import { Size } from '../types';
|
|
4
|
+
type RegularButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size' | 'type'>;
|
|
5
|
+
type LinkButtonProps = LinkProps;
|
|
6
|
+
export type ButtonProps = PropsWithChildren<{
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
10
|
+
type?: HTMLButtonElement['type'];
|
|
11
|
+
size?: Size;
|
|
12
|
+
inline?: boolean;
|
|
13
|
+
solid?: boolean;
|
|
14
|
+
ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
15
|
+
} & (RegularButtonProps | LinkButtonProps)>;
|
|
16
|
+
export declare const Button: FC<ButtonProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./Button').ButtonProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
argTypes: {
|
|
6
|
+
variant: {
|
|
7
|
+
options: string[];
|
|
8
|
+
};
|
|
9
|
+
type: {
|
|
10
|
+
options: string[];
|
|
11
|
+
};
|
|
12
|
+
size: import('storybook/internal/csf').InputType;
|
|
13
|
+
disabled: import('storybook/internal/csf').InputType;
|
|
14
|
+
inline: import('storybook/internal/csf').InputType;
|
|
15
|
+
solid: import('storybook/internal/csf').InputType;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
export declare const Main: Story;
|
|
21
|
+
export declare const Secondary: Story;
|
|
22
|
+
export declare const Danger: Story;
|
|
23
|
+
export declare const Sizes: () => import("react").JSX.Element;
|
|
24
|
+
export declare const Solid: () => import("react").JSX.Element;
|
|
25
|
+
export declare const Disabled: () => import("react").JSX.Element;
|
|
26
|
+
export declare const AsLink: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./BooleanControl').BooleanControlProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Basic: Story;
|
|
9
|
+
export declare const InCard: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, HTMLProps, Ref } from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
export type CloseButtonProps = {
|
|
4
|
+
label?: string;
|
|
5
|
+
onClick?: HTMLProps<HTMLButtonElement>['onClick'];
|
|
6
|
+
className?: string;
|
|
7
|
+
size?: Size;
|
|
8
|
+
solid?: boolean;
|
|
9
|
+
ref?: Ref<HTMLButtonElement>;
|
|
10
|
+
};
|
|
11
|
+
export declare const CloseButton: FC<CloseButtonProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./CloseButton').CloseButtonProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Basic: Story;
|
|
9
|
+
export declare const Solid: Story;
|
|
10
|
+
export declare const Small: Story;
|
|
11
|
+
export declare const Medium: Story;
|
|
12
|
+
export declare const CustomAccessibleLabel: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
export type FormControlWithFeedbackProps = PropsWithChildren<{
|
|
3
|
+
/** An error message to display under the input. Will cause the input to be set with `error` feedback. */
|
|
4
|
+
error?: ReactNode;
|
|
5
|
+
/** Informative help to be display under the input */
|
|
6
|
+
helpText?: ReactNode;
|
|
7
|
+
'data-testid'?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* This component should not be exported from the module. It's designed to reuse as a helper wrapper
|
|
11
|
+
*/
|
|
12
|
+
export declare const FormControlWithFeedback: FC<FormControlWithFeedbackProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, InputHTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
export type BaseInputProps = {
|
|
4
|
+
size?: Size;
|
|
5
|
+
feedback?: 'error';
|
|
6
|
+
/**
|
|
7
|
+
* Whether the input should have an opinionated style or not. Defaults to 'default'.
|
|
8
|
+
* An unstyled input can be useful to wrap or customize.
|
|
9
|
+
*/
|
|
10
|
+
variant?: 'default' | 'unstyled';
|
|
11
|
+
};
|
|
12
|
+
export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'checked' | 'defaultChecked'> & BaseInputProps & {
|
|
13
|
+
borderless?: boolean;
|
|
14
|
+
ref?: Ref<HTMLInputElement>;
|
|
15
|
+
};
|
|
16
|
+
export declare const Input: FC<InputProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./Input').InputProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
argTypes: {
|
|
6
|
+
feedback: {
|
|
7
|
+
options: string[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Regular: Story;
|
|
14
|
+
export declare const Error: Story;
|
|
15
|
+
export declare const Disabled: Story;
|
|
16
|
+
export declare const Readonly: Story;
|
|
17
|
+
export declare const Unstyled: Story;
|
|
18
|
+
export declare const Number: Story;
|
|
19
|
+
export declare const Password: Story;
|
|
20
|
+
export declare const InCard: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./Label').LabelProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Regular: Story;
|
|
9
|
+
export declare const Required: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RequiredReactNode } from '../types';
|
|
3
|
+
import { FormControlWithFeedbackProps } from './FormControlWithFeedback';
|
|
4
|
+
import { InputProps } from './Input';
|
|
5
|
+
export type LabelledInputProps = Omit<InputProps, 'className' | 'id' | 'feedback'> & FormControlWithFeedbackProps & {
|
|
6
|
+
label: RequiredReactNode;
|
|
7
|
+
inputClassName?: string;
|
|
8
|
+
/** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
|
|
9
|
+
hiddenRequired?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* An input with a label linked to it
|
|
13
|
+
*/
|
|
14
|
+
export declare const LabelledInput: FC<LabelledInputProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./LabelledInput').LabelledInputProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Regular: Story;
|
|
9
|
+
export declare const Required: Story;
|
|
10
|
+
export declare const HiddenRequired: Story;
|
|
11
|
+
export declare const WithHelpText: Story;
|
|
12
|
+
export declare const Error: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RequiredReactNode } from '../types';
|
|
3
|
+
import { FormControlWithFeedbackProps } from './FormControlWithFeedback';
|
|
4
|
+
import { RevealablePasswordInputProps } from './RevealablePasswordInput';
|
|
5
|
+
export type LabelledRevealablePasswordInputProps = Omit<RevealablePasswordInputProps, 'className' | 'id' | 'feedback'> & FormControlWithFeedbackProps & {
|
|
6
|
+
label: RequiredReactNode;
|
|
7
|
+
inputClassName?: string;
|
|
8
|
+
/** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
|
|
9
|
+
hiddenRequired?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Same as the `LabelledInput`, but wrapping a `RevealablePasswordInput` instead
|
|
13
|
+
*/
|
|
14
|
+
export declare const LabelledRevealablePasswordInput: FC<LabelledRevealablePasswordInputProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./LabelledRevealablePasswordInput').LabelledRevealablePasswordInputProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Regular: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RequiredReactNode } from '../types';
|
|
3
|
+
import { FormControlWithFeedbackProps } from './FormControlWithFeedback';
|
|
4
|
+
import { SelectProps } from './Select';
|
|
5
|
+
export type LabelledSelectProps = Omit<SelectProps, 'className' | 'id'> & FormControlWithFeedbackProps & {
|
|
6
|
+
label: RequiredReactNode;
|
|
7
|
+
selectClassName?: string;
|
|
8
|
+
/** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
|
|
9
|
+
hiddenRequired?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const LabelledSelect: FC<LabelledSelectProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./LabelledSelect').LabelledSelectProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
argTypes: {
|
|
6
|
+
children: import('storybook/internal/csf').InputType;
|
|
7
|
+
error: {
|
|
8
|
+
type: "string";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Regular: Story;
|
|
15
|
+
export declare const Error: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InputProps } from './Input';
|
|
3
|
+
export type RevealablePasswordInputProps = Omit<InputProps, 'type'> & {
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A password input where the value can be manually revealed
|
|
8
|
+
*/
|
|
9
|
+
export declare const RevealablePasswordInput: FC<RevealablePasswordInputProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./RevealablePasswordInput').RevealablePasswordInputProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Regular: Story;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { SearchInputProps } from './SearchInput';
|
|
3
|
+
type BaseInputProps = Omit<SearchInputProps, 'role' | 'aria-autocomplete' | 'aria-expanded' | 'aria-controls' | 'aria-activedescendant' | 'onChange' | 'autoComplete' | 'autoCorrect'>;
|
|
4
|
+
export type SearchComboboxProps<Item> = BaseInputProps & {
|
|
5
|
+
/** If defined, it will display a listbox with the search results */
|
|
6
|
+
searchResults?: Map<string, Item>;
|
|
7
|
+
/** Invoked when the search input value changes */
|
|
8
|
+
onSearch: (searchTerm: string) => void;
|
|
9
|
+
/** Invoked when the active search result is selected */
|
|
10
|
+
onSelectSearchResult: (item: Item) => void;
|
|
11
|
+
/** To customize the look and feel of a search result */
|
|
12
|
+
renderSearchResult: (item: Item) => ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Determines how the listbox should span when visible.
|
|
15
|
+
* - `full`: Be always as big as the input, regardless its content.
|
|
16
|
+
* - `auto`: Take only the needed space to display its content, up to the width of the input.
|
|
17
|
+
*
|
|
18
|
+
* Defaults to `full`.
|
|
19
|
+
*/
|
|
20
|
+
listboxSpan?: 'full' | 'auto';
|
|
21
|
+
/** Classes to add to the wrapping container */
|
|
22
|
+
containerClassName?: string;
|
|
23
|
+
/** Classes to add to the listbox */
|
|
24
|
+
listboxClassName?: string;
|
|
25
|
+
ref?: Ref<HTMLInputElement>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* This component combines a `SearchInput` with a `Listbox`, to behave close to an editable combobox with autocomplete,
|
|
29
|
+
* as described in [Combobox Autocomplete List pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/).
|
|
30
|
+
* The main difference is that the input is used only to search in the listbox. Once an item is selected, the input is
|
|
31
|
+
* cleared and the listbox is closed.
|
|
32
|
+
*/
|
|
33
|
+
export declare function SearchCombobox<Item>({ searchResults, onSearch, onSelectSearchResult, renderSearchResult, size, // SearchInput defaults its size to 'lg'. Change it to 'md'
|
|
34
|
+
listboxSpan, onFocus, containerClassName, listboxClassName, ref, ...rest }: SearchComboboxProps<Item>): import("react").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: ({ searchResults, onSearch, onSelectSearchResult, renderSearchResult, size, listboxSpan, onFocus, containerClassName, listboxClassName, ref, ...rest }: import('./SearchCombobox').SearchComboboxProps<{
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}>) => import("react").JSX.Element;
|
|
7
|
+
tags: string[];
|
|
8
|
+
argTypes: {
|
|
9
|
+
size: import('storybook/internal/csf').InputType;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Sync: Story;
|
|
15
|
+
export declare const Async: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InputProps } from './Input';
|
|
3
|
+
export type SearchInputProps = Omit<InputProps, 'className' | 'onChange' | 'value'> & {
|
|
4
|
+
onChange: (searchTerm: string) => void;
|
|
5
|
+
containerClassName?: string;
|
|
6
|
+
inputClassName?: string;
|
|
7
|
+
/** When set to true, it displays a loading indicator in place of the magnifyinf glass icon */
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether onChange should be triggered immediately or debounced.
|
|
11
|
+
* Defaults to false.
|
|
12
|
+
*/
|
|
13
|
+
immediate?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const SearchInput: FC<SearchInputProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./SearchInput').SearchInputProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
argTypes: {
|
|
6
|
+
size: import('storybook/internal/csf').InputType;
|
|
7
|
+
variant: {
|
|
8
|
+
options: string[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Regular: Story;
|
|
15
|
+
export declare const Small: Story;
|
|
16
|
+
export declare const Medium: Story;
|
|
17
|
+
export declare const Large: Story;
|
|
18
|
+
export declare const Borderless: Story;
|
|
19
|
+
export declare const Loading: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, HTMLProps, PropsWithChildren, Ref } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
type SelectElementProps = Omit<HTMLProps<HTMLSelectElement>, 'size' | 'checked' | 'defaultChecked'>;
|
|
4
|
+
export type SelectProps = PropsWithChildren<SelectElementProps & BaseInputProps> & {
|
|
5
|
+
ref?: Ref<HTMLSelectElement>;
|
|
6
|
+
};
|
|
7
|
+
export declare const Select: FC<SelectProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { SelectProps } from './Select';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
component: import('react').FC<SelectProps>;
|
|
5
|
+
tags: string[];
|
|
6
|
+
argTypes: {
|
|
7
|
+
children: import('storybook/internal/csf').InputType;
|
|
8
|
+
size: import('storybook/internal/csf').InputType;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Regular: Story;
|
|
14
|
+
export declare const Error: Story;
|
|
15
|
+
export declare const Disabled: Story;
|
|
16
|
+
export declare const Small: Story;
|
|
17
|
+
export declare const Large: Story;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { SearchComboboxProps } from './SearchCombobox';
|
|
3
|
+
export type TagItemProps = {
|
|
4
|
+
name: string;
|
|
5
|
+
color: string;
|
|
6
|
+
};
|
|
7
|
+
export type TagsAutocompleteProps = {
|
|
8
|
+
/** Full list of tags from which to build the suggestions */
|
|
9
|
+
tags: string[];
|
|
10
|
+
/** Tags currently selected */
|
|
11
|
+
selectedTags?: string[];
|
|
12
|
+
/** Invoked when tags are added or removed */
|
|
13
|
+
onTagsChange?: (tags: string[]) => void;
|
|
14
|
+
/** Invoked to determine what is the color of a tag */
|
|
15
|
+
getColorForTag?: (tag: string) => string;
|
|
16
|
+
/** Search input placeholder */
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** Classes to be added to the wrapping container */
|
|
19
|
+
containerClassName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to allow adding new arbitrary tags, or only select from the list of tags.
|
|
22
|
+
* Defaults to false.
|
|
23
|
+
*/
|
|
24
|
+
immutable?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* How to filter the list of tags when searching:
|
|
27
|
+
* - `startsWith`: those that start with the search term
|
|
28
|
+
* - `includes`: those that include the search term
|
|
29
|
+
* Defaults to `startsWith`.
|
|
30
|
+
*/
|
|
31
|
+
searchMode?: 'startsWith' | 'includes';
|
|
32
|
+
} & Pick<SearchComboboxProps<string>, 'placeholder' | 'size' | 'disabled' | 'aria-label'>;
|
|
33
|
+
export declare const TagsAutocomplete: FC<TagsAutocompleteProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./TagsAutocomplete').TagsAutocompleteProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
argTypes: {
|
|
6
|
+
size: import('storybook/internal/csf').InputType;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const Regular: Story;
|
|
12
|
+
export declare const WithSelectedTags: Story;
|
|
13
|
+
export declare const WithCustomColors: Story;
|
|
14
|
+
export declare const SearchByIncludes: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./BooleanControl').BooleanControlProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Basic: Story;
|
|
9
|
+
export declare const InCard: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './Button';
|
|
2
|
+
export * from './Checkbox';
|
|
3
|
+
export * from './CloseButton';
|
|
4
|
+
export * from './Input';
|
|
5
|
+
export * from './Label';
|
|
6
|
+
export * from './LabelledInput';
|
|
7
|
+
export * from './LabelledRevealablePasswordInput';
|
|
8
|
+
export * from './LabelledSelect';
|
|
9
|
+
export * from './RevealablePasswordInput';
|
|
10
|
+
export * from './SearchCombobox';
|
|
11
|
+
export * from './SearchInput';
|
|
12
|
+
export * from './Select';
|
|
13
|
+
export * from './TagsAutocomplete';
|
|
14
|
+
export * from './ToggleSwitch';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ELLIPSIS = "...";
|
|
2
|
+
type Ellipsis = typeof ELLIPSIS;
|
|
3
|
+
export type NumberOrEllipsis = number | Ellipsis;
|
|
4
|
+
export declare const progressivePagination: (currentPage: number, pageCount: number) => NumberOrEllipsis[];
|
|
5
|
+
export declare const pageIsEllipsis: (pageNumber: NumberOrEllipsis) => pageNumber is Ellipsis;
|
|
6
|
+
export declare const prettifyPageNumber: (pageNumber: NumberOrEllipsis) => string;
|
|
7
|
+
export declare const keyForPage: (pageNumber: NumberOrEllipsis, index: number) => string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type ArrowKeyNavigationOptions = {
|
|
3
|
+
/** Query selector for focusable elements that need to be included in the loop */
|
|
4
|
+
elementsSelector: string;
|
|
5
|
+
/** Whether first focusable item should be focused or not. Defaults to false */
|
|
6
|
+
focusFirstItem?: boolean;
|
|
7
|
+
/** Enables up and down arrows navigation. Defaults to true */
|
|
8
|
+
vertical?: boolean;
|
|
9
|
+
/** Enables left and right arrows navigation. Defaults to true */
|
|
10
|
+
horizontal?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Allows focus navigation via arrow keys on the elements of a container.
|
|
14
|
+
*
|
|
15
|
+
* Initially, the first element with [data-selected=true] or the first globally, matching `elementsSelector`, will be
|
|
16
|
+
* focusable via Tab, then arrow keys need to be used to move through the sequence.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useArrowKeyNavigation(containerRef: RefObject<HTMLElement | null>, { elementsSelector, focusFirstItem, vertical, horizontal }: ArrowKeyNavigationOptions): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useGoBack: () => () => void | Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useParsedQuery: <T>() => T;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type TagsSearchOptions = {
|
|
2
|
+
/** Full list of tags to search on */
|
|
3
|
+
tags: string[];
|
|
4
|
+
/** Tags that are already selected, to ignore them while searching */
|
|
5
|
+
selectedTags: string[];
|
|
6
|
+
/** How to do the search term matching on tags, via `startsWith` or `includes` */
|
|
7
|
+
searchMode: 'startsWith' | 'includes';
|
|
8
|
+
/** Max amount of matching tags to return. Defaults to 5 */
|
|
9
|
+
searchLimit?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Whether new entries are allowed or not.
|
|
12
|
+
* When this is true, it will be allowed to add the search term verbatim in the search result.
|
|
13
|
+
*/
|
|
14
|
+
allowAdding?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type TagsSearchResult = {
|
|
17
|
+
/**
|
|
18
|
+
* A Map with the list of tags that match the search result, with the tag used both as key and value.
|
|
19
|
+
* Returned as a Map for convenience to use with SearchCombobox.
|
|
20
|
+
*
|
|
21
|
+
* When the search term is empty, `undefined` is returned, so that it is possible to differentiate a search producing
|
|
22
|
+
* no results from not currently performing a search at all.
|
|
23
|
+
*
|
|
24
|
+
* @see {SearchCombobox}
|
|
25
|
+
*/
|
|
26
|
+
searchResults: Map<string, string> | undefined;
|
|
27
|
+
/** A callback used to perform a search in the list of tags */
|
|
28
|
+
onSearch: (searchTerm: string) => void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Allows to search on a list of tags and only return the ones that match.
|
|
32
|
+
* Search can be done by `startsWith` or `includes`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useTagsSearch({ tags, selectedTags, searchMode, searchLimit, allowAdding }: TagsSearchOptions): TagsSearchResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type TimeoutToggleOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* What should the flag value be initially.
|
|
4
|
+
* This will drive the behavior of the callback, which will set the opposite value, and then go back to the initial
|
|
5
|
+
* value after a delay.
|
|
6
|
+
*
|
|
7
|
+
* Defaults to false.
|
|
8
|
+
*/
|
|
9
|
+
initialValue?: boolean;
|
|
10
|
+
/** Delay in ms after which the flag should return to its initial value. Defaults to 2000 */
|
|
11
|
+
delay?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const useTimeoutToggle: ({ initialValue, delay }?: TimeoutToggleOptions, setTimeout_?: typeof setTimeout, clearTimeout_?: typeof clearTimeout) => [boolean, () => void];
|
|
14
|
+
export type TimeoutToggle = typeof useTimeoutToggle;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Callback = () => unknown;
|
|
2
|
+
export type UseTimeoutResult = {
|
|
3
|
+
/**
|
|
4
|
+
* Clears any in-progress timeout, and schedules a new callback.
|
|
5
|
+
* It optionally allows a delay to be provided, or falls back to the default delay otherwise.
|
|
6
|
+
*/
|
|
7
|
+
setTimeout: (callback: Callback, delay?: number) => void;
|
|
8
|
+
/** Clears any in-progress timeout */
|
|
9
|
+
clearCurrentTimeout: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useTimeout(defaultDelay: number,
|
|
12
|
+
/** Test seam. Defaults to global setTimeout */
|
|
13
|
+
setTimeout_?: typeof globalThis.setTimeout,
|
|
14
|
+
/** Test seam. Defaults to global clearTimeout */
|
|
15
|
+
clearTimeout_?: typeof clearTimeout): UseTimeoutResult;
|