@syscore/ui-library 1.7.8 → 1.8.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/client/components/ui/label.tsx +2 -2
- package/client/components/ui/tag.tsx +8 -8
- package/client/components/ui/toggle.tsx +16 -24
- package/client/global.css +3 -5
- package/client/lib/utils.ts +6 -0
- package/client/ui/Panel.stories.tsx +509 -435
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +27 -26
- package/package.json +1 -1
|
@@ -13,10 +13,10 @@ const Label = React.forwardRef<
|
|
|
13
13
|
>(({ className, children, ...props }, ref) => (
|
|
14
14
|
<LabelPrimitive.Root
|
|
15
15
|
ref={ref}
|
|
16
|
-
className={cn(labelVariants(), className)}
|
|
16
|
+
className={cn(labelVariants(), "overline-medium", className)}
|
|
17
17
|
{...props}
|
|
18
18
|
>
|
|
19
|
-
|
|
19
|
+
{children}
|
|
20
20
|
</LabelPrimitive.Root>
|
|
21
21
|
));
|
|
22
22
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
@@ -14,7 +14,7 @@ export interface TagProps
|
|
|
14
14
|
|
|
15
15
|
const getStatusClass = (
|
|
16
16
|
status: TagStatus,
|
|
17
|
-
variant: "light" | "dark" = "light"
|
|
17
|
+
variant: "light" | "dark" = "light",
|
|
18
18
|
) => {
|
|
19
19
|
return `status-tag tag--${variant}-${status}`;
|
|
20
20
|
};
|
|
@@ -30,7 +30,7 @@ export const Tag = React.forwardRef<HTMLButtonElement, TagProps>(
|
|
|
30
30
|
onClick,
|
|
31
31
|
...props
|
|
32
32
|
},
|
|
33
|
-
ref
|
|
33
|
+
ref,
|
|
34
34
|
) => {
|
|
35
35
|
// Status tag styling
|
|
36
36
|
if (status) {
|
|
@@ -39,10 +39,10 @@ export const Tag = React.forwardRef<HTMLButtonElement, TagProps>(
|
|
|
39
39
|
<button
|
|
40
40
|
ref={ref}
|
|
41
41
|
onClick={onClick}
|
|
42
|
-
className={cn(statusClass, className)}
|
|
42
|
+
className={cn("overline-medium", statusClass, className)}
|
|
43
43
|
{...props}
|
|
44
44
|
>
|
|
45
|
-
|
|
45
|
+
{children}
|
|
46
46
|
</button>
|
|
47
47
|
);
|
|
48
48
|
}
|
|
@@ -53,16 +53,16 @@ export const Tag = React.forwardRef<HTMLButtonElement, TagProps>(
|
|
|
53
53
|
ref={ref}
|
|
54
54
|
onClick={onClick}
|
|
55
55
|
className={cn(
|
|
56
|
-
"tag-general",
|
|
56
|
+
"tag-general body-small",
|
|
57
57
|
active ? "tag-general--active" : "tag-general--inactive",
|
|
58
|
-
className
|
|
58
|
+
className,
|
|
59
59
|
)}
|
|
60
60
|
{...props}
|
|
61
61
|
>
|
|
62
|
-
|
|
62
|
+
{children}
|
|
63
63
|
</button>
|
|
64
64
|
);
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
Tag.displayName = "Tag";
|
|
@@ -3,26 +3,23 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import { cn } from "../../lib/utils";
|
|
4
4
|
import { useSegmentedControl } from "../../hooks/use-segmented-control";
|
|
5
5
|
|
|
6
|
-
const toggleVariants = cva(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
default: "toggle--default",
|
|
12
|
-
outline: "toggle--outline",
|
|
13
|
-
},
|
|
14
|
-
size: {
|
|
15
|
-
default: "toggle--size-default",
|
|
16
|
-
sm: "toggle--size-sm",
|
|
17
|
-
lg: "toggle--size-lg",
|
|
18
|
-
},
|
|
6
|
+
const toggleVariants = cva("toggle", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "toggle--default",
|
|
10
|
+
outline: "toggle--outline",
|
|
19
11
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
size: {
|
|
13
|
+
default: "toggle--size-default",
|
|
14
|
+
sm: "toggle--size-sm",
|
|
15
|
+
lg: "toggle--size-lg",
|
|
23
16
|
},
|
|
24
17
|
},
|
|
25
|
-
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default",
|
|
20
|
+
size: "default",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
26
23
|
|
|
27
24
|
// Segmented Control Component
|
|
28
25
|
export interface SegmentedControlProps<T extends string = string>
|
|
@@ -51,14 +48,13 @@ const SegmentedControlInner = React.forwardRef<
|
|
|
51
48
|
return (
|
|
52
49
|
<div ref={ref} className={cn("segmented-control", className)} {...props}>
|
|
53
50
|
{options.map((option) => {
|
|
54
|
-
const isReactElement = React.isValidElement(option.label);
|
|
55
51
|
const isActive = selectedValue === option.value;
|
|
56
52
|
|
|
57
53
|
return (
|
|
58
54
|
<button
|
|
59
55
|
key={option.value}
|
|
60
56
|
className={cn(
|
|
61
|
-
"segmented-control-button",
|
|
57
|
+
"segmented-control-button body-small",
|
|
62
58
|
isActive
|
|
63
59
|
? "segmented-control-button--active"
|
|
64
60
|
: "segmented-control-button--inactive",
|
|
@@ -67,11 +63,7 @@ const SegmentedControlInner = React.forwardRef<
|
|
|
67
63
|
type="button"
|
|
68
64
|
data-active={isActive}
|
|
69
65
|
>
|
|
70
|
-
{
|
|
71
|
-
option.label
|
|
72
|
-
) : (
|
|
73
|
-
<span className="body-small font-medium">{option.label}</span>
|
|
74
|
-
)}
|
|
66
|
+
{option.label}
|
|
75
67
|
</button>
|
|
76
68
|
);
|
|
77
69
|
})}
|
package/client/global.css
CHANGED
|
@@ -1763,6 +1763,7 @@ body {
|
|
|
1763
1763
|
.tag-general--active {
|
|
1764
1764
|
background-color: var(--color-cyan-800, #0f748a);
|
|
1765
1765
|
color: var(--color-white, #fff);
|
|
1766
|
+
font-weight: 600;
|
|
1766
1767
|
}
|
|
1767
1768
|
|
|
1768
1769
|
.tag-general--active:hover {
|
|
@@ -1772,11 +1773,11 @@ body {
|
|
|
1772
1773
|
.tag-general--inactive {
|
|
1773
1774
|
background-color: var(--color-blue-100, #eff5fb);
|
|
1774
1775
|
color: var(--color-blue-700, #286495);
|
|
1776
|
+
font-weight: 500;
|
|
1775
1777
|
}
|
|
1776
1778
|
|
|
1777
1779
|
.tag-general--inactive:hover {
|
|
1778
|
-
background-color: var(--color-
|
|
1779
|
-
color: var(--color-white, #fff);
|
|
1780
|
+
background-color: var(--color-blue-200, #cbe0f1);
|
|
1780
1781
|
}
|
|
1781
1782
|
|
|
1782
1783
|
/* Toggle/Segmented Control Styles */
|
|
@@ -6625,7 +6626,6 @@ body {
|
|
|
6625
6626
|
.body-large {
|
|
6626
6627
|
font-size: 18px;
|
|
6627
6628
|
font-style: normal;
|
|
6628
|
-
font-weight: 400;
|
|
6629
6629
|
line-height: 25.2px;
|
|
6630
6630
|
}
|
|
6631
6631
|
|
|
@@ -6644,7 +6644,6 @@ body {
|
|
|
6644
6644
|
.body-base {
|
|
6645
6645
|
font-size: 16px;
|
|
6646
6646
|
font-style: normal;
|
|
6647
|
-
font-weight: 400;
|
|
6648
6647
|
line-height: 22.4px;
|
|
6649
6648
|
}
|
|
6650
6649
|
|
|
@@ -6663,7 +6662,6 @@ body {
|
|
|
6663
6662
|
.body-small {
|
|
6664
6663
|
font-size: 14px;
|
|
6665
6664
|
font-style: normal;
|
|
6666
|
-
font-weight: 400;
|
|
6667
6665
|
line-height: 19.6px;
|
|
6668
6666
|
}
|
|
6669
6667
|
|
package/client/lib/utils.ts
CHANGED
|
@@ -4,3 +4,9 @@ import { twMerge } from "tailwind-merge";
|
|
|
4
4
|
export function cn(...inputs: ClassValue[]) {
|
|
5
5
|
return twMerge(clsx(inputs));
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
/** Capitalize the first letter of a string */
|
|
9
|
+
export function capitalize(str: string): string {
|
|
10
|
+
if (!str) return str;
|
|
11
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
12
|
+
}
|