@comet/admin 9.0.0-beta.3 → 9.0.0-beta.5

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 (105) hide show
  1. package/lib/common/DeleteDialog.d.ts +1 -0
  2. package/lib/common/DeleteDialog.d.ts.map +1 -1
  3. package/lib/common/DeleteDialog.js +8 -1
  4. package/lib/common/__stories__/Tooltip.stories.js +404 -0
  5. package/lib/common/buttons/__stories__/Button.stories.js +445 -0
  6. package/lib/common/buttons/clearinput/ClearInputButton.js +1 -1
  7. package/lib/common/buttons/delete/__stories__/DeleteButton.stories.js +1 -1
  8. package/lib/common/toolbar/__stories__/DataGridToolbar.stories.js +76 -0
  9. package/lib/common/toolbar/__stories__/Toolbar.stories.js +82 -0
  10. package/lib/dataGrid/__stories__/ClickableRows.stories.js +109 -0
  11. package/lib/dataGrid/__stories__/CrudMoreActionsMenu.stories.js +50 -0
  12. package/lib/dataGrid/__stories__/DataGrid.stories.js +94 -0
  13. package/lib/dataGrid/__stories__/DataGridSingleSelectFilter.stories.js +492 -0
  14. package/lib/error/errorHandler/ErrorHandlerProvider.d.ts +8 -0
  15. package/lib/error/errorHandler/ErrorHandlerProvider.d.ts.map +1 -0
  16. package/lib/error/errorHandler/ErrorHandlerProvider.js +16 -0
  17. package/lib/error/errorboundary/ErrorBoundary.d.ts.map +1 -1
  18. package/lib/error/errorboundary/ErrorBoundary.js +26 -18
  19. package/lib/form/FinalFormInput.d.ts.map +1 -1
  20. package/lib/form/FinalFormInput.js +3 -2
  21. package/lib/form/__stories__/AsyncAutocompleteField.stories.js +660 -0
  22. package/lib/form/__stories__/AsyncSelectField.stories.js +513 -0
  23. package/lib/form/__stories__/Autocomplete.stories.js +188 -0
  24. package/lib/form/__stories__/AutocompleteField.stories.js +48 -0
  25. package/lib/form/__stories__/Checkbox.stories.js +70 -0
  26. package/lib/form/__stories__/CheckboxField.stories.js +87 -0
  27. package/lib/form/__stories__/CheckboxListField.stories.js +172 -0
  28. package/lib/form/__stories__/CustomButtons.stories.js +78 -0
  29. package/lib/form/__stories__/DependentAsyncSelects.stories.js +91 -0
  30. package/lib/form/__stories__/DisableAutoNavigation.stories.js +132 -0
  31. package/lib/form/__stories__/DisabledSubmitIfNotDirty.stories.js +54 -0
  32. package/lib/form/__stories__/FieldContainer.stories.js +87 -0
  33. package/lib/form/__stories__/FinalFormFileSelect.stories.js +155 -0
  34. package/lib/form/__stories__/FormInStack.stories.js +133 -0
  35. package/lib/form/__stories__/FormLayouts.stories.js +174 -0
  36. package/lib/form/__stories__/FormValidation.stories.js +82 -0
  37. package/lib/form/__stories__/Input.stories.js +37 -0
  38. package/lib/form/__stories__/NumberField.stories.js +38 -0
  39. package/lib/form/__stories__/Radio.stories.js +101 -0
  40. package/lib/form/__stories__/RadioGroupField.stories.js +172 -0
  41. package/lib/form/__stories__/RangeInput.stories.js +239 -0
  42. package/lib/form/__stories__/RouterTabs.stories.js +96 -0
  43. package/lib/form/__stories__/RouterTabsInForm.stories.js +73 -0
  44. package/lib/form/__stories__/RouterTabsInFormWithSubroutes.stories.js +96 -0
  45. package/lib/form/__stories__/ScrollToErrorField.stories.js +82 -0
  46. package/lib/form/__stories__/SearchField.stories.js +38 -0
  47. package/lib/form/__stories__/Select.stories.js +187 -0
  48. package/lib/form/__stories__/SelectField.stories.js +100 -0
  49. package/lib/form/__stories__/ShowErrorStrategies.stories.js +107 -0
  50. package/lib/form/__stories__/SingleTextField.stories.js +108 -0
  51. package/lib/form/__stories__/StackInForm.stories.js +53 -0
  52. package/lib/form/__stories__/SubmitErrors.stories.js +90 -0
  53. package/lib/form/__stories__/Switch.stories.js +49 -0
  54. package/lib/form/__stories__/SwitchField.stories.js +87 -0
  55. package/lib/form/__stories__/Tabs.stories.js +78 -0
  56. package/lib/form/__stories__/TextAreaField.stories.js +38 -0
  57. package/lib/form/__stories__/TextField.stories.js +67 -0
  58. package/lib/form/__stories__/ToggleButtonGroupField.stories.js +312 -0
  59. package/lib/form/__stories__/TwoLevelValidation.stories.js +168 -0
  60. package/lib/form/__stories__/Typography.stories.js +71 -0
  61. package/lib/form/file/__stories__/FileDropzone.stories.js +81 -0
  62. package/lib/form/file/__stories__/FileSelect.stories.js +139 -0
  63. package/lib/form/file/__stories__/FileSelectListItem.stories.js +108 -0
  64. package/lib/form/file/__stories__/FileSelectMultipleExamples.stories.js +187 -0
  65. package/lib/helpers/useTopOffset.js +1 -1
  66. package/lib/index.d.ts +1 -0
  67. package/lib/index.d.ts.map +1 -1
  68. package/lib/index.js +1 -0
  69. package/lib/section/__stories__/SectionHeadline.stories.js +71 -0
  70. package/lib/stack/Stack.d.ts.map +1 -1
  71. package/lib/stack/Stack.js +3 -0
  72. package/lib/stack/__stories__/RouterTabsNestedStack.stories.js +51 -0
  73. package/lib/stack/__stories__/Stack.stories.js +14 -0
  74. package/lib/stack/__stories__/StackBackButton.stories.js +50 -0
  75. package/lib/stack/__stories__/StackBreadcrumbs.stories.js +139 -0
  76. package/lib/stack/__stories__/StackBreadcrumbsTabs.stories.js +47 -0
  77. package/lib/stack/__stories__/StackCustomSeparator.stories.js +47 -0
  78. package/lib/stack/__stories__/StackLink.stories.js +41 -0
  79. package/lib/stack/__stories__/StackNested.stories.js +58 -0
  80. package/lib/stack/__stories__/StackNestedOnInitialPage.stories.js +78 -0
  81. package/lib/stack/__stories__/StackNestedOneStack.stories.js +90 -0
  82. package/lib/stack/__stories__/StackPageTitle.stories.js +121 -0
  83. package/lib/stack/__stories__/StackReactNodeTitle.stories.js +54 -0
  84. package/lib/stack/__stories__/StackRefApi.stories.js +56 -0
  85. package/lib/stack/__stories__/StackTableFormQueryAtStack.stories.js +155 -0
  86. package/lib/stack/__stories__/StackTableFormQueryInTable.stories.js +160 -0
  87. package/lib/stack/__stories__/StackUrl.stories.js +66 -0
  88. package/lib/tabs/__stories__/DynamicTabs.stories.js +84 -0
  89. package/lib/tabs/__stories__/NestedStackSwitchWithRouterTabs.stories.js +84 -0
  90. package/lib/tabs/__stories__/OverflowIssues.stories.js +224 -0
  91. package/lib/tabs/__stories__/RouterTabs.stories.js +31 -0
  92. package/lib/tabs/__stories__/RouterTabsInStack.stories.js +74 -0
  93. package/lib/tabs/__stories__/RouterTabsInSubroute.stories.js +68 -0
  94. package/lib/tabs/__stories__/Tabs.stories.js +219 -0
  95. package/lib/theme/componentsTheme/MuiDataGrid.js +1 -1
  96. package/lib/translator/ContentTranslationServiceContext.d.ts +1 -0
  97. package/lib/translator/ContentTranslationServiceContext.d.ts.map +1 -1
  98. package/lib/translator/ContentTranslationServiceProvider.d.ts +1 -1
  99. package/lib/translator/ContentTranslationServiceProvider.d.ts.map +1 -1
  100. package/lib/translator/ContentTranslationServiceProvider.js +4 -2
  101. package/lib/translator/PlainTextTranslationDialog.d.ts +1 -0
  102. package/lib/translator/PlainTextTranslationDialog.d.ts.map +1 -1
  103. package/lib/translator/PlainTextTranslationDialog.js +8 -3
  104. package/lib/translator/__stories__/ContentTranslation.stories.js +104 -0
  105. package/package.json +23 -24
@@ -0,0 +1,109 @@
1
+ import { Edit } from "@comet/admin-icons";
2
+ import { IconButton } from "@mui/material";
3
+ import { DataGrid } from "@mui/x-data-grid";
4
+ import { ToolbarBackButton } from "../../common/toolbar/backbutton/ToolbarBackButton";
5
+ import { ToolbarTitleItem } from "../../common/toolbar/titleitem/ToolbarTitleItem";
6
+ import { Toolbar } from "../../common/toolbar/Toolbar";
7
+ import { StackPage } from "../../stack/Page";
8
+ import { StackLink } from "../../stack/StackLink";
9
+ import { StackSwitch, useStackSwitchApi } from "../../stack/Switch";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ var exampleRows = [{
12
+ id: 1,
13
+ lastName: "Snow",
14
+ firstName: "Jon"
15
+ }, {
16
+ id: 2,
17
+ lastName: "Lannister",
18
+ firstName: "Cersei"
19
+ }, {
20
+ id: 3,
21
+ lastName: "Lannister",
22
+ firstName: "Jaime"
23
+ }, {
24
+ id: 4,
25
+ lastName: "Stark",
26
+ firstName: "Arya"
27
+ }, {
28
+ id: 5,
29
+ lastName: "Targaryen",
30
+ firstName: "Daenerys"
31
+ }, {
32
+ id: 6,
33
+ lastName: "Melisandre",
34
+ firstName: null
35
+ }, {
36
+ id: 7,
37
+ lastName: "Clifford",
38
+ firstName: "Ferrara"
39
+ }, {
40
+ id: 8,
41
+ lastName: "Frances",
42
+ firstName: "Rossini"
43
+ }, {
44
+ id: 9,
45
+ lastName: "Roxie",
46
+ firstName: "Harvey"
47
+ }];
48
+ var exampleColumns = [{
49
+ field: "firstName",
50
+ headerName: "First name",
51
+ flex: 1
52
+ }, {
53
+ field: "lastName",
54
+ headerName: "Last name",
55
+ flex: 1
56
+ }];
57
+ export default {
58
+ title: "components/dataGrid/ClickableRows",
59
+ parameters: {
60
+ stack: {
61
+ topLevelTitle: "Example Page"
62
+ }
63
+ }
64
+ };
65
+ export var ClickableRows = function ClickableRows() {
66
+ // Grid must be a separate component to make sure the stackSwitchApi context is correct
67
+ var Grid = function Grid() {
68
+ var stackSwitchApi = useStackSwitchApi();
69
+ var columns = [].concat(exampleColumns, [{
70
+ field: "actions",
71
+ type: "actions",
72
+ headerName: "",
73
+ width: 52,
74
+ renderCell: function renderCell(params) {
75
+ return /*#__PURE__*/_jsx(IconButton, {
76
+ color: "primary",
77
+ component: StackLink,
78
+ pageName: "edit",
79
+ payload: params.row.id,
80
+ children: /*#__PURE__*/_jsx(Edit, {})
81
+ });
82
+ }
83
+ }]);
84
+ return /*#__PURE__*/_jsx(DataGrid, {
85
+ rows: exampleRows,
86
+ columns: columns,
87
+ onRowClick: function onRowClick(params) {
88
+ stackSwitchApi.activatePage("edit", params.row.id);
89
+ }
90
+ });
91
+ };
92
+ return /*#__PURE__*/_jsxs(StackSwitch, {
93
+ children: [/*#__PURE__*/_jsx(StackPage, {
94
+ name: "grid",
95
+ children: /*#__PURE__*/_jsx(Grid, {})
96
+ }), /*#__PURE__*/_jsx(StackPage, {
97
+ name: "edit",
98
+ children: function children(id) {
99
+ return /*#__PURE__*/_jsxs(Toolbar, {
100
+ children: [/*#__PURE__*/_jsx(ToolbarBackButton, {}), /*#__PURE__*/_jsxs(ToolbarTitleItem, {
101
+ children: ["Editing item with id: ", /*#__PURE__*/_jsx("code", {
102
+ children: id
103
+ })]
104
+ })]
105
+ });
106
+ }
107
+ })]
108
+ });
109
+ };
@@ -0,0 +1,50 @@
1
+ import { Delete, Download, Excel, Favorite, Move } from "@comet/admin-icons";
2
+ import { ListItemIcon } from "@mui/material";
3
+ import { CrudMoreActionsMenu, CrudMoreActionsMenuItem } from "../CrudMoreActionsMenu";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export default {
6
+ title: "components/dataGrid/CrudMoreActionsMenu"
7
+ };
8
+ export var Basic = function Basic() {
9
+ return /*#__PURE__*/_jsx(CrudMoreActionsMenu, {
10
+ selectionSize: 2,
11
+ overallActions: [{
12
+ label: "Export to Excel",
13
+ onClick: function onClick() {},
14
+ icon: /*#__PURE__*/_jsx(Excel, {})
15
+ }],
16
+ selectiveActions: [{
17
+ label: "Move",
18
+ onClick: function onClick() {},
19
+ icon: /*#__PURE__*/_jsx(Move, {})
20
+ }, {
21
+ label: "Delete",
22
+ onClick: function onClick() {},
23
+ icon: /*#__PURE__*/_jsx(Delete, {}),
24
+ divider: true
25
+ }, {
26
+ label: "Download",
27
+ onClick: function onClick() {},
28
+ icon: /*#__PURE__*/_jsx(Download, {})
29
+ }]
30
+ });
31
+ };
32
+ export var CustomComponent = function CustomComponent() {
33
+ var CustomAction = function CustomAction() {
34
+ return /*#__PURE__*/_jsxs(CrudMoreActionsMenuItem, {
35
+ onClick: function onClick() {
36
+ window.alert("Hello from custom action");
37
+ },
38
+ children: [/*#__PURE__*/_jsx(ListItemIcon, {
39
+ children: /*#__PURE__*/_jsx(Favorite, {})
40
+ }), "Custom Action"]
41
+ });
42
+ };
43
+ return /*#__PURE__*/_jsx(CrudMoreActionsMenu, {
44
+ overallActions: [{
45
+ label: "Export to Excel",
46
+ onClick: function onClick() {},
47
+ icon: /*#__PURE__*/_jsx(Excel, {})
48
+ }, /*#__PURE__*/_jsx(CustomAction, {}, "custom-action")]
49
+ });
50
+ };
@@ -0,0 +1,94 @@
1
+ import { Add } from "@comet/admin-icons";
2
+ import { Box } from "@mui/material";
3
+ import { DataGrid } from "@mui/x-data-grid";
4
+ import { Button } from "../../common/buttons/Button";
5
+ import { FillSpace } from "../../common/FillSpace";
6
+ import { DataGridToolbar } from "../../common/toolbar/DataGridToolbar";
7
+ import { ToolbarTitleItem } from "../../common/toolbar/titleitem/ToolbarTitleItem";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ var exampleRows = [{
10
+ id: 1,
11
+ lastName: "Snow",
12
+ firstName: "Jon"
13
+ }, {
14
+ id: 2,
15
+ lastName: "Lannister",
16
+ firstName: "Cersei"
17
+ }, {
18
+ id: 3,
19
+ lastName: "Lannister",
20
+ firstName: "Jaime"
21
+ }, {
22
+ id: 4,
23
+ lastName: "Stark",
24
+ firstName: "Arya"
25
+ }, {
26
+ id: 5,
27
+ lastName: "Targaryen",
28
+ firstName: "Daenerys"
29
+ }, {
30
+ id: 6,
31
+ lastName: "Melisandre",
32
+ firstName: null
33
+ }, {
34
+ id: 7,
35
+ lastName: "Clifford",
36
+ firstName: "Ferrara"
37
+ }, {
38
+ id: 8,
39
+ lastName: "Frances",
40
+ firstName: "Rossini"
41
+ }, {
42
+ id: 9,
43
+ lastName: "Roxie",
44
+ firstName: "Harvey"
45
+ }];
46
+ var exampleColumns = [{
47
+ field: "firstName",
48
+ headerName: "First name",
49
+ flex: 1
50
+ }, {
51
+ field: "lastName",
52
+ headerName: "Last name",
53
+ flex: 1
54
+ }];
55
+ export default {
56
+ title: "components/dataGrid/DataGrid"
57
+ };
58
+ export var Default = {
59
+ args: {
60
+ density: "standard"
61
+ },
62
+ argTypes: {
63
+ density: {
64
+ name: "Density",
65
+ control: "select",
66
+ options: ["standard", "comfortable", "compact"]
67
+ }
68
+ },
69
+ render: function render(_ref) {
70
+ var density = _ref.density;
71
+ var ToolbarForGrid = function ToolbarForGrid() {
72
+ return /*#__PURE__*/_jsxs(DataGridToolbar, {
73
+ children: [/*#__PURE__*/_jsx(ToolbarTitleItem, {
74
+ children: "DataGrid example"
75
+ }), /*#__PURE__*/_jsx(FillSpace, {}), /*#__PURE__*/_jsx(Button, {
76
+ startIcon: /*#__PURE__*/_jsx(Add, {}),
77
+ children: "Add"
78
+ })]
79
+ });
80
+ };
81
+ return /*#__PURE__*/_jsx(Box, {
82
+ height: 400,
83
+ children: /*#__PURE__*/_jsx(DataGrid, {
84
+ density: density,
85
+ rows: exampleRows,
86
+ columns: exampleColumns,
87
+ slots: {
88
+ toolbar: ToolbarForGrid
89
+ },
90
+ showToolbar: true
91
+ })
92
+ });
93
+ }
94
+ };