@shlinkio/shlink-frontend-kit 0.7.2 → 0.8.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.
@@ -0,0 +1,224 @@
1
+ import { FC } from 'react';
2
+ import { HTMLProps } from 'react';
3
+ import { InputHTMLAttributes } from 'react';
4
+ import { LinkProps } from 'react-router';
5
+ import { PropsWithChildren } from 'react';
6
+ import { ReactNode } from 'react';
7
+
8
+ export declare type BaseInputProps = {
9
+ size?: Size;
10
+ feedback?: 'error';
11
+ };
12
+
13
+ export declare const Button: FC<ButtonProps>;
14
+
15
+ export declare type ButtonProps = PropsWithChildren<{
16
+ disabled?: boolean;
17
+ className?: string;
18
+ variant?: 'primary' | 'secondary' | 'danger';
19
+ size?: Size;
20
+ inline?: boolean;
21
+ solid?: boolean;
22
+ } & (RegularButtonProps | LinkButtonProps_2)>;
23
+
24
+ export declare type Callback = () => unknown;
25
+
26
+ export declare const Card: FC<CardProps> & {
27
+ Body: FC<CardProps>;
28
+ Header: FC<CardProps>;
29
+ Footer: FC<CardProps>;
30
+ };
31
+
32
+ export declare type CardProps = HTMLProps<HTMLDivElement>;
33
+
34
+ export declare type CellProps = HTMLProps<HTMLTableCellElement> & {
35
+ /**
36
+ * The name of the column to be displayed in small resolutions when the table is responsive, where the cells collapse.
37
+ * It is ignored for non-responsive tables.
38
+ */
39
+ columnName?: string;
40
+ /**
41
+ * Whether to use a th or td tag. If not provided, it is inferred based on the section, using td when inside tbody,
42
+ * and th when inside thead or tfoot
43
+ */
44
+ type?: 'td' | 'th';
45
+ };
46
+
47
+ export declare const CloseButton: FC<CloseButtonProps>;
48
+
49
+ export declare type CloseButtonProps = {
50
+ label?: string;
51
+ onClick?: HTMLProps<HTMLButtonElement>['onClick'];
52
+ };
53
+
54
+ declare type CommonModalDialogProps = {
55
+ open: boolean;
56
+ size?: Size | 'xl' | 'full';
57
+ /** Modal header title */
58
+ title: string;
59
+ /** Invoked when the modal is closed for any reason */
60
+ onClose?: () => void;
61
+ };
62
+
63
+ declare type CoverModalDialogProps = CommonModalDialogProps & {
64
+ /**
65
+ * Cover dialogs have a body that span the whole dialog, and no buttons.
66
+ * The header overlaps the body with semi-transparent background.
67
+ */
68
+ variant: 'cover';
69
+ };
70
+
71
+ export declare const ELLIPSIS = "...";
72
+
73
+ declare type Ellipsis = typeof ELLIPSIS;
74
+
75
+ export declare const formatNumber: (number: number | string) => string;
76
+
77
+ export declare const Input: FC<InputProps>;
78
+
79
+ export declare type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & BaseInputProps & {
80
+ borderless?: boolean;
81
+ };
82
+
83
+ export declare const keyForPage: (pageNumber: NumberOrEllipsis, index: number) => string;
84
+
85
+ export declare const Label: FC<LabelProps>;
86
+
87
+ export declare const LabelledInput: FC<LabelledInputProps>;
88
+
89
+ export declare type LabelledInputProps = Omit<InputProps, 'className' | 'id' | 'feedback'> & {
90
+ label: string;
91
+ inputClassName?: string;
92
+ error?: string;
93
+ /** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
94
+ hiddenRequired?: boolean;
95
+ };
96
+
97
+ export declare const LabelledSelect: FC<LabelledSelectProps>;
98
+
99
+ export declare type LabelledSelectProps = Omit<SelectProps, 'className' | 'id'> & {
100
+ label: string;
101
+ selectClassName?: string;
102
+ /** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
103
+ hiddenRequired?: boolean;
104
+ };
105
+
106
+ export declare type LabelProps = HTMLProps<HTMLLabelElement> & {
107
+ required?: boolean;
108
+ };
109
+
110
+ export declare const LinkButton: FC<LinkButtonProps>;
111
+
112
+ export declare type LinkButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size' | 'type'> & {
113
+ size?: Size;
114
+ type?: HTMLButtonElement['type'];
115
+ };
116
+
117
+ declare type LinkButtonProps_2 = LinkProps;
118
+
119
+ export declare const ModalDialog: FC<ModalDialogProps>;
120
+
121
+ export declare type ModalDialogProps = Omit<HTMLProps<HTMLDialogElement>, 'title' | 'size'> & (CoverModalDialogProps | RegularModalDialogProps);
122
+
123
+ declare type NoTitleProps = {
124
+ title?: never;
125
+ titleSize?: never;
126
+ };
127
+
128
+ export declare type NumberOrEllipsis = number | Ellipsis;
129
+
130
+ export declare const pageIsEllipsis: (pageNumber: NumberOrEllipsis) => pageNumber is Ellipsis;
131
+
132
+ export declare const Paginator: FC<PaginatorProps>;
133
+
134
+ export declare type PaginatorProps = {
135
+ pagesCount: number;
136
+ currentPage: number;
137
+ } & ({
138
+ onPageChange: (currentPage: number) => void;
139
+ } | {
140
+ urlForPage: (pageNumber: number) => string;
141
+ });
142
+
143
+ export declare const prettifyPageNumber: (pageNumber: NumberOrEllipsis) => string;
144
+
145
+ export declare const progressivePagination: (currentPage: number, pageCount: number) => NumberOrEllipsis[];
146
+
147
+ declare type RegularButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size'>;
148
+
149
+ declare type RegularModalDialogProps = CommonModalDialogProps & {
150
+ /** Danger dialogs use danger variants in title and confirm button */
151
+ variant?: 'default' | 'danger';
152
+ /** Value to display in confirm button. Defaults to 'Confirm' */
153
+ confirmText?: string;
154
+ /** Invoked when the modal is closed via confirm button */
155
+ onConfirm?: () => void;
156
+ };
157
+
158
+ export declare const roundTen: (number: number) => number;
159
+
160
+ export declare const SearchInput: FC<SearchInputProps>;
161
+
162
+ export declare type SearchInputProps = Omit<InputProps, 'className' | 'onChange' | 'value'> & {
163
+ onChange: (searchTerm: string) => void;
164
+ containerClassName?: string;
165
+ inputClassName?: string;
166
+ };
167
+
168
+ export declare type SectionType = 'head' | 'body' | 'footer';
169
+
170
+ export declare const Select: FC<SelectProps>;
171
+
172
+ declare type SelectElementProps = Omit<HTMLProps<HTMLSelectElement>, 'size'>;
173
+
174
+ export declare type SelectProps = PropsWithChildren<SelectElementProps & BaseInputProps>;
175
+
176
+ export declare const SimpleCard: FC<SimpleCardProps>;
177
+
178
+ export declare type SimpleCardProps = Omit<CardProps, 'title' | 'size'> & {
179
+ bodyClassName?: string;
180
+ } & (TitleProps | NoTitleProps);
181
+
182
+ declare type Size = 'sm' | 'md' | 'lg';
183
+
184
+ export declare const Table: FC<TableProps> & {
185
+ Row: FC<HTMLProps<HTMLTableRowElement>>;
186
+ Cell: FC<CellProps>;
187
+ };
188
+
189
+ export declare type TableElementProps = PropsWithChildren & {
190
+ className?: string;
191
+ };
192
+
193
+ export declare type TableProps = HTMLProps<HTMLTableElement> & {
194
+ header: ReactNode;
195
+ footer?: ReactNode;
196
+ /**
197
+ * By default, the table rows will collapse under large resolutions, and the headers will be hidden.
198
+ * Set `responsive={false}` to avoid this behavior.
199
+ */
200
+ responsive?: boolean;
201
+ };
202
+
203
+ declare type TitleProps = {
204
+ title: ReactNode;
205
+ titleSize?: Size;
206
+ };
207
+
208
+ export declare function useTimeout(defaultDelay: number,
209
+ /** Test seam. Defaults to global setTimeout */
210
+ setTimeout_?: typeof globalThis.setTimeout,
211
+ /** Test seam. Defaults to global clearTimeout */
212
+ clearTimeout_?: typeof clearTimeout): UseTimeoutResult;
213
+
214
+ export declare type UseTimeoutResult = {
215
+ /**
216
+ * Clears any in-progress timeout, and schedules a new callback.
217
+ * It optionally allows a delay to be provided, or falls back to the default delay otherwise.
218
+ */
219
+ setTimeout: (callback: Callback, delay?: number) => void;
220
+ /** Clears any in-progress timeout */
221
+ clearCurrentTimeout: () => void;
222
+ };
223
+
224
+ export { }