@gobolt/genesis 0.2.1 → 0.2.3
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.
- package/dist/_virtual/index5.cjs +1 -1
- package/dist/_virtual/index5.js +4 -4
- package/dist/_virtual/index6.cjs +1 -0
- package/dist/_virtual/index6.js +7 -0
- package/dist/_virtual/index7.cjs +1 -0
- package/dist/_virtual/index7.js +4 -0
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.js +34 -21
- package/dist/components/Badge/styles.cjs +5 -7
- package/dist/components/Badge/styles.js +5 -7
- package/dist/components/Breadcrumb/index.d.ts +1 -0
- package/dist/components/Select/Select.cjs +2 -2
- package/dist/components/Select/Select.js +25 -22
- package/dist/components/Table/Table.d.ts +5 -0
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.cjs +1 -0
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.d.ts +16 -0
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.js +119 -0
- package/dist/components/Table/TableControls/SecondaryTableControlsRow.cjs +1 -0
- package/dist/components/Table/TableControls/SecondaryTableControlsRow.d.ts +11 -0
- package/dist/components/Table/TableControls/SecondaryTableControlsRow.js +72 -0
- package/dist/components/Table/TableControls/TableControls.cjs +1 -0
- package/dist/components/Table/TableControls/TableControls.d.ts +11 -5
- package/dist/components/Table/TableControls/TableControls.js +36 -0
- package/dist/components/Table/TableWithControls/TableWithControls.cjs +1 -0
- package/dist/components/Table/TableWithControls/TableWithControls.d.ts +4 -4
- package/dist/components/Table/TableWithControls/TableWithControls.js +39 -0
- package/dist/components/Table/TableWithControls/index.d.ts +1 -0
- package/dist/components/Table/TableWithControls/useTableWithControls.cjs +1 -0
- package/dist/components/Table/TableWithControls/useTableWithControls.d.ts +28 -0
- package/dist/components/Table/TableWithControls/useTableWithControls.js +133 -0
- package/dist/components/Table/__mocks__/table-mocks.cjs +1 -0
- package/dist/components/Table/__mocks__/table-mocks.js +63 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/useTable.cjs +1 -0
- package/dist/components/Table/useTable.d.ts +23 -0
- package/dist/components/Table/useTable.js +66 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +48 -42
- package/dist/node_modules/antd/es/typography/hooks/useCopyClick.cjs +1 -1
- package/dist/node_modules/antd/es/typography/hooks/useCopyClick.js +1 -1
- package/dist/node_modules/debounce/index.cjs +1 -0
- package/dist/node_modules/debounce/index.js +44 -0
- package/dist/node_modules/react-icons/fi/index.cjs +1 -0
- package/dist/node_modules/react-icons/fi/index.js +8 -0
- package/dist/node_modules/react-icons/hi/index.cjs +1 -1
- package/dist/node_modules/react-icons/hi/index.js +22 -6
- package/dist/node_modules/react-icons/hi2/index.cjs +1 -0
- package/dist/node_modules/react-icons/hi2/index.js +8 -0
- package/dist/node_modules/react-icons/lu/index.cjs +1 -0
- package/dist/node_modules/react-icons/lu/index.js +8 -0
- package/dist/node_modules/react-icons/tb/index.cjs +1 -1
- package/dist/node_modules/react-icons/tb/index.js +6 -2
- package/dist/utils/icon-util.cjs +1 -1
- package/dist/utils/icon-util.js +44 -31
- package/package.json +3 -2
- package/dist/components/Table/TableControls/PrimaryTableControls.d.ts +0 -15
- package/dist/components/Table/TableControls/SecondaryTableControls.d.ts +0 -10
- package/dist/components/Table/__stories__/use-table-hook.d.ts +0 -9
- package/dist/components/Table/use-table-hook.d.ts +0 -23
package/dist/_virtual/index5.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e=require("./_commonjsHelpers.cjs"),r=require("../node_modules/debounce/index.cjs");var o=r.__require();const s=e.getDefaultExportFromCjs(o);module.exports=s;
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getDefaultExportFromCjs as
|
|
2
|
-
import { __require as r } from "../node_modules/
|
|
3
|
-
var
|
|
4
|
-
const a = /* @__PURE__ */ o
|
|
1
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as r } from "../node_modules/debounce/index.js";
|
|
3
|
+
var o = /* @__PURE__ */ r();
|
|
4
|
+
const a = /* @__PURE__ */ e(o);
|
|
5
5
|
export {
|
|
6
6
|
a as default
|
|
7
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("./_commonjsHelpers.cjs"),e=require("../node_modules/copy-to-clipboard/index.cjs");var o=e.__require();const s=r.getDefaultExportFromCjs(o);module.exports=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),u=require("./styles.cjs"),i=require("../../utils/icon-util.cjs"),f=require("../../node_modules/react-icons/hi/index.cjs"),x=require("../../providers/useGenesis.cjs"),p=require("../Typography/Typography.cjs"),d=!1,y=({label:o,state:e="info",isDisabled:r,hasClose:t=!1,onClick:a,size:g="normal",...c})=>{const{theme:s}=x.useGenesis(),l=t?"button":"badge";return o?n.jsxs(u.Badge,{label:o,role:l,onClick:a,state:e,disabled:r,style:{cursor:l==="button"?"pointer":"default"},...c,children:[i.getBadgeStateIcon(e,s.colors.status[e].onsurface,d),n.jsx(p,{variant:g==="small"?"label3":"label2",color:r?s.colors.status.disabled.default:s.colors.status[e].onsurface,isDisabled:r,children:o}),t?n.jsx(f.HiOutlineX,{color:s.colors.status[e].onsurface}):null]}):n.jsx(u.Badge,{label:o,role:"badge",state:e,disabled:r,style:{padding:"4px 4px"},...c,children:n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:i.getBadgeStateIcon(e,s.colors.status[e].onsurface,d)})})};module.exports=y;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { Badge as a } from "./styles.js";
|
|
3
|
-
import { getBadgeStateIcon as
|
|
3
|
+
import { getBadgeStateIcon as d } from "../../utils/icon-util.js";
|
|
4
4
|
import { HiOutlineX as p } from "../../node_modules/react-icons/hi/index.js";
|
|
5
5
|
import { useGenesis as g } from "../../providers/useGenesis.js";
|
|
6
|
-
import
|
|
7
|
-
const
|
|
6
|
+
import y from "../Typography/Typography.js";
|
|
7
|
+
const i = !1, v = ({
|
|
8
8
|
label: e,
|
|
9
9
|
state: o = "info",
|
|
10
10
|
isDisabled: n,
|
|
11
11
|
hasClose: l = !1,
|
|
12
|
-
onClick:
|
|
13
|
-
size:
|
|
14
|
-
...
|
|
12
|
+
onClick: u,
|
|
13
|
+
size: f = "normal",
|
|
14
|
+
...s
|
|
15
15
|
}) => {
|
|
16
16
|
const { theme: r } = g(), c = l ? "button" : "badge";
|
|
17
17
|
return e ? /* @__PURE__ */ m(
|
|
@@ -19,41 +19,54 @@ const d = !1, v = ({
|
|
|
19
19
|
{
|
|
20
20
|
label: e,
|
|
21
21
|
role: c,
|
|
22
|
-
onClick:
|
|
22
|
+
onClick: u,
|
|
23
23
|
state: o,
|
|
24
24
|
disabled: n,
|
|
25
25
|
style: { cursor: c === "button" ? "pointer" : "default" },
|
|
26
|
-
...
|
|
26
|
+
...s,
|
|
27
27
|
children: [
|
|
28
|
-
|
|
28
|
+
d(
|
|
29
29
|
o,
|
|
30
30
|
r.colors.status[o].onsurface,
|
|
31
|
-
|
|
31
|
+
i
|
|
32
32
|
),
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
33
|
+
/* @__PURE__ */ t(
|
|
34
|
+
y,
|
|
35
35
|
{
|
|
36
|
-
variant:
|
|
36
|
+
variant: f === "small" ? "label3" : "label2",
|
|
37
37
|
color: n ? r.colors.status.disabled.default : r.colors.status[o].onsurface,
|
|
38
38
|
isDisabled: n,
|
|
39
39
|
children: e
|
|
40
40
|
}
|
|
41
41
|
),
|
|
42
|
-
l ? /* @__PURE__ */
|
|
42
|
+
l ? /* @__PURE__ */ t(p, { color: r.colors.status[o].onsurface }) : null
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
|
-
) : /* @__PURE__ */
|
|
45
|
+
) : /* @__PURE__ */ t(
|
|
46
46
|
a,
|
|
47
47
|
{
|
|
48
48
|
label: e,
|
|
49
49
|
role: "badge",
|
|
50
50
|
state: o,
|
|
51
51
|
disabled: n,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
style: {
|
|
53
|
+
padding: "4px 4px"
|
|
54
|
+
},
|
|
55
|
+
...s,
|
|
56
|
+
children: /* @__PURE__ */ t(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
style: {
|
|
60
|
+
display: "flex",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
alignItems: "center"
|
|
63
|
+
},
|
|
64
|
+
children: d(
|
|
65
|
+
o,
|
|
66
|
+
r.colors.status[o].onsurface,
|
|
67
|
+
i
|
|
68
|
+
)
|
|
69
|
+
}
|
|
57
70
|
)
|
|
58
71
|
}
|
|
59
72
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../utils/styled.cjs"),a=(o,r)=>r==="hollow"?o.colors.inputs.surface.border:o.colors.status[r].surface,n=(o,r,d,s)=>`
|
|
2
2
|
display: flex;
|
|
3
3
|
gap: 4px;
|
|
4
4
|
justify-content: center;
|
|
@@ -11,14 +11,12 @@
|
|
|
11
11
|
border-radius: ${o.components.badge.radius}px;
|
|
12
12
|
border: 1px solid ${a(o,r)};
|
|
13
13
|
background-color: ${o.colors.status[r].surface};
|
|
14
|
-
width: ${s?"auto":"24px"};
|
|
15
|
-
height: ${s?"auto":"24px"};
|
|
16
14
|
|
|
17
15
|
&:not(:disabled):hover {
|
|
18
16
|
background-color: ${o.colors.status[r]["surface-hover"]};
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
${
|
|
19
|
+
${s?`
|
|
22
20
|
background-color: ${o.colors.status.disabled.surface} !important;
|
|
23
21
|
border-color: ${o.colors.status.disabled} !important;
|
|
24
22
|
border: none;
|
|
@@ -28,6 +26,6 @@
|
|
|
28
26
|
cursor: not-allowed;
|
|
29
27
|
}
|
|
30
28
|
`:""}
|
|
31
|
-
`,e
|
|
32
|
-
${({theme:o,state:r,label:
|
|
33
|
-
`;exports.Badge=
|
|
29
|
+
`,t=e.styled.div`
|
|
30
|
+
${({theme:o,state:r,label:d,disabled:s})=>n(o,r,d,s)}
|
|
31
|
+
`;exports.Badge=t;exports.getGenesisClass=n;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled as n } from "../../utils/styled.js";
|
|
2
|
-
const a = (o, r) => r === "hollow" ? o.colors.inputs.surface.border : o.colors.status[r].surface, t = (o, r,
|
|
2
|
+
const a = (o, r) => r === "hollow" ? o.colors.inputs.surface.border : o.colors.status[r].surface, t = (o, r, s, d) => `
|
|
3
3
|
display: flex;
|
|
4
4
|
gap: 4px;
|
|
5
5
|
justify-content: center;
|
|
@@ -12,14 +12,12 @@ const a = (o, r) => r === "hollow" ? o.colors.inputs.surface.border : o.colors.s
|
|
|
12
12
|
border-radius: ${o.components.badge.radius}px;
|
|
13
13
|
border: 1px solid ${a(o, r)};
|
|
14
14
|
background-color: ${o.colors.status[r].surface};
|
|
15
|
-
width: ${d ? "auto" : "24px"};
|
|
16
|
-
height: ${d ? "auto" : "24px"};
|
|
17
15
|
|
|
18
16
|
&:not(:disabled):hover {
|
|
19
17
|
background-color: ${o.colors.status[r]["surface-hover"]};
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
${
|
|
20
|
+
${d ? `
|
|
23
21
|
background-color: ${o.colors.status.disabled.surface} !important;
|
|
24
22
|
border-color: ${o.colors.status.disabled} !important;
|
|
25
23
|
border: none;
|
|
@@ -29,10 +27,10 @@ const a = (o, r) => r === "hollow" ? o.colors.inputs.surface.border : o.colors.s
|
|
|
29
27
|
cursor: not-allowed;
|
|
30
28
|
}
|
|
31
29
|
` : ""}
|
|
32
|
-
`,
|
|
33
|
-
${({ theme: o, state: r, label:
|
|
30
|
+
`, e = n.div`
|
|
31
|
+
${({ theme: o, state: r, label: s, disabled: d }) => t(o, r, s, d)}
|
|
34
32
|
`;
|
|
35
33
|
export {
|
|
36
|
-
|
|
34
|
+
e as Badge,
|
|
37
35
|
t as getGenesisClass
|
|
38
36
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),d=require("react"),p=require("../../constants/index.cjs"),x=require("./DropdownChevron.cjs"),s=require("./styles.cjs"),m=require("../../providers/useGenesis.cjs"),f=({type:r=p.TYPE.primary,state:c,variant:u="none",defaultValue:j,onChange:n,...i})=>{const{breakpoint:q}=m.useGenesis(),[l,o]=d.useState(!1);d.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
|
|
2
2
|
.ant-select-dropdown {
|
|
3
3
|
padding: 0px !important;
|
|
4
4
|
border-radius: 0px !important;
|
|
5
5
|
}
|
|
6
|
-
`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]);const a=e=>
|
|
6
|
+
`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]);const a=e=>t.jsx(s.SelectDropdown,{type:r,state:c,children:t.jsx(s.StyledMenuItem,{type:r,state:c,children:e})});return t.jsx(s.SelectWrapper,{$isFocused:l,type:r,children:t.jsx(s.Select,{...i,$variant:u,suffixIcon:t.jsx(x,{}),dropdownRender:a,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{o(!1),n==null||n(e)}})})};module.exports=f;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { TYPE as
|
|
4
|
-
import
|
|
5
|
-
import { SelectWrapper as
|
|
6
|
-
import { useGenesis as
|
|
7
|
-
const
|
|
8
|
-
type: t =
|
|
9
|
-
state:
|
|
10
|
-
variant:
|
|
11
|
-
defaultValue:
|
|
12
|
-
onChange:
|
|
13
|
-
...
|
|
2
|
+
import m, { useEffect as u } from "react";
|
|
3
|
+
import { TYPE as i } from "../../constants/index.js";
|
|
4
|
+
import p from "./DropdownChevron.js";
|
|
5
|
+
import { SelectWrapper as a, Select as f, SelectDropdown as S, StyledMenuItem as w } from "./styles.js";
|
|
6
|
+
import { useGenesis as x } from "../../providers/useGenesis.js";
|
|
7
|
+
const y = ({
|
|
8
|
+
type: t = i.primary,
|
|
9
|
+
state: d,
|
|
10
|
+
variant: s = "none",
|
|
11
|
+
defaultValue: h,
|
|
12
|
+
onChange: r,
|
|
13
|
+
...c
|
|
14
14
|
}) => {
|
|
15
|
-
const { breakpoint:
|
|
16
|
-
return
|
|
15
|
+
const { breakpoint: D } = x(), [l, n] = m.useState(!1);
|
|
16
|
+
return u(() => {
|
|
17
17
|
const e = document.createElement("style");
|
|
18
18
|
return e.textContent = `
|
|
19
19
|
.ant-select-dropdown {
|
|
@@ -23,18 +23,21 @@ const b = ({
|
|
|
23
23
|
`, document.head.appendChild(e), () => {
|
|
24
24
|
document.head.removeChild(e);
|
|
25
25
|
};
|
|
26
|
-
}, []), /* @__PURE__ */ o(
|
|
27
|
-
|
|
26
|
+
}, []), /* @__PURE__ */ o(a, { $isFocused: l, type: t, children: /* @__PURE__ */ o(
|
|
27
|
+
f,
|
|
28
28
|
{
|
|
29
|
-
...
|
|
30
|
-
$variant:
|
|
31
|
-
suffixIcon: /* @__PURE__ */ o(
|
|
32
|
-
dropdownRender: (e) => /* @__PURE__ */ o(
|
|
29
|
+
...c,
|
|
30
|
+
$variant: s,
|
|
31
|
+
suffixIcon: /* @__PURE__ */ o(p, {}),
|
|
32
|
+
dropdownRender: (e) => /* @__PURE__ */ o(S, { type: t, state: d, children: /* @__PURE__ */ o(w, { type: t, state: d, children: e }) }),
|
|
33
33
|
onFocus: () => n(!0),
|
|
34
|
-
onBlur: () => n(!1)
|
|
34
|
+
onBlur: () => n(!1),
|
|
35
|
+
onChange: (e) => {
|
|
36
|
+
n(!1), r == null || r(e);
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
) });
|
|
37
40
|
};
|
|
38
41
|
export {
|
|
39
|
-
|
|
42
|
+
y as default
|
|
40
43
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ColumnType } from 'antd/es/table';
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
export type ActionEvent = {
|
|
4
|
+
event: string;
|
|
5
|
+
payload: any;
|
|
6
|
+
};
|
|
7
|
+
export type Change = (actionEvent: ActionEvent) => void;
|
|
3
8
|
export type SelectionType = "checkbox" | "radio";
|
|
4
9
|
export interface TableProps<T extends Record<string, any>> {
|
|
5
10
|
dataSource: T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),j=require("../../../node_modules/react-icons/hi2/index.cjs"),c=require("../../../node_modules/react-icons/hi/index.cjs"),m=require("../../../node_modules/react-icons/fi/index.cjs"),q=require("../../../_virtual/index5.cjs"),I=require("../../Input/Input.cjs"),d=require("../../Button/UtilityButton.cjs"),f=require("../../Typography/Typography.cjs"),k=require("../../Select/Select.cjs"),S=require("../../Button/IconButton.cjs"),b=({sortOptions:s,searchByPlaceholder:p="",searchField:x="address",isSortedAscending:n=!0,onChange:t})=>{const a=i=>{const v={event:"inputChange",payload:{value:i.target.value,field:x}};q(()=>{t==null||t(v)},200)()},r=i=>{const u={event:"primaryChange",payload:{value:i}};t==null||t(u)},l=()=>{const i={event:"filterClick",payload:{}};t==null||t(i)},o=()=>{const i={event:"settingsClick",payload:{}};t==null||t(i)},y=()=>{const i={event:"orderClick",payload:{value:n?"desc":"asc"}};t==null||t(i)};return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",minWidth:800},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(I,{size:"normal",placeholder:p,prefix:e.jsx(c.HiSearch,{}),style:{padding:"5px 8px"},onChange:a}),l&&e.jsx(d,{isIconButton:!0,icon:e.jsx(j.HiMiniAdjustmentsVertical,{}),onClick:l}),o&&e.jsx(d,{isIconButton:!0,icon:e.jsx(m.FiSettings,{}),onClick:o})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsx(f,{variant:"body3",color:"#6C6C6C",children:"Sort by"}),s&&r?e.jsx(k,{options:s,defaultValue:s[0].value,variant:"simple",onChange:r}):null,e.jsx(S,{icon:n?e.jsx(c.HiOutlineSortDescending,{}):e.jsx(c.HiOutlineSortAscending,{}),onClick:y})]})]})};module.exports=b;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Change } from '../Table';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type SortOption = {
|
|
4
|
+
value: string;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
type SortOptions = SortOption[] | null;
|
|
8
|
+
export interface PrimaryTableControlsRowProps {
|
|
9
|
+
sortOptions: SortOptions;
|
|
10
|
+
searchByPlaceholder?: string;
|
|
11
|
+
searchField?: string;
|
|
12
|
+
isSortedAscending?: boolean;
|
|
13
|
+
onChange?: Change;
|
|
14
|
+
}
|
|
15
|
+
declare const PrimaryTableControlsRow: ({ sortOptions, searchByPlaceholder, searchField, isSortedAscending, onChange, }: PrimaryTableControlsRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default PrimaryTableControlsRow;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsxs as r, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { HiMiniAdjustmentsVertical as v } from "../../../node_modules/react-icons/hi2/index.js";
|
|
3
|
+
import { HiSearch as I, HiOutlineSortDescending as k, HiOutlineSortAscending as x } from "../../../node_modules/react-icons/hi/index.js";
|
|
4
|
+
import { FiSettings as b } from "../../../node_modules/react-icons/fi/index.js";
|
|
5
|
+
import S from "../../../_virtual/index5.js";
|
|
6
|
+
import A from "../../Input/Input.js";
|
|
7
|
+
import d from "../../Button/UtilityButton.js";
|
|
8
|
+
import E from "../../Typography/Typography.js";
|
|
9
|
+
import j from "../../Select/Select.js";
|
|
10
|
+
import B from "../../Button/IconButton.js";
|
|
11
|
+
const U = ({
|
|
12
|
+
sortOptions: l,
|
|
13
|
+
searchByPlaceholder: u = "",
|
|
14
|
+
searchField: m = "address",
|
|
15
|
+
isSortedAscending: o = !0,
|
|
16
|
+
onChange: t
|
|
17
|
+
}) => {
|
|
18
|
+
const a = (e) => {
|
|
19
|
+
const y = {
|
|
20
|
+
event: "inputChange",
|
|
21
|
+
payload: { value: e.target.value, field: m }
|
|
22
|
+
};
|
|
23
|
+
S(() => {
|
|
24
|
+
t == null || t(y);
|
|
25
|
+
}, 200)();
|
|
26
|
+
}, c = (e) => {
|
|
27
|
+
const p = {
|
|
28
|
+
event: "primaryChange",
|
|
29
|
+
payload: { value: e }
|
|
30
|
+
};
|
|
31
|
+
t == null || t(p);
|
|
32
|
+
}, n = () => {
|
|
33
|
+
const e = {
|
|
34
|
+
event: "filterClick",
|
|
35
|
+
payload: {}
|
|
36
|
+
};
|
|
37
|
+
t == null || t(e);
|
|
38
|
+
}, s = () => {
|
|
39
|
+
const e = {
|
|
40
|
+
event: "settingsClick",
|
|
41
|
+
payload: {}
|
|
42
|
+
};
|
|
43
|
+
t == null || t(e);
|
|
44
|
+
}, f = () => {
|
|
45
|
+
const e = {
|
|
46
|
+
event: "orderClick",
|
|
47
|
+
payload: {
|
|
48
|
+
value: o ? "desc" : "asc"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
t == null || t(e);
|
|
52
|
+
};
|
|
53
|
+
return /* @__PURE__ */ r(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
style: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
justifyContent: "space-between",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
width: "100%",
|
|
61
|
+
minWidth: 800
|
|
62
|
+
},
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
65
|
+
/* @__PURE__ */ i(
|
|
66
|
+
A,
|
|
67
|
+
{
|
|
68
|
+
size: "normal",
|
|
69
|
+
placeholder: u,
|
|
70
|
+
prefix: /* @__PURE__ */ i(I, {}),
|
|
71
|
+
style: {
|
|
72
|
+
padding: "5px 8px"
|
|
73
|
+
},
|
|
74
|
+
onChange: a
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
n && /* @__PURE__ */ i(
|
|
78
|
+
d,
|
|
79
|
+
{
|
|
80
|
+
isIconButton: !0,
|
|
81
|
+
icon: /* @__PURE__ */ i(v, {}),
|
|
82
|
+
onClick: n
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
s && /* @__PURE__ */ i(
|
|
86
|
+
d,
|
|
87
|
+
{
|
|
88
|
+
isIconButton: !0,
|
|
89
|
+
icon: /* @__PURE__ */ i(b, {}),
|
|
90
|
+
onClick: s
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
95
|
+
/* @__PURE__ */ i(E, { variant: "body3", color: "#6C6C6C", children: "Sort by" }),
|
|
96
|
+
l && c ? /* @__PURE__ */ i(
|
|
97
|
+
j,
|
|
98
|
+
{
|
|
99
|
+
options: l,
|
|
100
|
+
defaultValue: l[0].value,
|
|
101
|
+
variant: "simple",
|
|
102
|
+
onChange: c
|
|
103
|
+
}
|
|
104
|
+
) : null,
|
|
105
|
+
/* @__PURE__ */ i(
|
|
106
|
+
B,
|
|
107
|
+
{
|
|
108
|
+
icon: o ? /* @__PURE__ */ i(k, {}) : /* @__PURE__ */ i(x, {}),
|
|
109
|
+
onClick: f
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
export {
|
|
118
|
+
U as default
|
|
119
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),o=require("../../../utils/icon-util.cjs"),a=require("../../Typography/Typography.cjs"),d=require("../../Badge/Badge.cjs"),u=({title:s,items:i,onGroupItemClick:r})=>t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24},children:o.getIcon(s)}),t.jsx("div",{style:{display:"flex",gap:4},children:i.map(e=>t.jsx(d,{label:e,hasClose:!0,state:"generic",size:"small",onClick:()=>r(s,e)},e.toString()))})]}),p=({groups:s,onGroupItemClick:i})=>{if(!s)return null;const r=Object.entries(s).map(([e,l])=>({title:e,items:l}));return t.jsx("div",{style:{display:"flex",gap:4},children:r.map(e=>t.jsx(u,{title:e.title,items:e.items,onGroupItemClick:i},e.title))})},x=({groups:s,totalRecords:i,onChange:r})=>{const e=(l,n)=>{const c={event:"groupItemClick",payload:{title:l,item:n}};r==null||r(c)};return t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end",marginTop:8},children:[t.jsx(p,{groups:s,onGroupItemClick:e}),i?t.jsx(a,{variant:"body2",color:"#6C6C6C",children:`${i} results`}):null]})};module.exports=x;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Change } from '../Table';
|
|
2
|
+
export type Groups = {
|
|
3
|
+
[key: string]: string[];
|
|
4
|
+
};
|
|
5
|
+
export interface SecondaryTableControlsRowProps {
|
|
6
|
+
groups: Groups | null;
|
|
7
|
+
totalRecords: number | null;
|
|
8
|
+
onChange?: Change;
|
|
9
|
+
}
|
|
10
|
+
declare const SecondaryTableControlsRow: ({ groups, totalRecords, onChange, }: SecondaryTableControlsRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default SecondaryTableControlsRow;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as s, jsx as r, Fragment as a } from "react/jsx-runtime";
|
|
2
|
+
import { getIcon as p } from "../../../utils/icon-util.js";
|
|
3
|
+
import m from "../../Typography/Typography.js";
|
|
4
|
+
import d from "../../Badge/Badge.js";
|
|
5
|
+
const u = ({ title: t, items: i, onGroupItemClick: l }) => /* @__PURE__ */ s(a, { children: [
|
|
6
|
+
/* @__PURE__ */ r(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
style: {
|
|
10
|
+
display: "flex",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
width: 24,
|
|
14
|
+
height: 24
|
|
15
|
+
},
|
|
16
|
+
children: p(t)
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", gap: 4 }, children: i.map((e) => /* @__PURE__ */ r(
|
|
20
|
+
d,
|
|
21
|
+
{
|
|
22
|
+
label: e,
|
|
23
|
+
hasClose: !0,
|
|
24
|
+
state: "generic",
|
|
25
|
+
size: "small",
|
|
26
|
+
onClick: () => l(t, e)
|
|
27
|
+
},
|
|
28
|
+
e.toString()
|
|
29
|
+
)) })
|
|
30
|
+
] }), y = ({ groups: t, onGroupItemClick: i }) => {
|
|
31
|
+
if (!t) return null;
|
|
32
|
+
const l = Object.entries(t).map(([e, n]) => ({
|
|
33
|
+
title: e,
|
|
34
|
+
items: n
|
|
35
|
+
}));
|
|
36
|
+
return /* @__PURE__ */ r("div", { style: { display: "flex", gap: 4 }, children: l.map((e) => /* @__PURE__ */ r(
|
|
37
|
+
u,
|
|
38
|
+
{
|
|
39
|
+
title: e.title,
|
|
40
|
+
items: e.items,
|
|
41
|
+
onGroupItemClick: i
|
|
42
|
+
},
|
|
43
|
+
e.title
|
|
44
|
+
)) });
|
|
45
|
+
}, I = ({
|
|
46
|
+
groups: t,
|
|
47
|
+
totalRecords: i,
|
|
48
|
+
onChange: l
|
|
49
|
+
}) => /* @__PURE__ */ s(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
style: {
|
|
53
|
+
display: "flex",
|
|
54
|
+
justifyContent: "space-between",
|
|
55
|
+
alignItems: "flex-end",
|
|
56
|
+
marginTop: 8
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ r(y, { groups: t, onGroupItemClick: (n, o) => {
|
|
60
|
+
const c = {
|
|
61
|
+
event: "groupItemClick",
|
|
62
|
+
payload: { title: n, item: o }
|
|
63
|
+
};
|
|
64
|
+
l == null || l(c);
|
|
65
|
+
} }),
|
|
66
|
+
i ? /* @__PURE__ */ r(m, { variant: "body2", color: "#6C6C6C", children: `${i} results` }) : null
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
export {
|
|
71
|
+
I as default
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),i=require("./PrimaryTableControlsRow.cjs"),l=require("./SecondaryTableControlsRow.cjs"),d=({primaryTableRowData:s,secondaryTableRowData:o,onChange:n})=>{const t=e=>{n(e)},c=e=>{n(e)};return r.jsxs("div",{"data-testid":"TableControls",style:{margin:"16px 0px"},children:[r.jsx(i,{sortOptions:s.sortOptions,searchByPlaceholder:s.searchByPlaceholder,isSortedAscending:s.isSortedAscending,onChange:t}),o?r.jsx(l,{groups:o.groups,totalRecords:o.totalRecords,onChange:c}):null]})};module.exports=d;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PrimaryTableControlsRowProps } from './PrimaryTableControlsRow';
|
|
2
|
+
import { SecondaryTableControlsRowProps } from './SecondaryTableControlsRow';
|
|
3
|
+
import { Change } from '../Table';
|
|
4
|
+
export type TableControlsData = {
|
|
5
|
+
primaryTableRowData: PrimaryTableControlsRowProps;
|
|
6
|
+
secondaryTableRowData?: SecondaryTableControlsRowProps;
|
|
7
|
+
};
|
|
3
8
|
export interface TableControlsProps {
|
|
4
|
-
primaryTableRowData:
|
|
5
|
-
secondaryTableRowData
|
|
9
|
+
primaryTableRowData: PrimaryTableControlsRowProps;
|
|
10
|
+
secondaryTableRowData?: SecondaryTableControlsRowProps;
|
|
11
|
+
onChange: Change;
|
|
6
12
|
}
|
|
7
|
-
declare const TableControls: ({ primaryTableRowData, secondaryTableRowData, }: TableControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const TableControls: ({ primaryTableRowData, secondaryTableRowData, onChange, }: TableControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
14
|
export default TableControls;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import i from "./PrimaryTableControlsRow.js";
|
|
3
|
+
import c from "./SecondaryTableControlsRow.js";
|
|
4
|
+
const m = ({
|
|
5
|
+
primaryTableRowData: o,
|
|
6
|
+
secondaryTableRowData: r,
|
|
7
|
+
onChange: n
|
|
8
|
+
}) => {
|
|
9
|
+
const e = (s) => {
|
|
10
|
+
n(s);
|
|
11
|
+
}, l = (s) => {
|
|
12
|
+
n(s);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ d("div", { "data-testid": "TableControls", style: { margin: "16px 0px" }, children: [
|
|
15
|
+
/* @__PURE__ */ t(
|
|
16
|
+
i,
|
|
17
|
+
{
|
|
18
|
+
sortOptions: o.sortOptions,
|
|
19
|
+
searchByPlaceholder: o.searchByPlaceholder,
|
|
20
|
+
isSortedAscending: o.isSortedAscending,
|
|
21
|
+
onChange: e
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
r ? /* @__PURE__ */ t(
|
|
25
|
+
c,
|
|
26
|
+
{
|
|
27
|
+
groups: r.groups,
|
|
28
|
+
totalRecords: r.totalRecords,
|
|
29
|
+
onChange: l
|
|
30
|
+
}
|
|
31
|
+
) : null
|
|
32
|
+
] });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
m as default
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),g=require("../TableControls/TableControls.cjs"),i=require("../Table.cjs"),d=({tableData:s,tableControlsData:l,onChange:n})=>{const{primaryTableRowData:r,secondaryTableRowData:c}=l,{dataSource:b,columns:u,rowSelection:T}=s,h=e=>{n(e)},C=(e,a,t)=>{console.log("Table changed:",e,a,t),n({event:"tableChange",payload:{pagination:e,filters:a,sorter:t}})};return o.jsxs(o.Fragment,{children:[o.jsx(g,{primaryTableRowData:r,secondaryTableRowData:c,onChange:h}),o.jsx(i,{dataSource:b,columns:u,rowSelection:T,onChange:C})]})};module.exports=d;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TableProps } from '../../..';
|
|
2
|
-
import {
|
|
2
|
+
import { TableControlsData } from '../TableControls/TableControls';
|
|
3
3
|
export interface TableWithControlsProps {
|
|
4
|
-
tableControlsData:
|
|
4
|
+
tableControlsData: TableControlsData;
|
|
5
5
|
tableData: TableProps<Record<string, any>>;
|
|
6
|
-
|
|
6
|
+
onChange: (event: {
|
|
7
7
|
event: string;
|
|
8
8
|
payload: any;
|
|
9
9
|
}) => void;
|
|
10
10
|
}
|
|
11
|
-
declare const TableWithControls: ({ tableData, tableControlsData,
|
|
11
|
+
declare const TableWithControls: ({ tableData, tableControlsData, onChange, }: TableWithControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export default TableWithControls;
|