@sanity/dashboard 0.136.3-purple-unicorn-patch.5627

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 (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +118 -0
  3. package/lib/cjs/DashboardTool.js +59 -0
  4. package/lib/cjs/components/DashboardLayout.js +35 -0
  5. package/lib/cjs/components/NotFoundWidget.js +53 -0
  6. package/lib/cjs/components/WidgetGroup.js +71 -0
  7. package/lib/cjs/components/dashboardWidget.js +55 -0
  8. package/lib/cjs/containers/Dashboard.js +32 -0
  9. package/lib/cjs/containers/WidgetContainer.js +52 -0
  10. package/lib/cjs/dashboardConfig.js +16 -0
  11. package/lib/cjs/legacyParts.js +55 -0
  12. package/lib/cjs/versionedClient.js +20 -0
  13. package/lib/cjs/widget.css +62 -0
  14. package/lib/cjs/widgets/projectInfo/ProjectInfo.js +269 -0
  15. package/lib/cjs/widgets/projectInfo/index.js +19 -0
  16. package/lib/cjs/widgets/projectUsers/ProjectUsers.js +194 -0
  17. package/lib/cjs/widgets/projectUsers/index.js +16 -0
  18. package/lib/cjs/widgets/sanityTutorials/SanityTutorials.js +122 -0
  19. package/lib/cjs/widgets/sanityTutorials/Tutorial.js +114 -0
  20. package/lib/cjs/widgets/sanityTutorials/dataAdapter.js +28 -0
  21. package/lib/cjs/widgets/sanityTutorials/index.js +19 -0
  22. package/lib/dts/src/DashboardTool.d.ts +11 -0
  23. package/lib/dts/src/DashboardTool.d.ts.map +1 -0
  24. package/lib/dts/src/DashboardTool.js +18 -0
  25. package/lib/dts/src/DashboardTool.js.map +1 -0
  26. package/lib/dts/src/components/DashboardLayout.d.ts +13 -0
  27. package/lib/dts/src/components/DashboardLayout.d.ts.map +1 -0
  28. package/lib/dts/src/components/DashboardLayout.js +15 -0
  29. package/lib/dts/src/components/DashboardLayout.js.map +1 -0
  30. package/lib/dts/src/components/NotFoundWidget.d.ts +16 -0
  31. package/lib/dts/src/components/NotFoundWidget.d.ts.map +1 -0
  32. package/lib/dts/src/components/NotFoundWidget.js +29 -0
  33. package/lib/dts/src/components/NotFoundWidget.js.map +1 -0
  34. package/lib/dts/src/components/WidgetGroup.d.ts +3 -0
  35. package/lib/dts/src/components/WidgetGroup.d.ts.map +1 -0
  36. package/lib/dts/src/components/WidgetGroup.js +81 -0
  37. package/lib/dts/src/components/WidgetGroup.js.map +1 -0
  38. package/lib/dts/src/components/dashboardWidget.d.ts +9 -0
  39. package/lib/dts/src/components/dashboardWidget.d.ts.map +1 -0
  40. package/lib/dts/src/components/dashboardWidget.js +48 -0
  41. package/lib/dts/src/components/dashboardWidget.js.map +1 -0
  42. package/lib/dts/src/containers/Dashboard.d.ts +3 -0
  43. package/lib/dts/src/containers/Dashboard.d.ts.map +1 -0
  44. package/lib/dts/src/containers/Dashboard.js +14 -0
  45. package/lib/dts/src/containers/Dashboard.js.map +1 -0
  46. package/lib/dts/src/containers/WidgetContainer.d.ts +13 -0
  47. package/lib/dts/src/containers/WidgetContainer.d.ts.map +1 -0
  48. package/lib/dts/src/containers/WidgetContainer.js +42 -0
  49. package/lib/dts/src/containers/WidgetContainer.js.map +1 -0
  50. package/lib/dts/src/dashboardConfig.d.ts +7 -0
  51. package/lib/dts/src/dashboardConfig.d.ts.map +1 -0
  52. package/lib/dts/src/dashboardConfig.js +4 -0
  53. package/lib/dts/src/dashboardConfig.js.map +1 -0
  54. package/lib/dts/src/legacyParts.d.ts +8 -0
  55. package/lib/dts/src/legacyParts.d.ts.map +1 -0
  56. package/lib/dts/src/legacyParts.js +10 -0
  57. package/lib/dts/src/legacyParts.js.map +1 -0
  58. package/lib/dts/src/versionedClient.d.ts +8 -0
  59. package/lib/dts/src/versionedClient.d.ts.map +1 -0
  60. package/lib/dts/src/versionedClient.js +9 -0
  61. package/lib/dts/src/versionedClient.js.map +1 -0
  62. package/lib/dts/src/widgets/projectInfo/ProjectInfo.d.ts +31 -0
  63. package/lib/dts/src/widgets/projectInfo/ProjectInfo.d.ts.map +1 -0
  64. package/lib/dts/src/widgets/projectInfo/ProjectInfo.js +155 -0
  65. package/lib/dts/src/widgets/projectInfo/ProjectInfo.js.map +1 -0
  66. package/lib/dts/src/widgets/projectInfo/index.d.ts +10 -0
  67. package/lib/dts/src/widgets/projectInfo/index.d.ts.map +1 -0
  68. package/lib/dts/src/widgets/projectInfo/index.js +7 -0
  69. package/lib/dts/src/widgets/projectInfo/index.js.map +1 -0
  70. package/lib/dts/src/widgets/projectUsers/ProjectUsers.d.ts +20 -0
  71. package/lib/dts/src/widgets/projectUsers/ProjectUsers.d.ts.map +1 -0
  72. package/lib/dts/src/widgets/projectUsers/ProjectUsers.js +108 -0
  73. package/lib/dts/src/widgets/projectUsers/ProjectUsers.js.map +1 -0
  74. package/lib/dts/src/widgets/projectUsers/index.d.ts +7 -0
  75. package/lib/dts/src/widgets/projectUsers/index.d.ts.map +1 -0
  76. package/lib/dts/src/widgets/projectUsers/index.js +6 -0
  77. package/lib/dts/src/widgets/projectUsers/index.js.map +1 -0
  78. package/lib/dts/src/widgets/sanityTutorials/SanityTutorials.d.ts +21 -0
  79. package/lib/dts/src/widgets/sanityTutorials/SanityTutorials.d.ts.map +1 -0
  80. package/lib/dts/src/widgets/sanityTutorials/SanityTutorials.js +61 -0
  81. package/lib/dts/src/widgets/sanityTutorials/SanityTutorials.js.map +1 -0
  82. package/lib/dts/src/widgets/sanityTutorials/Tutorial.d.ts +21 -0
  83. package/lib/dts/src/widgets/sanityTutorials/Tutorial.d.ts.map +1 -0
  84. package/lib/dts/src/widgets/sanityTutorials/Tutorial.js +84 -0
  85. package/lib/dts/src/widgets/sanityTutorials/Tutorial.js.map +1 -0
  86. package/lib/dts/src/widgets/sanityTutorials/dataAdapter.d.ts +6 -0
  87. package/lib/dts/src/widgets/sanityTutorials/dataAdapter.d.ts.map +1 -0
  88. package/lib/dts/src/widgets/sanityTutorials/dataAdapter.js +16 -0
  89. package/lib/dts/src/widgets/sanityTutorials/dataAdapter.js.map +1 -0
  90. package/lib/dts/src/widgets/sanityTutorials/index.d.ts +10 -0
  91. package/lib/dts/src/widgets/sanityTutorials/index.d.ts.map +1 -0
  92. package/lib/dts/src/widgets/sanityTutorials/index.js +7 -0
  93. package/lib/dts/src/widgets/sanityTutorials/index.js.map +1 -0
  94. package/lib/dts/tsconfig.tsbuildinfo +1 -0
  95. package/lib/esm/DashboardTool.js +33 -0
  96. package/lib/esm/components/DashboardLayout.js +23 -0
  97. package/lib/esm/components/NotFoundWidget.js +39 -0
  98. package/lib/esm/components/WidgetGroup.js +54 -0
  99. package/lib/esm/components/dashboardWidget.js +38 -0
  100. package/lib/esm/containers/Dashboard.js +19 -0
  101. package/lib/esm/containers/WidgetContainer.js +39 -0
  102. package/lib/esm/dashboardConfig.js +9 -0
  103. package/lib/esm/legacyParts.js +9 -0
  104. package/lib/esm/versionedClient.js +11 -0
  105. package/lib/esm/widget.css +62 -0
  106. package/lib/esm/widgets/projectInfo/ProjectInfo.js +254 -0
  107. package/lib/esm/widgets/projectInfo/index.js +8 -0
  108. package/lib/esm/widgets/projectUsers/ProjectUsers.js +174 -0
  109. package/lib/esm/widgets/projectUsers/index.js +5 -0
  110. package/lib/esm/widgets/sanityTutorials/SanityTutorials.js +108 -0
  111. package/lib/esm/widgets/sanityTutorials/Tutorial.js +98 -0
  112. package/lib/esm/widgets/sanityTutorials/dataAdapter.js +16 -0
  113. package/lib/esm/widgets/sanityTutorials/index.js +8 -0
  114. package/package.json +55 -0
  115. package/sanity.json +59 -0
  116. package/src/DashboardTool.js +32 -0
  117. package/src/components/DashboardLayout.js +22 -0
  118. package/src/components/NotFoundWidget.js +41 -0
  119. package/src/components/WidgetGroup.js +97 -0
  120. package/src/components/dashboardWidget.tsx +70 -0
  121. package/src/containers/Dashboard.js +20 -0
  122. package/src/containers/WidgetContainer.js +52 -0
  123. package/src/dashboardConfig.js +3 -0
  124. package/src/legacyParts.ts +11 -0
  125. package/src/versionedClient.js +9 -0
  126. package/src/widget.css +62 -0
  127. package/src/widgets/projectInfo/ProjectInfo.js +232 -0
  128. package/src/widgets/projectInfo/index.js +7 -0
  129. package/src/widgets/projectUsers/ProjectUsers.js +179 -0
  130. package/src/widgets/projectUsers/index.js +6 -0
  131. package/src/widgets/sanityTutorials/SanityTutorials.js +91 -0
  132. package/src/widgets/sanityTutorials/Tutorial.js +120 -0
  133. package/src/widgets/sanityTutorials/dataAdapter.js +17 -0
  134. package/src/widgets/sanityTutorials/index.js +7 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 - 2022 Sanity.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # Dashboard
2
+
3
+ Dashboard is a Sanity Content Studio Tool which picks up and renders any widgets which implement `part:@sanity/dashboard/widget`. Install this plugin in your Studio to display stats about your project, recently edited documents, etc.
4
+
5
+ The Dashboard tool has been designed to be as generic as possible, making few assumptions about its widgets. The Dashboard itself is mostly concerned about the layout of the configured widgets.
6
+
7
+ ## Install
8
+
9
+ - `cd` to your Content Studio
10
+ - Type `sanity install @sanity/dashboard`. This will cause two things happen:
11
+ 1. The Dashboard tool gets installed to `./node_modules` in your Studio
12
+ 2. `@sanity/dashboard` is appended to the `plugins` array in the `sanity.json` file of your Studio
13
+ - To verify that all is well, fire up your Studio (`sanity start`) and point your browser to `http://localhost:3333/dashboard`
14
+ - \o/
15
+
16
+ ## How to configure the Dashboard
17
+
18
+ Changing what is rendered on your Dashboard is easy. To take control, do the following:
19
+
20
+ 1. Implement your own dashboardConfig. In your `sanity.json` file, append the following line to the `parts` array:
21
+
22
+ ```json
23
+ {
24
+ "implements": "part:@sanity/dashboard/config",
25
+ "path": "src/dashboardConfig.js"
26
+ }
27
+ ```
28
+
29
+ 2. Create the file `src/dashboardConfig.js` and make sure it's shaped something like this:
30
+
31
+ ```js
32
+ export default {
33
+ widgets: [{name: 'sanity-tutorials'}, {name: 'project-info'}, {name: 'project-users'}]
34
+ }
35
+ ```
36
+
37
+ The `widgets` array is how you tell the Dashboard which widgets to render. The ones mentioned in the above example are bundled with Sanity and require no separate installation.
38
+
39
+ 3. Restart your Studio and play around with the order of the widgets array in `src/dashboardConfig.js`. You can also duplicate them, should you want multiple instances of the same widget (see below).
40
+
41
+ A widget’s size behavior can be defined by adding a `layout` key to a the widget config. E.g.: `{name: 'project-users', layout: {width: 'full', height: 'small'}}`. Accepted values are `auto`, `small`, `medium`, `large` and `full`.
42
+
43
+ ## How to install a widget
44
+
45
+ Install a Dashboard widget as you would any other [Sanity Studio plugin](https://www.sanity.io/docs/extending/plugins).
46
+
47
+ E.g. if you want to install the cats example widget mentioned below, proceed as follows:
48
+
49
+ 1. Type `sanity install dashboard-widget-cats` in your terminal (this works because it's published on npm under the name `sanity-plugin-dashboard-widget-cats`)
50
+ 2. Update your `src/dashboardConfig.js` file by adding `{name: 'cats'}` to the `widgets` array
51
+ 3. You've got 🐱 in your Studio
52
+
53
+ Some widgets allow options to change aspects of their behavior. If you install the document-list widget mentioned below, it can be configured with:
54
+
55
+ ```js
56
+ {name: 'document-list', options: {title: 'Last edited books', order: '_updatedAt desc', types: ['book']}}
57
+ ```
58
+
59
+ Thus, if you want your dashboard to display both newest documents across all document types and another widget showing the last edited books, your dashboardConfig would look like this:
60
+
61
+ ```js
62
+ export default {
63
+ widgets: [
64
+ {name: 'document-list', options: {title: 'New', order: '_createdAt desc'}},
65
+ {
66
+ name: 'document-list',
67
+ options: {title: 'Last edited books', order: '_updatedAt desc', types: ['book']}
68
+ }
69
+ ]
70
+ }
71
+ ```
72
+
73
+ ## How to create a widget
74
+
75
+ Widgets are Sanity plugins that implement the part `part:@sanity/dashboard/widget`. Stay tuned for a complete "Widget Authors Cookbook", but until then, have a look at some sample widgets: E.g. [A document List](https://github.com/sanity-io/dashboard-widget-document-list/tree/master) or [maybe some cats](https://github.com/sanity-io/example-dashboard-widget-cats)?
76
+
77
+ When writing your widget components, it's recommended to use the `DashboardWidget` component from the Sanity Studio by importing it like so: `import { DashboardWidget } from "@sanity/dashboard";`.
78
+
79
+ This gives you a typical widget component structure with basic styles, and the option of presenting your content in the header, footer, or body of the widget.
80
+
81
+ If you need something more flexible you can create your own component.
82
+
83
+ Setting up the widget with the default setup will give you a basic widget that looks something like this:
84
+
85
+
86
+ ```js
87
+ <DashboardWidget
88
+ header="A cat"
89
+ footer={
90
+ <Flex direction="column" align="stretch">
91
+ <Button
92
+ flex={1}
93
+ paddingX={2}
94
+ paddingY={4}
95
+ mode="bleed"
96
+ tone="primary"
97
+ text="Get new cat"
98
+ />
99
+ </Flex>
100
+ }
101
+ >
102
+ <figure>
103
+ <img src="https://placekitten.com/300/450" />
104
+ </figure>
105
+ </DashboardWidget>
106
+ ```
107
+
108
+ ### More examples
109
+
110
+ You can study the source code of these widgets to get a sense of how you can approach fetching of documents, adding configuration, and so on:
111
+
112
+ - [dashboard-widget-document-list](https://github.com/sanity-io/dashboard-widget-document-list)
113
+ - [dashboard-widget-widget-document-count](https://github.com/sanity-io/example-dashboard-widget-document-count)
114
+ - [dashboard-widget-netlify](https://github.com/sanity-io/sanity-plugin-dashboard-widget-netlify)
115
+
116
+ ---
117
+
118
+
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {};
7
+ exports.default = void 0;
8
+
9
+ var _react = _interopRequireDefault(require("react"));
10
+
11
+ var _Dashboard = _interopRequireDefault(require("./containers/Dashboard"));
12
+
13
+ var _dashboardWidget = require("./components/dashboardWidget");
14
+
15
+ Object.keys(_dashboardWidget).forEach(function (key) {
16
+ if (key === "default" || key === "__esModule") return;
17
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
18
+ if (key in exports && exports[key] === _dashboardWidget[key]) return;
19
+ Object.defineProperty(exports, key, {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _dashboardWidget[key];
23
+ }
24
+ });
25
+ });
26
+
27
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
+
29
+ const strokeStyle = {
30
+ stroke: 'currentColor',
31
+ strokeWidth: 1.2
32
+ };
33
+
34
+ const DashboardIcon = () => /*#__PURE__*/_react.default.createElement("svg", {
35
+ "data-sanity-icon": true,
36
+ viewBox: "0 0 25 25",
37
+ fill: "none",
38
+ xmlns: "http://www.w3.org/2000/svg",
39
+ preserveAspectRatio: "xMidYMid",
40
+ width: "1em",
41
+ height: "1em"
42
+ }, /*#__PURE__*/_react.default.createElement("path", {
43
+ d: "M19.5 19.5H5.5V5.5H19.5V19.5Z",
44
+ style: strokeStyle
45
+ }), /*#__PURE__*/_react.default.createElement("path", {
46
+ d: "M5.5 12.5H19.5",
47
+ style: strokeStyle
48
+ }), /*#__PURE__*/_react.default.createElement("path", {
49
+ d: "M14.5 19.5V12.5M10.5 12.5V5.5",
50
+ style: strokeStyle
51
+ }));
52
+
53
+ var _default = {
54
+ title: 'Dashboard',
55
+ name: 'dashboard',
56
+ icon: DashboardIcon,
57
+ component: _Dashboard.default
58
+ };
59
+ exports.default = _default;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _ui = require("@sanity/ui");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function DashboardLayout(props) {
17
+ return /*#__PURE__*/_react.default.createElement(_ui.Container, {
18
+ width: 4,
19
+ padding: 4,
20
+ sizing: "border",
21
+ style: {
22
+ minHeight: '100%'
23
+ }
24
+ }, props.children);
25
+ }
26
+
27
+ DashboardLayout.propTypes = {
28
+ // eslint-disable-next-line react/forbid-prop-types
29
+ children: _propTypes.default.any
30
+ };
31
+ DashboardLayout.defaultProps = {
32
+ children: 'Dummy'
33
+ };
34
+ var _default = DashboardLayout;
35
+ exports.default = _default;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _ui = require("@sanity/ui");
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _templateObject;
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
21
+
22
+ const Root = (0, _styledComponents.default)(_ui.Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: stretch;\n height: 100%;\n"])));
23
+
24
+ function NotFoundWidget(props) {
25
+ const {
26
+ title,
27
+ children
28
+ } = props;
29
+ return /*#__PURE__*/_react.default.createElement(Root, {
30
+ radius: 3,
31
+ paddingX: 3,
32
+ paddingY: 4,
33
+ tone: "critical"
34
+ }, /*#__PURE__*/_react.default.createElement(_ui.Stack, {
35
+ space: 2
36
+ }, title && /*#__PURE__*/_react.default.createElement(_ui.Heading, {
37
+ size: 1,
38
+ as: "h2"
39
+ }, title), children && /*#__PURE__*/_react.default.createElement(_ui.Box, null, children)));
40
+ }
41
+
42
+ NotFoundWidget.propTypes = {
43
+ // eslint-disable-next-line react/forbid-prop-types
44
+ children: _propTypes.default.any,
45
+ // eslint-disable-next-line react/forbid-prop-types
46
+ title: _propTypes.default.any
47
+ };
48
+ NotFoundWidget.defaultProps = {
49
+ children: null,
50
+ title: null
51
+ };
52
+ var _default = NotFoundWidget;
53
+ exports.default = _default;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
+
12
+ var _ui = require("@sanity/ui");
13
+
14
+ var _legacyParts = require("../legacyParts");
15
+
16
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
25
+
26
+ const media = {
27
+ small: function () {
28
+ return (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n @media (min-width: ", "px) {\n ", "\n }\n "])), _ref => {
29
+ let {
30
+ theme
31
+ } = _ref;
32
+ return theme.sanity.media[0];
33
+ }, (0, _styledComponents.css)(...arguments));
34
+ },
35
+ medium: function () {
36
+ return (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n @media (min-width: ", "px) {\n ", "\n }\n "])), _ref2 => {
37
+ let {
38
+ theme
39
+ } = _ref2;
40
+ return theme.sanity.media[2];
41
+ }, (0, _styledComponents.css)(...arguments));
42
+ }
43
+ };
44
+ const Root = (0, _styledComponents.default)(_ui.Grid)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n\n & > div {\n overflow: hidden;\n }\n\n & > div[data-width='medium'] {\n ", "\n }\n\n & > div[data-width='large'] {\n ", "\n\n ", "\n }\n\n & > div[data-width='full'] {\n ", "\n }\n\n & > div[data-height='medium'] {\n ", "\n }\n\n & > div[data-height='large'] {\n ", "\n\n ", "\n }\n\n & > div[data-height='full'] {\n ", "\n }\n"])), media.small(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n grid-column: span 2;\n "]))), media.small(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n grid-column: span 2;\n "]))), media.medium(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n grid-column: span 3;\n "]))), media.small(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n grid-column: 1 / -1;\n "]))), media.small(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n grid-row: span 2;\n "]))), media.small(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n grid-row: span 2;\n "]))), media.medium(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n grid-row: span 3;\n "]))), media.medium(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n grid-row: 1 / -1;\n "]))));
45
+
46
+ function WidgetGroup(props) {
47
+ const config = props.config || {};
48
+ const widgets = config.widgets || [];
49
+ const layout = config.layout || {};
50
+ return /*#__PURE__*/_react.default.createElement(Root, {
51
+ autoFlow: "dense",
52
+ "data-width": layout.width || 'auto',
53
+ "data-height": layout.height || 'auto',
54
+ gap: 4
55
+ }, widgets.map((widgetConfig, index) => {
56
+ if (widgetConfig.type === '__experimental_group') {
57
+ return /*#__PURE__*/_react.default.createElement(WidgetGroup, {
58
+ key: String(index),
59
+ config: widgetConfig
60
+ });
61
+ }
62
+
63
+ return /*#__PURE__*/_react.default.createElement(_legacyParts.WidgetContainer, {
64
+ key: String(index),
65
+ config: widgetConfig
66
+ });
67
+ }));
68
+ }
69
+
70
+ var _default = WidgetGroup;
71
+ exports.default = _default;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DashboardWidget = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _ui = require("@sanity/ui");
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
23
+
24
+ const Root = (0, _styledComponents.default)(_ui.Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: stretch;\n height: 100%;\n box-sizing: border-box;\n position: relative;\n"])));
25
+ const Header = (0, _styledComponents.default)(_ui.Card)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: sticky;\n top: 0;\n z-index: 2;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n"])));
26
+ const Footer = (0, _styledComponents.default)(_ui.Card)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: sticky;\n overflow: hidden;\n bottom: 0;\n z-index: 2;\n border-bottom-right-radius: inherit;\n border-bottom-left-radius: inherit;\n margin-top: auto;\n"])));
27
+ const Content = (0, _styledComponents.default)(_ui.Box)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n height: stretch;\n min-height: 21.5em;\n\n @media (min-width: ", "px) {\n overflow-y: auto;\n outline: none;\n }\n"])), _ref => {
28
+ let {
29
+ theme
30
+ } = _ref;
31
+ return theme.sanity.media[0];
32
+ });
33
+ const DashboardWidget = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
34
+ const {
35
+ header,
36
+ children,
37
+ footer
38
+ } = props;
39
+ return /*#__PURE__*/_react.default.createElement(Root, {
40
+ radius: 3,
41
+ display: "flex",
42
+ ref: ref
43
+ }, header && /*#__PURE__*/_react.default.createElement(Header, {
44
+ borderBottom: true,
45
+ paddingX: 3,
46
+ paddingY: 4
47
+ }, /*#__PURE__*/_react.default.createElement(_ui.Heading, {
48
+ size: 1,
49
+ textOverflow: "ellipsis"
50
+ }, header)), children && /*#__PURE__*/_react.default.createElement(Content, null, children), footer && /*#__PURE__*/_react.default.createElement(Footer, {
51
+ borderTop: true
52
+ }, footer));
53
+ });
54
+ exports.DashboardWidget = DashboardWidget;
55
+ DashboardWidget.displayName = 'DashboardWidget';
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _DashboardLayout = _interopRequireDefault(require("../components/DashboardLayout"));
11
+
12
+ var _WidgetGroup = _interopRequireDefault(require("../components/WidgetGroup"));
13
+
14
+ var _legacyParts = require("../legacyParts");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function Dashboard() {
19
+ if (!_legacyParts.dashboardConfig) {
20
+ return null;
21
+ }
22
+
23
+ const widgetConfigs = _legacyParts.dashboardConfig.widgets || [];
24
+ return /*#__PURE__*/_react.default.createElement(_DashboardLayout.default, null, /*#__PURE__*/_react.default.createElement(_WidgetGroup.default, {
25
+ config: {
26
+ widgets: widgetConfigs
27
+ }
28
+ }));
29
+ }
30
+
31
+ var _default = Dashboard;
32
+ exports.default = _default;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _NotFoundWidget = _interopRequireDefault(require("../components/NotFoundWidget"));
13
+
14
+ var _legacyParts = require("../legacyParts");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function WidgetContainer(props) {
19
+ const config = props.config || {};
20
+ const definition = Array.isArray(_legacyParts.definitions) ? _legacyParts.definitions.find(wid => wid.name === config.name) : null;
21
+
22
+ if (definition) {
23
+ const options = { ...(definition.options || {}),
24
+ ...(config.options || {})
25
+ };
26
+ const layout = { ...(definition.layout || {}),
27
+ ...(config.layout || {})
28
+ };
29
+ return /*#__PURE__*/_react.default.createElement("div", {
30
+ "data-width": layout.width,
31
+ "data-height": layout.height
32
+ }, /*#__PURE__*/_react.default.createElement(definition.component, options));
33
+ }
34
+
35
+ const layout = config.layout || {};
36
+ return /*#__PURE__*/_react.default.createElement("div", {
37
+ "data-width": layout.width,
38
+ "data-height": layout.height
39
+ }, /*#__PURE__*/_react.default.createElement(_NotFoundWidget.default, {
40
+ title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Not found: \"", config.name, "\"")
41
+ }, /*#__PURE__*/_react.default.createElement("p", null, "Make sure your ", /*#__PURE__*/_react.default.createElement("code", null, "sanity.json"), " file mentions such a widget and that it\u2019s an implementation of ", /*#__PURE__*/_react.default.createElement("code", null, "part:@sanity/dashboard/widget"), ".")));
42
+ }
43
+
44
+ WidgetContainer.propTypes = {
45
+ // eslint-disable-next-line react/forbid-prop-types
46
+ config: _propTypes.default.any
47
+ };
48
+ WidgetContainer.defaultProps = {
49
+ config: null
50
+ };
51
+ var _default = WidgetContainer;
52
+ exports.default = _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ widgets: [{
9
+ name: 'sanity-tutorials'
10
+ }, {
11
+ name: 'project-info'
12
+ }, {
13
+ name: 'project-users'
14
+ }]
15
+ };
16
+ exports.default = _default;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "DefaultPreview", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _default.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "WidgetContainer", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _widgetContainer.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "dashboardConfig", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _config.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "definitions", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _widget.default;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "sanityClient", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _client.default;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "userStore", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _user.default;
40
+ }
41
+ });
42
+
43
+ var _widgetContainer = _interopRequireDefault(require("part:@sanity/dashboard/widget-container"));
44
+
45
+ var _config = _interopRequireDefault(require("part:@sanity/dashboard/config?"));
46
+
47
+ var _client = _interopRequireDefault(require("part:@sanity/base/client"));
48
+
49
+ var _widget = _interopRequireDefault(require("all:part:@sanity/dashboard/widget?"));
50
+
51
+ var _default = _interopRequireDefault(require("part:@sanity/components/previews/default"));
52
+
53
+ var _user = _interopRequireDefault(require("part:@sanity/base/user"));
54
+
55
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.versionedClient = void 0;
7
+
8
+ var _legacyParts = require("./legacyParts");
9
+
10
+ /**
11
+ * Only for use inside of @sanity/dashboard
12
+ * Don't import this from external modules.
13
+ *
14
+ * @internal
15
+ */
16
+ const versionedClient = _legacyParts.sanityClient.withConfig({
17
+ apiVersion: '1'
18
+ });
19
+
20
+ exports.versionedClient = versionedClient;
@@ -0,0 +1,62 @@
1
+ @import 'part:@sanity/base/theme/variables-style';
2
+
3
+ .container {
4
+ display: flex;
5
+ flex-direction: column;
6
+ justify-content: stretch;
7
+ height: 100%;
8
+ border-radius: var(--border-radius-base);
9
+ background-color: var(--component-bg);
10
+ box-sizing: border-box;
11
+ position: relative;
12
+ }
13
+
14
+ .containerWithPadding {
15
+ composes: container;
16
+ padding: var(--medium-padding);
17
+ }
18
+
19
+ .header {
20
+ padding: var(--small-padding) 0;
21
+ }
22
+
23
+ .title {
24
+ composes: heading4 from 'part:@sanity/base/theme/typography/headings-style';
25
+ margin: var(--small-padding) var(--medium-padding);
26
+ }
27
+
28
+ .content {
29
+ display: block;
30
+ margin: 0;
31
+ padding: 0;
32
+ min-height: 21.5em;
33
+
34
+ @media (--screen-medium) {
35
+ height: stretch;
36
+ overflow-y: auto;
37
+ }
38
+ }
39
+
40
+ .footer {
41
+ display: flex;
42
+ text-align: center;
43
+ font-weight: 600;
44
+ min-height: 4em;
45
+ height: 4em;
46
+ margin-top: auto;
47
+ overflow: hidden;
48
+
49
+ @nest & > * {
50
+ width: 100%;
51
+ }
52
+ }
53
+
54
+ /* TODO: remove after changing document list plugin */
55
+ .listContainer {
56
+ composes: content;
57
+ }
58
+
59
+ /* TODO: remove after changing document list plugin */
60
+ .bottomButtonContainer {
61
+ composes: footer;
62
+ }