@lanaco/lnc-react-ui 4.0.161 → 4.0.163

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.
@@ -1,384 +0,0 @@
1
- import { jsx as n, jsxs as p, Fragment as C } from "react/jsx-runtime";
2
- import U, { useState as g, useMemo as q, useEffect as M, forwardRef as D, useRef as L, useImperativeHandle as X } from "react";
3
- import { P as r } from "./index-CblbdqjE.js";
4
- import Z from "./FlexBox.js";
5
- import K from "./IconButton.js";
6
- import { useTheme as J } from "./ThemeProvider.js";
7
- import { s as G } from "./emotion-styled.browser.esm-BNN1dTl3.js";
8
- import { M as O } from "./consts-BuFChS64.js";
9
- import { u as Q } from "./useDetectMobile-Bkvj0VMa.js";
10
- import { u as Y } from "./useUpdateEffect-CuYWz7EA.js";
11
- import W from "./Button.js";
12
- import ee from "./Icon.js";
13
- import { l as re } from "./utils-BdsZgOUE.js";
14
- const te = G.div`
15
- position: relative;
16
- padding: ${(e) => e.padding};
17
-
18
- & button {
19
- white-space: nowrap;
20
- }
21
-
22
- & .badge-button {
23
- ${(e) => e.showTimesBtn === !0 && "padding-left: 0.5rem; padding-right: 0.5rem;"}
24
- }
25
-
26
- & .gradient {
27
- position: absolute;
28
- top: 50%;
29
- transform: translate(0, -50%);
30
- z-index: 4;
31
- transition: ${"0.3s"};
32
- right: ${(e) => e.noArrows !== !0 ? "6rem" : "0"};
33
- width: 2rem;
34
- background: #fff;
35
- height: 100%;
36
- -webkit-mask-image: linear-gradient(to left, black 10%, transparent 50%);
37
- mask-image: linear-gradient(to left, black 10%, transparent 50%);
38
- }
39
-
40
- & .scrollable-container {
41
- max-width: -webkit-fill-available;
42
- max-width: -moz-available; /* WebKit-based browsers will ignore this. */
43
- max-width: fill-available;
44
-
45
- ${(e) => e.rightAlignArrows === !0 && e.noArrows !== !0 && "margin-right: 6rem"};
46
- scroll-behavior: smooth;
47
- overflow: hidden;
48
- -webkit-overflow-scrolling: touch;
49
- ::-webkit-scrollbar {
50
- -webkit-appearance: none;
51
- }
52
- -ms-overflow-style: none;
53
- /* Internet Explorer 10+ */
54
- scrollbar-width: none;
55
- /* Firefox */
56
-
57
- &::-webkit-scrollbar {
58
- display: none;
59
- /* Safari and Chrome */
60
- }
61
-
62
- @media (max-width: ${O + "px"}) {
63
- margin-right: 0;
64
- }
65
- }
66
- & .scroll-arrow-right,
67
- & .scroll-arrow-left {
68
- position: absolute;
69
- top: 50%;
70
- transform: translate(0, -50%);
71
- display: flex;
72
- justify-content: center;
73
- align-items: center;
74
- cursor: pointer;
75
-
76
- visibility: ${(e) => e.arrowsVisibleOnHover === !1 && e.hasOverflow ? "visible" : "hidden"};
77
- z-index: 4;
78
- transition: ${"0.3s"};
79
- }
80
- & .scroll-arrow-right {
81
- ${(e) => e.rightAlignArrows === !0 ? "right: 0" : "right: 0.7rem"};
82
- }
83
- & .scroll-arrow-left {
84
- ${(e) => e.rightAlignArrows === !0 ? "right: 2.625rem" : "left: 0.7rem"};
85
- }
86
- & .scrollable-container:hover > .scroll-arrow-left,
87
- & .scrollable-container:hover > .scroll-arrow-right {
88
- visibility: ${(e) => e.hasOverflow ? "visible" : "hidden"};
89
- }
90
-
91
- @media (max-width: ${O + "px"}) {
92
- & .scrollable-container {
93
- overflow: auto;
94
- }
95
- & .scroll-arrow-left,
96
- & .scroll-arrow-right {
97
- display: none;
98
- }
99
-
100
- & .gradient {
101
- right: 0;
102
- }
103
-
104
- & .scrollable-container button:nth-of-type(3) {
105
- ${(e) => e.noMargin !== !0 && "margin-left: 1rem"};
106
- }
107
- }
108
- `, le = (e) => {
109
- const [u, a] = g(!1), l = q(
110
- () => new IntersectionObserver(
111
- ([o]) => a(o.isIntersecting)
112
- ),
113
- []
114
- );
115
- return M(() => (l.observe(e.current), () => {
116
- l.disconnect();
117
- }), [e, l]), u;
118
- }, oe = G.div`
119
- min-height: 1px;
120
- ${(e) => e.isHorizontal === !0 ? "min-width: 1px; width: 1px;" : "width: 100%;"}
121
- `, T = D((e, u) => {
122
- const {
123
- onIsVisible: a = () => {
124
- },
125
- onIsNotVisible: l,
126
- isHorizontal: o = !1,
127
- className: f = ""
128
- } = e, d = L(null), b = le(d);
129
- return Y(() => {
130
- b ? a() : l == null || l();
131
- }, [b]), /* @__PURE__ */ n(
132
- oe,
133
- {
134
- ref: d,
135
- className: `scroller-element ${f}`,
136
- isHorizontal: o
137
- }
138
- );
139
- });
140
- T.propTypes = {
141
- onIsVisible: r.func,
142
- /**
143
- * For horizontal scroll InfiniteScrollEndElement has to have some widh otherwise it won't ever be visible and trigger onIsVisible callback
144
- */
145
- isHorizontal: r.bool
146
- };
147
- const _ = U.forwardRef(
148
- ({
149
- columnGap: e = "2rem",
150
- rowGap: u = "1.25rem",
151
- scrollBySize: a = 300,
152
- wrapForMobile: l = !1,
153
- wrap: o = !1,
154
- children: f,
155
- methodsRef: d,
156
- arrowsVisibleOnHover: b = !0,
157
- rightAlignArrows: I = !1,
158
- padding: w = "0",
159
- showTimesBtn: v,
160
- noArrows: m,
161
- noGradient: S = !1,
162
- hideDisabledArrows: h = !1,
163
- noMargin: y = !1,
164
- ...k
165
- }, N) => {
166
- const $ = Q(), { theme: t } = J(), [i, A] = g(!1), [x, R] = g(!1), [F, B] = g(!0), s = L(), H = () => {
167
- var c;
168
- (c = s.current) == null || c.scrollBy(a, 0);
169
- }, V = () => {
170
- var c;
171
- (c = s.current) == null || c.scrollBy(-a, 0);
172
- }, [z, j] = g(!1);
173
- M(() => {
174
- var c, E;
175
- j(
176
- ((c = s == null ? void 0 : s.current) == null ? void 0 : c.scrollWidth) > ((E = s == null ? void 0 : s.current) == null ? void 0 : E.clientWidth)
177
- );
178
- }, [f]), X(d, () => ({
179
- scrollToEnd() {
180
- P();
181
- },
182
- scrollLeft() {
183
- V();
184
- },
185
- scrollRight() {
186
- H();
187
- }
188
- }));
189
- const P = () => {
190
- s.current.scrollLeft = s.current.scrollWidth;
191
- };
192
- return /* @__PURE__ */ n(
193
- te,
194
- {
195
- ref: N,
196
- arrowsVisibleOnHover: b,
197
- hasOverflow: z,
198
- noArrows: m,
199
- padding: w,
200
- rightAlignArrows: I,
201
- showTimesBtn: v,
202
- theme: t,
203
- noMargin: y,
204
- ...k,
205
- children: /* @__PURE__ */ p(
206
- Z,
207
- {
208
- ref: s,
209
- className: "scrollable-container",
210
- columnGap: e,
211
- rowGap: u,
212
- wrap: o || l && $ ? "Wrap" : "NoWrap",
213
- children: [
214
- m !== !0 && /* @__PURE__ */ p(C, { children: [
215
- !(h === !0 && x === !0) && /* @__PURE__ */ n(
216
- K,
217
- {
218
- borderRadius: "curved",
219
- btnType: "tinted",
220
- className: "scroll-arrow-left",
221
- color: "neutral",
222
- disabled: x,
223
- icon: "angle-left",
224
- onClick: V
225
- }
226
- ),
227
- !(h === !0 && i === !0) && /* @__PURE__ */ n(
228
- K,
229
- {
230
- borderRadius: "curved",
231
- btnType: "tinted",
232
- className: "scroll-arrow-right",
233
- color: "neutral",
234
- disabled: i,
235
- icon: "angle-right",
236
- onClick: H
237
- }
238
- )
239
- ] }),
240
- /* @__PURE__ */ n(
241
- T,
242
- {
243
- isHorizontal: !0,
244
- onIsNotVisible: () => {
245
- x === !0 && R(!1);
246
- },
247
- onIsVisible: () => {
248
- x === !1 && R(!0);
249
- }
250
- }
251
- ),
252
- f,
253
- /* @__PURE__ */ n(
254
- T,
255
- {
256
- className: "right-scroller",
257
- isHorizontal: !0,
258
- onIsNotVisible: () => {
259
- i === !0 && A(!1), B(!0);
260
- },
261
- onIsVisible: () => {
262
- i === !1 && A(!0), B(!1);
263
- }
264
- }
265
- ),
266
- F && z && S !== !0 && /* @__PURE__ */ n("div", { className: "gradient" })
267
- ]
268
- }
269
- )
270
- }
271
- );
272
- }
273
- );
274
- _.propTypes = {
275
- title: r.string,
276
- rowGap: r.string,
277
- columnGap: r.string,
278
- scrollBySize: r.number,
279
- wrapForMobile: r.bool,
280
- wrap: r.bool,
281
- methodsRef: r.any,
282
- arrowsVisibleOnHover: r.bool,
283
- rightAlignArrows: r.bool,
284
- padding: r.string
285
- };
286
- const se = D((e, u) => {
287
- const {
288
- allButton: a = !0,
289
- items: l = [],
290
- selectedIds: o = [],
291
- onSelect: f = () => {
292
- },
293
- onRemove: d = () => {
294
- },
295
- onSelectAll: b = () => {
296
- },
297
- className: I,
298
- showTimesBtn: w = !1,
299
- labelKey: v = "label",
300
- valueKey: m = "value",
301
- codeKey: S = "code",
302
- uniqueKey: h,
303
- typeKey: y,
304
- productsToolbarName: k = "All",
305
- ...N
306
- } = e, $ = (t, i) => {
307
- o != null && o.includes(i) ? d(t, i) : f(t, i);
308
- };
309
- return /* @__PURE__ */ p(
310
- _,
311
- {
312
- ref: u,
313
- arrowsVisibleOnHover: !1,
314
- className: I,
315
- columnGap: "0.75rem",
316
- padding: "0.25rem 0",
317
- rightAlignArrows: !0,
318
- showTimesBtn: w,
319
- ...N,
320
- children: [
321
- a && /* @__PURE__ */ n(
322
- W,
323
- {
324
- borderRadius: "curved",
325
- btnType: o.length === 0 ? "filled" : "tinted",
326
- className: "badge-button",
327
- color: "neutral",
328
- onClick: b,
329
- children: k
330
- }
331
- ),
332
- l.map((t, i) => /* @__PURE__ */ p(
333
- W,
334
- {
335
- borderRadius: "curved",
336
- btnType: o.includes(t.uuid) ? "filled" : "tinted",
337
- className: "badge-button",
338
- color: "neutral",
339
- onClick: () => $(t, t[m]),
340
- children: [
341
- re(t == null ? void 0 : t.icon) && /* @__PURE__ */ p(C, { children: [
342
- /* @__PURE__ */ n("i", { className: t == null ? void 0 : t.icon }),
343
- " "
344
- ] }),
345
- t[v],
346
- w === !0 && /* @__PURE__ */ n(
347
- ee,
348
- {
349
- className: "times-btn",
350
- icon: "times",
351
- sizeInUnits: "0.75rem",
352
- onClick: () => d(
353
- t[m],
354
- t[v],
355
- t[S],
356
- h ? t[h] : null,
357
- y ? t[y] : null
358
- )
359
- }
360
- )
361
- ]
362
- },
363
- i
364
- ))
365
- ]
366
- }
367
- );
368
- });
369
- se.propTypes = {
370
- allButton: r.bool,
371
- items: r.array,
372
- selectedIds: r.array,
373
- onSelect: r.func,
374
- onRemove: r.func,
375
- onSelectAll: r.func,
376
- className: r.string,
377
- showTimesBtn: r.bool,
378
- valuKey: r.string,
379
- labelKey: r.string,
380
- codeKey: r.string
381
- };
382
- export {
383
- se as S
384
- };