smartsell-ui-kit 0.1.13 → 0.1.15

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/index.d.cts CHANGED
@@ -1,392 +1,22 @@
1
+ import { C as ControlSize } from './types-ENHTzCG6.cjs';
2
+ export { B as Button, a as ButtonProps, b as Card, c as CardProps, d as CardSmall, e as CardSmallProps, f as Checkbox, g as CheckboxProps, h as ComposableModal, i as ComposableModalProps, j as ComposableModalSlotRenderProps, k as ComposableModalSlotRenderer, D as DatePicker, l as DatePickerChangeContext, m as DatePickerChangeReason, n as DatePickerMode, o as DatePickerProps, p as DatePickerValue, I as Input, q as InputProps, M as Modal, r as ModalAction, s as ModalProps, t as ModalSlotContext, u as ModalSlotIds, v as ModalTheme, w as ModalThemeSource, S as Select, x as SelectAsync, y as SelectAsyncLoadContext, z as SelectAsyncLoadResult, A as SelectAsyncOption, E as SelectAsyncOptionValue, F as SelectAsyncProps, G as SelectProps, H as Separator, J as SeparatorOrientation, K as SeparatorProps, L as SharedTableProps, N as StandardModalProps, T as Table, O as TableAction, P as TableActionSource, Q as TableActionTone, R as TableAsync, U as TableAsyncLoadContext, V as TableAsyncLoadResult, W as TableAsyncProps, X as TableColumn, Y as TableColumnAlign, Z as TableColumnType, _ as TableLabels, $ as TableProps, a0 as Textarea, a1 as TextareaProps, a2 as UiKitTheme, a3 as createModalSlotIds, a4 as useUiKitTheme } from './types-ENHTzCG6.cjs';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ButtonHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties, InputHTMLAttributes, Ref, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
- import { SmartSellTheme, ThemeColors } from 'smartsell-theme';
4
-
5
- type ControlSize = 'sm' | 'md' | 'lg';
6
-
7
- declare const UI_KIT_THEME_COLOR_NAMES: readonly ["primary", "primaryLight", "primaryDark", "shadow", "secondary", "background", "surface", "text", "textLight", "positive", "negative", "warning", "info", "onPrimary", "onSecondary"];
8
- type UiKitThemeColorName = (typeof UI_KIT_THEME_COLOR_NAMES)[number];
9
- type UiKitThemeColors = {
10
- [key in UiKitThemeColorName]: ThemeColors[key];
11
- };
12
- interface UiKitTheme extends Omit<SmartSellTheme, 'title' | 'colors' | 'color'> {
13
- title: SmartSellTheme['title'];
14
- colors: UiKitThemeColors;
15
- color: UiKitThemeColors;
16
- }
17
- declare function useUiKitTheme(): UiKitTheme;
18
-
19
- type LegacyVariant = 'primary';
20
- type ButtonVariant = 'solid' | 'secondary' | 'outline' | 'ghost' | 'negative' | LegacyVariant;
21
- type ButtonSize = ControlSize;
22
- interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'dangerouslySetInnerHTML'> {
23
- variant?: ButtonVariant;
24
- size?: ButtonSize;
25
- leadingIcon?: ReactNode;
26
- trailingIcon?: ReactNode;
27
- }
28
- declare function Button({ variant, size, leadingIcon, trailingIcon, children, disabled, className, style, type, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
29
-
30
- interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML' | 'title'> {
31
- children: ReactNode;
32
- eyebrow?: ReactNode;
33
- title?: ReactNode;
34
- action?: ReactNode;
35
- padded?: boolean;
36
- }
37
- declare function Card({ children, eyebrow, title, action, padded, className, ...rest }: CardProps): react_jsx_runtime.JSX.Element;
38
-
39
- interface CardSmallProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML' | 'title' | 'color'> {
40
- title?: ReactNode;
41
- value?: ReactNode;
42
- icon?: ReactNode;
4
+ import { HTMLAttributes, CSSProperties } from 'react';
5
+ import 'smartsell-theme';
6
+
7
+ type LoadingSize = ControlSize | number;
8
+ interface LoadingProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML' | 'color'> {
9
+ /** Rendered size of the animation. Named sizes map to 28 / 40 / 56 px. */
10
+ size?: LoadingSize;
11
+ /** Overrides the animation color. Defaults to the theme primary. */
43
12
  color?: CSSProperties['color'];
13
+ /** Optional caption rendered under the animation. */
14
+ label?: string;
15
+ /** Text announced by screen readers when no visible `label` is provided. */
16
+ accessibleLabel?: string;
17
+ /** Animation speed multiplier: 2 runs twice as fast, 0.5 runs at half speed. */
18
+ speed?: number;
44
19
  }
45
- declare function CardSmall({ title, value, icon, color, className, style, ...rest }: CardSmallProps): react_jsx_runtime.JSX.Element;
46
-
47
- interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dangerouslySetInnerHTML' | 'size' | 'type'> {
48
- label?: ReactNode;
49
- hint?: ReactNode;
50
- error?: ReactNode;
51
- size?: ControlSize;
52
- indeterminate?: boolean;
53
- }
54
- declare function Checkbox({ label, hint, error, size, id, checked, defaultChecked, disabled, indeterminate, required, className, style, onChange, onFocus, onBlur, ...rest }: CheckboxProps): react_jsx_runtime.JSX.Element;
55
-
56
- interface ModalSlotIds {
57
- header: string;
58
- body: string;
59
- footer: string;
60
- }
61
- interface ModalSlotContext<TPayload = unknown> {
62
- title: string;
63
- payload?: TPayload;
64
- close: () => void;
65
- confirm?: () => void;
66
- confirmLabel: string;
67
- cancelLabel: string;
68
- isOpen: boolean;
69
- isBusy: boolean;
70
- }
71
- interface ComposableModalSlotRenderProps<TPayload = unknown> {
72
- id: string;
73
- context: ModalSlotContext<TPayload>;
74
- children?: ReactNode;
75
- }
76
- type ComposableModalSlotRenderer<TPayload = unknown> = (props: ComposableModalSlotRenderProps<TPayload>) => ReactNode;
77
- interface ComposableModalProps<TPayload = unknown> {
78
- isOpen: boolean;
79
- onClose: () => void;
80
- title: string;
81
- slotBaseId: string;
82
- renderSlot?: ComposableModalSlotRenderer<TPayload>;
83
- payload?: TPayload;
84
- onConfirm?: () => void;
85
- confirmLabel?: string;
86
- cancelLabel?: string;
87
- isBusy?: boolean;
88
- closeOnBackdrop?: boolean;
89
- closeOnEscape?: boolean;
90
- hideExpandButton?: boolean;
91
- maximized?: boolean;
92
- hideDefaultFooter?: boolean;
93
- maxWidth?: number | string;
94
- headerFallback?: ReactNode;
95
- footerFallback?: ReactNode;
96
- children?: ReactNode;
97
- }
98
- declare const createModalSlotIds: (slotBaseId: string) => ModalSlotIds;
99
- declare function ComposableModal<TPayload = unknown>({ isOpen, onClose, title, slotBaseId, renderSlot, payload, onConfirm, confirmLabel, cancelLabel, isBusy, closeOnBackdrop, closeOnEscape, hideExpandButton, maximized, hideDefaultFooter, maxWidth, headerFallback, footerFallback, children, }: ComposableModalProps<TPayload>): react_jsx_runtime.JSX.Element;
100
-
101
- interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dangerouslySetInnerHTML' | 'size'> {
102
- label?: ReactNode;
103
- hint?: ReactNode;
104
- error?: ReactNode;
105
- size?: ControlSize;
106
- showPasswordToggle?: boolean;
107
- fileButtonLabel?: ReactNode;
108
- icon?: ReactNode;
109
- disableFloatingLabel?: boolean;
110
- ref?: Ref<HTMLInputElement>;
111
- }
112
- declare function Input({ label, hint, error, size, className, showPasswordToggle, fileButtonLabel, icon, id, disabled, placeholder, onChange, style, type, disableFloatingLabel, ...rest }: InputProps): react_jsx_runtime.JSX.Element;
113
-
114
- type DatePickerMode = 'date' | 'datetime';
115
- type DatePickerValue = string | Date | null;
116
- type DatePickerChangeReason = 'input' | 'picker' | 'clear';
117
- interface DatePickerChangeContext {
118
- reason: DatePickerChangeReason;
119
- date: Date | null;
120
- nativeValue: string;
121
- displayValue: string;
122
- }
123
- interface DatePickerProps extends Omit<InputProps, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> {
124
- label?: ReactNode;
125
- hint?: ReactNode;
126
- error?: ReactNode;
127
- value?: DatePickerValue;
128
- defaultValue?: DatePickerValue;
129
- onChange?: (value: string | null, context: DatePickerChangeContext) => void;
130
- mode?: DatePickerMode;
131
- format?: string;
132
- allowPastDates?: boolean;
133
- allowFutureDates?: boolean;
134
- minDate?: DatePickerValue;
135
- maxDate?: DatePickerValue;
136
- minuteStep?: number;
137
- clearable?: boolean;
138
- showPickerButton?: boolean;
139
- isDateUnavailable?: (date: Date) => boolean;
140
- invalidDateMessage?: ReactNode;
141
- unavailableDateMessage?: ReactNode;
142
- pickerButtonLabel?: string;
143
- clearButtonLabel?: string;
144
- }
145
- declare function DatePicker({ value, defaultValue, onChange, mode, minDate, maxDate, minuteStep, placeholder, ...props }: DatePickerProps): react_jsx_runtime.JSX.Element;
146
-
147
- type ModalActionAppearance = 'text' | 'outlined' | 'contained' | 'link';
148
- type ModalThemeColors = {
149
- background: string;
150
- surface: string;
151
- text: string;
152
- textLight: string;
153
- primary: string;
154
- onPrimary: string;
155
- secondary: string;
156
- onSecondary: string;
157
- negative: string;
158
- warning: string;
159
- };
160
- interface ModalTheme {
161
- colors?: Partial<ModalThemeColors>;
162
- }
163
- type ModalThemeSource = ModalTheme | UiKitTheme;
164
- interface ModalAction {
165
- label: ReactNode;
166
- onClick: () => void;
167
- appearance?: ModalActionAppearance;
168
- style?: CSSProperties;
169
- disabled?: boolean;
170
- hidden?: boolean;
171
- }
172
- interface BaseModalProps {
173
- children?: ReactNode;
174
- theme?: ModalThemeSource;
175
- }
176
- interface ModalProps extends BaseModalProps {
177
- isOpen: boolean;
178
- onClose: () => void;
179
- title?: ReactNode;
180
- headerContent?: ReactNode;
181
- footer?: ReactNode;
182
- confirmAction?: ModalAction;
183
- cancelAction?: ModalAction;
184
- closeAction?: ModalAction;
185
- extraActions?: ModalAction[];
186
- maxWidth?: number | string;
187
- closeOnBackdrop?: boolean;
188
- closeOnEscape?: boolean;
189
- hideCloseButton?: boolean;
190
- hideExpandButton?: boolean;
191
- disableDismiss?: boolean;
192
- maximized?: boolean;
193
- contentStyle?: CSSProperties;
194
- bodyStyle?: CSSProperties;
195
- isBusy?: boolean;
196
- }
197
- type StandardModalProps = ModalProps;
198
- declare function Modal(props: ModalProps): react_jsx_runtime.JSX.Element;
199
-
200
- type SeparatorOrientation = 'vertical' | 'horizontal';
201
- interface SeparatorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML' | 'color'> {
202
- orientation?: SeparatorOrientation;
203
- color?: CSSProperties['backgroundColor'];
204
- size?: CSSProperties['width'];
205
- }
206
- declare function Separator({ orientation, color, size, className, style, ...rest }: SeparatorProps): react_jsx_runtime.JSX.Element;
207
-
208
- interface SharedSelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'dangerouslySetInnerHTML' | 'size'> {
209
- label?: ReactNode;
210
- hint?: ReactNode;
211
- error?: ReactNode;
212
- placeholder?: ReactNode;
213
- size?: ControlSize;
214
- isMulti?: boolean;
215
- isFilterable?: boolean;
216
- }
217
-
218
- type SelectOption = {
219
- label: string;
220
- value: string;
221
- };
222
- interface SelectProps extends SharedSelectProps {
223
- children?: ReactNode;
224
- options?: SelectOption[];
225
- }
226
- declare function Select({ children, options, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
227
-
228
- type SelectObjectOptionValue = string | number;
229
- interface SelectObjectOption<TValue extends SelectObjectOptionValue = SelectObjectOptionValue> {
230
- value: TValue;
231
- label: ReactNode;
232
- disabled?: boolean;
233
- group?: ReactNode;
234
- }
235
-
236
- type SelectAsyncOptionValue = SelectObjectOptionValue;
237
- type SelectAsyncOption<TValue extends SelectAsyncOptionValue = SelectAsyncOptionValue> = SelectObjectOption<TValue>;
238
- interface SelectAsyncLoadContext {
239
- page: number;
240
- signal: AbortSignal;
241
- }
242
- interface SelectAsyncLoadResult<TValue extends SelectAsyncOptionValue = SelectAsyncOptionValue> {
243
- options: Array<SelectAsyncOption<TValue>>;
244
- hasMore?: boolean;
245
- }
246
- type SelectAsyncSingleValue<TValue extends SelectAsyncOptionValue> = SelectAsyncOption<TValue> | null;
247
- type SelectAsyncMultiValue<TValue extends SelectAsyncOptionValue> = Array<SelectAsyncOption<TValue>>;
248
- type SelectAsyncValue<TValue extends SelectAsyncOptionValue> = SelectAsyncSingleValue<TValue> | SelectAsyncMultiValue<TValue>;
249
- interface SelectAsyncProps<TValue extends SelectAsyncOptionValue = SelectAsyncOptionValue> extends Omit<SharedSelectProps, 'children' | 'value' | 'defaultValue' | 'onChange' | 'multiple'> {
250
- value?: SelectAsyncValue<TValue>;
251
- defaultValue?: SelectAsyncValue<TValue>;
252
- onChange?: (value: SelectAsyncValue<TValue>) => void;
253
- loadOptions: (query: string, loadedOptions: Array<SelectAsyncOption<TValue>>, context: SelectAsyncLoadContext) => Promise<SelectAsyncLoadResult<TValue>>;
254
- defaultOptions?: Array<SelectAsyncOption<TValue>>;
255
- fixedOptions?: Array<SelectAsyncOption<TValue>>;
256
- cacheUniqs?: ReadonlyArray<unknown>;
257
- searchDebounceMs?: number;
258
- loadingMessage?: ReactNode;
259
- loadErrorMessage?: ReactNode;
260
- emptyMessage?: ReactNode;
261
- loadingMoreMessage?: ReactNode;
262
- loadMoreHintMessage?: ReactNode;
263
- loadMoreThreshold?: number;
264
- searchPlaceholder?: string;
265
- }
266
- declare function SelectAsync<TValue extends SelectAsyncOptionValue = SelectAsyncOptionValue>({ value, defaultValue, onChange, loadOptions, defaultOptions, fixedOptions, cacheUniqs, searchDebounceMs, loadingMessage, loadErrorMessage, emptyMessage, loadingMoreMessage, loadMoreHintMessage, loadMoreThreshold, isMulti, isFilterable, searchPlaceholder, ...props }: SelectAsyncProps<TValue>): react_jsx_runtime.JSX.Element;
267
-
268
- type TableColumnAlign = 'left' | 'center' | 'right';
269
- type TableColumnType = 'data' | 'actions';
270
- type TableActionTone = 'default' | 'danger';
271
- interface TableColumn<TItem> {
272
- id?: string;
273
- label?: ReactNode;
274
- accessor?: keyof TItem;
275
- Cell?: (item: TItem, index: number) => ReactNode;
276
- getSearchValue?: (item: TItem, index: number) => string;
277
- type?: TableColumnType;
278
- align?: TableColumnAlign;
279
- width?: CSSProperties['width'];
280
- minWidth?: CSSProperties['minWidth'];
281
- colSpan?: number;
282
- headerColSpan?: number;
283
- hideLabel?: boolean;
284
- }
285
- interface TableAction<TItem> {
286
- id?: string;
287
- label: string;
288
- icon?: ReactNode;
289
- onClick: (item: TItem, index: number) => void;
290
- disabled?: boolean | ((item: TItem, index: number) => boolean);
291
- hidden?: boolean | ((item: TItem, index: number) => boolean);
292
- tone?: TableActionTone;
293
- }
294
- type TableActionSource<TItem> = Array<TableAction<TItem>> | ((item: TItem, index: number) => Array<TableAction<TItem>>);
295
- interface TableLabels {
296
- searchPlaceholder?: string;
297
- emptyMessage?: ReactNode;
298
- noResultsMessage?: ReactNode;
299
- loadingMessage?: ReactNode;
300
- errorMessage?: ReactNode;
301
- firstPageLabel?: string;
302
- previousPageLabel?: string;
303
- nextPageLabel?: string;
304
- lastPageLabel?: string;
305
- rowsPerPageLabel?: string;
306
- actionsMenuLabel?: string;
307
- moreActionsLabel?: string;
308
- retryLabel?: string;
309
- settingsButtonLabel?: string;
310
- settingsModalTitle?: ReactNode;
311
- tableInfoSectionTitle?: ReactNode;
312
- totalPagesInfoLabel?: string;
313
- totalItemsInfoLabel?: string;
314
- currentPageInfoLabel?: string;
315
- currentPageItemsInfoLabel?: string;
316
- downloadSectionTitle?: ReactNode;
317
- downloadCsvLabel?: string;
318
- downloadXlsLabel?: string;
319
- downloadPdfLabel?: string;
320
- pageLabel?: (page: number, totalPages: number) => ReactNode;
321
- resultCountLabel?: (start: number, end: number, totalItems: number) => ReactNode;
322
- }
323
- interface SharedTableProps<TItem> {
324
- desktopColumns: Array<TableColumn<TItem>>;
325
- mobileColumns: Array<TableColumn<TItem>>;
326
- getRowId?: (item: TItem, index: number) => string;
327
- actions?: TableActionSource<TItem>;
328
- stickyActionsColumn?: boolean;
329
- maxInlineActions?: number;
330
- /**
331
- * Alinhamento dos botões dentro da coluna de ações. Padrão `right`. Use
332
- * `center` quando houver poucas ações e o alinhamento à direita deixar a
333
- * coluna visualmente desequilibrada.
334
- */
335
- actionsAlign?: 'right' | 'center';
336
- /**
337
- * Viewport width (in px) below which the table switches from the desktop
338
- * table layout to the stacked mobile card layout. Defaults to 768 so the
339
- * table collapses in sync with the host app's mobile breakpoint.
340
- */
341
- collapseBelow?: number;
342
- searchable?: boolean;
343
- showSearch?: boolean;
344
- showPagination?: boolean;
345
- showRowsPerPage?: boolean;
346
- showSettingsButton?: boolean;
347
- defaultSearchValue?: string;
348
- defaultPage?: number;
349
- defaultPageSize?: number;
350
- pageSizeOptions?: number[];
351
- labels?: TableLabels;
352
- translations?: TableLabels;
353
- className?: string;
354
- style?: CSSProperties;
355
- onSearchValueChange?: (value: string) => void;
356
- onPageChange?: (page: number) => void;
357
- onPageSizeChange?: (pageSize: number) => void;
358
- ariaLabel?: string;
359
- }
360
- interface TableAsyncLoadContext {
361
- page: number;
362
- pageSize: number;
363
- signal: AbortSignal;
364
- }
365
- interface TableAsyncLoadResult<TItem> {
366
- items: Array<TItem>;
367
- totalPages: number;
368
- totalItems?: number;
369
- }
370
-
371
- interface TableProps<TItem> extends SharedTableProps<TItem> {
372
- items: Array<TItem>;
373
- }
374
- declare function Table<TItem>({ items, desktopColumns, mobileColumns, defaultSearchValue, defaultPage, defaultPageSize, pageSizeOptions, searchable, onSearchValueChange, onPageChange, onPageSizeChange, ...props }: TableProps<TItem>): react_jsx_runtime.JSX.Element;
375
-
376
- interface TableAsyncProps<TItem> extends SharedTableProps<TItem> {
377
- loadItems: (query: string, context: TableAsyncLoadContext) => Promise<TableAsyncLoadResult<TItem>>;
378
- cacheUniqs?: ReadonlyArray<unknown>;
379
- searchDebounceMs?: number;
380
- keepPreviousData?: boolean;
381
- }
382
- declare function TableAsync<TItem>({ loadItems, desktopColumns, mobileColumns, defaultSearchValue, defaultPage, defaultPageSize, pageSizeOptions, searchable, cacheUniqs, searchDebounceMs, keepPreviousData, onSearchValueChange, onPageChange, onPageSizeChange, ...props }: TableAsyncProps<TItem>): react_jsx_runtime.JSX.Element;
383
-
384
- interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'dangerouslySetInnerHTML'> {
385
- label?: ReactNode;
386
- hint?: ReactNode;
387
- error?: ReactNode;
388
- size?: ControlSize;
389
- }
390
- declare function Textarea({ label, hint, error, size, id, disabled, style, rows, placeholder, ...rest }: TextareaProps): react_jsx_runtime.JSX.Element;
20
+ declare function Loading({ size, color, label, accessibleLabel, speed, className, style, ...rest }: LoadingProps): react_jsx_runtime.JSX.Element;
391
21
 
392
- export { Button, type ButtonProps, Card, type CardProps, CardSmall, type CardSmallProps, Checkbox, type CheckboxProps, ComposableModal, type ComposableModalProps, type ComposableModalSlotRenderProps, type ComposableModalSlotRenderer, type ControlSize, DatePicker, type DatePickerChangeContext, type DatePickerChangeReason, type DatePickerMode, type DatePickerProps, type DatePickerValue, Input, type InputProps, Modal, type ModalAction, type ModalProps, type ModalSlotContext, type ModalSlotIds, type ModalTheme, type ModalThemeSource, Select, SelectAsync, type SelectAsyncLoadContext, type SelectAsyncLoadResult, type SelectAsyncOption, type SelectAsyncOptionValue, type SelectAsyncProps, type SelectProps, Separator, type SeparatorOrientation, type SeparatorProps, type SharedTableProps, type StandardModalProps, Table, type TableAction, type TableActionSource, type TableActionTone, TableAsync, type TableAsyncLoadContext, type TableAsyncLoadResult, type TableAsyncProps, type TableColumn, type TableColumnAlign, type TableColumnType, type TableLabels, type TableProps, Textarea, type TextareaProps, type UiKitTheme, createModalSlotIds, useUiKitTheme };
22
+ export { ControlSize, Loading, type LoadingProps, type LoadingSize };