@caspeco/casper-ui-library 7.11.0 → 8.0.0
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/components/alert/helper.js +0 -2
- package/dist/components/checkbox/checkbox-icon.js +1 -7
- package/dist/components/menu/helper.js +0 -1
- package/dist/components/stepper/step.js +0 -1
- package/dist/components/table/index.d.ts +4 -0
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/table-cell.js +1 -1
- package/dist/components/table/table-content.d.ts +5 -0
- package/dist/components/table/table-content.d.ts.map +1 -1
- package/dist/components/table/table-row-expand-toggle-button.d.ts.map +1 -1
- package/dist/components/table/table-row-expand-toggle-button.js +23 -24
- package/dist/components/table/table-toolbar-actions.d.ts +17 -0
- package/dist/components/table/table-toolbar-actions.d.ts.map +1 -0
- package/dist/components/table/table-toolbar-actions.js +25 -0
- package/dist/components/table/table-toolbar-add-button.d.ts +13 -0
- package/dist/components/table/table-toolbar-add-button.d.ts.map +1 -0
- package/dist/components/table/table-toolbar-add-button.js +13 -0
- package/dist/components/table/table-toolbar-search.d.ts +11 -0
- package/dist/components/table/table-toolbar-search.d.ts.map +1 -0
- package/dist/components/table/table-toolbar-search.js +19 -0
- package/dist/components/table/table-toolbar-settings.d.ts +7 -0
- package/dist/components/table/table-toolbar-settings.d.ts.map +1 -0
- package/dist/components/table/table-toolbar-settings.js +59 -0
- package/dist/components/table/table-toolbar.d.ts +11 -19
- package/dist/components/table/table-toolbar.d.ts.map +1 -1
- package/dist/components/table/table-toolbar.js +49 -143
- package/dist/components/table/table-toolbar.spec.d.ts +2 -0
- package/dist/components/table/table-toolbar.spec.d.ts.map +1 -0
- package/dist/components/table/table.composition.d.ts.map +1 -1
- package/dist/components/table/table.d.ts +5 -0
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/types.d.ts +4 -1
- package/dist/components/table/types.d.ts.map +1 -1
- package/dist/index.js +63 -55
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +31 -28
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +77 -66
- package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -35
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -1
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -3
- package/dist/node_modules/date-fns/constants.js +1 -1
- package/package.json +10 -10
|
@@ -10,7 +10,6 @@ const o = (e) => {
|
|
|
10
10
|
return r.OnWarningContainer;
|
|
11
11
|
case "neutral":
|
|
12
12
|
return r.OnNeutralContainer;
|
|
13
|
-
case "success":
|
|
14
13
|
default:
|
|
15
14
|
return r.OnSuccessContainer;
|
|
16
15
|
}
|
|
@@ -24,7 +23,6 @@ const o = (e) => {
|
|
|
24
23
|
return r.WarningContainer;
|
|
25
24
|
case "neutral":
|
|
26
25
|
return r.NeutralContainer;
|
|
27
|
-
case "success":
|
|
28
26
|
default:
|
|
29
27
|
return r.SuccessContainer;
|
|
30
28
|
}
|
|
@@ -5,13 +5,7 @@ import { Minus as m } from "./icons/minus.js";
|
|
|
5
5
|
import { Plus as f } from "./icons/plus.js";
|
|
6
6
|
function p(o, c, r) {
|
|
7
7
|
if (c && !r)
|
|
8
|
-
|
|
9
|
-
case "sm":
|
|
10
|
-
return "9px";
|
|
11
|
-
case "md":
|
|
12
|
-
default:
|
|
13
|
-
return "10px";
|
|
14
|
-
}
|
|
8
|
+
return o === "sm" ? "9px" : "10px";
|
|
15
9
|
switch (o) {
|
|
16
10
|
case "sm":
|
|
17
11
|
return "14px";
|
|
@@ -4,5 +4,9 @@ export { TableContent } from './table-content.js';
|
|
|
4
4
|
export { useTableContext } from './table-context.js';
|
|
5
5
|
export { TableFilter } from './table-filter.js';
|
|
6
6
|
export { TableToolbar } from './table-toolbar.js';
|
|
7
|
+
export { TableToolbarSearch } from './table-toolbar-search.js';
|
|
8
|
+
export { TableToolbarSettings } from './table-toolbar-settings.js';
|
|
9
|
+
export { TableToolbarActions } from './table-toolbar-actions.js';
|
|
10
|
+
export { TableToolbarAddButton } from './table-toolbar-add-button.js';
|
|
7
11
|
export type { CellContext, ColumnDef, ExpandedState, Row, RowSelectionState, TableContentProps, TableProps, TableRow, TableToolbarProps, VisibilityState, } from './types.js';
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,YAAY,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,GAAG,EACH,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,eAAe,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -91,7 +91,7 @@ const X = ({
|
|
|
91
91
|
borderBottom: 0,
|
|
92
92
|
paddingLeft: A()
|
|
93
93
|
},
|
|
94
|
-
children: /* @__PURE__ */ k(j, { w: "100%", align: "center", children: [
|
|
94
|
+
children: /* @__PURE__ */ k(j, { w: "100%", h: "100%", align: "center", children: [
|
|
95
95
|
d && /* @__PURE__ */ n(G, { children: ({ isOpen: e }) => /* @__PURE__ */ k(
|
|
96
96
|
h,
|
|
97
97
|
{
|
|
@@ -49,6 +49,11 @@ export interface TableContentProps<TData extends TableData = TableData> {
|
|
|
49
49
|
portalContainerRef?: React.RefObject<HTMLElement | null>;
|
|
50
50
|
}
|
|
51
51
|
declare const TableContentInner: <TData extends TableData>({ onClickRow, onRowClickIndication, hideTableHeaderDropdown, showRowHoverStyle, stickyHeaders, virtualization, portalContainerRef, ...props }: TableContentProps<TData> & ThemeStyleProps) => import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Renders table rows and columns with support for row interactions, nested data, and virtualization.
|
|
54
|
+
*
|
|
55
|
+
* @see Docs https://caspeco.github.io/casper-ui-library/components/table
|
|
56
|
+
*/
|
|
52
57
|
export declare const TableContent: typeof TableContentInner;
|
|
53
58
|
export {};
|
|
54
59
|
//# sourceMappingURL=table-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-content.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,UAAU,qBAAqB;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,+IASjD,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,4CAuJ5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"table-content.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,UAAU,qBAAqB;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,+IASjD,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,4CAuJ5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-row-expand-toggle-button.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row-expand-toggle-button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-row-expand-toggle-button.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row-expand-toggle-button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,UAAU,+BAA+B;IACxC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,0BAA0B,qFACS,+BAA+B,6CAkC9E,CAAC"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
g,
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { memo as c } from "react";
|
|
3
|
+
import { translations as d } from "./translations.js";
|
|
4
|
+
import { IconButton as x } from "../icon-button/icon-button.js";
|
|
5
|
+
import { Icons as r } from "../icon/types.js";
|
|
6
|
+
import { ThemeSpaceVariable as g } from "../../theme/theme-types.js";
|
|
7
|
+
const w = c(
|
|
8
|
+
({ row: o, localeString: i, rowIsExpanded: a, hidden: e }) => {
|
|
9
|
+
const n = d[i], l = o.getToggleExpandedHandler(), p = (t) => {
|
|
10
|
+
t.stopPropagation(), l();
|
|
11
|
+
}, s = () => a ? `${n.collapseRow} ${o.index + 1}` : `${n.expandRow} ${o.index + 1}`;
|
|
12
|
+
return /* @__PURE__ */ m(
|
|
13
|
+
x,
|
|
15
14
|
{
|
|
16
15
|
size: "xs",
|
|
17
|
-
mr:
|
|
16
|
+
mr: g.XSmall,
|
|
18
17
|
variant: "ghost",
|
|
19
|
-
"aria-label":
|
|
20
|
-
icon:
|
|
21
|
-
onClick:
|
|
22
|
-
onKeyDown: (
|
|
23
|
-
visibility:
|
|
24
|
-
"aria-hidden":
|
|
25
|
-
tabIndex:
|
|
18
|
+
"aria-label": s(),
|
|
19
|
+
icon: a ? r.TreeViewCollapse : r.TreeViewExpand,
|
|
20
|
+
onClick: p,
|
|
21
|
+
onKeyDown: (t) => t.stopPropagation(),
|
|
22
|
+
visibility: e ? "hidden" : "initial",
|
|
23
|
+
"aria-hidden": e,
|
|
24
|
+
tabIndex: e ? -1 : 0,
|
|
26
25
|
borderRadius: "0"
|
|
27
26
|
}
|
|
28
|
-
)
|
|
27
|
+
);
|
|
29
28
|
}
|
|
30
29
|
);
|
|
31
30
|
export {
|
|
32
|
-
|
|
31
|
+
w as TableRowExpandToggleButton
|
|
33
32
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MenuList } from '../menu/index.js';
|
|
2
|
+
import { ComponentProps, ReactElement } from 'react';
|
|
3
|
+
export type TableToolbarActionsProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The MenuList content to render in the actions menu
|
|
6
|
+
*/
|
|
7
|
+
children: ReactElement<ComponentProps<typeof MenuList>, typeof MenuList>;
|
|
8
|
+
};
|
|
9
|
+
declare const TableToolbarActionsInner: ({ children }: TableToolbarActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Custom action menu for table operations. Accepts MenuList as children. Use inside TableToolbar.
|
|
12
|
+
*
|
|
13
|
+
* @see Docs https://caspeco.github.io/casper-ui-library/components/table#table-toolbar
|
|
14
|
+
*/
|
|
15
|
+
export declare const TableToolbarActions: typeof TableToolbarActionsInner;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=table-toolbar-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-toolbar-actions.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar-actions.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAQ,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrE,MAAM,MAAM,wBAAwB,GAAG;IACtC;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,CAAC;CACzE,CAAC;AAEF,QAAA,MAAM,wBAAwB,GAAI,cAAc,wBAAwB,4CAevE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAqC,OAAO,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { memo as i } from "react";
|
|
3
|
+
import { useTableContext as e } from "./table-context.js";
|
|
4
|
+
import { translations as m } from "./translations.js";
|
|
5
|
+
import { Menu as s } from "../menu/menu.js";
|
|
6
|
+
import { MenuIconButton as l } from "../menu/menu-icon-button.js";
|
|
7
|
+
import { Icons as c } from "../icon/types.js";
|
|
8
|
+
const b = ({ children: o }) => {
|
|
9
|
+
const t = e(), r = m[t.localeString];
|
|
10
|
+
return /* @__PURE__ */ n(s, { children: [
|
|
11
|
+
/* @__PURE__ */ a(
|
|
12
|
+
l,
|
|
13
|
+
{
|
|
14
|
+
icon: c.MoreVertical,
|
|
15
|
+
variant: "ghost",
|
|
16
|
+
size: "md",
|
|
17
|
+
"aria-label": r.toolbarActions
|
|
18
|
+
}
|
|
19
|
+
),
|
|
20
|
+
o
|
|
21
|
+
] });
|
|
22
|
+
}, M = i(b);
|
|
23
|
+
export {
|
|
24
|
+
M as TableToolbarActions
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IconButtonProps } from '../icon-button/index.js';
|
|
2
|
+
export type TableToolbarAddButtonProps = Omit<IconButtonProps, "icon" | "aria-label"> & {
|
|
3
|
+
"aria-label"?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const TableToolbarAddButtonInner: (props: TableToolbarAddButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Add button with icon for creating new items. Use inside TableToolbar.
|
|
8
|
+
*
|
|
9
|
+
* @see Docs https://caspeco.github.io/casper-ui-library/components/table#table-toolbar
|
|
10
|
+
*/
|
|
11
|
+
export declare const TableToolbarAddButton: typeof TableToolbarAddButtonInner;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=table-toolbar-add-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-toolbar-add-button.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar-add-button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAK5E,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,YAAY,CAAC,GAAG;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,0BAA0B,GAAI,OAAO,0BAA0B,4CAMpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAuC,OAAO,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { memo as e } from "react";
|
|
3
|
+
import { useTableContext as l } from "./table-context.js";
|
|
4
|
+
import { translations as i } from "./translations.js";
|
|
5
|
+
import { IconButton as m } from "../icon-button/icon-button.js";
|
|
6
|
+
import { Icons as s } from "../icon/types.js";
|
|
7
|
+
const c = (o) => {
|
|
8
|
+
const t = l(), a = i[t.localeString], r = o["aria-label"] ?? a.new;
|
|
9
|
+
return /* @__PURE__ */ n(m, { "aria-label": r, icon: s.Increase, variant: "secondary", ...o });
|
|
10
|
+
}, I = e(c);
|
|
11
|
+
export {
|
|
12
|
+
I as TableToolbarAddButton
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputProps } from '../input/index.js';
|
|
2
|
+
export type TableToolbarSearchProps = InputProps;
|
|
3
|
+
declare const TableToolbarSearchInner: ({ ...props }: TableToolbarSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
/**
|
|
5
|
+
* Search input with icon for filtering table data. Use inside TableToolbar.
|
|
6
|
+
*
|
|
7
|
+
* @see Docs https://caspeco.github.io/casper-ui-library/components/table#table-toolbar
|
|
8
|
+
*/
|
|
9
|
+
export declare const TableToolbarSearch: typeof TableToolbarSearchInner;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=table-toolbar-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-toolbar-search.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar-search.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAG5D,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAEjD,QAAA,MAAM,uBAAuB,GAAI,cAAc,uBAAuB,4CAWrE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAoC,OAAO,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { memo as e } from "react";
|
|
3
|
+
import { Input as t } from "../input/input.js";
|
|
4
|
+
import { Icon as m } from "../icon/icon.js";
|
|
5
|
+
import { Icons as a } from "../icon/types.js";
|
|
6
|
+
const n = ({ ...r }) => /* @__PURE__ */ o(
|
|
7
|
+
t,
|
|
8
|
+
{
|
|
9
|
+
leftElement: /* @__PURE__ */ o(m, { icon: a.Search }),
|
|
10
|
+
size: "md",
|
|
11
|
+
type: "search",
|
|
12
|
+
w: { base: "100%", md: "170px" },
|
|
13
|
+
"data-testid": "filterInput",
|
|
14
|
+
...r
|
|
15
|
+
}
|
|
16
|
+
), l = e(n);
|
|
17
|
+
export {
|
|
18
|
+
l as TableToolbarSearch
|
|
19
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings menu for column visibility and breaking content. Use inside TableToolbar.
|
|
3
|
+
*
|
|
4
|
+
* @see Docs https://caspeco.github.io/casper-ui-library/components/table#column-visibility-and-how-to-store-it
|
|
5
|
+
*/
|
|
6
|
+
export declare const TableToolbarSettings: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
//# sourceMappingURL=table-toolbar-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-toolbar-settings.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar-settings.tsx"],"names":[],"mappings":"AA8EA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,oFAAkC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as t, jsxs as r, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { Flex as p, Portal as C, Box as d } from "@chakra-ui/react";
|
|
3
|
+
import { memo as u, useCallback as a } from "react";
|
|
4
|
+
import { useTableContext as f } from "./table-context.js";
|
|
5
|
+
import { translations as k } from "./translations.js";
|
|
6
|
+
import { Menu as S } from "../menu/menu.js";
|
|
7
|
+
import { MenuButton as x } from "../menu/menu-button.js";
|
|
8
|
+
import { Icon as T } from "../icon/icon.js";
|
|
9
|
+
import { Icons as s } from "../icon/types.js";
|
|
10
|
+
import { MenuList as I } from "../menu/menu-list.js";
|
|
11
|
+
import { Text as M } from "../text/text.js";
|
|
12
|
+
import { MenuItem as m } from "../menu/menu-item.js";
|
|
13
|
+
import { Checkbox as B } from "../checkbox/checkbox.js";
|
|
14
|
+
import { MenuDivider as w } from "../menu/menu-divider.js";
|
|
15
|
+
import { Switch as y } from "../switch/switch.js";
|
|
16
|
+
import { ThemeIconSizeVariable as V, ThemeSpaceVariable as c, ThemeColorVariable as j } from "../../theme/theme-types.js";
|
|
17
|
+
const v = () => {
|
|
18
|
+
const e = f(), l = k[e.localeString], h = a(() => e.table.getAllColumns().length === Object.keys(e.breakingContentState).length && !Object.values(e.breakingContentState).includes(!1), [e.breakingContentState, e.table]), b = a(
|
|
19
|
+
(n) => {
|
|
20
|
+
const o = {};
|
|
21
|
+
e.table.getAllColumns().forEach((i) => {
|
|
22
|
+
o[i.id] = n.target.checked;
|
|
23
|
+
}), e.setBreakingContentState(o), e.onBreakingContentChange?.(o);
|
|
24
|
+
},
|
|
25
|
+
[e]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ t(p, { children: /* @__PURE__ */ r(S, { closeOnSelect: !1, isLazy: !0, children: [
|
|
28
|
+
/* @__PURE__ */ t(x, { "aria-label": l.presets, variant: "ghost", p: "unset", w: "40px", h: "40px", children: /* @__PURE__ */ t(T, { icon: s.Sliders, size: V.Medium }) }),
|
|
29
|
+
/* @__PURE__ */ t(C, { children: /* @__PURE__ */ r(I, { children: [
|
|
30
|
+
/* @__PURE__ */ t(
|
|
31
|
+
M,
|
|
32
|
+
{
|
|
33
|
+
color: j.OnSurfaceSubdued,
|
|
34
|
+
py: c.Small,
|
|
35
|
+
px: c.Medium,
|
|
36
|
+
children: l.showColumns
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ t(d, { maxHeight: "320px", overflowY: "auto", children: e.table.getAllLeafColumns().filter((n) => n.getCanHide()).map((n) => /* @__PURE__ */ r(m, { itemType: "checkbox", leftIcon: s.GripMore, children: [
|
|
40
|
+
/* @__PURE__ */ t(g, { children: n.columnDef.header }),
|
|
41
|
+
/* @__PURE__ */ t(
|
|
42
|
+
B,
|
|
43
|
+
{
|
|
44
|
+
isChecked: n.getIsVisible(),
|
|
45
|
+
onChange: n.getToggleVisibilityHandler()
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] }, n.id)) }),
|
|
49
|
+
/* @__PURE__ */ t(w, {}),
|
|
50
|
+
/* @__PURE__ */ r(m, { itemType: "switch", children: [
|
|
51
|
+
l.breakingContent,
|
|
52
|
+
/* @__PURE__ */ t(y, { onChange: b, isChecked: h() })
|
|
53
|
+
] })
|
|
54
|
+
] }) })
|
|
55
|
+
] }) });
|
|
56
|
+
}, R = u(v);
|
|
57
|
+
export {
|
|
58
|
+
R as TableToolbarSettings
|
|
59
|
+
};
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
import { MenuList } from '../menu/index.js';
|
|
2
1
|
import { ThemeStyleProps } from '../../theme/index.js';
|
|
3
|
-
import {
|
|
2
|
+
import { ReactNode } from 'react';
|
|
4
3
|
export type TableToolbarProps = {
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
* Optional title for the header above the table
|
|
7
6
|
*/
|
|
8
|
-
|
|
7
|
+
title?: string;
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* Toolbar subcomponents (TableToolbarSearch, TableToolbarSettings, TableToolbarActions, TableToolbarAddButton)
|
|
11
10
|
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* DefaultValue for the search input, e.g. if you have a persisted filter state you want to hydrate after refresh or routing.
|
|
15
|
-
*/
|
|
16
|
-
defaultValue?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Use this to add a new item. Optional.
|
|
19
|
-
*/
|
|
20
|
-
onAddNewItem?: () => void;
|
|
21
|
-
/**
|
|
22
|
-
* Use this to add a action menu. Needs a [MenuList](https://caspeco.github.io/casper-ui-library/components/menu/) to render correctly. Optional.
|
|
23
|
-
*/
|
|
24
|
-
actionMenu?: React.ReactElement<ComponentProps<typeof MenuList>, typeof MenuList>;
|
|
11
|
+
children?: ReactNode;
|
|
25
12
|
};
|
|
26
|
-
declare const TableToolbarInner: ({
|
|
13
|
+
declare const TableToolbarInner: ({ title, children, ...props }: TableToolbarProps & ThemeStyleProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Composable toolbar for tables. Accepts title prop and renders subcomponents in a responsive layout.
|
|
16
|
+
*
|
|
17
|
+
* @see Docs https://caspeco.github.io/casper-ui-library/components/table#table-toolbar
|
|
18
|
+
*/
|
|
27
19
|
export declare const TableToolbar: typeof TableToolbarInner;
|
|
28
20
|
export {};
|
|
29
21
|
//# sourceMappingURL=table-toolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-toolbar.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-toolbar.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAKN,KAAK,eAAe,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAOnF,MAAM,MAAM,iBAAiB,GAAG;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,+BAA+B,iBAAiB,GAAG,eAAe,4CAqF5F,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
|
|
@@ -1,151 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMediaQuery as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { useTableContext as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
), s = l(
|
|
37
|
-
() => /* @__PURE__ */ e(
|
|
38
|
-
P,
|
|
39
|
-
{
|
|
40
|
-
leftElement: /* @__PURE__ */ e(I, { icon: c.Search }),
|
|
41
|
-
onChange: (n) => f?.(n),
|
|
42
|
-
defaultValue: C,
|
|
43
|
-
size: "md",
|
|
44
|
-
type: "search",
|
|
45
|
-
w: { base: "100%", md: "170px" },
|
|
46
|
-
"data-testid": "filterInput"
|
|
47
|
-
}
|
|
48
|
-
),
|
|
49
|
-
[f, C]
|
|
50
|
-
), m = l(
|
|
51
|
-
() => /* @__PURE__ */ e(a, { children: /* @__PURE__ */ o(w, { closeOnSelect: !1, isLazy: !0, children: [
|
|
52
|
-
/* @__PURE__ */ e(Q, { "aria-label": r.presets, variant: "ghost", p: "unset", w: "40px", h: "40px", children: /* @__PURE__ */ e(I, { icon: c.Sliders, size: R.Medium }) }),
|
|
53
|
-
/* @__PURE__ */ e(O, { children: /* @__PURE__ */ o(W, { children: [
|
|
54
|
-
/* @__PURE__ */ e(
|
|
55
|
-
B,
|
|
56
|
-
{
|
|
57
|
-
color: L.OnSurfaceSubdued,
|
|
58
|
-
py: i.Small,
|
|
59
|
-
px: i.Medium,
|
|
60
|
-
children: r.showColumns
|
|
61
|
-
}
|
|
62
|
-
),
|
|
63
|
-
/* @__PURE__ */ e(x, { maxHeight: "320px", overflowY: "auto", children: t.table.getAllLeafColumns().filter((n) => n.getCanHide()).map((n) => /* @__PURE__ */ o(F, { itemType: "checkbox", leftIcon: c.GripMore, children: [
|
|
64
|
-
/* @__PURE__ */ e(A, { children: n.columnDef.header }),
|
|
65
|
-
/* @__PURE__ */ e(
|
|
66
|
-
X,
|
|
67
|
-
{
|
|
68
|
-
isChecked: n.getIsVisible(),
|
|
69
|
-
onChange: n.getToggleVisibilityHandler()
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
] }, n.id)) }),
|
|
73
|
-
/* @__PURE__ */ e(Y, {}),
|
|
74
|
-
/* @__PURE__ */ o(F, { itemType: "switch", children: [
|
|
75
|
-
r.breakingContent,
|
|
76
|
-
/* @__PURE__ */ e(q, { onChange: T, isChecked: S() })
|
|
77
|
-
] })
|
|
78
|
-
] }) })
|
|
79
|
-
] }) }),
|
|
80
|
-
[
|
|
81
|
-
S,
|
|
82
|
-
T,
|
|
83
|
-
t.table,
|
|
84
|
-
r.breakingContent,
|
|
85
|
-
r.presets,
|
|
86
|
-
r.showColumns
|
|
87
|
-
]
|
|
88
|
-
), d = l(
|
|
89
|
-
() => /* @__PURE__ */ e(
|
|
90
|
-
J,
|
|
91
|
-
{
|
|
92
|
-
"aria-label": r.new,
|
|
93
|
-
icon: c.Increase,
|
|
94
|
-
onClick: k,
|
|
95
|
-
variant: "secondary"
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
[k, r.new]
|
|
99
|
-
), h = l(() => p ? /* @__PURE__ */ o(w, { children: [
|
|
100
|
-
/* @__PURE__ */ e(
|
|
101
|
-
K,
|
|
102
|
-
{
|
|
103
|
-
icon: c.MoreVertical,
|
|
104
|
-
variant: "ghost",
|
|
105
|
-
size: "md",
|
|
106
|
-
"aria-label": r.toolbarActions
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
p
|
|
110
|
-
] }) : null, [p, r.toolbarActions]), u = l(
|
|
111
|
-
() => /* @__PURE__ */ e(
|
|
112
|
-
B,
|
|
113
|
-
{
|
|
114
|
-
fontSize: Z.X2Large,
|
|
115
|
-
color: L.OnBackgroundHeader,
|
|
116
|
-
fontWeight: "bold",
|
|
117
|
-
fontFamily: U.Header,
|
|
118
|
-
children: g
|
|
119
|
-
}
|
|
120
|
-
),
|
|
121
|
-
[g]
|
|
122
|
-
), V = y(
|
|
123
|
-
() => /* @__PURE__ */ e(a, { direction: "column", gap: i.Medium, mb: i.Medium, children: /* @__PURE__ */ o(a, { justifyContent: "space-between", alignItems: "center", children: [
|
|
124
|
-
u(),
|
|
125
|
-
/* @__PURE__ */ o(a, { gap: i.Medium, children: [
|
|
126
|
-
s(),
|
|
127
|
-
m(),
|
|
128
|
-
h(),
|
|
129
|
-
d()
|
|
1
|
+
import { jsx as s, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMediaQuery as M, Flex as o, Box as S } from "@chakra-ui/react";
|
|
3
|
+
import { memo as C, useMemo as l, Children as j } from "react";
|
|
4
|
+
import { useTableContext as B } from "./table-context.js";
|
|
5
|
+
import { TableToolbarActions as L } from "./table-toolbar-actions.js";
|
|
6
|
+
import { TableToolbarAddButton as w } from "./table-toolbar-add-button.js";
|
|
7
|
+
import { TableToolbarSearch as F } from "./table-toolbar-search.js";
|
|
8
|
+
import { TableToolbarSettings as V } from "./table-toolbar-settings.js";
|
|
9
|
+
import { Text as I } from "../text/text.js";
|
|
10
|
+
import { ThemeFontVariable as z, ThemeColorVariable as A, ThemeFontSizeVariable as H, ThemeSpaceVariable as r } from "../../theme/theme-types.js";
|
|
11
|
+
const k = ({ title: m, children: c, ...T }) => {
|
|
12
|
+
const d = B(), [h] = M("(min-width: 48em)"), g = d.id ? `${d.id}-toolbar` : void 0, e = l(() => {
|
|
13
|
+
let u = null, b = null, p = null, f = null;
|
|
14
|
+
return j.forEach(c, (a) => {
|
|
15
|
+
if (!a || typeof a != "object" || !("type" in a)) return;
|
|
16
|
+
const t = a;
|
|
17
|
+
t.type === F ? u = t : t.type === V ? b = t : t.type === L ? p = t : t.type === w && (f = t);
|
|
18
|
+
}), { search: u, settings: b, actions: p, addButton: f };
|
|
19
|
+
}, [c]), i = l(() => m ? /* @__PURE__ */ s(
|
|
20
|
+
I,
|
|
21
|
+
{
|
|
22
|
+
fontSize: H.X2Large,
|
|
23
|
+
color: A.OnBackgroundHeader,
|
|
24
|
+
fontWeight: "bold",
|
|
25
|
+
fontFamily: z.Header,
|
|
26
|
+
children: m
|
|
27
|
+
}
|
|
28
|
+
) : null, [m]), y = l(
|
|
29
|
+
() => /* @__PURE__ */ s(o, { direction: "column", gap: r.Medium, mb: r.Medium, children: /* @__PURE__ */ n(o, { justifyContent: "space-between", alignItems: "center", children: [
|
|
30
|
+
i,
|
|
31
|
+
/* @__PURE__ */ n(o, { gap: r.Medium, children: [
|
|
32
|
+
e.search,
|
|
33
|
+
e.settings,
|
|
34
|
+
e.actions,
|
|
35
|
+
e.addButton
|
|
130
36
|
] })
|
|
131
37
|
] }) }),
|
|
132
|
-
[
|
|
133
|
-
),
|
|
134
|
-
() => /* @__PURE__ */ o
|
|
135
|
-
/* @__PURE__ */ o
|
|
136
|
-
|
|
137
|
-
|
|
38
|
+
[i, e]
|
|
39
|
+
), x = l(
|
|
40
|
+
() => /* @__PURE__ */ n(o, { direction: "column", gap: r.Medium, mb: r.Medium, children: [
|
|
41
|
+
/* @__PURE__ */ n(o, { justifyContent: "space-between", children: [
|
|
42
|
+
i,
|
|
43
|
+
e.addButton
|
|
138
44
|
] }),
|
|
139
|
-
/* @__PURE__ */ o
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
45
|
+
/* @__PURE__ */ n(o, { justifyContent: "space-between", gap: r.Medium, children: [
|
|
46
|
+
e.search,
|
|
47
|
+
e.actions,
|
|
48
|
+
e.settings
|
|
143
49
|
] })
|
|
144
50
|
] }),
|
|
145
|
-
[
|
|
51
|
+
[i, e]
|
|
146
52
|
);
|
|
147
|
-
return /* @__PURE__ */
|
|
148
|
-
},
|
|
53
|
+
return /* @__PURE__ */ s(S, { id: g, ...T, children: h ? y : x });
|
|
54
|
+
}, J = C(k);
|
|
149
55
|
export {
|
|
150
|
-
|
|
56
|
+
J as TableToolbar
|
|
151
57
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-toolbar.spec.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table.composition.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table.composition.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AA8GH,eAAO,MAAM,UAAU,+CAoEtB,CAAC;AAEF,eAAO,MAAM,WAAW,+CAyDvB,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAqBD,eAAO,MAAM,aAAa,+CAqEzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,+CAmElC,CAAC"}
|