@ztwoint/z-ui 0.1.25 → 0.1.27

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.
@@ -21,7 +21,7 @@ function C({
21
21
  /* @__PURE__ */ s("div", { className: "flex flex-col gap-1", children: [
22
22
  f && /* @__PURE__ */ e(k, { className: "flex-shrink-0", children: f }),
23
23
  /* @__PURE__ */ s("div", { className: "flex flex-row flex-wrap w-full items-center", children: [
24
- o && /* @__PURE__ */ e(b, { className: "flex-shrink-1", children: o }),
24
+ o && /* @__PURE__ */ e("span", { className: "flex-shrink-1", children: /* @__PURE__ */ e(b, { children: o }) }),
25
25
  p && (i || m) && /* @__PURE__ */ s("div", { className: "flex items-center self-end flex-shrink-0", children: [
26
26
  i && /* @__PURE__ */ e(
27
27
  "button",
@@ -0,0 +1,32 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ function d({
3
+ fill: r = "currentColor",
4
+ secondaryfill: i,
5
+ strokewidth: l = 1,
6
+ width: c = "1em",
7
+ height: t = "1em",
8
+ ...o
9
+ }) {
10
+ return /* @__PURE__ */ e(
11
+ "svg",
12
+ {
13
+ height: t,
14
+ id: "circle-check",
15
+ width: c,
16
+ viewBox: "0 0 12 12",
17
+ xmlns: "http://www.w3.org/2000/svg",
18
+ ...o,
19
+ children: /* @__PURE__ */ e("g", { fill: r, children: /* @__PURE__ */ e(
20
+ "path",
21
+ {
22
+ d: "m6,0C2.691,0,0,2.691,0,6s2.691,6,6,6,6-2.691,6-6S9.309,0,6,0Zm2.853,4.45l-3.003,4c-.13.174-.329.282-.546.298-.019.001-.036.002-.054.002-.198,0-.389-.078-.53-.219l-1.503-1.5c-.293-.292-.293-.768,0-1.061s.768-.294,1.062,0l.892.89,2.484-3.31c.248-.331.718-.4,1.05-.149.331.249.398.719.149,1.05Z",
23
+ fill: r,
24
+ strokeWidth: "0"
25
+ }
26
+ ) })
27
+ }
28
+ );
29
+ }
30
+ export {
31
+ d as default
32
+ };
@@ -0,0 +1,34 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-hover-card";
3
+ import { cn as n } from "../../../lib/utils.js";
4
+ function l({ ...t }) {
5
+ return /* @__PURE__ */ o(r.Root, { "data-slot": "hover-card", ...t });
6
+ }
7
+ function m({ ...t }) {
8
+ return /* @__PURE__ */ o(r.Trigger, { "data-slot": "hover-card-trigger", ...t });
9
+ }
10
+ function c({
11
+ className: t,
12
+ align: a = "center",
13
+ sideOffset: e = 4,
14
+ ...d
15
+ }) {
16
+ return /* @__PURE__ */ o(r.Portal, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ o(
17
+ r.Content,
18
+ {
19
+ "data-slot": "hover-card-content",
20
+ align: a,
21
+ sideOffset: e,
22
+ className: n(
23
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) bg-transparent shadow-lg rounded-2xl outline-hidden",
24
+ t
25
+ ),
26
+ ...d
27
+ }
28
+ ) });
29
+ }
30
+ export {
31
+ l as HoverCard,
32
+ c as HoverCardContent,
33
+ m as HoverCardTrigger
34
+ };
@@ -24,7 +24,7 @@ declare function Z2DropdownInput({ onSearchChange, placeholder, className, selec
24
24
  declare function Z2DropdownContent({ className, align, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
25
25
  export interface Z2DropdownItemProps extends React.HTMLAttributes<HTMLDivElement> {
26
26
  icon?: React.ReactNode;
27
- label?: string;
27
+ label?: React.ReactNode;
28
28
  value: string;
29
29
  disabled?: boolean;
30
30
  disablePopoverClose?: boolean;
@@ -0,0 +1,245 @@
1
+ import { jsx as t, jsxs as x } from "react/jsx-runtime";
2
+ import * as p from "@radix-ui/react-popover";
3
+ import D, { createContext as N, useState as v, useRef as k, useEffect as C, useMemo as E, useCallback as P, useContext as V } from "react";
4
+ import { cn as d } from "../../lib/utils.js";
5
+ import { SearchIcon as Z, ChevronDown as S } from "lucide-react";
6
+ import b from "../assets/icons/circle-check.js";
7
+ import { HoverCard as T, HoverCardTrigger as O, HoverCardContent as R } from "./helpers/hover-card.js";
8
+ const y = N(void 0), g = () => {
9
+ const e = V(y);
10
+ if (!e)
11
+ throw new Error("useDropdown must be used within a Z2Dropdown");
12
+ return e;
13
+ };
14
+ function q({
15
+ defaultOpen: e = !1,
16
+ value: a,
17
+ onValueChange: o,
18
+ ...l
19
+ }) {
20
+ const [r, s] = v(e), [c, f] = v(""), [h, i] = v(a || "");
21
+ return /* @__PURE__ */ t(
22
+ y.Provider,
23
+ {
24
+ value: {
25
+ open: r,
26
+ setOpen: s,
27
+ searchValue: c,
28
+ setSearchValue: f,
29
+ value: h,
30
+ setSelectedValue: i,
31
+ onValueChange: o
32
+ },
33
+ children: /* @__PURE__ */ t(_, { ...l })
34
+ }
35
+ );
36
+ }
37
+ function _({ ...e }) {
38
+ const { open: a } = g();
39
+ return /* @__PURE__ */ t(p.Root, { "data-slot": "popover", open: a, ...e });
40
+ }
41
+ function I({ ...e }) {
42
+ return /* @__PURE__ */ t(p.Trigger, { "data-slot": "popover-trigger", ...e });
43
+ }
44
+ function j({
45
+ ...e
46
+ }) {
47
+ return /* @__PURE__ */ t(p.Anchor, { "data-slot": "popover-anchor", ...e });
48
+ }
49
+ function B({
50
+ onSearchChange: e,
51
+ placeholder: a = "Search...",
52
+ className: o = "",
53
+ selectedIcon: l
54
+ }) {
55
+ const { open: r, setOpen: s, searchValue: c, setSearchValue: f, value: h } = g(), i = k(null);
56
+ C(() => {
57
+ if (r && i.current) {
58
+ const n = setTimeout(() => {
59
+ var u;
60
+ (u = i.current) == null || u.focus();
61
+ }, 10);
62
+ return () => clearTimeout(n);
63
+ }
64
+ !r && i.current && i.current.blur();
65
+ }, [r]);
66
+ const m = (n) => {
67
+ const u = n.target.value;
68
+ f(u), e == null || e(u);
69
+ }, w = E(() => r ? c : h, [r, c, h]);
70
+ return /* @__PURE__ */ t(j, { asChild: !0, children: /* @__PURE__ */ t(I, { onClick: () => s(!r), "data-prevent-close": !0, className: "w-full", children: /* @__PURE__ */ x(
71
+ "div",
72
+ {
73
+ className: d(
74
+ "flex items-center justify-center gap-1.5 p-2 self-stretch relative cursor-pointer rounded-lg bg-white border-[0.5px] border-[#E0E0E0] shadow-[0px_1px_2px_0px_rgba(0,0,0,0.05)] hover:border-neutral-300 ",
75
+ o
76
+ ),
77
+ children: [
78
+ l && !r && /* @__PURE__ */ t("div", { className: "text-neutral-400 w-[14px] h-[14px] flex-shrink-0", children: l }),
79
+ r && /* @__PURE__ */ t("div", { className: "text-neutral-400 w-[14px] h-[14px] flex-shrink-0", children: /* @__PURE__ */ t(Z, { className: "w-3.5 h-3.5 flex-shrink-0" }) }),
80
+ /* @__PURE__ */ t("div", { className: "flex items-center justify-center px-0.5 gap-2.5 flex-1 relative h-[14px]", children: /* @__PURE__ */ t(
81
+ "input",
82
+ {
83
+ ref: i,
84
+ id: "z2-dropdown-input",
85
+ type: "text",
86
+ placeholder: a,
87
+ className: "w-full text-default-primary h-3.5 !text-sm bg-transparent border-none outline-none placeholder:text-default-muted overflow-visible",
88
+ value: w,
89
+ onChange: m,
90
+ onClick: (n) => {
91
+ s(!0), n.stopPropagation();
92
+ },
93
+ onKeyDown: (n) => {
94
+ var u;
95
+ n.stopPropagation(), n.key === "Escape" ? (s(!1), f(""), (u = i.current) == null || u.blur()) : n.key === "Enter" || n.key === " " || (n.key === "ArrowDown" || n.key === "ArrowUp") && n.preventDefault();
96
+ },
97
+ onKeyUp: (n) => {
98
+ n.stopPropagation(), n.key === " " && n.preventDefault();
99
+ }
100
+ }
101
+ ) }),
102
+ /* @__PURE__ */ t("div", { className: "text-neutral-400 w-[14px] h-[14px] flex-shrink-0", children: /* @__PURE__ */ t(S, { className: d(r && "rotate-180", "w-3.5 h-3.5 flex-shrink-0") }) })
103
+ ]
104
+ }
105
+ ) }) });
106
+ }
107
+ function F({
108
+ className: e,
109
+ align: a = "start",
110
+ ...o
111
+ }) {
112
+ const { setOpen: l } = g(), r = P((s) => {
113
+ s && setTimeout(() => {
114
+ const c = s.offsetHeight;
115
+ c > 0 && document.documentElement.style.setProperty(
116
+ "--radix-popover-content-height",
117
+ `${c}px`
118
+ );
119
+ }, 10);
120
+ }, []);
121
+ return /* @__PURE__ */ t(p.Portal, { children: /* @__PURE__ */ t(
122
+ p.Content,
123
+ {
124
+ ref: r,
125
+ onInteractOutside: (s) => {
126
+ if (s.target.closest("[data-prevent-close]")) {
127
+ s.preventDefault();
128
+ return;
129
+ }
130
+ l(!1);
131
+ },
132
+ "data-slot": "popover-content",
133
+ align: a,
134
+ sideOffset: 8,
135
+ className: d(
136
+ "bg-white max-w-fit w-[var(--radix-popover-trigger-width)] p-1 flex flex-col items-start rounded-2xl border-[0.5px] border-[#E0E0E0] shadow-lg z-50 min-w-fit",
137
+ e
138
+ ),
139
+ ...o
140
+ }
141
+ ) });
142
+ }
143
+ function A({
144
+ icon: e,
145
+ label: a,
146
+ value: o,
147
+ hoverComponent: l,
148
+ disablePopoverClose: r = !1
149
+ }) {
150
+ const { onValueChange: s, value: c, setSelectedValue: f, setOpen: h } = g(), i = c === o, m = D.useMemo(() => /* @__PURE__ */ x(
151
+ "div",
152
+ {
153
+ onClick: (w) => {
154
+ w.preventDefault(), f(o), s && s(o), r || h(!1);
155
+ },
156
+ className: d(
157
+ i && "bg-neutral-secondary",
158
+ "p-2 gap-2 flex items-center rounded-lg cursor-pointer h-[30px] self-stretch",
159
+ "hover:bg-neutral-secondary"
160
+ ),
161
+ children: [
162
+ e && /* @__PURE__ */ t("span", { className: "h-3.5 w-3.5 relative", children: e }),
163
+ a || o,
164
+ /* @__PURE__ */ t(b, { className: d("ml-auto", i ? "opacity-100" : "opacity-0") })
165
+ ]
166
+ },
167
+ o
168
+ ), [
169
+ o,
170
+ i,
171
+ e,
172
+ a,
173
+ f,
174
+ s,
175
+ r,
176
+ h
177
+ ]);
178
+ return l ? /* @__PURE__ */ x(T, { openDelay: 1e3, children: [
179
+ /* @__PURE__ */ t(O, { className: "w-full", children: m }),
180
+ /* @__PURE__ */ t(R, { side: "right", sideOffset: 14, children: l })
181
+ ] }) : m;
182
+ }
183
+ function G({ ...e }) {
184
+ return /* @__PURE__ */ t(p.Root, { "data-slot": "popover", ...e });
185
+ }
186
+ function J({
187
+ value: e,
188
+ label: a,
189
+ icon: o,
190
+ isSelected: l = !1
191
+ }) {
192
+ return /* @__PURE__ */ x(
193
+ p.Trigger,
194
+ {
195
+ "data-slot": "popover-sub-trigger",
196
+ className: d(
197
+ "!w-full",
198
+ "p-2 gap-2 flex items-center rounded-lg cursor-pointer h-[30px] self-stretch",
199
+ "hover:bg-neutral-secondary"
200
+ ),
201
+ children: [
202
+ o && /* @__PURE__ */ t("span", { className: "h-3.5 w-3.5 relative", children: o }),
203
+ a || e,
204
+ /* @__PURE__ */ t(b, { className: d("ml-auto", l ? "opacity-100" : "opacity-0") })
205
+ ]
206
+ }
207
+ );
208
+ }
209
+ function L({
210
+ className: e,
211
+ align: a = "start",
212
+ sideOffset: o = 4,
213
+ side: l = "right",
214
+ ...r
215
+ }) {
216
+ return /* @__PURE__ */ t(p.Portal, { children: /* @__PURE__ */ t(
217
+ p.Content,
218
+ {
219
+ "data-slot": "popover-content",
220
+ align: a,
221
+ sideOffset: o,
222
+ side: l,
223
+ className: d(
224
+ "min-w-md min-h-fit h-[var(--radix-popover-content-height)]",
225
+ "bg-white w-full p-1 flex flex-col items-start rounded-2xl border-[0.5px] border-[#E0E0E0] shadow-lg z-50",
226
+ e
227
+ ),
228
+ ...r
229
+ }
230
+ ) });
231
+ }
232
+ function Q({ ...e }) {
233
+ return /* @__PURE__ */ t(A, { ...e });
234
+ }
235
+ export {
236
+ y as DropdownContext,
237
+ q as Z2Dropdown,
238
+ F as Z2DropdownContent,
239
+ B as Z2DropdownInput,
240
+ A as Z2DropdownItem,
241
+ G as Z2DropdownSub,
242
+ L as Z2DropdownSubContent,
243
+ Q as Z2DropdownSubItem,
244
+ J as Z2DropdownSubTrigger
245
+ };
@@ -103,6 +103,21 @@
103
103
  color: var(--color-neutral-400);
104
104
  }
105
105
 
106
+ .z2-select-label{
107
+ display: flex;
108
+ padding: var(--spacing-2, 8px) var(--spacing-2, 8px) var(--spacing-1, 4px) var(--spacing-2, 8px);
109
+ align-items: center;
110
+ gap: 4px;
111
+ align-self: stretch;
112
+ color: var(--color-neutral-600);
113
+ /* text small/leading-none/medium */
114
+ font-size: var(--base-sizes-small-font-size, 14px);
115
+ font-style: normal;
116
+ font-weight: var(--font-weight-medium, 450);
117
+ line-height: 100%; /* 14px */
118
+ letter-spacing: var(--font-letter-spacing-bittight, -0.2px);
119
+ }
120
+
106
121
  .z2-select-item-text {
107
122
  @apply flex items-center justify-center gap-2 flex-1 overflow-hidden text-ellipsis text-[14px] font-[450] leading-[100%] tracking-[-0.2px];
108
123
  }