@lanaco/lnc-react-ui 4.0.161 → 4.0.162

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