@dgshahr/ui-kit 0.0.89 → 0.0.91
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/Chip/index.cjs +1 -1
- package/dist/Chip/index.d.ts.map +1 -1
- package/dist/Chip/index.mjs +2 -2
- package/dist/FieldBottomInfo-CE1uBAqq.cjs +1 -0
- package/dist/FieldBottomInfo-CJ8_Kr25.js +49 -0
- package/dist/Form/FileUploader/index.cjs +1 -1
- package/dist/Form/FileUploader/index.d.ts.map +1 -1
- package/dist/Form/FileUploader/index.mjs +80 -80
- package/dist/Form/FileUploader/types.d.ts +2 -1
- package/dist/Form/FileUploader/types.d.ts.map +1 -1
- package/dist/Form/Input/index.cjs +1 -1
- package/dist/Form/Input/index.mjs +1 -1
- package/dist/Form/OtpInput/index.cjs +1 -1
- package/dist/Form/OtpInput/index.mjs +2 -2
- package/dist/Form/Select/Options.d.ts.map +1 -1
- package/dist/Form/Select/index.cjs +1 -1
- package/dist/Form/Select/index.mjs +25 -21
- package/dist/Form/Textarea/index.cjs +1 -1
- package/dist/Form/Textarea/index.mjs +1 -1
- package/dist/IconInfoCircleOutline-0ef3qbeI.cjs +1 -0
- package/dist/IconInfoCircleOutline-aO1F3qnG.js +35 -0
- package/dist/Table/Cell.d.ts +13 -0
- package/dist/Table/Cell.d.ts.map +1 -0
- package/dist/Table/Header.d.ts +7 -0
- package/dist/Table/Header.d.ts.map +1 -0
- package/dist/Table/TBody.d.ts +7 -0
- package/dist/Table/TBody.d.ts.map +1 -0
- package/dist/Table/THead.d.ts +7 -0
- package/dist/Table/THead.d.ts.map +1 -0
- package/dist/Table/context.d.ts +13 -0
- package/dist/Table/context.d.ts.map +1 -0
- package/dist/Table/index.cjs +1 -0
- package/dist/Table/index.d.ts +5 -0
- package/dist/Table/index.d.ts.map +1 -0
- package/dist/Table/index.mjs +372 -0
- package/dist/Table/types.d.ts +58 -0
- package/dist/Table/types.d.ts.map +1 -0
- package/dist/Table/utils.d.ts +8 -0
- package/dist/Table/utils.d.ts.map +1 -0
- package/dist/{TextFieldWrapper-K0g1kAl1.cjs → TextFieldWrapper-CQbBbmlX.cjs} +1 -1
- package/dist/{TextFieldWrapper-44165bs_.js → TextFieldWrapper-CQgQsfMJ.js} +1 -1
- package/dist/Tooltip/index.cjs +1 -1
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/index.mjs +36 -27
- package/dist/assets/styles.css +1 -1
- 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 +12 -10
- package/package.json +6 -1
- package/dist/FieldBottomInfo-7YeZbp0-.cjs +0 -1
- package/dist/FieldBottomInfo-B1n-gK3T.js +0 -78
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s, jsxs as g } from "react/jsx-runtime";
|
|
3
|
+
import { c } from "../clsx-OuTLNxxd.js";
|
|
4
|
+
import { useState as K, useEffect as T, createContext as L, useContext as j, useRef as H } from "react";
|
|
5
|
+
import D from "../Badge/index.mjs";
|
|
6
|
+
import O from "../Form/Checkbox/index.mjs";
|
|
7
|
+
import A from "../Tooltip/index.mjs";
|
|
8
|
+
import { I as P } from "../IconArrowDown2-7ddwV5IE.js";
|
|
9
|
+
import { I as z } from "../IconInfoCircleOutline-aO1F3qnG.js";
|
|
10
|
+
import m from "../Divider/index.mjs";
|
|
11
|
+
import q from "../Pagination/index.mjs";
|
|
12
|
+
import '../assets/styles.css';/* empty css */
|
|
13
|
+
const E = L({
|
|
14
|
+
observer: null,
|
|
15
|
+
columns: [],
|
|
16
|
+
data: [],
|
|
17
|
+
rowKey: ""
|
|
18
|
+
}), R = "after:!dgs-ui-kit-shadow-[rgba(0,0,0,0.06)]";
|
|
19
|
+
function y(e) {
|
|
20
|
+
e.classList.add(R);
|
|
21
|
+
}
|
|
22
|
+
function $(e) {
|
|
23
|
+
e.classList.remove(R);
|
|
24
|
+
}
|
|
25
|
+
function M(e) {
|
|
26
|
+
const { children: t, ...n } = e, { columns: o, rowSelection: r } = n, [d, a] = K(null);
|
|
27
|
+
return T(() => {
|
|
28
|
+
let i = o.some((u) => !!u.sticky);
|
|
29
|
+
return i || (i = !!r?.sticky), i && a(
|
|
30
|
+
new IntersectionObserver(
|
|
31
|
+
(u) => {
|
|
32
|
+
let l = !1;
|
|
33
|
+
for (const k of u)
|
|
34
|
+
if (k.boundingClientRect.right > k.intersectionRect.right) {
|
|
35
|
+
document.querySelectorAll("#sticky-cell-right").forEach(y), l = !0;
|
|
36
|
+
break;
|
|
37
|
+
} else if (k.boundingClientRect.left < k.intersectionRect.left) {
|
|
38
|
+
document.querySelectorAll("#sticky-cell-left").forEach(y), l = !0;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
l || document.querySelectorAll('[id^="sticky-cell-"]').forEach($);
|
|
42
|
+
},
|
|
43
|
+
{ threshold: 1, rootMargin: "0% 100% 0% 100%" }
|
|
44
|
+
)
|
|
45
|
+
), () => {
|
|
46
|
+
d && d.disconnect();
|
|
47
|
+
};
|
|
48
|
+
}, []), /* @__PURE__ */ s(E.Provider, { value: { observer: d, ...n }, children: t });
|
|
49
|
+
}
|
|
50
|
+
const b = () => j(E), F = (e) => {
|
|
51
|
+
const { title: t, extraElement: n, showTotal: o, total: r, className: d } = e;
|
|
52
|
+
return /* @__PURE__ */ g(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: c(
|
|
56
|
+
"dgs-ui-kit-p-4 dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",
|
|
57
|
+
d
|
|
58
|
+
),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ s("div", { className: "dgs-ui-kit-font-h4-bold dgs-ui-kit-text-gray-700 dgs-ui-kit-w-full", children: t }),
|
|
61
|
+
o && /* @__PURE__ */ g("div", { className: "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-shrink-0", children: [
|
|
62
|
+
/* @__PURE__ */ s("span", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-700 dgs-ui-kit-ml-1", children: "تعداد نتایج:" }),
|
|
63
|
+
/* @__PURE__ */ s(
|
|
64
|
+
D,
|
|
65
|
+
{
|
|
66
|
+
value: r ?? 0,
|
|
67
|
+
valueType: "number",
|
|
68
|
+
size: "large",
|
|
69
|
+
color: "primary",
|
|
70
|
+
type: "twoTone"
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
n
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
function p(e) {
|
|
80
|
+
switch (e) {
|
|
81
|
+
case "center":
|
|
82
|
+
return "dgs-ui-kit-justify-center";
|
|
83
|
+
case "start":
|
|
84
|
+
return "dgs-ui-kit-justify-start";
|
|
85
|
+
case "end":
|
|
86
|
+
return "dgs-ui-kit-justify-end";
|
|
87
|
+
default:
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function B(e, t) {
|
|
92
|
+
return e || (Array.isArray(t) ? t[t.length - 1] : t);
|
|
93
|
+
}
|
|
94
|
+
function _(e) {
|
|
95
|
+
return !!(e && e.selectedRowKeys.length > 1 || typeof e?.onSelectRow == "function");
|
|
96
|
+
}
|
|
97
|
+
function I(e, t) {
|
|
98
|
+
return /* @__PURE__ */ s(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: c(
|
|
102
|
+
"dgs-ui-kit-w-full dgs-ui-kit-flex dgs-ui-kit-items-centerd",
|
|
103
|
+
p(e ?? "center")
|
|
104
|
+
),
|
|
105
|
+
children: /* @__PURE__ */ s(O, { ...t })
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
function U(e, t) {
|
|
110
|
+
if (e)
|
|
111
|
+
return c(
|
|
112
|
+
"dgs-ui-kit-sticky dgs-ui-kit-z-10",
|
|
113
|
+
'after:dgs-ui-kit-content[""] after:dgs-ui-kit-absolute after:dgs-ui-kit-top-0 after:dgs-ui-kit-h-full after:dgs-ui-kit-w-[30px] after:dgs-ui-kit-transition-shadow',
|
|
114
|
+
// sticky shadow class
|
|
115
|
+
{
|
|
116
|
+
" dgs-ui-kit-right-[-1px] dgs-ui-kit-pr-[calc(1em+1px)] after:dgs-ui-kit-left-0 after:-dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_-10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent": e === "right",
|
|
117
|
+
" dgs-ui-kit-left-[-1px] dgs-ui-kit-pl-[calc(1em+1px)] after:dgs-ui-kit-right-0 after:dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent": e === "left",
|
|
118
|
+
'before:dgs-ui-kit-content-[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-top-0 before:dgs-ui-kit-right-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-t before:md:dgs-ui-kit-border-t-0 before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200': t
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
const f = (e) => {
|
|
123
|
+
const { children: t, className: n, type: o, sticky: r, addBorderToSticky: d, stuckToTop: a } = e, i = H(null), u = o, { observer: l } = b();
|
|
124
|
+
return T(() => {
|
|
125
|
+
if (!(!i.current || !l))
|
|
126
|
+
return r && l.observe(i.current), () => {
|
|
127
|
+
!i.current || !l || r && l.unobserve(i.current);
|
|
128
|
+
};
|
|
129
|
+
}, [i, l]), /* @__PURE__ */ s(
|
|
130
|
+
u,
|
|
131
|
+
{
|
|
132
|
+
ref: i,
|
|
133
|
+
className: c(n, U(r, d), {
|
|
134
|
+
'dgs-ui-kit-border-b-0 before:dgs-ui-kit-content[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-bottom-0 before:dgs-ui-kit-left-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-b before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200': a,
|
|
135
|
+
"dgs-ui-kit-top-0 dgs-ui-kit-z-20": a && r,
|
|
136
|
+
"dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-z-10": a && !r
|
|
137
|
+
}),
|
|
138
|
+
id: r && `sticky-cell-${r}`,
|
|
139
|
+
children: t
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}, x = "dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-bg-white dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200";
|
|
143
|
+
function W(e, t) {
|
|
144
|
+
return e ? Array.isArray(e) ? e.reduce((n, o) => n?.[o] ?? null, t) : t[e] : null;
|
|
145
|
+
}
|
|
146
|
+
function Z(e, t, n) {
|
|
147
|
+
if (typeof e.render == "function") return e.render(t, n);
|
|
148
|
+
const o = W(e.dataIndex, t);
|
|
149
|
+
if (e.ellipsis) {
|
|
150
|
+
const r = /* @__PURE__ */ s("div", { className: "!dgs-ui-kit-truncate", children: o });
|
|
151
|
+
return typeof e.ellipsis != "boolean" && e.ellipsis.hideTooltip ? r : /* @__PURE__ */ s(
|
|
152
|
+
A,
|
|
153
|
+
{
|
|
154
|
+
wrapperClassName: "dgs-ui-kit-w-full",
|
|
155
|
+
content: o,
|
|
156
|
+
children: r
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
return o;
|
|
161
|
+
}
|
|
162
|
+
const G = (e) => {
|
|
163
|
+
const { havePagination: t } = e, { columns: n, data: o, rowKey: r, rowSelection: d, stickyTableHeader: a } = b();
|
|
164
|
+
return /* @__PURE__ */ s("tbody", { children: o.map((i, u) => /* @__PURE__ */ g("tr", { children: [
|
|
165
|
+
_(d) && /* @__PURE__ */ s(
|
|
166
|
+
f,
|
|
167
|
+
{
|
|
168
|
+
type: "td",
|
|
169
|
+
className: c(
|
|
170
|
+
x,
|
|
171
|
+
d?.className,
|
|
172
|
+
{
|
|
173
|
+
"dgs-ui-kit-border-b-0 dgs-ui-kit-rounded-br-2xl": !t && u === o.length - 1
|
|
174
|
+
},
|
|
175
|
+
d?.className
|
|
176
|
+
),
|
|
177
|
+
sticky: d?.sticky,
|
|
178
|
+
addBorderToSticky: a ? u !== 0 : !0,
|
|
179
|
+
children: I(d?.align, {
|
|
180
|
+
onChange: (l) => d?.onSelectRow(l, i[r]),
|
|
181
|
+
checked: !!d?.selectedRowKeys.find((l) => l === i[r])
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
n.map((l) => /* @__PURE__ */ s(
|
|
186
|
+
f,
|
|
187
|
+
{
|
|
188
|
+
type: "td",
|
|
189
|
+
className: c(
|
|
190
|
+
x,
|
|
191
|
+
{
|
|
192
|
+
"dgs-ui-kit-border-b-0 first:dgs-ui-kit-rounded-br-2xl last:dgs-ui-kit-rounded-bl-2xl": !t && u === o.length - 1
|
|
193
|
+
},
|
|
194
|
+
l.className
|
|
195
|
+
),
|
|
196
|
+
sticky: l.sticky,
|
|
197
|
+
addBorderToSticky: a ? u !== 0 : !0,
|
|
198
|
+
children: /* @__PURE__ */ s(
|
|
199
|
+
"div",
|
|
200
|
+
{
|
|
201
|
+
className: c(
|
|
202
|
+
"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-ml-2",
|
|
203
|
+
p(l.align)
|
|
204
|
+
),
|
|
205
|
+
children: Z(l, i, u)
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
},
|
|
209
|
+
`${i[r]}-${B(l.key, l.dataIndex)}`
|
|
210
|
+
))
|
|
211
|
+
] }, i[r])) });
|
|
212
|
+
}, J = (e) => /* @__PURE__ */ s(
|
|
213
|
+
"svg",
|
|
214
|
+
{
|
|
215
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
216
|
+
width: "1em",
|
|
217
|
+
height: "1em",
|
|
218
|
+
fill: "none",
|
|
219
|
+
viewBox: "0 0 24 24",
|
|
220
|
+
...e,
|
|
221
|
+
children: /* @__PURE__ */ s(
|
|
222
|
+
"path",
|
|
223
|
+
{
|
|
224
|
+
fill: "currentColor",
|
|
225
|
+
d: "M19.53 16.03a.75.75 0 0 1-.976.073l-.084-.073L12 9.561l-6.47 6.47a.75.75 0 0 1-.976.072l-.084-.073a.75.75 0 0 1-.073-.976l.073-.084 7-7a.75.75 0 0 1 .976-.073l.084.073 7 7a.75.75 0 0 1 0 1.06"
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
function Q(e, t) {
|
|
231
|
+
if (e.length !== t.length) return !1;
|
|
232
|
+
e.sort(), t.sort();
|
|
233
|
+
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
234
|
+
return !0;
|
|
235
|
+
}
|
|
236
|
+
const h = 16, v = "dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-text-gray-500 dgs-ui-kit-bg-gray-50 dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200", w = "!dgs-ui-kit-h-8 dgs-ui-kit-shrink-0";
|
|
237
|
+
function C(e, t) {
|
|
238
|
+
return /* @__PURE__ */ s("button", { onClick: () => t.onSort(e), children: /* @__PURE__ */ s(
|
|
239
|
+
e === "ascend" ? J : P,
|
|
240
|
+
{
|
|
241
|
+
width: h,
|
|
242
|
+
height: h,
|
|
243
|
+
className: t.active === e ? "dgs-ui-kit-text-primary-500" : "dgs-ui-kit-text-gray-500"
|
|
244
|
+
}
|
|
245
|
+
) });
|
|
246
|
+
}
|
|
247
|
+
function N(e, t) {
|
|
248
|
+
return /* @__PURE__ */ g("div", { className: "dgs-ui-kit-font-p1-medium dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse", children: [
|
|
249
|
+
/* @__PURE__ */ s("span", { children: e }),
|
|
250
|
+
t && (t.anchorIcon ?? /* @__PURE__ */ s(
|
|
251
|
+
z,
|
|
252
|
+
{
|
|
253
|
+
width: h,
|
|
254
|
+
height: h
|
|
255
|
+
}
|
|
256
|
+
))
|
|
257
|
+
] });
|
|
258
|
+
}
|
|
259
|
+
function S(e, t) {
|
|
260
|
+
return e.map((n) => n[t]);
|
|
261
|
+
}
|
|
262
|
+
const X = (e) => {
|
|
263
|
+
const { haveHeader: t } = e, { columns: n, rowKey: o, rowSelection: r, data: d, stickyTableHeader: a } = b();
|
|
264
|
+
return /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ g("tr", { children: [
|
|
265
|
+
_(r) && /* @__PURE__ */ s(
|
|
266
|
+
f,
|
|
267
|
+
{
|
|
268
|
+
type: "th",
|
|
269
|
+
className: c(
|
|
270
|
+
v,
|
|
271
|
+
{ "dgs-ui-kit-rounded-tr-2xl": !t },
|
|
272
|
+
r?.className
|
|
273
|
+
),
|
|
274
|
+
sticky: r?.sticky,
|
|
275
|
+
stuckToTop: a,
|
|
276
|
+
children: /* @__PURE__ */ g("div", { className: "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-between", children: [
|
|
277
|
+
I(r?.align, {
|
|
278
|
+
checked: r.selectedRowKeys.length > 0,
|
|
279
|
+
isIndeterminate: !Q(
|
|
280
|
+
S(d, o),
|
|
281
|
+
r.selectedRowKeys
|
|
282
|
+
),
|
|
283
|
+
onChange: (i) => r?.onSelectRow(i, i.target.checked ? S(d, o) : [])
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ s(
|
|
286
|
+
m,
|
|
287
|
+
{
|
|
288
|
+
type: "vertical",
|
|
289
|
+
className: w
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] })
|
|
293
|
+
}
|
|
294
|
+
),
|
|
295
|
+
n.map((i, u) => /* @__PURE__ */ s(
|
|
296
|
+
f,
|
|
297
|
+
{
|
|
298
|
+
type: "th",
|
|
299
|
+
sticky: i.sticky,
|
|
300
|
+
className: c(
|
|
301
|
+
v,
|
|
302
|
+
{
|
|
303
|
+
"first:dgs-ui-kit-rounded-tr-2xl last:dgs-ui-kit-rounded-tl-2xl": !t
|
|
304
|
+
},
|
|
305
|
+
i.className
|
|
306
|
+
),
|
|
307
|
+
stuckToTop: a,
|
|
308
|
+
children: /* @__PURE__ */ g("div", { className: "dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-items-center", children: [
|
|
309
|
+
/* @__PURE__ */ g(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
className: c(
|
|
313
|
+
"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-2 dgs-ui-kit-space-x-reverse dgs-ui-kit-w-full dgs-ui-kit-ml-2",
|
|
314
|
+
p(i.align)
|
|
315
|
+
),
|
|
316
|
+
children: [
|
|
317
|
+
i.tooltip?.content ? /* @__PURE__ */ s(A, { ...i.tooltip, children: N(i.title, i.tooltip) }) : N(i.title),
|
|
318
|
+
typeof i.sort?.onSort == "function" && /* @__PURE__ */ g("div", { className: "dgs-ui-kit-flex dgs-ui-kit-flex-col", children: [
|
|
319
|
+
C("ascend", i.sort),
|
|
320
|
+
C("descend", i.sort)
|
|
321
|
+
] })
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
u !== n.length - 1 && /* @__PURE__ */ s(
|
|
326
|
+
m,
|
|
327
|
+
{
|
|
328
|
+
type: "vertical",
|
|
329
|
+
className: w
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
] })
|
|
333
|
+
},
|
|
334
|
+
B(i.key, i.dataIndex)
|
|
335
|
+
))
|
|
336
|
+
] }) });
|
|
337
|
+
};
|
|
338
|
+
function ae(e) {
|
|
339
|
+
const { header: t, wrapperClassName: n, className: o, data: r, pagination: d } = e, a = (t && Object.values(t).length > 0) ?? !1, i = !!(d?.totalCount && d?.pageSize);
|
|
340
|
+
return /* @__PURE__ */ g(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
className: c(
|
|
344
|
+
"dgs-ui-kit-relative dgs-ui-kit-bg-white dgs-ui-kit-border dgs-ui-kit-border-gray-200 dgs-ui-kit-border-solid dgs-ui-kit-rounded-2xl ",
|
|
345
|
+
n
|
|
346
|
+
),
|
|
347
|
+
children: [
|
|
348
|
+
a && /* @__PURE__ */ s(
|
|
349
|
+
F,
|
|
350
|
+
{
|
|
351
|
+
...t,
|
|
352
|
+
total: d?.totalCount ?? r.length
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ s("table", { className: o, children: /* @__PURE__ */ g(M, { ...e, children: [
|
|
356
|
+
/* @__PURE__ */ s(X, { haveHeader: a }),
|
|
357
|
+
/* @__PURE__ */ s(G, { havePagination: i })
|
|
358
|
+
] }) }),
|
|
359
|
+
i && /* @__PURE__ */ s(
|
|
360
|
+
q,
|
|
361
|
+
{
|
|
362
|
+
className: c("dgs-ui-kit-py-4 !dgs-ui-kit-px-0", d?.className),
|
|
363
|
+
...d
|
|
364
|
+
}
|
|
365
|
+
)
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
export {
|
|
371
|
+
ae as default
|
|
372
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DeepNamePath } from '../../utils/types/deepNamePath';
|
|
3
|
+
import { PaginationProps } from '../Pagination';
|
|
4
|
+
import { TooltipProps } from '../Tooltip';
|
|
5
|
+
type NonTypeSafeDataIndex = string | string[];
|
|
6
|
+
type TypeSafeDataIndex<T> = keyof T | DeepNamePath<T>;
|
|
7
|
+
type DataIndexPath<T> = [keyof T] extends [never] ? NonTypeSafeDataIndex : TypeSafeDataIndex<T>;
|
|
8
|
+
export type UnknownRecord = Record<string, unknown>;
|
|
9
|
+
export type SortValues = 'ascend' | 'descend';
|
|
10
|
+
interface ColumnsTypeBase<T> {
|
|
11
|
+
title?: string;
|
|
12
|
+
align?: 'start' | 'center' | 'end';
|
|
13
|
+
className?: string;
|
|
14
|
+
tooltip?: Omit<TooltipProps, 'children'> & {
|
|
15
|
+
anchorIcon?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
sticky?: 'left' | 'right';
|
|
18
|
+
ellipsis?: boolean | {
|
|
19
|
+
hideTooltip?: boolean;
|
|
20
|
+
};
|
|
21
|
+
render?: (record: T, index: number) => ReactNode;
|
|
22
|
+
sort?: {
|
|
23
|
+
active?: SortValues;
|
|
24
|
+
onSort: (value: SortValues) => void;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface ColumnsTypeWithKey<T> {
|
|
28
|
+
key: string;
|
|
29
|
+
dataIndex?: DataIndexPath<T>;
|
|
30
|
+
}
|
|
31
|
+
interface ColumnsTypeWithDataIndex<T> {
|
|
32
|
+
key?: string;
|
|
33
|
+
dataIndex: DataIndexPath<T>;
|
|
34
|
+
}
|
|
35
|
+
export type ColumnsType<T extends UnknownRecord = UnknownRecord> = ColumnsTypeBase<T> & (ColumnsTypeWithKey<T> | ColumnsTypeWithDataIndex<T>);
|
|
36
|
+
export interface TableHeaderProps {
|
|
37
|
+
title?: string;
|
|
38
|
+
showTotal?: boolean;
|
|
39
|
+
extraElement?: ReactNode;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface RowSelectionProps<T> extends Pick<ColumnsType, 'align' | 'sticky' | 'className'> {
|
|
43
|
+
onSelectRow: (e: React.ChangeEvent<HTMLInputElement>, key: string | string[], record?: T) => void;
|
|
44
|
+
selectedRowKeys: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface TableProps<T extends UnknownRecord = UnknownRecord> {
|
|
47
|
+
data: T[];
|
|
48
|
+
columns: ColumnsType<T>[];
|
|
49
|
+
rowKey: [keyof T] extends [never] ? string : keyof T;
|
|
50
|
+
header?: TableHeaderProps;
|
|
51
|
+
stickyTableHeader?: boolean;
|
|
52
|
+
rowSelection?: RowSelectionProps<T>;
|
|
53
|
+
pagination?: PaginationProps;
|
|
54
|
+
wrapperClassName?: string;
|
|
55
|
+
className?: string;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/Table/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ColumnsType, TableProps, UnknownRecord } from './types';
|
|
2
|
+
import { CheckboxProps } from '../Form/Checkbox';
|
|
3
|
+
export declare function getAlingmentClass(align: ColumnsType['align']): "dgs-ui-kit-justify-end" | "dgs-ui-kit-justify-center" | "dgs-ui-kit-justify-start" | undefined;
|
|
4
|
+
export declare function getColumnKey(key: ColumnsType['key'], dataIndex: ColumnsType<UnknownRecord>['dataIndex']): string | undefined;
|
|
5
|
+
export declare function isSelectionAvailable<T extends UnknownRecord>(rowSelection: TableProps<T>['rowSelection']): boolean;
|
|
6
|
+
export declare function renderRowSelectCheckbox(alingment: ColumnsType['align'], checkboxProps?: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function getStickyClass(sticky: ColumnsType['sticky'], addBeforeBorderTop?: boolean): string | undefined;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/components/Table/utils.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,mGAW5D;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,EACvB,SAAS,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,sBAQnD;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAC1D,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,WAM5C;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,EAC/B,aAAa,CAAC,EAAE,aAAa,2CAY9B;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,EAAE,OAAO,sBAezF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";require('./assets/styles.css');const e=require("react/jsx-runtime"),x=require("./clsx-C11secjj.cjs"),q=require("react"),w=require("./FieldBottomInfo-
|
|
1
|
+
"use client";"use strict";require('./assets/styles.css');const e=require("react/jsx-runtime"),x=require("./clsx-C11secjj.cjs"),q=require("react"),w=require("./FieldBottomInfo-CE1uBAqq.cjs");;/* empty css */const m=d=>{const{link:i,labelContent:s,required:a,disabled:r,labelAddon:n}=d;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:x.clsx("dgs-ui-kit-flex",{"dgs-ui-kit-justify-between":s&&i?.href,"dgs-ui-kit-mb-2":!n,"dgs-ui-kit-justify-start":s&&!i?.href,"dgs-ui-kit-justify-end":!s&&i?.href,"dgs-ui-kit-text-gray-400":r}),children:[s&&e.jsxs("label",{className:"dgs-ui-kit-px-0 dgs-ui-kit-font-p2-medium md:dgs-ui-kit-mx-0",children:[s,a&&e.jsx("span",{className:"dgs-ui-kit-ms-2 dgs-ui-kit-text-error-500",children:"*"})]}),i?.href&&e.jsx("a",{href:i.href,className:"dgs-ui-kit-font-button-small dgs-ui-kit-text-primary-400",children:i.cnotent})]}),n]})},C=d=>{const{labelContent:i,link:s,containerClassName:a,rightIcon:r,isError:n,errorMessage:l,hintMessage:g,required:f,labelAddon:p,maxLength:u,disabled:t,value:b,wrapperClassName:o,showMaxLength:j,children:y}=d,c=!!(l||g||u&&j),k=!!(i||s?.href),v=c||k||o?"div":q.Fragment,N=F=>{const h=F.currentTarget.querySelector("textarea, input");h&&h.focus()};return e.jsxs(v,{...o?{className:o}:{},children:[k&&e.jsx(m,{disabled:t,labelContent:i,link:s,required:f,labelAddon:p}),e.jsxs("div",{onClick:N,className:x.clsx(`dgs-ui-kit-relative dgs-ui-kit-cursor-text dgs-ui-kit-border dgs-ui-kit-border-solid dgs-ui-kit-rounded-lg dgs-ui-kit-ring-4 dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-gap-x-3 dgs-ui-kit-p-3 dgs-ui-kit-bg-gray-100 dgs-ui-kit-transition-all dgs-ui-kit-ring-transparent has-[:focus]:dgs-ui-kit-bg-white ${!t&&"hover:dgs-ui-kit-ring-gray-50"}`,n||l?"dgs-ui-kit-border-error-500 has-[:focus]:dgs-ui-kit-ring-error-50":`dgs-ui-kit-border-transparent has-[:focus]:dgs-ui-kit-border-primary-500 has-[:focus]:dgs-ui-kit-ring-primary-50 ${!t&&"hover:dgs-ui-kit-border-gray-300"}`,a,{"dgs-ui-kit-text-gray-400":t}),children:[r&&e.jsx("div",{className:"dgs-ui-kit-text-gray-600",children:r}),y]}),c&&e.jsx(w.FieldBottomInfo,{disabled:t,errorMessage:l,hintMessage:g,extraHelper:u&&e.jsxs("span",{className:"ss02",children:[b?.toString()?.length??0,"/",u]})})]})};exports.FieldLabel=m;exports.TextFieldWrapper=C;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs as t, Fragment as w, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { c as p } from "./clsx-OuTLNxxd.js";
|
|
4
4
|
import C from "react";
|
|
5
|
-
import { F as j } from "./FieldBottomInfo-
|
|
5
|
+
import { F as j } from "./FieldBottomInfo-CJ8_Kr25.js";
|
|
6
6
|
import './assets/styles.css';/* empty css */
|
|
7
7
|
const E = (d) => {
|
|
8
8
|
const { link: i, labelContent: e, required: o, disabled: n, labelAddon: a } = d;
|
package/dist/Tooltip/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";require('../assets/styles.css');const t=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";require('../assets/styles.css');const t=require("react/jsx-runtime"),i=require("../clsx-C11secjj.cjs"),n=require("react"),S=require("../useFlipPosition-CLwjhe7O.cjs");;/* empty css */const T={"bottom-right":"dgs-ui-kit-left-4 dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-t dgs-ui-kit-border-l dgs-ui-kit-rounded-tl","bottom-center":"dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2 dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-t dgs-ui-kit-border-l dgs-ui-kit-rounded-tl","bottom-left":"dgs-ui-kit-right-4 dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-t dgs-ui-kit-border-l dgs-ui-kit-rounded-tl","top-right":"dgs-ui-kit-left-4 dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-b dgs-ui-kit-border-r dgs-ui-kit-rounded-br","top-center":"dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2 dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-b dgs-ui-kit-border-r dgs-ui-kit-rounded-br","top-left":"dgs-ui-kit-right-4 dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-b dgs-ui-kit-border-r dgs-ui-kit-rounded-br"},j={"bottom-right":"dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-0","bottom-center":"dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2","bottom-left":"dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-right-0","top-right":"dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-0","top-center":"dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2","top-left":"dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-right-0"},v=l=>{const{children:c,content:p,className:b,wrapperClassName:x,footer:f,icon:s,position:d="top-center",title:e}=l,[h,u]=n.useState(!1),[o,m]=n.useState(d),{anchorRef:y,popperRef:N}=S.useFlipPosition({initialPosition:d,onPositionChange(k){m(a=>a===k?a:k)}});function r(){u(!0)}function g(){u(!1)}return t.jsxs("div",{ref:y,className:i.clsx("dgs-ui-kit-relative",x),onMouseEnter:r,onTouchStart:r,onMouseLeave:g,onTouchEnd:g,children:[c,t.jsxs("div",{ref:N,className:i.clsx(b,"dgs-ui-kit-absolute dgs-ui-kit-p-4 dgs-ui-kit-flex dgs-ui-kit-gap-2 dgs-ui-kit-max-w-[400px] dgs-ui-kit-bg-gray-700 dgs-ui-kit-text-white dgs-ui-kit-rounded-lg dgs-ui-kit-border dgs-ui-kit-border-gray-300 dgs-ui-kit-shadow-md dgs-ui-kit-transition dgs-ui-kit-duration-300 dgs-ui-kit-w-max",h?"dgs-ui-kit-opacity-100 dgs-ui-kit-scale-100":"dgs-ui-kit-opacity-0 dgs-ui-kit-scale-0",j[o]),children:[s&&t.jsx("span",{className:"dgs-ui-kit-shrink-0 [&_svg]:dgs-ui-kit-size-5 dgs-ui-kit-pt-1",children:s}),t.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-gap-1 dgs-ui-kit-font-p2-regular",children:[e&&t.jsx("div",{className:"dgs-ui-kit-font-h5-bold",children:e}),p,f]}),t.jsx("div",{className:i.clsx("dgs-ui-kit-w-4 dgs-ui-kit-h-4 dgs-ui-kit-bg-gray-700 dgs-ui-kit-border-gray-300 dgs-ui-kit-absolute dgs-ui-kit-rotate-45",T[o])})]})]})};module.exports=v;
|
package/dist/Tooltip/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEnF,OAAO,kBAAkB,CAAC;AA4B1B,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEnF,OAAO,kBAAkB,CAAC;AA4B1B,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAqE7B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/Tooltip/index.mjs
CHANGED
|
@@ -1,70 +1,79 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as t, jsx as i } from "react/jsx-runtime";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as s } from "../clsx-OuTLNxxd.js";
|
|
4
4
|
import { useState as n } from "react";
|
|
5
|
-
import { u as
|
|
5
|
+
import { u as T } from "../useFlipPosition-pGmVUUhs.js";
|
|
6
6
|
import '../assets/styles.css';/* empty css */
|
|
7
|
-
const
|
|
7
|
+
const v = {
|
|
8
8
|
"bottom-right": "dgs-ui-kit-left-4 dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-t dgs-ui-kit-border-l dgs-ui-kit-rounded-tl",
|
|
9
9
|
"bottom-center": "dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2 dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-t dgs-ui-kit-border-l dgs-ui-kit-rounded-tl",
|
|
10
10
|
"bottom-left": "dgs-ui-kit-right-4 dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-t dgs-ui-kit-border-l dgs-ui-kit-rounded-tl",
|
|
11
11
|
"top-right": "dgs-ui-kit-left-4 dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-b dgs-ui-kit-border-r dgs-ui-kit-rounded-br",
|
|
12
12
|
"top-center": "dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2 dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-b dgs-ui-kit-border-r dgs-ui-kit-rounded-br",
|
|
13
13
|
"top-left": "dgs-ui-kit-right-4 dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-1/2 dgs-ui-kit-border-b dgs-ui-kit-border-r dgs-ui-kit-rounded-br"
|
|
14
|
-
},
|
|
14
|
+
}, w = {
|
|
15
15
|
"bottom-right": "dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-0",
|
|
16
16
|
"bottom-center": "dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2",
|
|
17
17
|
"bottom-left": "dgs-ui-kit-bottom-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-right-0",
|
|
18
18
|
"top-right": "dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-0",
|
|
19
19
|
"top-center": "dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-left-1/2 -dgs-ui-kit-translate-x-1/2",
|
|
20
20
|
"top-left": "dgs-ui-kit-top-0 -dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-right-0"
|
|
21
|
-
},
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
}, C = (c) => {
|
|
22
|
+
const {
|
|
23
|
+
children: p,
|
|
24
|
+
content: b,
|
|
25
|
+
className: m,
|
|
26
|
+
wrapperClassName: f,
|
|
27
|
+
footer: h,
|
|
28
|
+
icon: d,
|
|
29
|
+
position: o = "top-center",
|
|
30
|
+
title: e
|
|
31
|
+
} = c, [x, u] = n(!1), [r, y] = n(o), { anchorRef: N, popperRef: S } = T({
|
|
32
|
+
initialPosition: o,
|
|
33
|
+
onPositionChange(a) {
|
|
34
|
+
y((l) => l === a ? l : a);
|
|
26
35
|
}
|
|
27
36
|
});
|
|
28
37
|
function g() {
|
|
29
|
-
|
|
38
|
+
u(!0);
|
|
30
39
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
40
|
+
function k() {
|
|
41
|
+
u(!1);
|
|
33
42
|
}
|
|
34
43
|
return /* @__PURE__ */ t(
|
|
35
44
|
"div",
|
|
36
45
|
{
|
|
37
|
-
ref:
|
|
38
|
-
className: "dgs-ui-kit-relative",
|
|
46
|
+
ref: N,
|
|
47
|
+
className: s("dgs-ui-kit-relative", f),
|
|
39
48
|
onMouseEnter: g,
|
|
40
49
|
onTouchStart: g,
|
|
41
|
-
onMouseLeave:
|
|
42
|
-
onTouchEnd:
|
|
50
|
+
onMouseLeave: k,
|
|
51
|
+
onTouchEnd: k,
|
|
43
52
|
children: [
|
|
44
53
|
p,
|
|
45
54
|
/* @__PURE__ */ t(
|
|
46
55
|
"div",
|
|
47
56
|
{
|
|
48
|
-
ref:
|
|
49
|
-
className:
|
|
50
|
-
|
|
57
|
+
ref: S,
|
|
58
|
+
className: s(
|
|
59
|
+
m,
|
|
51
60
|
"dgs-ui-kit-absolute dgs-ui-kit-p-4 dgs-ui-kit-flex dgs-ui-kit-gap-2 dgs-ui-kit-max-w-[400px] dgs-ui-kit-bg-gray-700 dgs-ui-kit-text-white dgs-ui-kit-rounded-lg dgs-ui-kit-border dgs-ui-kit-border-gray-300 dgs-ui-kit-shadow-md dgs-ui-kit-transition dgs-ui-kit-duration-300 dgs-ui-kit-w-max",
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
x ? "dgs-ui-kit-opacity-100 dgs-ui-kit-scale-100" : "dgs-ui-kit-opacity-0 dgs-ui-kit-scale-0",
|
|
62
|
+
w[r]
|
|
54
63
|
),
|
|
55
64
|
children: [
|
|
56
|
-
|
|
65
|
+
d && /* @__PURE__ */ i("span", { className: "dgs-ui-kit-shrink-0 [&_svg]:dgs-ui-kit-size-5 dgs-ui-kit-pt-1", children: d }),
|
|
57
66
|
/* @__PURE__ */ t("div", { className: "dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-gap-1 dgs-ui-kit-font-p2-regular", children: [
|
|
58
|
-
|
|
67
|
+
e && /* @__PURE__ */ i("div", { className: "dgs-ui-kit-font-h5-bold", children: e }),
|
|
59
68
|
b,
|
|
60
|
-
|
|
69
|
+
h
|
|
61
70
|
] }),
|
|
62
71
|
/* @__PURE__ */ i(
|
|
63
72
|
"div",
|
|
64
73
|
{
|
|
65
|
-
className:
|
|
74
|
+
className: s(
|
|
66
75
|
"dgs-ui-kit-w-4 dgs-ui-kit-h-4 dgs-ui-kit-bg-gray-700 dgs-ui-kit-border-gray-300 dgs-ui-kit-absolute dgs-ui-kit-rotate-45",
|
|
67
|
-
|
|
76
|
+
v[r]
|
|
68
77
|
)
|
|
69
78
|
}
|
|
70
79
|
)
|
|
@@ -76,5 +85,5 @@ const T = {
|
|
|
76
85
|
);
|
|
77
86
|
};
|
|
78
87
|
export {
|
|
79
|
-
|
|
88
|
+
C as default
|
|
80
89
|
};
|