@shlinkio/shlink-frontend-kit 1.3.1 → 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 -1651
- package/dist/index.js +1311 -1647
- 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 +26 -20
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { RequiredReactNode, Size } from '../types';
|
|
3
|
+
export type DropdownProps = PropsWithChildren<{
|
|
4
|
+
buttonContent: RequiredReactNode;
|
|
5
|
+
buttonSize?: Size;
|
|
6
|
+
buttonClassName?: string;
|
|
7
|
+
buttonVariant?: 'button' | 'link' | 'text';
|
|
8
|
+
buttonDisabled?: boolean;
|
|
9
|
+
/** Set as the button's `aria-label` attribute */
|
|
10
|
+
buttonLabel?: string;
|
|
11
|
+
/** Classes to be set on the containing wrapper element */
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
/** Classes to be set on the menu element */
|
|
14
|
+
menuClassName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the menu should align with the right or the left side of the toggle button in case it is bigger.
|
|
17
|
+
* Defaults to 'left'.
|
|
18
|
+
*/
|
|
19
|
+
menuAlignment?: 'left' | 'right';
|
|
20
|
+
/** Distance between toggle button and menu when open, in pixels. Defaults to 3 */
|
|
21
|
+
menuOffset?: number;
|
|
22
|
+
/** Whether to hide the caret or not. Defaults to false */
|
|
23
|
+
caretless?: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const Dropdown: FC<DropdownProps> & {
|
|
26
|
+
Item: FC<import('./Menu').MenuItemProps>;
|
|
27
|
+
Separator: FC;
|
|
28
|
+
Title: FC<{
|
|
29
|
+
children?: import('react').ReactNode | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
Misc: FC<import('react').HTMLProps<HTMLDivElement>>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./Dropdown').DropdownProps> & {
|
|
4
|
+
Item: import('react').FC<import('./Menu').MenuItemProps>;
|
|
5
|
+
Separator: import('react').FC;
|
|
6
|
+
Title: import('react').FC<{
|
|
7
|
+
children?: import('react').ReactNode | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
Misc: import('react').FC<import('react').HTMLProps<HTMLDivElement>>;
|
|
10
|
+
};
|
|
11
|
+
tags: string[];
|
|
12
|
+
argTypes: {
|
|
13
|
+
buttonDisabled: import('storybook/internal/csf').InputType;
|
|
14
|
+
menuOffset: {
|
|
15
|
+
type: "number";
|
|
16
|
+
};
|
|
17
|
+
buttonSize: import('storybook/internal/csf').InputType;
|
|
18
|
+
buttonVariant: {
|
|
19
|
+
options: string[];
|
|
20
|
+
};
|
|
21
|
+
menuAlignment: {
|
|
22
|
+
options: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof meta>;
|
|
28
|
+
export declare const Base: Story;
|
|
29
|
+
export declare const MenuGrowsToButtonSize: Story;
|
|
30
|
+
export declare const RightAligned: Story;
|
|
31
|
+
export declare const Small: Story;
|
|
32
|
+
export declare const Large: Story;
|
|
33
|
+
export declare const Caretless: Story;
|
|
34
|
+
export declare const Link: Story;
|
|
35
|
+
export declare const Text: Story;
|
|
36
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, HTMLProps, Ref } from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
export type LinkButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size' | 'type'> & {
|
|
4
|
+
size?: Size;
|
|
5
|
+
type?: HTMLButtonElement['type'];
|
|
6
|
+
ref?: Ref<HTMLButtonElement>;
|
|
7
|
+
};
|
|
8
|
+
export declare const LinkButton: FC<LinkButtonProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./LinkButton').LinkButtonProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Medium: Story;
|
|
9
|
+
export declare const Small: Story;
|
|
10
|
+
export declare const Large: Story;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FC, HTMLProps } from 'react';
|
|
2
|
+
import { LinkProps } from 'react-router';
|
|
3
|
+
import { CardProps } from '../surfaces';
|
|
4
|
+
type ButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'role' | 'disabled' | 'aria-disabled' | 'tabIndex' | 'type'>;
|
|
5
|
+
type AnchorProps = Omit<LinkProps, 'role' | 'aria-disabled' | 'tabIndex' | 'type'>;
|
|
6
|
+
export type MenuItemProps = (ButtonProps | AnchorProps) & {
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type MenuProps = Omit<CardProps, 'role'> & {
|
|
11
|
+
/**
|
|
12
|
+
* Selector to determine elements that should be part of the focus sequence.
|
|
13
|
+
* Defaults to '[role="menuitem"]:not([disabled]):not([aria-disabled])'
|
|
14
|
+
*/
|
|
15
|
+
focusableElementsSelector?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Whether first focusable item should be focused or not.
|
|
18
|
+
* Defaults to false.
|
|
19
|
+
*/
|
|
20
|
+
focusFirstItem?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Optional callback invoked when a Menu.Item is clicked.
|
|
23
|
+
* If the Menu.Item has its own onClick, this callback will be called afterwards.
|
|
24
|
+
*/
|
|
25
|
+
onItemClick?: () => void;
|
|
26
|
+
};
|
|
27
|
+
export declare const Menu: FC<MenuProps> & {
|
|
28
|
+
Item: FC<MenuItemProps>;
|
|
29
|
+
Separator: FC;
|
|
30
|
+
Title: FC<{
|
|
31
|
+
children?: import('react').ReactNode | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
Misc: FC<HTMLProps<HTMLDivElement>>;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./Menu').MenuProps> & {
|
|
4
|
+
Item: import('react').FC<import('./Menu').MenuItemProps>;
|
|
5
|
+
Separator: import('react').FC;
|
|
6
|
+
Title: import('react').FC<{
|
|
7
|
+
children?: import('react').ReactNode | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
Misc: import('react').FC<import('react').HTMLProps<HTMLDivElement>>;
|
|
10
|
+
};
|
|
11
|
+
tags: string[];
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Base: Story;
|
|
16
|
+
export declare const WithLinksAndMiscItems: Story;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, HTMLProps } from 'react';
|
|
2
|
+
import { LinkProps } from 'react-router';
|
|
3
|
+
import { RequiredReactNode } from '../types';
|
|
4
|
+
import { DropdownProps } from './Dropdown';
|
|
5
|
+
type ItemProps = {
|
|
6
|
+
active?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type NavBarProps = HTMLProps<HTMLElement> & {
|
|
9
|
+
brand: RequiredReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare const BaseNavBar: FC<NavBarProps>;
|
|
12
|
+
export declare const NavBar: FC<NavBarProps> & {
|
|
13
|
+
MenuItem: FC<LinkProps & ItemProps>;
|
|
14
|
+
Dropdown: FC<Omit<DropdownProps, "menuAlignment" | "buttonVariant" | "menuOffset"> & ItemProps>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./NavBar').NavBarProps> & {
|
|
4
|
+
MenuItem: import('react').FC<import('react-router').LinkProps & {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
Dropdown: import('react').FC<Omit<import('./Dropdown').DropdownProps, "menuAlignment" | "buttonVariant" | "menuOffset"> & {
|
|
8
|
+
active?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
tags: string[];
|
|
12
|
+
argTypes: {
|
|
13
|
+
children: import('storybook/internal/csf').InputType;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
export declare const Base: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { LinkProps } from 'react-router';
|
|
3
|
+
export type PillProps = LinkProps;
|
|
4
|
+
export type NavPillsProps = PropsWithChildren<{
|
|
5
|
+
fill?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const NavPills: FC<NavPillsProps> & {
|
|
9
|
+
Pill: FC<LinkProps>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { NavPillsProps } from './NavPills';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
component: FC<NavPillsProps> & {
|
|
6
|
+
Pill: FC<import('react-router').LinkProps>;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const LeftAligned: Story;
|
|
13
|
+
export declare const Fill: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export type PaginatorProps = {
|
|
3
|
+
pagesCount: number;
|
|
4
|
+
currentPage: number;
|
|
5
|
+
} & ({
|
|
6
|
+
onPageChange: (currentPage: number) => void;
|
|
7
|
+
} | {
|
|
8
|
+
urlForPage: (pageNumber: number) => string;
|
|
9
|
+
});
|
|
10
|
+
export declare const Paginator: FC<PaginatorProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./Paginator').PaginatorProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
decorators: ((Story: import('storybook/internal/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
6
|
+
pagesCount: number;
|
|
7
|
+
currentPage: number;
|
|
8
|
+
onPageChange: (currentPage: number) => void;
|
|
9
|
+
} | {
|
|
10
|
+
pagesCount: number;
|
|
11
|
+
currentPage: number;
|
|
12
|
+
urlForPage: (pageNumber: number) => string;
|
|
13
|
+
}>) => import("react").JSX.Element)[];
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
export declare const ButtonBased: Story;
|
|
18
|
+
export declare const LinkBased: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DropdownProps } from './Dropdown';
|
|
3
|
+
export type RowDropdownProps = Omit<DropdownProps, 'caretless' | 'buttonContent' | 'buttonVariant'>;
|
|
4
|
+
export declare const RowDropdown: FC<RowDropdownProps> & {
|
|
5
|
+
Item: FC<import('./Menu').MenuItemProps>;
|
|
6
|
+
Separator: FC;
|
|
7
|
+
Title: FC<{
|
|
8
|
+
children?: import('react').ReactNode | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
Misc: FC<import('react').HTMLProps<HTMLDivElement>>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { RowDropdownProps } from './RowDropdown';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
component: import('react').FC<RowDropdownProps> & {
|
|
5
|
+
Item: import('react').FC<import('./Menu').MenuItemProps>;
|
|
6
|
+
Separator: import('react').FC;
|
|
7
|
+
Title: import('react').FC<{
|
|
8
|
+
children?: import('react').ReactNode | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
Misc: import('react').FC<import('react').HTMLProps<HTMLDivElement>>;
|
|
11
|
+
};
|
|
12
|
+
tags: string[];
|
|
13
|
+
argTypes: {
|
|
14
|
+
buttonLabel: {
|
|
15
|
+
type: "string";
|
|
16
|
+
};
|
|
17
|
+
buttonSize: import('storybook/internal/csf').InputType;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
export declare const Base: Story;
|
|
23
|
+
export declare const Small: Story;
|
|
24
|
+
export declare const Large: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Order } from '..';
|
|
2
|
+
import { DropdownProps } from '../navigation';
|
|
3
|
+
export type OrderingDropdownProps<T extends string = string> = Omit<DropdownProps, 'buttonContent'> & {
|
|
4
|
+
items: Record<T, string>;
|
|
5
|
+
order: Order<T>;
|
|
6
|
+
onChange: (newOrder: Order<T>) => void;
|
|
7
|
+
prefixed?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A dropdown specifically designed to determine order field and direction.
|
|
11
|
+
*/
|
|
12
|
+
export declare function OrderingDropdown<T extends string = string>({ items, order, onChange, prefixed, buttonVariant, ...rest }: OrderingDropdownProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { OrderingDropdown } from './OrderingDropdown';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
component: typeof OrderingDropdown;
|
|
5
|
+
tags: string[];
|
|
6
|
+
argTypes: {
|
|
7
|
+
buttonVariant: {
|
|
8
|
+
options: string[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Base: Story;
|
|
15
|
+
export declare const AsLink: Story;
|
|
16
|
+
export declare const AsText: Story;
|
|
17
|
+
export declare const NonPrefixed: Story;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type OrderDir = 'ASC' | 'DESC' | undefined;
|
|
2
|
+
export type Order<Fields> = {
|
|
3
|
+
field?: Fields;
|
|
4
|
+
dir?: OrderDir;
|
|
5
|
+
};
|
|
6
|
+
export type OrderDirChange<Fields extends string = string> = {
|
|
7
|
+
currentField?: Fields;
|
|
8
|
+
newField?: Fields;
|
|
9
|
+
currentOrderDir?: OrderDir;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Generate an Order dir for the new order field, based on previous order field and direction.
|
|
13
|
+
*/
|
|
14
|
+
export declare function determineOrderDir<Fields extends string = string>(orderDirChange: OrderDirChange<Fields>): OrderDir;
|
|
15
|
+
/**
|
|
16
|
+
* Generate an Order object for the new order field, based on previous order field and direction.
|
|
17
|
+
*/
|
|
18
|
+
export declare function determineOrder<Fields extends string = string>(orderDirChange: OrderDirChange<Fields>): Order<Fields>;
|
|
19
|
+
export declare const sortList: <List>(list: List[], { field, dir }: Order<keyof List>) => List[];
|
|
20
|
+
/**
|
|
21
|
+
* Convert provided order object to string, with the pattern `${order.field}-${order.di}`.
|
|
22
|
+
* @return - A `string` if the `dir` prop is set, `undefined` otherwise.
|
|
23
|
+
*/
|
|
24
|
+
export declare const orderToString: <T>(order: Order<T>) => string | undefined;
|
|
25
|
+
export declare const stringToOrder: <T>(order: string) => Order<T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./Card').CardProps> & {
|
|
4
|
+
Body: import('react').FC<import('./Card').CardProps>;
|
|
5
|
+
Header: import('react').FC<import('./Card').CardProps>;
|
|
6
|
+
Footer: import('react').FC<import('./Card').CardProps>;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const Base: Story;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
import { CardProps } from './Card';
|
|
4
|
+
type TitleProps = {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
titleSize?: Size;
|
|
7
|
+
};
|
|
8
|
+
type NoTitleProps = {
|
|
9
|
+
title?: never;
|
|
10
|
+
titleSize?: never;
|
|
11
|
+
};
|
|
12
|
+
export type SimpleCardProps = Omit<CardProps, 'title' | 'size'> & {
|
|
13
|
+
bodyClassName?: string;
|
|
14
|
+
} & (TitleProps | NoTitleProps);
|
|
15
|
+
export declare const SimpleCard: FC<SimpleCardProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./SimpleCard').SimpleCardProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Base: Story;
|
|
9
|
+
export declare const SmallTitle: Story;
|
|
10
|
+
export declare const LargeTitle: Story;
|
|
11
|
+
export declare const NoTitle: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const BRAND_COLOR_DM = "#4696e5";
|
|
2
|
+
export declare const BRAND_COLOR_ALPHA_DM = "rgba(70, 150, 229, 0.4)";
|
|
3
|
+
export declare const BRAND_COLOR_LM = "#2078CF";
|
|
4
|
+
export declare const BRAND_COLOR_ALPHA_LM = "rgba(32, 120, 207, 0.4)";
|
|
5
|
+
export declare const brandColor: () => "#4696e5" | "#2078CF";
|
|
6
|
+
export declare const brandColorAlpha: () => "rgba(70, 150, 229, 0.4)" | "rgba(32, 120, 207, 0.4)";
|
|
7
|
+
export declare const HIGHLIGHTED_COLOR = "#f77f28";
|
|
8
|
+
export declare const HIGHLIGHTED_COLOR_ALPHA = "rgba(247, 127, 40, 0.4)";
|
|
9
|
+
export declare const PRIMARY_LIGHT_COLOR = "white";
|
|
10
|
+
export declare const PRIMARY_DARK_COLOR = "#161b22";
|
|
11
|
+
export type Theme = 'dark' | 'light';
|
|
12
|
+
export declare const changeThemeInMarkup: (theme: Theme) => void | undefined;
|
|
13
|
+
export declare const isDarkThemeEnabled: () => boolean;
|
|
14
|
+
export declare const getSystemPreferredTheme: (_matchMedia?: ((query: string) => MediaQueryList) & typeof matchMedia) => Theme;
|
|
15
|
+
export declare const useTheme: (initialTheme?: Theme) => readonly [Theme, import('react').Dispatch<import('react').SetStateAction<Theme>>];
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, HTMLProps } from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
export type CopyToClipboardButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'type' | 'onClick' | 'size'> & {
|
|
4
|
+
/** Text to be copied when the button is clicked */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Size of the button. Defaults to `lg` */
|
|
7
|
+
size?: Size;
|
|
8
|
+
/** Test seam */
|
|
9
|
+
initialCopied?: boolean;
|
|
10
|
+
/** Test seam */
|
|
11
|
+
navigator_?: typeof globalThis.navigator;
|
|
12
|
+
};
|
|
13
|
+
export declare const CopyToClipboardButton: FC<CopyToClipboardButtonProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: import('react').FC<import('./CopyToClipboardButton').CopyToClipboardButtonProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Base: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if a color is light or not, based on its perceived lightness.
|
|
3
|
+
*
|
|
4
|
+
* For an RGB color, lightness is represented as a number from 0 to 256.
|
|
5
|
+
* The lower the number, the darker is the color perceived.
|
|
6
|
+
*
|
|
7
|
+
* HSP by Darel Rex Finley https://alienryderflex.com/hsp.html
|
|
8
|
+
*/
|
|
9
|
+
export declare function isLightColor(colorHex: string): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses provided query string into an object.
|
|
3
|
+
* Parameters ending with "[]" will be considered arrays and returned as a single prop with all values.
|
|
4
|
+
*/
|
|
5
|
+
export declare const parseQueryString: <T>(search: string) => T;
|
|
6
|
+
/**
|
|
7
|
+
* Stringify an object of query parameters.
|
|
8
|
+
* Keys explicitly defined with undefined value will be skipped.
|
|
9
|
+
* Arrays will be appended multiple times with the "[]" suffix in the param name.
|
|
10
|
+
* All values are cast to string.
|
|
11
|
+
*/
|
|
12
|
+
export declare const stringifyQueryParams: (params: Record<string, unknown | unknown[] | undefined>) => string;
|
package/package.json
CHANGED
|
@@ -28,14 +28,15 @@
|
|
|
28
28
|
"build": "vite build && cp ./src/tailwind.preset.css ./dist/tailwind.preset.css",
|
|
29
29
|
"test": "vitest run",
|
|
30
30
|
"test:ci": "npm run test -- --coverage",
|
|
31
|
-
"lint": "eslint
|
|
31
|
+
"lint": "eslint src test .storybook",
|
|
32
32
|
"lint:fix": "npm run lint -- --fix",
|
|
33
33
|
"types": "tsc",
|
|
34
|
-
"
|
|
34
|
+
"storybook": "storybook dev -p 3001",
|
|
35
|
+
"storybook:build": "storybook build"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@floating-ui/react": "^0.27.
|
|
38
|
-
"@vitest/browser-playwright": "^4.
|
|
38
|
+
"@floating-ui/react": "^0.27.19",
|
|
39
|
+
"@vitest/browser-playwright": "^4.1.9",
|
|
39
40
|
"clsx": "^2.1.1"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"@fortawesome/react-fontawesome": "^3.0.0",
|
|
48
49
|
"react": "^19.1",
|
|
49
50
|
"react-dom": "^19.1",
|
|
50
|
-
"react-router": "^7.0.2",
|
|
51
|
+
"react-router": "^8.0.1 || ^7.0.2",
|
|
51
52
|
"tailwindcss": "^4.0.1"
|
|
52
53
|
},
|
|
53
54
|
"peerDependenciesMeta": {
|
|
@@ -57,31 +58,36 @@
|
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@shlinkio/eslint-config-js-coding-standard": "~3.7.0",
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
61
|
+
"@storybook/addon-docs": "^10.4.6",
|
|
62
|
+
"@storybook/react-vite": "^10.4.6",
|
|
63
|
+
"@stylistic/eslint-plugin": "^5.7.1",
|
|
64
|
+
"@tailwindcss/vite": "^4.3.1",
|
|
62
65
|
"@testing-library/jest-dom": "^6.9.1",
|
|
63
|
-
"@testing-library/react": "^16.3.
|
|
66
|
+
"@testing-library/react": "^16.3.2",
|
|
64
67
|
"@testing-library/user-event": "^14.6.1",
|
|
65
68
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
66
|
-
"@types/
|
|
67
|
-
"@types/react
|
|
68
|
-
"@
|
|
69
|
+
"@types/node": "^26.0.0",
|
|
70
|
+
"@types/react": "^19.2.17",
|
|
71
|
+
"@types/react-dom": "^19.2.3",
|
|
72
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
69
73
|
"@vitest/browser": "^4.0.3",
|
|
70
|
-
"@vitest/coverage-v8": "^4.
|
|
71
|
-
"axe-core": "^4.
|
|
72
|
-
"eslint": "^9.39.
|
|
74
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
75
|
+
"axe-core": "^4.12.1",
|
|
76
|
+
"eslint": "^9.39.2",
|
|
73
77
|
"eslint-plugin-import": "^2.32.0",
|
|
74
78
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
75
79
|
"eslint-plugin-react": "^7.37.5",
|
|
76
80
|
"eslint-plugin-react-compiler": "^19.0.0-beta-714736e-20250131",
|
|
77
81
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
78
82
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
83
|
+
"eslint-plugin-storybook": "^10.2.10",
|
|
79
84
|
"history": "^5.3.0",
|
|
80
|
-
"playwright": "^1.
|
|
81
|
-
"
|
|
82
|
-
"typescript
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
+
"playwright": "^1.61.0",
|
|
86
|
+
"storybook": "^10.3.6",
|
|
87
|
+
"typescript": "^6.0.3",
|
|
88
|
+
"typescript-eslint": "^8.58.0",
|
|
89
|
+
"unplugin-dts": "^1.0.2",
|
|
90
|
+
"vite": "^8.0.16",
|
|
85
91
|
"vitest": "^4.0.3"
|
|
86
92
|
},
|
|
87
93
|
"browserslist": [
|
|
@@ -90,5 +96,5 @@
|
|
|
90
96
|
"not ie <= 11",
|
|
91
97
|
"not op_mini all"
|
|
92
98
|
],
|
|
93
|
-
"version": "1.
|
|
99
|
+
"version": "1.5.0"
|
|
94
100
|
}
|