@dgshahr/ui-kit 0.0.92 → 0.0.93
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/dist/Form/Datepicker/index.cjs +1 -1
- package/dist/Form/Datepicker/index.mjs +1 -1
- package/dist/Form/Input/index.cjs +1 -1
- package/dist/Form/Input/index.d.ts +6 -4
- package/dist/Form/Input/index.d.ts.map +1 -1
- package/dist/Form/Input/index.mjs +8 -166
- package/dist/Form/OtpInput/index.cjs +1 -1
- package/dist/Form/OtpInput/index.mjs +7 -7
- package/dist/Form/Select/index.cjs +1 -1
- package/dist/Form/Select/index.d.ts.map +1 -1
- package/dist/Form/Select/index.mjs +143 -114
- package/dist/PickerWrapper-VwVWt_Vr.cjs +1 -0
- package/dist/{PickerWrapper-CrHfM70f.js → PickerWrapper-rZ3IIgox.js} +1 -1
- package/dist/Sidebar/index.cjs +1 -1
- package/dist/Sidebar/index.mjs +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/index-BOxK2gfQ.js +183 -0
- package/dist/index-CSis3p-s.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +37 -35
- package/package.json +2 -2
- package/dist/PickerWrapper-BuAOe-BZ.cjs +0 -1
|
@@ -1,185 +1,186 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as b, Fragment as O } from "react/jsx-runtime";
|
|
2
2
|
import { c as d } from "../../clsx-OuTLNxxd.js";
|
|
3
|
-
import {
|
|
3
|
+
import { I as _, a as q } from "../../index-BOxK2gfQ.js";
|
|
4
|
+
import { memo as D, useState as M, useRef as F, useMemo as P, useCallback as B, useEffect as L } from "react";
|
|
4
5
|
import { I as K } from "../../IconSearch-aShj2vmu.js";
|
|
5
6
|
import U from "../Checkbox/index.mjs";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import G from "../../Button/index.mjs";
|
|
8
|
+
import { u as J, P as Q } from "../../PickerWrapper-rZ3IIgox.js";
|
|
9
|
+
import X from "../../Chip/index.mjs";
|
|
9
10
|
import '../../assets/styles.css';/* empty css */
|
|
10
|
-
function
|
|
11
|
-
if (!
|
|
11
|
+
function Y(s, r = 100) {
|
|
12
|
+
if (!s) return;
|
|
12
13
|
if (window.innerWidth > 768) {
|
|
13
|
-
|
|
14
|
+
s.focus(), s.click();
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
17
|
+
const t = document.createElement("input");
|
|
18
|
+
t.style.position = "absolute", t.style.top = `${s.offsetTop + 7}px`, t.style.left = `${s.offsetLeft}px`, t.style.height = "0px", t.style.opacity = "0px", document.body.appendChild(t), t.focus(), setTimeout(() => {
|
|
19
|
+
s.focus(), s.click(), document.body.removeChild(t);
|
|
20
|
+
}, r);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
label:
|
|
23
|
-
isMultiple:
|
|
24
|
-
isActive:
|
|
22
|
+
function Z({
|
|
23
|
+
label: s,
|
|
24
|
+
isMultiple: r,
|
|
25
|
+
isActive: t,
|
|
25
26
|
disabled: o
|
|
26
27
|
}) {
|
|
27
|
-
return
|
|
28
|
+
return r ? /* @__PURE__ */ n(
|
|
28
29
|
U,
|
|
29
30
|
{
|
|
30
|
-
checked:
|
|
31
|
-
label:
|
|
31
|
+
checked: t,
|
|
32
|
+
label: s,
|
|
32
33
|
readOnly: !0,
|
|
33
34
|
disabled: o
|
|
34
35
|
}
|
|
35
|
-
) :
|
|
36
|
+
) : s;
|
|
36
37
|
}
|
|
37
|
-
const
|
|
38
|
-
const { option:
|
|
39
|
-
function
|
|
40
|
-
return Array.isArray(o) ? o.includes(
|
|
38
|
+
const ee = (s) => {
|
|
39
|
+
const { option: r, onClick: t, value: o, mode: u, optionCellClassName: p, optionCell: i } = s;
|
|
40
|
+
function l() {
|
|
41
|
+
return Array.isArray(o) ? o.includes(r.value) : r.value === o;
|
|
41
42
|
}
|
|
42
43
|
return /* @__PURE__ */ n(
|
|
43
44
|
"button",
|
|
44
45
|
{
|
|
45
46
|
type: "button",
|
|
46
|
-
onClick:
|
|
47
|
+
onClick: t,
|
|
47
48
|
className: d(
|
|
48
49
|
"dgs-ui-kit-w-full dgs-ui-kit-text-start dgs-ui-kit-px-3 disabled:dgs-ui-kit-cursor-not-allowed dgs-ui-kit-py-3 dgs-ui-kit-font-p1-regular disabled:dgs-ui-kit-bg-gray-50 dgs-ui-kit-transition",
|
|
49
|
-
|
|
50
|
+
l() ? "dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-500" : "dgs-ui-kit-text-gray-700 disabled:dgs-ui-kit-text-gray-400",
|
|
50
51
|
p
|
|
51
52
|
),
|
|
52
|
-
disabled:
|
|
53
|
-
children:
|
|
54
|
-
label:
|
|
55
|
-
isMultiple:
|
|
56
|
-
isActive:
|
|
57
|
-
disabled:
|
|
53
|
+
disabled: r.disabled,
|
|
54
|
+
children: i ? i(r, l()) : Z({
|
|
55
|
+
label: r.label,
|
|
56
|
+
isMultiple: u === "multiple",
|
|
57
|
+
isActive: l(),
|
|
58
|
+
disabled: r.disabled ?? !1
|
|
58
59
|
})
|
|
59
60
|
}
|
|
60
61
|
);
|
|
61
|
-
},
|
|
62
|
+
}, j = D(ee), te = 20, ie = (s) => {
|
|
62
63
|
const {
|
|
63
|
-
options:
|
|
64
|
-
mode:
|
|
64
|
+
options: r,
|
|
65
|
+
mode: t = "single",
|
|
65
66
|
afterOptions: o,
|
|
66
|
-
beforOptions:
|
|
67
|
+
beforOptions: u,
|
|
67
68
|
onChange: p,
|
|
68
|
-
searchable:
|
|
69
|
-
separateSelectedOptions:
|
|
70
|
-
optionsTitle:
|
|
69
|
+
searchable: i = !0,
|
|
70
|
+
separateSelectedOptions: l = !0,
|
|
71
|
+
optionsTitle: g = "عنوانها",
|
|
71
72
|
value: c,
|
|
72
|
-
optionCellClassName:
|
|
73
|
+
optionCellClassName: x,
|
|
73
74
|
emptyContent: W = "نتیجهای یافت نشد !",
|
|
74
75
|
showClearButtonOnEmpty: H = !0
|
|
75
|
-
} =
|
|
76
|
+
} = s, [m, E] = M(""), [k, V] = M(0), f = F(null), { toggleWrapperVisibility: z } = J(), S = d(
|
|
76
77
|
"dgs-ui-kit-border-t dgs-ui-kit-border-solid dgs-ui-kit-border-gray-100",
|
|
77
|
-
(!
|
|
78
|
+
(!i && !u || t === "multiple" && l) && "first-of-type:dgs-ui-kit-border-t-0",
|
|
78
79
|
!!o && "last-of-type:dgs-ui-kit-border-b"
|
|
79
80
|
);
|
|
80
|
-
let
|
|
81
|
-
const
|
|
82
|
-
typeof
|
|
83
|
-
const v =
|
|
84
|
-
if (!Array.isArray(
|
|
81
|
+
let h;
|
|
82
|
+
const C = i;
|
|
83
|
+
typeof i == "boolean" ? h = i : h = Object.keys(i).length > 0;
|
|
84
|
+
const v = P(() => {
|
|
85
|
+
if (!Array.isArray(r))
|
|
85
86
|
throw new Error("options should be array");
|
|
86
|
-
return m ?
|
|
87
|
-
}, [m,
|
|
88
|
-
let
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
}, [v,
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
}, [
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
return
|
|
102
|
-
}, [
|
|
103
|
-
|
|
87
|
+
return m ? r?.filter((e) => e.label.includes(m)) : r;
|
|
88
|
+
}, [m, r]), N = P(() => t === "multiple" && l ? r?.filter((e) => c.includes(e.value)) ?? [] : [], [r, c]), T = P(() => {
|
|
89
|
+
let e = v;
|
|
90
|
+
t === "multiple" && l && (e = e?.filter((I) => !c.includes(I.value)));
|
|
91
|
+
const a = Math.min(k + te, e?.length ?? 0);
|
|
92
|
+
return e?.slice(k, a);
|
|
93
|
+
}, [v, k, c]), y = f?.current?.children[0]?.clientHeight ?? 50, R = (v?.length ?? 0) * y, w = B(() => {
|
|
94
|
+
const e = f?.current?.parentElement;
|
|
95
|
+
if (!e) return;
|
|
96
|
+
const a = e.scrollTop, I = f.current.offsetTop, $ = Math.floor((a - I) / y);
|
|
97
|
+
V($ >= 0 ? $ : 0);
|
|
98
|
+
}, [y]);
|
|
99
|
+
L(() => {
|
|
100
|
+
const e = f.current?.parentElement;
|
|
101
|
+
if (e)
|
|
102
|
+
return e.addEventListener("scroll", w), () => e.removeEventListener("scroll", w);
|
|
103
|
+
}, [w]), L(() => {
|
|
104
|
+
h && Y(document.getElementById("search-input"), 400);
|
|
104
105
|
}, []);
|
|
105
|
-
const A =
|
|
106
|
-
(
|
|
106
|
+
const A = B(
|
|
107
|
+
(e) => {
|
|
107
108
|
if (typeof p == "function")
|
|
108
|
-
if (
|
|
109
|
-
const
|
|
110
|
-
|
|
109
|
+
if (t === "multiple") {
|
|
110
|
+
const a = [...c ?? []];
|
|
111
|
+
a.includes(e) ? a.splice(a.indexOf(e), 1) : a.push(e), p(a);
|
|
111
112
|
} else
|
|
112
|
-
p(
|
|
113
|
+
p(e), z();
|
|
113
114
|
},
|
|
114
115
|
[c]
|
|
115
116
|
);
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
return /* @__PURE__ */ b(O, { children: [
|
|
118
|
+
h && /* @__PURE__ */ n(
|
|
119
|
+
_,
|
|
119
120
|
{
|
|
120
121
|
id: "search-input",
|
|
121
122
|
wrapperClassName: d(
|
|
122
123
|
"dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-pt-3 dgs-ui-kit-right-0 dgs-ui-kit-bg-white dgs-ui-kit-z-10 dgs-ui-kit-px-3",
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
u ? "dgs-ui-kit-pb-2" : "dgs-ui-kit-pb-3",
|
|
125
|
+
C?.wrapperClassName
|
|
125
126
|
),
|
|
126
|
-
placeholder:
|
|
127
|
+
placeholder: C?.placeholder ?? "جستجوی عنوان",
|
|
127
128
|
value: m,
|
|
128
|
-
onChange: (
|
|
129
|
-
rightIcon:
|
|
129
|
+
onChange: (e) => E(e.currentTarget.value),
|
|
130
|
+
rightIcon: C?.rightIcon ?? /* @__PURE__ */ n(
|
|
130
131
|
K,
|
|
131
132
|
{
|
|
132
133
|
width: 20,
|
|
133
134
|
height: 20
|
|
134
135
|
}
|
|
135
136
|
),
|
|
136
|
-
...typeof
|
|
137
|
+
...typeof i == "object" ? i : {}
|
|
137
138
|
}
|
|
138
139
|
),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/* @__PURE__ */ n("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: `${
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
u,
|
|
141
|
+
t === "multiple" && l && N.length > 0 && /* @__PURE__ */ b(O, { children: [
|
|
142
|
+
/* @__PURE__ */ n("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: `${g}ی انتخاب شده` }),
|
|
143
|
+
N.map((e) => /* @__PURE__ */ n(
|
|
144
|
+
j,
|
|
144
145
|
{
|
|
145
|
-
onClick: () => A(
|
|
146
|
-
option:
|
|
147
|
-
optionCellClassName: d(
|
|
148
|
-
...
|
|
146
|
+
onClick: () => A(e.value),
|
|
147
|
+
option: e,
|
|
148
|
+
optionCellClassName: d(S, x),
|
|
149
|
+
...s
|
|
149
150
|
},
|
|
150
|
-
|
|
151
|
+
e.value
|
|
151
152
|
))
|
|
152
153
|
] }),
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
|
|
154
|
+
/* @__PURE__ */ b(O, { children: [
|
|
155
|
+
t === "multiple" && l && /* @__PURE__ */ n("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: g }),
|
|
155
156
|
/* @__PURE__ */ n(
|
|
156
157
|
"div",
|
|
157
158
|
{
|
|
158
|
-
ref:
|
|
159
|
+
ref: f,
|
|
159
160
|
className: "dgs-ui-kit-relative",
|
|
160
|
-
style: { height:
|
|
161
|
-
children:
|
|
161
|
+
style: { height: R },
|
|
162
|
+
children: T?.map((e, a) => /* @__PURE__ */ n(
|
|
162
163
|
"div",
|
|
163
164
|
{
|
|
164
|
-
className: d("dgs-ui-kit-absolute dgs-ui-kit-w-full",
|
|
165
|
-
style: { top: `${(
|
|
165
|
+
className: d("dgs-ui-kit-absolute dgs-ui-kit-w-full", S),
|
|
166
|
+
style: { top: `${(k + a) * y}px` },
|
|
166
167
|
children: /* @__PURE__ */ n(
|
|
167
|
-
|
|
168
|
+
j,
|
|
168
169
|
{
|
|
169
|
-
onClick: () => A(
|
|
170
|
-
option:
|
|
171
|
-
...
|
|
170
|
+
onClick: () => A(e.value),
|
|
171
|
+
option: e,
|
|
172
|
+
...s
|
|
172
173
|
}
|
|
173
174
|
)
|
|
174
175
|
},
|
|
175
|
-
|
|
176
|
+
e.value
|
|
176
177
|
))
|
|
177
178
|
}
|
|
178
179
|
),
|
|
179
|
-
!
|
|
180
|
+
!T?.length && !N.length && /* @__PURE__ */ b("div", { className: "dgs-ui-kit-text-center dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-items-center dgs-ui-kit-mt-2", children: [
|
|
180
181
|
/* @__PURE__ */ n("p", { className: "dgs-ui-kit-text-gray-500 dgs-ui-kit-font-p3-medium", children: W }),
|
|
181
182
|
H && /* @__PURE__ */ n(
|
|
182
|
-
|
|
183
|
+
G,
|
|
183
184
|
{
|
|
184
185
|
type: "button",
|
|
185
186
|
className: "dgs-ui-kit-mt-1",
|
|
@@ -194,19 +195,47 @@ const Y = (i) => {
|
|
|
194
195
|
o
|
|
195
196
|
] });
|
|
196
197
|
};
|
|
197
|
-
function
|
|
198
|
-
|
|
198
|
+
function se(s, r) {
|
|
199
|
+
if (!Array.isArray(s))
|
|
200
|
+
return r.find((t) => t.value === s)?.label ?? "";
|
|
199
201
|
}
|
|
200
|
-
const
|
|
201
|
-
const { searchable:
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
const fe = (s) => {
|
|
203
|
+
const { searchable: r = !0, value: t, options: o } = s, u = Array.isArray(t) && t.length > 0;
|
|
204
|
+
function p() {
|
|
205
|
+
return s.inputProps?.prefix ? s.inputProps.prefix : u ? t.map((l) => /* @__PURE__ */ n(
|
|
206
|
+
X,
|
|
207
|
+
{
|
|
208
|
+
label: o.find((g) => g.value === l)?.label,
|
|
209
|
+
clickable: !0,
|
|
210
|
+
leftIcon: /* @__PURE__ */ n(q, {}),
|
|
211
|
+
onClick: (g) => {
|
|
212
|
+
g.stopPropagation();
|
|
213
|
+
const c = t.filter((x) => x !== l);
|
|
214
|
+
s.onChange?.(c);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
l
|
|
218
|
+
)) : null;
|
|
219
|
+
}
|
|
220
|
+
const i = { ...s };
|
|
221
|
+
return i.dropdownType === "popover" && !r && (i.popoverClassName = d("dgs-ui-kit-pt-3", i.popoverClassName)), i.dropdownType === "drawer" && (i.drawerProps = {
|
|
222
|
+
...i.drawerProps,
|
|
204
223
|
containerClassName: d(
|
|
205
|
-
|
|
206
|
-
|
|
224
|
+
r ? "!dgs-ui-kit-pt-0" : "!dgs-ui-kit-pt-3",
|
|
225
|
+
i.drawerProps?.containerClassName
|
|
207
226
|
)
|
|
208
|
-
}),
|
|
227
|
+
}), i.customInput || (i.inputProps = {
|
|
228
|
+
...i.inputProps,
|
|
229
|
+
value: se(t, o),
|
|
230
|
+
prefix: p(),
|
|
231
|
+
prefixClassName: u ? d(
|
|
232
|
+
"dgs-ui-kit-flex dgs-ui-kit-items-center flex dgs-ui-kit-flex-wrap dgs-ui-kit-gap-2 dgs-ui-kit-w-full",
|
|
233
|
+
i.inputProps?.prefixClassName
|
|
234
|
+
) : i.inputProps?.prefixClassName,
|
|
235
|
+
className: u ? "dgs-ui-kit-hidden" : i.inputProps?.className,
|
|
236
|
+
containerClassName: u ? d("dgs-ui-kit-items-baseline", i.inputProps?.containerClassName) : i.inputProps?.containerClassName
|
|
237
|
+
}), /* @__PURE__ */ n(Q, { ...i, children: /* @__PURE__ */ n(ie, { ...s }) });
|
|
209
238
|
};
|
|
210
239
|
export {
|
|
211
|
-
|
|
240
|
+
fe as default
|
|
212
241
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";require('./assets/styles.css');const t=require("react/jsx-runtime"),e=require("./clsx-C11secjj.cjs"),n=require("react"),R=require("./Drawer/index.cjs"),q=require("./useFlipPosition-CLwjhe7O.cjs"),S=require("./IconArrowDown2-C1dLVveG.cjs"),E=require("./index-CSis3p-s.cjs");;/* empty css */const v=n.createContext({toggleWrapperVisibility:()=>{}}),D=()=>n.useContext(v),A=a=>{const i=n.useRef(null);return n.useEffect(()=>{const s=r=>{i.current&&!i.current.contains(r.target)&&a()};return document.addEventListener("click",s,!0),()=>{document.removeEventListener("click",s,!0)}},[i,a]),i},C="dgs-ui-kit-duration-300",b=400,O=a=>{const{dropdownType:i="popover",disabled:s,isLoading:r,wrapperClassName:N,customInput:g,children:k,drawerProps:m,inputProps:I,popoverClassName:y}=a,[u,c]=n.useState(!1),[f,d]=n.useState(!1),[x,P]=n.useState("bottom-left");let o;const{anchorRef:T,popperRef:W}=q.useFlipPosition({initialPosition:"bottom-left",minVisible:180,onPositionChange(l){P(w=>w===l?w:l)}}),j=A(()=>{i==="popover"&&u&&(c(!1),o&&clearTimeout(o),o=setTimeout(()=>{d(!1)},b))});function h(){if(s||r)return;const l=!f;o&&clearTimeout(o),l?(d(!0),o=setTimeout(()=>{c(!0)},0)):(c(!1),o=setTimeout(()=>{d(!1)},b))}const p=e.clsx({"!dgs-ui-kit-cursor-not-allowed":s,"!dgs-ui-kit-cursor-wait":r,"!dgs-ui-kit-cursor-pointer":!r&&!s});return t.jsxs("div",{ref:j,className:e.clsx("dgs-ui-kit-relative",N),children:[t.jsx("button",{ref:T,type:"button",className:e.clsx("dgs-ui-kit-w-full",p),onClick:h,children:g?g(u):t.jsx(E.Input,{leftIcon:r?t.jsx("div",{className:"dot-flashing dgs-ui-kit-mr-2"}):t.jsx(S.IconArrowDown2,{width:20,height:20,className:e.clsx("dgs-ui-kit-transition",C,{"dgs-ui-kit-rotate-180":u})}),containerClassName:e.clsx(p,{"dgs-ui-kit-items-baseline":r}),className:e.clsx("dgs-ui-kit-caret-transparent",p),disabled:s,...I})}),t.jsx(v.Provider,{value:{toggleWrapperVisibility:h},children:f&&t.jsx(t.Fragment,{children:i==="popover"?t.jsx("div",{ref:W,className:e.clsx("dgs-ui-kit-absolute dgs-ui-kit-min-w-[300px] dgs-ui-kit-right-0 dgs-ui-kit-overflow-y-auto dgs-ui-kit-overflow-x-hidden dgs-ui-kit-shadow-lg dgs-ui-kit-w-full dgs-ui-kit-max-h-[360px] dgs-ui-kit-transition-all dgs-ui-kit-bg-white dgs-ui-kit-z-50 dgs-ui-kit-rounded-lg dgs-ui-kit-border dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200 dgs-ui-kit-pb-3",C,u?"dgs-ui-kit-opacity-100":"dgs-ui-kit-opacity-0 dgs-ui-kit-max-h-0 dgs-ui-kit-overflow-y-hidden",{"dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-[calc(100%+8px)]":x.includes("bottom"),"dgs-ui-kit-top-0 dgs-ui-kit-translate-y-[calc(-100%-8px)]":x.includes("top")},y),children:k}):t.jsx(R,{...m,open:u,onClose:()=>c(!1),containerClassName:e.clsx("!dgs-ui-kit-pb-3 !dgs-ui-kit-px-0",m?.containerClassName),children:k})})})]})};exports.PickerWrapper=O;exports.usePickerWrapperContext=D;
|
|
@@ -5,7 +5,7 @@ import { createContext as D, useContext as O, useRef as A, useEffect as L, useSt
|
|
|
5
5
|
import V from "./Drawer/index.mjs";
|
|
6
6
|
import { u as _ } from "./useFlipPosition-pGmVUUhs.js";
|
|
7
7
|
import { I as j } from "./IconArrowDown2-7ddwV5IE.js";
|
|
8
|
-
import F from "./
|
|
8
|
+
import { I as F } from "./index-BOxK2gfQ.js";
|
|
9
9
|
import './assets/styles.css';/* empty css */
|
|
10
10
|
const v = D({
|
|
11
11
|
toggleWrapperVisibility: () => {
|
package/dist/Sidebar/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),r=require("../clsx-C11secjj.cjs"),o=require("react"),B=require("../index-BfuaA-Ji.cjs"),
|
|
1
|
+
"use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),r=require("../clsx-C11secjj.cjs"),o=require("react"),B=require("../index-BfuaA-Ji.cjs"),I=require("../IconSearch-BeVs-gUu.cjs"),S=require("../Badge/index.cjs"),O=require("../index-CSis3p-s.cjs");;/* empty css */const w=require("../AccordionItem-BcOHTf5E.cjs"),N=require("../Divider/index.cjs"),E=require("../IconArrowLeft2-CNA3H0xY.cjs"),R=require("../Button/index.cjs"),T=s=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...s,children:[i.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M9 12.12a.75.75 0 0 1 .75-.75h12.041a.75.75 0 0 1 0 1.5H9.75a.75.75 0 0 1-.75-.75",clipRule:"evenodd"}),i.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.333 8.675a.75.75 0 0 1 1.06-.002l2.928 2.916a.75.75 0 0 1 0 1.063l-2.928 2.916a.75.75 0 0 1-1.058-1.063l2.394-2.384-2.394-2.385a.75.75 0 0 1-.002-1.06M14.288 4.45c.777.576 1.165 1.516 1.325 3.249a.75.75 0 1 0 1.494-.138c-.17-1.848-.617-3.347-1.926-4.316C13.927 2.315 12.037 2 9.36 2c-3.55 0-5.733.556-6.853 2.38-.533.869-.77 1.945-.884 3.177-.114 1.228-.114 2.702-.114 4.411v.063c0 1.71 0 3.184.114 4.411.115 1.233.35 2.309.884 3.178C3.627 21.443 5.81 22 9.36 22c2.677 0 4.567-.316 5.821-1.245 1.309-.97 1.755-2.468 1.926-4.316a.75.75 0 1 0-1.494-.138c-.16 1.732-.548 2.673-1.325 3.249-.83.615-2.276.95-4.928.95-3.551 0-4.92-.599-5.575-1.665-.353-.576-.561-1.379-.668-2.531-.107-1.15-.108-2.557-.108-4.304s0-3.154.108-4.304c.107-1.153.315-1.955.668-2.531C4.441 4.098 5.81 3.5 9.36 3.5c2.652 0 4.098.334 4.928.95",clipRule:"evenodd"})]}),h="dgs-ui-kit-duration-300",b="dgs-ui-kit-relative dgs-ui-kit-transition-all hover:dgs-ui-kit-bg-gray-50 dgs-ui-kit-rounded-lg focus:dgs-ui-kit-ring-[3px] focus:dgs-ui-kit-ring-offset-1 dgs-ui-kit-ring-offset-white dgs-ui-kit-ring-primary-300 dgs-ui-kit-text-gray-600",j="dgs-ui-kit-opacity-40 dgs-ui-kit-pointer-events-none",v="!dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-600",y=`${v} before:dgs-ui-kit-content-[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-w-1 before:dgs-ui-kit-h-[22px] before:dgs-ui-kit-rounded-l-md before:dgs-ui-kit-bg-primary-500 before:dgs-ui-kit-top-1/2 before:-dgs-ui-kit-translate-y-1/2 before:-dgs-ui-kit-right-4`,A=o.createContext({isOpen:!1,setIsOpen:()=>{}}),c=()=>o.useContext(A),p=s=>r.clsx("dgs-ui-kit-transition-opacity dgs-ui-kit-whitespace-pre dgs-ui-kit-overflow-hidden",s?"dgs-ui-kit-opacity-100":"dgs-ui-kit-opacity-0",h);function C(s,t){return i.jsxs("div",{className:r.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center [&_svg]:dgs-ui-kit-size-6 [&_svg]:dgs-ui-kit-shrink-0 dgs-ui-kit-min-h-12 dgs-ui-kit-text-start",t?"dgs-ui-kit-space-x-2 dgs-ui-kit-space-x-reverse":"dgs-ui-kit-justify-center"),children:[s.icon,i.jsx("div",{className:r.clsx("dgs-ui-kit-font-p2-regular dgs-ui-kit-line-clamp-1 !dgs-ui-kit-transition-[width,opacity]",t?"dgs-ui-kit-w-full":"dgs-ui-kit-w-0",p),children:s.title}),s.badgeCount&&i.jsx(S,{className:r.clsx("dgs-ui-kit-shrink-0",{"!dgs-ui-kit-absolute dgs-ui-kit-top-0 dgs-ui-kit-left-0":!t}),value:s.badgeCount,valueType:"number",color:"error",size:"small"})]})}function _(s,t){return s.map(e=>{if("children"in e&&e.children){const u=_(e.children,t);if(u.length>0)return{...e,children:u}}return e.title.includes(t)?{...e}:null}).filter(e=>!!e)}const z=s=>{const{value:t,onChange:e}=s,{isOpen:u,searchInput:n}=c();return i.jsx(O.Input,{value:t,onChange:e,rightIcon:i.jsx(I.IconSearch,{}),placeholder:"جستجو",...typeof n=="boolean"?{}:n,wrapperClassName:r.clsx("dgs-ui-kit-mb-8 dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-bg-white dgs-ui-kit-z-10 dgs-ui-kit-px-4",p(u),typeof n=="object"&&n.wrapperClassName,h)})},D=()=>{const{isOpen:s,searchInput:t=!0,items:e}=c(),[u,n]=o.useState(""),[g,k]=o.useState(e??[]),f=o.useCallback(B.debounce(l=>{k(_(g,l))},800),[]);function m(l){const x=l.target.value;n(x),f(x)}function q(){n(""),k(e??[])}return o.useEffect(()=>{u&&q()},[s]),i.jsxs("div",{className:"dgs-ui-kit-overflow-y-auto dgs-ui-kit-overflow-x-hidden -dgs-ui-kit-mx-4 dgs-ui-kit-h-3/4 no-scrollbar",children:[!!t&&i.jsx(z,{value:u,onChange:m}),i.jsx("div",{className:"dgs-ui-kit-space-y-6 dgs-ui-kit-px-4",children:g.map((l,x)=>i.jsxs(o.Fragment,{children:[i.jsx("div",{className:r.clsx("dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400",p(s)),children:l.title}),i.jsx(w.AccordionGroup,{className:"dgs-ui-kit-mt-4 dgs-ui-kit-space-y-2",children:l.children?.map(d=>d.link?i.jsx("a",{href:d.link,className:r.clsx("dgs-ui-kit-pr-3",d.disabled&&j,d.active&&y,s?"dgs-ui-kit-pl-9":"dgs-ui-kit-pl-3",b),children:C(d,s)},d.link):i.jsx(w.AccordionItem,{className:r.clsx("!dgs-ui-kit-p-0",d.disabled&&j),title:C(d,s),hideDivider:!0,hideArrow:!s||d.disabled,disable:!s||d.disabled,titleClassName:r.clsx("[&_>div:first-child]:dgs-ui-kit-flex-1 [&_>div:first-child]:dgs-ui-kit-pl-1",s?"dgs-ui-kit-px-3":"!dgs-ui-kit-justify-center",d.children?.find(a=>a.active)&&y,b),children:d.children?.map(a=>i.jsxs("a",{href:a.link,className:r.clsx("dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-h-10 dgs-ui-kit-pl-9 dgs-ui-kit-pr-11 dgs-ui-kit-py-2 dgs-ui-kit-mt-1 first:dgs-ui-kit-mt-0",a.disabled&&j,a.active&&v,b),children:[i.jsx("p",{children:a.title}),a.badgeCount&&i.jsx(S,{valueType:"number",value:a.badgeCount,color:"error",type:"twoTone",size:"small"})]},a.link))},d.link??d.title))}),x!==g.length-1&&i.jsx(N,{type:"horizontal"})]},l.title))})]})},P=()=>{const{isOpen:s,logo:t}=c();return i.jsx("div",{className:"dgs-ui-kit-flex dgs-ui-kit-justify-center dgs-ui-kit-items-center dgs-ui-kit-mb-8",children:i.jsx("img",{...t,alt:t?.alt??"Logo",src:s?t?.open:t?.close,className:r.clsx("dgs-ui-kit-h-12 dgs-ui-kit-w-full",t?.className)})})},M=()=>{const{userProfile:s,isOpen:t}=c();return i.jsxs("a",{href:s?.link??"#",className:r.clsx("dgs-ui-kit-mb-4 dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-2 dgs-ui-kit-space-x-reverse",{"dgs-ui-kit-pointer-events-none":!s?.link}),children:[i.jsx("img",{src:s?.image,alt:s?.name??"user_avatar",className:"dgs-ui-kit-size-12 dgs-ui-kit-rounded-full dgs-ui-kit-shrink-0"}),i.jsxs("div",{className:r.clsx("dgs-ui-kit-flex dgs-ui-kit-flex-col",p(t)),children:[i.jsx("p",{className:"dgs-ui-kit-font-p3-medium dgs-ui-kit-text-gray-700",children:s?.name}),i.jsx("p",{className:"dgs-ui-kit-font-p3-regular dgs-ui-kit-text-gray-400",children:s?.description})]})]})},F=()=>{const{isOpen:s,setIsOpen:t}=c();return i.jsx("button",{type:"button",className:"dgs-ui-kit-absolute dgs-ui-kit-top-7 dgs-ui-kit-left-0 -dgs-ui-kit-translate-x-1/2 dgs-ui-kit-p-1 dgs-ui-kit-rounded-lg dgs-ui-kit-border dgs-ui-kit-border-gray-300 dgs-ui-kit-bg-white",onClick:()=>t(!s),children:i.jsx(E.IconArrowLeft2,{className:r.clsx("dgs-ui-kit-transition-transform dgs-ui-kit-text-primary-500",s&&"dgs-ui-kit-rotate-180",h),width:16,height:16})})},V=s=>{const{isOpen:t,className:e,logo:u,items:n,extraComponent:g,userProfile:k,logOutButtonProps:f,onLogout:m}=s;return i.jsx(A.Provider,{value:s,children:i.jsxs("div",{className:r.clsx(e,"dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-fixed dgs-ui-kit-top-0 dgs-ui-kit-right-0 dgs-ui-kit-bg-white dgs-ui-kit-shadow-md dgs-ui-kit-h-full dgs-ui-kit-p-4 dgs-ui-kit-pt-6 dgs-ui-kit-transition-[width,max-width]",t?"dgs-ui-kit-w-[280px] dgs-ui-kit-max-w-full":"dgs-ui-kit-w-[80px] dgs-ui-kit-max-w-[80px]",h),children:[i.jsx(F,{}),!!(u?.open??u?.close)&&i.jsx(P,{}),n&&n.length>0&&i.jsx(D,{}),i.jsxs("div",{className:"dgs-ui-kit-shrink-0 dgs-ui-kit-flex-1",children:[g,i.jsx(N,{className:"dgs-ui-kit-mt-6 dgs-ui-kit-mb-4",type:"horizontal"}),!!k?.image&&i.jsx(M,{}),i.jsx(R,{color:"error",variant:"secondary",rightIcon:i.jsx(T,{}),isFullWidth:!0,onClick:m,...f,children:t?"خروج":""})]})]})})};module.exports=V;
|
package/dist/Sidebar/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createContext as E, useContext as I, useState as C, useCallback as T, u
|
|
|
4
4
|
import { d as D } from "../index-CzwAoGdL.js";
|
|
5
5
|
import { I as R } from "../IconSearch-aShj2vmu.js";
|
|
6
6
|
import S from "../Badge/index.mjs";
|
|
7
|
-
import P from "../
|
|
7
|
+
import { I as P } from "../index-BOxK2gfQ.js";
|
|
8
8
|
import '../assets/styles.css';/* empty css */
|
|
9
9
|
import { A as M, a as V } from "../AccordionItem-CbYyB1Ub.js";
|
|
10
10
|
import v from "../Divider/index.mjs";
|