@compill/admin 1.0.102 → 1.0.104

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 (153) hide show
  1. package/dist/index.d.ts +50 -50
  2. package/dist/index.js +50 -50
  3. package/dist/lib/SectionTitle.js +4 -0
  4. package/dist/lib/breadcrumbs/BreadCrumbs.js +29 -0
  5. package/dist/lib/buttons/{DialogButton.jsx → DialogButton.js} +2 -4
  6. package/dist/lib/buttons/InvalidateButton.d.ts +1 -1
  7. package/dist/lib/buttons/{InvalidateButton.jsx → InvalidateButton.js} +3 -2
  8. package/dist/lib/buttons/{NavigateButton.jsx → NavigateButton.js} +2 -3
  9. package/dist/lib/buttons/{PublishButton.jsx → PublishButton.js} +3 -4
  10. package/dist/lib/buttons/{UpdateButton.jsx → UpdateButton.js} +3 -4
  11. package/dist/lib/buttons/ViewButton.d.ts +1 -1
  12. package/dist/lib/buttons/{ViewButton.jsx → ViewButton.js} +3 -4
  13. package/dist/lib/cells/{OrderCell.jsx → OrderCell.js} +2 -11
  14. package/dist/lib/json/DetailsView.d.ts +1 -1
  15. package/dist/lib/json/DetailsView.js +69 -0
  16. package/dist/lib/json/EditItemView.d.ts +1 -1
  17. package/dist/lib/json/EditItemView.js +6 -0
  18. package/dist/lib/json/MultiQueryWrapper.d.ts +1 -1
  19. package/dist/lib/json/{MultiQueryWrapper.jsx → MultiQueryWrapper.js} +5 -4
  20. package/dist/lib/json/QueryWrapper.d.ts +1 -1
  21. package/dist/lib/json/{QueryWrapper.jsx → QueryWrapper.js} +3 -2
  22. package/dist/lib/json/ScreenRenderer.d.ts +1 -1
  23. package/dist/lib/json/ScreenRenderer.js +19 -0
  24. package/dist/lib/json/ScreenTopBar.d.ts +2 -2
  25. package/dist/lib/json/ScreenTopBar.js +18 -0
  26. package/dist/lib/json/TabbedView.d.ts +1 -1
  27. package/dist/lib/json/TabbedView.js +21 -0
  28. package/dist/lib/json/buttons/{ActionButton.jsx → ActionButton.js} +2 -4
  29. package/dist/lib/json/buttons/{ConfirmationActionButton.jsx → ConfirmationActionButton.js} +3 -20
  30. package/dist/lib/json/dialog/DialogRenderer.d.ts +3 -3
  31. package/dist/lib/json/dialog/DialogRenderer.js +14 -0
  32. package/dist/lib/json/dialog/ItemDeleteDialog.js +14 -0
  33. package/dist/lib/json/dialog/ItemEditDialog.js +77 -0
  34. package/dist/lib/json/dialog/MultiQueryWrapperDialog.d.ts +1 -1
  35. package/dist/lib/json/dialog/{MultiQueryWrapperDialog.jsx → MultiQueryWrapperDialog.js} +3 -2
  36. package/dist/lib/json/dialog/QueryWrapperDialog.d.ts +2 -2
  37. package/dist/lib/json/dialog/{QueryWrapperDialog.jsx → QueryWrapperDialog.js} +3 -2
  38. package/dist/lib/json/table/{RefreshButton.jsx → RefreshButton.js} +3 -4
  39. package/dist/lib/json/table/TableRowActionsView.d.ts +1 -1
  40. package/dist/lib/json/table/TableRowActionsView.js +36 -0
  41. package/dist/lib/json/table/{TableRowPublishPostButton.jsx → TableRowPublishPostButton.js} +2 -3
  42. package/dist/lib/json/table/TableView.d.ts +1 -1
  43. package/dist/lib/json/table/TableView.js +65 -0
  44. package/dist/lib/json/table/TableViewContext.d.ts +1 -1
  45. package/dist/lib/json/table/{TableViewContext.jsx → TableViewContext.js} +6 -5
  46. package/dist/lib/json/table/useTableProps.d.ts +1 -1
  47. package/dist/lib/json/table/{useTableProps.jsx → useTableProps.js} +4 -3
  48. package/dist/lib/json/types/DetailsView.d.ts +1 -1
  49. package/dist/lib/json/types/EditItemDialog.d.ts +1 -1
  50. package/dist/lib/json/types/MultiQueryWrapper.d.ts +3 -3
  51. package/dist/lib/json/types/MultiQueryWrapperDialog.d.ts +1 -1
  52. package/dist/lib/json/types/QueryWrapper.d.ts +3 -3
  53. package/dist/lib/json/types/QueryWrapperDialog.d.ts +1 -1
  54. package/dist/lib/json/types/ScreenConfig.d.ts +6 -6
  55. package/dist/lib/json/types/TabbedView.d.ts +5 -5
  56. package/dist/lib/json/types/TableView.d.ts +4 -4
  57. package/dist/lib/layout/AdminLayout.d.ts +1 -1
  58. package/dist/lib/layout/AdminLayout.js +15 -0
  59. package/dist/lib/layout/ButtonBar.d.ts +1 -1
  60. package/dist/lib/layout/ButtonBar.js +19 -0
  61. package/dist/lib/layout/Content.js +9 -0
  62. package/dist/lib/layout/PageTitleBar.js +4 -0
  63. package/dist/lib/layout/Sidebar.d.ts +1 -1
  64. package/dist/lib/layout/Sidebar.js +12 -0
  65. package/dist/lib/layout/menu/Menu.d.ts +1 -1
  66. package/dist/lib/layout/menu/Menu.js +23 -0
  67. package/dist/lib/layout/menu/MenuButton.js +5 -0
  68. package/dist/lib/layout/menu/MenuItem.d.ts +1 -1
  69. package/dist/lib/layout/menu/MenuItem.js +11 -0
  70. package/dist/lib/layout/menu/NextMenuItem.d.ts +1 -1
  71. package/dist/lib/layout/menu/NextMenuItem.js +11 -0
  72. package/dist/lib/layout/menu/SelectedIndicator.js +4 -0
  73. package/dist/lib/layout/menu/UserBlock.d.ts +1 -1
  74. package/dist/lib/layout/menu/UserBlock.js +34 -0
  75. package/dist/lib/modal/{AttachDialog.jsx → AttachDialog.js} +4 -40
  76. package/dist/lib/modal/FormActionDialog.js +20 -0
  77. package/dist/lib/page/PageContainer.js +5 -0
  78. package/dist/lib/page/PageContentEditor.js +10 -0
  79. package/dist/lib/page/PageMain.js +5 -0
  80. package/dist/lib/page/{PageQueryStateContainer.jsx → PageQueryStateContainer.js} +5 -4
  81. package/dist/lib/page/PageSectionTitle.js +4 -0
  82. package/dist/lib/page/PageSidebar.js +4 -0
  83. package/dist/lib/page/PageSidebarSection.js +5 -0
  84. package/dist/lib/page/PageStateContainer.js +7 -0
  85. package/dist/lib/page/PageSubSectionTitle.js +4 -0
  86. package/dist/lib/page/PageTitle.js +4 -0
  87. package/dist/lib/page/PageTopBar.d.ts +1 -1
  88. package/dist/lib/page/{PageTopBar.jsx → PageTopBar.js} +6 -20
  89. package/dist/lib/status/{StatusBadge.jsx → StatusBadge.js} +2 -1
  90. package/dist/lib/table/{TableColumnButton.jsx → TableColumnButton.js} +1 -1
  91. package/dist/lib/table/TableContainer.js +6 -0
  92. package/dist/lib/table/{TableContainerContext.jsx → TableContainerContext.js} +2 -1
  93. package/dist/lib/table/TableCreateButton.d.ts +1 -1
  94. package/dist/lib/table/TableCreateButton.js +7 -0
  95. package/dist/lib/table/TableFilterButton.js +8 -0
  96. package/dist/lib/table/{TableFilters.jsx → TableFilters.js} +4 -23
  97. package/dist/lib/table/TableMassActions.d.ts +1 -1
  98. package/dist/lib/table/TableMassActions.js +9 -0
  99. package/dist/lib/table/TableRowActionBar.js +8 -0
  100. package/dist/lib/table/TableRowActionButton.js +5 -0
  101. package/dist/lib/table/TableRowActionDialogButton.d.ts +1 -1
  102. package/dist/lib/table/TableRowActionDialogButton.js +6 -0
  103. package/dist/lib/table/TableRowDeleteButton.d.ts +1 -1
  104. package/dist/lib/table/{TableRowDeleteButton.jsx → TableRowDeleteButton.js} +3 -2
  105. package/dist/lib/table/TableRowEditButton.d.ts +1 -1
  106. package/dist/lib/table/{TableRowEditButton.jsx → TableRowEditButton.js} +3 -4
  107. package/dist/lib/table/{TableRowNavigateButton.jsx → TableRowNavigateButton.js} +3 -2
  108. package/dist/lib/table/{TableRowPublishPostButton.jsx → TableRowPublishPostButton.js} +3 -2
  109. package/dist/lib/table/{TableRowViewButton.jsx → TableRowViewButton.js} +3 -2
  110. package/dist/lib/table/TableTopBar.d.ts +1 -1
  111. package/dist/lib/table/TableTopBar.js +5 -0
  112. package/package.json +17 -17
  113. package/dist/lib/SectionTitle.jsx +0 -3
  114. package/dist/lib/breadcrumbs/BreadCrumbs.jsx +0 -43
  115. package/dist/lib/json/DetailsView.jsx +0 -96
  116. package/dist/lib/json/EditItemView.jsx +0 -5
  117. package/dist/lib/json/ScreenRenderer.jsx +0 -18
  118. package/dist/lib/json/ScreenTopBar.jsx +0 -39
  119. package/dist/lib/json/TabbedView.jsx +0 -28
  120. package/dist/lib/json/dialog/DialogRenderer.jsx +0 -13
  121. package/dist/lib/json/dialog/ItemDeleteDialog.jsx +0 -36
  122. package/dist/lib/json/dialog/ItemEditDialog.jsx +0 -124
  123. package/dist/lib/json/table/TableRowActionsView.jsx +0 -45
  124. package/dist/lib/json/table/TableView.jsx +0 -100
  125. package/dist/lib/layout/AdminLayout.jsx +0 -24
  126. package/dist/lib/layout/ButtonBar.jsx +0 -29
  127. package/dist/lib/layout/Content.jsx +0 -10
  128. package/dist/lib/layout/PageTitleBar.jsx +0 -12
  129. package/dist/lib/layout/Sidebar.jsx +0 -24
  130. package/dist/lib/layout/menu/Menu.jsx +0 -30
  131. package/dist/lib/layout/menu/MenuButton.jsx +0 -7
  132. package/dist/lib/layout/menu/MenuItem.jsx +0 -20
  133. package/dist/lib/layout/menu/NextMenuItem.jsx +0 -20
  134. package/dist/lib/layout/menu/SelectedIndicator.jsx +0 -3
  135. package/dist/lib/layout/menu/UserBlock.jsx +0 -55
  136. package/dist/lib/modal/FormActionDialog.jsx +0 -46
  137. package/dist/lib/page/PageContainer.jsx +0 -4
  138. package/dist/lib/page/PageContentEditor.jsx +0 -11
  139. package/dist/lib/page/PageMain.jsx +0 -4
  140. package/dist/lib/page/PageSectionTitle.jsx +0 -3
  141. package/dist/lib/page/PageSidebar.jsx +0 -3
  142. package/dist/lib/page/PageSidebarSection.jsx +0 -7
  143. package/dist/lib/page/PageStateContainer.jsx +0 -9
  144. package/dist/lib/page/PageSubSectionTitle.jsx +0 -3
  145. package/dist/lib/page/PageTitle.jsx +0 -3
  146. package/dist/lib/table/TableContainer.jsx +0 -11
  147. package/dist/lib/table/TableCreateButton.jsx +0 -9
  148. package/dist/lib/table/TableFilterButton.jsx +0 -16
  149. package/dist/lib/table/TableMassActions.jsx +0 -15
  150. package/dist/lib/table/TableRowActionBar.jsx +0 -14
  151. package/dist/lib/table/TableRowActionButton.jsx +0 -7
  152. package/dist/lib/table/TableRowActionDialogButton.jsx +0 -8
  153. package/dist/lib/table/TableTopBar.jsx +0 -17
@@ -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.js";
7
+ import { Sidebar } from "./Sidebar.js";
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
+ }
@@ -1,4 +1,4 @@
1
- import { DialogButtonProps } from "../buttons/DialogButton";
1
+ import { DialogButtonProps } from "../buttons/DialogButton.js";
2
2
  import { ParentComponent, SoperioComponent } from "@soperio/react";
3
3
  import { ButtonProps } from "@valerya/ui";
4
4
  import React from "react";
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { DialogButton } from "../buttons/DialogButton.js";
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
+ }
@@ -1,5 +1,5 @@
1
1
  import { Color, ParentComponent, SoperioComponent } from "@soperio/react";
2
- import { MenuConfig } from "./menu/MenuConfig";
2
+ import { MenuConfig } from "./menu/MenuConfig.js";
3
3
  interface SidebarProps extends SoperioComponent, ParentComponent {
4
4
  show?: boolean;
5
5
  color: Color;
@@ -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.js";
4
+ import { AppEnv } from "@compill/env";
5
+ import Image from "next/image";
6
+ import { UserBlock } from "./menu/UserBlock.js";
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
+ }
@@ -1,5 +1,5 @@
1
1
  import { ParentComponent, SoperioComponent } from "@soperio/react";
2
- import { MenuConfig } from "./MenuConfig";
2
+ import { MenuConfig } from "./MenuConfig.js";
3
3
  export interface MenuProps extends SoperioComponent, ParentComponent {
4
4
  darkMode?: boolean;
5
5
  config: MenuConfig;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { MenuItem } from "./MenuItem.js";
3
+ import { NextMenuItem } from "./NextMenuItem.js";
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
+ }
@@ -1,5 +1,5 @@
1
1
  import { ParentComponent, SoperioComponent } from "@soperio/react";
2
- import { Item } from "./MenuConfig";
2
+ import { Item } from "./MenuConfig.js";
3
3
  interface MenuItemProps extends SoperioComponent, ParentComponent {
4
4
  path: string;
5
5
  depth?: number;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
2
+ import { SelectedIndicator } from "./SelectedIndicator.js";
3
+ import { Link, useLocation, useMatch } from "react-router-dom";
4
+ import { MenuButton } from "./MenuButton.js";
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
+ }
@@ -1,5 +1,5 @@
1
1
  import { ParentComponent, SoperioComponent } from "@soperio/react";
2
- import { Item } from "./MenuConfig";
2
+ import { Item } from "./MenuConfig.js";
3
3
  interface NextMenuItemProps extends SoperioComponent, ParentComponent {
4
4
  path: string;
5
5
  depth?: number;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
2
+ import { MenuButton } from "./MenuButton.js";
3
+ import { SelectedIndicator } from "./SelectedIndicator.js";
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
+ }
@@ -1,4 +1,4 @@
1
- import { MenuConfig } from "./MenuConfig";
1
+ import { MenuConfig } from "./MenuConfig.js";
2
2
  interface UserBlockProps {
3
3
  color: string;
4
4
  darkMode?: boolean;
@@ -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.js";
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,15 +1,16 @@
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";
4
- import { PageContainer } from "./PageContainer";
5
+ import { PageContainer } from "./PageContainer.js";
5
6
  function PageQueryStateContainerInner({ queryId, api, apiFn, loadingStyles, errorStyles, children, ...props }) {
6
7
  // @ts-ignore
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.js";
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,6 +1,6 @@
1
1
  import { ParentComponent, SoperioComponent } from "@soperio/react";
2
2
  import React from "react";
3
- import { Breadcrumb, QueryBreadcrumbs } from "../breadcrumbs/BreadCrumbs";
3
+ import { Breadcrumb, QueryBreadcrumbs } from "../breadcrumbs/BreadCrumbs.js";
4
4
  export interface PageTopBarProps extends SoperioComponent, ParentComponent {
5
5
  title?: string;
6
6
  breadcrumbs?: Breadcrumb[] | QueryBreadcrumbs;
@@ -1,24 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
1
2
  import { createContext } from "@soperio/react";
2
- import { PageTitle } from "./PageTitle";
3
+ import { PageTitle } from "./PageTitle.js";
3
4
  import React from "react";
4
5
  import { createPortal } from "react-dom";
5
6
  import { FlexCenter } from "@compill/components";
6
- import { Breadcrumbs } from "../breadcrumbs/BreadCrumbs";
7
+ import { Breadcrumbs } from "../breadcrumbs/BreadCrumbs.js";
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
  }
@@ -1,5 +1,5 @@
1
1
  // import { mdiViewColumn } from "@mdi/js";
2
- // import { useTableContainerContext } from "./TableContainerContext";
2
+ // import { useTableContainerContext } from "./TableContainerContext.js";
3
3
  // import { ColumnDef, ColumnDefResolved } from "@tanstack/react-table";
4
4
  // import { ButtonProps } from "@valerya/ui";
5
5
  export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "@soperio/jsx-runtime";
2
+ import { TableContextProvider } from "@compill/table";
3
+ import { TableContainerContextProvider } from "./TableContainerContext.js";
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,4 +1,4 @@
1
- import { DialogButtonProps } from "../buttons/DialogButton";
1
+ import { DialogButtonProps } from "../buttons/DialogButton.js";
2
2
  export declare function TableCreateButton({ icon, children, ...props }: {
3
3
  icon?: string;
4
4
  } & DialogButtonProps): JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { mdiPlusThick } from "@mdi/js";
3
+ import { Icon } from "@valerya/ui";
4
+ import { ButtonBarDialogButton } from "../layout/ButtonBar.js";
5
+ export function TableCreateButton({ icon, children, ...props }) {
6
+ return (_jsxs(ButtonBarDialogButton, { ...props, children: [_jsx(Icon, { path: icon ?? mdiPlusThick }), children] }));
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,6 +1,7 @@
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
- import { useTableContainerContext } from "./TableContainerContext";
4
+ import { useTableContainerContext } from "./TableContainerContext.js";
4
5
  import { FieldLabel, FormProvider, FormRenderer, mergeInitialFormValues, SubmitButton } from "@compill/form";
5
6
  import { Button, Collapse } from "@valerya/ui";
6
7
  import { isEqual } from "es-toolkit";
@@ -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
  }
@@ -1,4 +1,4 @@
1
- import { MassAction } from "../json/types/TableView";
1
+ import { MassAction } from "../json/types/TableView.js";
2
2
  interface TableMassActionsProps {
3
3
  actions: MassAction[];
4
4
  }
@@ -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.js";
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
+ }
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
2
+ import { TableRowViewButton } from "./TableRowViewButton.js";
3
+ import { TableRowNavigateButton } from "./TableRowNavigateButton.js";
4
+ import { TableRowEditButton } from "./TableRowEditButton.js";
5
+ import { TableRowDeleteButton } from "./TableRowDeleteButton.js";
6
+ export function TableRowActionBar({ publishId, viewPath, navigatePath, editDialog, deleteDialog, children, ...props }) {
7
+ return (_jsxs("div", { dflex: true, spaceX: "1", placeContent: "end", ...props, children: [viewPath && _jsx(TableRowViewButton, { path: viewPath }), navigatePath && _jsx(TableRowNavigateButton, { path: navigatePath }), editDialog && _jsx(TableRowEditButton, { buildDialog: editDialog }), deleteDialog && _jsx(TableRowDeleteButton, { buildDialog: deleteDialog }), children] }));
8
+ }
@@ -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 TableRowActionButton({ icon, children, ...props }) {
4
+ return (_jsxs(Button, { dflex: true, alignContent: "center", placeContent: "center", py: "2.5", px: "3", h: "full", size: "lg", variant: "borderless", corners: "square", gap: "2", ...props, children: [icon && _jsx(Icon, { path: icon, size: "sm" }), children] }));
5
+ }