qaema-ui 0.0.26 → 0.0.27

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,21 +1,21 @@
1
1
  import { j as t } from "../../_virtual/jsx-runtime.js";
2
- import { useRef as g, useState as v, useCallback as ne, useEffect as D } from "react";
3
- import { createPortal as re } from "react-dom";
4
- import { FaTimes as k, FaAngleDown as oe } from "../../node_modules/react-icons/fa/index.js";
5
- import { useTheme as le } from "styled-components";
6
- import { HelperTextWrapper as ie } from "../PhoneInputField.js";
7
- import se from "../SearchBar.js";
8
- import ae from "../Typography.js";
9
- import ce from "../../hooks/useZIndex.js";
10
- import { useQaemaCoreTranslation as de } from "../../i18n/i18n.js";
11
- import { StyledDropDownContainer as ue, StyledlabelContainer as fe, StyledDropDown as me, StyledDropDownToggle as he, StyledDropDownTitle as pe, IconsContainer as xe, StyledDropDownMenu as Se, SearchContainer as je, StyledOptionsContainer as we, StyledDropItem as ye, SelectedTagsContainer as ge, SelectedTag as ve } from "../../styles/Dropdown.styles.js";
12
- import Ce from "./Table/Table.js";
13
- import be from "../../node_modules/react-bootstrap/esm/Spinner.js";
14
- const He = (d) => {
2
+ import { useRef as g, useState as v, useCallback as re, useEffect as D } from "react";
3
+ import { createPortal as oe } from "react-dom";
4
+ import { FaTimes as k, FaAngleDown as le } from "../../node_modules/react-icons/fa/index.js";
5
+ import { useTheme as ie } from "styled-components";
6
+ import { HelperTextWrapper as se } from "../PhoneInputField.js";
7
+ import ae from "../SearchBar.js";
8
+ import ce from "../Spinner.js";
9
+ import de from "../Typography.js";
10
+ import ue from "../../hooks/useZIndex.js";
11
+ import { useQaemaCoreTranslation as fe } from "../../i18n/i18n.js";
12
+ import { StyledDropDownContainer as me, StyledlabelContainer as he, StyledDropDown as pe, StyledDropDownToggle as xe, StyledDropDownTitle as Se, IconsContainer as je, StyledDropDownMenu as we, SearchContainer as ye, StyledOptionsContainer as ge, SpinnerRow as ve, SelectedTagsContainer as Ce, SelectedTag as be } from "../../styles/Dropdown.styles.js";
13
+ import De from "./Table/Table.js";
14
+ const Me = (d) => {
15
15
  const {
16
16
  label: T,
17
- options: P,
18
- placeholder: R = "Select Something",
17
+ options: R,
18
+ placeholder: P = "Select Something",
19
19
  optional: W = !1,
20
20
  error: s = "",
21
21
  disabled: S = !1,
@@ -26,21 +26,22 @@ const He = (d) => {
26
26
  icon: F,
27
27
  allowSearch: H,
28
28
  searchHandler: M,
29
- searchPlaceholder: B,
29
+ searchPlaceholder: N,
30
30
  onToggle: i,
31
31
  multiSelect: f = !1,
32
- isLoading: N = !1,
32
+ isLoading: B = !1,
33
33
  currentSelectedOptions: h = [],
34
- isInteractive: I = !1,
34
+ isInteractive: E = !1,
35
35
  //Table related props
36
36
  columns: A,
37
37
  isTableHeadVisible: V = !1,
38
38
  getDisplayValue: y,
39
- isRowDisabled: Q
40
- } = d, p = le(), { t: E } = de(), C = g(null), a = g(null), X = g(null), Y = g(d.currentSelectedOptions !== void 0), [u, b] = v(!1), [Z, q] = v(0), [L, G] = v({ top: 0, left: 0 }), [l, x] = v(h), $ = F ?? /* @__PURE__ */ t.jsx(t.Fragment, {}), J = ce("dropdown"), m = ne(() => {
39
+ isRowDisabled: Q,
40
+ rowClassName: X
41
+ } = d, p = ie(), { t: I } = fe(), C = g(null), a = g(null), Y = g(null), Z = g(d.currentSelectedOptions !== void 0), [u, b] = v(!1), [q, G] = v(0), [L, J] = v({ top: 0, left: 0 }), [l, x] = v(h), O = F ?? /* @__PURE__ */ t.jsx(t.Fragment, {}), K = ue("dropdown"), m = re(() => {
41
42
  if (a != null && a.current) {
42
43
  const e = a.current.getBoundingClientRect();
43
- q(a.current.offsetWidth / 16), G({
44
+ G(a.current.offsetWidth / 16), J({
44
45
  top: e.bottom + window.scrollY,
45
46
  left: e.left + window.scrollX
46
47
  });
@@ -49,24 +50,24 @@ const He = (d) => {
49
50
  D(() => (u && (m(), window.addEventListener("resize", m), window.addEventListener("scroll", m, !0)), () => {
50
51
  window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0);
51
52
  }), [u, m]), D(() => {
52
- if (!Y.current) return;
53
+ if (!Z.current) return;
53
54
  (h.length !== l.length || h.some((n, o) => {
54
55
  var c;
55
56
  return n[r] !== ((c = l[o]) == null ? void 0 : c[r]);
56
57
  })) && x(h);
57
58
  }, [h]);
58
- const K = (e, n, o, c = "default") => o ? p.colors.grey.n400 : e ? p.colors.state.error.n450 : n ? p.colors.primary.dark.n600 : c === "light-primary" ? p.colors.primary.purple.n450 : p.colors.grey.n300, O = (e) => l.some((n) => typeof n == "object" && typeof e == "object" ? n[r] === e[r] : n.value === e.value), U = (e) => {
59
+ const U = (e, n, o, c = "default") => o ? p.colors.grey.n400 : e ? p.colors.state.error.n450 : n ? p.colors.primary.dark.n600 : c === "light-primary" ? p.colors.primary.purple.n450 : p.colors.grey.n300, $ = (e) => l.some((n) => typeof n == "object" && typeof e == "object" ? n[r] === e[r] : n.value === e.value), _ = (e) => {
59
60
  if (f) {
60
- const n = O(e);
61
+ const n = $(e);
61
62
  let o;
62
63
  n ? o = l.filter((c) => typeof c == "object" && typeof e == "object" ? c[r] !== e[r] : c.value !== e.value) : o = [...l, e], x(o), w(o);
63
64
  } else
64
65
  x([e]), w(e), b(!1), i == null || i(!1);
65
- }, _ = (e) => {
66
+ }, ee = (e) => {
66
67
  const n = l.filter((o) => typeof o == "object" && typeof e == "object" ? o[r] !== e[r] : o.value !== e.value);
67
68
  x(n), w(n);
68
- }, ee = (e) => {
69
- if (e.length === 0) return R;
69
+ }, te = (e) => {
70
+ if (e.length === 0) return P;
70
71
  if (!f) {
71
72
  const n = e[0];
72
73
  if (y)
@@ -76,7 +77,7 @@ const He = (d) => {
76
77
  if (r)
77
78
  return String(n == null ? void 0 : n[r]);
78
79
  }
79
- return `${e.length} ${E("SELECTED")}`;
80
+ return `${e.length} ${I("SELECTED")}`;
80
81
  };
81
82
  D(() => {
82
83
  const e = (n) => {
@@ -86,14 +87,14 @@ const He = (d) => {
86
87
  document.removeEventListener("mousedown", e);
87
88
  };
88
89
  }, [u, i]);
89
- const te = () => I || (s == null ? void 0 : s.length) === 0 ? null : /* @__PURE__ */ t.jsx(ie, { error: s, children: s });
90
- return /* @__PURE__ */ t.jsxs(ue, { children: [
91
- T && /* @__PURE__ */ t.jsxs(fe, { children: [
90
+ const ne = () => E || (s == null ? void 0 : s.length) === 0 ? null : /* @__PURE__ */ t.jsx(se, { error: s, children: s });
91
+ return /* @__PURE__ */ t.jsxs(me, { children: [
92
+ T && /* @__PURE__ */ t.jsxs(he, { children: [
92
93
  /* @__PURE__ */ t.jsx("label", { children: T }),
93
- W && /* @__PURE__ */ t.jsx("span", { children: E("OPTIONAL") })
94
+ W && /* @__PURE__ */ t.jsx("span", { children: I("OPTIONAL") })
94
95
  ] }),
95
96
  /* @__PURE__ */ t.jsxs(
96
- me,
97
+ pe,
97
98
  {
98
99
  show: u,
99
100
  onToggle: () => {
@@ -102,20 +103,20 @@ const He = (d) => {
102
103
  placement: "bottom-start",
103
104
  autoClose: f ? "outside" : !0,
104
105
  children: [
105
- /* @__PURE__ */ t.jsx(he, { disabled: S, ref: a, $valid: !s, $variant: d.variant || "default", children: /* @__PURE__ */ t.jsx(pe, { $valid: !s, $isInteractive: I, children: /* @__PURE__ */ t.jsxs("div", { className: "title-container", children: [
106
+ /* @__PURE__ */ t.jsx(xe, { disabled: S, ref: a, $valid: !s, $variant: d.variant || "default", children: /* @__PURE__ */ t.jsx(Se, { $valid: !s, $isInteractive: E, children: /* @__PURE__ */ t.jsxs("div", { className: "title-container", children: [
106
107
  /* @__PURE__ */ t.jsxs("div", { className: "heading-container", children: [
107
- z && typeof $ == "function" && /* @__PURE__ */ t.jsx($, {}),
108
+ z && typeof O == "function" && /* @__PURE__ */ t.jsx(O, {}),
108
109
  /* @__PURE__ */ t.jsx(
109
- ae,
110
+ de,
110
111
  {
111
112
  component: "span",
112
113
  variant: "mdText",
113
- color: K(s, l.length > 0, S, d.variant || "default"),
114
- children: ee(l)
114
+ color: U(s, l.length > 0, S, d.variant || "default"),
115
+ children: te(l)
115
116
  }
116
117
  )
117
118
  ] }),
118
- /* @__PURE__ */ t.jsxs(xe, { children: [
119
+ /* @__PURE__ */ t.jsxs(je, { children: [
119
120
  !f && l.length > 0 && !S && /* @__PURE__ */ t.jsx(
120
121
  k,
121
122
  {
@@ -125,43 +126,47 @@ const He = (d) => {
125
126
  }
126
127
  }
127
128
  ),
128
- !S && /* @__PURE__ */ t.jsx(oe, {})
129
+ !S && /* @__PURE__ */ t.jsx(le, {})
129
130
  ] })
130
131
  ] }) }) }),
131
- u && re(
132
+ u && oe(
132
133
  /* @__PURE__ */ t.jsxs(
133
- Se,
134
+ we,
134
135
  {
135
136
  ref: C,
136
- $menuWidth: Z,
137
- $zIndex: J,
137
+ $menuWidth: q,
138
+ $zIndex: K,
138
139
  style: {
139
140
  position: "fixed",
140
141
  top: `${L.top}px`,
141
142
  left: `${L.left}px`
142
143
  },
143
144
  children: [
144
- H && /* @__PURE__ */ t.jsx(je, { children: /* @__PURE__ */ t.jsx(se, { placeholder: B, onSearch: M }) }),
145
- /* @__PURE__ */ t.jsx(
146
- we,
145
+ H && /* @__PURE__ */ t.jsx(ye, { children: /* @__PURE__ */ t.jsx(ae, { placeholder: N, onSearch: M }) }),
146
+ /* @__PURE__ */ t.jsxs(
147
+ ge,
147
148
  {
148
- ref: X,
149
+ ref: Y,
149
150
  onScroll: (e) => {
150
151
  var n;
151
152
  (n = d.onScroll) == null || n.call(d, e);
152
153
  },
153
- children: N ? /* @__PURE__ */ t.jsx(ye, { $selected: !1, children: /* @__PURE__ */ t.jsx(be, {}) }) : /* @__PURE__ */ t.jsx(
154
- Ce,
155
- {
156
- keyField: r,
157
- data: P,
158
- columns: A,
159
- onRowClick: (e) => U(e),
160
- isRowSelected: (e) => O(e),
161
- isTableHeadVisible: V,
162
- isRowDisabled: Q
163
- }
164
- )
154
+ children: [
155
+ /* @__PURE__ */ t.jsx(
156
+ De,
157
+ {
158
+ keyField: r,
159
+ data: R,
160
+ columns: A,
161
+ onRowClick: (e) => _(e),
162
+ isRowSelected: (e) => $(e),
163
+ isTableHeadVisible: V,
164
+ isRowDisabled: Q,
165
+ rowClassName: X
166
+ }
167
+ ),
168
+ B && /* @__PURE__ */ t.jsx(ve, { children: /* @__PURE__ */ t.jsx(ce, {}) })
169
+ ]
165
170
  }
166
171
  )
167
172
  ]
@@ -172,13 +177,13 @@ const He = (d) => {
172
177
  ]
173
178
  }
174
179
  ),
175
- f && l.length > 0 && /* @__PURE__ */ t.jsx(ge, { children: l.map((e) => /* @__PURE__ */ t.jsxs(ve, { children: [
180
+ f && l.length > 0 && /* @__PURE__ */ t.jsx(Ce, { children: l.map((e) => /* @__PURE__ */ t.jsxs(be, { children: [
176
181
  y ? y(e) : String(j ? e[j] : e[r]),
177
- /* @__PURE__ */ t.jsx(k, { onClick: () => _(e) })
182
+ /* @__PURE__ */ t.jsx(k, { onClick: () => ee(e) })
178
183
  ] }, String(e[r]))) }),
179
- te()
184
+ ne()
180
185
  ] });
181
186
  };
182
187
  export {
183
- He as default
188
+ Me as default
184
189
  };
@@ -25,4 +25,5 @@ export interface DropDownWithTableProps<T extends Record<string, unknown>> {
25
25
  isTableHeadVisible?: boolean;
26
26
  getDisplayValue?: (option: T) => string;
27
27
  isRowDisabled?: (row: T) => boolean;
28
+ rowClassName?: (row: T, index: number) => string;
28
29
  }
@@ -35,6 +35,7 @@ export declare const StyledDropItem: import('styled-components/dist/types').ISty
35
35
  }, {
36
36
  $selected: boolean;
37
37
  }>> & string & Omit<import('react-bootstrap/esm/helpers').BsPrefixRefForwardingComponent<"a", import('react-bootstrap').DropdownItemProps>, keyof import('react').Component<any, {}, any>>;
38
+ export declare const SpinnerRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
38
39
  export declare const TypographyContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
39
40
  export declare const IconsContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
40
41
  export declare const SearchContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,7 +1,7 @@
1
1
  import r, { css as n } from "styled-components";
2
2
  import { Scrollbar as i } from "./Scrollbar.styles.js";
3
- import s from "../node_modules/react-bootstrap/esm/Dropdown.js";
4
- import t from "../node_modules/react-bootstrap/esm/DropdownToggle.js";
3
+ import t from "../node_modules/react-bootstrap/esm/Dropdown.js";
4
+ import s from "../node_modules/react-bootstrap/esm/DropdownToggle.js";
5
5
  import a from "../node_modules/react-bootstrap/esm/DropdownMenu.js";
6
6
  import l from "../node_modules/react-bootstrap/esm/DropdownItem.js";
7
7
  const x = r.div`
@@ -30,7 +30,7 @@ const x = r.div`
30
30
  flex-wrap: wrap;
31
31
  gap: ${({ theme: o }) => o.spacing.xs};
32
32
  margin-top: ${({ theme: o }) => o.spacing.xs};
33
- `, u = r.div`
33
+ `, w = r.div`
34
34
  display: flex;
35
35
  align-items: center;
36
36
  background-color: ${({ theme: o }) => o.colors.grey.n100};
@@ -47,11 +47,11 @@ const x = r.div`
47
47
  color: ${({ theme: o }) => o.colors.state.error.n450};
48
48
  }
49
49
  }
50
- `, w = r(s)`
50
+ `, u = r(t)`
51
51
  width: 100%;
52
52
  max-height: 3.5rem;
53
53
  min-width: 5rem !important;
54
- `, f = r(t)`
54
+ `, f = r(s)`
55
55
  width: 100%;
56
56
  box-shadow: ${({ $valid: o }) => o ? "0px 1px 2px 0px rgba(0, 0, 0, 0.06), 0px 1px 3px 0px rgba(0, 0, 0, 0.1);" : "none"};
57
57
  padding: 0px;
@@ -150,6 +150,12 @@ const x = r.div`
150
150
  &:hover {
151
151
  background-color: ${({ theme: o }) => o.colors.grey.n100};
152
152
  }
153
+ `, k = r.div`
154
+ display: flex;
155
+ justify-content: center;
156
+ align-items: center;
157
+ padding: ${({ theme: o }) => o.spacing.sm};
158
+ width: 100%;
153
159
  `;
154
160
  r.div`
155
161
  overflow: hidden;
@@ -157,13 +163,13 @@ r.div`
157
163
  white-space: nowrap;
158
164
  width: 100%;
159
165
  `;
160
- const k = r.div`
166
+ const z = r.div`
161
167
  display: flex;
162
168
  flex-direction: row;
163
169
  align-items: center;
164
170
  justify-content: flex-end;
165
171
  gap: ${({ theme: o }) => o.spacing.xs};
166
- `, z = r.div`
172
+ `, C = r.div`
167
173
  display: flex;
168
174
  align-items: center;
169
175
  column-gap: 0.625rem;
@@ -171,11 +177,12 @@ const k = r.div`
171
177
  padding: ${({ theme: o }) => o.spacing.xs} 1.25rem;
172
178
  `;
173
179
  export {
174
- k as IconsContainer,
175
- z as SearchContainer,
176
- u as SelectedTag,
180
+ z as IconsContainer,
181
+ C as SearchContainer,
182
+ w as SelectedTag,
177
183
  h as SelectedTagsContainer,
178
- w as StyledDropDown,
184
+ k as SpinnerRow,
185
+ u as StyledDropDown,
179
186
  x as StyledDropDownContainer,
180
187
  v as StyledDropDownMenu,
181
188
  b as StyledDropDownTitle,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qaema-ui",
3
3
  "private": false,
4
- "version": "0.0.26",
4
+ "version": "0.0.27",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -1,26 +0,0 @@
1
- import i from "../../../_virtual/index.js";
2
- import * as f from "react";
3
- import { useBootstrapPrefix as c } from "./ThemeProvider.js";
4
- import { j as d } from "../../../_virtual/jsx-runtime.js";
5
- const x = /* @__PURE__ */ f.forwardRef(({
6
- bsPrefix: r,
7
- variant: e,
8
- animation: t = "border",
9
- size: o,
10
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11
- as: a = "div",
12
- className: m,
13
- ...p
14
- }, n) => {
15
- r = c(r, "spinner");
16
- const s = `${r}-${t}`;
17
- return /* @__PURE__ */ d.jsx(a, {
18
- ref: n,
19
- ...p,
20
- className: i(m, s, o && `${s}-${o}`, e && `text-${e}`)
21
- });
22
- });
23
- x.displayName = "Spinner";
24
- export {
25
- x as default
26
- };