@qodo/design-system 0.9.7 → 0.10.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/dist/index.d.ts CHANGED
@@ -6,17 +6,23 @@ import { Column } from '@tanstack/react-table';
6
6
  import { ComboboxProps as ComboboxProps_2 } from './types';
7
7
  import { Control } from 'react-hook-form';
8
8
  import * as DialogPrimitive from '@radix-ui/react-dialog';
9
+ import { Dispatch } from 'react';
10
+ import { DropdownMenuContentProps } from '@radix-ui/react-dropdown-menu';
9
11
  import { FieldValues } from 'react-hook-form';
10
12
  import { FormState } from 'react-hook-form';
13
+ import { ForwardRefExoticComponent } from 'react';
11
14
  import { InputProps as InputProps_2 } from './types';
12
15
  import { JSX as JSX_2 } from 'react/jsx-runtime';
16
+ import { MouseEvent as MouseEvent_2 } from 'react';
13
17
  import * as ProgressPrimitive from '@radix-ui/react-progress';
14
18
  import { PropsWithChildren } from 'react';
15
19
  import * as React_2 from 'react';
16
20
  import { ReactNode } from 'react';
21
+ import { RefAttributes } from 'react';
17
22
  import { RowData } from '@tanstack/react-table';
18
23
  import * as SelectPrimitive from '@radix-ui/react-select';
19
24
  import { SelectProps } from './types';
25
+ import { SetStateAction } from 'react';
20
26
  import { Steps as Steps_2 } from '@ark-ui/react/steps';
21
27
  import { SubmitHandler } from 'react-hook-form';
22
28
  import * as SwitchPrimitive from '@radix-ui/react-switch';
@@ -52,6 +58,16 @@ export declare function AccordionItem({ className, ...props }: React_2.Component
52
58
 
53
59
  export declare function AccordionTrigger({ className, children, ...props }: React_2.ComponentProps<typeof AccordionPrimitive.Trigger>): JSX_2.Element;
54
60
 
61
+ export declare interface ActionItemType extends BaseMenuItemType, TypeGuard<"ActionMenuItem"> {
62
+ endAndornment?: ReactNode;
63
+ onClick?: (event: MouseEvent_2<HTMLDivElement>) => void;
64
+ onSelect?: (event: Event) => void;
65
+ separator?: boolean;
66
+ loading?: boolean;
67
+ tooltip?: string;
68
+ isHidden?: boolean;
69
+ }
70
+
55
71
  export declare function Badge({ className, variant, size, ...props }: BadgeProps): JSX_2.Element;
56
72
 
57
73
  export declare const BadgeCell: (props: BadgeCellProps) => JSX_2.Element;
@@ -72,6 +88,12 @@ export declare type BaseCellProps = PropsWithChildren & {
72
88
  className?: string;
73
89
  };
74
90
 
91
+ declare type BaseMenuItemType = {
92
+ label: ReactNode;
93
+ icon?: ReactNode;
94
+ disabled?: boolean;
95
+ };
96
+
75
97
  export declare const borderRadius: {
76
98
  readonly sm: "0.25rem";
77
99
  readonly md: "0.375rem";
@@ -103,6 +125,29 @@ export declare function CardHeader({ className, ...props }: React_2.ComponentPro
103
125
 
104
126
  export declare function CardTitle({ className, ...props }: React_2.ComponentProps<"div">): JSX_2.Element;
105
127
 
128
+ declare interface CheckboxGroupType extends TypeGuard<"CheckboxGroup"> {
129
+ checkboxes: CheckboxItemType[];
130
+ separator?: boolean;
131
+ }
132
+
133
+ declare interface CheckboxItemType extends BaseMenuItemType {
134
+ checked: boolean;
135
+ onSelect?: Dispatch<SetStateAction<boolean>>;
136
+ }
137
+
138
+ /***
139
+ *
140
+ * CLASSHELPER
141
+ * Helper function for applying SCSS or Tailwind classes
142
+ *
143
+ * PARAMS
144
+ * debug: log the output to the console (boolean, optional)
145
+ * props: props object (object, required)
146
+ * styles: SCSS or tailwind styles (required)
147
+ *
148
+ **********/
149
+ export declare function ClassHelper(styles: any, props: any, debug: boolean): string;
150
+
106
151
  export declare function cn(...inputs: ClassValue[]): string;
107
152
 
108
153
  export declare const colors: {
@@ -173,6 +218,25 @@ export declare function DialogTitle({ className, ...props }: React_2.ComponentPr
173
218
 
174
219
  export declare function DialogTrigger({ ...props }: React_2.ComponentProps<typeof DialogPrimitive.Trigger>): JSX_2.Element;
175
220
 
221
+ export declare const Dropdown: ({ menuItems, header, footer, triggerElement, size, asChild, side, modal, }: DropdownProps) => JSX_2.Element;
222
+
223
+ declare type DropdownMenuItem = (RadioGroupType | ActionItemType | CheckboxGroupType | SubMenuItemType | MenuLabelType | SeparatorType) & {
224
+ isHidden?: boolean;
225
+ };
226
+
227
+ export declare type DropdownMenuItems = Array<DropdownMenuItem>;
228
+
229
+ declare interface DropdownProps {
230
+ menuItems: DropdownMenuItems;
231
+ header?: HeaderItemType;
232
+ footer?: FooterItemType;
233
+ triggerElement: TriggerElement;
234
+ size?: "s" | "l";
235
+ asChild?: boolean;
236
+ side?: DropdownMenuContentProps["side"];
237
+ modal?: boolean;
238
+ }
239
+
176
240
  export declare interface EmailChipProps {
177
241
  email: string;
178
242
  isValid: boolean;
@@ -217,10 +281,14 @@ export declare type EmptyStateProps = {
217
281
  description?: string;
218
282
  };
219
283
 
284
+ declare interface FooterItemType extends BaseMenuItemType {
285
+ action?: () => void;
286
+ }
287
+
220
288
  export declare const Form: {
221
289
  <T extends FieldValues>(props: FormProps<T>): JSX_2.Element;
222
290
  Button: ({ type, ...rest }: ButtonProps_2) => JSX_2.Element;
223
- Input: (props: InputProps_2) => JSX_2.Element;
291
+ Input: ForwardRefExoticComponent<Omit<InputProps_2, "ref"> & RefAttributes<HTMLInputElement>>;
224
292
  Select: (props: SelectProps) => JSX_2.Element;
225
293
  Combobox: (props: ComboboxProps_2) => JSX_2.Element;
226
294
  Divider: (props: React.HTMLAttributes<HTMLHRElement>) => JSX_2.Element;
@@ -245,6 +313,8 @@ declare type FormProviderProps<T extends FieldValues> = PropsWithChildren<{
245
313
  readOnly?: boolean;
246
314
  }>;
247
315
 
316
+ declare type HeaderItemType = TitleHeaderContentType;
317
+
248
318
  declare type IndicatorProps = React.ComponentProps<typeof Steps_2.Indicator> & {
249
319
  index: number;
250
320
  };
@@ -259,6 +329,10 @@ declare const inputVariants: (props?: ({
259
329
  variant?: "default" | "secondary" | "accent" | "success" | "warning" | "destructive" | null | undefined;
260
330
  } & ClassProp) | undefined) => string;
261
331
 
332
+ declare interface MenuLabelType extends TypeGuard<"MenuLabel"> {
333
+ label: ReactNode;
334
+ }
335
+
262
336
  export declare type NoResultProps = {
263
337
  title?: string;
264
338
  };
@@ -276,6 +350,17 @@ export declare type PaginationStepperProps<T extends RowData> = {
276
350
 
277
351
  export declare function Progress({ className, value, ...props }: React_2.ComponentProps<typeof ProgressPrimitive.Root>): JSX_2.Element;
278
352
 
353
+ declare interface RadioGroupType extends TypeGuard<"RadioGroup"> {
354
+ value: string;
355
+ onValueChange: (value: string) => void;
356
+ radioItems: RadioItemType[];
357
+ separator?: boolean;
358
+ }
359
+
360
+ declare interface RadioItemType extends BaseMenuItemType {
361
+ value: string;
362
+ }
363
+
279
364
  export declare const SearchInput: ({ containerClassName, className: propsClassName, searchSize, disabled, disableFilterIcon, ...rest }: SearchInputProps) => JSX_2.Element;
280
365
 
281
366
  export declare interface SearchInputProps extends InputProps {
@@ -315,6 +400,9 @@ declare type SeparatorProps = React.ComponentProps<typeof Steps_2.Separator> & {
315
400
  index: number;
316
401
  };
317
402
 
403
+ declare interface SeparatorType extends TypeGuard<"Separator"> {
404
+ }
405
+
318
406
  export declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX_2.Element;
319
407
 
320
408
  export declare const SortableHeaderCell: <T extends RowData>({ column, children, tooltipContent, }: SortableHeaderCellProps<T>) => JSX_2.Element;
@@ -347,6 +435,11 @@ export declare const Steps: {
347
435
  NextTrigger: ({ className: propsClassName, ...rest }: React.ComponentProps<typeof Steps_2.NextTrigger>) => JSX_2.Element;
348
436
  };
349
437
 
438
+ declare interface SubMenuItemType extends BaseMenuItemType, TypeGuard<"SubMenuItem"> {
439
+ subItems: DropdownMenuItems;
440
+ separator?: boolean;
441
+ }
442
+
350
443
  export declare function Switch({ className, ...props }: React_2.ComponentProps<typeof SwitchPrimitive.Root>): JSX_2.Element;
351
444
 
352
445
  export declare const Table: <T extends RowData>({ table, emptyStateComponent, noResultsComponent, errorComponent, isLoading, isError, onRowClick, emptyStateTitle, emptyStateDescription, noResultsTitle, wrapperClassName, }: TableProps<T>) => JSX_2.Element;
@@ -365,6 +458,11 @@ export declare type TableProps<T extends RowData> = {
365
458
  wrapperClassName?: string;
366
459
  };
367
460
 
461
+ declare interface TitleHeaderContentType extends TypeGuard<"MenuTitleHeader"> {
462
+ title: string;
463
+ label: string;
464
+ }
465
+
368
466
  export declare function Toggle({ className, variant, size, ...props }: React_2.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>): JSX_2.Element;
369
467
 
370
468
  export declare function ToggleGroup({ className, variant, size, children, ...props }: React_2.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants>): JSX_2.Element;
@@ -388,6 +486,12 @@ declare interface TooltipProps {
388
486
  triggerProps?: TooltipTriggerProps;
389
487
  }
390
488
 
489
+ declare type TriggerElement = React.ReactNode;
490
+
491
+ declare type TypeGuard<T> = {
492
+ type: T;
493
+ };
494
+
391
495
  export declare const typography: {
392
496
  readonly fontFamily: {
393
497
  readonly sans: readonly ["Inter", "system-ui", "sans-serif"];