@canonical/react-components 0.58.0 → 0.59.0

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 (45) hide show
  1. package/dist/components/ApplicationLayout/AppAside/AppAside.d.ts +33 -0
  2. package/dist/components/ApplicationLayout/AppAside/AppAside.js +33 -0
  3. package/dist/components/ApplicationLayout/AppAside/AppAside.stories.d.ts +13 -0
  4. package/dist/components/ApplicationLayout/AppAside/AppAside.stories.js +116 -0
  5. package/dist/components/ApplicationLayout/AppAside/index.d.ts +2 -0
  6. package/dist/components/ApplicationLayout/AppAside/index.js +13 -0
  7. package/dist/components/ApplicationLayout/AppMain/AppMain.d.ts +14 -0
  8. package/dist/components/ApplicationLayout/AppMain/AppMain.js +25 -0
  9. package/dist/components/ApplicationLayout/AppMain/AppMain.stories.d.ts +14 -0
  10. package/dist/components/ApplicationLayout/AppMain/AppMain.stories.js +45 -0
  11. package/dist/components/ApplicationLayout/AppMain/index.d.ts +2 -0
  12. package/dist/components/ApplicationLayout/AppMain/index.js +13 -0
  13. package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.d.ts +26 -0
  14. package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.js +35 -0
  15. package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.d.ts +12 -0
  16. package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.js +104 -0
  17. package/dist/components/ApplicationLayout/AppNavigation/index.d.ts +2 -0
  18. package/dist/components/ApplicationLayout/AppNavigation/index.js +13 -0
  19. package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.d.ts +18 -0
  20. package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.js +28 -0
  21. package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.d.ts +15 -0
  22. package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.js +52 -0
  23. package/dist/components/ApplicationLayout/AppNavigationBar/index.d.ts +2 -0
  24. package/dist/components/ApplicationLayout/AppNavigationBar/index.js +13 -0
  25. package/dist/components/ApplicationLayout/AppStatus/AppStatus.d.ts +14 -0
  26. package/dist/components/ApplicationLayout/AppStatus/AppStatus.js +25 -0
  27. package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.d.ts +13 -0
  28. package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.js +41 -0
  29. package/dist/components/ApplicationLayout/AppStatus/index.d.ts +2 -0
  30. package/dist/components/ApplicationLayout/AppStatus/index.js +13 -0
  31. package/dist/components/ApplicationLayout/Application/Application.d.ts +15 -0
  32. package/dist/components/ApplicationLayout/Application/Application.js +26 -0
  33. package/dist/components/ApplicationLayout/Application/Application.stories.d.ts +6 -0
  34. package/dist/components/ApplicationLayout/Application/Application.stories.js +16 -0
  35. package/dist/components/ApplicationLayout/Application/index.d.ts +2 -0
  36. package/dist/components/ApplicationLayout/Application/index.js +13 -0
  37. package/dist/components/ApplicationLayout/ApplicationLayout.d.ts +89 -0
  38. package/dist/components/ApplicationLayout/ApplicationLayout.js +118 -0
  39. package/dist/components/ApplicationLayout/ApplicationLayout.stories.d.ts +19 -0
  40. package/dist/components/ApplicationLayout/ApplicationLayout.stories.js +218 -0
  41. package/dist/components/ApplicationLayout/index.d.ts +7 -0
  42. package/dist/components/ApplicationLayout/index.js +55 -0
  43. package/dist/index.d.ts +14 -0
  44. package/dist/index.js +56 -0
  45. package/package.json +5 -2
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Navigation = exports.ExternalStates = exports.Default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Form = _interopRequireDefault(require("../Form"));
9
+ var _Input = _interopRequireDefault(require("../Input"));
10
+ var _Button = _interopRequireDefault(require("../Button"));
11
+ var _Row = _interopRequireDefault(require("../Row"));
12
+ var _Col = _interopRequireDefault(require("../Col"));
13
+ var _ApplicationLayout = _interopRequireDefault(require("./ApplicationLayout"));
14
+ var _AppAside = _interopRequireDefault(require("./AppAside"));
15
+ var _Panel = _interopRequireDefault(require("../Panel"));
16
+ var _Icon = _interopRequireDefault(require("../Icon"));
17
+ var _SideNavigation = _interopRequireDefault(require("../SideNavigation"));
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ /* eslint-disable react-hooks/rules-of-hooks */
22
+
23
+ const meta = {
24
+ component: _ApplicationLayout.default,
25
+ tags: ["autodocs"]
26
+ };
27
+ var _default = exports.default = meta;
28
+ const Default = exports.Default = {
29
+ render: () => {
30
+ const [showAside, setShowAside] = (0, _react.useState)(true);
31
+ const [asidePinned, setAsidePinned] = (0, _react.useState)(false);
32
+ return /*#__PURE__*/_react.default.createElement(_ApplicationLayout.default, {
33
+ logo: {
34
+ icon: "https://assets.ubuntu.com/v1/7144ec6d-logo-jaas-icon.svg",
35
+ name: "https://assets.ubuntu.com/v1/2e04d794-logo-jaas.svg",
36
+ nameAlt: "JAAS",
37
+ href: "/"
38
+ },
39
+ navItems: [{
40
+ items: [{
41
+ icon: "drag",
42
+ label: "Models",
43
+ href: "/models"
44
+ }, {
45
+ icon: "menu",
46
+ label: "Controllers",
47
+ href: "/controllers"
48
+ }, {
49
+ icon: "user",
50
+ label: "Permissions",
51
+ href: "/users"
52
+ }]
53
+ }],
54
+ aside: showAside ? /*#__PURE__*/_react.default.createElement(_AppAside.default, {
55
+ title: "Aside panel",
56
+ pinned: asidePinned
57
+ }, /*#__PURE__*/_react.default.createElement(_Panel.default, {
58
+ controls: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
59
+ onClick: () => setAsidePinned(!asidePinned),
60
+ dense: true,
61
+ className: "u-no-margin"
62
+ }, "Pin aside"), /*#__PURE__*/_react.default.createElement(_Button.default, {
63
+ appearance: "base",
64
+ className: "u-no-margin--bottom",
65
+ hasIcon: true,
66
+ onClick: () => {
67
+ setShowAside(false);
68
+ setAsidePinned(false);
69
+ }
70
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
71
+ name: "close"
72
+ }, "Close")))
73
+ }, /*#__PURE__*/_react.default.createElement(_Form.default, {
74
+ stacked: true
75
+ }, /*#__PURE__*/_react.default.createElement(_Input.default, {
76
+ label: "Full name",
77
+ type: "text",
78
+ name: "fullName",
79
+ autoComplete: "name",
80
+ stacked: true
81
+ }), /*#__PURE__*/_react.default.createElement(_Input.default, {
82
+ label: "Username",
83
+ type: "text",
84
+ name: "username-stacked",
85
+ autoComplete: "username",
86
+ "aria-describedby": "exampleHelpTextMessage",
87
+ stacked: true,
88
+ help: "30 characters or fewer."
89
+ }), /*#__PURE__*/_react.default.createElement(_Input.default, {
90
+ type: "text",
91
+ label: "Email address",
92
+ "aria-invalid": "true",
93
+ name: "username-stackederror",
94
+ autoComplete: "email",
95
+ required: true,
96
+ error: "This field is required.",
97
+ stacked: true
98
+ }), /*#__PURE__*/_react.default.createElement(_Input.default, {
99
+ label: "Address line 1",
100
+ type: "text",
101
+ name: "address-optional-stacked",
102
+ autoComplete: "address-line1",
103
+ stacked: true
104
+ }), /*#__PURE__*/_react.default.createElement(_Input.default, {
105
+ label: "Address line 2",
106
+ type: "text",
107
+ name: "address-optional-stacked",
108
+ autoComplete: "address-line3",
109
+ stacked: true
110
+ }), /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
111
+ size: 12
112
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
113
+ appearance: "positive",
114
+ className: "u-float-right",
115
+ name: "add-details"
116
+ }, "Add details")))))) : null,
117
+ status: /*#__PURE__*/_react.default.createElement(_Button.default, {
118
+ onClick: () => setShowAside(!showAside),
119
+ dense: true,
120
+ appearance: "base",
121
+ className: "u-no-margin"
122
+ }, "Toggle aside")
123
+ }, /*#__PURE__*/_react.default.createElement(_Panel.default, {
124
+ title: "Application Layout"
125
+ }, /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
126
+ size: 12
127
+ }, "Content"))));
128
+ }
129
+ };
130
+
131
+ /**
132
+ * The pinned and collapsed states can be handled externally if you need access
133
+ * to these outside the application layout.
134
+ */
135
+ const ExternalStates = exports.ExternalStates = {
136
+ render: () => {
137
+ const [menuPinned, setMenuPinned] = (0, _react.useState)(false);
138
+ const [menuCollapsed, setMenuCollapsed] = (0, _react.useState)(true);
139
+ return /*#__PURE__*/_react.default.createElement(_ApplicationLayout.default, {
140
+ menuPinned: menuPinned,
141
+ onPinMenu: setMenuPinned,
142
+ menuCollapsed: menuCollapsed,
143
+ onCollapseMenu: setMenuCollapsed,
144
+ logo: {
145
+ icon: "https://assets.ubuntu.com/v1/7144ec6d-logo-jaas-icon.svg",
146
+ name: "https://assets.ubuntu.com/v1/2e04d794-logo-jaas.svg",
147
+ nameAlt: "JAAS",
148
+ href: "/"
149
+ },
150
+ navItems: [{
151
+ items: [{
152
+ icon: "drag",
153
+ label: "Models",
154
+ href: "/models"
155
+ }, {
156
+ icon: "menu",
157
+ label: "Controllers",
158
+ href: "/controllers"
159
+ }, {
160
+ icon: "user",
161
+ label: "Permissions",
162
+ href: "/users"
163
+ }]
164
+ }]
165
+ }, /*#__PURE__*/_react.default.createElement(_Panel.default, {
166
+ title: "Application Layout"
167
+ }, /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
168
+ size: 12
169
+ }, "Content"))));
170
+ }
171
+ };
172
+
173
+ /**
174
+ * Menu items can either be provided as an array given to `navItems` or when
175
+ * more control is needed then by proving `sideNavigation`.
176
+ *
177
+ * For more details about how to provide navigation items see the
178
+ * [`SideNavigation`](/docs/components-sidenavigation--docs) docs.
179
+ */
180
+ const Navigation = exports.Navigation = {
181
+ render: () => {
182
+ const [menuPinned, setMenuPinned] = (0, _react.useState)(false);
183
+ const [menuCollapsed, setMenuCollapsed] = (0, _react.useState)(true);
184
+ return /*#__PURE__*/_react.default.createElement(_ApplicationLayout.default, {
185
+ menuPinned: menuPinned,
186
+ onPinMenu: setMenuPinned,
187
+ menuCollapsed: menuCollapsed,
188
+ onCollapseMenu: setMenuCollapsed,
189
+ logo: {
190
+ icon: "https://assets.ubuntu.com/v1/7144ec6d-logo-jaas-icon.svg",
191
+ name: "https://assets.ubuntu.com/v1/2e04d794-logo-jaas.svg",
192
+ nameAlt: "JAAS",
193
+ href: "/"
194
+ },
195
+ sideNavigation: /*#__PURE__*/_react.default.createElement(_SideNavigation.default, {
196
+ items: [{
197
+ items: [{
198
+ icon: "drag",
199
+ label: "Models",
200
+ href: "/models"
201
+ }, {
202
+ icon: "menu",
203
+ label: "Controllers",
204
+ href: "/controllers"
205
+ }, {
206
+ icon: "user",
207
+ label: "Permissions",
208
+ href: "/users"
209
+ }]
210
+ }]
211
+ })
212
+ }, /*#__PURE__*/_react.default.createElement(_Panel.default, {
213
+ title: "Application Layout"
214
+ }, /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
215
+ size: 12
216
+ }, "Content"))));
217
+ }
218
+ };
@@ -0,0 +1,7 @@
1
+ export { default, type Props as ApplicationLayoutProps, } from "./ApplicationLayout";
2
+ export { default as AppAside, type AppAsideProps } from "./AppAside";
3
+ export { default as Application, type ApplicationProps } from "./Application";
4
+ export { default as AppMain, type AppMainProps } from "./AppMain";
5
+ export { default as AppNavigation, type AppNavigationProps, } from "./AppNavigation";
6
+ export { default as AppNavigationBar, type AppNavigationBarProps, } from "./AppNavigationBar";
7
+ export { default as AppStatus, type AppStatusProps } from "./AppStatus";
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AppAside", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _AppAside.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "AppMain", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _AppMain.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "AppNavigation", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _AppNavigation.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "AppNavigationBar", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _AppNavigationBar.default;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "AppStatus", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _AppStatus.default;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "Application", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _Application.default;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "default", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _ApplicationLayout.default;
46
+ }
47
+ });
48
+ var _ApplicationLayout = _interopRequireDefault(require("./ApplicationLayout"));
49
+ var _AppAside = _interopRequireDefault(require("./AppAside"));
50
+ var _Application = _interopRequireDefault(require("./Application"));
51
+ var _AppMain = _interopRequireDefault(require("./AppMain"));
52
+ var _AppNavigation = _interopRequireDefault(require("./AppNavigation"));
53
+ var _AppNavigationBar = _interopRequireDefault(require("./AppNavigationBar"));
54
+ var _AppStatus = _interopRequireDefault(require("./AppStatus"));
55
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  export { default as Accordion } from "./components/Accordion";
2
2
  export { default as ActionButton } from "./components/ActionButton";
3
3
  export { default as ArticlePagination } from "./components/ArticlePagination";
4
+ export { default as ApplicationLayout } from "./components/ApplicationLayout";
5
+ export { default as AppAside } from "./components/ApplicationLayout/AppAside";
6
+ export { default as Application } from "./components/ApplicationLayout/Application";
7
+ export { default as AppMain } from "./components/ApplicationLayout/AppMain";
8
+ export { default as AppNavigation } from "./components/ApplicationLayout/AppNavigation";
9
+ export { default as AppNavigationBar } from "./components/ApplicationLayout/AppNavigationBar";
10
+ export { default as AppStatus } from "./components/ApplicationLayout/AppStatus";
4
11
  export { default as Badge } from "./components/Badge";
5
12
  export { default as Button, ButtonAppearance } from "./components/Button";
6
13
  export { default as Card } from "./components/Card";
@@ -59,6 +66,13 @@ export { default as TablePagination } from "./components/TablePagination";
59
66
  export type { AccordionProps } from "./components/Accordion";
60
67
  export type { ActionButtonProps } from "./components/ActionButton";
61
68
  export type { ArticlePaginationProps } from "./components/ArticlePagination";
69
+ export type { ApplicationLayoutProps } from "./components/ApplicationLayout";
70
+ export type { AppAsideProps } from "./components/ApplicationLayout/AppAside";
71
+ export type { ApplicationProps } from "./components/ApplicationLayout/Application";
72
+ export type { AppMainProps } from "./components/ApplicationLayout/AppMain";
73
+ export type { AppNavigationProps } from "./components/ApplicationLayout/AppNavigation";
74
+ export type { AppNavigationBarProps } from "./components/ApplicationLayout/AppNavigationBar";
75
+ export type { AppStatusProps } from "./components/ApplicationLayout/AppStatus";
62
76
  export type { BadgeProps } from "./components/Badge";
63
77
  export type { ButtonProps } from "./components/Button";
64
78
  export type { CardProps } from "./components/Card";
package/dist/index.js CHANGED
@@ -7,6 +7,13 @@ var _exportNames = {
7
7
  Accordion: true,
8
8
  ActionButton: true,
9
9
  ArticlePagination: true,
10
+ ApplicationLayout: true,
11
+ AppAside: true,
12
+ Application: true,
13
+ AppMain: true,
14
+ AppNavigation: true,
15
+ AppNavigationBar: true,
16
+ AppStatus: true,
10
17
  Badge: true,
11
18
  Button: true,
12
19
  ButtonAppearance: true,
@@ -97,6 +104,48 @@ Object.defineProperty(exports, "ActionButton", {
97
104
  return _ActionButton.default;
98
105
  }
99
106
  });
107
+ Object.defineProperty(exports, "AppAside", {
108
+ enumerable: true,
109
+ get: function () {
110
+ return _AppAside.default;
111
+ }
112
+ });
113
+ Object.defineProperty(exports, "AppMain", {
114
+ enumerable: true,
115
+ get: function () {
116
+ return _AppMain.default;
117
+ }
118
+ });
119
+ Object.defineProperty(exports, "AppNavigation", {
120
+ enumerable: true,
121
+ get: function () {
122
+ return _AppNavigation.default;
123
+ }
124
+ });
125
+ Object.defineProperty(exports, "AppNavigationBar", {
126
+ enumerable: true,
127
+ get: function () {
128
+ return _AppNavigationBar.default;
129
+ }
130
+ });
131
+ Object.defineProperty(exports, "AppStatus", {
132
+ enumerable: true,
133
+ get: function () {
134
+ return _AppStatus.default;
135
+ }
136
+ });
137
+ Object.defineProperty(exports, "Application", {
138
+ enumerable: true,
139
+ get: function () {
140
+ return _Application.default;
141
+ }
142
+ });
143
+ Object.defineProperty(exports, "ApplicationLayout", {
144
+ enumerable: true,
145
+ get: function () {
146
+ return _ApplicationLayout.default;
147
+ }
148
+ });
100
149
  Object.defineProperty(exports, "ArticlePagination", {
101
150
  enumerable: true,
102
151
  get: function () {
@@ -568,6 +617,13 @@ Object.defineProperty(exports, "useWindowFitment", {
568
617
  var _Accordion = _interopRequireDefault(require("./components/Accordion"));
569
618
  var _ActionButton = _interopRequireDefault(require("./components/ActionButton"));
570
619
  var _ArticlePagination = _interopRequireDefault(require("./components/ArticlePagination"));
620
+ var _ApplicationLayout = _interopRequireDefault(require("./components/ApplicationLayout"));
621
+ var _AppAside = _interopRequireDefault(require("./components/ApplicationLayout/AppAside"));
622
+ var _Application = _interopRequireDefault(require("./components/ApplicationLayout/Application"));
623
+ var _AppMain = _interopRequireDefault(require("./components/ApplicationLayout/AppMain"));
624
+ var _AppNavigation = _interopRequireDefault(require("./components/ApplicationLayout/AppNavigation"));
625
+ var _AppNavigationBar = _interopRequireDefault(require("./components/ApplicationLayout/AppNavigationBar"));
626
+ var _AppStatus = _interopRequireDefault(require("./components/ApplicationLayout/AppStatus"));
571
627
  var _Badge = _interopRequireDefault(require("./components/Badge"));
572
628
  var _Button = _interopRequireWildcard(require("./components/Button"));
573
629
  var _Card = _interopRequireDefault(require("./components/Card"));
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "0.58.0",
3
+ "version": "0.59.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
- "author": "Huw Wilkins <huw.wilkins@canonical.com>",
6
+ "author": {
7
+ "email": "webteam@canonical.com",
8
+ "name": "Canonical Webteam"
9
+ },
7
10
  "license": "LGPL-3.0",
8
11
  "files": [
9
12
  "dist/**/*.js",