@rovula/ui 0.0.47 → 0.0.49

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 (45) hide show
  1. package/dist/cjs/bundle.css +32 -4
  2. package/dist/cjs/bundle.js +3 -3
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/Switch/Switch.stories.d.ts +1 -6
  5. package/dist/cjs/types/components/Tree/Tree.d.ts +4 -0
  6. package/dist/cjs/types/components/Tree/Tree.stories.d.ts +12 -0
  7. package/dist/cjs/types/components/Tree/TreeItem.d.ts +4 -0
  8. package/dist/cjs/types/components/Tree/index.d.ts +4 -0
  9. package/dist/cjs/types/components/Tree/type.d.ts +76 -0
  10. package/dist/cjs/types/index.d.ts +1 -0
  11. package/dist/components/Switch/Switch.js +2 -2
  12. package/dist/components/Switch/Switch.stories.js +2 -7
  13. package/dist/components/Tree/Tree.js +104 -0
  14. package/dist/components/Tree/Tree.stories.js +162 -0
  15. package/dist/components/Tree/TreeItem.js +81 -0
  16. package/dist/components/Tree/index.js +4 -0
  17. package/dist/components/Tree/type.js +1 -0
  18. package/dist/esm/bundle.css +32 -4
  19. package/dist/esm/bundle.js +1 -1
  20. package/dist/esm/bundle.js.map +1 -1
  21. package/dist/esm/types/components/Switch/Switch.stories.d.ts +1 -6
  22. package/dist/esm/types/components/Tree/Tree.d.ts +4 -0
  23. package/dist/esm/types/components/Tree/Tree.stories.d.ts +12 -0
  24. package/dist/esm/types/components/Tree/TreeItem.d.ts +4 -0
  25. package/dist/esm/types/components/Tree/index.d.ts +4 -0
  26. package/dist/esm/types/components/Tree/type.d.ts +76 -0
  27. package/dist/esm/types/index.d.ts +1 -0
  28. package/dist/index.d.ts +82 -2
  29. package/dist/index.js +1 -0
  30. package/dist/src/theme/global.css +75 -14
  31. package/dist/theme/themes/SKL/color.css +10 -10
  32. package/dist/theme/themes/xspector/baseline.css +1 -0
  33. package/dist/theme/themes/xspector/components/switch.css +30 -0
  34. package/package.json +1 -1
  35. package/src/components/Switch/Switch.stories.tsx +2 -7
  36. package/src/components/Switch/Switch.tsx +2 -2
  37. package/src/components/Tree/Tree.stories.tsx +288 -0
  38. package/src/components/Tree/Tree.tsx +192 -0
  39. package/src/components/Tree/TreeItem.tsx +231 -0
  40. package/src/components/Tree/index.ts +5 -0
  41. package/src/components/Tree/type.ts +90 -0
  42. package/src/index.ts +1 -0
  43. package/src/theme/themes/SKL/color.css +10 -10
  44. package/src/theme/themes/xspector/baseline.css +1 -0
  45. package/src/theme/themes/xspector/components/switch.css +30 -0
@@ -0,0 +1,90 @@
1
+ import { CSSProperties, ReactNode } from "react";
2
+
3
+ export type TreeData = {
4
+ id: string;
5
+ title: string;
6
+ icon?: ReactNode;
7
+ disabled?: boolean;
8
+ onClickItem?: (id: string) => void;
9
+ children?: TreeData[];
10
+ renderIcon?: (params: {
11
+ id: string;
12
+ expanded: boolean;
13
+ selected: boolean;
14
+ }) => ReactNode;
15
+ };
16
+
17
+ export interface TreeItemProps extends TreeData {
18
+ isFirstLevel?: boolean;
19
+ isLastItem: boolean;
20
+ disabled?: boolean;
21
+ showIcon?: boolean;
22
+ showExpandButton?: boolean;
23
+ enableSeparatorLine?: boolean;
24
+ checkIsExpanded: (id: string) => boolean;
25
+ checkIsChecked: (id: string) => boolean;
26
+ checkIsLoading?: (id: string) => void;
27
+ onExpandChange?: (id: string, expanded: boolean) => void;
28
+ onCheckedChange?: (id: string, checked: boolean) => void;
29
+ renderRightSection?: (params: {
30
+ id: string;
31
+ expanded: boolean;
32
+ selected: boolean;
33
+ }) => ReactNode;
34
+ renderElement?: (params: {
35
+ id: string;
36
+ expanded: boolean;
37
+ selected: boolean;
38
+ children: ReactNode;
39
+ styles: {
40
+ branch: CSSProperties;
41
+ horizontalLine: CSSProperties;
42
+ expandButton: CSSProperties;
43
+ childPadding: CSSProperties;
44
+ };
45
+ onClick?: TreeItemProps["onClickItem"];
46
+ }) => ReactNode;
47
+ renderTitle?: (params: {
48
+ id: string;
49
+ title: string;
50
+ expanded: boolean;
51
+ selected: boolean;
52
+ }) => ReactNode;
53
+ classes?: Partial<{
54
+ elementWrapper: string;
55
+ branch: string;
56
+ itemWrapper: string;
57
+ itemContainer: string;
58
+ horizontalLine: string;
59
+ expandButton: string;
60
+ separatorLine: string;
61
+ checkbox: string;
62
+ item: string;
63
+ title: string;
64
+ childrenWrapper: string;
65
+ }>;
66
+ }
67
+
68
+ export interface TreeProps
69
+ extends Pick<
70
+ TreeItemProps,
71
+ | "renderIcon"
72
+ | "renderRightSection"
73
+ | "renderElement"
74
+ | "renderTitle"
75
+ | "showIcon"
76
+ | "disabled"
77
+ | "enableSeparatorLine"
78
+ | "classes"
79
+ > {
80
+ data: TreeData[];
81
+ defaultExpandedId?: string[];
82
+ defaultCheckedId?: string[];
83
+ checkedId?: string[];
84
+ loadingId?: string[];
85
+ onExpandChange?: (id: string, expanded: boolean) => void;
86
+ onCheckedChange?: (checkedId: string[]) => void;
87
+ defaultExpandAll?: boolean;
88
+ defaultCheckAll?: boolean;
89
+ hierarchicalCheck?: boolean;
90
+ }
package/src/index.ts CHANGED
@@ -39,6 +39,7 @@ export * from "./components/Tooltip/TooltipSimple";
39
39
  export * from "./components/Toast/Toast";
40
40
  export * from "./components/Toast/Toaster";
41
41
  export * from "./components/Toast/useToast";
42
+ export * from "./components/Tree";
42
43
 
43
44
  // Export component types
44
45
  export type { ButtonProps } from "./components/Button/Button";
@@ -12,16 +12,16 @@
12
12
  --input-color-error: #ed2f15;
13
13
 
14
14
  /* Function button */
15
- --function-default-solid: #1e3249;
16
- --function-default-hover: #35475b;
17
- --function-default-hover-bg: rgba(30 50 73 / 0.08);
18
- --function-default-stroke: rgba(30 50 73 / 0.48);
15
+ --function-default-solid: var(--state-color-primary-default);
16
+ --function-default-hover: var(--state-color-primary-hover);
17
+ --function-default-hover-bg: var(--state-color-primary-hover-bg);
18
+ --function-default-stroke: var(--state-color-primary-stroke);
19
19
  --function-default-icon: #ffffff;
20
- --function-default-outline-icon: #1e3249;
21
- --function-active-solid: #9b8f00;
22
- --function-active-hover: #b1a400;
23
- --function-active-hover-bg: rgba(221 205 0 / 0.08);
24
- --function-active-stroke: rgba(177 164 0 / 0.48);
20
+ --function-default-outline-icon: var(--state-color-primary-default);
21
+ --function-active-solid: var(--state-color-secondary-default);
22
+ --function-active-hover: var(--state-color-secondary-hover);
23
+ --function-active-hover-bg: var(--state-color-secondary-hover-bg);
24
+ --function-active-stroke: var(--state-color-secondary-stroke);
25
25
  --function-active-icon: #ffffff;
26
26
 
27
27
  --text-black: #000000;
@@ -49,7 +49,7 @@
49
49
  --foreground: var(--common-black);
50
50
 
51
51
  --primary: var(--primary-ramps-primary-100);
52
- --secondary: var(--secondary-ramps-secondary-100);
52
+ --primary: var(--secondary-ramps-secondary-100);
53
53
  --tertiary: var(--tertiary-ramps-tertiary-100);
54
54
  --info: var(--info-info-100);
55
55
  --success: var(--success-success-100);
@@ -6,3 +6,4 @@
6
6
  @import url(components/action-button.css);
7
7
  @import url(components/loading.css);
8
8
  @import url(components/dropdown-menu.css);
9
+ @import url(components/switch.css);
@@ -0,0 +1,30 @@
1
+ :root[data-theme="xspector"] {
2
+ /* ------------------------------------------------------------------ */
3
+ /* Switch Component Tokens */
4
+ /* ------------------------------------------------------------------ */
5
+ /* Naming Convention: --[component]-[element]-[state]-[property] */
6
+ /* Element: [progress, track] */
7
+ /* ------------------------------------------------------------------ */
8
+
9
+ /* Default State */
10
+ --switch-default-color: rgb(from var(--state-color-secondary-active) r g b / 0.32);
11
+ --switch-thumb-default-color: var(--state-color-secondary-active);
12
+
13
+ /* Hover State */
14
+ --switch-hover-color: rgb(from var(--state-color-secondary-active) r g b / 0.48);
15
+ --switch-thumb-hover-color: var(--switch-thumb-default-color);
16
+ --switch-thumb-hover-ring: var(--state-color-secondary-hover-bg);
17
+
18
+ /* Active State */
19
+ --switch-active-color: rgb(from var(--state-color-primary-active) r g b / 0.32);
20
+ --switch-thumb-active-color: var(--state-color-primary-active);
21
+
22
+ /* Active Hover State */
23
+ --switch-active-hover-color: rgb(from var(--state-color-primary-active) r g b / 0.48);
24
+ --switch-thumb-active-hover-color: var(--switch-thumb-active-color);
25
+ --switch-thumb-active-hover-ring: var(--state-color-primary-hover-bg);
26
+
27
+ /* Disabled State */
28
+ --switch-disabled-color: rgb(from var(--state-color-disable-solid) r g b / 0.32);
29
+ --switch-thumb-disabled-color: var(--state-color-disable-solid)
30
+ }