@compill/admin 1.0.44 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -170,20 +170,17 @@ function InvalidateButton(_a) {
170
170
  const invalidate = api.useMutate(mutation, {
171
171
  successMsg: "Page successfully invalidated"
172
172
  });
173
- return jsxRuntime.jsx(ui.Button, Object.assign({
173
+ return jsxRuntime.jsx(ui.IconButton, Object.assign({
174
174
  scheme: "dark",
175
175
  variant: "glass",
176
- corners: "pill",
177
- w: "10",
178
- h: "10",
176
+ size: "md",
177
+ corners: "square",
178
+ aspectRatio: "square",
179
179
  title: "Regenerate",
180
180
  disabled: mutation.isLoading,
181
- onClick: invalidate
182
- }, props, {
183
- children: jsxRuntime.jsx(ui.Icon, {
184
- path: mdiDatabaseRefreshOutline
185
- })
186
- }));
181
+ onClick: invalidate,
182
+ icon: mdiDatabaseRefreshOutline
183
+ }, props));
187
184
  }
188
185
 
189
186
  function NavigateButton(_a) {
@@ -228,8 +225,8 @@ function PublishButton(_a) {
228
225
  return jsxRuntime.jsxs(ui.Button, Object.assign({
229
226
  scheme: "secondary",
230
227
  variant: "glass",
231
- corners: "pill",
232
- px: "4",
228
+ size: "sm",
229
+ px: "3",
233
230
  disabled: mutation.isLoading,
234
231
  onClick: publish,
235
232
  dflex: true,
@@ -647,8 +644,8 @@ function UpdateButton(_a) {
647
644
  }, [dirty, props, handleSubmit]);
648
645
  return jsxRuntime.jsxs(form.SubmitButton, Object.assign({
649
646
  type: "submit",
650
- corners: "pill",
651
- px: "4",
647
+ size: "sm",
648
+ px: "3",
652
649
  dflex: true,
653
650
  alignItems: "center",
654
651
  gap: "3"
@@ -668,19 +665,14 @@ function ViewButton(_a) {
668
665
  const openPage = React__default["default"].useCallback(() => {
669
666
  window.open(path, '_blank');
670
667
  }, [path]);
671
- return jsxRuntime.jsx(ui.Button, Object.assign({
668
+ return jsxRuntime.jsx(ui.IconButton, Object.assign({
669
+ icon: icon ? icon : mdiOpenInNew,
672
670
  type: "submit",
673
671
  scheme: "dark",
674
672
  variant: "glass",
675
- corners: "pill",
676
- w: "10",
677
- h: "10",
673
+ size: "md",
678
674
  onClick: openPage
679
- }, props, {
680
- children: jsxRuntime.jsx(ui.Icon, {
681
- path: icon !== null && icon !== void 0 ? icon : mdiOpenInNew
682
- })
683
- }));
675
+ }, props));
684
676
  }
685
677
 
686
678
  function OrderCell({
@@ -820,6 +812,8 @@ function PageContentEditor(_a) {
820
812
  children: jsxRuntime.jsx(FormEditor, {
821
813
  minH: "128",
822
814
  minW: "144",
815
+ maxW: props.maxW,
816
+ // w={props.w}
823
817
  name: name,
824
818
  placeHolder: "Write here..."
825
819
  })
@@ -883,9 +877,10 @@ function PageSidebarSection(_a) {
883
877
  return jsxRuntime.jsxs("div", Object.assign({
884
878
  w: "full",
885
879
  bgColor: "white",
886
- rounded: true,
880
+ rounded: "lg",
887
881
  p: "5",
888
- textSize: "sm"
882
+ textSize: "sm",
883
+ shadow: true
889
884
  }, props, {
890
885
  children: [title && jsxRuntime.jsx(admin.PageSectionTitle, {
891
886
  children: title
@@ -1157,44 +1152,51 @@ function Internal({
1157
1152
  item: item,
1158
1153
  isLoading: mutation.isLoading,
1159
1154
  trackingRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current
1160
- }), jsxRuntime.jsxs(PageContainer, {
1161
- w: editorMaxW ? "auto" : "full",
1162
- size: "x2",
1163
- id: "pagecontainer",
1164
- children: [header, jsxRuntime.jsxs("div", {
1165
- dflex: true,
1166
- gap: "8",
1167
- children: [jsxRuntime.jsxs("div", {
1155
+ }), jsxRuntime.jsx("div", {
1156
+ p: "5",
1157
+ bgColor: "slate-100",
1158
+ rounded: "lg",
1159
+ children: jsxRuntime.jsxs(PageContainer, {
1160
+ w: editorMaxW ? "auto" : "full",
1161
+ size: "x2",
1162
+ id: "pagecontainer",
1163
+ children: [header, jsxRuntime.jsxs("div", {
1168
1164
  dflex: true,
1169
- flexCol: true,
1170
- gap: "8",
1171
- flexGrow: true,
1172
- children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1173
- // TODO Find a way to make this editor shrink in width when resizing the window...
1174
- jsxRuntime.jsx(PageContentEditor, {
1175
- name: "content",
1176
- w: editorMaxW,
1177
- maxW: editorMaxW,
1178
- minW: "144"
1179
- }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsxRuntime.jsx(form.TextArea, {
1180
- name: editor === null || editor === void 0 ? void 0 : editor.name,
1181
- maxW: editorMaxW,
1182
- minW: editorMaxW,
1183
- w: editorMaxW,
1184
- minH: "128",
1185
- rows: 25,
1186
- bgColor: "white",
1187
- border: "0",
1188
- p: "5",
1189
- textColor: "slate-800"
1190
- }), editoFooter]
1191
- }), jsxRuntime.jsx(PageSidebar, {
1192
- children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsxRuntime.jsx(Section, {
1193
- section: section,
1194
- item: item
1195
- }, index))
1165
+ gap: "5",
1166
+ children: [jsxRuntime.jsxs("div", {
1167
+ dflex: true,
1168
+ flexCol: true,
1169
+ gap: "8",
1170
+ flexGrow: true,
1171
+ children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1172
+ // TODO Find a way to make this editor shrink in width when resizing the window...
1173
+ jsxRuntime.jsx(PageContentEditor, {
1174
+ name: "content",
1175
+ maxW: editorMaxW,
1176
+ minW: "144",
1177
+ shadow: true,
1178
+ rounded: "lg"
1179
+ }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsxRuntime.jsx(form.TextArea, {
1180
+ name: editor === null || editor === void 0 ? void 0 : editor.name,
1181
+ maxW: editorMaxW,
1182
+ minW: editorMaxW,
1183
+ w: editorMaxW,
1184
+ minH: "128",
1185
+ rows: 25,
1186
+ bgColor: "white",
1187
+ border: "0",
1188
+ shadow: true,
1189
+ p: "5",
1190
+ textColor: "slate-800"
1191
+ }), editoFooter]
1192
+ }), jsxRuntime.jsx(PageSidebar, {
1193
+ children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsxRuntime.jsx(Section, {
1194
+ section: section,
1195
+ item: item
1196
+ }, index))
1197
+ })]
1196
1198
  })]
1197
- })]
1199
+ })
1198
1200
  })]
1199
1201
  });
1200
1202
  }
@@ -1363,12 +1365,7 @@ function TableContainer(_a) {
1363
1365
  children
1364
1366
  } = _a,
1365
1367
  props = __rest$1(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
1366
- return jsxRuntime.jsx(ui.Tile, Object.assign({
1367
- scheme: "light",
1368
- shadow: true,
1369
- rounded: "md",
1370
- px: "0",
1371
- py: "4",
1368
+ return jsxRuntime.jsx("div", Object.assign({
1372
1369
  w: "full",
1373
1370
  dflex: true,
1374
1371
  flexCol: true
@@ -1390,10 +1387,10 @@ function TableCreateButton(_a) {
1390
1387
  } = _a,
1391
1388
  props = __rest$1(_a, ["children"]);
1392
1389
  return jsxRuntime.jsx(DialogButton, Object.assign({
1393
- scheme: "default",
1394
- corners: "pill",
1395
- h: "10",
1396
- variant: "glass"
1390
+ scheme: "dark",
1391
+ size: "sm",
1392
+ aspectRatio: "square",
1393
+ variant: "borderless"
1397
1394
  }, props, {
1398
1395
  children: children !== null && children !== void 0 ? children : jsxRuntime.jsx(ui.Icon, {
1399
1396
  path: mdiPlusThick
@@ -1408,11 +1405,11 @@ function TableFilterButton(_a) {
1408
1405
  side: "bottom-end",
1409
1406
  modal: true,
1410
1407
  children: [jsxRuntime.jsx(ui.Button, Object.assign({
1411
- scheme: "default",
1412
- corners: "pill",
1413
- w: "10",
1414
- h: "10",
1415
- variant: "glass"
1408
+ scheme: "dark",
1409
+ size: "sm",
1410
+ aspectRatio: "square",
1411
+ variant: "borderless",
1412
+ corners: "square"
1416
1413
  }, props, {
1417
1414
  children: jsxRuntime.jsx(ui.Icon, {
1418
1415
  path: mdiFilter
@@ -1447,26 +1444,18 @@ function TableFilterButton(_a) {
1447
1444
  function TableTopBar(_a) {
1448
1445
  var {
1449
1446
  title,
1450
- queryKey,
1451
1447
  children
1452
1448
  } = _a,
1453
- props = __rest$1(_a, ["title", "queryKey", "children"]);
1454
- const invalidate = api.useInvalidateQuery(queryKey);
1455
- useHotkeys('ctrl+r', () => invalidate(), {
1456
- preventDefault: true
1457
- }, [invalidate]);
1449
+ props = __rest$1(_a, ["title", "children"]);
1458
1450
  return jsxRuntime.jsxs("div", Object.assign({
1459
1451
  dflex: true,
1460
1452
  flexRow: true,
1461
- pb: "4",
1462
1453
  alignItems: "center",
1463
1454
  gap: "3",
1464
- px: "8",
1465
- borderB: "0.5",
1466
- borderBColor: "--bg-2"
1455
+ p: "8"
1467
1456
  }, props, {
1468
1457
  children: [title && jsxRuntime.jsx("h2", {
1469
- textSize: "x3",
1458
+ textSize: "x2",
1470
1459
  fontWeight: "600",
1471
1460
  textColor: "#3f4254",
1472
1461
  textTransform: "capitalize",
@@ -1474,22 +1463,7 @@ function TableTopBar(_a) {
1474
1463
  }), jsxRuntime.jsx("div", {
1475
1464
  flexGrow: true,
1476
1465
  children: "\u00A0"
1477
- }), jsxRuntime.jsxs("div", {
1478
- spaceX: "2",
1479
- dflex: true,
1480
- alignItems: "center",
1481
- children: [jsxRuntime.jsx(ui.Button, {
1482
- scheme: "default",
1483
- corners: "pill",
1484
- w: "10",
1485
- h: "10",
1486
- variant: "glass",
1487
- onClick: invalidate,
1488
- children: jsxRuntime.jsx(ui.Icon, {
1489
- path: mdiRefresh
1490
- })
1491
- }), children]
1492
- })]
1466
+ }), children]
1493
1467
  }));
1494
1468
  }
1495
1469
 
@@ -1952,15 +1926,14 @@ function TableRowPublishPostButton$1(_a) {
1952
1926
  mutation.mutateAsync(id).then(() => reactToastify.toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => reactToastify.toast.error(`Error: ${error}`));
1953
1927
  }, [mutation, id]);
1954
1928
  return jsxRuntime.jsx(ui.Button, Object.assign({
1955
- w: "10",
1956
- h: "10",
1957
1929
  variant: "borderless",
1958
- corners: "pill",
1959
- scheme: "default",
1930
+ corners: "square",
1931
+ scheme: "dark",
1960
1932
  onClick: publish
1961
1933
  }, props, {
1962
1934
  children: jsxRuntime.jsx(ui.Icon, {
1963
- path: isDraft ? mdiPublish : mdiPublishOff
1935
+ path: isDraft ? mdiPublish : mdiPublishOff,
1936
+ size: "sm"
1964
1937
  })
1965
1938
  }));
1966
1939
  }
@@ -1975,8 +1948,10 @@ function TableRowActionsView({
1975
1948
  const item = row.original;
1976
1949
  return jsxRuntime.jsx("div", {
1977
1950
  dflex: true,
1978
- spaceX: "1",
1951
+ w: "full",
1952
+ alignItems: "stretch",
1979
1953
  placeContent: "end",
1954
+ h: "full",
1980
1955
  children: rowActions === null || rowActions === void 0 ? void 0 : rowActions.map((action, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
1981
1956
  children: [action.type === "publish" && jsxRuntime.jsx(TableRowPublishPostButton$1, {
1982
1957
  id: item.id,
@@ -1989,7 +1964,8 @@ function TableRowActionsView({
1989
1964
  onClick: () => onAction(action, item),
1990
1965
  scheme: schemes$1[action.type],
1991
1966
  children: jsxRuntime.jsx(ui.Icon, {
1992
- path: icons[action.type]
1967
+ path: icons[action.type],
1968
+ size: "sm"
1993
1969
  })
1994
1970
  })]
1995
1971
  }, index))
@@ -2006,10 +1982,15 @@ function ActionButton$1(_a) {
2006
1982
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
2007
1983
  }, [onClick]);
2008
1984
  return jsxRuntime.jsx(ui.Button, Object.assign({
2009
- w: "10",
2010
- h: "10",
1985
+ dflex: true,
1986
+ alignContent: "center",
1987
+ placeContent: "center",
1988
+ py: "2.5",
1989
+ px: "3",
1990
+ h: "full",
1991
+ size: "lg",
2011
1992
  variant: "borderless",
2012
- corners: "pill",
1993
+ corners: "default",
2013
1994
  onClick: handleClick
2014
1995
  }, props));
2015
1996
  }
@@ -2023,11 +2004,11 @@ const icons = {
2023
2004
  };
2024
2005
  const schemes$1 = {
2025
2006
  "link": "dark",
2026
- "view": "secondary",
2027
- "edit": "warning",
2028
- "delete": "danger",
2029
- "publish": "warning",
2030
- "custom": "default"
2007
+ "view": "dark",
2008
+ "edit": "dark",
2009
+ "delete": "dark",
2010
+ "publish": "dark",
2011
+ "custom": "dark"
2031
2012
  };
2032
2013
 
2033
2014
  function useTableProps(api, table, rowActions) {
@@ -2505,7 +2486,7 @@ function TableView(_a) {
2505
2486
  const id = useId(queryField);
2506
2487
  const _screen = react.runIfFn(screen, id);
2507
2488
  return jsxRuntime.jsx(PageContainer, Object.assign({
2508
- p: "5"
2489
+ bgColor: "white"
2509
2490
  }, props, {
2510
2491
  children: jsxRuntime.jsx(TableContainer, {
2511
2492
  columns: _screen.table.columns,
@@ -2544,15 +2525,16 @@ function TT({
2544
2525
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2545
2526
  children: [breadcrumbs && jsxRuntime.jsx(PageTopBar, {
2546
2527
  breadcrumbs: breadcrumbs
2547
- }), jsxRuntime.jsxs(TableTopBar, {
2528
+ }), jsxRuntime.jsx(TableTopBar, {
2548
2529
  title: title,
2549
- queryKey: tableApi.queryKey,
2550
- children: [jsxRuntime.jsx(ButtonBar, {
2530
+ children: jsxRuntime.jsx(ButtonBar, {
2551
2531
  buttonBar: buttonBar,
2552
2532
  createView: createView,
2553
2533
  editView: editView,
2554
- api: tableApi
2555
- }), filters && jsxRuntime.jsx(TableFilterButton, {})]
2534
+ api: tableApi,
2535
+ queryKey: tableApi.queryKey,
2536
+ children: filters && jsxRuntime.jsx(TableFilterButton, {})
2537
+ })
2556
2538
  }), filters && jsxRuntime.jsx(TableFilters, {
2557
2539
  form: filters.form,
2558
2540
  initialValues: filters.initialValues,
@@ -2577,10 +2559,16 @@ function TT({
2577
2559
  }
2578
2560
  function ButtonBar({
2579
2561
  buttonBar,
2562
+ queryKey,
2580
2563
  createView,
2581
2564
  editView,
2582
- api
2565
+ api: api$1,
2566
+ children
2583
2567
  }) {
2568
+ const invalidate = api.useInvalidateQuery(queryKey);
2569
+ useHotkeys('ctrl+r', () => invalidate(), {
2570
+ preventDefault: true
2571
+ }, [invalidate]);
2584
2572
  const createDialog = React__default["default"].useCallback(onClose => {
2585
2573
  const view = createView !== null && createView !== void 0 ? createView : editView;
2586
2574
  if (view.type == "customDialog") return view.render({
@@ -2589,17 +2577,33 @@ function ButtonBar({
2589
2577
  });else return jsxRuntime.jsx(DialogRenderer, {
2590
2578
  config: view,
2591
2579
  onClose: onClose,
2592
- invalidateQueryKey: api.queryKey
2580
+ invalidateQueryKey: api$1.queryKey
2593
2581
  });
2594
- }, [editView, api]);
2595
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
2596
- children: buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs("div", {
2582
+ }, [editView, api$1]);
2583
+ return jsxRuntime.jsxs("div", {
2584
+ dflex: true,
2585
+ border: "1px",
2586
+ borderColor: "zinc-200",
2587
+ divideX: "1px",
2588
+ divideColor: "zinc-200",
2589
+ rounded: "lg",
2590
+ overflow: "hidden",
2591
+ children: [jsxRuntime.jsx(ui.Button, {
2592
+ scheme: "dark",
2593
+ size: "sm",
2594
+ aspectRatio: "square",
2595
+ variant: "borderless",
2596
+ onClick: invalidate,
2597
+ children: jsxRuntime.jsx(ui.Icon, {
2598
+ path: mdiRefresh
2599
+ })
2600
+ }), buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
2597
2601
  children: [button.type === "create" && editView && jsxRuntime.jsx(TableCreateButton, {
2598
2602
  buildDialog: createDialog
2599
2603
  }), button.type === "invalidate" && jsxRuntime.jsx(InvalidateButton, {
2600
2604
  pathOrPermalink: button.pathOrPermalink
2601
2605
  }), button.type === "custom" && button.render()]
2602
- }, index))
2606
+ }, index)), children]
2603
2607
  });
2604
2608
  }
2605
2609
  function TableWrapper({
@@ -2621,6 +2625,7 @@ function TableWrapper({
2621
2625
  };
2622
2626
  }, [subtitle]);
2623
2627
  return jsxRuntime.jsx(table.Table, Object.assign({}, tableProps, {
2628
+ p: "8",
2624
2629
  title: _subtitle
2625
2630
  }));
2626
2631
  }
@@ -3251,11 +3256,9 @@ function TableRowNavigateButton(_a) {
3251
3256
  navigate(`${path}`);
3252
3257
  }, [navigate, path]);
3253
3258
  return jsxRuntime.jsx(ui.Button, Object.assign({
3254
- scheme: "secondary",
3255
- w: "10",
3256
- h: "10",
3259
+ scheme: "dark",
3257
3260
  variant: "borderless",
3258
- corners: "pill",
3261
+ corners: "square",
3259
3262
  onClick: handleClick
3260
3263
  }, props, {
3261
3264
  children: jsxRuntime.jsx(ui.Icon, {
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from '@soperio/jsx-runtime';
2
- import { Icon, Button, Container, Tile, Popover, Modal, Collapse, Checkbox, Badge } from '@valerya/ui';
2
+ import { Icon, Button, IconButton, Container, Tile, Popover, Modal, Collapse, Checkbox, Badge } from '@valerya/ui';
3
3
  import Link from 'next/link';
4
4
  import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
5
5
  import { INVALIDATE_API } from '@compill/admin-api';
@@ -161,20 +161,17 @@ function InvalidateButton(_a) {
161
161
  const invalidate = useMutate(mutation, {
162
162
  successMsg: "Page successfully invalidated"
163
163
  });
164
- return jsx(Button, Object.assign({
164
+ return jsx(IconButton, Object.assign({
165
165
  scheme: "dark",
166
166
  variant: "glass",
167
- corners: "pill",
168
- w: "10",
169
- h: "10",
167
+ size: "md",
168
+ corners: "square",
169
+ aspectRatio: "square",
170
170
  title: "Regenerate",
171
171
  disabled: mutation.isLoading,
172
- onClick: invalidate
173
- }, props, {
174
- children: jsx(Icon, {
175
- path: mdiDatabaseRefreshOutline
176
- })
177
- }));
172
+ onClick: invalidate,
173
+ icon: mdiDatabaseRefreshOutline
174
+ }, props));
178
175
  }
179
176
 
180
177
  function NavigateButton(_a) {
@@ -219,8 +216,8 @@ function PublishButton(_a) {
219
216
  return jsxs(Button, Object.assign({
220
217
  scheme: "secondary",
221
218
  variant: "glass",
222
- corners: "pill",
223
- px: "4",
219
+ size: "sm",
220
+ px: "3",
224
221
  disabled: mutation.isLoading,
225
222
  onClick: publish,
226
223
  dflex: true,
@@ -638,8 +635,8 @@ function UpdateButton(_a) {
638
635
  }, [dirty, props, handleSubmit]);
639
636
  return jsxs(SubmitButton, Object.assign({
640
637
  type: "submit",
641
- corners: "pill",
642
- px: "4",
638
+ size: "sm",
639
+ px: "3",
643
640
  dflex: true,
644
641
  alignItems: "center",
645
642
  gap: "3"
@@ -659,19 +656,14 @@ function ViewButton(_a) {
659
656
  const openPage = React.useCallback(() => {
660
657
  window.open(path, '_blank');
661
658
  }, [path]);
662
- return jsx(Button, Object.assign({
659
+ return jsx(IconButton, Object.assign({
660
+ icon: icon ? icon : mdiOpenInNew,
663
661
  type: "submit",
664
662
  scheme: "dark",
665
663
  variant: "glass",
666
- corners: "pill",
667
- w: "10",
668
- h: "10",
664
+ size: "md",
669
665
  onClick: openPage
670
- }, props, {
671
- children: jsx(Icon, {
672
- path: icon !== null && icon !== void 0 ? icon : mdiOpenInNew
673
- })
674
- }));
666
+ }, props));
675
667
  }
676
668
 
677
669
  function OrderCell({
@@ -811,6 +803,8 @@ function PageContentEditor(_a) {
811
803
  children: jsx(FormEditor, {
812
804
  minH: "128",
813
805
  minW: "144",
806
+ maxW: props.maxW,
807
+ // w={props.w}
814
808
  name: name,
815
809
  placeHolder: "Write here..."
816
810
  })
@@ -874,9 +868,10 @@ function PageSidebarSection(_a) {
874
868
  return jsxs("div", Object.assign({
875
869
  w: "full",
876
870
  bgColor: "white",
877
- rounded: true,
871
+ rounded: "lg",
878
872
  p: "5",
879
- textSize: "sm"
873
+ textSize: "sm",
874
+ shadow: true
880
875
  }, props, {
881
876
  children: [title && jsx(PageSectionTitle$1, {
882
877
  children: title
@@ -1148,44 +1143,51 @@ function Internal({
1148
1143
  item: item,
1149
1144
  isLoading: mutation.isLoading,
1150
1145
  trackingRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current
1151
- }), jsxs(PageContainer, {
1152
- w: editorMaxW ? "auto" : "full",
1153
- size: "x2",
1154
- id: "pagecontainer",
1155
- children: [header, jsxs("div", {
1156
- dflex: true,
1157
- gap: "8",
1158
- children: [jsxs("div", {
1146
+ }), jsx("div", {
1147
+ p: "5",
1148
+ bgColor: "slate-100",
1149
+ rounded: "lg",
1150
+ children: jsxs(PageContainer, {
1151
+ w: editorMaxW ? "auto" : "full",
1152
+ size: "x2",
1153
+ id: "pagecontainer",
1154
+ children: [header, jsxs("div", {
1159
1155
  dflex: true,
1160
- flexCol: true,
1161
- gap: "8",
1162
- flexGrow: true,
1163
- children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1164
- // TODO Find a way to make this editor shrink in width when resizing the window...
1165
- jsx(PageContentEditor, {
1166
- name: "content",
1167
- w: editorMaxW,
1168
- maxW: editorMaxW,
1169
- minW: "144"
1170
- }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsx(TextArea, {
1171
- name: editor === null || editor === void 0 ? void 0 : editor.name,
1172
- maxW: editorMaxW,
1173
- minW: editorMaxW,
1174
- w: editorMaxW,
1175
- minH: "128",
1176
- rows: 25,
1177
- bgColor: "white",
1178
- border: "0",
1179
- p: "5",
1180
- textColor: "slate-800"
1181
- }), editoFooter]
1182
- }), jsx(PageSidebar, {
1183
- children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsx(Section, {
1184
- section: section,
1185
- item: item
1186
- }, index))
1156
+ gap: "5",
1157
+ children: [jsxs("div", {
1158
+ dflex: true,
1159
+ flexCol: true,
1160
+ gap: "8",
1161
+ flexGrow: true,
1162
+ children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1163
+ // TODO Find a way to make this editor shrink in width when resizing the window...
1164
+ jsx(PageContentEditor, {
1165
+ name: "content",
1166
+ maxW: editorMaxW,
1167
+ minW: "144",
1168
+ shadow: true,
1169
+ rounded: "lg"
1170
+ }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsx(TextArea, {
1171
+ name: editor === null || editor === void 0 ? void 0 : editor.name,
1172
+ maxW: editorMaxW,
1173
+ minW: editorMaxW,
1174
+ w: editorMaxW,
1175
+ minH: "128",
1176
+ rows: 25,
1177
+ bgColor: "white",
1178
+ border: "0",
1179
+ shadow: true,
1180
+ p: "5",
1181
+ textColor: "slate-800"
1182
+ }), editoFooter]
1183
+ }), jsx(PageSidebar, {
1184
+ children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsx(Section, {
1185
+ section: section,
1186
+ item: item
1187
+ }, index))
1188
+ })]
1187
1189
  })]
1188
- })]
1190
+ })
1189
1191
  })]
1190
1192
  });
1191
1193
  }
@@ -1354,12 +1356,7 @@ function TableContainer(_a) {
1354
1356
  children
1355
1357
  } = _a,
1356
1358
  props = __rest$1(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
1357
- return jsx(Tile, Object.assign({
1358
- scheme: "light",
1359
- shadow: true,
1360
- rounded: "md",
1361
- px: "0",
1362
- py: "4",
1359
+ return jsx("div", Object.assign({
1363
1360
  w: "full",
1364
1361
  dflex: true,
1365
1362
  flexCol: true
@@ -1381,10 +1378,10 @@ function TableCreateButton(_a) {
1381
1378
  } = _a,
1382
1379
  props = __rest$1(_a, ["children"]);
1383
1380
  return jsx(DialogButton, Object.assign({
1384
- scheme: "default",
1385
- corners: "pill",
1386
- h: "10",
1387
- variant: "glass"
1381
+ scheme: "dark",
1382
+ size: "sm",
1383
+ aspectRatio: "square",
1384
+ variant: "borderless"
1388
1385
  }, props, {
1389
1386
  children: children !== null && children !== void 0 ? children : jsx(Icon, {
1390
1387
  path: mdiPlusThick
@@ -1399,11 +1396,11 @@ function TableFilterButton(_a) {
1399
1396
  side: "bottom-end",
1400
1397
  modal: true,
1401
1398
  children: [jsx(Button, Object.assign({
1402
- scheme: "default",
1403
- corners: "pill",
1404
- w: "10",
1405
- h: "10",
1406
- variant: "glass"
1399
+ scheme: "dark",
1400
+ size: "sm",
1401
+ aspectRatio: "square",
1402
+ variant: "borderless",
1403
+ corners: "square"
1407
1404
  }, props, {
1408
1405
  children: jsx(Icon, {
1409
1406
  path: mdiFilter
@@ -1438,26 +1435,18 @@ function TableFilterButton(_a) {
1438
1435
  function TableTopBar(_a) {
1439
1436
  var {
1440
1437
  title,
1441
- queryKey,
1442
1438
  children
1443
1439
  } = _a,
1444
- props = __rest$1(_a, ["title", "queryKey", "children"]);
1445
- const invalidate = useInvalidateQuery(queryKey);
1446
- useHotkeys('ctrl+r', () => invalidate(), {
1447
- preventDefault: true
1448
- }, [invalidate]);
1440
+ props = __rest$1(_a, ["title", "children"]);
1449
1441
  return jsxs("div", Object.assign({
1450
1442
  dflex: true,
1451
1443
  flexRow: true,
1452
- pb: "4",
1453
1444
  alignItems: "center",
1454
1445
  gap: "3",
1455
- px: "8",
1456
- borderB: "0.5",
1457
- borderBColor: "--bg-2"
1446
+ p: "8"
1458
1447
  }, props, {
1459
1448
  children: [title && jsx("h2", {
1460
- textSize: "x3",
1449
+ textSize: "x2",
1461
1450
  fontWeight: "600",
1462
1451
  textColor: "#3f4254",
1463
1452
  textTransform: "capitalize",
@@ -1465,22 +1454,7 @@ function TableTopBar(_a) {
1465
1454
  }), jsx("div", {
1466
1455
  flexGrow: true,
1467
1456
  children: "\u00A0"
1468
- }), jsxs("div", {
1469
- spaceX: "2",
1470
- dflex: true,
1471
- alignItems: "center",
1472
- children: [jsx(Button, {
1473
- scheme: "default",
1474
- corners: "pill",
1475
- w: "10",
1476
- h: "10",
1477
- variant: "glass",
1478
- onClick: invalidate,
1479
- children: jsx(Icon, {
1480
- path: mdiRefresh
1481
- })
1482
- }), children]
1483
- })]
1457
+ }), children]
1484
1458
  }));
1485
1459
  }
1486
1460
 
@@ -1943,15 +1917,14 @@ function TableRowPublishPostButton$1(_a) {
1943
1917
  mutation.mutateAsync(id).then(() => toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => toast.error(`Error: ${error}`));
1944
1918
  }, [mutation, id]);
1945
1919
  return jsx(Button, Object.assign({
1946
- w: "10",
1947
- h: "10",
1948
1920
  variant: "borderless",
1949
- corners: "pill",
1950
- scheme: "default",
1921
+ corners: "square",
1922
+ scheme: "dark",
1951
1923
  onClick: publish
1952
1924
  }, props, {
1953
1925
  children: jsx(Icon, {
1954
- path: isDraft ? mdiPublish : mdiPublishOff
1926
+ path: isDraft ? mdiPublish : mdiPublishOff,
1927
+ size: "sm"
1955
1928
  })
1956
1929
  }));
1957
1930
  }
@@ -1966,8 +1939,10 @@ function TableRowActionsView({
1966
1939
  const item = row.original;
1967
1940
  return jsx("div", {
1968
1941
  dflex: true,
1969
- spaceX: "1",
1942
+ w: "full",
1943
+ alignItems: "stretch",
1970
1944
  placeContent: "end",
1945
+ h: "full",
1971
1946
  children: rowActions === null || rowActions === void 0 ? void 0 : rowActions.map((action, index) => jsxs(React.Fragment, {
1972
1947
  children: [action.type === "publish" && jsx(TableRowPublishPostButton$1, {
1973
1948
  id: item.id,
@@ -1980,7 +1955,8 @@ function TableRowActionsView({
1980
1955
  onClick: () => onAction(action, item),
1981
1956
  scheme: schemes$1[action.type],
1982
1957
  children: jsx(Icon, {
1983
- path: icons[action.type]
1958
+ path: icons[action.type],
1959
+ size: "sm"
1984
1960
  })
1985
1961
  })]
1986
1962
  }, index))
@@ -1997,10 +1973,15 @@ function ActionButton$1(_a) {
1997
1973
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
1998
1974
  }, [onClick]);
1999
1975
  return jsx(Button, Object.assign({
2000
- w: "10",
2001
- h: "10",
1976
+ dflex: true,
1977
+ alignContent: "center",
1978
+ placeContent: "center",
1979
+ py: "2.5",
1980
+ px: "3",
1981
+ h: "full",
1982
+ size: "lg",
2002
1983
  variant: "borderless",
2003
- corners: "pill",
1984
+ corners: "default",
2004
1985
  onClick: handleClick
2005
1986
  }, props));
2006
1987
  }
@@ -2014,11 +1995,11 @@ const icons = {
2014
1995
  };
2015
1996
  const schemes$1 = {
2016
1997
  "link": "dark",
2017
- "view": "secondary",
2018
- "edit": "warning",
2019
- "delete": "danger",
2020
- "publish": "warning",
2021
- "custom": "default"
1998
+ "view": "dark",
1999
+ "edit": "dark",
2000
+ "delete": "dark",
2001
+ "publish": "dark",
2002
+ "custom": "dark"
2022
2003
  };
2023
2004
 
2024
2005
  function useTableProps(api, table, rowActions) {
@@ -2496,7 +2477,7 @@ function TableView(_a) {
2496
2477
  const id = useId(queryField);
2497
2478
  const _screen = runIfFn(screen, id);
2498
2479
  return jsx(PageContainer, Object.assign({
2499
- p: "5"
2480
+ bgColor: "white"
2500
2481
  }, props, {
2501
2482
  children: jsx(TableContainer, {
2502
2483
  columns: _screen.table.columns,
@@ -2535,15 +2516,16 @@ function TT({
2535
2516
  return jsxs(Fragment, {
2536
2517
  children: [breadcrumbs && jsx(PageTopBar, {
2537
2518
  breadcrumbs: breadcrumbs
2538
- }), jsxs(TableTopBar, {
2519
+ }), jsx(TableTopBar, {
2539
2520
  title: title,
2540
- queryKey: tableApi.queryKey,
2541
- children: [jsx(ButtonBar, {
2521
+ children: jsx(ButtonBar, {
2542
2522
  buttonBar: buttonBar,
2543
2523
  createView: createView,
2544
2524
  editView: editView,
2545
- api: tableApi
2546
- }), filters && jsx(TableFilterButton, {})]
2525
+ api: tableApi,
2526
+ queryKey: tableApi.queryKey,
2527
+ children: filters && jsx(TableFilterButton, {})
2528
+ })
2547
2529
  }), filters && jsx(TableFilters, {
2548
2530
  form: filters.form,
2549
2531
  initialValues: filters.initialValues,
@@ -2568,10 +2550,16 @@ function TT({
2568
2550
  }
2569
2551
  function ButtonBar({
2570
2552
  buttonBar,
2553
+ queryKey,
2571
2554
  createView,
2572
2555
  editView,
2573
- api
2556
+ api,
2557
+ children
2574
2558
  }) {
2559
+ const invalidate = useInvalidateQuery(queryKey);
2560
+ useHotkeys('ctrl+r', () => invalidate(), {
2561
+ preventDefault: true
2562
+ }, [invalidate]);
2575
2563
  const createDialog = React.useCallback(onClose => {
2576
2564
  const view = createView !== null && createView !== void 0 ? createView : editView;
2577
2565
  if (view.type == "customDialog") return view.render({
@@ -2583,14 +2571,30 @@ function ButtonBar({
2583
2571
  invalidateQueryKey: api.queryKey
2584
2572
  });
2585
2573
  }, [editView, api]);
2586
- return jsx(Fragment, {
2587
- children: buttonBar && buttonBar.map((button, index) => jsxs("div", {
2574
+ return jsxs("div", {
2575
+ dflex: true,
2576
+ border: "1px",
2577
+ borderColor: "zinc-200",
2578
+ divideX: "1px",
2579
+ divideColor: "zinc-200",
2580
+ rounded: "lg",
2581
+ overflow: "hidden",
2582
+ children: [jsx(Button, {
2583
+ scheme: "dark",
2584
+ size: "sm",
2585
+ aspectRatio: "square",
2586
+ variant: "borderless",
2587
+ onClick: invalidate,
2588
+ children: jsx(Icon, {
2589
+ path: mdiRefresh
2590
+ })
2591
+ }), buttonBar && buttonBar.map((button, index) => jsxs(React.Fragment, {
2588
2592
  children: [button.type === "create" && editView && jsx(TableCreateButton, {
2589
2593
  buildDialog: createDialog
2590
2594
  }), button.type === "invalidate" && jsx(InvalidateButton, {
2591
2595
  pathOrPermalink: button.pathOrPermalink
2592
2596
  }), button.type === "custom" && button.render()]
2593
- }, index))
2597
+ }, index)), children]
2594
2598
  });
2595
2599
  }
2596
2600
  function TableWrapper({
@@ -2612,6 +2616,7 @@ function TableWrapper({
2612
2616
  };
2613
2617
  }, [subtitle]);
2614
2618
  return jsx(Table, Object.assign({}, tableProps, {
2619
+ p: "8",
2615
2620
  title: _subtitle
2616
2621
  }));
2617
2622
  }
@@ -3242,11 +3247,9 @@ function TableRowNavigateButton(_a) {
3242
3247
  navigate(`${path}`);
3243
3248
  }, [navigate, path]);
3244
3249
  return jsx(Button, Object.assign({
3245
- scheme: "secondary",
3246
- w: "10",
3247
- h: "10",
3250
+ scheme: "dark",
3248
3251
  variant: "borderless",
3249
- corners: "pill",
3252
+ corners: "square",
3250
3253
  onClick: handleClick
3251
3254
  }, props, {
3252
3255
  children: jsx(Icon, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { ButtonProps } from "@valerya/ui";
3
- interface InvalidateButtonProps extends ButtonProps {
2
+ import { IconButtonProps } from "@valerya/ui";
3
+ interface InvalidateButtonProps extends Omit<IconButtonProps, "icon"> {
4
4
  pathOrPermalink: string;
5
5
  }
6
6
  export declare function InvalidateButton({ pathOrPermalink, ...props }: InvalidateButtonProps): JSX.Element;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { ButtonProps } from "@valerya/ui";
3
- export declare function ViewButton({ path, icon, ...props }: {
2
+ import { IconButtonProps } from "@valerya/ui";
3
+ export declare function ViewButton({ path, icon, ...props }: Omit<IconButtonProps, "icon"> & {
4
4
  path: string;
5
5
  icon?: string;
6
- } & ButtonProps): JSX.Element;
6
+ }): JSX.Element;
@@ -2,7 +2,6 @@
2
2
  import { ParentComponent, SoperioComponent } from "@soperio/react";
3
3
  interface TableTopBarProps extends SoperioComponent, ParentComponent {
4
4
  title?: string;
5
- queryKey: string[];
6
5
  }
7
- export declare function TableTopBar({ title, queryKey, children, ...props }: TableTopBarProps): JSX.Element;
6
+ export declare function TableTopBar({ title, children, ...props }: TableTopBarProps): JSX.Element;
8
7
  export {};