@compill/admin 1.0.102 → 1.0.103

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.
Files changed (106) hide show
  1. package/dist/lib/SectionTitle.js +4 -0
  2. package/dist/lib/breadcrumbs/BreadCrumbs.js +29 -0
  3. package/dist/lib/buttons/{DialogButton.jsx → DialogButton.js} +2 -4
  4. package/dist/lib/buttons/{InvalidateButton.jsx → InvalidateButton.js} +2 -1
  5. package/dist/lib/buttons/{NavigateButton.jsx → NavigateButton.js} +2 -3
  6. package/dist/lib/buttons/{PublishButton.jsx → PublishButton.js} +2 -3
  7. package/dist/lib/buttons/{UpdateButton.jsx → UpdateButton.js} +2 -3
  8. package/dist/lib/buttons/{ViewButton.jsx → ViewButton.js} +2 -3
  9. package/dist/lib/cells/{OrderCell.jsx → OrderCell.js} +2 -11
  10. package/dist/lib/json/{DetailsView.jsx → DetailsView.js} +9 -36
  11. package/dist/lib/json/{EditItemView.jsx → EditItemView.js} +2 -1
  12. package/dist/lib/json/{MultiQueryWrapper.jsx → MultiQueryWrapper.js} +4 -3
  13. package/dist/lib/json/{QueryWrapper.jsx → QueryWrapper.js} +2 -1
  14. package/dist/lib/json/{ScreenRenderer.jsx → ScreenRenderer.js} +7 -6
  15. package/dist/lib/json/ScreenTopBar.js +18 -0
  16. package/dist/lib/json/{TabbedView.jsx → TabbedView.js} +5 -12
  17. package/dist/lib/json/buttons/{ActionButton.jsx → ActionButton.js} +2 -4
  18. package/dist/lib/json/buttons/{ConfirmationActionButton.jsx → ConfirmationActionButton.js} +3 -20
  19. package/dist/lib/json/dialog/DialogRenderer.js +14 -0
  20. package/dist/lib/json/dialog/ItemDeleteDialog.js +14 -0
  21. package/dist/lib/json/dialog/ItemEditDialog.js +77 -0
  22. package/dist/lib/json/dialog/{MultiQueryWrapperDialog.jsx → MultiQueryWrapperDialog.js} +2 -1
  23. package/dist/lib/json/dialog/{QueryWrapperDialog.jsx → QueryWrapperDialog.js} +2 -1
  24. package/dist/lib/json/table/{RefreshButton.jsx → RefreshButton.js} +2 -3
  25. package/dist/lib/json/table/{TableRowActionsView.jsx → TableRowActionsView.js} +4 -13
  26. package/dist/lib/json/table/{TableRowPublishPostButton.jsx → TableRowPublishPostButton.js} +2 -3
  27. package/dist/lib/json/table/TableView.js +65 -0
  28. package/dist/lib/json/table/{TableViewContext.jsx → TableViewContext.js} +4 -3
  29. package/dist/lib/json/table/{useTableProps.jsx → useTableProps.js} +2 -1
  30. package/dist/lib/layout/AdminLayout.js +15 -0
  31. package/dist/lib/layout/ButtonBar.js +19 -0
  32. package/dist/lib/layout/Content.js +9 -0
  33. package/dist/lib/layout/PageTitleBar.js +4 -0
  34. package/dist/lib/layout/Sidebar.js +12 -0
  35. package/dist/lib/layout/menu/Menu.js +23 -0
  36. package/dist/lib/layout/menu/MenuButton.js +5 -0
  37. package/dist/lib/layout/menu/MenuItem.js +11 -0
  38. package/dist/lib/layout/menu/NextMenuItem.js +11 -0
  39. package/dist/lib/layout/menu/SelectedIndicator.js +4 -0
  40. package/dist/lib/layout/menu/UserBlock.js +34 -0
  41. package/dist/lib/modal/{AttachDialog.jsx → AttachDialog.js} +4 -40
  42. package/dist/lib/modal/FormActionDialog.js +20 -0
  43. package/dist/lib/page/PageContainer.js +5 -0
  44. package/dist/lib/page/PageContentEditor.js +10 -0
  45. package/dist/lib/page/PageMain.js +5 -0
  46. package/dist/lib/page/{PageQueryStateContainer.jsx → PageQueryStateContainer.js} +4 -3
  47. package/dist/lib/page/PageSectionTitle.js +4 -0
  48. package/dist/lib/page/PageSidebar.js +4 -0
  49. package/dist/lib/page/PageSidebarSection.js +5 -0
  50. package/dist/lib/page/PageStateContainer.js +7 -0
  51. package/dist/lib/page/PageSubSectionTitle.js +4 -0
  52. package/dist/lib/page/PageTitle.js +4 -0
  53. package/dist/lib/page/{PageTopBar.jsx → PageTopBar.js} +4 -18
  54. package/dist/lib/status/{StatusBadge.jsx → StatusBadge.js} +2 -1
  55. package/dist/lib/table/TableContainer.js +6 -0
  56. package/dist/lib/table/{TableContainerContext.jsx → TableContainerContext.js} +2 -1
  57. package/dist/lib/table/{TableCreateButton.jsx → TableCreateButton.js} +2 -4
  58. package/dist/lib/table/TableFilterButton.js +8 -0
  59. package/dist/lib/table/{TableFilters.jsx → TableFilters.js} +3 -22
  60. package/dist/lib/table/TableMassActions.js +9 -0
  61. package/dist/lib/table/TableRowActionBar.js +8 -0
  62. package/dist/lib/table/TableRowActionButton.js +5 -0
  63. package/dist/lib/table/TableRowActionDialogButton.js +6 -0
  64. package/dist/lib/table/{TableRowDeleteButton.jsx → TableRowDeleteButton.js} +2 -1
  65. package/dist/lib/table/{TableRowEditButton.jsx → TableRowEditButton.js} +2 -3
  66. package/dist/lib/table/{TableRowNavigateButton.jsx → TableRowNavigateButton.js} +2 -1
  67. package/dist/lib/table/{TableRowPublishPostButton.jsx → TableRowPublishPostButton.js} +2 -1
  68. package/dist/lib/table/{TableRowViewButton.jsx → TableRowViewButton.js} +2 -1
  69. package/dist/lib/table/TableTopBar.js +5 -0
  70. package/package.json +9 -9
  71. package/dist/lib/SectionTitle.jsx +0 -3
  72. package/dist/lib/breadcrumbs/BreadCrumbs.jsx +0 -43
  73. package/dist/lib/json/ScreenTopBar.jsx +0 -39
  74. package/dist/lib/json/dialog/DialogRenderer.jsx +0 -13
  75. package/dist/lib/json/dialog/ItemDeleteDialog.jsx +0 -36
  76. package/dist/lib/json/dialog/ItemEditDialog.jsx +0 -124
  77. package/dist/lib/json/table/TableView.jsx +0 -100
  78. package/dist/lib/layout/AdminLayout.jsx +0 -24
  79. package/dist/lib/layout/ButtonBar.jsx +0 -29
  80. package/dist/lib/layout/Content.jsx +0 -10
  81. package/dist/lib/layout/PageTitleBar.jsx +0 -12
  82. package/dist/lib/layout/Sidebar.jsx +0 -24
  83. package/dist/lib/layout/menu/Menu.jsx +0 -30
  84. package/dist/lib/layout/menu/MenuButton.jsx +0 -7
  85. package/dist/lib/layout/menu/MenuItem.jsx +0 -20
  86. package/dist/lib/layout/menu/NextMenuItem.jsx +0 -20
  87. package/dist/lib/layout/menu/SelectedIndicator.jsx +0 -3
  88. package/dist/lib/layout/menu/UserBlock.jsx +0 -55
  89. package/dist/lib/modal/FormActionDialog.jsx +0 -46
  90. package/dist/lib/page/PageContainer.jsx +0 -4
  91. package/dist/lib/page/PageContentEditor.jsx +0 -11
  92. package/dist/lib/page/PageMain.jsx +0 -4
  93. package/dist/lib/page/PageSectionTitle.jsx +0 -3
  94. package/dist/lib/page/PageSidebar.jsx +0 -3
  95. package/dist/lib/page/PageSidebarSection.jsx +0 -7
  96. package/dist/lib/page/PageStateContainer.jsx +0 -9
  97. package/dist/lib/page/PageSubSectionTitle.jsx +0 -3
  98. package/dist/lib/page/PageTitle.jsx +0 -3
  99. package/dist/lib/table/TableContainer.jsx +0 -11
  100. package/dist/lib/table/TableFilterButton.jsx +0 -16
  101. package/dist/lib/table/TableMassActions.jsx +0 -15
  102. package/dist/lib/table/TableRowActionBar.jsx +0 -14
  103. package/dist/lib/table/TableRowActionButton.jsx +0 -7
  104. package/dist/lib/table/TableRowActionDialogButton.jsx +0 -8
  105. package/dist/lib/table/TableTopBar.jsx +0 -17
  106. /package/dist/lib/table/{TableColumnButton.jsx → TableColumnButton.js} +0 -0
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
2
+ import { Table, useTableContext } from "@compill/table";
3
+ import { isFunction, runIfFn } from "@soperio/react";
4
+ import React from "react";
5
+ import { useParams } from "react-router-dom";
6
+ import { InvalidateButton } from "../../buttons/InvalidateButton";
7
+ import { PageContainer } from "../../page/PageContainer";
8
+ import { TableContainer } from "../../table/TableContainer";
9
+ import { TableCreateButton } from "../../table/TableCreateButton";
10
+ import { TableFilterButton } from "../../table/TableFilterButton";
11
+ import { TableTopBar } from "../../table/TableTopBar";
12
+ import { ButtonBar } from "../../layout/ButtonBar";
13
+ import { TableFilters } from "../../table/TableFilters";
14
+ import { TableMassActions } from "../../table/TableMassActions";
15
+ import { DialogRenderer } from "../dialog/DialogRenderer";
16
+ import { RefreshButton } from "./RefreshButton";
17
+ import { TableViewProvider, useTableViewContext } from "./TableViewContext";
18
+ import { useTableProps } from "./useTableProps";
19
+ function useId(queryField) {
20
+ const params = useParams();
21
+ if (queryField === undefined)
22
+ return undefined;
23
+ const { [queryField]: id } = params;
24
+ return id;
25
+ }
26
+ export function TableView({ queryField, title, subtitle, screen, ...props }) {
27
+ const id = useId(queryField);
28
+ const _screen = runIfFn(screen, id);
29
+ return (_jsx(PageContainer, { bgColor: "white", ...props, children: _jsx(TableContainer, { columns: _screen.table.columns, initialVisibleColumns: _screen.table.initialVisibleColumns, filtersMethod: _screen.table.filtersMethod, children: _jsx(TT, { id: id, title: title, subtitle: subtitle, screen: _screen }) }) }));
30
+ }
31
+ function TT({ id, title, subtitle, screen }) {
32
+ const { setRowSelection } = useTableContext();
33
+ const { api, table, filters, massActions, buttonBar, rowActions, createView, editView, deleteItem, breadcrumbs } = screen;
34
+ const tableApi = runIfFn(api, id ?? "");
35
+ return (_jsxs(_Fragment, { children: [_jsx(TableTopBar, { title: title, breadcrumbs: breadcrumbs, children: _jsx(TableButtonBar, { buttonBar: buttonBar, createView: createView, editView: editView, api: tableApi, queryKey: tableApi.queryKey, children: filters && _jsx(TableFilterButton, {}) }) }), filters &&
36
+ (_jsx(TableFilters, { form: filters.form, initialValues: filters.initialValues, schema: filters.schema, processInput: filters.processInput })), massActions && _jsx(TableMassActions, { actions: massActions.items }), _jsxs(TableViewProvider, { queryKey: tableApi.queryKey, editView: editView, deleteItem: deleteItem, children: [_jsx(TableWrapper, { table: { ...table, onSelectionChange: setRowSelection }, rowActions: rowActions, api: tableApi, subtitle: subtitle, queryParams: screen.queryParams }), _jsx(TableDialogManager, {})] })] }));
37
+ }
38
+ function TableButtonBar({ buttonBar, queryKey, createView, editView, api, children }) {
39
+ const createDialogFn = React.useCallback((data) => {
40
+ return (onClose) => {
41
+ const view = runIfFn(createView, data) ?? runIfFn(editView, null);
42
+ if (view.type == "customDialog")
43
+ return view.render({ show: true, onClose });
44
+ else
45
+ return _jsx(DialogRenderer, { config: view, onClose: onClose, invalidateQueryKey: api.queryKey });
46
+ };
47
+ }, [createView, editView, api]);
48
+ return (_jsxs(ButtonBar, { children: [_jsx(RefreshButton, { queryKey: queryKey }), buttonBar && buttonBar.map((button, index) => _jsxs(React.Fragment, { children: [button.type === "create" && editView &&
49
+ (_jsx(TableCreateButton, { buildDialog: createDialogFn(button.data), icon: button.icon, children: button.label })), button.type === "invalidate" && _jsx(InvalidateButton, { pathOrPermalink: button.pathOrPermalink }), button.type === "custom" && button.render()] }, index)), children] }));
50
+ }
51
+ function TableWrapper({ table, subtitle, rowActions, api, queryParams }) {
52
+ const tableProps = useTableProps(api, table, rowActions, queryParams);
53
+ const _subtitle = React.useMemo(() => {
54
+ if (!subtitle)
55
+ return undefined;
56
+ return (data) => {
57
+ return (_jsx("div", { textSize: "lg", textColor: "#475569", fontWeight: "600", children: isFunction(subtitle) ? subtitle(data) : subtitle }));
58
+ };
59
+ }, [subtitle]);
60
+ return _jsx(Table, { ...tableProps, p: "8", title: _subtitle });
61
+ }
62
+ function TableDialogManager() {
63
+ const { dialog } = useTableViewContext();
64
+ return dialog;
65
+ }
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
1
2
  import { useOpenLink } from "@compill/hooks";
2
3
  import { createContext, runIfFn } from "@soperio/react";
3
4
  import React from "react";
@@ -31,7 +32,7 @@ function TableViewProvider({ editView, deleteItem, queryKey, children }) {
31
32
  setDialog(editConfig.render({ show: true, onClose: onCloseDialog }));
32
33
  }
33
34
  else {
34
- setDialog(<DialogRenderer onClose={onCloseDialog} config={editConfig} queryId={item.id} invalidateQueryKey={queryKey}/>);
35
+ setDialog(_jsx(DialogRenderer, { onClose: onCloseDialog, config: editConfig, queryId: item.id, invalidateQueryKey: queryKey }));
35
36
  }
36
37
  }
37
38
  break;
@@ -39,7 +40,7 @@ function TableViewProvider({ editView, deleteItem, queryKey, children }) {
39
40
  case "delete":
40
41
  {
41
42
  const deleteConfig = runIfFn(deleteItem, item);
42
- setDialog(<ItemDeleteDialog show onClose={onCloseDialog} queryId={item.id} invalidateQueryKey={queryKey} msg={item.msg} {...deleteConfig} itemLabel={runIfFn(deleteConfig.itemLabel, item)}/>);
43
+ setDialog(_jsx(ItemDeleteDialog, { show: true, onClose: onCloseDialog, queryId: item.id, invalidateQueryKey: queryKey, msg: item.msg, ...deleteConfig, itemLabel: runIfFn(deleteConfig.itemLabel, item) }));
43
44
  // TODO
44
45
  // const { initialValues, ...props } = editItem!!
45
46
  // setDialog(<ItemEditDialog {...props} initialValues={runIfFn(initialValues, item)} show queryId={item?.id} onClose={onCloseDialog} />)
@@ -52,6 +53,6 @@ function TableViewProvider({ editView, deleteItem, queryKey, children }) {
52
53
  dialog,
53
54
  onAction
54
55
  };
55
- return <Provider value={value}>{children}</Provider>;
56
+ return _jsx(Provider, { value: value, children: children });
56
57
  }
57
58
  export { TableViewProvider, useContext as useTableViewContext };
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
1
2
  import { useOpenLink } from "@compill/hooks";
2
3
  import { runIfFn } from "@soperio/react";
3
4
  import { createColumnHelper } from "@tanstack/react-table";
@@ -41,7 +42,7 @@ export function useTableProps(api, table, rowActions, queryParams) {
41
42
  columns.push(createColumnHelper().display({
42
43
  id: "actions",
43
44
  header: "Actions",
44
- cell: props => <TableRowActionsView row={props.row} onAction={onAction} rowActions={rowActions} api={api} queryKey={api.queryKey}/>
45
+ cell: props => _jsx(TableRowActionsView, { row: props.row, onAction: onAction, rowActions: rowActions, api: api, queryKey: api.queryKey })
45
46
  }));
46
47
  }
47
48
  return columns;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { useBoolean } from "@compill/hooks";
3
+ import { mdiArrowLeft } from "@mdi/js";
4
+ import { IconButton } from "@valerya/ui";
5
+ import { useHotkeys } from "react-hotkeys-hook";
6
+ import Content from "./Content";
7
+ import { Sidebar } from "./Sidebar";
8
+ export function AdminLayout({ color, darkMode, logo, title, menuConfig, userMenuConfig, userSettingsPath, ...props }) {
9
+ return (_jsxs("div", { w: "full", h: "screen", dflex: true, flexRow: true, bgColor: `${color}-${darkMode ? "900" : "100"}`, ...props, children: [_jsx(LeftPanel, { color: color, darkMode: darkMode, logo: logo, title: title, menuConfig: menuConfig, userMenuConfig: userMenuConfig, userSettingsPath: userSettingsPath }), _jsx("div", { w: "screen", py: "2", pe: "2", children: _jsx(Content, { bgColor: "white", rounded: "lg", shadow: true }) })] }));
10
+ }
11
+ function LeftPanel({ color, darkMode, logo, title, menuConfig, userMenuConfig, userSettingsPath }) {
12
+ const [isOpen, __, toggle] = useBoolean(true);
13
+ useHotkeys('ctrl+t', () => toggle(), [toggle]);
14
+ return (_jsxs("div", { ms: isOpen ? "0" : "-14.5rem", transition: "all", duration: "500", transform: true, children: [_jsx(Sidebar, { flexShrink: "0", color: color, darkMode: darkMode, logo: logo, title: title, menuConfig: menuConfig, userMenuConfig: userMenuConfig, userSettingsPath: userSettingsPath }), _jsx(IconButton, { icon: mdiArrowLeft, transition: "all", duration: "500", transform: true, rotate: isOpen ? "0" : "180", position: "absolute", bottom: "14", end: "-5", size: "lg", corners: "pill", onClick: toggle, z: "100" })] }));
15
+ }
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { DialogButton } from "../buttons/DialogButton";
3
+ import { Button, Icon } from "@valerya/ui";
4
+ import { useFormikContext } from "formik";
5
+ import React from "react";
6
+ export function ButtonBar({ children, ...props }) {
7
+ return (_jsx("div", { dflex: true, border: "1px", borderColor: "zinc-200", divideX: "1px", divideColor: "zinc-200", rounded: "lg", overflow: "hidden", ...props, children: children }));
8
+ }
9
+ export const ButtonBarButton = React.forwardRef(function ({ icon, children, ...props }, ref) {
10
+ return (_jsxs(Button, { scheme: "dark", size: "sm", aspectRatio: icon && !children ? "square" : undefined, variant: "borderless", dflex: true, alignItems: "center", placeContent: "center", corners: "square", gap: "2", ...props, ref: ref, children: [icon && _jsx(Icon, { path: icon }), children] }));
11
+ });
12
+ export const ButtonBarSubmitButton = React.forwardRef(function ({ useDirty, disabled, icon, children, ...props }, ref) {
13
+ const { dirty, handleSubmit } = useFormikContext() ?? { dirty: false, handleSubmit: undefined, values: {} };
14
+ const onSubmit = React.useCallback(() => handleSubmit(), [handleSubmit]);
15
+ return (_jsxs(Button, { scheme: "dark", size: "sm", aspectRatio: icon && !children ? "square" : undefined, variant: "borderless", dflex: true, alignItems: "center", placeContent: "center", corners: "square", gap: "2", disabled: (useDirty && !dirty) || disabled, onClick: onSubmit, ...props, ref: ref, children: [icon && _jsx(Icon, { path: icon }), children] }));
16
+ });
17
+ export function ButtonBarDialogButton({ icon, children, ...props }) {
18
+ return (_jsxs(DialogButton, { scheme: "dark", size: "sm", aspectRatio: icon && !children ? "square" : undefined, variant: "borderless", dflex: true, alignItems: "center", placeContent: "center", corners: "square", gap: "2", ...props, children: [icon && _jsx(Icon, { path: icon }), children] }));
19
+ }
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { Outlet } from "react-router-dom";
3
+ /**
4
+ *
5
+ *
6
+ */
7
+ export default function Content({ ...props }) {
8
+ return (_jsx("div", { w: "100%", h: "100%", overflowY: "auto", ...props, children: _jsx(Outlet, {}) }));
9
+ }
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ export function PageTitleBar({ title, children, ...props }) {
3
+ return (_jsxs("div", { dflex: true, flexRow: true, alignItems: "center", gap: "3", p: "8", ...props, children: [title && _jsx("h2", { textSize: "x2", fontWeight: "600", textColor: "#3f4254", textTransform: "capitalize", children: title }), _jsx("div", { flexGrow: true, children: "\u00A0" }), children] }));
4
+ }
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { FlexCenter } from "@compill/components";
3
+ import { Menu } from "./menu/Menu";
4
+ import { AppEnv } from "@compill/env";
5
+ import Image from "next/image";
6
+ import { UserBlock } from "./menu/UserBlock";
7
+ export function Sidebar({ show, logo, title, menuConfig, userMenuConfig, userSettingsPath, color, darkMode, ...props }) {
8
+ return (_jsxs("div", { dflex: true, flexCol: true, w: "full", md_w: "64", minH: "screen", p: "0", textColor: darkMode ? "white" : "slate-800", ...props, children: [_jsxs(FlexCenter, { placeContent: "start", p: "4", font: "title", gap: "3", borderB: "px", borderBColor: "slate-900", borderOpacity: "5", children: [logo ?? _jsx(Logo, { width: 40, height: 40, darkMode: darkMode }), _jsx("h1", { textSize: "md", children: title || AppEnv.appName() })] }), _jsx(Menu, { overflowY: "auto", flexGrow: "1", p: "4", darkMode: darkMode, config: menuConfig }), _jsx("div", { p: "2", children: _jsx(UserBlock, { darkMode: darkMode, color: color, menuConfig: userMenuConfig, path: userSettingsPath }) })] }));
9
+ }
10
+ export default function Logo({ width, height, darkMode, ...props }) {
11
+ return (_jsx("div", { ...props, children: _jsx(Image, { src: `/logo_${darkMode ? "light" : "dark"}.png`, alt: AppEnv.appName() || "", width: width, height: height, priority: true, unoptimized: true }) }));
12
+ }
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { MenuItem } from "./MenuItem";
3
+ import { NextMenuItem } from "./NextMenuItem";
4
+ /**
5
+ *
6
+ *
7
+ */
8
+ export function Menu({ darkMode, config, useNextRouter, ...props }) {
9
+ const Comp = useNextRouter ? NextMenuItem : MenuItem;
10
+ return (_jsx("ul", { ...props, children: config.map((item, index) => {
11
+ if (item.type == "divider")
12
+ return _jsx(Divider, { title: item.label }, index);
13
+ if (item.type == "item") {
14
+ return (_jsx(Comp, { icon: item.icon, path: item.path, depth: 0, darkMode: darkMode, subMenu: item.children, children: item.label }, index));
15
+ }
16
+ }) }));
17
+ }
18
+ function Divider({ title }) {
19
+ return (_jsx("div", { px: "2", mt: "5", mb: "2", opacity: "75", textTransform: "capitalize", letterSpacing: "widest", fontWeight: "700", textSize: "xs", children: title }));
20
+ }
21
+ function CategoryItem({ children, ...props }) {
22
+ return (_jsx("li", { ps: "5", py: "2", mt: "5", textSize: "sm", textColor: "white", textOpacity: "80", fontWeight: "600", textTransform: "uppercase", children: children }));
23
+ }
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { Button, Icon } from "@valerya/ui";
3
+ export function MenuButton({ depth, darkMode, icon, selected, children, ...props }) {
4
+ return (_jsxs(Button, { as: "li", minH: "8", ms: `${(depth ?? 0) * 2}`, p: "2", font: "title", textColor: darkMode ? "white" : "black", fontWeight: "600", rounded: "lg", textSize: "sm", variant: "borderless", hover_bgColor: darkMode ? "white" : "black", hover_bgOpacity: "10", hover_textColor: darkMode ? "white" : "zinc-800", cursor: "pointer", dflex: true, alignItems: "center", gap: "3", ...props, children: [icon && _jsx(Icon, { path: icon, opacity: selected ? "100" : "60" }), children] }));
5
+ }
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
2
+ import { SelectedIndicator } from "./SelectedIndicator";
3
+ import { Link, useLocation, useMatch } from "react-router-dom";
4
+ import { MenuButton } from "./MenuButton";
5
+ export function MenuItem({ icon, path, depth, darkMode, subMenu, ...props }) {
6
+ const location = useLocation();
7
+ const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
8
+ const match = useMatch("/" + path) != null;
9
+ // const selected = match != null
10
+ return (_jsxs(_Fragment, { children: [_jsxs(Link, { to: path, style: { position: "relative" }, children: [_jsx(MenuButton, { depth: depth, darkMode: darkMode, icon: icon, selected: selected, ...props }), match && _jsx(SelectedIndicator, { darkMode: darkMode })] }), subMenu?.map((item, index) => (_jsx(MenuItem, { icon: item.icon, path: item.path, depth: (depth ?? 0) + 1, darkMode: darkMode, subMenu: item.children, children: item.label }, index)))] }));
11
+ }
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
2
+ import { MenuButton } from "./MenuButton";
3
+ import { SelectedIndicator } from "./SelectedIndicator";
4
+ import Link from "next/link";
5
+ import { useRouter } from "next/router";
6
+ export function NextMenuItem({ icon, path, depth, darkMode, subMenu, ...props }) {
7
+ const { pathname } = useRouter();
8
+ const selected = path == "/" ? pathname == "/" : pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
9
+ const match = path == "/" ? pathname == "/" : pathname == (path.startsWith("/") ? path : `/${path}`);
10
+ return (_jsxs(_Fragment, { children: [_jsxs(Link, { href: path, style: { position: "relative" }, children: [_jsx(MenuButton, { depth: depth, darkMode: darkMode, icon: icon, selected: selected, ...props }), match && _jsx(SelectedIndicator, { darkMode: darkMode })] }), subMenu?.map((item, index) => (_jsx(NextMenuItem, { icon: item.icon, path: item.path, depth: (depth ?? 0) + 1, darkMode: darkMode, subMenu: item.children, children: item.label }, index)))] }));
11
+ }
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ export function SelectedIndicator({ darkMode }) {
3
+ return (_jsx("div", { position: "absolute", bgColor: darkMode ? "white" : "black", bgOpacity: "90", w: "0.5", h: "6", top: "1.5", start: "-4" }));
4
+ }
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
2
+ import { useSessionLogout, useSessionUser } from "@compill/auth";
3
+ import { mdiCog, mdiDotsVertical, mdiLogout } from "@mdi/js";
4
+ import { Avatar, Button, Icon, IconButton, Popup } from "@valerya/ui";
5
+ import { capitalize } from "es-toolkit";
6
+ import React from "react";
7
+ import { useNavigate } from "react-router-dom";
8
+ export function UserBlock({ color, darkMode, menuConfig, path }) {
9
+ const { isLoading, user } = useSessionUser();
10
+ const navigate = useNavigate();
11
+ const handleClick = React.useCallback(() => navigate(path), [navigate, path]);
12
+ if (isLoading)
13
+ return null;
14
+ return (_jsxs("div", { dflex: true, alignItems: "center", border: "0.5", borderColor: `${color}-${darkMode ? "800" : "200"}`, ps: "3", py: "1.5", textSize: "md", rounded: "lg", hover_bgColor: `${color}-${darkMode ? "800" : "200"}`, cursor: "pointer", textColor: darkMode ? "white" : "slate-800", onClick: handleClick, children: [_jsx(Avatar, { size: "sm", src: user?.media?.url ?? "", name: `${user?.firstname} ${user?.lastname}` }), _jsx("span", { flexGrow: true, ms: "2", children: `${capitalize(user?.firstname || user?.lastname || "")}` }), _jsx(IconButton, { variant: "borderless", corners: "pill", scheme: "dark", textColor: darkMode ? "white" : "slate-800", hover_textColor: darkMode ? "white" : "slate-800", hover_bgColor: `${color}-${darkMode ? "900" : "200"}`, icon: mdiCog, onClick: handleClick }), _jsx(OverflowMenu, { color: color, darkMode: darkMode, menuConfig: menuConfig })] }));
15
+ }
16
+ function OverflowMenu({ color, darkMode, menuConfig }) {
17
+ const [showPopup, setShowPopup] = React.useState(false);
18
+ const navigate = useNavigate();
19
+ const logout = useSessionLogout(false);
20
+ return (_jsx(_Fragment, { children: _jsxs(Popup, { show: showPopup, position: "relative", side: "bottom-end", onClick: (e) => { e.preventDefault(); e.stopPropagation(); setShowPopup((show) => !show); }, onHide: () => setShowPopup(false), children: [_jsx(IconButton, { icon: mdiDotsVertical, variant: "borderless", corners: "pill", scheme: "dark", textColor: darkMode ? "white" : "slate-800", hover_textColor: darkMode ? "white" : "slate-800", hover_bgColor: `${color}-${darkMode ? "900" : "200"}` }), _jsxs("div", { bgColor: "white", rounded: "sm", overflow: "hidden", shadow: true, mt: "1", border: "px", borderColor: "gray-200", divideColor: "gray-200", divideY: "px", minW: "40", children: [menuConfig && menuConfig.length > 0 && menuConfig.map((item, index) => {
21
+ if (item.type == "item") {
22
+ return (_jsx(MenuItem, { icon: item.icon, onClick: () => navigate(item.path), children: item.label }, index));
23
+ }
24
+ return null;
25
+ }), _jsx(MenuItem, { icon: mdiLogout, onClick: logout, children: "Logout" })] })] }) }));
26
+ }
27
+ function MenuItem({ icon, onClick, children, ...props }) {
28
+ const handleClick = React.useCallback((e) => {
29
+ e.preventDefault();
30
+ e.stopPropagation();
31
+ onClick?.(e);
32
+ }, []);
33
+ return (_jsxs(Button, { variant: "borderless", scheme: "dark", size: "sm", alignItems: "center", dflex: true, gap: "2", px: "2", py: "1.5", w: "full", onClick: handleClick, textColor: "slate-700", ...props, children: [icon && _jsx(Icon, { path: icon, size: "md" }), children] }));
34
+ }
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
1
2
  import { useApiMutation, useApiQuery } from "@compill/api";
2
3
  import { ModalLoadingOverlay, QueryLoadingState, RetryOnError } from "@compill/components";
3
4
  import { useQueryClient } from "@tanstack/react-query";
@@ -64,46 +65,9 @@ export function AttachDialog({ queryId, queryKey, queryFetchFn, queryFetchAllKey
64
65
  }
65
66
  return r;
66
67
  }, [attached, data]);
67
- return (<Modal size={size} show={show} onClose={onClose} scheme="light" transition
68
- // closeOnMaskClick={false}
69
- {...props}>
70
- <Modal.Header>
71
- {`Add ${itemLabel}`}
72
- </Modal.Header>
73
-
74
- {isLoading && (<Modal.Body>
75
- <QueryLoadingState minW="72"/>
76
- </Modal.Body>)}
77
-
78
- {isError && (<Modal.Body>
79
- <RetryOnError label={`${fetchErrorMsg} ${error}`} onClick={retry}/>
80
- </Modal.Body>)}
81
-
82
- {!isLoading && !isError &&
83
- (<>
84
- <Modal.Body px="0" pb="6" maxH="750px" overflow="auto">
85
- <div dflex flexCol overflow="auto">
86
-
87
- {resources.map(item => (<ListItem key={item.id} label={item.name} value={item.id} data-id={item.id} checked={selectedResources.includes(`${item.id}`)} onClick={handleClick}/>))}
88
- </div>
89
- </Modal.Body>
90
-
91
- <Modal.Footer dflex placeContent="end" spaceX="3">
92
- <Button disabled={mutation.isLoading} onClick={onClose} variant="borderless" me="2">
93
- {cancelLabel}
94
- </Button>
95
- <Button type="submit" disabled={selectedResources.length == 0 || mutation.isLoading /* || !isValid*/} onClick={saveItem}>
96
- {saveLabel ? saveLabel : (queryId ? "Update" : "Create")}
97
- </Button>
98
- </Modal.Footer>
99
- </>)}
100
-
101
- {mutation.isLoading && <ModalLoadingOverlay />}
102
- </Modal>);
68
+ return (_jsxs(Modal, { size: size, show: show, onClose: onClose, scheme: "light", transition: true, ...props, children: [_jsx(Modal.Header, { children: `Add ${itemLabel}` }), isLoading && (_jsx(Modal.Body, { children: _jsx(QueryLoadingState, { minW: "72" }) })), isError && (_jsx(Modal.Body, { children: _jsx(RetryOnError, { label: `${fetchErrorMsg} ${error}`, onClick: retry }) })), !isLoading && !isError &&
69
+ (_jsxs(_Fragment, { children: [_jsx(Modal.Body, { px: "0", pb: "6", maxH: "750px", overflow: "auto", children: _jsx("div", { dflex: true, flexCol: true, overflow: "auto", children: resources.map(item => (_jsx(ListItem, { label: item.name, value: item.id, "data-id": item.id, checked: selectedResources.includes(`${item.id}`), onClick: handleClick }, item.id))) }) }), _jsxs(Modal.Footer, { dflex: true, placeContent: "end", spaceX: "3", children: [_jsx(Button, { disabled: mutation.isLoading, onClick: onClose, variant: "borderless", me: "2", children: cancelLabel }), _jsx(Button, { type: "submit", disabled: selectedResources.length == 0 || mutation.isLoading /* || !isValid*/, onClick: saveItem, children: saveLabel ? saveLabel : (queryId ? "Update" : "Create") })] })] })), mutation.isLoading && _jsx(ModalLoadingOverlay, {})] }));
103
70
  }
104
71
  function ListItem({ label, value, checked, ...props }) {
105
- return (<div dflex alignItems="center" hover_bgColor="slate-100" px="5" py="2" cursor="pointer" {...props}>
106
- <span flexGrow>{label}</span>
107
- <Checkbox name={`resources.${value}`} value={value} checked={checked}/>
108
- </div>);
72
+ return (_jsxs("div", { dflex: true, alignItems: "center", hover_bgColor: "slate-100", px: "5", py: "2", cursor: "pointer", ...props, children: [_jsx("span", { flexGrow: true, children: label }), _jsx(Checkbox, { name: `resources.${value}`, value: value, checked: checked })] }));
109
73
  }
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { useMutate } from "@compill/api";
3
+ import { ModalLoadingOverlay } from "@compill/components";
4
+ import { SubmitButton, FormRenderer, FormProvider } from "@compill/form";
5
+ import { useApiMutation, useInvalidateParentMutation } from "@compill/api";
6
+ import { Button, Modal } from "@valerya/ui";
7
+ import React from "react";
8
+ export function FormActionDialog({ initialValues, itemLabel, queryId = "", queryKey, queryFn, queryOptions, onSuccess, successMsg, showSuccessMsg, onError, errorMsg, showErrorMsg, processInput, invalidateQueriesOnSuccess = true, cancelLabel = "Cancel", saveLabel = "Send", size = "lg", title, form, show, onClose, formikProps, ...props }) {
9
+ const mutation = invalidateQueriesOnSuccess ? useInvalidateParentMutation(queryFn, queryKey, queryOptions) : useApiMutation(queryFn, queryKey, queryId, queryOptions);
10
+ const mutate = useMutate(mutation, {
11
+ onSuccess,
12
+ successMsg,
13
+ showSuccessMsg,
14
+ onError,
15
+ errorMsg,
16
+ showErrorMsg,
17
+ processInput,
18
+ });
19
+ return (_jsxs(Modal, { size: size, show: show, onClose: onClose, scheme: "light", transition: true, ...props, children: [_jsx(Modal.Header, { children: title }), _jsxs(FormProvider, { initialValues: initialValues ?? {}, onSubmit: mutate, ...formikProps, children: [_jsxs(Modal.Body, { pb: "6", children: [React.isValidElement(form) && form, Array.isArray(form) && _jsx(FormRenderer, { form: form })] }), _jsxs(Modal.Footer, { dflex: true, placeContent: "end", spaceX: "3", children: [_jsx(Button, { disabled: mutation.isLoading, onClick: onClose, variant: "borderless", me: "2", children: cancelLabel }), _jsx(SubmitButton, { disabled: mutation.isLoading, children: saveLabel })] })] }), mutation.isLoading && _jsx(ModalLoadingOverlay, {})] }));
20
+ }
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { Container } from "@valerya/ui";
3
+ export function PageContainer({ children, ...props }) {
4
+ return _jsx(Container, { center: true, dflex: true, flexCol: true, gap: "8", ...props, children: children });
5
+ }
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { FormEditor } from "@compill/form-editor";
3
+ import { PageMain } from "./PageMain";
4
+ import { ImageExtension } from "@compill/editor";
5
+ export function PageContentEditor({ name, ...props }) {
6
+ const extensions = [ImageExtension];
7
+ return (_jsx(PageMain, { h: "min", ...props, children: _jsx(FormEditor, { minH: "128", minW: "144", maxW: props.maxW,
8
+ // w={props.w}
9
+ name: name, placeHolder: "Write here...", extensions: extensions }) }));
10
+ }
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { Tile } from "@valerya/ui";
3
+ export function PageMain({ children, ...props }) {
4
+ return _jsx(Tile, { scheme: "light", p: "5", ...props, children: children });
5
+ }
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
1
2
  import { QueryLoadingState, RetryOnError } from "@compill/components";
2
3
  import { useApiQuery, useInvalidateQuery } from "@compill/api";
3
4
  import React from "react";
@@ -7,9 +8,9 @@ function PageQueryStateContainerInner({ queryId, api, apiFn, loadingStyles, erro
7
8
  const { data, isLoading, isError } = apiFn == "getAll" ? useApiQuery(api.queryKey, api.getAll, props.apiParams) : useApiQuery(api.queryKey, api.get, queryId);
8
9
  const invalidate = useInvalidateQuery(api.queryKey, queryId);
9
10
  if (isLoading)
10
- return <QueryLoadingState w="full" h="100%" {...loadingStyles}/>;
11
+ return _jsx(QueryLoadingState, { w: "full", h: "100%", ...loadingStyles });
11
12
  if (isError)
12
- return <RetryOnError p="0" onClick={invalidate} {...errorStyles}/>;
13
- return <PageContainer {...props}>{apiFn == "get" ? children(data) : children(data)}</PageContainer>;
13
+ return _jsx(RetryOnError, { p: "0", onClick: invalidate, ...errorStyles });
14
+ return _jsx(PageContainer, { ...props, children: apiFn == "get" ? children(data) : children(data) });
14
15
  }
15
16
  export const PageQueryStateContainer = React.forwardRef(PageQueryStateContainerInner);
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ export function PageSectionTitle({ children, ...props }) {
3
+ return _jsx("div", { trait: "typo.h6", mb: "5", ...props, children: children });
4
+ }
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ export function PageSidebar({ children, ...props }) {
3
+ return _jsx("div", { w: "112", minW: "112", minH: "100%", gap: "8", dflex: true, flexCol: true, ...props, children: children });
4
+ }
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { PageSectionTitle } from "./PageSectionTitle";
3
+ export function PageSidebarSection({ title, children, ...props }) {
4
+ return (_jsxs("div", { w: "full", ...props, children: [title && _jsx(PageSectionTitle, { children: title }), children] }));
5
+ }
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { QueryLoadingState } from "@compill/components";
3
+ import { Container } from "@valerya/ui";
4
+ import React from "react";
5
+ export const PageStateContainer = React.forwardRef(({ loading = false, children, ...props }, ref) => {
6
+ return (_jsxs(_Fragment, { children: [loading && _jsx(QueryLoadingState, { w: "full", h: "100%" }), !loading && _jsx(Container, { ref: ref, center: true, size: "x2", dflex: true, flexCol: true, gap: "8", ...props, children: children })] }));
7
+ });
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ export function PageSubSectionTitle({ children, ...props }) {
3
+ return _jsx("div", { trait: "typo.h6", mb: "3", ...props, children: children });
4
+ }
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ export function PageTitle({ children, ...props }) {
3
+ return _jsx("div", { trait: "typo.h5", ...props, children: children });
4
+ }
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
1
2
  import { createContext } from "@soperio/react";
2
3
  import { PageTitle } from "./PageTitle";
3
4
  import React from "react";
@@ -5,20 +6,13 @@ import { createPortal } from "react-dom";
5
6
  import { FlexCenter } from "@compill/components";
6
7
  import { Breadcrumbs } from "../breadcrumbs/BreadCrumbs";
7
8
  export function PageTopBar({ title, breadcrumbs, children, ...props }) {
8
- return (<FlexCenter gap="3" minH="9" {...props}>
9
- {title && <PageTitle>{title}</PageTitle>}
10
- {breadcrumbs && <Breadcrumbs breadcrumbs={breadcrumbs}/>}
11
- <div flexGrow/>
12
- {children}
13
- </FlexCenter>);
9
+ return (_jsxs(FlexCenter, { gap: "3", minH: "9", ...props, children: [title && _jsx(PageTitle, { children: title }), breadcrumbs && _jsx(Breadcrumbs, { breadcrumbs: breadcrumbs }), _jsx("div", { flexGrow: true }), children] }));
14
10
  }
15
11
  const [CP, usePageTabbedTopBarContext] = createContext();
16
12
  export function PageTabbedTopBarProvider({ children }) {
17
13
  const [containerEl, setContainerEl] = React.useState(null);
18
14
  const r = React.createRef();
19
- return (<CP value={{ containerEl, setContainerEl }}>
20
- {children}
21
- </CP>);
15
+ return (_jsx(CP, { value: { containerEl, setContainerEl }, children: children }));
22
16
  }
23
17
  export function PageTabbedTopBar({ title, breadcrumbs, children, ...props }) {
24
18
  const ref = React.createRef();
@@ -31,15 +25,7 @@ export function PageTabbedTopBar({ title, breadcrumbs, children, ...props }) {
31
25
  }
32
26
  return () => setContainerEl(null);
33
27
  }, []);
34
- return (<FlexCenter gap="3" minH="9" {...props}>
35
- <>
36
- {title && <PageTitle>{title}</PageTitle>}
37
- {breadcrumbs && <Breadcrumbs breadcrumbs={breadcrumbs}/>}
38
- <div flexGrow/>
39
- <div ref={ref} dflex flexRow gap="3"/>
40
- {children}
41
- </>
42
- </FlexCenter>);
28
+ return (_jsx(FlexCenter, { gap: "3", minH: "9", ...props, children: _jsxs(_Fragment, { children: [title && _jsx(PageTitle, { children: title }), breadcrumbs && _jsx(Breadcrumbs, { breadcrumbs: breadcrumbs }), _jsx("div", { flexGrow: true }), _jsx("div", { ref: ref, dflex: true, flexRow: true, gap: "3" }), children] }) }));
43
29
  }
44
30
  export function PageTopBarToolbar({ trackingRef, children }) {
45
31
  const { containerEl } = usePageTabbedTopBarContext();
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
1
2
  import { Badge } from "@valerya/ui";
2
3
  const labels = {
3
4
  draft: "Draft",
@@ -16,5 +17,5 @@ const schemes = {
16
17
  rejected: "danger",
17
18
  };
18
19
  export function StatusBadge({ status, ...props }) {
19
- return (<Badge size="sm" variant="glass" whiteSpace="nowrap" rounded="full" px="3" scheme={schemes[status]} {...props}>{labels[status]}</Badge>);
20
+ return (_jsx(Badge, { size: "sm", variant: "glass", whiteSpace: "nowrap", rounded: "full", px: "3", scheme: schemes[status], ...props, children: labels[status] }));
20
21
  }
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { TableContextProvider } from "@compill/table";
3
+ import { TableContainerContextProvider } from "./TableContainerContext";
4
+ export function TableContainer({ initialPageSize, initialVisibleColumns, columns, filtersMethod = "reactRouter", children, ...props }) {
5
+ return (_jsx("div", { w: "full", dflex: true, flexCol: true, ...props, children: _jsx(TableContextProvider, { initialPageSize: initialPageSize, filtersMethod: filtersMethod, children: _jsx(TableContainerContextProvider, { columns: columns, initialVisibleColumns: initialVisibleColumns, children: children }) }) }));
6
+ }
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
1
2
  import React from "react";
2
3
  import { createContext } from "@soperio/react";
3
4
  const [provider, useContext] = createContext();
@@ -34,6 +35,6 @@ function TableContainerContextProvider({ initialVisibleColumns, columns, childre
34
35
  toggleColumnVisibility,
35
36
  isColumnVisible
36
37
  };
37
- return <Provider value={value}>{children}</Provider>;
38
+ return _jsx(Provider, { value: value, children: children });
38
39
  }
39
40
  export { TableContainerContextProvider, useContext as useTableContainerContext };
@@ -1,9 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
1
2
  import { mdiPlusThick } from "@mdi/js";
2
3
  import { Icon } from "@valerya/ui";
3
4
  import { ButtonBarDialogButton } from "../layout/ButtonBar";
4
5
  export function TableCreateButton({ icon, children, ...props }) {
5
- return (<ButtonBarDialogButton {...props}>
6
- <Icon path={icon ?? mdiPlusThick}/>
7
- {children}
8
- </ButtonBarDialogButton>);
6
+ return (_jsxs(ButtonBarDialogButton, { ...props, children: [_jsx(Icon, { path: icon ?? mdiPlusThick }), children] }));
9
7
  }
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { Icon } from "@valerya/ui";
3
+ import { Button, Popover } from "@valerya/ui";
4
+ import { mdiFilter } from "@mdi/js";
5
+ export function TableFilterButton({ ...props }) {
6
+ // return <Button scheme="secondary" {...props}><Icon path={mdiFilter} /></Button>
7
+ return (_jsxs(Popover, { side: "bottom-end", modal: true, children: [_jsx(Button, { scheme: "dark", size: "sm", aspectRatio: "square", variant: "borderless", corners: "square", ...props, children: _jsx(Icon, { path: mdiFilter }) }), _jsxs("div", { bgColor: "white", rounded: true, shadow: true, children: [_jsx("div", { py: "3", hover_bgColor: "#ff0000", px: "5", hover_textColor: "white", children: "First Item" }), _jsx("div", { py: "3", hover_bgColor: "#ff0000", px: "5", hover_textColor: "white", children: "Second Item" }), _jsx("div", { py: "3", hover_bgColor: "#ff0000", px: "5", hover_textColor: "white", children: "Third Item" })] })] }));
8
+ }
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
1
2
  import { useTableContext } from "@compill/table";
2
3
  import React from "react";
3
4
  import { useTableContainerContext } from "./TableContainerContext";
@@ -19,28 +20,8 @@ export function TableFilters({ form, initialValues, schema, processInput }) {
19
20
  resetForm();
20
21
  }, [setFilters, initialValues]);
21
22
  React.useEffect(() => setFilters(initialValues), []);
22
- return (<Collapse in={showFilters} style={{ overflow: showFilters ? "initial" : "hidden" }}>
23
- <div p="8" borderT="px" borderB="px" borderColor="slate-100">
24
- <FormProvider initialValues={mergeInitialFormValues(getFilters(), initialValues)} onSubmit={handleSubmit} validationSchema={schema} enableReinitialize>
25
- {(props) => (<div dflex gap="3" placeContent="start">
26
- <FormRenderer flexRow w="auto" form={form}/>
27
- <Buttons handleReset={() => handleReset(props.resetForm)}/>
28
- </div>)}
29
-
30
- </FormProvider>
31
- </div>
32
- </Collapse>);
23
+ return (_jsx(Collapse, { in: showFilters, style: { overflow: showFilters ? "initial" : "hidden" }, children: _jsx("div", { p: "8", borderT: "px", borderB: "px", borderColor: "slate-100", children: _jsx(FormProvider, { initialValues: mergeInitialFormValues(getFilters(), initialValues), onSubmit: handleSubmit, validationSchema: schema, enableReinitialize: true, children: (props) => (_jsxs("div", { dflex: true, gap: "3", placeContent: "start", children: [_jsx(FormRenderer, { flexRow: true, w: "auto", form: form }), _jsx(Buttons, { handleReset: () => handleReset(props.resetForm) })] })) }) }) }));
33
24
  }
34
25
  function Buttons({ handleReset }) {
35
- return (<div dflex gap="3">
36
- <div dflex flexCol>
37
- <FieldLabel name="" label="&nbsp;"/>
38
- <SubmitButton>Filter</SubmitButton>
39
- </div>
40
-
41
- <div dflex flexCol>
42
- <FieldLabel name="" label="&nbsp;"/>
43
- <Button scheme="neutral" onClick={handleReset}>Reset</Button>
44
- </div>
45
- </div>);
26
+ return (_jsxs("div", { dflex: true, gap: "3", children: [_jsxs("div", { dflex: true, flexCol: true, children: [_jsx(FieldLabel, { name: "", label: "\u00A0" }), _jsx(SubmitButton, { children: "Filter" })] }), _jsxs("div", { dflex: true, flexCol: true, children: [_jsx(FieldLabel, { name: "", label: "\u00A0" }), _jsx(Button, { scheme: "neutral", onClick: handleReset, children: "Reset" })] })] }));
46
27
  }
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { useTableContext } from "@compill/table";
3
+ import { Collapse } from "@valerya/ui";
4
+ import { ActionButton } from "../json/buttons/ActionButton";
5
+ export function TableMassActions({ actions }) {
6
+ const { ids } = useTableContext();
7
+ const showMassActions = ids && ids.length > 0;
8
+ return (_jsx(Collapse, { in: showMassActions, style: { overflow: showMassActions ? "initial" : "hidden" }, children: _jsx("div", { dflex: true, gap: "3", flexWrap: true, alignItems: "center", px: "8", pt: "5", children: actions.map((action, index) => (_jsx("div", { children: action.type == "button" && !action.showConfirmationDialog && (_jsx(ActionButton, { label: action.label, queryFn: action.queryFn, queryKey: action.queryKey, buttonProps: action.buttonProps })) }, index))) }) }));
9
+ }