qaema-ui 0.0.13 → 0.0.15

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,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  export interface DatePickerProps {
3
3
  value: Date | null;
4
- onChange: (date: Date) => void;
4
+ onChange: (date: Date | null) => void;
5
5
  minDate?: Date;
6
6
  maxDate?: Date;
7
7
  label?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/lib/components/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA4B3D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAiLD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0OzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/lib/components/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA4B3D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAiLD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAkPzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { j as r } from "../_virtual/jsx-runtime.js";
2
- import { useState as p, useRef as Q, useEffect as O } from "react";
2
+ import { useState as p, useRef as Q, useEffect as C } from "react";
3
3
  import { dayLabels as X } from "../constants/calendar.constant.js";
4
4
  import { useTranslation as Z } from "react-i18next";
5
5
  import { FaRegCalendarAlt as ee, FaAngleDown as re, FaAngleLeft as te } from "../node_modules/react-icons/fa/index.js";
@@ -95,11 +95,11 @@ const we = s.div`
95
95
  text-align: center;
96
96
  font-weight: bold;
97
97
  color: #666;
98
- `, Ce = s.div`
98
+ `, Oe = s.div`
99
99
  display: grid;
100
100
  grid-template-columns: repeat(7, 1fr);
101
101
  margin-top: 0.5rem;
102
- `, Oe = s.div`
102
+ `, Ce = s.div`
103
103
  text-align: center;
104
104
  padding: ${({ theme: e }) => e.spacing.xs};
105
105
  cursor: ${(e) => e.disabled ? "not-allowed" : "pointer"};
@@ -162,35 +162,39 @@ const we = s.div`
162
162
  display: flex;
163
163
  justify-content: ${({ theme: e }) => e.dir === "rtl" ? "flex-end" : "flex-start"};
164
164
  text-align: ${({ theme: e }) => e.dir === "rtl" ? "right" : "left"};
165
- `, pr = ({ value: e, onChange: i, minDate: l, maxDate: m, label: D, optional: k, disabled: F, error: w }) => {
166
- const [I, f] = p(!1), [d, c] = p(e || /* @__PURE__ */ new Date()), [g, u] = p(e || null), [W, h] = p(e ? $(e, "dd/MM/yyyy") : ""), [y, x] = p("calendar"), [E, S] = p(0), j = Q(null), M = /* @__PURE__ */ new Date(), v = oe(), { t: N, i18n: H } = Z(), b = (H.language || "").toLowerCase().startsWith("ar") || v.dir === "rtl", T = b ? le : de, V = b ? ["ن", "ث", "ر", "خ", "ج", "س", "ح"] : X, J = b ? ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"] : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
167
- O(() => {
165
+ `, pr = ({ value: e, onChange: i, minDate: l, maxDate: g, label: D, optional: k, disabled: F, error: w }) => {
166
+ const [I, u] = p(!1), [d, c] = p(e || /* @__PURE__ */ new Date()), [h, m] = p(e || null), [W, f] = p(e ? $(e, "dd/MM/yyyy") : ""), [y, x] = p("calendar"), [E, S] = p(0), j = Q(null), M = /* @__PURE__ */ new Date(), v = oe(), { t: N, i18n: H } = Z(), b = (H.language || "").toLowerCase().startsWith("ar") || v.dir === "rtl", T = b ? le : de, V = b ? ["ن", "ث", "ر", "خ", "ج", "س", "ح"] : X, J = b ? ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"] : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
167
+ C(() => {
168
168
  const o = (t) => {
169
- j.current && !j.current.contains(t.target) && (f(!1), x("calendar"));
169
+ j.current && !j.current.contains(t.target) && (u(!1), x("calendar"));
170
170
  };
171
171
  return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
172
- }, []), O(() => {
173
- e ? (u(e), c(e), h($(e, "dd/MM/yyyy"))) : (u(null), h(""));
172
+ }, []), C(() => {
173
+ e ? (m(e), c(e), f($(e, "dd/MM/yyyy"))) : (m(null), f(""));
174
174
  }, [e]);
175
175
  const P = (o) => {
176
176
  let t = o.target.value.replace(/\D/g, "");
177
- if (t.length >= 3 && (t = t.slice(0, 2) + "/" + t.slice(2)), t.length >= 6 && (t = t.slice(0, 5) + "/" + t.slice(5, 9)), h(t), t.length === 10) {
178
- const a = se(t, "dd/MM/yyyy", /* @__PURE__ */ new Date()), n = l && R(a, l) || m && z(a, m);
179
- ie(a) && !n && (u(a), c(a), i(a));
177
+ if (t === "") {
178
+ f(""), m(null), i(null);
179
+ return;
180
+ }
181
+ if (t.length >= 3 && (t = t.slice(0, 2) + "/" + t.slice(2)), t.length >= 6 && (t = t.slice(0, 5) + "/" + t.slice(5, 9)), f(t), t.length === 10) {
182
+ const a = se(t, "dd/MM/yyyy", /* @__PURE__ */ new Date()), n = l && R(a, l) || g && z(a, g);
183
+ ie(a) && !n && (m(a), c(a), i(a));
180
184
  }
181
185
  }, B = () => {
182
186
  const o = pe(me(d), { weekStartsOn: 1 }), t = fe(ge(d), { weekStartsOn: 1 }), a = [];
183
187
  for (let n = o; n <= t; n = ue(n, 1)) {
184
- const C = l && R(n, l) || m && z(n, m) || !he(n, d);
188
+ const O = l && R(n, l) || g && z(n, g) || !he(n, d);
185
189
  a.push(
186
190
  /* @__PURE__ */ r.jsx(
187
- Oe,
191
+ Ce,
188
192
  {
189
193
  isToday: M.getDate() === n.getDate() && M.getMonth() === n.getMonth() && M.getFullYear() === n.getFullYear(),
190
- disabled: C,
191
- selected: g ? ye(n, g) : !1,
194
+ disabled: O,
195
+ selected: h ? ye(n, h) : !1,
192
196
  onClick: () => {
193
- C || (u(n), h($(n, "dd/MM/yyyy")), i(n), f(!1));
197
+ O || (m(n), f($(n, "dd/MM/yyyy")), i(n), u(!1));
194
198
  },
195
199
  children: n.getDate()
196
200
  },
@@ -198,7 +202,7 @@ const we = s.div`
198
202
  )
199
203
  );
200
204
  }
201
- return /* @__PURE__ */ r.jsx(Ce, { children: a });
205
+ return /* @__PURE__ */ r.jsx(Oe, { children: a });
202
206
  }, G = () => {
203
207
  const t = xe(/* @__PURE__ */ new Date()) + E * 12, a = [];
204
208
  for (let n = 0; n < 12; n++)
@@ -239,7 +243,7 @@ const we = s.div`
239
243
  ze,
240
244
  {
241
245
  onClick: () => {
242
- g && i(g), f(!1);
246
+ h && i(h), u(!1);
243
247
  },
244
248
  children: N("SET_DATE")
245
249
  }
@@ -260,7 +264,7 @@ const we = s.div`
260
264
  value: W,
261
265
  onChange: P,
262
266
  placeholder: b ? "يوم/شهر/سنة" : "dd/mm/yyyy",
263
- onFocus: () => f(!0)
267
+ onFocus: () => u(!0)
264
268
  }
265
269
  )
266
270
  ] }),
@@ -1 +1 @@
1
- {"version":3,"file":"FilterActiveBar.d.ts","sourceRoot":"","sources":["../../src/lib/components/FilterActiveBar.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAiBxD,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAIF,QAAA,MAAM,eAAe,GAAI,qCAAqC,oBAAoB,4CA8CjF,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"FilterActiveBar.d.ts","sourceRoot":"","sources":["../../src/lib/components/FilterActiveBar.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAiBxD,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAIF,QAAA,MAAM,eAAe,GAAI,qCAAqC,oBAAoB,4CA2DjF,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,41 +1,48 @@
1
- import { j as n } from "../_virtual/jsx-runtime.js";
2
- import { useTranslation as f } from "react-i18next";
3
- import s from "styled-components";
4
- import x from "../hooks/useBadgeVariant.js";
5
- import v from "./Badge.js";
6
- import g from "./Typography.js";
7
- const j = s.div`
8
- margin-bottom: ${({ theme: o }) => o.spacing.l};
9
- `, B = s.div`
1
+ import { j as o } from "../_virtual/jsx-runtime.js";
2
+ import { useTranslation as g } from "react-i18next";
3
+ import u from "styled-components";
4
+ import y from "../hooks/useBadgeVariant.js";
5
+ import N from "./Badge.js";
6
+ import j from "./Typography.js";
7
+ const B = u.div`
8
+ margin-bottom: ${({ theme: s }) => s.spacing.l};
9
+ `, b = u.div`
10
10
  display: flex;
11
11
  flex-wrap: wrap;
12
12
  gap: 8px;
13
- `, S = ({ fields: o, activeFilters: i, onRemove: l }) => {
14
- const { t: d } = f(), c = x("default"), m = (e) => {
15
- l(e);
16
- }, p = (e) => {
17
- const r = o.find((t) => t.accessor === e.fieldName);
13
+ `, F = ({ fields: s, activeFilters: d, onRemove: p }) => {
14
+ const { t: m } = g(), f = y("default"), h = (e) => {
15
+ p(e);
16
+ }, v = (e) => {
17
+ var i, c;
18
+ const r = s.find((t) => t.accessor === e.fieldName);
18
19
  if (!r) return e.value;
19
- const a = (t, u, h) => /* @__PURE__ */ n.jsxs(g, { variant: "span", color: c.color, children: [
20
+ let a = e.value;
21
+ if (r.type === "select") {
22
+ const t = (c = (i = r == null ? void 0 : r.options) == null ? void 0 : i.filter((n) => typeof n.value == "number" ? n.value === Number(a) : n.value === a)) == null ? void 0 : c[0];
23
+ if (!t) return e.value;
24
+ a = t == null ? void 0 : t.label;
25
+ }
26
+ const l = (t, n, x) => /* @__PURE__ */ o.jsxs(j, { variant: "span", color: f.color, children: [
20
27
  t,
21
28
  " ",
22
- /* @__PURE__ */ n.jsx("strong", { children: d(h) }),
29
+ /* @__PURE__ */ o.jsx("strong", { children: m(x) }),
23
30
  " ",
24
- u
31
+ n
25
32
  ] });
26
33
  switch (e.operator) {
27
34
  case "=":
28
- return a(r.header, e.value, "LBL_IS");
35
+ return l(r.header, a, "LBL_IS");
29
36
  case "like":
30
- return a(r.header, e.value, "CONTAINS");
37
+ return l(r.header, a, "CONTAINS");
31
38
  case "between":
32
- return a(r.header, e.value, "BETWEEN");
39
+ return l(r.header, a, "BETWEEN");
33
40
  default:
34
- return a(r.header, e.value, "LBL_IS");
41
+ return l(r.header, a, "LBL_IS");
35
42
  }
36
43
  };
37
- return /* @__PURE__ */ n.jsx(j, { children: /* @__PURE__ */ n.jsx(B, { children: i.map((e) => o.find((a) => a.accessor === e.fieldName) ? /* @__PURE__ */ n.jsx(v, { onClose: () => m(e.fieldName), children: p(e) }, e.fieldName) : null) }) });
44
+ return /* @__PURE__ */ o.jsx(B, { children: /* @__PURE__ */ o.jsx(b, { children: d.map((e) => s.find((a) => a.accessor === e.fieldName) ? /* @__PURE__ */ o.jsx(N, { onClose: () => h(e.fieldName), children: v(e) }, e.fieldName) : null) }) });
38
45
  };
39
46
  export {
40
- S as default
47
+ F as default
41
48
  };