laif-ds 0.2.75 → 0.2.77

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
@@ -11,6 +11,7 @@ import { Command as Command_2 } from 'cmdk';
11
11
  import { ComponentProps } from 'react';
12
12
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
13
13
  import { ControllerProps } from 'react-hook-form';
14
+ import { ControllerRenderProps } from 'react-hook-form';
14
15
  import { DateRange } from 'react-day-picker';
15
16
  import { DayPicker } from 'react-day-picker';
16
17
  import { default as default_2 } from 'react';
@@ -65,7 +66,7 @@ import { UseEmblaCarouselType } from 'embla-carousel-react';
65
66
  import { UseFormReturn } from 'react-hook-form';
66
67
  import { VariantProps } from 'class-variance-authority';
67
68
 
68
- declare type AcceptItem = "pdf" | "doc" | "docx" | "xls" | "xlsx" | "ppt" | "pptx" | "txt" | "csv" | "jpg" | "jpeg" | "png" | "gif" | "image" | "video" | "audio";
69
+ declare type AcceptItem = "pdf" | "doc" | "docx" | "xls" | "xlsx" | "ppt" | "pptx" | "txt" | "csv" | "jpg" | "jpeg" | "png" | "gif" | "image" | "video" | "audio" | "zip" | "rar" | "7z" | "tar" | "gz" | "tgz";
69
70
 
70
71
  /**
71
72
  * Distributive helper: for a given key K, creates a config where cell gets the resolved value type.
@@ -74,6 +75,7 @@ declare type AcceptItem = "pdf" | "doc" | "docx" | "xls" | "xlsx" | "ppt" | "ppt
74
75
  declare type AccessorColumnConfigForKey<TData, K extends string> = BaseColumnFields & {
75
76
  accessorKey: K;
76
77
  cell?: (value: DeepValue<TData, K>, row: TData, tableRow: Row<TData>) => React.ReactNode;
78
+ cellClassName?: string | ((value: DeepValue<TData, K>, row: TData) => string);
77
79
  };
78
80
 
79
81
  export declare function Accordion({ ...props }: AccordionProps): JSX.Element;
@@ -144,6 +146,50 @@ declare const alertVariants: (props?: ({
144
146
 
145
147
  declare type Animation_2 = VariantProps<typeof chatBubbleVariants>["animation"];
146
148
 
149
+ export declare function AppCard({ header, title, description, body, actions, footer, variant, size, isLoading, showHeaderBorder, showFooterBorder, className, headerClassName, bodyClassName, footerClassName, children, ...props }: Readonly<AppCardProps>): JSX.Element;
150
+
151
+ export declare interface AppCardProps extends Omit<React_2.ComponentProps<"div">, "title"> {
152
+ /** Header content (title and/or description) */
153
+ header?: React_2.ReactNode;
154
+ /** Card title displayed in the header */
155
+ title?: string | React_2.ReactNode;
156
+ /** Card description displayed below the title */
157
+ description?: string | React_2.ReactNode;
158
+ /** Main content of the card */
159
+ body?: React_2.ReactNode;
160
+ /**
161
+ * Fallback body content when `body` is not provided.
162
+ * `body` takes precedence over `children` if both are passed.
163
+ */
164
+ children?: React_2.ReactNode;
165
+ /** Action buttons typically displayed in the header (right-aligned) */
166
+ actions?: React_2.ReactNode;
167
+ /** Footer content (typically action buttons) */
168
+ footer?: React_2.ReactNode;
169
+ /** Visual variant of the card */
170
+ variant?: AppCardVariant;
171
+ /** Controls internal padding via the base Card component */
172
+ size?: AppCardSize;
173
+ /** When true, renders skeleton placeholders instead of content */
174
+ isLoading?: boolean;
175
+ /** Whether to show a border between header and body */
176
+ showHeaderBorder?: boolean;
177
+ /** Whether to show a border between body and footer */
178
+ showFooterBorder?: boolean;
179
+ /** Additional className for the card container */
180
+ className?: string;
181
+ /** Additional className for the header section */
182
+ headerClassName?: string;
183
+ /** Additional className for the body section */
184
+ bodyClassName?: string;
185
+ /** Additional className for the footer section */
186
+ footerClassName?: string;
187
+ }
188
+
189
+ declare type AppCardSize = "sm" | "default" | "lg" | "none";
190
+
191
+ export declare type AppCardVariant = "default" | "elevated" | "outlined" | "ghost" | "flat" | "interactive" | "success" | "warning" | "destructive" | "info";
192
+
147
193
  export declare function AppCheckbox({ options, value, defaultValue, onValueChange, label, description, disabled, required, name, orientation, className, wrpClassName, optionClassName, layout, error, id, "data-testid": dataTestId, }: AppCheckboxProps): JSX.Element;
148
194
 
149
195
  export declare interface AppCheckboxOption {
@@ -232,39 +278,164 @@ declare type AppEditorToolbar = "block-format" | "font-format" | "history";
232
278
 
233
279
  export declare const AppForm: <TFormValues extends FieldValues = FieldValues, TAsyncOption = unknown>({ items, cols, form, submitText, onSubmit, isSubmitting, showSubmitButton, }: AppFormProps<TFormValues, TAsyncOption>) => JSX.Element;
234
280
 
235
- export declare interface AppFormItem<TAsyncOption = unknown> {
281
+ declare type AppFormComponentType = "input" | "select" | "textarea" | "checkbox" | "multiselect" | "datepicker" | "radio" | "switch" | "slider" | "async" | "async-multiple" | "custom";
282
+
283
+ export declare type AppFormItem<TAsyncOption = unknown, TComponent extends AppFormComponentType = AppFormComponentType> = {
284
+ /** Field label displayed above the component. */
236
285
  label: string;
237
- component: "input" | "select" | "textarea" | "checkbox" | "multiselect" | "datepicker" | "radio" | "switch" | "slider" | "async" | "async-multiple";
286
+ /** The type of form component to render. */
287
+ component: TComponent;
288
+ /** Field name used for React Hook Form state binding and validation. */
238
289
  name: string;
290
+ /**
291
+ * HTML input type. Only applies when `component` is `"input"`.
292
+ * @example "text" | "email" | "password" | "number" | "url" | "search" | "tel"
293
+ */
239
294
  inputType?: ComponentProps<"input">["type"];
295
+ /** Initial value for the field. */
240
296
  defaultValue?: string | boolean | number | string[] | Date | number[];
297
+ /** Options list for `select`, `multiselect`, and `radio` components. */
241
298
  options?: AppSelectOption[];
299
+ /**
300
+ * Disables the field, preventing user interaction.
301
+ * @default false
302
+ */
242
303
  disabled?: boolean;
304
+ /** Placeholder text shown when no value is selected or entered. */
243
305
  placeholder?: string;
306
+ /** Helper text displayed below the field. */
244
307
  caption?: string;
308
+ /**
309
+ * Enables range mode on the `datepicker` component when provided.
310
+ * The two dates define the selectable calendar boundaries.
311
+ */
245
312
  calendarRange?: [Date, Date];
313
+ /** Minimum value for the `slider` component. @default 0 */
246
314
  min?: number;
315
+ /** Maximum value for the `slider` component. @default 100 */
247
316
  max?: number;
317
+ /** Step increment for the `slider` component. @default 1 */
248
318
  step?: number;
319
+ /**
320
+ * Async data loader for `async` and `async-multiple` components.
321
+ * Called with the current search query; must return a promise of options.
322
+ */
249
323
  fetcher?: (query?: string) => Promise<TAsyncOption[]>;
324
+ /**
325
+ * Custom render function for each option item in the async dropdown.
326
+ * Required for `async` and `async-multiple` components.
327
+ */
250
328
  renderOptionItem?: (option: TAsyncOption) => React.ReactNode;
329
+ /**
330
+ * Extracts the unique string value from an async option object.
331
+ * Required for `async` and `async-multiple` components.
332
+ */
251
333
  resolveOptionValue?: (option: TAsyncOption) => string;
334
+ /**
335
+ * Custom render function for the selected value chip/label.
336
+ * Required for `async` and `async-multiple` components.
337
+ */
252
338
  renderSelectedValue?: (option: TAsyncOption) => React.ReactNode;
339
+ /**
340
+ * Pre-loaded options used to hydrate the async select on mount,
341
+ * avoiding an initial fetch when the value is already known.
342
+ */
253
343
  initialOptions?: TAsyncOption[];
344
+ /** Custom node displayed when the async fetcher returns no results at all. */
254
345
  notFound?: React.ReactNode;
346
+ /** Message shown when the async search query returns no matching results. */
255
347
  noResultsMessage?: string;
348
+ /**
349
+ * Debounce delay in milliseconds for the async search input.
350
+ * @default 300
351
+ */
256
352
  debounce?: number;
353
+ /**
354
+ * Allows the user to clear the selected value in the async select.
355
+ * @default false
356
+ */
257
357
  clearable?: boolean;
258
- datePickerProps?: Partial<ComponentProps<typeof DatePicker>>;
358
+ /** Extra props forwarded directly to the `DatePicker` component. */
359
+ datePickerProps?: Partial<DatePickerProps>;
360
+ /**
361
+ * Column span for the item in the grid.
362
+ * @default undefined (auto, or `"full"` for the last item)
363
+ */
364
+ colSpan?: "1" | "2" | "3" | "full";
365
+ /**
366
+ * Icon to display on the left side of the input.
367
+ * Only applies when `component` is `"input"`.
368
+ */
369
+ iconLeft?: IconName;
370
+ /**
371
+ * Icon to display on the right side of the input.
372
+ * Only applies when `component` is `"input"`.
373
+ */
374
+ iconRight?: IconName;
375
+ /**
376
+ * Enables search/filter functionality inside `select` and `multiselect` dropdowns.
377
+ * @default true
378
+ */
379
+ searchable?: boolean;
380
+ /**
381
+ * Custom render function for the component.
382
+ * Required when `component` is `"custom"`.
383
+ */
384
+ render?: (props: {
385
+ field: ControllerRenderProps<FieldValues, string>;
386
+ error?: string;
387
+ label: React.ReactNode;
388
+ }) => React.ReactNode;
389
+ /**
390
+ * Hides the label above the field.
391
+ * @default false
392
+ */
393
+ hideLabel?: boolean;
394
+ /**
395
+ * Additional props forwarded to the underlying UI component.
396
+ * Strongly typed based on the chosen `component` value.
397
+ */
398
+ componentProps?: AppFormItemComponentProps<TAsyncOption>[TComponent];
399
+ /** Additional CSS class name applied to the item container div. */
400
+ className?: string;
401
+ };
402
+
403
+ declare interface AppFormItemComponentProps<TAsyncOption = unknown> {
404
+ input: Omit<InputProps, "name" | "value" | "onChange" | "onBlur" | "disabled" | "placeholder" | "type" | "iconLeft" | "iconRight" | "label">;
405
+ select: Omit<SingleSelectProps, "options" | "placeholder" | "disabled" | "searchable" | "value" | "onValueChange" | "multiple" | "label">;
406
+ multiselect: Omit<MultiSelectProps, "options" | "placeholder" | "disabled" | "searchable" | "value" | "onValueChange" | "multiple" | "label">;
407
+ textarea: Omit<ComponentProps<typeof Textarea>, "name" | "value" | "onChange" | "onBlur" | "disabled" | "placeholder" | "label">;
408
+ checkbox: Omit<ComponentProps<typeof Checkbox>, "checked" | "onCheckedChange" | "disabled" | "id" | "name">;
409
+ datepicker: Omit<DatePickerProps, "mode" | "value" | "onChange" | "placeholder" | "disabled" | "label">;
410
+ radio: Omit<ComponentProps<typeof RadioGroup>, "value" | "onValueChange" | "disabled" | "name">;
411
+ switch: Omit<ComponentProps<typeof Switch>, "checked" | "onCheckedChange" | "disabled" | "id" | "name">;
412
+ slider: Omit<ComponentProps<typeof Slider>, "value" | "onValueChange" | "min" | "max" | "step" | "disabled">;
413
+ async: Omit<AsyncSelectProps<TAsyncOption>, "multiple" | "fetcher" | "initialOptions" | "renderOptionItem" | "resolveOptionValue" | "renderSelectedValue" | "value" | "onChange" | "placeholder" | "disabled" | "notFound" | "noResultsMessage" | "debounce" | "clearable" | "label">;
414
+ "async-multiple": Omit<AsyncSelectProps<TAsyncOption>, "multiple" | "fetcher" | "initialOptions" | "renderOptionItem" | "resolveOptionValue" | "renderSelectedValue" | "value" | "onChange" | "placeholder" | "disabled" | "notFound" | "noResultsMessage" | "debounce" | "clearable" | "label">;
415
+ custom: Record<string, unknown>;
259
416
  }
260
417
 
261
418
  declare interface AppFormProps<TFormValues extends FieldValues = FieldValues, TAsyncOption = unknown> {
419
+ /** Number of grid columns for the form layout. @default "2" */
262
420
  cols?: "1" | "2" | "3";
263
- items: AppFormItem<TAsyncOption>[];
421
+ /** Array of field configurations describing each form field. */
422
+ items: AppFormItem<TAsyncOption, AppFormComponentType>[];
423
+ /** React Hook Form instance returned by `useForm`. */
264
424
  form: UseFormReturn<TFormValues>;
425
+ /** Text label for the internal submit button. @default "Invia" */
265
426
  submitText?: string;
427
+ /** Callback fired with validated form data on submission. */
266
428
  onSubmit?: (data: TFormValues) => void;
429
+ /**
430
+ * When `true`, shows a loading spinner on the submit button.
431
+ * @default false
432
+ */
267
433
  isSubmitting?: boolean;
434
+ /**
435
+ * When `true`, renders an internal submit button at the bottom of the form.
436
+ * The button is disabled while the form is invalid or pristine.
437
+ * @default false
438
+ */
268
439
  showSubmitButton?: boolean;
269
440
  }
270
441
 
@@ -605,6 +776,7 @@ declare type BaseColumnFields = {
605
776
  filterable?: boolean;
606
777
  searchable?: boolean;
607
778
  pinned?: "left" | "right";
779
+ headerClassName?: string;
608
780
  } & HeaderConfig;
609
781
 
610
782
  declare type BaseProps = {
@@ -626,7 +798,7 @@ declare type BaseProps = {
626
798
  disabled?: boolean;
627
799
  maxSelected?: number;
628
800
  showChipsInsteadOfCount?: boolean;
629
- size?: SelectSizeType_2;
801
+ size?: SelectSizeType;
630
802
  onClear?: () => void;
631
803
  id?: string;
632
804
  "data-testid"?: string;
@@ -1407,7 +1579,7 @@ export declare enum DataRepeatTypes {
1407
1579
  MONTH = "MONTH"
1408
1580
  }
1409
1581
 
1410
- export declare function DataTable<TData, TValue>({ columns, data, loading, emptyComponent, className, rowSelection, onRowSelectionChange, checkable, onCheckedRowsChange, actions, customComponentsLeft, customComponentsRight, hidePagination, hideActionsRow, i18n, maxSortedColumns, initialState, serverMode, serverConfig, disableAutoPageSize, id, "data-testid": dataTestId, }: DataTableProps<TData, TValue>): JSX.Element;
1582
+ export declare function DataTable<TData, TValue>({ columns, data, loading, emptyComponent, className, rowSelection, onRowSelectionChange, checkable, onCheckedRowsChange, actions, customComponentsLeft, customComponentsRight, hidePagination, hideActionsRow, i18n, maxSortedColumns, initialState, serverMode, serverConfig, disableAutoPageSize, id, "data-testid": dataTestId, rowClassName, }: DataTableProps<TData, TValue>): JSX.Element;
1411
1583
 
1412
1584
  export declare interface DataTableActions {
1413
1585
  label: string;
@@ -1598,6 +1770,7 @@ export declare interface DataTableProps<TData, TValue> {
1598
1770
  disableAutoPageSize?: boolean;
1599
1771
  id?: string;
1600
1772
  "data-testid"?: string;
1773
+ rowClassName?: string | ((row: Row<TData>) => string);
1601
1774
  }
1602
1775
 
1603
1776
  export declare interface DataTableServerConfig {
@@ -1745,10 +1918,13 @@ export declare function DialogTrigger({ ...props }: React_2.ComponentProps<typeo
1745
1918
  declare type DisplayColumnConfig<TData> = BaseColumnFields & {
1746
1919
  accessorKey?: undefined;
1747
1920
  cell?: (value: undefined, row: TData, tableRow: Row<TData>) => React.ReactNode;
1921
+ cellClassName?: string | ((value: undefined, row: TData) => string);
1748
1922
  };
1749
1923
 
1750
- /** Distributes AccessorColumnConfig over each key in the DeepKeys union */
1751
- declare type DistributedAccessorConfig<TData> = DeepKeys<TData> extends infer K ? K extends string ? AccessorColumnConfigForKey<TData, K> : never : never;
1924
+ /** Maps each key to its typed accessor config, then unions them */
1925
+ declare type DistributedAccessorConfig<TData> = {
1926
+ [K in DeepKeys<TData> & string]: AccessorColumnConfigForKey<TData, K>;
1927
+ }[DeepKeys<TData> & string];
1752
1928
 
1753
1929
  export declare const downloadFile: (url: string, filename?: string) => void;
1754
1930
 
@@ -2676,7 +2852,7 @@ export declare function SelectItem({ className, children, ...props }: React_2.Co
2676
2852
  export declare function SelectLabel({ className, ...props }: React_2.ComponentProps<typeof SelectPrimitive.Label>): JSX.Element;
2677
2853
 
2678
2854
  declare interface SelectProps extends React_2.ComponentProps<typeof SelectPrimitive.Root> {
2679
- size?: SelectSizeType;
2855
+ size?: SelectSizeType_2;
2680
2856
  label?: string | React_2.ReactNode;
2681
2857
  className?: string;
2682
2858
  labelClassName?: string;
@@ -2689,7 +2865,7 @@ declare type SelectSizeType = "sm" | "default" | "lg";
2689
2865
  declare type SelectSizeType_2 = "sm" | "default" | "lg";
2690
2866
 
2691
2867
  export declare function SelectTrigger({ className, size: sizeProp, children, ...props }: React_2.ComponentProps<typeof SelectPrimitive.Trigger> & {
2692
- size?: SelectSizeType;
2868
+ size?: SelectSizeType_2;
2693
2869
  }): JSX.Element;
2694
2870
 
2695
2871
  declare const selectTriggerVariants: (props?: ({
@@ -3016,6 +3192,29 @@ declare type TransformedDataType<T> = {
3016
3192
  [P in keyof T as Exclude<P, "children">]: T[P];
3017
3193
  };
3018
3194
 
3195
+ export declare function TruncatedCell({ children, text, title, popoverContent, className, wrapperClassName, popoverClassName, showButton, emptyFallback, }: TruncatedCellProps): JSX.Element;
3196
+
3197
+ export declare interface TruncatedCellProps {
3198
+ /** The text to display and potentially truncate (can be string or ReactNode) */
3199
+ children?: React.ReactNode;
3200
+ /** The text value to use for truncation detection, accessibility and default popover content */
3201
+ text?: string;
3202
+ /** Optional title for the popover dialog */
3203
+ title?: string;
3204
+ /** Custom popover content to override default text display */
3205
+ popoverContent?: React.ReactNode;
3206
+ /** Additional CSS classes for the wrapper container */
3207
+ wrapperClassName?: string;
3208
+ /** Additional CSS classes for cell */
3209
+ className?: string;
3210
+ /** CSS classes for the popoverContent component */
3211
+ popoverClassName?: string;
3212
+ /** Flg used to show / hide the eye button */
3213
+ showButton?: boolean;
3214
+ /** Custom placeholder rendered when there is no content */
3215
+ emptyFallback?: React.ReactNode;
3216
+ }
3217
+
3019
3218
  export declare function TypingIndicator(): JSX.Element;
3020
3219
 
3021
3220
  export declare const Typo: React_2.FC<TypoProps>;
@@ -3130,5 +3329,7 @@ declare module "@tanstack/react-table" {
3130
3329
  searchable?: boolean;
3131
3330
  pinned?: "left" | "right";
3132
3331
  listOptions?: AppSelectOption[];
3332
+ cellClassName?: string | ((value: unknown, row: TData) => string);
3333
+ headerClassName?: string;
3133
3334
  }
3134
3335
  }