@xola/ui-kit 2.1.0 → 2.1.1

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/build/ui-kit.mjs CHANGED
@@ -1264,10 +1264,10 @@ const Si = Mi((e, t) => e(t), 500), Bo = ({
1264
1264
  shouldHideMenu: m = !1,
1265
1265
  ...g
1266
1266
  }) => {
1267
- const [w, x] = ne(!0), [v, h] = ne(o != null ? o : ""), f = de(), b = dn("search-input"), k = dn("search-menu"), y = Bi(), [C, E] = ne(!0), A = { value: v }, L = v ? [A, ...t] : [], M = ({ selectedItem: j, type: _ }) => {
1268
- _ !== Kt.stateChangeTypes.InputBlur && _ !== Kt.stateChangeTypes.FunctionCloseMenu && (j === A ? (r == null || r(v), f.current.blur()) : j && (i == null || i(j), f.current.blur()), G());
1269
- }, V = ({ inputValue: j }) => {
1270
- h(j), a && Si(a, j);
1267
+ const [w, x] = ne(!0), [v, h] = ne(o != null ? o : ""), f = de(), b = dn("search-input"), k = dn("search-menu"), y = Bi(), [C, E] = ne(!0), A = { value: v }, L = v ? [A, ...t] : [], M = ({ selectedItem: O, type: _ }) => {
1268
+ _ !== Kt.stateChangeTypes.InputBlur && _ !== Kt.stateChangeTypes.FunctionCloseMenu && (O === A ? (r == null || r(v), f.current.blur()) : O && (i == null || i(O), f.current.blur()), G());
1269
+ }, V = ({ inputValue: O }) => {
1270
+ h(O), a && Si(a, O);
1271
1271
  }, {
1272
1272
  isOpen: P,
1273
1273
  openMenu: q,
@@ -1288,13 +1288,13 @@ const Si = Mi((e, t) => e(t), 500), Bo = ({
1288
1288
  _e(() => {
1289
1289
  P ? E(!1) : setTimeout(() => E(!0), 1);
1290
1290
  }, [P, E]);
1291
- const O = () => {
1291
+ const W = () => {
1292
1292
  x(!1), q();
1293
- }, W = (P || !C || u) && L.length > 0 && !m, $ = W && !s && L.length <= 1;
1294
- ur(yt ? "cmd+k" : "ctrl+k", (j) => {
1295
- j.preventDefault(), f.current.focus();
1293
+ }, j = (P || !C || u) && L.length > 0 && !m, $ = j && !s && L.length <= 1;
1294
+ ur(yt ? "cmd+k" : "ctrl+k", (O) => {
1295
+ O.preventDefault(), f.current.focus();
1296
1296
  }), ur("esc", () => f.current.blur(), { enableOnTags: ["INPUT"] });
1297
- const re = W || !d;
1297
+ const re = j || !d;
1298
1298
  return /* @__PURE__ */ n.createElement("div", {
1299
1299
  className: "ui-search relative w-full"
1300
1300
  }, /* @__PURE__ */ n.createElement("div", {
@@ -1313,8 +1313,9 @@ const Si = Mi((e, t) => e(t), 500), Bo = ({
1313
1313
  e
1314
1314
  ),
1315
1315
  ref: f,
1316
- onFocus: O,
1316
+ onFocus: W,
1317
1317
  onBlur: () => x(!0),
1318
+ onChange: (O) => h(O.target.value),
1318
1319
  ...g
1319
1320
  })
1320
1321
  }), /* @__PURE__ */ n.createElement("div", {
@@ -1329,13 +1330,13 @@ const Si = Mi((e, t) => e(t), 500), Bo = ({
1329
1330
  className: I(
1330
1331
  "ui-search-menu",
1331
1332
  "absolute top-10 divide-y divide-gray-light w-full xl:w-2/3 max-h-[75vh] border border-blue-light mt-1 rounded overflow-auto z-10 bg-white",
1332
- { hidden: !W }
1333
+ { hidden: !j }
1333
1334
  )
1334
1335
  })
1335
- }, re ? L.map((j, _) => /* @__PURE__ */ n.createElement("li", {
1336
- key: j,
1337
- ...B({ key: _, item: j, index: _, className: "ui-search-item" })
1338
- }, j === A ? /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("div", {
1336
+ }, re ? L.map((O, _) => /* @__PURE__ */ n.createElement("li", {
1337
+ key: O,
1338
+ ...B({ key: _, item: O, index: _, className: "ui-search-item" })
1339
+ }, O === A ? /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("div", {
1339
1340
  className: I(
1340
1341
  "cursor-pointer p-2",
1341
1342
  z === _ ? "bg-blue-light text-white" : ""
@@ -1344,7 +1345,7 @@ const Si = Mi((e, t) => e(t), 500), Bo = ({
1344
1345
  className: "p-3 text-center"
1345
1346
  }, /* @__PURE__ */ n.createElement(ft, {
1346
1347
  size: "small"
1347
- })) : null) : l == null ? void 0 : l(j, z === _))) : null, re && $ ? /* @__PURE__ */ n.createElement("li", {
1348
+ })) : null) : l == null ? void 0 : l(O, z === _))) : null, re && $ ? /* @__PURE__ */ n.createElement("li", {
1348
1349
  className: "cursor-not-allowed p-2"
1349
1350
  }, "No results found") : null, re && L.length < 5 ? /* @__PURE__ */ n.createElement("li", {
1350
1351
  className: "search-footer pointer-events sticky bottom-0 flex space-x-5 p-2 text-sm text-gray-dark"
@@ -2518,9 +2519,9 @@ function Ns() {
2518
2519
  }
2519
2520
  }
2520
2521
  }
2521
- var E = u, A = d, L = s, M = l, V = t, P = m, q = a, D = v, Y = x, H = o, z = i, B = r, G = g, O = !1;
2522
- function W(N) {
2523
- return O || (O = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), $(N) || C(N) === u;
2522
+ var E = u, A = d, L = s, M = l, V = t, P = m, q = a, D = v, Y = x, H = o, z = i, B = r, G = g, W = !1;
2523
+ function j(N) {
2524
+ return W || (W = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), $(N) || C(N) === u;
2524
2525
  }
2525
2526
  function $(N) {
2526
2527
  return C(N) === d;
@@ -2528,7 +2529,7 @@ function Ns() {
2528
2529
  function re(N) {
2529
2530
  return C(N) === s;
2530
2531
  }
2531
- function j(N) {
2532
+ function O(N) {
2532
2533
  return C(N) === l;
2533
2534
  }
2534
2535
  function _(N) {
@@ -2558,7 +2559,7 @@ function Ns() {
2558
2559
  function Le(N) {
2559
2560
  return C(N) === g;
2560
2561
  }
2561
- U.AsyncMode = E, U.ConcurrentMode = A, U.ContextConsumer = L, U.ContextProvider = M, U.Element = V, U.ForwardRef = P, U.Fragment = q, U.Lazy = D, U.Memo = Y, U.Portal = H, U.Profiler = z, U.StrictMode = B, U.Suspense = G, U.isAsyncMode = W, U.isConcurrentMode = $, U.isContextConsumer = re, U.isContextProvider = j, U.isElement = _, U.isForwardRef = ge, U.isFragment = he, U.isLazy = ue, U.isMemo = ce, U.isPortal = ve, U.isProfiler = Ee, U.isStrictMode = Re, U.isSuspense = Le, U.isValidElementType = y, U.typeOf = C;
2562
+ U.AsyncMode = E, U.ConcurrentMode = A, U.ContextConsumer = L, U.ContextProvider = M, U.Element = V, U.ForwardRef = P, U.Fragment = q, U.Lazy = D, U.Memo = Y, U.Portal = H, U.Profiler = z, U.StrictMode = B, U.Suspense = G, U.isAsyncMode = j, U.isConcurrentMode = $, U.isContextConsumer = re, U.isContextProvider = O, U.isElement = _, U.isForwardRef = ge, U.isFragment = he, U.isLazy = ue, U.isMemo = ce, U.isPortal = ve, U.isProfiler = Ee, U.isStrictMode = Re, U.isSuspense = Le, U.isValidElementType = y, U.typeOf = C;
2562
2563
  }()), U;
2563
2564
  }
2564
2565
  (function(e) {
@@ -4233,11 +4234,11 @@ var Tl = process.env.NODE_ENV === "production" ? {
4233
4234
  }, [m]), L = Ne(function() {
4234
4235
  var H = "";
4235
4236
  if (o && A.onChange) {
4236
- var z = o.option, B = o.options, G = o.removedValue, O = o.removedValues, W = o.value, $ = function(ce) {
4237
+ var z = o.option, B = o.options, G = o.removedValue, W = o.removedValues, j = o.value, $ = function(ce) {
4237
4238
  return Array.isArray(ce) ? null : ce;
4238
- }, re = G || z || $(W), j = re ? g(re) : "", _ = B || O || void 0, ge = _ ? _.map(g) : [], he = T({
4239
+ }, re = G || z || $(j), O = re ? g(re) : "", _ = B || W || void 0, ge = _ ? _.map(g) : [], he = T({
4239
4240
  isDisabled: re && v(re, s),
4240
- label: j,
4241
+ label: O,
4241
4242
  labels: ge
4242
4243
  }, o);
4243
4244
  H = A.onChange(he);
@@ -5620,9 +5621,9 @@ var Va = function(t) {
5620
5621
  }), r.formatOptionLabel(_.data, "menu"));
5621
5622
  }, G;
5622
5623
  if (this.hasOptions())
5623
- G = this.getCategorizedOptions().map(function(j) {
5624
- if (j.type === "group") {
5625
- var _ = j.data, ge = j.options, he = j.index, ue = "".concat(r.getElementId("group"), "-").concat(he), ce = "".concat(ue, "-heading");
5624
+ G = this.getCategorizedOptions().map(function(O) {
5625
+ if (O.type === "group") {
5626
+ var _ = O.data, ge = O.options, he = O.index, ue = "".concat(r.getElementId("group"), "-").concat(he), ce = "".concat(ue, "-heading");
5626
5627
  return /* @__PURE__ */ Z.createElement(l, S({}, v, {
5627
5628
  key: ue,
5628
5629
  data: _,
@@ -5630,29 +5631,29 @@ var Va = function(t) {
5630
5631
  Heading: s,
5631
5632
  headingProps: {
5632
5633
  id: ce,
5633
- data: j.data
5634
+ data: O.data
5634
5635
  },
5635
- label: r.formatGroupLabel(j.data)
5636
- }), j.options.map(function(ve) {
5636
+ label: r.formatGroupLabel(O.data)
5637
+ }), O.options.map(function(ve) {
5637
5638
  return B(ve, "".concat(he, "-").concat(ve.index));
5638
5639
  }));
5639
- } else if (j.type === "option")
5640
- return B(j, "".concat(j.index));
5640
+ } else if (O.type === "option")
5641
+ return B(O, "".concat(O.index));
5641
5642
  });
5642
5643
  else if (y) {
5643
- var O = C({
5644
+ var W = C({
5644
5645
  inputValue: k
5645
5646
  });
5646
- if (O === null)
5647
+ if (W === null)
5647
5648
  return null;
5648
- G = /* @__PURE__ */ Z.createElement(g, v, O);
5649
+ G = /* @__PURE__ */ Z.createElement(g, v, W);
5649
5650
  } else {
5650
- var W = Y({
5651
+ var j = Y({
5651
5652
  inputValue: k
5652
5653
  });
5653
- if (W === null)
5654
+ if (j === null)
5654
5655
  return null;
5655
- G = /* @__PURE__ */ Z.createElement(w, v, W);
5656
+ G = /* @__PURE__ */ Z.createElement(w, v, j);
5656
5657
  }
5657
5658
  var $ = {
5658
5659
  minMenuHeight: E,
@@ -5660,8 +5661,8 @@ var Va = function(t) {
5660
5661
  menuPlacement: M,
5661
5662
  menuPosition: V,
5662
5663
  menuShouldScrollIntoView: D
5663
- }, re = /* @__PURE__ */ Z.createElement(F0, S({}, v, $), function(j) {
5664
- var _ = j.ref, ge = j.placerProps, he = ge.placement, ue = ge.maxHeight;
5664
+ }, re = /* @__PURE__ */ Z.createElement(F0, S({}, v, $), function(O) {
5665
+ var _ = O.ref, ge = O.placerProps, he = ge.placement, ue = ge.maxHeight;
5665
5666
  return /* @__PURE__ */ Z.createElement(u, S({}, v, $, {
5666
5667
  innerRef: _,
5667
5668
  innerProps: {
@@ -5812,11 +5813,11 @@ var Va = function(t) {
5812
5813
  Ra.defaultProps = ic;
5813
5814
  var dc = ["defaultInputValue", "defaultMenuIsOpen", "defaultValue", "inputValue", "menuIsOpen", "onChange", "onInputChange", "onMenuClose", "onMenuOpen", "value"];
5814
5815
  function mc(e) {
5815
- var t = e.defaultInputValue, o = t === void 0 ? "" : t, a = e.defaultMenuIsOpen, r = a === void 0 ? !1 : a, i = e.defaultValue, l = i === void 0 ? null : i, s = e.inputValue, u = e.menuIsOpen, d = e.onChange, m = e.onInputChange, g = e.onMenuClose, w = e.onMenuOpen, x = e.value, v = Ze(e, dc), h = ne(s !== void 0 ? s : o), f = Be(h, 2), b = f[0], k = f[1], y = ne(u !== void 0 ? u : r), C = Be(y, 2), E = C[0], A = C[1], L = ne(x !== void 0 ? x : l), M = Be(L, 2), V = M[0], P = M[1], q = ae(function(O, W) {
5816
- typeof d == "function" && d(O, W), P(O);
5817
- }, [d]), D = ae(function(O, W) {
5816
+ var t = e.defaultInputValue, o = t === void 0 ? "" : t, a = e.defaultMenuIsOpen, r = a === void 0 ? !1 : a, i = e.defaultValue, l = i === void 0 ? null : i, s = e.inputValue, u = e.menuIsOpen, d = e.onChange, m = e.onInputChange, g = e.onMenuClose, w = e.onMenuOpen, x = e.value, v = Ze(e, dc), h = ne(s !== void 0 ? s : o), f = Be(h, 2), b = f[0], k = f[1], y = ne(u !== void 0 ? u : r), C = Be(y, 2), E = C[0], A = C[1], L = ne(x !== void 0 ? x : l), M = Be(L, 2), V = M[0], P = M[1], q = ae(function(W, j) {
5817
+ typeof d == "function" && d(W, j), P(W);
5818
+ }, [d]), D = ae(function(W, j) {
5818
5819
  var $;
5819
- typeof m == "function" && ($ = m(O, W)), k($ !== void 0 ? $ : O);
5820
+ typeof m == "function" && ($ = m(W, j)), k($ !== void 0 ? $ : W);
5820
5821
  }, [m]), Y = ae(function() {
5821
5822
  typeof w == "function" && w(), A(!0);
5822
5823
  }, [w]), H = ae(function() {
@@ -6634,23 +6635,23 @@ const Nt = {
6634
6635
  _e(() => {
6635
6636
  l == null || l(f);
6636
6637
  }, [f, l]);
6637
- const E = (B, G, O) => {
6638
+ const E = (B, G, W) => {
6638
6639
  if (!G.disabled)
6639
6640
  if (y(""), C)
6640
6641
  if (t.from && t.to)
6641
- i({ from: B, to: null }, G, O);
6642
+ i({ from: B, to: null }, G, W);
6642
6643
  else if ((t.from || t.to).getTime() === B.getTime()) {
6643
- const W = R(B).startOf("day").toDate(), $ = R(B).endOf("day").toDate();
6644
- i({ from: W, to: $ }, G, O);
6644
+ const j = R(B).startOf("day").toDate(), $ = R(B).endOf("day").toDate();
6645
+ i({ from: j, to: $ }, G, W);
6645
6646
  } else
6646
- i(i1.addDayToRange(B, t), G, O);
6647
+ i(i1.addDayToRange(B, t), G, W);
6647
6648
  else
6648
- i(B, G, O);
6649
- }, A = (B, G, O) => {
6649
+ i(B, G, W);
6650
+ }, A = (B, G, W) => {
6650
6651
  if (C)
6651
6652
  return;
6652
- const W = new Date();
6653
- G.disabled || P(W) ? (b(W), l == null || l(W)) : i(B, G, O);
6653
+ const j = new Date();
6654
+ G.disabled || P(j) ? (b(j), l == null || l(j)) : i(B, G, W);
6654
6655
  }, L = (B, G) => {
6655
6656
  b(G.from), i(G, u, null);
6656
6657
  }, M = (B) => {
@@ -6660,18 +6661,18 @@ const Nt = {
6660
6661
  currentMonth: f,
6661
6662
  onChange: M
6662
6663
  }) : void 0, P = (B) => e1(a) ? a.some((G) => R(G).isSame(B, "day")) : (t1(a), a(B)), q = (B) => {
6663
- const G = w == null ? void 0 : w(B), O = P(B);
6664
+ const G = w == null ? void 0 : w(B), W = P(B);
6664
6665
  return G ? /* @__PURE__ */ n.createElement(Gn, {
6665
6666
  placement: "top",
6666
6667
  content: G
6667
6668
  }, /* @__PURE__ */ n.createElement(Cn, {
6668
- disabled: O,
6669
+ disabled: W,
6669
6670
  selectedDate: t,
6670
6671
  date: B,
6671
6672
  getContent: o,
6672
6673
  currentMonth: f
6673
6674
  })) : /* @__PURE__ */ n.createElement(Cn, {
6674
- disabled: O,
6675
+ disabled: W,
6675
6676
  selectedDate: t,
6676
6677
  date: B,
6677
6678
  getContent: o,
@@ -6687,17 +6688,17 @@ const Nt = {
6687
6688
  }, "Upcoming"), (x == null ? void 0 : x.length) > 0 ? /* @__PURE__ */ n.createElement("div", {
6688
6689
  className: "mt-5"
6689
6690
  }, x == null ? void 0 : x.map((B) => {
6690
- const G = R(B).isSame(R(t), "day"), O = R(B).format();
6691
+ const G = R(B).isSame(R(t), "day"), W = R(B).format();
6691
6692
  return /* @__PURE__ */ n.createElement("div", {
6692
- key: O,
6693
+ key: W,
6693
6694
  value: !0,
6694
6695
  className: I(
6695
6696
  "mx-6 mt-3 flex min-w-40 cursor-pointer items-center justify-center",
6696
6697
  "rounded border border-gray py-3 hover:border-blue hover:bg-blue hover:text-white",
6697
6698
  { "border-blue bg-blue text-white": G }
6698
6699
  ),
6699
- onClick: (W) => {
6700
- E(B, {}, W), M(B);
6700
+ onClick: (j) => {
6701
+ E(B, {}, j), M(B);
6701
6702
  }
6702
6703
  }, R(B).format("ddd DD MMMM"));
6703
6704
  })) : /* @__PURE__ */ n.createElement("div", {
@@ -6855,11 +6856,11 @@ var Xa = { exports: {} };
6855
6856
  z.call(P, G), V = V.replace(G, "");
6856
6857
  }
6857
6858
  }
6858
- return function(O) {
6859
- var W = O.afternoon;
6860
- if (W !== void 0) {
6861
- var $ = O.hours;
6862
- W ? $ < 12 && (O.hours += 12) : $ === 12 && (O.hours = 0), delete O.afternoon;
6859
+ return function(W) {
6860
+ var j = W.afternoon;
6861
+ if (j !== void 0) {
6862
+ var $ = W.hours;
6863
+ j ? $ < 12 && (W.hours += 12) : $ === 12 && (W.hours = 0), delete W.afternoon;
6863
6864
  }
6864
6865
  }(P), P;
6865
6866
  };
@@ -6873,14 +6874,14 @@ var Xa = { exports: {} };
6873
6874
  var M = L[1];
6874
6875
  if (typeof M == "string") {
6875
6876
  var V = L[2] === !0, P = L[3] === !0, q = V || P, D = L[2];
6876
- P && (D = L[2]), s = this.$locale(), !V && D && (s = b.Ls[D]), this.$d = function(B, G, O) {
6877
+ P && (D = L[2]), s = this.$locale(), !V && D && (s = b.Ls[D]), this.$d = function(B, G, W) {
6877
6878
  try {
6878
6879
  if (["x", "X"].indexOf(G) > -1)
6879
6880
  return new Date((G === "X" ? 1e3 : 1) * B);
6880
- var W = v(G)(B), $ = W.year, re = W.month, j = W.day, _ = W.hours, ge = W.minutes, he = W.seconds, ue = W.milliseconds, ce = W.zone, ve = new Date(), Ee = j || ($ || re ? 1 : ve.getDate()), Re = $ || ve.getFullYear(), Le = 0;
6881
+ var j = v(G)(B), $ = j.year, re = j.month, O = j.day, _ = j.hours, ge = j.minutes, he = j.seconds, ue = j.milliseconds, ce = j.zone, ve = new Date(), Ee = O || ($ || re ? 1 : ve.getDate()), Re = $ || ve.getFullYear(), Le = 0;
6881
6882
  $ && !re || (Le = re > 0 ? re - 1 : ve.getMonth());
6882
6883
  var N = _ || 0, Me = ge || 0, be = he || 0, Fe = ue || 0;
6883
- return ce ? new Date(Date.UTC(Re, Le, Ee, N, Me, be, Fe + 60 * ce.offset * 1e3)) : O ? new Date(Date.UTC(Re, Le, Ee, N, Me, be, Fe)) : new Date(Re, Le, Ee, N, Me, be, Fe);
6884
+ return ce ? new Date(Date.UTC(Re, Le, Ee, N, Me, be, Fe + 60 * ce.offset * 1e3)) : W ? new Date(Date.UTC(Re, Le, Ee, N, Me, be, Fe)) : new Date(Re, Le, Ee, N, Me, be, Fe);
6884
6885
  } catch {
6885
6886
  return new Date("");
6886
6887
  }