@ztwoint/z-ui 0.1.9 → 0.1.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.
- package/README.md +2 -1
- package/dist/components/button/button.js +6 -6
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-header.js +19 -19
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-item.js +1 -1
- package/dist/components/dialog/dialog.d.ts +12 -0
- package/dist/components/dialog/dialog.stories.d.ts +10 -0
- package/dist/components/tooltip/tooltip.d.ts +21 -0
- package/dist/components/tooltip/tooltip.js +32 -0
- package/dist/components/tooltip/tooltip.stories.d.ts +10 -0
- package/dist/css/config/colors/components/button.css +2 -2
- package/dist/css/config/colors/components/tab.css +1 -1
- package/dist/css/config/colors/text.css +1 -1
- package/dist/css/config/config.css +1 -1
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -10
- package/dist/types/components/dialog/dialog.d.ts +12 -0
- package/dist/types/components/dialog/dialog.stories.d.ts +10 -0
- package/dist/types/components/tooltip/tooltip.d.ts +21 -0
- package/dist/types/components/tooltip/tooltip.stories.d.ts +10 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ npm install @ztwoint/z-ui
|
|
|
19
19
|
# or
|
|
20
20
|
yarn add @ztwoint/z-ui
|
|
21
21
|
```
|
|
22
|
+
|
|
22
23
|
> Note: To use this package on a remote server, you need to set up an SSH key with access to this repository.
|
|
23
24
|
|
|
24
|
-
This package will be published to npm registry later.
|
|
25
|
+
This package will be published to npm registry later.
|
|
@@ -50,12 +50,12 @@ const N = z(
|
|
|
50
50
|
{
|
|
51
51
|
variant: "stroke",
|
|
52
52
|
shade: "neutral",
|
|
53
|
-
class: "
|
|
53
|
+
class: "border-none shadow-default button-secondary-surface-default text-default-primary hover:button-secondary-surface-hover hover:text-default-secondary active:button-secondary-surface-pressed active:text-default-disabled disabled:button-secondary-surface-disabled disabled:text-default-disabled"
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
variant: "stroke",
|
|
57
57
|
shade: "danger",
|
|
58
|
-
class: "
|
|
58
|
+
class: "border-none shadow-default button-secondary-surface-default text-default-danger hover:button-secondary-surface-hover hover:text-default-danger active:button-secondary-surface-pressed active:text-default-danger disabled:button-secondary-surface-disabled disabled:text-default-disabled"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
variant: "ghost",
|
|
@@ -76,17 +76,17 @@ const N = z(
|
|
|
76
76
|
shade: c,
|
|
77
77
|
size: b,
|
|
78
78
|
variant: f,
|
|
79
|
-
asChild:
|
|
79
|
+
asChild: o = !1,
|
|
80
80
|
leftIcon: a,
|
|
81
81
|
rightIcon: t,
|
|
82
82
|
label: p,
|
|
83
|
-
children:
|
|
83
|
+
children: l,
|
|
84
84
|
...m
|
|
85
85
|
}, v) => {
|
|
86
|
-
const y =
|
|
86
|
+
const y = o ? O : "button", r = p || l, s = !r && !!(a || t), i = s ? a || t : null, h = n(
|
|
87
87
|
N({ shade: c, size: b, variant: f, iconOnly: s, className: u })
|
|
88
88
|
), d = "w-3.5 h-3.5";
|
|
89
|
-
return /* @__PURE__ */ e(y, { className: h, ref: v, ...m, children:
|
|
89
|
+
return /* @__PURE__ */ e(y, { className: h, ref: v, ...m, children: o ? l : s ? i ? /* @__PURE__ */ e("span", { className: d, children: i }) : null : /* @__PURE__ */ x(g, { children: [
|
|
90
90
|
a && /* @__PURE__ */ e("span", { className: n(d), children: a }),
|
|
91
91
|
r && /* @__PURE__ */ e("span", { children: r }),
|
|
92
92
|
t && /* @__PURE__ */ e("span", { className: n(d), children: t })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import { cn as x } from "../../lib/utils.js";
|
|
4
4
|
import { useZ2SideNavBar as N } from "./context.js";
|
|
@@ -7,26 +7,26 @@ import w from "../assets/icons/sidebar-left-show-copy.js";
|
|
|
7
7
|
const C = n.forwardRef(
|
|
8
8
|
({
|
|
9
9
|
className: o,
|
|
10
|
-
children:
|
|
10
|
+
children: l,
|
|
11
11
|
showCollapseButton: g = !0,
|
|
12
|
-
icon:
|
|
13
|
-
title:
|
|
12
|
+
icon: s,
|
|
13
|
+
title: r,
|
|
14
14
|
forceMultiLine: c = !1,
|
|
15
15
|
...d
|
|
16
16
|
}, m) => {
|
|
17
|
-
const { toggleCollapsed: p, isCollapsed: i } = N(), [v, h] = n.useState(c), f = n.useRef(null), b = v || !!
|
|
17
|
+
const { toggleCollapsed: p, isCollapsed: i } = N(), [v, h] = n.useState(c), f = n.useRef(null), b = v || !!l;
|
|
18
18
|
return n.useEffect(() => {
|
|
19
19
|
if (c) {
|
|
20
20
|
h(!0);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
if (f.current && !i &&
|
|
23
|
+
if (f.current && !i && r) {
|
|
24
24
|
const t = document.createElement("span");
|
|
25
|
-
t.style.visibility = "hidden", t.style.position = "absolute", t.style.whiteSpace = "nowrap", t.style.fontSize = "14px", t.style.fontWeight = "450", t.textContent =
|
|
25
|
+
t.style.visibility = "hidden", t.style.position = "absolute", t.style.whiteSpace = "nowrap", t.style.fontSize = "14px", t.style.fontWeight = "450", t.textContent = r, document.body.appendChild(t);
|
|
26
26
|
const y = t.offsetWidth;
|
|
27
27
|
document.body.removeChild(t), h(y > 168);
|
|
28
28
|
}
|
|
29
|
-
}, [
|
|
29
|
+
}, [r, i, c]), i ? /* @__PURE__ */ e(
|
|
30
30
|
"div",
|
|
31
31
|
{
|
|
32
32
|
ref: m,
|
|
@@ -45,7 +45,7 @@ const C = n.forwardRef(
|
|
|
45
45
|
}
|
|
46
46
|
)
|
|
47
47
|
}
|
|
48
|
-
) : b && !i ? /* @__PURE__ */
|
|
48
|
+
) : b && !i ? /* @__PURE__ */ a(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
51
51
|
ref: m,
|
|
@@ -55,8 +55,8 @@ const C = n.forwardRef(
|
|
|
55
55
|
),
|
|
56
56
|
...d,
|
|
57
57
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
58
|
+
/* @__PURE__ */ a("div", { className: "header-icons-container flex justify-between items-center self-stretch relative", children: [
|
|
59
|
+
s && /* @__PURE__ */ e("div", { className: "database-icon-container flex p-1.5 justify-center items-center gap-1 rounded-lg bg-gray-50 relative", children: /* @__PURE__ */ e("div", { className: "w-3.5 h-3.5 aspect-square relative", children: s }) }),
|
|
60
60
|
g && /* @__PURE__ */ e(
|
|
61
61
|
"button",
|
|
62
62
|
{
|
|
@@ -67,20 +67,20 @@ const C = n.forwardRef(
|
|
|
67
67
|
}
|
|
68
68
|
)
|
|
69
69
|
] }),
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */ e("div", { className: "primary-text self-stretch text-gray-950 text-sm font-medium leading-none tracking-tight relative", children:
|
|
70
|
+
/* @__PURE__ */ a("div", { className: "text-preset-container flex flex-col items-start gap-2.5 self-stretch relative", children: [
|
|
71
|
+
/* @__PURE__ */ e("div", { className: "primary-text self-stretch text-gray-950 text-sm font-medium leading-none tracking-tight relative", children: r }),
|
|
72
72
|
/* @__PURE__ */ e(
|
|
73
73
|
"div",
|
|
74
74
|
{
|
|
75
75
|
ref: f,
|
|
76
76
|
className: "secondary-text line-clamp-1 self-stretch overflow-hidden text-gray-600 text-ellipsis text-sm font-normal leading-none tracking-tight relative",
|
|
77
|
-
children:
|
|
77
|
+
children: l
|
|
78
78
|
}
|
|
79
79
|
)
|
|
80
80
|
] })
|
|
81
81
|
]
|
|
82
82
|
}
|
|
83
|
-
) : /* @__PURE__ */
|
|
83
|
+
) : /* @__PURE__ */ a(
|
|
84
84
|
"div",
|
|
85
85
|
{
|
|
86
86
|
ref: m,
|
|
@@ -90,15 +90,15 @@ const C = n.forwardRef(
|
|
|
90
90
|
),
|
|
91
91
|
...d,
|
|
92
92
|
children: [
|
|
93
|
-
|
|
94
|
-
/* @__PURE__ */
|
|
93
|
+
s && /* @__PURE__ */ e("div", { className: "icon-container flex p-1.5 justify-center items-center gap-1 rounded-lg bg-gray-50 relative", children: /* @__PURE__ */ e("div", { className: "w-3.5 h-3.5 aspect-square relative", children: s }) }),
|
|
94
|
+
/* @__PURE__ */ a(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
97
|
ref: f,
|
|
98
98
|
className: "text-content flex flex-col items-start gap-2.5 flex-1 relative",
|
|
99
99
|
children: [
|
|
100
|
-
/* @__PURE__ */ e("div", { className: "primary-text line-clamp-1 self-stretch overflow-hidden text-gray-950 text-ellipsis text-sm font-medium leading-none tracking-tight relative", children:
|
|
101
|
-
|
|
100
|
+
/* @__PURE__ */ e("div", { className: "primary-text line-clamp-1 self-stretch overflow-hidden text-gray-950 text-ellipsis text-sm font-medium leading-none tracking-tight relative", children: r }),
|
|
101
|
+
l && /* @__PURE__ */ e("div", { className: "secondary-text line-clamp-1 self-stretch overflow-hidden text-(--color-neutral-600) text-ellipsis text-xs font-normal leading-none tracking-tight relative", children: l })
|
|
102
102
|
]
|
|
103
103
|
}
|
|
104
104
|
),
|
|
@@ -124,7 +124,7 @@ const K = d.forwardRef(
|
|
|
124
124
|
...N,
|
|
125
125
|
children: [
|
|
126
126
|
m && /* @__PURE__ */ r("span", { className: "nav-item-icon flex-shrink-0 flex items-center justify-center w-3.5 h-3.5", children: m }),
|
|
127
|
-
o && /* @__PURE__ */ r("div", { className: "nav-item-label-container flex items-center gap-2.5 flex-1 px-0.5 relative", children: /* @__PURE__ */ r("div", { className: "nav-item-label flex-1 truncate text-sm font-medium leading-none tracking-tight text-black relative line-clamp-1", children: c }) }),
|
|
127
|
+
o && /* @__PURE__ */ r("div", { className: "nav-item-label-container flex items-center gap-2.5 flex-1 px-0.5 relative", children: /* @__PURE__ */ r("div", { className: "nav-item-label flex-1 truncate text-sm font-medium leading-none tracking-tight text-black relative line-clamp-1 py-1", children: c }) }),
|
|
128
128
|
o && n && /* @__PURE__ */ r(P, { children: t ? /* @__PURE__ */ r(
|
|
129
129
|
B,
|
|
130
130
|
{
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
|
+
declare function Z2Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function Z2DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function Z2DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function Z2DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function Z2DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function Z2DialogContent({ className, children, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function Z2DialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function Z2DialogFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function Z2DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function Z2DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { Z2Dialog, Z2DialogContent, Z2DialogDescription, Z2DialogFooter, Z2DialogHeader, Z2DialogOverlay, Z2DialogPortal, Z2DialogClose, Z2DialogTitle, Z2DialogTrigger, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Z2Dialog } from './dialog';
|
|
3
|
+
declare const meta: Meta<typeof Z2Dialog>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Z2Dialog>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithLongDescription: Story;
|
|
8
|
+
export declare const CustomFooter: Story;
|
|
9
|
+
export declare const Fullscreen: Story;
|
|
10
|
+
export declare const CloseInHeader: Story;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
3
|
+
export interface TooltipProps extends Omit<RadixTooltip.TooltipContentProps, 'children' | 'asChild'> {
|
|
4
|
+
/**
|
|
5
|
+
* The content to show inside the tooltip.
|
|
6
|
+
*/
|
|
7
|
+
message: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The element that triggers the tooltip (usually a button, icon, etc).
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Delay in ms before showing the tooltip (default: 300)
|
|
14
|
+
*/
|
|
15
|
+
delayDuration?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A reusable Tooltip component using Radix Tooltip primitive.
|
|
19
|
+
* Wraps any element as a trigger and shows a message on hover/focus.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Z2Tooltip: React.FC<TooltipProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as o, jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import * as t from "@radix-ui/react-tooltip";
|
|
3
|
+
import { cn as s } from "../../lib/utils.js";
|
|
4
|
+
const m = ({
|
|
5
|
+
message: a,
|
|
6
|
+
children: r,
|
|
7
|
+
delayDuration: i = 300,
|
|
8
|
+
side: d = "top",
|
|
9
|
+
className: n,
|
|
10
|
+
...l
|
|
11
|
+
}) => /* @__PURE__ */ o(t.Provider, { delayDuration: i, children: /* @__PURE__ */ e(t.Root, { children: [
|
|
12
|
+
/* @__PURE__ */ o(t.Trigger, { asChild: !0, children: r }),
|
|
13
|
+
/* @__PURE__ */ o(t.Portal, { children: /* @__PURE__ */ e(
|
|
14
|
+
t.Content,
|
|
15
|
+
{
|
|
16
|
+
side: d,
|
|
17
|
+
className: s(
|
|
18
|
+
"bg-[var(--color-neutral-950)] border-none text-white leading-none-regular-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-1 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
19
|
+
n
|
|
20
|
+
),
|
|
21
|
+
...l,
|
|
22
|
+
children: [
|
|
23
|
+
a,
|
|
24
|
+
/* @__PURE__ */ o(t.Arrow, { className: "bg-[var(--color-neutral-950)] z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
) })
|
|
28
|
+
] }) });
|
|
29
|
+
m.displayName = "Z2Tooltip";
|
|
30
|
+
export {
|
|
31
|
+
m as Z2Tooltip
|
|
32
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Z2Tooltip } from './tooltip';
|
|
3
|
+
declare const meta: Meta<typeof Z2Tooltip>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Z2Tooltip>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const IconTrigger: Story;
|
|
8
|
+
export declare const AllSides: Story;
|
|
9
|
+
export declare const CustomStyling: Story;
|
|
10
|
+
export declare const CustomDelay: Story;
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/* Shadow utility class */
|
|
89
|
-
@utility
|
|
89
|
+
@utility shadow-default {
|
|
90
90
|
box-shadow:
|
|
91
91
|
0px 1px 2px 0px var(--color-alpha-dark-50),
|
|
92
|
-
0px 0px 0px
|
|
92
|
+
0px 0px 0px 0.5px var(--color-neutral-150);
|
|
93
93
|
}
|