@rovula/ui 0.0.48 → 0.0.50

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 (33) hide show
  1. package/dist/cjs/bundle.css +9 -3
  2. package/dist/cjs/bundle.js +3 -3
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/Tree/Tree.d.ts +4 -45
  5. package/dist/cjs/types/components/Tree/Tree.stories.d.ts +9 -1
  6. package/dist/cjs/types/components/Tree/TreeItem.d.ts +4 -0
  7. package/dist/cjs/types/components/Tree/index.d.ts +4 -0
  8. package/dist/cjs/types/components/Tree/type.d.ts +76 -0
  9. package/dist/cjs/types/index.d.ts +1 -0
  10. package/dist/components/Tree/Tree.js +20 -52
  11. package/dist/components/Tree/Tree.stories.js +2210 -8
  12. package/dist/components/Tree/TreeItem.js +81 -0
  13. package/dist/components/Tree/index.js +4 -0
  14. package/dist/components/Tree/type.js +1 -0
  15. package/dist/esm/bundle.css +9 -3
  16. package/dist/esm/bundle.js +1 -1
  17. package/dist/esm/bundle.js.map +1 -1
  18. package/dist/esm/types/components/Tree/Tree.d.ts +4 -45
  19. package/dist/esm/types/components/Tree/Tree.stories.d.ts +9 -1
  20. package/dist/esm/types/components/Tree/TreeItem.d.ts +4 -0
  21. package/dist/esm/types/components/Tree/index.d.ts +4 -0
  22. package/dist/esm/types/components/Tree/type.d.ts +76 -0
  23. package/dist/esm/types/index.d.ts +1 -0
  24. package/dist/index.d.ts +82 -2
  25. package/dist/index.js +1 -0
  26. package/dist/src/theme/global.css +12 -4
  27. package/package.json +1 -1
  28. package/src/components/Tree/Tree.stories.tsx +2397 -8
  29. package/src/components/Tree/Tree.tsx +52 -188
  30. package/src/components/Tree/TreeItem.tsx +232 -0
  31. package/src/components/Tree/index.ts +5 -0
  32. package/src/components/Tree/type.ts +90 -0
  33. package/src/index.ts +1 -0
@@ -1,45 +1,4 @@
1
- import { FC, ReactNode } from "react";
2
- export type TreeData = {
3
- id: string;
4
- title: string;
5
- icon?: ReactNode;
6
- children?: TreeData[];
7
- };
8
- export interface TreeItemProps extends TreeData {
9
- isFirstLevel?: boolean;
10
- isLastItem: boolean;
11
- checkIsExpanded: (id: string) => boolean;
12
- checkIsChecked: (id: string) => boolean;
13
- onExpandChange?: (id: string, expanded: boolean) => void;
14
- onCheckedChange?: (id: string, checked: boolean) => void;
15
- }
16
- export type TreeProps = {
17
- data: TreeData[];
18
- defaultExpandedId?: string[];
19
- defaultCheckedId?: string[];
20
- checkedId?: string[];
21
- onCheckedChange?: (checkedId: string[]) => void;
22
- defaultExpandAll?: boolean;
23
- defaultCheckAll?: boolean;
24
- hierarchicalCheck?: boolean;
25
- };
26
- export declare const Tree: FC<TreeProps>;
27
- /**
28
- * TODO
29
- * -----
30
- * - Custom style
31
- * - Custom icon, elm and render props -> callback with selected*expanded
32
- * - OnClick item
33
- * - OnClick expandButton
34
- * - disabled props
35
- * - right section icon
36
- * - props for show icon, line
37
- * - props for render item
38
- * - OnLoad mode
39
- * -----
40
- * - props onLoad item
41
- * - props for hasChildren * for check to trigger on load
42
- * - animate expand
43
- * - check duplicate reversive on updateChildren
44
- * - write storybook
45
- */
1
+ import { FC } from "react";
2
+ import { TreeProps } from "./type";
3
+ declare const Tree: FC<TreeProps>;
4
+ export default Tree;
@@ -1,5 +1,13 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
- import { Tree } from "./Tree";
2
+ import Tree from "./Tree";
3
3
  declare const meta: Meta<typeof Tree>;
4
4
  export default meta;
5
5
  export declare const Default: StoryObj<typeof Tree>;
6
+ export declare const Controller: StoryObj<typeof Tree>;
7
+ export declare const onClick: StoryObj<typeof Tree>;
8
+ export declare const CustomIcon: StoryObj<typeof Tree>;
9
+ export declare const renderRightSection: StoryObj<typeof Tree>;
10
+ export declare const ControlShowExpandButton: StoryObj<typeof Tree>;
11
+ export declare const Diabled: StoryObj<typeof Tree>;
12
+ export declare const DiabledEachItem: StoryObj<typeof Tree>;
13
+ export declare const ExpandLoadData: StoryObj<typeof Tree>;
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { TreeItemProps } from "./type";
3
+ declare const TreeItem: FC<TreeItemProps>;
4
+ export default TreeItem;
@@ -0,0 +1,4 @@
1
+ import Tree from "./Tree";
2
+ import TreeItem from "./TreeItem";
3
+ export * from "./type";
4
+ export { Tree, TreeItem };
@@ -0,0 +1,76 @@
1
+ import { CSSProperties, ReactNode } from "react";
2
+ export type TreeData = {
3
+ id: string;
4
+ title: string;
5
+ icon?: ReactNode;
6
+ disabled?: boolean;
7
+ onClickItem?: (id: string) => void;
8
+ children?: TreeData[];
9
+ renderIcon?: (params: {
10
+ id: string;
11
+ expanded: boolean;
12
+ selected: boolean;
13
+ }) => ReactNode;
14
+ };
15
+ export interface TreeItemProps extends TreeData {
16
+ isFirstLevel?: boolean;
17
+ isLastItem: boolean;
18
+ disabled?: boolean;
19
+ showIcon?: boolean;
20
+ showExpandButton?: boolean;
21
+ enableSeparatorLine?: boolean;
22
+ checkIsExpanded: (id: string) => boolean;
23
+ checkIsChecked: (id: string) => boolean;
24
+ checkIsLoading?: (id: string) => void;
25
+ onExpandChange?: (id: string, expanded: boolean) => void;
26
+ onCheckedChange?: (id: string, checked: boolean) => void;
27
+ renderRightSection?: (params: {
28
+ id: string;
29
+ expanded: boolean;
30
+ selected: boolean;
31
+ }) => ReactNode;
32
+ renderElement?: (params: {
33
+ id: string;
34
+ expanded: boolean;
35
+ selected: boolean;
36
+ children: ReactNode;
37
+ styles: {
38
+ branch: CSSProperties;
39
+ horizontalLine: CSSProperties;
40
+ expandButton: CSSProperties;
41
+ childPadding: CSSProperties;
42
+ };
43
+ onClick?: TreeItemProps["onClickItem"];
44
+ }) => ReactNode;
45
+ renderTitle?: (params: {
46
+ id: string;
47
+ title: string;
48
+ expanded: boolean;
49
+ selected: boolean;
50
+ }) => ReactNode;
51
+ classes?: Partial<{
52
+ elementWrapper: string;
53
+ branch: string;
54
+ itemWrapper: string;
55
+ itemContainer: string;
56
+ horizontalLine: string;
57
+ expandButton: string;
58
+ separatorLine: string;
59
+ checkbox: string;
60
+ item: string;
61
+ title: string;
62
+ childrenWrapper: string;
63
+ }>;
64
+ }
65
+ export interface TreeProps extends Pick<TreeItemProps, "renderIcon" | "renderRightSection" | "renderElement" | "renderTitle" | "showIcon" | "disabled" | "enableSeparatorLine" | "classes"> {
66
+ data: TreeData[];
67
+ defaultExpandedId?: string[];
68
+ defaultCheckedId?: string[];
69
+ checkedId?: string[];
70
+ loadingId?: string[];
71
+ onExpandChange?: (id: string, expanded: boolean) => void;
72
+ onCheckedChange?: (checkedId: string[]) => void;
73
+ defaultExpandAll?: boolean;
74
+ defaultCheckAll?: boolean;
75
+ hierarchicalCheck?: boolean;
76
+ }
@@ -32,6 +32,7 @@ export * from "./components/Tooltip/TooltipSimple";
32
32
  export * from "./components/Toast/Toast";
33
33
  export * from "./components/Toast/Toaster";
34
34
  export * from "./components/Toast/useToast";
35
+ export * from "./components/Tree";
35
36
  export type { ButtonProps } from "./components/Button/Button";
36
37
  export type { InputProps } from "./components/TextInput/TextInput";
37
38
  export type { DropdownProps, Options } from "./components/Dropdown/Dropdown";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { ReactElement, ReactNode, FC, ComponentPropsWithoutRef } from 'react';
2
+ import React__default, { ReactElement, ReactNode, FC, ComponentPropsWithoutRef, CSSProperties } from 'react';
3
3
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
4
4
  import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
5
5
  import * as LabelPrimitive from '@radix-ui/react-label';
@@ -601,6 +601,86 @@ declare function useToast(options?: ToastOptions): {
601
601
  position?: ToasterPosition;
602
602
  };
603
603
 
604
+ type TreeData = {
605
+ id: string;
606
+ title: string;
607
+ icon?: ReactNode;
608
+ disabled?: boolean;
609
+ onClickItem?: (id: string) => void;
610
+ children?: TreeData[];
611
+ renderIcon?: (params: {
612
+ id: string;
613
+ expanded: boolean;
614
+ selected: boolean;
615
+ }) => ReactNode;
616
+ };
617
+ interface TreeItemProps extends TreeData {
618
+ isFirstLevel?: boolean;
619
+ isLastItem: boolean;
620
+ disabled?: boolean;
621
+ showIcon?: boolean;
622
+ showExpandButton?: boolean;
623
+ enableSeparatorLine?: boolean;
624
+ checkIsExpanded: (id: string) => boolean;
625
+ checkIsChecked: (id: string) => boolean;
626
+ checkIsLoading?: (id: string) => void;
627
+ onExpandChange?: (id: string, expanded: boolean) => void;
628
+ onCheckedChange?: (id: string, checked: boolean) => void;
629
+ renderRightSection?: (params: {
630
+ id: string;
631
+ expanded: boolean;
632
+ selected: boolean;
633
+ }) => ReactNode;
634
+ renderElement?: (params: {
635
+ id: string;
636
+ expanded: boolean;
637
+ selected: boolean;
638
+ children: ReactNode;
639
+ styles: {
640
+ branch: CSSProperties;
641
+ horizontalLine: CSSProperties;
642
+ expandButton: CSSProperties;
643
+ childPadding: CSSProperties;
644
+ };
645
+ onClick?: TreeItemProps["onClickItem"];
646
+ }) => ReactNode;
647
+ renderTitle?: (params: {
648
+ id: string;
649
+ title: string;
650
+ expanded: boolean;
651
+ selected: boolean;
652
+ }) => ReactNode;
653
+ classes?: Partial<{
654
+ elementWrapper: string;
655
+ branch: string;
656
+ itemWrapper: string;
657
+ itemContainer: string;
658
+ horizontalLine: string;
659
+ expandButton: string;
660
+ separatorLine: string;
661
+ checkbox: string;
662
+ item: string;
663
+ title: string;
664
+ childrenWrapper: string;
665
+ }>;
666
+ }
667
+ interface TreeProps extends Pick<TreeItemProps, "renderIcon" | "renderRightSection" | "renderElement" | "renderTitle" | "showIcon" | "disabled" | "enableSeparatorLine" | "classes"> {
668
+ data: TreeData[];
669
+ defaultExpandedId?: string[];
670
+ defaultCheckedId?: string[];
671
+ checkedId?: string[];
672
+ loadingId?: string[];
673
+ onExpandChange?: (id: string, expanded: boolean) => void;
674
+ onCheckedChange?: (checkedId: string[]) => void;
675
+ defaultExpandAll?: boolean;
676
+ defaultCheckAll?: boolean;
677
+ hierarchicalCheck?: boolean;
678
+ }
679
+
680
+ declare const Tree: FC<TreeProps>;
681
+
682
+ declare const TreeItem: FC<TreeItemProps>;
683
+
604
684
  declare const resloveTimestamp: (timestamp: number) => number;
605
685
  declare const getStartDateOfDay: (date: Date) => Date;
606
686
  declare const getEndDateOfDay: (date: Date) => Date;
@@ -612,4 +692,4 @@ declare const getTimestampUTC: (date: Date) => number;
612
692
 
613
693
  declare function cn(...inputs: ClassValue[]): string;
614
694
 
615
- export { ActionButton, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, Calendar, Checkbox, Collapsible, DataTable, type DataTableProps, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownProps, Icon, Input, InputFilter, type InputFilterProps, type InputProps, Label, Loading, Navbar, type NavbarProps, type Options$1 as Options, Popover, PopoverContent, PopoverTrigger, ProgressBar, Search, type SearchProps, Slider, type SliderProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Text, TextInput, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipSimple, TooltipTrigger, cn, getEndDateOfDay, getStartDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, reducer, resloveTimestamp, toast, useToast };
695
+ export { ActionButton, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, Calendar, Checkbox, Collapsible, DataTable, type DataTableProps, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownProps, Icon, Input, InputFilter, type InputFilterProps, type InputProps, Label, Loading, Navbar, type NavbarProps, type Options$1 as Options, Popover, PopoverContent, PopoverTrigger, ProgressBar, Search, type SearchProps, Slider, type SliderProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Text, TextInput, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipSimple, TooltipTrigger, Tree, type TreeData, TreeItem, type TreeItemProps, type TreeProps, cn, getEndDateOfDay, getStartDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, reducer, resloveTimestamp, toast, useToast };
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ export * from "./components/Tooltip/TooltipSimple";
34
34
  export * from "./components/Toast/Toast";
35
35
  export * from "./components/Toast/Toaster";
36
36
  export * from "./components/Toast/useToast";
37
+ export * from "./components/Tree";
37
38
  // UTILS
38
39
  export { resloveTimestamp, getStartDateOfDay, getEndDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, } from "./utils/datetime";
39
40
  export { cn } from "./utils/cn";
@@ -3667,10 +3667,6 @@ input[type=number] {
3667
3667
  height: 100%;
3668
3668
  }
3669
3669
 
3670
- .h-1\/2 {
3671
- height: 50%;
3672
- }
3673
-
3674
3670
  .h-10 {
3675
3671
  height: 2.5rem;
3676
3672
  }
@@ -3711,6 +3707,10 @@ input[type=number] {
3711
3707
  height: 24px;
3712
3708
  }
3713
3709
 
3710
+ .h-\[2px\] {
3711
+ height: 2px;
3712
+ }
3713
+
3714
3714
  .h-\[32px\] {
3715
3715
  height: 32px;
3716
3716
  }
@@ -6104,6 +6104,10 @@ input[type=number] {
6104
6104
  fill: color-mix(in srgb, var(--state-color-error-default) calc(100% * 1), transparent);
6105
6105
  }
6106
6106
 
6107
+ .fill-info {
6108
+ fill: color-mix(in srgb, var(--state-color-info-default) calc(100% * 1), transparent);
6109
+ }
6110
+
6107
6111
  .fill-inherit {
6108
6112
  fill: inherit;
6109
6113
  }
@@ -6128,6 +6132,10 @@ input[type=number] {
6128
6132
  fill: color-mix(in srgb, var(--state-color-primary-default) calc(100% * 1), transparent);
6129
6133
  }
6130
6134
 
6135
+ .fill-secondary {
6136
+ fill: color-mix(in srgb, var(--state-color-secondary-default) calc(100% * 1), transparent);
6137
+ }
6138
+
6131
6139
  .fill-warning {
6132
6140
  fill: color-mix(in srgb, var(--state-color-warning-default) calc(100% * 1), transparent);
6133
6141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.0.48",
3
+ "version": "0.0.50",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",