jcicl 0.0.345 → 1.0.3

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/Nav/Nav.js CHANGED
@@ -1,41 +1,281 @@
1
- import { jsx as c, jsxs as u } from "react/jsx-runtime";
2
- import { useState as j } from "react";
3
- import { n as v, i as z } from "../.chunks/emotion-styled.browser.esm.js";
4
- import P from "../theme.js";
5
- import B from "../ScrollContainer/ScrollContainer.js";
6
- import { B as D } from "../.chunks/ButtonBase.js";
7
- const C = v(D, {
8
- shouldForwardProp: (t) => z(t)
9
- })(({ active: t, isTablet: n, highlight1: r, highlight3: i, iconColor: e, isMobile: s, shadowSecondary: d }) => ({
1
+ import { jsx as d, jsxs as z } from "react/jsx-runtime";
2
+ import H, { useRef as j, useEffect as K, useCallback as D, useState as V } from "react";
3
+ import { _ as h, n as M, i as q } from "../.chunks/emotion-styled.browser.esm.js";
4
+ import ee from "../theme.js";
5
+ import re from "../ScrollContainer/ScrollContainer.js";
6
+ import { _ } from "../.chunks/TransitionGroupContext.js";
7
+ import { B as oe } from "../.chunks/ButtonBase.js";
8
+ var B = 100, te = (r) => {
9
+ var {
10
+ h: o,
11
+ s: e,
12
+ l: t,
13
+ a
14
+ } = ae(r);
15
+ return "hsla(" + o + ", " + e + "%, " + t + "%, " + a + ")";
16
+ }, ae = (r) => {
17
+ var {
18
+ h: o,
19
+ s: e,
20
+ v: t,
21
+ a
22
+ } = r, l = (200 - e) * t / B;
23
+ return {
24
+ h: o,
25
+ s: l > 0 && l < 200 ? e * t / B / (l <= B ? l : 200 - l) * B : 0,
26
+ l: l / 2,
27
+ a
28
+ };
29
+ };
30
+ function I(r) {
31
+ var o = j(r);
32
+ return K(() => {
33
+ o.current = r;
34
+ }), D((e, t) => o.current && o.current(e, t), []);
35
+ }
36
+ var P = (r) => "touches" in r, L = (r) => {
37
+ !P(r) && r.preventDefault && r.preventDefault();
38
+ }, W = function(o, e, t) {
39
+ return e === void 0 && (e = 0), t === void 0 && (t = 1), o > t ? t : o < e ? e : o;
40
+ }, Y = (r, o) => {
41
+ var e = r.getBoundingClientRect(), t = P(o) ? o.touches[0] : o;
42
+ return {
43
+ left: W((t.pageX - (e.left + window.pageXOffset)) / e.width),
44
+ top: W((t.pageY - (e.top + window.pageYOffset)) / e.height),
45
+ width: e.width,
46
+ height: e.height,
47
+ x: t.pageX - (e.left + window.pageXOffset),
48
+ y: t.pageY - (e.top + window.pageYOffset)
49
+ };
50
+ }, ne = ["prefixCls", "className", "onMove", "onDown"], Q = /* @__PURE__ */ H.forwardRef((r, o) => {
51
+ var {
52
+ prefixCls: e = "w-color-interactive",
53
+ className: t,
54
+ onMove: a,
55
+ onDown: l
56
+ } = r, c = _(r, ne), u = j(null), f = j(!1), [v, b] = V(!1), C = I(a), s = I(l), N = (i) => f.current && !P(i) ? !1 : (f.current = P(i), !0), g = D((i) => {
57
+ if (L(i), !!u.current) {
58
+ var m = P(i) ? i.touches.length > 0 : i.buttons > 0;
59
+ if (!m) {
60
+ b(!1);
61
+ return;
62
+ }
63
+ C == null || C(Y(u.current, i), i);
64
+ }
65
+ }, [C]), p = D(() => b(!1), []), n = D((i) => {
66
+ i ? (window.addEventListener(f.current ? "touchmove" : "mousemove", g), window.addEventListener(f.current ? "touchend" : "mouseup", p)) : (window.removeEventListener("mousemove", g), window.removeEventListener("mouseup", p), window.removeEventListener("touchmove", g), window.removeEventListener("touchend", p));
67
+ }, [g, p]);
68
+ K(() => (n(v), () => {
69
+ n(!1);
70
+ }), [v, g, p, n]);
71
+ var y = D((i) => {
72
+ var m = document.activeElement;
73
+ m == null || m.blur(), L(i.nativeEvent), N(i.nativeEvent) && u.current && (s == null || s(Y(u.current, i.nativeEvent), i.nativeEvent), b(!0));
74
+ }, [s]);
75
+ return /* @__PURE__ */ d("div", h({}, c, {
76
+ className: [e, t || ""].filter(Boolean).join(" "),
77
+ style: h({}, c.style, {
78
+ touchAction: "none"
79
+ }),
80
+ ref: u,
81
+ tabIndex: 0,
82
+ onMouseDown: y,
83
+ onTouchStart: y
84
+ }));
85
+ });
86
+ Q.displayName = "Interactive";
87
+ var ie = ["className", "prefixCls", "left", "top", "style", "fillProps"], le = (r) => {
88
+ var {
89
+ className: o,
90
+ prefixCls: e,
91
+ left: t,
92
+ top: a,
93
+ style: l,
94
+ fillProps: c
95
+ } = r, u = _(r, ie), f = h({}, l, {
96
+ position: "absolute",
97
+ left: t,
98
+ top: a
99
+ }), v = h({
100
+ width: 18,
101
+ height: 18,
102
+ boxShadow: "var(--alpha-pointer-box-shadow)",
103
+ borderRadius: "50%",
104
+ backgroundColor: "var(--alpha-pointer-background-color)"
105
+ }, c == null ? void 0 : c.style, {
106
+ transform: t ? "translate(-9px, -1px)" : "translate(-1px, -9px)"
107
+ });
108
+ return /* @__PURE__ */ d("div", h({
109
+ className: e + "-pointer " + (o || ""),
110
+ style: f
111
+ }, u, {
112
+ children: /* @__PURE__ */ d("div", h({
113
+ className: e + "-fill"
114
+ }, c, {
115
+ style: v
116
+ }))
117
+ }));
118
+ }, se = ["prefixCls", "className", "hsva", "background", "bgProps", "innerProps", "pointerProps", "radius", "width", "height", "direction", "style", "onChange", "pointer"], de = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==", $ = /* @__PURE__ */ H.forwardRef((r, o) => {
119
+ var {
120
+ prefixCls: e = "w-color-alpha",
121
+ className: t,
122
+ hsva: a,
123
+ background: l,
124
+ bgProps: c = {},
125
+ innerProps: u = {},
126
+ pointerProps: f = {},
127
+ radius: v = 0,
128
+ width: b,
129
+ height: C = 16,
130
+ direction: s = "horizontal",
131
+ style: N,
132
+ onChange: g,
133
+ pointer: p
134
+ } = r, n = _(r, se), y = (x) => {
135
+ g && g(h({}, a, {
136
+ a: s === "horizontal" ? x.left : x.top
137
+ }), x);
138
+ }, i = te(Object.assign({}, a, {
139
+ a: 1
140
+ })), m = "linear-gradient(to " + (s === "horizontal" ? "right" : "bottom") + ", rgba(244, 67, 54, 0) 0%, " + i + " 100%)", w = {};
141
+ s === "horizontal" ? w.left = a.a * 100 + "%" : w.top = a.a * 100 + "%";
142
+ var k = h({
143
+ "--alpha-background-color": "#fff",
144
+ "--alpha-pointer-background-color": "rgb(248, 248, 248)",
145
+ "--alpha-pointer-box-shadow": "rgb(0 0 0 / 37%) 0px 1px 4px 0px",
146
+ borderRadius: v,
147
+ background: "url(" + de + ") left center",
148
+ backgroundColor: "var(--alpha-background-color)"
149
+ }, {
150
+ width: b,
151
+ height: C
152
+ }, N, {
153
+ position: "relative"
154
+ }), E = D((x) => {
155
+ var R = 0.01, S = a.a, A = S;
156
+ switch (x.key) {
157
+ case "ArrowLeft":
158
+ s === "horizontal" && (A = Math.max(0, S - R), x.preventDefault());
159
+ break;
160
+ case "ArrowRight":
161
+ s === "horizontal" && (A = Math.min(1, S + R), x.preventDefault());
162
+ break;
163
+ case "ArrowUp":
164
+ s === "vertical" && (A = Math.max(0, S - R), x.preventDefault());
165
+ break;
166
+ case "ArrowDown":
167
+ s === "vertical" && (A = Math.min(1, S + R), x.preventDefault());
168
+ break;
169
+ default:
170
+ return;
171
+ }
172
+ if (A !== S) {
173
+ var Z = {
174
+ left: s === "horizontal" ? A : a.a,
175
+ top: s === "vertical" ? A : a.a,
176
+ width: 0,
177
+ height: 0,
178
+ x: 0,
179
+ y: 0
180
+ };
181
+ g && g(h({}, a, {
182
+ a: A
183
+ }), Z);
184
+ }
185
+ }, [a, s, g]), J = D((x) => {
186
+ x.target.focus();
187
+ }, []), T = p && typeof p == "function" ? p(h({
188
+ prefixCls: e
189
+ }, f, w)) : /* @__PURE__ */ d(le, h({}, f, {
190
+ prefixCls: e
191
+ }, w));
192
+ return /* @__PURE__ */ z("div", h({}, n, {
193
+ className: [e, e + "-" + s, t || ""].filter(Boolean).join(" "),
194
+ style: k,
195
+ ref: o,
196
+ children: [/* @__PURE__ */ d("div", h({}, c, {
197
+ style: h({
198
+ inset: 0,
199
+ position: "absolute",
200
+ background: l || m,
201
+ borderRadius: v
202
+ }, c.style)
203
+ })), /* @__PURE__ */ d(Q, h({}, u, {
204
+ style: h({}, u.style, {
205
+ inset: 0,
206
+ zIndex: 1,
207
+ position: "absolute",
208
+ outline: "none"
209
+ }),
210
+ onMove: y,
211
+ onDown: y,
212
+ onClick: J,
213
+ onKeyDown: E,
214
+ children: T
215
+ }))]
216
+ }));
217
+ });
218
+ $.displayName = "Alpha";
219
+ var ce = ["prefixCls", "className", "hue", "onChange", "direction"], F = /* @__PURE__ */ H.forwardRef((r, o) => {
220
+ var {
221
+ prefixCls: e = "w-color-hue",
222
+ className: t,
223
+ hue: a = 0,
224
+ onChange: l,
225
+ direction: c = "horizontal"
226
+ } = r, u = _(r, ce);
227
+ return /* @__PURE__ */ d($, h({
228
+ ref: o,
229
+ className: e + " " + (t || "")
230
+ }, u, {
231
+ direction: c,
232
+ background: "linear-gradient(to " + (c === "horizontal" ? "right" : "bottom") + ", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)",
233
+ hsva: {
234
+ h: a,
235
+ s: 100,
236
+ v: 100,
237
+ a: a / 360
238
+ },
239
+ onChange: (f, v) => {
240
+ l && l({
241
+ h: c === "horizontal" ? 360 * v.left : 360 * v.top
242
+ });
243
+ }
244
+ }));
245
+ });
246
+ F.displayName = "Hue";
247
+ const G = M(oe, {
248
+ shouldForwardProp: (r) => q(r)
249
+ })(({ active: r, isTablet: o, highlight1: e, highlight3: t, iconColor: a, isMobile: l, shadowSecondary: c }) => ({
10
250
  display: "flex",
11
- flexDirection: n ? "row" : "column",
251
+ flexDirection: o ? "row" : "column",
12
252
  alignItems: "center",
13
- justifyContent: n ? "flex-start" : "center",
253
+ justifyContent: o ? "flex-start" : "center",
14
254
  width: "100%",
15
- padding: n ? "16px" : "0 8px 8px 8px",
255
+ padding: o ? "16px" : "0 8px 8px 8px",
16
256
  transition: "313ms all ease-in-out",
17
- backgroundColor: t && !s ? r : "transparent",
18
- boxShadow: t ? e : "none",
19
- ...n && {
257
+ backgroundColor: r && !l ? e : "transparent",
258
+ boxShadow: r ? a : "none",
259
+ ...o && {
20
260
  gap: "0.5rem"
21
261
  },
22
- ...s && {
262
+ ...l && {
23
263
  padding: 0
24
264
  },
25
265
  "&:hover, :focus-visible": {
26
266
  svg: {
27
- ...!n && {
28
- backgroundColor: r
267
+ ...!o && {
268
+ backgroundColor: e
29
269
  }
30
270
  },
31
- ...n && {
32
- boxShadow: d,
33
- backgroundColor: i
271
+ ...o && {
272
+ boxShadow: c,
273
+ backgroundColor: t
34
274
  }
35
275
  },
36
276
  svg: {
37
277
  fontSize: "2.1rem",
38
- fill: e,
278
+ fill: a,
39
279
  backgroundColor: "transparent",
40
280
  borderRadius: "50%",
41
281
  padding: "8px",
@@ -43,97 +283,158 @@ const C = v(D, {
43
283
  alignItems: "center",
44
284
  justifyContent: "center",
45
285
  transition: "313ms all ease-in-out",
46
- ...s && t && {
47
- backgroundColor: r
286
+ ...l && r && {
287
+ backgroundColor: e
48
288
  }
49
289
  },
50
290
  span: {
51
291
  fontFamily: "Roboto, sans-serif",
52
292
  fontSize: "12px",
53
293
  fontWeight: "bold",
54
- color: e,
294
+ color: a,
55
295
  textAlign: "center",
56
- ...n && {
296
+ ...o && {
57
297
  fontSize: "1.5rem",
58
298
  fontWeight: "500"
59
299
  }
60
300
  }
61
- })), y = v("div")(({ navWidth: t, isTablet: n, isMobile: r, shadowSecondary: i }) => ({
301
+ })), O = M(F)`
302
+ div:first-of-type {
303
+ border-radius: inherit !important;
304
+ }
305
+ .w-color-alpha-pointer > .w-color-alpha-fill {
306
+ border-radius: 50% !important;
307
+ }
308
+ `, U = M("div")(({ isTablet: r }) => ({
309
+ display: "block",
310
+ padding: "16px",
311
+ span: {
312
+ paddingBottom: "15px",
313
+ fontFamily: "Roboto, sans-serif",
314
+ fontSize: "12px",
315
+ fontWeight: "bold",
316
+ cursor: "default",
317
+ ...r && {
318
+ fontSize: "1.5rem",
319
+ fontWeight: "500"
320
+ }
321
+ }
322
+ })), X = M("div")(({ navWidth: r, isTablet: o, isMobile: e, shadowSecondary: t }) => ({
62
323
  display: "flex",
63
- flexDirection: r ? "row" : "column",
324
+ flexDirection: e ? "row" : "column",
64
325
  backgroundColor: "transparent",
65
- alignItems: "center",
66
- justifyContent: r ? "space-between" : "flex-start",
326
+ alignItems: "stretch",
327
+ justifyContent: e ? "space-between" : "flex-start",
67
328
  maxHeight: "100%",
68
329
  flexShrink: 0,
69
- gap: n ? 0 : "1rem",
70
- width: t,
330
+ gap: o ? 0 : "1rem",
331
+ width: r,
71
332
  boxSizing: "border-box",
72
- ...r && {
73
- boxShadow: i,
333
+ ...e && {
334
+ boxShadow: t,
74
335
  zIndex: 1313,
75
336
  padding: "4px 8px"
76
337
  }
77
- })), $ = ({
78
- navItems: t,
79
- activeRoute: n,
80
- navWidth: r = `${P.constants.navDefaultWidth}px`,
81
- isTablet: i,
82
- isMobile: e,
83
- themeColors: s
338
+ })), xe = ({
339
+ navItems: r,
340
+ activeRoute: o,
341
+ navWidth: e = `${ee.constants.navDefaultWidth}px`,
342
+ isTablet: t,
343
+ isMobile: a,
344
+ themeColors: l
84
345
  }) => {
85
- const [d, w] = j(""), f = (a, o) => {
86
- w(a), o();
87
- }, { highlightPrimary: g, highlightTertiary: m, iconPrimary: x, shadowSecondary: p, scrollColor: S } = s, k = { navWidth: r, isTablet: i, shadowSecondary: p };
88
- return e ? /* @__PURE__ */ c(y, { isTablet: !1, navWidth: "100%", isMobile: !0, shadowSecondary: p, children: t.map(({ icon: a, label: o = "", onClick: l = () => {
89
- }, ...h }) => /* @__PURE__ */ u(
90
- C,
91
- {
92
- ...h,
93
- active: n ? n === o : d === o,
94
- onClick: () => f(o, l),
95
- isTablet: i,
96
- highlight1: g,
97
- highlight3: m,
98
- iconColor: x,
99
- shadowSecondary: p,
100
- isMobile: !0,
101
- children: [
102
- a,
103
- /* @__PURE__ */ c("span", { children: o })
104
- ]
105
- },
106
- o
107
- )) }) : /* @__PURE__ */ c(
108
- B,
346
+ const [c, u] = V(""), f = (p, n) => {
347
+ u(p), n();
348
+ }, { highlightPrimary: v, highlightTertiary: b, iconPrimary: C, shadowSecondary: s, scrollColor: N } = l, g = { navWidth: e, isTablet: t, shadowSecondary: s };
349
+ return a ? /* @__PURE__ */ d(X, { isTablet: !1, navWidth: "100%", isMobile: !0, shadowSecondary: s, children: r.map(({ icon: p, label: n = "", onClick: y = () => {
350
+ }, hue: i = void 0, onChange: m, ...w }) => {
351
+ const k = o ? o === n : c === n;
352
+ return n == "Hue" ? /* @__PURE__ */ z(U, { ...w, active: k, isTablet: t, children: [
353
+ /* @__PURE__ */ d("div", { style: { display: "flex" }, children: /* @__PURE__ */ d("span", { children: "Select Theme Color" }) }),
354
+ /* @__PURE__ */ d("div", { style: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ d(
355
+ O,
356
+ {
357
+ hue: i,
358
+ onChange: (E) => {
359
+ m && m(E);
360
+ },
361
+ style: {
362
+ width: "96%",
363
+ cursor: "pointer",
364
+ borderRadius: "20px",
365
+ boxShadow: "0px 1px 4px 0px rgba(0, 0, 0, 0.25)"
366
+ }
367
+ }
368
+ ) })
369
+ ] }, n) : /* @__PURE__ */ z(
370
+ G,
371
+ {
372
+ ...w,
373
+ active: k,
374
+ onClick: () => f(n, y),
375
+ isTablet: t,
376
+ highlight1: v,
377
+ highlight3: b,
378
+ iconColor: C,
379
+ shadowSecondary: s,
380
+ isMobile: !0,
381
+ children: [
382
+ p,
383
+ /* @__PURE__ */ d("span", { children: n })
384
+ ]
385
+ },
386
+ n
387
+ );
388
+ }) }) : /* @__PURE__ */ d(
389
+ re,
109
390
  {
110
- scrollColor: S,
391
+ scrollColor: N,
111
392
  direction: "vertical",
112
- width: r,
113
- styles: { minWidth: r },
114
- children: /* @__PURE__ */ c(y, { ...k, children: t.map(({ icon: a, label: o = "", onClick: l = () => {
115
- }, ...h }) => /* @__PURE__ */ u(
116
- C,
117
- {
118
- ...h,
119
- active: n ? n === o : d === o,
120
- onClick: () => f(o, l),
121
- isTablet: i,
122
- highlight1: g,
123
- highlight3: m,
124
- iconColor: x,
125
- shadowSecondary: p,
126
- children: [
127
- a,
128
- /* @__PURE__ */ c("span", { children: o })
129
- ]
130
- },
131
- o
132
- )) })
393
+ width: e,
394
+ styles: { minWidth: e },
395
+ children: /* @__PURE__ */ d(X, { ...g, children: r.map(({ icon: p, label: n = "", onClick: y = () => {
396
+ }, hue: i = void 0, onChange: m, ...w }) => {
397
+ const k = o ? o === n : c === n;
398
+ return n == "Hue" ? /* @__PURE__ */ z(U, { ...w, active: k, isTablet: t, children: [
399
+ /* @__PURE__ */ d("div", { style: { display: "flex" }, children: /* @__PURE__ */ d("span", { children: "Custom Theme" }) }),
400
+ /* @__PURE__ */ d("div", { style: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ d(
401
+ O,
402
+ {
403
+ hue: i,
404
+ onChange: (E) => {
405
+ m && m(E);
406
+ },
407
+ style: {
408
+ width: "96%",
409
+ cursor: "pointer",
410
+ borderRadius: "20px",
411
+ boxShadow: "0px 1px 4px 0px rgba(0, 0, 0, 0.25)"
412
+ }
413
+ }
414
+ ) })
415
+ ] }, n) : /* @__PURE__ */ z(
416
+ G,
417
+ {
418
+ ...w,
419
+ active: k,
420
+ onClick: () => f(n, y),
421
+ isTablet: t,
422
+ highlight1: v,
423
+ highlight3: b,
424
+ iconColor: C,
425
+ shadowSecondary: s,
426
+ children: [
427
+ p,
428
+ /* @__PURE__ */ d("span", { children: n })
429
+ ]
430
+ },
431
+ n
432
+ );
433
+ }) })
133
434
  }
134
435
  );
135
436
  };
136
437
  export {
137
- $ as Nav,
138
- $ as default
438
+ xe as Nav,
439
+ xe as default
139
440
  };