@rovula/ui 0.0.47 → 0.0.48

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.
@@ -293,13 +293,8 @@ declare const meta: {
293
293
  export default meta;
294
294
  export declare const Default: {
295
295
  args: {
296
- defaultValue: number[];
297
- max: number;
298
- step: number;
299
- name: string;
300
- minStepsBetweenThumbs: number;
296
+ checked: boolean;
301
297
  disabled: boolean;
302
- inverted: boolean;
303
298
  };
304
299
  render: (args: {}) => import("react/jsx-runtime").JSX.Element;
305
300
  };
@@ -0,0 +1,45 @@
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
+ */
@@ -0,0 +1,5 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Tree } from "./Tree";
3
+ declare const meta: Meta<typeof Tree>;
4
+ export default meta;
5
+ export declare const Default: StoryObj<typeof Tree>;
@@ -1576,6 +1576,30 @@
1576
1576
  /* Disabled State */
1577
1577
  --dropdown-menu-disabled-bg: transparent;
1578
1578
  --dropdown-menu-disabled-text: var(--grey-grey-140);
1579
+ /* ------------------------------------------------------------------ */
1580
+ /* Switch Component Tokens */
1581
+ /* ------------------------------------------------------------------ */
1582
+ /* Naming Convention: --[component]-[element]-[state]-[property] */
1583
+ /* Element: [progress, track] */
1584
+ /* ------------------------------------------------------------------ */
1585
+ /* Default State */
1586
+ --switch-default-color: rgb(from var(--state-color-secondary-active) r g b / 0.32);
1587
+ --switch-thumb-default-color: var(--state-color-secondary-active);
1588
+ /* Hover State */
1589
+ --switch-hover-color: rgb(from var(--state-color-secondary-active) r g b / 0.48);
1590
+ --switch-thumb-hover-color: var(--switch-thumb-default-color);
1591
+ --switch-thumb-hover-ring: var(--state-color-secondary-hover-bg);
1592
+ /* Active State */
1593
+ --switch-active-color: rgb(from var(--state-color-primary-active) r g b / 0.32);
1594
+ --switch-thumb-active-color: var(--state-color-primary-active);
1595
+ /* Active Hover State */
1596
+ --switch-active-hover-color: rgb(from var(--state-color-primary-active) r g b / 0.48);
1597
+ --switch-thumb-active-hover-color: var(--switch-thumb-active-color);
1598
+ --switch-thumb-active-hover-ring: var(--state-color-primary-hover-bg);
1599
+ /* Disabled State */
1600
+ --switch-disabled-color: rgb(from var(--state-color-disable-solid) r g b / 0.32);
1601
+ --switch-thumb-disabled-color: var(--state-color-disable-solid)
1602
+ ;
1579
1603
  }
1580
1604
 
1581
1605
  :root[data-theme="SKL"]{
@@ -1820,16 +1844,16 @@
1820
1844
  /* #2d2e30; */
1821
1845
  --input-color-error: #ed2f15;
1822
1846
  /* Function button */
1823
- --function-default-solid: #1e3249;
1824
- --function-default-hover: #35475b;
1825
- --function-default-hover-bg: rgba(30 50 73 / 0.08);
1826
- --function-default-stroke: rgba(30 50 73 / 0.48);
1847
+ --function-default-solid: var(--state-color-primary-default);
1848
+ --function-default-hover: var(--state-color-primary-hover);
1849
+ --function-default-hover-bg: var(--state-color-primary-hover-bg);
1850
+ --function-default-stroke: var(--state-color-primary-stroke);
1827
1851
  --function-default-icon: #ffffff;
1828
- --function-default-outline-icon: #1e3249;
1829
- --function-active-solid: #9b8f00;
1830
- --function-active-hover: #b1a400;
1831
- --function-active-hover-bg: rgba(221 205 0 / 0.08);
1832
- --function-active-stroke: rgba(177 164 0 / 0.48);
1852
+ --function-default-outline-icon: var(--state-color-primary-default);
1853
+ --function-active-solid: var(--state-color-secondary-default);
1854
+ --function-active-hover: var(--state-color-secondary-hover);
1855
+ --function-active-hover-bg: var(--state-color-secondary-hover-bg);
1856
+ --function-active-stroke: var(--state-color-secondary-stroke);
1833
1857
  --function-active-icon: #ffffff;
1834
1858
  --text-black: #000000;
1835
1859
  --text-dark: #18283a;
@@ -1853,7 +1877,7 @@
1853
1877
  --background: var(--base-color-bg);
1854
1878
  --foreground: var(--common-black);
1855
1879
  --primary: var(--primary-ramps-primary-100);
1856
- --secondary: var(--secondary-ramps-secondary-100);
1880
+ --primary: var(--secondary-ramps-secondary-100);
1857
1881
  --tertiary: var(--tertiary-ramps-tertiary-100);
1858
1882
  --info: var(--info-info-100);
1859
1883
  --success: var(--success-success-100);
@@ -3518,6 +3542,10 @@ input[type=number] {
3518
3542
  margin-right: 1rem;
3519
3543
  }
3520
3544
 
3545
+ .mr-\[2px\] {
3546
+ margin-right: 2px;
3547
+ }
3548
+
3521
3549
  .mt-1 {
3522
3550
  margin-top: 0.25rem;
3523
3551
  }
@@ -3619,6 +3647,11 @@ input[type=number] {
3619
3647
  height: 14px;
3620
3648
  }
3621
3649
 
3650
+ .size-\[16pt\] {
3651
+ width: 16pt;
3652
+ height: 16pt;
3653
+ }
3654
+
3622
3655
  .size-\[30px\] {
3623
3656
  width: 30px;
3624
3657
  height: 30px;
@@ -3634,6 +3667,10 @@ input[type=number] {
3634
3667
  height: 100%;
3635
3668
  }
3636
3669
 
3670
+ .h-1\/2 {
3671
+ height: 50%;
3672
+ }
3673
+
3637
3674
  .h-10 {
3638
3675
  height: 2.5rem;
3639
3676
  }
@@ -3727,6 +3764,10 @@ input[type=number] {
3727
3764
  max-height: 100vh;
3728
3765
  }
3729
3766
 
3767
+ .min-h-10 {
3768
+ min-height: 2.5rem;
3769
+ }
3770
+
3730
3771
  .w-1\/2 {
3731
3772
  width: 50%;
3732
3773
  }
@@ -4083,6 +4124,10 @@ input[type=number] {
4083
4124
  white-space: nowrap;
4084
4125
  }
4085
4126
 
4127
+ .text-ellipsis {
4128
+ text-overflow: ellipsis;
4129
+ }
4130
+
4086
4131
  .rounded {
4087
4132
  border-radius: 0.25rem;
4088
4133
  }
@@ -6083,6 +6128,10 @@ input[type=number] {
6083
6128
  fill: color-mix(in srgb, var(--state-color-primary-default) calc(100% * 1), transparent);
6084
6129
  }
6085
6130
 
6131
+ .fill-warning {
6132
+ fill: color-mix(in srgb, var(--state-color-warning-default) calc(100% * 1), transparent);
6133
+ }
6134
+
6086
6135
  .stroke-input-default-stroke {
6087
6136
  stroke: color-mix(in srgb, var(--input-color-default-stroke) calc(100% * 1), transparent);
6088
6137
  }
@@ -8921,8 +8970,8 @@ input[type=number] {
8921
8970
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
8922
8971
  }
8923
8972
 
8924
- .group:disabled .group-disabled\:bg-\[--switch-thumb-disabled-color\] {
8925
- background-color: var(--switch-thumb-disabled-color);
8973
+ .group:disabled .group-disabled\:\!bg-\[--switch-thumb-disabled-color\] {
8974
+ background-color: var(--switch-thumb-disabled-color) !important;
8926
8975
  }
8927
8976
 
8928
8977
  .peer:-moz-placeholder-shown ~ .peer-placeholder-shown\:top-2 {
@@ -9255,8 +9304,8 @@ input[type=number] {
9255
9304
  background-color: var(--dropdown-menu-disabled-bg) !important;
9256
9305
  }
9257
9306
 
9258
- .data-\[disabled\]\:bg-\[var\(--switch-disabled-color\)\][data-disabled] {
9259
- background-color: var(--switch-disabled-color);
9307
+ .data-\[disabled\]\:\!bg-\[var\(--switch-disabled-color\)\][data-disabled] {
9308
+ background-color: var(--switch-disabled-color) !important;
9260
9309
  }
9261
9310
 
9262
9311
  .data-\[loading\=true\]\:bg-button-error-flat-active[data-loading=true] {
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@ const meta = {
13
13
  },
14
14
  decorators: [
15
15
  (Story) => (
16
- <div className="p-5 flex w-full">
16
+ <div className="p-5 flex w-full bg-base-bg2">
17
17
  <Story />
18
18
  </div>
19
19
  ),
@@ -24,13 +24,8 @@ export default meta;
24
24
 
25
25
  export const Default = {
26
26
  args: {
27
- defaultValue: [50],
28
- max: 100,
29
- step: 1,
30
- name: "test",
31
- minStepsBetweenThumbs: 1,
27
+ checked: false,
32
28
  disabled: false,
33
- inverted: false,
34
29
  },
35
30
  render: (args) => {
36
31
  console.log("args ", args);
@@ -13,7 +13,7 @@ const switchStateClasses = {
13
13
  checked:
14
14
  "data-[state=checked]:bg-[var(--switch-active-color)] hover:data-[state=checked]:bg-[var(--switch-active-hover-color)]",
15
15
  disabled:
16
- "data-[disabled]:cursor-not-allowed data-[disabled]:bg-[var(--switch-disabled-color)] data-[disabled]:pointer-events-none",
16
+ "data-[disabled]:cursor-not-allowed data-[disabled]:!bg-[var(--switch-disabled-color)] data-[disabled]:pointer-events-none",
17
17
  };
18
18
 
19
19
  const thumbBaseClasses =
@@ -27,7 +27,7 @@ const thumbStateClasses = {
27
27
  "group-hover:ring group-hover:data-[state=checked]:ring-[var(--switch-thumb-active-hover-ring)] group-hover:data-[state=unchecked]:ring-[var(--switch-thumb-hover-ring)]",
28
28
  hoverColor:
29
29
  "group-hover:data-[state=checked]:bg-[var(--switch-thumb-active-hover-color)] group-hover:data-[state=unchecked]:bg-[var(--switch-thumb-hover-color)]",
30
- disabled: "group-disabled:bg-[--switch-thumb-disabled-color]",
30
+ disabled: "group-disabled:!bg-[--switch-thumb-disabled-color]",
31
31
  };
32
32
 
33
33
  const Switch = React.forwardRef<
@@ -0,0 +1,66 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Tree } from "./Tree";
4
+
5
+ // Example data for testing the Tree component (as plain objects)
6
+ const exampleData = [
7
+ {
8
+ id: "1",
9
+ title: "Parent Folder 1",
10
+ children: [
11
+ {
12
+ id: "1.1",
13
+ title: "Child Folder 1.1",
14
+ children: [
15
+ { id: "1.1.1", title: "Sub Folder 1.1.1" },
16
+ { id: "1.1.2", title: "Sub Folder 1.1.2" },
17
+ ],
18
+ },
19
+ { id: "1.2", title: "Child Folder 1.2" },
20
+ ],
21
+ },
22
+ {
23
+ id: "2",
24
+ title: "Parent Folder 2",
25
+ children: [{ id: "2.1", title: "Child Folder 2.1" }],
26
+ },
27
+ { id: "3", title: "Parent Folder 3" },
28
+ ];
29
+
30
+ // Storybook metadata
31
+ const meta: Meta<typeof Tree> = {
32
+ title: "Components/Tree",
33
+ component: Tree,
34
+ tags: ["autodocs"],
35
+ parameters: {
36
+ layout: "fullscreen",
37
+ },
38
+ decorators: [
39
+ (Story) => (
40
+ <div className="p-5 flex w-full bg-base-bg">
41
+ <Story />
42
+ </div>
43
+ ),
44
+ ],
45
+ };
46
+
47
+ export default meta;
48
+
49
+ // Default story
50
+ export const Default: StoryObj<typeof Tree> = {
51
+ args: {
52
+ data: exampleData,
53
+ defaultExpandedId: ["1", "1.1"],
54
+ defaultCheckedId: ["1.1"],
55
+ defaultExpandAll: true,
56
+ defaultCheckAll: true,
57
+ hierarchicalCheck: true,
58
+ },
59
+ render: (args) => {
60
+ return (
61
+ <div className="flex flex-row gap-4 w-full">
62
+ <Tree {...args} />
63
+ </div>
64
+ );
65
+ },
66
+ };