smartsell-ui-kit 0.1.0 → 0.1.2

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.ts CHANGED
@@ -1,20 +1,40 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ButtonHTMLAttributes, ReactNode, HTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
- export { L as LegacyModalAction, a as LegacyModalCompatProps, b as LegacyModalProps, M as Modal, c as ModalAction, d as ModalProps, e as ModalTheme, f as ModalThemeSource, S as StandardModalProps, U as UiKitThemeTokens, u as useUiKitTheme } from './modal-B2lmASXk.js';
4
- import 'smartsell-theme';
2
+ import { ButtonHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties, InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
+ import { SmartSellTheme, ThemeColors } from 'smartsell-theme';
5
4
 
6
- type ControlSize$1 = 'sm' | 'md' | 'lg';
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
+ interface UiKitThemeTokens {
18
+ theme: UiKitTheme;
19
+ borderSoft: string;
20
+ borderStrong: string;
21
+ surfaceMuted: string;
22
+ surfaceRaised: string;
23
+ overlay: string;
24
+ focusRing: string;
25
+ mutedText: string;
26
+ }
27
+ declare function useUiKitTheme(): UiKitThemeTokens;
7
28
 
8
29
  type ButtonVariant = 'solid' | 'outline' | 'ghost';
9
- type ButtonSize = ControlSize$1;
30
+ type ButtonSize = ControlSize;
10
31
  interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'dangerouslySetInnerHTML'> {
11
32
  variant?: ButtonVariant;
12
33
  size?: ButtonSize;
13
- fullWidth?: boolean;
14
34
  leadingIcon?: ReactNode;
15
35
  trailingIcon?: ReactNode;
16
36
  }
17
- declare function Button({ variant, size, fullWidth, leadingIcon, trailingIcon, children, disabled, style, type, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onBlur, onKeyDown, onKeyUp, onTouchStart, onTouchEnd, onTouchCancel, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
37
+ declare function Button({ variant, size, leadingIcon, trailingIcon, children, disabled, className, type, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
18
38
 
19
39
  interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML' | 'title'> {
20
40
  children: ReactNode;
@@ -23,13 +43,21 @@ interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'd
23
43
  action?: ReactNode;
24
44
  padded?: boolean;
25
45
  }
26
- declare function Card({ children, eyebrow, title, action, padded, style, ...rest }: CardProps): react_jsx_runtime.JSX.Element;
46
+ declare function Card({ children, eyebrow, title, action, padded, className, ...rest }: CardProps): react_jsx_runtime.JSX.Element;
47
+
48
+ interface CardSmallProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML' | 'title' | 'color'> {
49
+ title?: ReactNode;
50
+ value?: ReactNode;
51
+ icon?: ReactNode;
52
+ color?: CSSProperties['color'];
53
+ }
54
+ declare function CardSmall({ title, value, icon, color, className, style, ...rest }: CardSmallProps): react_jsx_runtime.JSX.Element;
27
55
 
28
56
  interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dangerouslySetInnerHTML' | 'size' | 'type'> {
29
57
  label?: ReactNode;
30
58
  hint?: ReactNode;
31
59
  error?: ReactNode;
32
- controlSize?: ControlSize$1;
60
+ controlSize?: ControlSize;
33
61
  indeterminate?: boolean;
34
62
  }
35
63
  declare function Checkbox({ label, hint, error, controlSize, id, checked, defaultChecked, disabled, indeterminate, required, className, style, onChange, onFocus, onBlur, ...rest }: CheckboxProps): react_jsx_runtime.JSX.Element;
@@ -92,7 +120,7 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'd
92
120
  label?: ReactNode;
93
121
  hint?: ReactNode;
94
122
  error?: ReactNode;
95
- controlSize?: ControlSize$1;
123
+ controlSize?: ControlSize;
96
124
  value?: DatePickerValue;
97
125
  defaultValue?: DatePickerValue;
98
126
  onChange?: (value: string | null, context: DatePickerChangeContext) => void;
@@ -111,28 +139,239 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'd
111
139
  pickerButtonLabel?: string;
112
140
  clearButtonLabel?: string;
113
141
  }
114
- declare function DatePicker({ label, hint, error, controlSize, value, defaultValue, onChange, mode, format, allowPastDates, allowFutureDates, minDate, maxDate, minuteStep, clearable, showPickerButton, isDateUnavailable, invalidDateMessage, unavailableDateMessage, pickerButtonLabel, clearButtonLabel, id, name, disabled, readOnly, required, style, className, placeholder, onBlur, onFocus, onKeyDown, ...rest }: DatePickerProps): react_jsx_runtime.JSX.Element;
142
+ declare function DatePicker({ label, hint, error, controlSize, value, defaultValue, onChange, mode, format, allowPastDates, allowFutureDates, minDate, maxDate, minuteStep, clearable, showPickerButton, isDateUnavailable, invalidDateMessage, unavailableDateMessage, pickerButtonLabel, clearButtonLabel, id, name, disabled, readOnly, required, style, className, placeholder, onBlur, onClick, onFocus, onKeyDown, ...rest }: DatePickerProps): react_jsx_runtime.JSX.Element;
115
143
 
116
144
  interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dangerouslySetInnerHTML' | 'size'> {
117
145
  label?: ReactNode;
118
146
  hint?: ReactNode;
119
147
  error?: ReactNode;
120
- controlSize?: ControlSize$1;
148
+ controlSize?: ControlSize;
121
149
  showPasswordToggle?: boolean;
150
+ fileButtonLabel?: ReactNode;
151
+ }
152
+ declare function Input({ label, hint, error, controlSize, className, showPasswordToggle, fileButtonLabel, id, disabled, placeholder, onChange, style, type, ...rest }: InputProps): react_jsx_runtime.JSX.Element;
153
+
154
+ type ModalActionAppearance = 'text' | 'outlined' | 'contained' | 'link';
155
+ type ModalThemeColors = {
156
+ background: string;
157
+ surface: string;
158
+ text: string;
159
+ textLight: string;
160
+ primary: string;
161
+ onPrimary: string;
162
+ secondary: string;
163
+ onSecondary: string;
164
+ negative: string;
165
+ warning: string;
166
+ };
167
+ interface ModalTheme {
168
+ colors?: Partial<ModalThemeColors>;
169
+ }
170
+ type ModalThemeSource = ModalTheme | UiKitThemeTokens;
171
+ interface ModalAction {
172
+ label: ReactNode;
173
+ onClick: () => void;
174
+ appearance?: ModalActionAppearance;
175
+ style?: CSSProperties;
176
+ disabled?: boolean;
177
+ hidden?: boolean;
178
+ }
179
+ interface BaseModalProps {
180
+ children?: ReactNode;
181
+ theme?: ModalThemeSource;
182
+ }
183
+ interface ModalProps extends BaseModalProps {
184
+ isOpen: boolean;
185
+ onClose: () => void;
186
+ title?: ReactNode;
187
+ headerContent?: ReactNode;
188
+ footer?: ReactNode;
189
+ confirmAction?: ModalAction;
190
+ cancelAction?: ModalAction;
191
+ closeAction?: ModalAction;
192
+ extraActions?: ModalAction[];
193
+ maxWidth?: number | string;
194
+ closeOnBackdrop?: boolean;
195
+ closeOnEscape?: boolean;
196
+ hideCloseButton?: boolean;
197
+ hideExpandButton?: boolean;
198
+ disableDismiss?: boolean;
199
+ maximized?: boolean;
200
+ contentStyle?: CSSProperties;
201
+ bodyStyle?: CSSProperties;
202
+ isBusy?: boolean;
122
203
  }
123
- declare function Input({ label, hint, error, controlSize, showPasswordToggle, id, disabled, style, type, ...rest }: InputProps): react_jsx_runtime.JSX.Element;
204
+ type StandardModalProps = ModalProps;
205
+ declare function Modal(props: ModalProps): react_jsx_runtime.JSX.Element;
124
206
 
125
- interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'dangerouslySetInnerHTML' | 'size'> {
207
+ type SeparatorOrientation = 'vertical' | 'horizontal';
208
+ interface SeparatorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML' | 'color'> {
209
+ orientation?: SeparatorOrientation;
210
+ color?: CSSProperties['backgroundColor'];
211
+ size?: CSSProperties['width'];
212
+ }
213
+ declare function Separator({ orientation, color, size, className, style, ...rest }: SeparatorProps): react_jsx_runtime.JSX.Element;
214
+
215
+ interface SharedSelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'dangerouslySetInnerHTML' | 'size'> {
126
216
  label?: ReactNode;
127
217
  hint?: ReactNode;
128
218
  error?: ReactNode;
129
- controlSize?: ControlSize$1;
219
+ placeholder?: ReactNode;
220
+ controlSize?: ControlSize;
130
221
  isMulti?: boolean;
131
222
  isFilterable?: boolean;
132
223
  }
133
- declare function Select({ label, hint, error, controlSize, id, disabled, style, children, value, defaultValue, onChange, onFocus, onBlur, onKeyDown, onClick, autoFocus, className, isMulti, isFilterable, multiple, ...rest }: SelectProps): react_jsx_runtime.JSX.Element;
134
224
 
135
- type ControlSize = 'sm' | 'md' | 'lg';
225
+ interface SelectProps extends SharedSelectProps {
226
+ children?: ReactNode;
227
+ }
228
+ declare function Select({ children, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
229
+
230
+ type SelectObjectOptionValue = string | number;
231
+ interface SelectObjectOption<TValue extends SelectObjectOptionValue = SelectObjectOptionValue> {
232
+ value: TValue;
233
+ label: ReactNode;
234
+ disabled?: boolean;
235
+ group?: ReactNode;
236
+ }
237
+
238
+ type SelectAsyncOptionValue = SelectObjectOptionValue;
239
+ type SelectAsyncOption<TValue extends SelectAsyncOptionValue = SelectAsyncOptionValue> = SelectObjectOption<TValue>;
240
+ interface SelectAsyncLoadContext {
241
+ page: number;
242
+ signal: AbortSignal;
243
+ }
244
+ interface SelectAsyncLoadResult<TValue extends SelectAsyncOptionValue = SelectAsyncOptionValue> {
245
+ options: Array<SelectAsyncOption<TValue>>;
246
+ hasMore?: boolean;
247
+ }
248
+ type SelectAsyncSingleValue<TValue extends SelectAsyncOptionValue> = SelectAsyncOption<TValue> | null;
249
+ type SelectAsyncMultiValue<TValue extends SelectAsyncOptionValue> = Array<SelectAsyncOption<TValue>>;
250
+ type SelectAsyncValue<TValue extends SelectAsyncOptionValue> = SelectAsyncSingleValue<TValue> | SelectAsyncMultiValue<TValue>;
251
+ interface SelectAsyncProps<TValue extends SelectAsyncOptionValue = SelectAsyncOptionValue> extends Omit<SharedSelectProps, 'children' | 'value' | 'defaultValue' | 'onChange' | 'multiple'> {
252
+ value?: SelectAsyncValue<TValue>;
253
+ defaultValue?: SelectAsyncValue<TValue>;
254
+ onChange?: (value: SelectAsyncValue<TValue>) => void;
255
+ loadOptions: (query: string, loadedOptions: Array<SelectAsyncOption<TValue>>, context: SelectAsyncLoadContext) => Promise<SelectAsyncLoadResult<TValue>>;
256
+ defaultOptions?: Array<SelectAsyncOption<TValue>>;
257
+ fixedOptions?: Array<SelectAsyncOption<TValue>>;
258
+ cacheUniqs?: ReadonlyArray<unknown>;
259
+ searchDebounceMs?: number;
260
+ loadingMessage?: ReactNode;
261
+ loadErrorMessage?: ReactNode;
262
+ emptyMessage?: ReactNode;
263
+ loadingMoreMessage?: ReactNode;
264
+ loadMoreHintMessage?: ReactNode;
265
+ loadMoreThreshold?: number;
266
+ searchPlaceholder?: string;
267
+ }
268
+ 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;
269
+
270
+ type TableColumnAlign = 'left' | 'center' | 'right';
271
+ type TableColumnType = 'data' | 'actions';
272
+ type TableActionTone = 'default' | 'danger';
273
+ interface TableColumn<TItem> {
274
+ id?: string;
275
+ label?: ReactNode;
276
+ accessor?: keyof TItem;
277
+ Cell?: (item: TItem, index: number) => ReactNode;
278
+ getSearchValue?: (item: TItem, index: number) => string;
279
+ type?: TableColumnType;
280
+ align?: TableColumnAlign;
281
+ width?: CSSProperties['width'];
282
+ minWidth?: CSSProperties['minWidth'];
283
+ colSpan?: number;
284
+ headerColSpan?: number;
285
+ hideLabel?: boolean;
286
+ }
287
+ interface TableAction<TItem> {
288
+ id?: string;
289
+ label: string;
290
+ icon?: ReactNode;
291
+ onClick: (item: TItem, index: number) => void;
292
+ disabled?: boolean | ((item: TItem, index: number) => boolean);
293
+ hidden?: boolean | ((item: TItem, index: number) => boolean);
294
+ tone?: TableActionTone;
295
+ }
296
+ type TableActionSource<TItem> = Array<TableAction<TItem>> | ((item: TItem, index: number) => Array<TableAction<TItem>>);
297
+ interface TableLabels {
298
+ searchPlaceholder?: string;
299
+ emptyMessage?: ReactNode;
300
+ noResultsMessage?: ReactNode;
301
+ loadingMessage?: ReactNode;
302
+ errorMessage?: ReactNode;
303
+ firstPageLabel?: string;
304
+ previousPageLabel?: string;
305
+ nextPageLabel?: string;
306
+ lastPageLabel?: string;
307
+ rowsPerPageLabel?: string;
308
+ actionsMenuLabel?: string;
309
+ moreActionsLabel?: string;
310
+ retryLabel?: string;
311
+ settingsButtonLabel?: string;
312
+ settingsModalTitle?: ReactNode;
313
+ tableInfoSectionTitle?: ReactNode;
314
+ totalPagesInfoLabel?: string;
315
+ totalItemsInfoLabel?: string;
316
+ currentPageInfoLabel?: string;
317
+ currentPageItemsInfoLabel?: string;
318
+ downloadSectionTitle?: ReactNode;
319
+ downloadCsvLabel?: string;
320
+ downloadXlsLabel?: string;
321
+ downloadPdfLabel?: string;
322
+ pageLabel?: (page: number, totalPages: number) => ReactNode;
323
+ resultCountLabel?: (start: number, end: number, totalItems: number) => ReactNode;
324
+ }
325
+ interface SharedTableProps<TItem> {
326
+ desktopColumns: Array<TableColumn<TItem>>;
327
+ mobileColumns: Array<TableColumn<TItem>>;
328
+ getRowId?: (item: TItem, index: number) => string;
329
+ actions?: TableActionSource<TItem>;
330
+ stickyActionsColumn?: boolean;
331
+ maxInlineActions?: number;
332
+ collapseBelow?: number;
333
+ searchable?: boolean;
334
+ showSearch?: boolean;
335
+ showPagination?: boolean;
336
+ showRowsPerPage?: boolean;
337
+ showSettingsButton?: boolean;
338
+ defaultSearchValue?: string;
339
+ defaultPage?: number;
340
+ defaultPageSize?: number;
341
+ pageSizeOptions?: number[];
342
+ labels?: TableLabels;
343
+ translations?: TableLabels;
344
+ className?: string;
345
+ style?: CSSProperties;
346
+ onSearchValueChange?: (value: string) => void;
347
+ onPageChange?: (page: number) => void;
348
+ onPageSizeChange?: (pageSize: number) => void;
349
+ ariaLabel?: string;
350
+ }
351
+ interface TableAsyncLoadContext {
352
+ page: number;
353
+ pageSize: number;
354
+ signal: AbortSignal;
355
+ }
356
+ interface TableAsyncLoadResult<TItem> {
357
+ items: Array<TItem>;
358
+ totalPages: number;
359
+ totalItems?: number;
360
+ }
361
+
362
+ interface TableProps<TItem> extends SharedTableProps<TItem> {
363
+ items: Array<TItem>;
364
+ }
365
+ declare function Table<TItem>({ items, desktopColumns, mobileColumns, defaultSearchValue, defaultPage, defaultPageSize, pageSizeOptions, searchable, onSearchValueChange, onPageChange, onPageSizeChange, ...props }: TableProps<TItem>): react_jsx_runtime.JSX.Element;
366
+
367
+ interface TableAsyncProps<TItem> extends SharedTableProps<TItem> {
368
+ loadItems: (query: string, context: TableAsyncLoadContext) => Promise<TableAsyncLoadResult<TItem>>;
369
+ cacheUniqs?: ReadonlyArray<unknown>;
370
+ searchDebounceMs?: number;
371
+ keepPreviousData?: boolean;
372
+ }
373
+ 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;
374
+
136
375
  interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'dangerouslySetInnerHTML'> {
137
376
  label?: ReactNode;
138
377
  hint?: ReactNode;
@@ -141,4 +380,4 @@ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
141
380
  }
142
381
  declare function Textarea({ label, hint, error, controlSize, id, disabled, style, rows, ...rest }: TextareaProps): react_jsx_runtime.JSX.Element;
143
382
 
144
- export { Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, ComposableModal, type ComposableModalProps, type ComposableModalSlotRenderProps, type ComposableModalSlotRenderer, DatePicker, type DatePickerChangeContext, type DatePickerChangeReason, type DatePickerMode, type DatePickerProps, type DatePickerValue, Input, type InputProps, type ModalSlotContext, type ModalSlotIds, Select, type SelectProps, Textarea, type TextareaProps, createModalSlotIds };
383
+ 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 UiKitThemeTokens, createModalSlotIds, useUiKitTheme };