@cagatayfdn/flora-components 0.0.162 → 0.0.164

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,13 +1,14 @@
1
1
  import { j as n } from "../../jsx-runtime-BcAkpsdy.js";
2
- import { c as i } from "../../index-BHf7G3IG.js";
3
- import x from "../Icon/index.js";
4
- import '../../IconBox.css';const a = "_iconBox_jz84k_2", t = "_iconBox__primary_jz84k_2", m = "_iconBox__secondary_jz84k_2", c = {
5
- iconBox: a,
6
- iconBox__primary: t,
2
+ import { c as t } from "../../index-BHf7G3IG.js";
3
+ import a from "../Icon/index.js";
4
+ import '../../IconBox.css';const x = "_iconBox_jz84k_2", e = "_iconBox__primary_jz84k_2", m = "_iconBox__secondary_jz84k_2", c = {
5
+ iconBox: x,
6
+ iconBox__primary: e,
7
7
  iconBox__secondary: m
8
- }, p = ({ icon: s, onClick: _, type: o = "secondary", className: r }) => /* @__PURE__ */ n.jsx("button", { className: i(c.iconBox, r, {
9
- [c[`iconBox__${o}`]]: o
10
- }), onClick: _, children: /* @__PURE__ */ n.jsx(x, { name: s }) });
8
+ }, j = ({ icon: s, onClick: _, isDisabled: r, type: o = "secondary", className: i }) => /* @__PURE__ */ n.jsx("button", { className: t(c.iconBox, i, {
9
+ [c[`iconBox__${o}`]]: o,
10
+ "pointer-events-none opacity-50": r
11
+ }), onClick: _, children: /* @__PURE__ */ n.jsx(a, { name: s }) });
11
12
  export {
12
- p as default
13
+ j as default
13
14
  };
@@ -1,7 +1,7 @@
1
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 m } from "../../index-BHf7G3IG.js";
4
+ import { c as C } from "../../index-BHf7G3IG.js";
5
5
  import { s as x } from "../../Table.module-rFa4-NE2.js";
6
6
  import { ThemeAppearance as z, AppearanceSpinner as D } from "../../enums/appearance.js";
7
7
  import G from "../Checkbox/Checkbox.js";
@@ -16,25 +16,25 @@ import { _ as W, k as pe } from "../../keys-B0bo5Q7o.js";
16
16
  import { _ as U, a as he, b as fe } from "../../_reduce-DsUCMz4O.js";
17
17
  import { _ as xe } from "../../Select-nhp2PiJK.js";
18
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;
19
+ for (var o = 0, i = t.length, p = []; o < i; )
20
+ l(t[o]) && (p[p.length] = t[o]), o += 1;
21
21
  return p;
22
22
  }
23
23
  var ge = /* @__PURE__ */ function() {
24
- function l(t, n) {
25
- this.xf = n, this.f = t;
24
+ function l(t, o) {
25
+ this.xf = o, this.f = t;
26
26
  }
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;
27
+ return l.prototype["@@transducer/init"] = U.init, l.prototype["@@transducer/result"] = U.result, l.prototype["@@transducer/step"] = function(t, o) {
28
+ return this.f(o) ? this.xf["@@transducer/step"](t, o) : t;
29
29
  }, l;
30
- }(), be = /* @__PURE__ */ W(function(t, n) {
31
- return new ge(t, n);
30
+ }(), je = /* @__PURE__ */ W(function(t, o) {
31
+ return new ge(t, o);
32
32
  });
33
- const je = be;
33
+ const be = je;
34
34
  var k = /* @__PURE__ */ W(
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;
35
+ /* @__PURE__ */ he(["filter"], be, function(l, t) {
36
+ return xe(t) ? fe(function(o, i) {
37
+ return l(t[i]) && (o[i] = t[i]), o;
38
38
  }, {}, pe(t)) : (
39
39
  // else
40
40
  ue(l, t)
@@ -44,7 +44,7 @@ var k = /* @__PURE__ */ W(
44
44
  const Oe = (l) => {
45
45
  const {
46
46
  columns: t = [],
47
- dataSource: n = [],
47
+ dataSource: o = [],
48
48
  totalCount: i,
49
49
  currentPage: p,
50
50
  className: X,
@@ -55,8 +55,8 @@ const Oe = (l) => {
55
55
  rowSelectionChange: c,
56
56
  pagerVisible: _,
57
57
  pagerOnChange: E,
58
- columnRenderer: R,
59
- pageSizeOnChange: y,
58
+ columnRenderer: y,
59
+ pageSizeOnChange: R,
60
60
  pageSize: v,
61
61
  headerVisible: P = !0,
62
62
  headerLeftItem: q,
@@ -64,22 +64,22 @@ const Oe = (l) => {
64
64
  isLoading: M = !1,
65
65
  footerAction: Q = !0,
66
66
  pageSizeVisible: Y = !0,
67
- appearance: j = z.LIGHT,
67
+ appearance: w = z.LIGHT,
68
68
  fixedHeader: Z,
69
69
  showItemsText: L,
70
70
  customHeader: H,
71
71
  selectedItems: T = [],
72
72
  scrollClass: I,
73
73
  disabledItems: g = [],
74
- expandable: o
75
- } = l, [h, w] = F(T), [$, C] = F([]), ee = (e) => {
76
- c && (e.target.checked ? (w(
77
- n.filter((s) => !u(s, g))
74
+ expandable: n
75
+ } = l, [h, m] = F(T), [$, j] = F([]), ee = (e) => {
76
+ c && (e.target.checked ? (m(
77
+ o.filter((s) => !u(s, g))
78
78
  ), c(
79
- n.filter((s) => !u(s, g))
80
- )) : (w([]), c([])));
79
+ o.filter((s) => !u(s, g))
80
+ )) : (m([]), c([])));
81
81
  }, re = (e, s) => {
82
- c && (e.target.checked ? (w([...h, s]), c([...h, s])) : (w(
82
+ c && (e.target.checked ? (m([...h, s]), c([...h, s])) : (m(
83
83
  k((a) => a.pk !== s.pk, h)
84
84
  ), c(
85
85
  k((a) => a.pk !== s.pk, h)
@@ -87,7 +87,7 @@ const Oe = (l) => {
87
87
  }, ae = (e, s) => {
88
88
  var d;
89
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);
90
+ (n == null ? void 0 : n.expandStrategy) === "single" ? j(a ? [] : [e]) : j(a ? (f) => k((N) => N !== e, f) : (f) => [...f, e]), (d = n == null ? void 0 : n.onExpand) == null || d.call(n, !a, s);
91
91
  }, te = (e, s) => e == null ? void 0 : e.map((a, d) => /* @__PURE__ */ r.jsx(
92
92
  "td",
93
93
  {
@@ -95,7 +95,7 @@ const Oe = (l) => {
95
95
  onClick: (f) => {
96
96
  a != null && a.onClick && (a == null || a.onClick(f, s, a, d));
97
97
  },
98
- className: m(a.className, a.tdClassName),
98
+ className: C(a.className, a.tdClassName),
99
99
  children: a.render ? a.render(s[a.dataIndex], s) : s[a.dataIndex]
100
100
  },
101
101
  `col-${d}`
@@ -103,13 +103,13 @@ const Oe = (l) => {
103
103
  return O(() => {
104
104
  c && c(T.filter((e) => !u(e, g)));
105
105
  }, [h, g]), O(() => {
106
- C([]);
106
+ j([]);
107
107
  }, [p]), /* @__PURE__ */ r.jsxs(
108
108
  "div",
109
109
  {
110
110
  "data-testid": "table-container",
111
- className: m(x.wrapper, B, {
112
- [x[`${j}`]]: j
111
+ className: C(x.wrapper, B, {
112
+ [x[`${w}`]]: w
113
113
  }),
114
114
  children: [
115
115
  P && /* @__PURE__ */ r.jsx(
@@ -119,7 +119,7 @@ const Oe = (l) => {
119
119
  showItemsText: L,
120
120
  actionOnChange: S,
121
121
  pageSize: v,
122
- pageSizeOnChange: y,
122
+ pageSizeOnChange: R,
123
123
  pagerOnChange: E,
124
124
  pagerVisible: _,
125
125
  totalCount: i,
@@ -131,7 +131,7 @@ const Oe = (l) => {
131
131
  oe,
132
132
  {
133
133
  wrapperClass: x.tableLoading,
134
- appearance: j === z.LIGHT ? D.LIGHT : D.DARK
134
+ appearance: w === z.LIGHT ? D.LIGHT : D.DARK
135
135
  }
136
136
  ),
137
137
  H && H,
@@ -139,18 +139,18 @@ const Oe = (l) => {
139
139
  "table",
140
140
  {
141
141
  "data-testid": "table-content",
142
- className: m(x.table, X, {
142
+ className: C(x.table, X, {
143
143
  [x.fixed]: Z
144
144
  }),
145
145
  children: [
146
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]" }),
147
+ n && /* @__PURE__ */ r.jsx("th", { className: "w-[48px]" }),
148
148
  b && /* @__PURE__ */ r.jsx("th", { className: "w-[26px]", children: /* @__PURE__ */ r.jsx(
149
149
  G,
150
150
  {
151
151
  name: "selectAll",
152
- isDisabled: n.length === 0,
153
- checked: n.length > 0 && n.length === h.length,
152
+ isDisabled: o.length === 0,
153
+ checked: o.length > 0 && o.length === h.length,
154
154
  onChange: ee
155
155
  }
156
156
  ) }),
@@ -186,7 +186,7 @@ const Oe = (l) => {
186
186
  );
187
187
  })
188
188
  ] }) }),
189
- /* @__PURE__ */ r.jsx("tbody", { "data-testid": "table-body", children: n.length > 0 ? n.map((e, s) => {
189
+ /* @__PURE__ */ r.jsx("tbody", { "data-testid": "table-body", children: o.length > 0 ? o.map((e, s) => {
190
190
  const a = u(s, $);
191
191
  return /* @__PURE__ */ r.jsxs(se.Fragment, { children: [
192
192
  /* @__PURE__ */ r.jsxs(
@@ -194,20 +194,20 @@ const Oe = (l) => {
194
194
  {
195
195
  "data-testid": "table-row",
196
196
  onClick: () => {
197
- o && o.rowExpandable && o.rowExpandable(e) && ae(s, e);
197
+ n && n.rowExpandable && n.rowExpandable(e) && ae(s, e);
198
198
  },
199
- className: m({
200
- "cursor-pointer": o && o.rowExpandable ? o.rowExpandable(e) : o
199
+ className: C({
200
+ "cursor-pointer": n && n.rowExpandable ? n.rowExpandable(e) : n
201
201
  }),
202
202
  children: [
203
- o && /* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsx(
203
+ n && /* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsx(
204
204
  "span",
205
205
  {
206
206
  className: "inline-block transition-transform duration-200",
207
207
  style: {
208
208
  transform: a ? "rotate(90deg)" : "rotate(0deg)"
209
209
  },
210
- children: o.rowExpandable && o.rowExpandable(e) ? /* @__PURE__ */ r.jsx(ie, { name: ce.ChevronRight }) : null
210
+ children: n.rowExpandable && n.rowExpandable(e) ? /* @__PURE__ */ r.jsx(ie, { name: ce.ChevronRight }) : null
211
211
  }
212
212
  ) }),
213
213
  b && /* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsx(
@@ -219,24 +219,24 @@ const Oe = (l) => {
219
219
  isDisabled: u(e, g)
220
220
  }
221
221
  ) }),
222
- R ? R(t, e) : te(t, e)
222
+ y ? y(t, e) : te(t, e)
223
223
  ]
224
224
  },
225
225
  `table-row-${s}`
226
226
  ),
227
- o && a && /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
227
+ n && a && /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
228
228
  "td",
229
229
  {
230
- colSpan: t.length + (b ? 1 : 0) + (o ? 1 : 0),
230
+ colSpan: t.length + (b ? 1 : 0) + (n ? 1 : 0),
231
231
  className: "p-0 border-0",
232
- children: o.expandedRowRender(e)
232
+ children: n.expandedRowRender(e)
233
233
  }
234
234
  ) })
235
235
  ] }, `row-${s}`);
236
236
  }) : /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
237
237
  "td",
238
238
  {
239
- colSpan: t.length + (b ? 1 : 0) + (o ? 1 : 0),
239
+ colSpan: t.length + (b ? 1 : 0) + (n ? 1 : 0),
240
240
  children: /* @__PURE__ */ r.jsx(ne, {})
241
241
  }
242
242
  ) }) })
@@ -251,7 +251,7 @@ const Oe = (l) => {
251
251
  showItemsText: L,
252
252
  actionOnChange: S,
253
253
  pageSize: v,
254
- pageSizeOnChange: y,
254
+ pageSizeOnChange: R,
255
255
  pagerOnChange: E,
256
256
  pagerVisible: _,
257
257
  pageSizeVisible: Y,
@@ -259,7 +259,7 @@ const Oe = (l) => {
259
259
  customItem: J,
260
260
  headerLeftItem: q,
261
261
  currentPage: p,
262
- appearance: j
262
+ appearance: w
263
263
  }
264
264
  )
265
265
  ]
package/dist/index.d.mts CHANGED
@@ -525,6 +525,7 @@ declare type ExpandableType = {
525
525
  expandedRowRender: (record: any) => ReactNode;
526
526
  rowExpandable?: (record: any) => boolean;
527
527
  onExpand?: (expanded: boolean, record: any) => void;
528
+ expandStrategy?: 'single' | 'multiple';
528
529
  };
529
530
 
530
531
  export declare type FetcherReturnType = {
@@ -734,12 +735,13 @@ export { i18n }
734
735
 
735
736
  export declare const Icon: (props: IconProps) => JSX.Element;
736
737
 
737
- export declare const IconBox: ({ icon, onClick, type, className }: IconBoxProps) => JSX_2.Element;
738
+ export declare const IconBox: ({ icon, onClick, isDisabled, type, className }: IconBoxProps) => JSX_2.Element;
738
739
 
739
740
  export declare type IconBoxProps = {
740
741
  icon: FloraIcons;
741
742
  onClick?: () => void;
742
743
  type?: "primary" | "secondary";
744
+ isDisabled?: boolean;
743
745
  className?: string;
744
746
  };
745
747
 
package/dist/index.d.ts CHANGED
@@ -525,6 +525,7 @@ declare type ExpandableType = {
525
525
  expandedRowRender: (record: any) => ReactNode;
526
526
  rowExpandable?: (record: any) => boolean;
527
527
  onExpand?: (expanded: boolean, record: any) => void;
528
+ expandStrategy?: 'single' | 'multiple';
528
529
  };
529
530
 
530
531
  export declare type FetcherReturnType = {
@@ -734,12 +735,13 @@ export { i18n }
734
735
 
735
736
  export declare const Icon: (props: IconProps) => JSX.Element;
736
737
 
737
- export declare const IconBox: ({ icon, onClick, type, className }: IconBoxProps) => JSX_2.Element;
738
+ export declare const IconBox: ({ icon, onClick, isDisabled, type, className }: IconBoxProps) => JSX_2.Element;
738
739
 
739
740
  export declare type IconBoxProps = {
740
741
  icon: FloraIcons;
741
742
  onClick?: () => void;
742
743
  type?: "primary" | "secondary";
744
+ isDisabled?: boolean;
743
745
  className?: string;
744
746
  };
745
747
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cagatayfdn/flora-components",
3
- "version": "0.0.162",
3
+ "version": "0.0.164",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",