@cfx-dev/ui-components 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.
@@ -1 +1 @@
1
- ._root_jdj5z_1 table{width:100%;border-collapse:collapse;border-radius:var(--border-radius-small);overflow:hidden}._root_jdj5z_1 th,._root_jdj5z_1 td{text-align:left;padding:0 calc(var(--quant) * .75);padding-bottom:1px;color:#fff;height:calc(var(--quant) * 8.75);box-sizing:border-box}._root_jdj5z_1 ._radio_jdj5z_15{display:flex;align-items:center;justify-content:center;min-width:calc(var(--quant) * 8.75)}._root_jdj5z_1 ._pointer_jdj5z_21{cursor:pointer}._root_jdj5z_1 ._selectedRow_jdj5z_24{background-color:rgba(var(--color-secondary),.4);box-shadow:0 -1px rgba(var(--color-primary),1) inset}._root_jdj5z_1 th{position:sticky;top:0;z-index:0;background-color:rgba(var(--color-bg-light),1)}._root_jdj5z_1 th ._headerContent_jdj5z_34{display:flex;align-items:center;flex-direction:row;justify-content:space-between}._root_jdj5z_1 th ._headerContent_jdj5z_34._sortable_jdj5z_40._empty_jdj5z_40{justify-content:flex-end}._root_jdj5z_1 th ._sortButton_jdj5z_43{opacity:.5;padding:calc(var(--quant) * 2)}._root_jdj5z_1 th:hover ._sortButton_jdj5z_43{opacity:1}._root_jdj5z_1 tr{box-shadow:0 -1px rgba(var(--color-bg-light),1) inset;box-sizing:border-box}._root_jdj5z_1 tr:hover{background-color:rgba(var(--color-secondary),.2)}._root_jdj5z_1 tr:hover:not(._selectedRow_jdj5z_24){box-shadow:none}._root_jdj5z_1 tr:last-child{border-bottom-left-radius:var(--border-radius-small);border-bottom-right-radius:var(--border-radius-small)}
1
+ ._root_13qg4_1 table{width:100%;border-collapse:collapse;border-radius:var(--border-radius-small);overflow:hidden}._root_13qg4_1 th,._root_13qg4_1 td{text-align:left;padding:calc(var(--quant) * 1.5) calc(var(--quant) * .75);color:#fff;height:calc(var(--quant) * 8.75);box-sizing:border-box}._root_13qg4_1 ._radio_13qg4_14{text-align:center;min-width:calc(var(--quant) * 8.75)}._root_13qg4_1 ._radio_13qg4_14 button{display:inline-flex}._root_13qg4_1 ._pointer_13qg4_21{cursor:pointer}._root_13qg4_1 ._selectedRow_13qg4_24{background-color:rgba(var(--color-secondary),.4);box-shadow:0 -1px rgba(var(--color-primary),1) inset}._root_13qg4_1 th{position:sticky;top:0;z-index:0;background-color:rgba(var(--color-bg-light),1)}._root_13qg4_1 th ._headerContent_13qg4_34{display:flex;align-items:center;flex-direction:row;justify-content:space-between}._root_13qg4_1 th ._headerContent_13qg4_34._sortable_13qg4_40._empty_13qg4_40{justify-content:flex-end}._root_13qg4_1 th ._sortButton_13qg4_43{opacity:.5;padding:calc(var(--quant) * 2)}._root_13qg4_1 th:hover ._sortButton_13qg4_43{opacity:1}._root_13qg4_1 tr{box-shadow:0 -1px rgba(var(--color-bg-light),1) inset;box-sizing:border-box}._root_13qg4_1 tr:hover{background-color:rgba(var(--color-secondary),.2)}._root_13qg4_1 tr:hover:not(._selectedRow_13qg4_24){box-shadow:none}._root_13qg4_1 tr:last-child{border-bottom-left-radius:var(--border-radius-small);border-bottom-right-radius:var(--border-radius-small)}
@@ -1,26 +1,26 @@
1
- import { jsx as t, jsxs as j } from "react/jsx-runtime";
2
- import l, { useState as C } from "react";
3
- import N from "../Checkbox/Checkbox.js";
1
+ import { jsx as t, jsxs as C } from "react/jsx-runtime";
2
+ import l, { useState as k } from "react";
3
+ import g from "../Checkbox/Checkbox.js";
4
4
  import B from "../IconButton/IconButton.js";
5
5
  import { Text as v } from "../Text/Text.js";
6
- import { clsx as z } from "../../utils/clsx.js";
7
- import '../../assets/Table.css';const $ = "_root_jdj5z_1", T = "_radio_jdj5z_15", A = "_pointer_jdj5z_21", E = "_selectedRow_jdj5z_24", O = "_headerContent_jdj5z_34", S = "_sortable_jdj5z_40", F = "_empty_jdj5z_40", H = "_sortButton_jdj5z_43", r = {
6
+ import { clsx as y } from "../../utils/clsx.js";
7
+ import '../../assets/Table.css';const $ = "_root_13qg4_1", T = "_radio_13qg4_14", j = "_pointer_13qg4_21", z = "_selectedRow_13qg4_24", A = "_headerContent_13qg4_34", E = "_sortable_13qg4_40", O = "_empty_13qg4_40", S = "_sortButton_13qg4_43", r = {
8
8
  root: $,
9
9
  radio: T,
10
- pointer: A,
11
- selectedRow: E,
12
- headerContent: O,
13
- sortable: S,
14
- empty: F,
15
- sortButton: H
10
+ pointer: j,
11
+ selectedRow: z,
12
+ headerContent: A,
13
+ sortable: E,
14
+ empty: O,
15
+ sortButton: S
16
16
  };
17
- function V(h) {
17
+ function F(h) {
18
18
  const {
19
19
  item: e,
20
20
  onSortClick: o
21
21
  } = h, s = l.useCallback(() => {
22
22
  o && o(e.sortKey || e.text);
23
- }, [e.sortKey, e.text, o]), b = z(r.headerContent, {
23
+ }, [e.sortKey, e.text, o]), b = y(r.headerContent, {
24
24
  [r.sortable]: e.sortable,
25
25
  [r.empty]: !e.text
26
26
  });
@@ -29,7 +29,7 @@ function V(h) {
29
29
  {
30
30
  className: e.sortable ? r.pointer : void 0,
31
31
  onClick: e.sortable ? s : void 0,
32
- children: /* @__PURE__ */ j("div", { className: b, children: [
32
+ children: /* @__PURE__ */ C("div", { className: b, children: [
33
33
  /* @__PURE__ */ t(v, { color: "secondary", weight: "bold", uppercase: !0, size: "xxsmall", children: e.text }),
34
34
  !!e.sortable && /* @__PURE__ */ t(
35
35
  B,
@@ -44,7 +44,7 @@ function V(h) {
44
44
  }
45
45
  );
46
46
  }
47
- function q(h) {
47
+ function H(h) {
48
48
  const {
49
49
  index: e,
50
50
  includeRadio: o = !1,
@@ -58,18 +58,18 @@ function q(h) {
58
58
  );
59
59
  }, [a, e]), _ = l.useCallback(() => {
60
60
  a(e);
61
- }, [a, e]), p = z({
61
+ }, [a, e]), p = y({
62
62
  [r.selectedRow]: s === e,
63
63
  [r.pointer]: o
64
64
  });
65
- return /* @__PURE__ */ j(
65
+ return /* @__PURE__ */ C(
66
66
  "tr",
67
67
  {
68
68
  className: p,
69
69
  onClick: o ? _ : void 0,
70
70
  children: [
71
71
  o && /* @__PURE__ */ t("td", { className: r.radio, children: /* @__PURE__ */ t(
72
- N,
72
+ g,
73
73
  {
74
74
  size: "small",
75
75
  onCheckedChange: f,
@@ -78,15 +78,15 @@ function q(h) {
78
78
  }
79
79
  ) }),
80
80
  b.map((n, u) => {
81
- let i;
82
- return l.isValidElement(n) ? i = n : m ? i = l.createElement(m, { item: n }) : i = String(n), /* @__PURE__ */ t("td", { children: i }, `item-${u}`);
81
+ let d;
82
+ return l.isValidElement(n) ? d = n : m ? d = l.createElement(m, { item: n }) : d = String(n), /* @__PURE__ */ t("td", { children: d }, `item-${u}`);
83
83
  })
84
84
  ]
85
85
  },
86
86
  `row-${e}`
87
87
  );
88
88
  }
89
- function M({
89
+ function L({
90
90
  headers: h = [],
91
91
  data: e = [],
92
92
  includeRadio: o = !1,
@@ -97,49 +97,49 @@ function M({
97
97
  sortOrder: f = "asc",
98
98
  onSortChange: _
99
99
  }) {
100
- const [p, n] = C(m), [u, i] = C(a), [k, w] = C(f), R = l.useCallback((c) => {
101
- const x = u === c && k === "asc" ? "desc" : "asc";
102
- i(c), w(x), _ == null || _(c, x);
103
- }, [_, u, k]), y = l.useCallback(
100
+ const [p, n] = k(m), [u, d] = k(a), [w, x] = k(f), q = l.useCallback((c) => {
101
+ const R = u === c && w === "asc" ? "desc" : "asc";
102
+ d(c), x(R), _ == null || _(c, R);
103
+ }, [_, u, w]), N = l.useCallback(
104
104
  (c) => {
105
- const d = c === p ? null : c;
106
- n(d), s == null || s(d);
105
+ const i = c === p ? null : c;
106
+ n(i), s == null || s(i);
107
107
  },
108
108
  [s, p]
109
109
  );
110
110
  return l.useEffect(() => {
111
111
  n(m);
112
112
  }, [m]), l.useEffect(() => {
113
- i(a);
113
+ d(a);
114
114
  }, [a]), l.useEffect(() => {
115
- w(f);
116
- }, [f]), /* @__PURE__ */ t("div", { className: r.root, children: /* @__PURE__ */ j("table", { children: [
117
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ j("tr", { children: [
115
+ x(f);
116
+ }, [f]), /* @__PURE__ */ t("div", { className: r.root, children: /* @__PURE__ */ C("table", { children: [
117
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ C("tr", { children: [
118
118
  o && /* @__PURE__ */ t("th", { "aria-label": "Select Row" }),
119
- h.map((c, d) => /* @__PURE__ */ t(
120
- V,
119
+ h.map((c, i) => /* @__PURE__ */ t(
120
+ F,
121
121
  {
122
122
  item: c,
123
- onSortClick: R
123
+ onSortClick: q
124
124
  },
125
- `header-${d}`
125
+ `header-${i}`
126
126
  ))
127
127
  ] }) }),
128
- /* @__PURE__ */ t("tbody", { children: e.map((c, d) => /* @__PURE__ */ t(
129
- q,
128
+ /* @__PURE__ */ t("tbody", { children: e.map((c, i) => /* @__PURE__ */ t(
129
+ H,
130
130
  {
131
- index: d,
131
+ index: i,
132
132
  item: c,
133
133
  includeRadio: o,
134
134
  selectedRow: p,
135
- onSelectChange: y,
135
+ onSelectChange: N,
136
136
  dataContainer: b
137
137
  },
138
- `row-${d}`
138
+ `row-${i}`
139
139
  )) })
140
140
  ] }) });
141
141
  }
142
142
  export {
143
- M as Table,
144
- V as TableHeaderItem
143
+ L as Table,
144
+ F as TableHeaderItem
145
145
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfx-dev/ui-components",
3
3
  "private": false,
4
- "version": "2.1.0",
4
+ "version": "2.1.1",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "dist/main.js",