@rovula/ui 0.0.10 → 0.0.11

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.
Files changed (56) hide show
  1. package/dist/cjs/bundle.css +14 -0
  2. package/dist/cjs/bundle.js +1 -1
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/Button/Button.d.ts +14 -3
  5. package/dist/cjs/types/components/Button/Buttons.stories.d.ts +8 -6
  6. package/dist/cjs/types/components/DataTable/DataTable.d.ts +14 -0
  7. package/dist/cjs/types/components/DataTable/DataTable.stories.d.ts +19 -0
  8. package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +29 -3
  9. package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +31 -30
  10. package/dist/cjs/types/components/Label/Label.stories.d.ts +1 -1
  11. package/dist/cjs/types/components/RadioGroup/RadioGroup.stories.d.ts +1 -1
  12. package/dist/cjs/types/components/Text/Text.d.ts +3 -3
  13. package/dist/cjs/types/components/Text/Text.stories.d.ts +3 -9
  14. package/dist/cjs/types/components/TextInput/TextInput.d.ts +20 -2
  15. package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +28 -1
  16. package/dist/cjs/types/components/ui/table.d.ts +10 -0
  17. package/dist/cjs/types/index.d.ts +3 -0
  18. package/dist/components/Button/Button.js +4 -3
  19. package/dist/components/DataTable/DataTable.js +32 -0
  20. package/dist/components/DataTable/DataTable.stories.js +66 -0
  21. package/dist/components/Dropdown/Dropdown.js +15 -5
  22. package/dist/components/Dropdown/Dropdown.stories.js +48 -0
  23. package/dist/components/Text/Text.js +3 -2
  24. package/dist/components/TextInput/TextInput.js +5 -7
  25. package/dist/components/TextInput/TextInput.stories.js +22 -0
  26. package/dist/components/ui/table.js +66 -0
  27. package/dist/esm/bundle.css +14 -0
  28. package/dist/esm/bundle.js +1 -1
  29. package/dist/esm/bundle.js.map +1 -1
  30. package/dist/esm/types/components/Button/Button.d.ts +14 -3
  31. package/dist/esm/types/components/Button/Buttons.stories.d.ts +8 -6
  32. package/dist/esm/types/components/DataTable/DataTable.d.ts +14 -0
  33. package/dist/esm/types/components/DataTable/DataTable.stories.d.ts +19 -0
  34. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +29 -3
  35. package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +31 -30
  36. package/dist/esm/types/components/Label/Label.stories.d.ts +1 -1
  37. package/dist/esm/types/components/RadioGroup/RadioGroup.stories.d.ts +1 -1
  38. package/dist/esm/types/components/Text/Text.d.ts +3 -3
  39. package/dist/esm/types/components/Text/Text.stories.d.ts +3 -9
  40. package/dist/esm/types/components/TextInput/TextInput.d.ts +20 -2
  41. package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +28 -1
  42. package/dist/esm/types/components/ui/table.d.ts +10 -0
  43. package/dist/esm/types/index.d.ts +3 -0
  44. package/dist/index.d.ts +61 -7
  45. package/dist/src/theme/global.css +18 -0
  46. package/package.json +2 -1
  47. package/src/components/Button/Button.tsx +47 -39
  48. package/src/components/DataTable/DataTable.stories.tsx +76 -0
  49. package/src/components/DataTable/DataTable.tsx +105 -0
  50. package/src/components/Dropdown/Dropdown.stories.tsx +87 -3
  51. package/src/components/Dropdown/Dropdown.tsx +147 -109
  52. package/src/components/Text/Text.tsx +21 -19
  53. package/src/components/TextInput/TextInput.stories.tsx +46 -1
  54. package/src/components/TextInput/TextInput.tsx +7 -7
  55. package/src/components/ui/table.tsx +117 -0
  56. package/src/index.ts +5 -0
@@ -1,5 +1,5 @@
1
- import React, { FC, ReactElement } from "react";
2
- type ButtonProps = {
1
+ import React, { ReactElement } from "react";
2
+ export type ButtonProps = {
3
3
  title?: string;
4
4
  size?: "sm" | "md" | "lg";
5
5
  color?: "primary" | "secondary" | "success" | "tertiary" | "info" | "warning" | "error";
@@ -11,5 +11,16 @@ type ButtonProps = {
11
11
  startIcon?: ReactElement;
12
12
  endIcon?: ReactElement;
13
13
  } & React.ButtonHTMLAttributes<HTMLButtonElement>;
14
- declare const Button: FC<ButtonProps>;
14
+ declare const Button: React.ForwardRefExoticComponent<{
15
+ title?: string | undefined;
16
+ size?: "sm" | "md" | "lg" | undefined;
17
+ color?: "primary" | "secondary" | "tertiary" | "success" | "info" | "warning" | "error" | undefined;
18
+ variant?: "solid" | "outline" | "flat" | "link" | undefined;
19
+ disabled?: boolean | undefined;
20
+ isLoading?: boolean | undefined;
21
+ fullwidth?: boolean | undefined;
22
+ children?: React.ReactNode;
23
+ startIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
24
+ endIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
25
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
15
26
  export default Button;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  declare const meta: {
3
3
  title: string;
4
- component: React.FC<{
4
+ component: React.ForwardRefExoticComponent<{
5
5
  title?: string | undefined;
6
6
  size?: "sm" | "md" | "lg" | undefined;
7
7
  color?: "primary" | "secondary" | "tertiary" | "success" | "info" | "warning" | "error" | undefined;
@@ -12,7 +12,7 @@ declare const meta: {
12
12
  children?: React.ReactNode;
13
13
  startIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
14
14
  endIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
15
- } & React.ButtonHTMLAttributes<HTMLButtonElement>>;
15
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
16
16
  tags: string[];
17
17
  parameters: {
18
18
  layout: string;
@@ -299,6 +299,8 @@ declare const meta: {
299
299
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
300
300
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
301
301
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
302
+ ref?: React.LegacyRef<HTMLButtonElement> | undefined;
303
+ key?: React.Key | null | undefined;
302
304
  }>) => import("react/jsx-runtime").JSX.Element)[];
303
305
  };
304
306
  export default meta;
@@ -317,7 +319,7 @@ export declare const Solid: {
317
319
  children?: React.ReactNode;
318
320
  startIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
319
321
  endIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
320
- } & React.ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
322
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
321
323
  };
322
324
  export declare const Outline: {
323
325
  args: {
@@ -335,7 +337,7 @@ export declare const Outline: {
335
337
  children?: React.ReactNode;
336
338
  startIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
337
339
  endIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
338
- } & React.ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
340
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
339
341
  };
340
342
  export declare const Flat: {
341
343
  args: {
@@ -353,7 +355,7 @@ export declare const Flat: {
353
355
  children?: React.ReactNode;
354
356
  startIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
355
357
  endIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
356
- } & React.ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
358
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
357
359
  };
358
360
  export declare const Link: {
359
361
  args: {
@@ -371,5 +373,5 @@ export declare const Link: {
371
373
  children?: React.ReactNode;
372
374
  startIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
373
375
  endIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
374
- } & React.ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
376
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
375
377
  };
@@ -0,0 +1,14 @@
1
+ import { ColumnDef } from "@tanstack/react-table";
2
+ export type Payment = {
3
+ id: string;
4
+ amount: number;
5
+ status: "pending" | "processing" | "success" | "failed";
6
+ email: string;
7
+ };
8
+ export declare const columns: ColumnDef<Payment>[];
9
+ interface DataTableProps<TData, TValue> {
10
+ columns: ColumnDef<TData, TValue>[];
11
+ data: TData[];
12
+ }
13
+ export declare function DataTable<TData, TValue>({ columns, data, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,19 @@
1
+ import { DataTable } from "./DataTable";
2
+ import { ColumnDef } from "@tanstack/react-table";
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof DataTable;
6
+ tags: string[];
7
+ parameters: {
8
+ layout: string;
9
+ };
10
+ decorators: ((Story: import("@storybook/types").PartialStoryFn<import("@storybook/react").ReactRenderer, {
11
+ columns: ColumnDef<unknown, unknown>[];
12
+ data: unknown[];
13
+ }>) => import("react/jsx-runtime").JSX.Element)[];
14
+ };
15
+ export default meta;
16
+ export declare const Default: {
17
+ args: {};
18
+ render: (args: {}) => import("react/jsx-runtime").JSX.Element;
19
+ };
@@ -1,9 +1,17 @@
1
+ import React, { ReactNode } from "react";
1
2
  import { InputProps } from "../TextInput/TextInput";
2
- type Options = {
3
+ type RenderLabelCallbackArg = {
3
4
  value: string;
4
5
  label: string;
6
+ handleOnClick: () => void;
7
+ className: string;
5
8
  };
6
- type DropdownProps = {
9
+ export type Options = {
10
+ value: string;
11
+ label: string;
12
+ renderLabel?: (config: RenderLabelCallbackArg) => ReactNode;
13
+ };
14
+ export type DropdownProps = {
7
15
  id?: string;
8
16
  label?: string;
9
17
  size?: "sm" | "md" | "lg";
@@ -22,5 +30,23 @@ type DropdownProps = {
22
30
  onChangeText?: InputProps["onChange"];
23
31
  onSelect?: (value: Options) => void;
24
32
  } & Omit<InputProps, "value">;
25
- declare const Dropdown: ({ id, options, value, label, size, rounded, variant, helperText, errorMessage, fullwidth, disabled, error, filterMode, required, onChangeText, onSelect, ...props }: DropdownProps) => import("react/jsx-runtime").JSX.Element;
33
+ declare const Dropdown: React.ForwardRefExoticComponent<{
34
+ id?: string | undefined;
35
+ label?: string | undefined;
36
+ size?: "sm" | "md" | "lg" | undefined;
37
+ rounded?: "none" | "normal" | "full" | undefined;
38
+ variant?: "outline" | "flat" | "underline" | undefined;
39
+ helperText?: string | undefined;
40
+ errorMessage?: string | undefined;
41
+ filterMode?: boolean | undefined;
42
+ fullwidth?: boolean | undefined;
43
+ disabled?: boolean | undefined;
44
+ error?: boolean | undefined;
45
+ required?: boolean | undefined;
46
+ className?: string | undefined;
47
+ options: Options[];
48
+ value?: Options | undefined;
49
+ onChangeText?: InputProps["onChange"];
50
+ onSelect?: ((value: Options) => void) | undefined;
51
+ } & Omit<InputProps, "value"> & React.RefAttributes<HTMLInputElement>>;
26
52
  export default Dropdown;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
+ import { Options } from "./Dropdown";
2
3
  declare const meta: {
3
4
  title: string;
4
- component: ({ id, options, value, label, size, rounded, variant, helperText, errorMessage, fullwidth, disabled, error, filterMode, required, onChangeText, onSelect, ...props }: {
5
+ component: React.ForwardRefExoticComponent<{
5
6
  id?: string | undefined;
6
7
  label?: string | undefined;
7
8
  size?: "sm" | "md" | "lg" | undefined;
@@ -15,20 +16,11 @@ declare const meta: {
15
16
  error?: boolean | undefined;
16
17
  required?: boolean | undefined;
17
18
  className?: string | undefined;
18
- options: {
19
- value: string;
20
- label: string;
21
- }[];
22
- value?: {
23
- value: string;
24
- label: string;
25
- } | undefined;
19
+ options: Options[];
20
+ value?: Options | undefined;
26
21
  onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
27
- onSelect?: ((value: {
28
- value: string;
29
- label: string;
30
- }) => void) | undefined;
31
- } & Omit<import("../TextInput/TextInput").InputProps, "value">) => import("react/jsx-runtime").JSX.Element;
22
+ onSelect?: ((value: Options) => void) | undefined;
23
+ } & Omit<import("../..").InputProps, "value"> & React.RefAttributes<HTMLInputElement>>;
32
24
  tags: string[];
33
25
  parameters: {
34
26
  layout: string;
@@ -47,19 +39,10 @@ declare const meta: {
47
39
  error?: boolean | undefined;
48
40
  required?: boolean | undefined;
49
41
  className?: string | undefined;
50
- options: {
51
- value: string;
52
- label: string;
53
- }[];
54
- value?: {
55
- value: string;
56
- label: string;
57
- } | undefined;
42
+ options: Options[];
43
+ value?: Options | undefined;
58
44
  onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
59
- onSelect?: (((value: {
60
- value: string;
61
- label: string;
62
- }) => void) & React.ReactEventHandler<HTMLInputElement>) | undefined;
45
+ onSelect?: (((value: Options) => void) & React.ReactEventHandler<HTMLInputElement>) | undefined;
63
46
  color?: string | undefined;
64
47
  title?: string | undefined;
65
48
  children?: React.ReactNode;
@@ -351,6 +334,9 @@ declare const meta: {
351
334
  src?: string | undefined;
352
335
  step?: string | number | undefined;
353
336
  width?: string | number | undefined;
337
+ labelClassName?: string | undefined;
338
+ ref?: React.LegacyRef<HTMLInputElement> | undefined;
339
+ key?: React.Key | null | undefined;
354
340
  }>) => import("react/jsx-runtime").JSX.Element)[];
355
341
  };
356
342
  export default meta;
@@ -358,10 +344,25 @@ export declare const Default: {
358
344
  args: {
359
345
  label: string;
360
346
  fullwidth: boolean;
361
- options: {
362
- value: string;
363
- label: string;
364
- }[];
347
+ options: Options[];
348
+ };
349
+ render: (args: {}) => import("react/jsx-runtime").JSX.Element;
350
+ };
351
+ export declare const WithRef: {
352
+ args: {
353
+ label: string;
354
+ fullwidth: boolean;
355
+ options: Options[];
356
+ filterMode: boolean;
357
+ };
358
+ render: (args: {}) => import("react/jsx-runtime").JSX.Element;
359
+ };
360
+ export declare const CustomOption: {
361
+ args: {
362
+ label: string;
363
+ fullwidth: boolean;
364
+ options: Options[];
365
+ filterMode: boolean;
365
366
  };
366
367
  render: (args: {}) => import("react/jsx-runtime").JSX.Element;
367
368
  };
@@ -273,8 +273,8 @@ declare const meta: {
273
273
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLLabelElement> | undefined;
274
274
  onTransitionEnd?: React.TransitionEventHandler<HTMLLabelElement> | undefined;
275
275
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLLabelElement> | undefined;
276
- key?: React.Key | null | undefined;
277
276
  htmlFor?: string | undefined;
277
+ key?: React.Key | null | undefined;
278
278
  asChild?: boolean | undefined;
279
279
  ref?: React.LegacyRef<HTMLLabelElement> | undefined;
280
280
  }>) => import("react/jsx-runtime").JSX.Element)[];
@@ -276,8 +276,8 @@ declare const meta: {
276
276
  onTransitionEnd?: React.TransitionEventHandler<HTMLDivElement> | undefined;
277
277
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLDivElement> | undefined;
278
278
  required?: boolean | undefined;
279
- key?: React.Key | null | undefined;
280
279
  orientation?: "horizontal" | "vertical" | undefined;
280
+ key?: React.Key | null | undefined;
281
281
  asChild?: boolean | undefined;
282
282
  loop?: boolean | undefined;
283
283
  onValueChange?: ((value: string) => void) | undefined;
@@ -1,5 +1,5 @@
1
- import React, { FC } from "react";
2
- type TextProps = {
1
+ import React from "react";
2
+ export type TextProps = {
3
3
  variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "subtitile1" | "subtitile2" | "subtitile3" | "subtitile4" | "subtitile5" | "subtitile6" | "body1" | "body2" | "body3" | "body4" | "small1" | "small2" | "small3" | "label1" | "label2";
4
4
  color?: "primary" | "secondary" | "success" | "tertiary" | "info" | "warning" | "error";
5
5
  children?: React.ReactNode;
@@ -8,5 +8,5 @@ type TextProps = {
8
8
  style?: React.CSSProperties;
9
9
  id?: string;
10
10
  };
11
- declare const Text: FC<TextProps>;
11
+ declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<keyof JSX.IntrinsicElements | undefined>>;
12
12
  export default Text;
@@ -1,15 +1,7 @@
1
1
  import React from "react";
2
2
  declare const meta: {
3
3
  title: string;
4
- component: React.FC<{
5
- variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "subtitile1" | "subtitile2" | "subtitile3" | "subtitile4" | "subtitile5" | "subtitile6" | "body1" | "body2" | "body3" | "body4" | "small1" | "small2" | "small3" | "label1" | "label2" | undefined;
6
- color?: "primary" | "secondary" | "tertiary" | "success" | "info" | "warning" | "error" | undefined;
7
- children?: React.ReactNode;
8
- className?: string | undefined;
9
- tag?: keyof JSX.IntrinsicElements | undefined;
10
- style?: React.CSSProperties | undefined;
11
- id?: string | undefined;
12
- }>;
4
+ component: React.ForwardRefExoticComponent<import("./Text").TextProps & React.RefAttributes<keyof JSX.IntrinsicElements | undefined>>;
13
5
  tags: string[];
14
6
  parameters: {
15
7
  layout: string;
@@ -22,6 +14,8 @@ declare const meta: {
22
14
  tag?: keyof JSX.IntrinsicElements | undefined;
23
15
  style?: React.CSSProperties | undefined;
24
16
  id?: string | undefined;
17
+ ref?: React.LegacyRef<keyof JSX.IntrinsicElements | undefined> | undefined;
18
+ key?: React.Key | null | undefined;
25
19
  }>) => import("react/jsx-runtime").JSX.Element)[];
26
20
  };
27
21
  export default meta;
@@ -1,4 +1,4 @@
1
- import React, { FC, ReactNode } from "react";
1
+ import React, { ReactNode } from "react";
2
2
  export type InputProps = {
3
3
  id?: string;
4
4
  label?: string;
@@ -15,6 +15,24 @@ export type InputProps = {
15
15
  hasClearIcon?: boolean;
16
16
  endIcon?: ReactNode;
17
17
  className?: string;
18
+ labelClassName?: string;
18
19
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">;
19
- declare const TextInput: FC<InputProps>;
20
+ export declare const TextInput: React.ForwardRefExoticComponent<{
21
+ id?: string | undefined;
22
+ label?: string | undefined;
23
+ size?: "sm" | "md" | "lg" | undefined;
24
+ rounded?: "none" | "normal" | "full" | undefined;
25
+ variant?: "outline" | "flat" | "underline" | undefined;
26
+ type?: React.HTMLInputTypeAttribute | undefined;
27
+ helperText?: string | undefined;
28
+ errorMessage?: string | undefined;
29
+ fullwidth?: boolean | undefined;
30
+ disabled?: boolean | undefined;
31
+ error?: boolean | undefined;
32
+ required?: boolean | undefined;
33
+ hasClearIcon?: boolean | undefined;
34
+ endIcon?: ReactNode;
35
+ className?: string | undefined;
36
+ labelClassName?: string | undefined;
37
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
20
38
  export default TextInput;
@@ -1,7 +1,24 @@
1
1
  import React from "react";
2
2
  declare const meta: {
3
3
  title: string;
4
- component: React.FC<import("./TextInput").InputProps>;
4
+ component: React.ForwardRefExoticComponent<{
5
+ id?: string | undefined;
6
+ label?: string | undefined;
7
+ size?: "sm" | "md" | "lg" | undefined;
8
+ rounded?: "none" | "normal" | "full" | undefined;
9
+ variant?: "outline" | "flat" | "underline" | undefined;
10
+ type?: React.HTMLInputTypeAttribute | undefined;
11
+ helperText?: string | undefined;
12
+ errorMessage?: string | undefined;
13
+ fullwidth?: boolean | undefined;
14
+ disabled?: boolean | undefined;
15
+ error?: boolean | undefined;
16
+ required?: boolean | undefined;
17
+ hasClearIcon?: boolean | undefined;
18
+ endIcon?: React.ReactNode;
19
+ className?: string | undefined;
20
+ labelClassName?: string | undefined;
21
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
5
22
  tags: string[];
6
23
  parameters: {
7
24
  layout: string;
@@ -22,6 +39,7 @@ declare const meta: {
22
39
  hasClearIcon?: boolean | undefined;
23
40
  endIcon?: React.ReactNode;
24
41
  className?: string | undefined;
42
+ labelClassName?: string | undefined;
25
43
  color?: string | undefined;
26
44
  title?: string | undefined;
27
45
  children?: React.ReactNode;
@@ -312,6 +330,8 @@ declare const meta: {
312
330
  src?: string | undefined;
313
331
  step?: string | number | undefined;
314
332
  width?: string | number | undefined;
333
+ ref?: React.LegacyRef<HTMLInputElement> | undefined;
334
+ key?: React.Key | null | undefined;
315
335
  }>) => import("react/jsx-runtime").JSX.Element)[];
316
336
  };
317
337
  export default meta;
@@ -322,3 +342,10 @@ export declare const Default: {
322
342
  };
323
343
  render: (args: {}) => import("react/jsx-runtime").JSX.Element;
324
344
  };
345
+ export declare const CustomLabel: {
346
+ args: {
347
+ label: string;
348
+ fullwidth: boolean;
349
+ };
350
+ render: (args: {}) => import("react/jsx-runtime").JSX.Element;
351
+ };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
3
+ declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
4
+ declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
5
+ declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
6
+ declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
7
+ declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
8
+ declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
9
+ declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
10
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
@@ -10,5 +10,8 @@ export { Input } from "./components/Input/Input";
10
10
  export * from "./components/Table/Table";
11
11
  export * from "./components/Dialog/Dialog";
12
12
  export * from "./components/AlertDialog/AlertDialog";
13
+ export type { ButtonProps } from "./components/Button/Button";
14
+ export type { InputProps } from "./components/TextInput/TextInput";
15
+ export type { DropdownProps } from "./components/Dropdown/Dropdown";
13
16
  export { resloveTimestamp, getStartDateOfDay, getEndDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, } from "./utils/datetime";
14
17
  export { cn } from "./utils/cn";
@@ -21,11 +21,12 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
24
+ import { forwardRef } from "react";
24
25
  import { buttonVariants } from "./Button.styles";
25
26
  import { cn } from "@/utils/cn";
26
- var Button = function (_a) {
27
+ var Button = forwardRef(function (_a, ref) {
27
28
  var _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.color, color = _c === void 0 ? "primary" : _c, _d = _a.variant, variant = _d === void 0 ? "solid" : _d, title = _a.title, children = _a.children, startIcon = _a.startIcon, endIcon = _a.endIcon, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.fullwidth, fullwidth = _f === void 0 ? false : _f, _g = _a.isLoading, isLoading = _g === void 0 ? false : _g, className = _a.className, props = __rest(_a, ["size", "color", "variant", "title", "children", "startIcon", "endIcon", "disabled", "fullwidth", "isLoading", "className"]);
28
29
  var isDisabled = disabled || isLoading;
29
- return (_jsx("button", __assign({ type: "button" }, props, { "aria-disabled": isDisabled || undefined, tabIndex: isDisabled ? -1 : 0, className: cn(buttonVariants({ size: size, color: color, variant: variant, disabled: disabled, fullwidth: fullwidth }), className), disabled: isDisabled, children: _jsxs(_Fragment, { children: [startIcon, children || title, endIcon] }) })));
30
- };
30
+ return (_jsx("button", __assign({ type: "button" }, props, { ref: ref, "aria-disabled": isDisabled || undefined, tabIndex: isDisabled ? -1 : 0, className: cn(buttonVariants({ size: size, color: color, variant: variant, disabled: disabled, fullwidth: fullwidth }), className), disabled: isDisabled, children: _jsxs(_Fragment, { children: [startIcon, children || title, endIcon] }) })));
31
+ });
31
32
  export default Button;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { flexRender, getCoreRowModel, useReactTable, } from "@tanstack/react-table";
4
+ export var columns = [
5
+ {
6
+ accessorKey: "status",
7
+ header: "Status",
8
+ },
9
+ {
10
+ accessorKey: "email",
11
+ header: "Email",
12
+ },
13
+ {
14
+ accessorKey: "amount",
15
+ header: "Amount",
16
+ },
17
+ ];
18
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table";
19
+ export function DataTable(_a) {
20
+ var _b;
21
+ var columns = _a.columns, data = _a.data;
22
+ var table = useReactTable({
23
+ data: data,
24
+ columns: columns,
25
+ getCoreRowModel: getCoreRowModel(),
26
+ });
27
+ return (_jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: table.getHeaderGroups().map(function (headerGroup) { return (_jsx(TableRow, { children: headerGroup.headers.map(function (header) {
28
+ return (_jsx(TableHead, { children: header.isPlaceholder
29
+ ? null
30
+ : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
31
+ }) }, headerGroup.id)); }) }), _jsx(TableBody, { children: ((_b = table.getRowModel().rows) === null || _b === void 0 ? void 0 : _b.length) ? (table.getRowModel().rows.map(function (row) { return (_jsx(TableRow, { "data-state": row.getIsSelected() && "selected", children: row.getVisibleCells().map(function (cell) { return (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)); }) }, row.id)); })) : (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) })) })] }) }));
32
+ }
@@ -0,0 +1,66 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { DataTable } from "./DataTable";
14
+ var meta = {
15
+ title: "Components/DataTable",
16
+ component: DataTable,
17
+ tags: ["autodocs"],
18
+ parameters: {
19
+ layout: "fullscreen",
20
+ },
21
+ decorators: [
22
+ function (Story) { return (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })); },
23
+ ],
24
+ };
25
+ export default meta;
26
+ var columns = [
27
+ {
28
+ accessorKey: "amount",
29
+ header: function () { return _jsx("div", { className: "text-right", children: "Amount" }); },
30
+ cell: function (_a) {
31
+ var row = _a.row;
32
+ var amount = parseFloat(row.getValue("amount"));
33
+ var formatted = new Intl.NumberFormat("en-US", {
34
+ style: "currency",
35
+ currency: "USD",
36
+ }).format(amount);
37
+ return _jsx("div", { className: "text-right font-medium", children: formatted });
38
+ },
39
+ },
40
+ {
41
+ accessorKey: "status",
42
+ },
43
+ {
44
+ accessorKey: "email",
45
+ },
46
+ ];
47
+ export var Default = {
48
+ args: {
49
+ // label: "Lorem Ipsum",
50
+ // value: "Lorem Ipsum",
51
+ // fullwidth: true,
52
+ },
53
+ render: function (args) {
54
+ console.log("args ", args);
55
+ var props = __assign({}, args);
56
+ var data = [
57
+ {
58
+ id: "728ed52f",
59
+ amount: 100,
60
+ status: "pending",
61
+ email: "m@example.com",
62
+ },
63
+ ];
64
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DataTable, { columns: columns, data: data }) }));
65
+ },
66
+ };
@@ -21,11 +21,11 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- import { useCallback, useEffect, useMemo, useState } from "react";
24
+ import { Fragment, forwardRef, useCallback, useEffect, useMemo, useState, } from "react";
25
25
  import TextInput from "../TextInput/TextInput";
26
26
  import { customInputVariant, dropdownIconVariant, iconWrapperVariant, } from "./Dropdown.styles";
27
27
  import { ChevronDownIcon } from "@heroicons/react/16/solid";
28
- var Dropdown = function (_a) {
28
+ var Dropdown = forwardRef(function (_a, ref) {
29
29
  var id = _a.id, options = _a.options, value = _a.value, label = _a.label, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.rounded, rounded = _c === void 0 ? "normal" : _c, _d = _a.variant, variant = _d === void 0 ? "outline" : _d, helperText = _a.helperText, errorMessage = _a.errorMessage, _e = _a.fullwidth, fullwidth = _e === void 0 ? true : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.error, error = _g === void 0 ? false : _g, _h = _a.filterMode, filterMode = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? true : _j, onChangeText = _a.onChangeText, onSelect = _a.onSelect, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "onChangeText", "onSelect"]);
30
30
  var _id = id || "".concat(label, "-select");
31
31
  var _k = useState(false), isFocused = _k[0], setIsFocused = _k[1];
@@ -52,7 +52,17 @@ var Dropdown = function (_a) {
52
52
  ((_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(textValue === null || textValue === void 0 ? void 0 : textValue.toLowerCase()));
53
53
  });
54
54
  }, [options, filterMode, textValue]);
55
- var renderOptions = function () { return (_jsxs("ul", { className: "absolute mt-1 w-full bg-white border border-gray-300 rounded-md shadow-md z-10 max-h-60 overflow-y-auto", children: [optionsFiltered.map(function (option) { return (_jsx("li", { onMouseDown: function () { return handleOptionClick(option); }, className: "px-4 py-2 hover:bg-gray-100 cursor-pointer ".concat((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value ? " bg-gray-200" : ""), children: option.label }, option.value)); }), optionsFiltered.length === 0 && (_jsx("li", { className: "px-4 py-14 text-center text-input-text", children: "Not found" }))] })); };
56
- return (_jsxs("div", { className: "relative ".concat(fullwidth ? "w-full" : ""), children: [_jsx(TextInput, __assign({}, props, { readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, hasClearIcon: false, size: size, className: customInputVariant({ size: size }), onFocus: function () { return setIsFocused(true); }, onBlur: function () { return setIsFocused(false); }, endIcon: _jsx("div", { className: iconWrapperVariant({ size: size }), children: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ size: size, isFocus: isFocused }) }) }) })), isFocused && renderOptions()] }));
57
- };
55
+ var renderOptions = function () { return (_jsxs("ul", { className: "absolute mt-1 w-full bg-white border border-gray-300 rounded-md shadow-md z-10 max-h-60 overflow-y-auto", children: [optionsFiltered.map(function (option) {
56
+ if (option.renderLabel) {
57
+ return (_jsx(Fragment, { children: option.renderLabel({
58
+ value: option.value,
59
+ label: option.label,
60
+ handleOnClick: function () { return handleOptionClick(option); },
61
+ className: "px-4 py-2 hover:bg-gray-100 cursor-pointer ".concat((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value ? " bg-gray-200" : ""),
62
+ }) }, option.value));
63
+ }
64
+ return (_jsx("li", { onMouseDown: function () { return handleOptionClick(option); }, className: "px-4 py-2 hover:bg-gray-100 cursor-pointer ".concat((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value ? " bg-gray-200" : ""), children: option.label }, option.value));
65
+ }), optionsFiltered.length === 0 && (_jsx("li", { className: "px-4 py-14 text-center text-input-text", children: "Not found" }))] })); };
66
+ return (_jsxs("div", { className: "relative ".concat(fullwidth ? "w-full" : ""), children: [_jsx(TextInput, __assign({}, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, hasClearIcon: false, size: size, className: customInputVariant({ size: size }), onFocus: function () { return setIsFocused(true); }, onBlur: function () { return setIsFocused(false); }, endIcon: _jsx("div", { className: iconWrapperVariant({ size: size }), children: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ size: size, isFocus: isFocused }) }) }) })), isFocused && renderOptions()] }));
67
+ });
58
68
  export default Dropdown;