@cagatayfdn/flora-components 0.0.135 → 0.0.136

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,44 +1,46 @@
1
1
  import { j as e } from "../../jsx-runtime-BcAkpsdy.js";
2
2
  import { c as r } from "../../index-BHf7G3IG.js";
3
- import { ThemeAppearance as m } from "../../enums/appearance.js";
4
- import '../../Panel.css';const x = "_box_1bthr_2", p = "_header_1bthr_2", j = "_hasBorder_1bthr_2", f = "_body_1bthr_2", N = "_noHeaders_1bthr_2", y = "_description_1bthr_2", u = "_dark_1bthr_2", v = "_line_1bthr_2", s = {
5
- box: x,
6
- header: p,
7
- hasBorder: j,
8
- body: f,
9
- noHeaders: N,
10
- description: y,
11
- dark: u,
12
- line: v
13
- }, A = ({
3
+ import { ThemeAppearance as x } from "../../enums/appearance.js";
4
+ import '../../Panel.css';const p = "_box_1bthr_2", j = "_header_1bthr_2", f = "_hasBorder_1bthr_2", N = "_body_1bthr_2", y = "_noHeaders_1bthr_2", u = "_description_1bthr_2", v = "_dark_1bthr_2", B = "_line_1bthr_2", s = {
5
+ box: p,
6
+ header: j,
7
+ hasBorder: f,
8
+ body: N,
9
+ noHeaders: y,
10
+ description: u,
11
+ dark: v,
12
+ line: B
13
+ }, $ = ({
14
14
  title: a,
15
15
  children: i,
16
- description: n,
16
+ description: d,
17
17
  className: _,
18
- type: d = "box",
19
- appearance: t = m.DARK,
18
+ type: n = "box",
19
+ appearance: t = x.DARK,
20
20
  headerDescription: c,
21
21
  headerRightChild: o,
22
- headerClass: h,
23
- hasBorder: l,
24
- bodyClass: b
22
+ headerClass: l,
23
+ hasBorder: h,
24
+ bodyClass: b,
25
+ isLoading: m
25
26
  }) => /* @__PURE__ */ e.jsxs(
26
27
  "div",
27
28
  {
28
29
  "data-testid": "panel-container",
29
30
  className: r(_, s.container, {
30
31
  [s[`${t}`]]: t,
31
- [s[`${d}`]]: d
32
+ [s[`${n}`]]: n
32
33
  }),
33
34
  children: [
34
35
  a && /* @__PURE__ */ e.jsxs(
35
36
  "div",
36
37
  {
37
38
  "data-testid": "panel-header",
38
- className: r(s.header, h, {
39
+ className: r(s.header, l, {
39
40
  flex: o,
41
+ slide: m,
40
42
  "justify-between": o,
41
- [s.hasBorder]: l
43
+ [s.hasBorder]: h
42
44
  }),
43
45
  children: [
44
46
  /* @__PURE__ */ e.jsxs("div", { children: [
@@ -56,7 +58,7 @@ import '../../Panel.css';const x = "_box_1bthr_2", p = "_header_1bthr_2", j = "_
56
58
  [s.noHeaders]: !a
57
59
  }),
58
60
  children: [
59
- n && /* @__PURE__ */ e.jsx("p", { "data-testid": "panel-description", className: s.description, children: n }),
61
+ d && /* @__PURE__ */ e.jsx("p", { "data-testid": "panel-description", className: s.description, children: d }),
60
62
  i
61
63
  ]
62
64
  }
@@ -65,5 +67,5 @@ import '../../Panel.css';const x = "_box_1bthr_2", p = "_header_1bthr_2", j = "_
65
67
  }
66
68
  );
67
69
  export {
68
- A as default
70
+ $ as default
69
71
  };
@@ -1,259 +1,265 @@
1
- import { j as t } from "../../jsx-runtime-BcAkpsdy.js";
1
+ import { j as r } from "../../jsx-runtime-BcAkpsdy.js";
2
2
  import se, { useState as F, useEffect as O } from "react";
3
3
  import ne from "../NoResult/NoResult.js";
4
- import { c as N } from "../../index-BHf7G3IG.js";
4
+ import { c as m } from "../../index-BHf7G3IG.js";
5
5
  import { s as x } from "../../Table.module-DUqpZOLt.js";
6
6
  import { ThemeAppearance as z, AppearanceSpinner as D } from "../../enums/appearance.js";
7
7
  import G from "../Checkbox/Checkbox.js";
8
8
  import oe from "../Loading/Loading.js";
9
9
  import le from "../ScrollContainer/ScrollContainer.js";
10
10
  import V from "./TableHeader.js";
11
- import ie from "./TableSort.js";
12
- import de from "../Icon/index.js";
11
+ import de from "./TableSort.js";
12
+ import ie from "../Icon/index.js";
13
13
  import { Icons as ce } from "../../assets/icons/icons.js";
14
14
  import { i as u } from "../../includes-8YTFrx85.js";
15
- import { _ as W, k as he } from "../../keys-B0bo5Q7o.js";
16
- import { _ as U, a as pe, b as fe } from "../../_reduce-DsUCMz4O.js";
15
+ import { _ as W, k as pe } from "../../keys-B0bo5Q7o.js";
16
+ import { _ as U, a as he, b as fe } from "../../_reduce-DsUCMz4O.js";
17
17
  import { _ as xe } from "../../Select-BE_y91ZN.js";
18
- function ue(o, a) {
19
- for (var n = 0, d = a.length, h = []; n < d; )
20
- o(a[n]) && (h[h.length] = a[n]), n += 1;
21
- return h;
18
+ function ue(l, t) {
19
+ for (var n = 0, i = t.length, p = []; n < i; )
20
+ l(t[n]) && (p[p.length] = t[n]), n += 1;
21
+ return p;
22
22
  }
23
23
  var ge = /* @__PURE__ */ function() {
24
- function o(a, n) {
25
- this.xf = n, this.f = a;
24
+ function l(t, n) {
25
+ this.xf = n, this.f = t;
26
26
  }
27
- return o.prototype["@@transducer/init"] = U.init, o.prototype["@@transducer/result"] = U.result, o.prototype["@@transducer/step"] = function(a, n) {
28
- return this.f(n) ? this.xf["@@transducer/step"](a, n) : a;
29
- }, o;
30
- }(), je = /* @__PURE__ */ W(function(a, n) {
31
- return new ge(a, n);
27
+ return l.prototype["@@transducer/init"] = U.init, l.prototype["@@transducer/result"] = U.result, l.prototype["@@transducer/step"] = function(t, n) {
28
+ return this.f(n) ? this.xf["@@transducer/step"](t, n) : t;
29
+ }, l;
30
+ }(), be = /* @__PURE__ */ W(function(t, n) {
31
+ return new ge(t, n);
32
32
  });
33
- const me = je;
33
+ const je = be;
34
34
  var k = /* @__PURE__ */ W(
35
- /* @__PURE__ */ pe(["filter"], me, function(o, a) {
36
- return xe(a) ? fe(function(n, d) {
37
- return o(a[d]) && (n[d] = a[d]), n;
38
- }, {}, he(a)) : (
35
+ /* @__PURE__ */ he(["filter"], je, function(l, t) {
36
+ return xe(t) ? fe(function(n, i) {
37
+ return l(t[i]) && (n[i] = t[i]), n;
38
+ }, {}, pe(t)) : (
39
39
  // else
40
- ue(o, a)
40
+ ue(l, t)
41
41
  );
42
42
  })
43
43
  );
44
- const Oe = (o) => {
44
+ const Oe = (l) => {
45
45
  const {
46
- columns: a = [],
46
+ columns: t = [],
47
47
  dataSource: n = [],
48
- totalCount: d,
49
- currentPage: h,
48
+ totalCount: i,
49
+ currentPage: p,
50
50
  className: X,
51
51
  wrapperClass: B,
52
52
  title: K,
53
- rowSelection: j = !1,
53
+ rowSelection: b = !1,
54
54
  actionOnChange: S,
55
55
  rowSelectionChange: c,
56
56
  pagerVisible: _,
57
- pagerOnChange: R,
58
- columnRenderer: y,
59
- pageSizeOnChange: v,
60
- pageSize: L,
57
+ pagerOnChange: E,
58
+ columnRenderer: R,
59
+ pageSizeOnChange: y,
60
+ pageSize: v,
61
61
  headerVisible: P = !0,
62
62
  headerLeftItem: q,
63
63
  customFooterItem: J,
64
64
  isLoading: M = !1,
65
65
  footerAction: Q = !0,
66
66
  pageSizeVisible: Y = !0,
67
- appearance: m = z.LIGHT,
67
+ appearance: j = z.LIGHT,
68
68
  fixedHeader: Z,
69
- showItemsText: H,
70
- customHeader: T,
71
- selectedItems: $ = [],
69
+ showItemsText: L,
70
+ customHeader: H,
71
+ selectedItems: T = [],
72
72
  scrollClass: I,
73
73
  disabledItems: g = [],
74
- expandable: l
75
- } = o, [p, C] = F($), [A, b] = F([]), ee = (e) => {
76
- c && (e.target.checked ? (C(
74
+ expandable: o
75
+ } = l, [h, w] = F(T), [$, C] = F([]), ee = (e) => {
76
+ c && (e.target.checked ? (w(
77
77
  n.filter((s) => !u(s, g))
78
78
  ), c(
79
79
  n.filter((s) => !u(s, g))
80
- )) : (C([]), c([])));
81
- }, te = (e, s) => {
82
- c && (e.target.checked ? (C([...p, s]), c([...p, s])) : (C(
83
- k((r) => r.pk !== s.pk, p)
80
+ )) : (w([]), c([])));
81
+ }, re = (e, s) => {
82
+ c && (e.target.checked ? (w([...h, s]), c([...h, s])) : (w(
83
+ k((a) => a.pk !== s.pk, h)
84
84
  ), c(
85
- k((r) => r.pk !== s.pk, p)
85
+ k((a) => a.pk !== s.pk, h)
86
86
  )));
87
- }, re = (e, s) => {
88
- var i;
89
- const r = u(e, A);
90
- b(r ? (f) => k((w) => w !== e, f) : (f) => [...f, e]), (i = l == null ? void 0 : l.onExpand) == null || i.call(l, !r, s);
91
- }, ae = (e, s) => e == null ? void 0 : e.map((r, i) => /* @__PURE__ */ t.jsx(
87
+ }, ae = (e, s) => {
88
+ var d;
89
+ const a = u(e, $);
90
+ C(a ? (f) => k((N) => N !== e, f) : (f) => [...f, e]), (d = o == null ? void 0 : o.onExpand) == null || d.call(o, !a, s);
91
+ }, te = (e, s) => e == null ? void 0 : e.map((a, d) => /* @__PURE__ */ r.jsx(
92
92
  "td",
93
93
  {
94
- width: r.width,
94
+ width: a.width,
95
95
  onClick: (f) => {
96
- r != null && r.onClick && (r == null || r.onClick(f, s, r, i));
96
+ a != null && a.onClick && (a == null || a.onClick(f, s, a, d));
97
97
  },
98
- className: N(r.className, r.tdClassName),
99
- children: r.render ? r.render(s[r.dataIndex], s) : s[r.dataIndex]
98
+ className: m(a.className, a.tdClassName),
99
+ children: a.render ? a.render(s[a.dataIndex], s) : s[a.dataIndex]
100
100
  },
101
- `col-${i}`
101
+ `col-${d}`
102
102
  ));
103
103
  return O(() => {
104
- c && c($.filter((e) => !u(e, g)));
105
- }, [p, g]), O(() => {
106
- b([]);
107
- }, [h]), /* @__PURE__ */ t.jsxs(
104
+ c && c(T.filter((e) => !u(e, g)));
105
+ }, [h, g]), O(() => {
106
+ C([]);
107
+ }, [p]), /* @__PURE__ */ r.jsxs(
108
108
  "div",
109
109
  {
110
110
  "data-testid": "table-container",
111
- className: N(x.wrapper, B, {
112
- [x[`${m}`]]: m
111
+ className: m(x.wrapper, B, {
112
+ [x[`${j}`]]: j
113
113
  }),
114
114
  children: [
115
- P && /* @__PURE__ */ t.jsx(
115
+ P && /* @__PURE__ */ r.jsx(
116
116
  V,
117
117
  {
118
118
  title: K,
119
- showItemsText: H,
119
+ showItemsText: L,
120
120
  actionOnChange: S,
121
- pageSize: L,
122
- pageSizeOnChange: v,
123
- pagerOnChange: R,
121
+ pageSize: v,
122
+ pageSizeOnChange: y,
123
+ pagerOnChange: E,
124
124
  pagerVisible: _,
125
- totalCount: d,
126
- currentPage: h
125
+ totalCount: i,
126
+ currentPage: p
127
127
  }
128
128
  ),
129
- /* @__PURE__ */ t.jsxs("div", { className: x.tableWrap, children: [
130
- M && /* @__PURE__ */ t.jsx(
129
+ /* @__PURE__ */ r.jsxs("div", { className: x.tableWrap, children: [
130
+ M && /* @__PURE__ */ r.jsx(
131
131
  oe,
132
132
  {
133
133
  wrapperClass: x.tableLoading,
134
- appearance: m === z.LIGHT ? D.LIGHT : D.DARK
134
+ appearance: j === z.LIGHT ? D.LIGHT : D.DARK
135
135
  }
136
136
  ),
137
- T && T,
138
- /* @__PURE__ */ t.jsx(le, { className: I || x.scrollWrap, children: /* @__PURE__ */ t.jsxs(
137
+ H && H,
138
+ /* @__PURE__ */ r.jsx(le, { className: I || x.scrollWrap, children: /* @__PURE__ */ r.jsxs(
139
139
  "table",
140
140
  {
141
141
  "data-testid": "table-content",
142
- className: N(x.table, X, {
142
+ className: m(x.table, X, {
143
143
  [x.fixed]: Z
144
144
  }),
145
145
  children: [
146
- /* @__PURE__ */ t.jsx("thead", { "data-testid": "table-head", children: /* @__PURE__ */ t.jsxs("tr", { "data-testid": "table-row", children: [
147
- l && /* @__PURE__ */ t.jsx("th", { className: "w-[48px]" }),
148
- j && /* @__PURE__ */ t.jsx("th", { className: "w-[26px]", children: /* @__PURE__ */ t.jsx(
146
+ /* @__PURE__ */ r.jsx("thead", { "data-testid": "table-head", children: /* @__PURE__ */ r.jsxs("tr", { "data-testid": "table-row", children: [
147
+ o && /* @__PURE__ */ r.jsx("th", { className: "w-[48px]" }),
148
+ b && /* @__PURE__ */ r.jsx("th", { className: "w-[26px]", children: /* @__PURE__ */ r.jsx(
149
149
  G,
150
150
  {
151
151
  name: "selectAll",
152
152
  isDisabled: n.length === 0,
153
- checked: n.length > 0 && n.length === p.length,
153
+ checked: n.length > 0 && n.length === h.length,
154
154
  onChange: ee
155
155
  }
156
156
  ) }),
157
- a == null ? void 0 : a.map((e, s) => {
158
- var r, i;
159
- return e.sortable ? /* @__PURE__ */ t.jsx(
157
+ t == null ? void 0 : t.map((e, s) => {
158
+ var a, d;
159
+ return e.sortable ? /* @__PURE__ */ r.jsx(
160
160
  "th",
161
161
  {
162
162
  "data-testid": "table-head-item",
163
163
  style: { width: e.width },
164
164
  className: e.className,
165
- children: /* @__PURE__ */ t.jsx(
166
- ie,
165
+ children: /* @__PURE__ */ r.jsx(
166
+ de,
167
167
  {
168
- title: (r = e.title) == null ? void 0 : r.toString().toLocaleUpperCase(),
169
- onClick: (f, w) => {
170
- var E;
171
- return (E = e == null ? void 0 : e.onSort) == null ? void 0 : E.call(e, f, w);
168
+ title: (a = e.title) == null ? void 0 : a.toString().toLocaleUpperCase(),
169
+ onClick: (f, N) => {
170
+ var A;
171
+ return (A = e == null ? void 0 : e.onSort) == null ? void 0 : A.call(e, f, N);
172
172
  }
173
173
  }
174
174
  )
175
175
  },
176
176
  `table-header-${s}`
177
- ) : /* @__PURE__ */ t.jsx(
177
+ ) : /* @__PURE__ */ r.jsx(
178
178
  "th",
179
179
  {
180
180
  "data-testid": "table-head-item",
181
181
  style: { width: e.width },
182
182
  className: e.className,
183
- children: typeof e.title == "string" || e.title instanceof String ? (i = e.title) == null ? void 0 : i.toString().toLocaleUpperCase() : e.title
183
+ children: typeof e.title == "string" || e.title instanceof String ? (d = e.title) == null ? void 0 : d.toString().toLocaleUpperCase() : e.title
184
184
  },
185
185
  `table-header-${s}`
186
186
  );
187
187
  })
188
188
  ] }) }),
189
- /* @__PURE__ */ t.jsx("tbody", { "data-testid": "table-body", children: n.length > 0 ? n.map((e, s) => {
190
- const r = u(s, A);
191
- return /* @__PURE__ */ t.jsxs(se.Fragment, { children: [
192
- /* @__PURE__ */ t.jsxs("tr", { children: [
193
- l && /* @__PURE__ */ t.jsx(
194
- "td",
195
- {
196
- className: "text-center cursor-pointer pr-[0]!",
197
- onClick: () => re(s, e),
198
- children: /* @__PURE__ */ t.jsx(
189
+ /* @__PURE__ */ r.jsx("tbody", { "data-testid": "table-body", children: n.length > 0 ? n.map((e, s) => {
190
+ const a = u(s, $);
191
+ return /* @__PURE__ */ r.jsxs(se.Fragment, { children: [
192
+ /* @__PURE__ */ r.jsxs(
193
+ "tr",
194
+ {
195
+ "data-testid": "table-row",
196
+ onClick: () => {
197
+ o && o.rowExpandable && o.rowExpandable(e) && ae(s, e);
198
+ },
199
+ className: m({
200
+ "cursor-pointer": o && o.rowExpandable ? o.rowExpandable(e) : o
201
+ }),
202
+ children: [
203
+ o && /* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsx(
199
204
  "span",
200
205
  {
201
206
  className: "inline-block transition-transform duration-200",
202
207
  style: {
203
- transform: r ? "rotate(90deg)" : "rotate(0deg)"
208
+ transform: a ? "rotate(90deg)" : "rotate(0deg)"
204
209
  },
205
- children: /* @__PURE__ */ t.jsx(de, { name: ce.ChevronRight })
210
+ children: o.rowExpandable && o.rowExpandable(e) ? /* @__PURE__ */ r.jsx(ie, { name: ce.ChevronRight }) : null
206
211
  }
207
- )
208
- }
209
- ),
210
- j && /* @__PURE__ */ t.jsx("td", { children: /* @__PURE__ */ t.jsx(
211
- G,
212
- {
213
- checked: u(e, p),
214
- name: `select-${s}`,
215
- onChange: (i) => te(i, e),
216
- isDisabled: u(e, g)
217
- }
218
- ) }),
219
- y ? y(a, e) : ae(a, e)
220
- ] }),
221
- l && r && /* @__PURE__ */ t.jsx("tr", { children: /* @__PURE__ */ t.jsx(
212
+ ) }),
213
+ b && /* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsx(
214
+ G,
215
+ {
216
+ checked: u(e, h),
217
+ name: `select-${s}`,
218
+ onChange: (d) => re(d, e),
219
+ isDisabled: u(e, g)
220
+ }
221
+ ) }),
222
+ R ? R(t, e) : te(t, e)
223
+ ]
224
+ },
225
+ `table-row-${s}`
226
+ ),
227
+ o && a && /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
222
228
  "td",
223
229
  {
224
- colSpan: a.length + (j ? 1 : 0) + (l ? 1 : 0),
230
+ colSpan: t.length + (b ? 1 : 0) + (o ? 1 : 0),
225
231
  className: "p-0 border-0",
226
- children: l.expandedRowRender(e)
232
+ children: o.expandedRowRender(e)
227
233
  }
228
234
  ) })
229
235
  ] }, `row-${s}`);
230
- }) : /* @__PURE__ */ t.jsx("tr", { children: /* @__PURE__ */ t.jsx(
236
+ }) : /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
231
237
  "td",
232
238
  {
233
- colSpan: a.length + (j ? 1 : 0) + (l ? 1 : 0),
234
- children: /* @__PURE__ */ t.jsx(ne, {})
239
+ colSpan: t.length + (b ? 1 : 0) + (o ? 1 : 0),
240
+ children: /* @__PURE__ */ r.jsx(ne, {})
235
241
  }
236
242
  ) }) })
237
243
  ]
238
244
  }
239
245
  ) })
240
246
  ] }),
241
- Q && /* @__PURE__ */ t.jsx(
247
+ Q && /* @__PURE__ */ r.jsx(
242
248
  V,
243
249
  {
244
250
  className: "mt-0",
245
- showItemsText: H,
251
+ showItemsText: L,
246
252
  actionOnChange: S,
247
- pageSize: L,
248
- pageSizeOnChange: v,
249
- pagerOnChange: R,
253
+ pageSize: v,
254
+ pageSizeOnChange: y,
255
+ pagerOnChange: E,
250
256
  pagerVisible: _,
251
257
  pageSizeVisible: Y,
252
- totalCount: d,
258
+ totalCount: i,
253
259
  customItem: J,
254
260
  headerLeftItem: q,
255
- currentPage: h,
256
- appearance: m
261
+ currentPage: p,
262
+ appearance: j
257
263
  }
258
264
  )
259
265
  ]
package/dist/index.d.mts CHANGED
@@ -943,13 +943,14 @@ export declare type PagerProps = {
943
943
 
944
944
  export declare const PageWrapper: (props: LayoutProps) => JSX.Element;
945
945
 
946
- export declare const Panel: ({ title, children, description, className, type, appearance, headerDescription, headerRightChild, headerClass, hasBorder, bodyClass, }: PanelProps) => JSX.Element;
946
+ export declare const Panel: ({ title, children, description, className, type, appearance, headerDescription, headerRightChild, headerClass, hasBorder, bodyClass, isLoading, }: PanelProps) => JSX.Element;
947
947
 
948
948
  export declare type PanelProps = {
949
949
  children: ReactNode;
950
950
  title?: ReactNode;
951
951
  description?: string;
952
952
  appearance?: ThemeAppearance;
953
+ isLoading?: boolean;
953
954
  className?: string;
954
955
  type?: 'line' | 'box';
955
956
  headerDescription?: string;
package/dist/index.d.ts CHANGED
@@ -943,13 +943,14 @@ export declare type PagerProps = {
943
943
 
944
944
  export declare const PageWrapper: (props: LayoutProps) => JSX.Element;
945
945
 
946
- export declare const Panel: ({ title, children, description, className, type, appearance, headerDescription, headerRightChild, headerClass, hasBorder, bodyClass, }: PanelProps) => JSX.Element;
946
+ export declare const Panel: ({ title, children, description, className, type, appearance, headerDescription, headerRightChild, headerClass, hasBorder, bodyClass, isLoading, }: PanelProps) => JSX.Element;
947
947
 
948
948
  export declare type PanelProps = {
949
949
  children: ReactNode;
950
950
  title?: ReactNode;
951
951
  description?: string;
952
952
  appearance?: ThemeAppearance;
953
+ isLoading?: boolean;
953
954
  className?: string;
954
955
  type?: 'line' | 'box';
955
956
  headerDescription?: string;