@ztwoint/z-ui 0.1.143 → 0.1.145

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.
@@ -0,0 +1,8 @@
1
+ import { SVGProps } from 'react';
2
+ type IconProps = SVGProps<SVGSVGElement> & {
3
+ secondaryfill?: string;
4
+ strokewidth?: number;
5
+ title?: string;
6
+ };
7
+ declare function ArrowsThroughLineY({ fill, secondaryfill: _secondaryfill, strokewidth: _strokewidth, title, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
8
+ export default ArrowsThroughLineY;
@@ -0,0 +1,38 @@
1
+ import { jsxs as e, jsx as t } from "react/jsx-runtime";
2
+ function n({
3
+ fill: r = "currentColor",
4
+ secondaryfill: o,
5
+ strokewidth: d = 1,
6
+ title: h = "Reorder Menu",
7
+ ...a
8
+ }) {
9
+ return /* @__PURE__ */ e("svg", { height: "14", width: "14", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg", ...a, children: [
10
+ /* @__PURE__ */ t("title", { children: h }),
11
+ /* @__PURE__ */ e("g", { fill: r, children: [
12
+ /* @__PURE__ */ t(
13
+ "path",
14
+ {
15
+ d: "M12.29 7.61h-2.93a0.58 0.58 0 0 1 0-1.17h2.93a0.58 0.58 0 0 1 0 1.17z",
16
+ fill: r
17
+ }
18
+ ),
19
+ /* @__PURE__ */ t(
20
+ "path",
21
+ {
22
+ d: "M7.02 7.61h-5.26a0.58 0.58 0 0 1 0-1.17h5.26a0.58 0.58 0 0 1 0 1.17z",
23
+ fill: r
24
+ }
25
+ ),
26
+ /* @__PURE__ */ t(
27
+ "path",
28
+ {
29
+ d: "M8.95 4.12a0.58 0.58 0 0 0 0.82 0 0.58 0.58 0 0 0 0-0.83l-2.34-2.34a0.58 0.58 0 0 0-0.82 0l-2.34 2.34a0.58 0.58 0 1 0 0.82 0.83l1.35-1.34v8.48l-1.35-1.34a0.58 0.58 0 1 0-0.82 0.83l2.34 2.34a0.58 0.58 0 0 0 0.82 0l2.34-2.34a0.58 0.58 0 1 0-0.82-0.83l-1.35 1.34v-8.48l1.35 1.34z",
30
+ fill: r
31
+ }
32
+ )
33
+ ] })
34
+ ] });
35
+ }
36
+ export {
37
+ n as default
38
+ };
@@ -15,4 +15,5 @@ export { default as CirclesIcon } from '../assets/icons/circles-icon';
15
15
  export { default as DatabaseCopy } from '../assets/icons/database-copy';
16
16
  export { default as WindowLeftCopy } from '../assets/icons/window-left-copy';
17
17
  export { default as SidebarLeftShowCopy } from '../assets/icons/sidebar-left-show-copy';
18
+ export { default as ArrowsThroughLineY } from '../assets/icons/arrows-through-line-y';
18
19
  export { SIDEBAR_WIDTH, SIDEBAR_WIDTH_COLLAPSED } from './constants';
@@ -1,84 +1,98 @@
1
1
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
- import * as n from "react";
3
- import { cn as h } from "../../lib/utils.js";
4
- import { useZ2SideNavBar as C } from "./context.js";
5
- import x from "../assets/icons/window-left-copy.js";
6
- import { Button as v } from "../button/button.js";
7
- const w = n.forwardRef(
2
+ import * as o from "react";
3
+ import { cn as x } from "../../lib/utils.js";
4
+ import { useZ2SideNavBar as z } from "./context.js";
5
+ import v from "../assets/icons/window-left-copy.js";
6
+ import C from "../assets/icons/arrows-through-line-y.js";
7
+ import { Button as a } from "../button/button.js";
8
+ const I = o.forwardRef(
8
9
  ({
9
- className: o,
10
- children: r,
10
+ className: d,
11
+ children: s,
11
12
  showCollapseButton: g = !0,
12
- icon: s,
13
- title: a,
14
- forceMultiLine: d = !1,
15
- ...c
16
- }, m) => {
17
- const { toggleCollapsed: f, isCollapsed: i } = C(), [y, u] = n.useState(d), p = n.useRef(null), b = y || !!r;
18
- return n.useEffect(() => {
19
- if (d) {
20
- u(!0);
13
+ icon: i,
14
+ title: r,
15
+ forceMultiLine: c = !1,
16
+ ...m
17
+ }, f) => {
18
+ const { toggleCollapsed: h, isCollapsed: n, enableEdit: u, onReorderClick: y } = z(), [N, b] = o.useState(c), p = o.useRef(null), k = N || !!s;
19
+ return o.useEffect(() => {
20
+ if (c) {
21
+ b(!0);
21
22
  return;
22
23
  }
23
- if (p.current && !i && a) {
24
+ if (p.current && !n && r) {
24
25
  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 = a, document.body.appendChild(t);
26
- const N = t.offsetWidth;
27
- document.body.removeChild(t), u(N > 168);
26
+ 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);
27
+ const w = t.offsetWidth;
28
+ document.body.removeChild(t), b(w > 168);
28
29
  }
29
- }, [a, i, d]), i ? /* @__PURE__ */ e(
30
+ }, [r, n, c]), n ? /* @__PURE__ */ e(
30
31
  "div",
31
32
  {
32
- ref: m,
33
- className: h(
33
+ ref: f,
34
+ className: x(
34
35
  "flex flex-col items-center gap-1.5 self-stretch border-b border-gray-200 p-2",
35
- o
36
+ d
36
37
  ),
37
- ...c,
38
+ ...m,
38
39
  children: /* @__PURE__ */ e(
39
- v,
40
+ a,
40
41
  {
41
- variant: "ghost",
42
+ variant: "stroke",
42
43
  shade: "neutral",
43
44
  size: "small",
44
- onClick: f,
45
+ onClick: h,
45
46
  title: "Collapse sidebar",
46
- leftIcon: /* @__PURE__ */ e(x, {})
47
+ leftIcon: /* @__PURE__ */ e(v, {})
47
48
  }
48
49
  )
49
50
  }
50
- ) : b && !i ? /* @__PURE__ */ l(
51
+ ) : k && !n ? /* @__PURE__ */ l(
51
52
  "div",
52
53
  {
53
- ref: m,
54
- className: h(
54
+ ref: f,
55
+ className: x(
55
56
  "flex flex-col items-start gap-5 self-stretch border-b border-gray-100 w-60 px-2.5 py-4 pl-4 relative",
56
- o
57
+ d
57
58
  ),
58
- ...c,
59
+ ...m,
59
60
  children: [
60
61
  /* @__PURE__ */ l("div", { className: "header-icons-container flex justify-between items-center self-stretch relative", children: [
61
- 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 }) }),
62
- g && /* @__PURE__ */ e(
63
- v,
64
- {
65
- variant: "ghost",
66
- shade: "neutral",
67
- size: "small",
68
- onClick: f,
69
- title: "Collapse sidebar",
70
- leftIcon: /* @__PURE__ */ e(x, {})
71
- }
72
- )
62
+ i && /* @__PURE__ */ e(a, { variant: "filled", shade: "brand", size: "small", leftIcon: i }),
63
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
64
+ u && /* @__PURE__ */ e(
65
+ a,
66
+ {
67
+ variant: "ghost",
68
+ shade: "neutral",
69
+ size: "small",
70
+ onClick: y,
71
+ title: "Reorder items",
72
+ leftIcon: /* @__PURE__ */ e(C, {})
73
+ }
74
+ ),
75
+ g && /* @__PURE__ */ e(
76
+ a,
77
+ {
78
+ variant: "stroke",
79
+ shade: "neutral",
80
+ size: "small",
81
+ onClick: h,
82
+ title: "Collapse sidebar",
83
+ leftIcon: /* @__PURE__ */ e(v, {})
84
+ }
85
+ )
86
+ ] })
73
87
  ] }),
74
88
  /* @__PURE__ */ l("div", { className: "text-preset-container flex flex-col items-start gap-2.5 self-stretch relative", children: [
75
- /* @__PURE__ */ e("div", { className: "primary-text self-stretch text-gray-950 text-sm font-medium leading-none tracking-tight relative", children: a }),
89
+ /* @__PURE__ */ e("div", { className: "primary-text self-stretch text-gray-950 text-sm font-medium leading-none tracking-tight relative", children: r }),
76
90
  /* @__PURE__ */ e(
77
91
  "div",
78
92
  {
79
93
  ref: p,
80
94
  className: "secondary-text line-clamp-1 self-stretch overflow-hidden text-gray-600 text-ellipsis text-sm font-normal leading-none tracking-tight relative",
81
- children: r
95
+ children: s
82
96
  }
83
97
  )
84
98
  ] })
@@ -87,42 +101,54 @@ const w = n.forwardRef(
87
101
  ) : /* @__PURE__ */ l(
88
102
  "div",
89
103
  {
90
- ref: m,
91
- className: h(
104
+ ref: f,
105
+ className: x(
92
106
  "flex items-center gap-2.5 border-b header-default-layout w-full pr-2.5 pl-3 py-2.5 stroke-solid-light relative",
93
- o
107
+ d
94
108
  ),
95
- ...c,
109
+ ...m,
96
110
  children: [
97
- 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 }) }),
111
+ i && /* @__PURE__ */ e(a, { variant: "filled", shade: "brand", size: "small", leftIcon: i }),
98
112
  /* @__PURE__ */ l(
99
113
  "div",
100
114
  {
101
115
  ref: p,
102
116
  className: "text-content flex flex-col items-start gap-2.5 flex-1 relative",
103
117
  children: [
104
- /* @__PURE__ */ e("div", { className: "leading-none-medium-sm text-neutral-primary", children: a }),
105
- r && /* @__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: r })
118
+ /* @__PURE__ */ e("div", { className: "leading-none-medium-sm text-neutral-primary", children: r }),
119
+ s && /* @__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: s })
106
120
  ]
107
121
  }
108
122
  ),
109
- g && /* @__PURE__ */ e(
110
- v,
111
- {
112
- variant: "ghost",
113
- shade: "neutral",
114
- size: "small",
115
- onClick: f,
116
- title: "Collapse sidebar",
117
- leftIcon: /* @__PURE__ */ e(x, {})
118
- }
119
- )
123
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
124
+ u && /* @__PURE__ */ e(
125
+ a,
126
+ {
127
+ shade: "neutral",
128
+ size: "small",
129
+ onClick: y,
130
+ title: "Reorder items",
131
+ leftIcon: /* @__PURE__ */ e(C, {})
132
+ }
133
+ ),
134
+ g && /* @__PURE__ */ e(
135
+ a,
136
+ {
137
+ variant: "stroke",
138
+ shade: "neutral",
139
+ size: "small",
140
+ onClick: h,
141
+ title: "Collapse sidebar",
142
+ leftIcon: /* @__PURE__ */ e(v, {})
143
+ }
144
+ )
145
+ ] })
120
146
  ]
121
147
  }
122
148
  );
123
149
  }
124
150
  );
125
- w.displayName = "Z2SideNavBarHeader";
151
+ I.displayName = "Z2SideNavBarHeader";
126
152
  export {
127
- w as Z2SideNavBarHeader
153
+ I as Z2SideNavBarHeader
128
154
  };
@@ -1,39 +1,41 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
- import { cn as l } from "../../lib/utils.js";
4
- import { Z2SideNavBarContext as S } from "./context.js";
5
- import { SIDEBAR_WIDTH_COLLAPSED as d, SIDEBAR_WIDTH as h } from "./constants.js";
6
- const C = r.forwardRef(
7
- ({ children: m, defaultCollapsed: c = !1, style: t, className: a, ...n }, p) => {
8
- const [e, u] = r.useState(c), s = r.useCallback(() => {
9
- u(!e);
10
- }, [e]), v = r.useMemo(
3
+ import { cn as m } from "../../lib/utils.js";
4
+ import { Z2SideNavBarContext as B } from "./context.js";
5
+ import { SIDEBAR_WIDTH_COLLAPSED as c, SIDEBAR_WIDTH as C } from "./constants.js";
6
+ const D = r.forwardRef(
7
+ ({ children: p, defaultCollapsed: n = !1, enableEdit: s, onReorderClick: t, style: a, className: i, ...u }, v) => {
8
+ const [e, f] = r.useState(n), l = r.useCallback(() => {
9
+ f(!e);
10
+ }, [e]), S = r.useMemo(
11
11
  () => ({
12
12
  isCollapsed: e,
13
- toggleCollapsed: s
13
+ toggleCollapsed: l,
14
+ enableEdit: s,
15
+ onReorderClick: t
14
16
  }),
15
- [e, s]
16
- ), i = r.useMemo(() => e ? d : h, [e]), f = r.useMemo(
17
+ [e, l, s, t]
18
+ ), d = r.useMemo(() => e ? c : C, [e]), h = r.useMemo(
17
19
  () => ({
18
- "--sidebar-width": i,
19
- "--sidebar-width-collapsed": d,
20
- ...t
20
+ "--sidebar-width": d,
21
+ "--sidebar-width-collapsed": c,
22
+ ...a
21
23
  }),
22
- [i, t]
24
+ [d, a]
23
25
  );
24
- return /* @__PURE__ */ o(S.Provider, { value: v, children: /* @__PURE__ */ o(
26
+ return /* @__PURE__ */ o(B.Provider, { value: S, children: /* @__PURE__ */ o(
25
27
  "div",
26
28
  {
27
- ref: p,
28
- className: l("relative h-full", a),
29
- style: f,
30
- ...n,
31
- children: /* @__PURE__ */ o("div", { className: l("h-full", a), children: m })
29
+ ref: v,
30
+ className: m("relative h-full", i),
31
+ style: h,
32
+ ...u,
33
+ children: /* @__PURE__ */ o("div", { className: m("h-full", i), children: p })
32
34
  }
33
35
  ) });
34
36
  }
35
37
  );
36
- C.displayName = "Z2SideNavBarProvider";
38
+ D.displayName = "Z2SideNavBarProvider";
37
39
  export {
38
- C as Z2SideNavBarProvider
40
+ D as Z2SideNavBarProvider
39
41
  };
@@ -2,10 +2,14 @@ import * as React from 'react';
2
2
  export interface Z2SideNavBarContextType {
3
3
  isCollapsed: boolean;
4
4
  toggleCollapsed: () => void;
5
+ enableEdit?: boolean;
6
+ onReorderClick?: () => void;
5
7
  }
6
8
  export interface Z2SideNavBarProviderProps {
7
9
  children: React.ReactNode;
8
10
  defaultCollapsed?: boolean;
11
+ enableEdit?: boolean;
12
+ onReorderClick?: () => void;
9
13
  style?: React.CSSProperties;
10
14
  className?: string;
11
15
  }
@@ -1,13 +1,13 @@
1
1
  import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
2
  import { useRef as N } from "react";
3
3
  import { SearchIcon as I } from "lucide-react";
4
- import { Z2Select as Z, Z2SelectTrigger as P, Z2SelectValue as k, Z2SelectContent as O, Z2SelectItem as p } from "../../select/z2-select.js";
4
+ import { Z2Select as Z, Z2SelectTrigger as P, Z2SelectValue as k, Z2SelectContent as O, Z2SelectItem as h } from "../../select/z2-select.js";
5
5
  import { Input as V } from "../../input/input.js";
6
6
  import { useSelectCompactSearch as b } from "./select-compact.hook.js";
7
7
  function q({
8
8
  value: s,
9
9
  onChange: r,
10
- options: d,
10
+ options: p,
11
11
  placeholder: y = "Select field",
12
12
  className: S,
13
13
  searchable: a = !1,
@@ -15,16 +15,16 @@ function q({
15
15
  disabled: w = !1
16
16
  }) {
17
17
  const {
18
- searchQuery: i,
19
- filteredOptions: u,
20
- isCurrentValueInFiltered: x,
18
+ searchQuery: u,
19
+ filteredOptions: i,
20
+ isCurrentValueInFiltered: C,
21
21
  currentOption: n,
22
22
  handleSearchChange: m,
23
23
  resetSearch: o
24
- } = b(d, s), l = N(null), C = (e) => {
24
+ } = b(p, s), l = N(null), x = (e) => {
25
25
  e && a && setTimeout(() => {
26
- var h;
27
- (h = l.current) == null || h.focus();
26
+ var d;
27
+ (d = l.current) == null || d.focus();
28
28
  }, 0), e || o();
29
29
  }, K = (e) => {
30
30
  r == null || r(e), o();
@@ -38,12 +38,12 @@ function q({
38
38
  {
39
39
  value: s || "",
40
40
  onValueChange: K,
41
- onOpenChange: C,
41
+ onOpenChange: x,
42
42
  disabled: w,
43
43
  children: [
44
44
  /* @__PURE__ */ t(P, { className: S, children: /* @__PURE__ */ t(k, { placeholder: y }) }),
45
45
  /* @__PURE__ */ c(O, { onKeyDown: (e) => {
46
- !a || !l.current || document.activeElement !== l.current && D(e) && (e.preventDefault(), e.stopPropagation(), m(i + e.key), l.current.focus());
46
+ !a || !l.current || document.activeElement !== l.current && D(e) && (e.preventDefault(), e.stopPropagation(), m(u + e.key), l.current.focus());
47
47
  }, children: [
48
48
  a && /* @__PURE__ */ t(
49
49
  "div",
@@ -56,7 +56,7 @@ function q({
56
56
  {
57
57
  ref: l,
58
58
  size: "small",
59
- value: i,
59
+ value: u,
60
60
  onChange: (e) => m(e.target.value),
61
61
  onKeyDown: v,
62
62
  placeholder: g,
@@ -66,9 +66,9 @@ function q({
66
66
  )
67
67
  }
68
68
  ),
69
- /* @__PURE__ */ c("div", { className: "max-h-[240px] min-h-[120px] overflow-y-auto w-full", children: [
70
- !x && n && /* @__PURE__ */ t(p, { value: n.value, className: "hidden", children: n.label }, n.value),
71
- u.length > 0 ? u.map((e) => /* @__PURE__ */ t(p, { value: e.value, children: e.label }, e.value)) : /* @__PURE__ */ t("div", { className: "px-2 py-3 text-text-neutral-muted leading-none-medium-sm text-center", children: "No results found" })
69
+ /* @__PURE__ */ c("div", { className: "max-h-[240px] overflow-y-auto w-full", children: [
70
+ !C && n && /* @__PURE__ */ t(h, { value: n.value, className: "hidden", children: n.label }, n.value),
71
+ i.length > 0 ? i.map((e) => /* @__PURE__ */ t(h, { value: e.value, children: e.label }, e.value)) : /* @__PURE__ */ t("div", { className: "px-2 py-3 text-text-neutral-muted leading-none-medium-sm text-center", children: "No results found" })
72
72
  ] })
73
73
  ] })
74
74
  ]