@canonical/react-components 0.57.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.
- package/dist/components/ApplicationLayout/AppAside/AppAside.d.ts +33 -0
- package/dist/components/ApplicationLayout/AppAside/AppAside.js +33 -0
- package/dist/components/ApplicationLayout/AppAside/AppAside.stories.d.ts +13 -0
- package/dist/components/ApplicationLayout/AppAside/AppAside.stories.js +116 -0
- package/dist/components/ApplicationLayout/AppAside/index.d.ts +2 -0
- package/dist/components/ApplicationLayout/AppAside/index.js +13 -0
- package/dist/components/ApplicationLayout/AppMain/AppMain.d.ts +14 -0
- package/dist/components/ApplicationLayout/AppMain/AppMain.js +25 -0
- package/dist/components/ApplicationLayout/AppMain/AppMain.stories.d.ts +14 -0
- package/dist/components/ApplicationLayout/AppMain/AppMain.stories.js +45 -0
- package/dist/components/ApplicationLayout/AppMain/index.d.ts +2 -0
- package/dist/components/ApplicationLayout/AppMain/index.js +13 -0
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.d.ts +26 -0
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.js +35 -0
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.d.ts +12 -0
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.js +104 -0
- package/dist/components/ApplicationLayout/AppNavigation/index.d.ts +2 -0
- package/dist/components/ApplicationLayout/AppNavigation/index.js +13 -0
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.d.ts +18 -0
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.js +28 -0
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.d.ts +15 -0
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.js +52 -0
- package/dist/components/ApplicationLayout/AppNavigationBar/index.d.ts +2 -0
- package/dist/components/ApplicationLayout/AppNavigationBar/index.js +13 -0
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.d.ts +14 -0
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.js +25 -0
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.d.ts +13 -0
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.js +41 -0
- package/dist/components/ApplicationLayout/AppStatus/index.d.ts +2 -0
- package/dist/components/ApplicationLayout/AppStatus/index.js +13 -0
- package/dist/components/ApplicationLayout/Application/Application.d.ts +15 -0
- package/dist/components/ApplicationLayout/Application/Application.js +26 -0
- package/dist/components/ApplicationLayout/Application/Application.stories.d.ts +6 -0
- package/dist/components/ApplicationLayout/Application/Application.stories.js +16 -0
- package/dist/components/ApplicationLayout/Application/index.d.ts +2 -0
- package/dist/components/ApplicationLayout/Application/index.js +13 -0
- package/dist/components/ApplicationLayout/ApplicationLayout.d.ts +89 -0
- package/dist/components/ApplicationLayout/ApplicationLayout.js +118 -0
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.d.ts +19 -0
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.js +218 -0
- package/dist/components/ApplicationLayout/index.d.ts +7 -0
- package/dist/components/ApplicationLayout/index.js +55 -0
- package/dist/components/SideNavigation/SideNavigation.d.ts +50 -0
- package/dist/components/SideNavigation/SideNavigation.js +90 -0
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +14 -0
- package/dist/components/SideNavigation/SideNavigation.stories.js +62 -0
- package/dist/components/SideNavigation/SideNavigationBase/SideNavigationBase.d.ts +27 -0
- package/dist/components/SideNavigation/SideNavigationBase/SideNavigationBase.js +31 -0
- package/dist/components/SideNavigation/SideNavigationBase/index.d.ts +1 -0
- package/dist/components/SideNavigation/SideNavigationBase/index.js +13 -0
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.d.ts +20 -0
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.js +33 -0
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.stories.d.ts +22 -0
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.stories.js +68 -0
- package/dist/components/SideNavigation/SideNavigationItem/index.d.ts +1 -0
- package/dist/components/SideNavigation/SideNavigationItem/index.js +13 -0
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.d.ts +13 -0
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.js +27 -0
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.stories.d.ts +7 -0
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.stories.js +32 -0
- package/dist/components/SideNavigation/SideNavigationLink/index.d.ts +1 -0
- package/dist/components/SideNavigation/SideNavigationLink/index.js +13 -0
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.d.ts +7 -0
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.js +24 -0
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.stories.d.ts +6 -0
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.stories.js +25 -0
- package/dist/components/SideNavigation/SideNavigationText/index.d.ts +1 -0
- package/dist/components/SideNavigation/SideNavigationText/index.js +13 -0
- package/dist/components/SideNavigation/index.d.ts +5 -0
- package/dist/components/SideNavigation/index.js +34 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +88 -0
- package/package.json +5 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { PropsWithSpread } from "../../../types";
|
|
3
|
+
import { type HTMLProps, type PropsWithChildren } from "react";
|
|
4
|
+
export type Props = PropsWithSpread<{
|
|
5
|
+
/**
|
|
6
|
+
* Whether the aside panel should be collapsed. Toggling this state will animate
|
|
7
|
+
* the panel open or closed.
|
|
8
|
+
*/
|
|
9
|
+
collapsed?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The panel content.
|
|
12
|
+
*/
|
|
13
|
+
children?: PropsWithChildren["children"];
|
|
14
|
+
/**
|
|
15
|
+
* A ref that will be passed to the wrapping `<aside>` element.
|
|
16
|
+
*/
|
|
17
|
+
forwardRef?: React.Ref<HTMLElement> | null;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the aside panel should be narrow.
|
|
20
|
+
*/
|
|
21
|
+
narrow?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the aside panel should be pinned. When pinned the panel will appear
|
|
24
|
+
* beside the main content, instead of above it.
|
|
25
|
+
*/
|
|
26
|
+
pinned?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the aside panel should be wide.
|
|
29
|
+
*/
|
|
30
|
+
wide?: boolean;
|
|
31
|
+
}, HTMLProps<HTMLElement>>;
|
|
32
|
+
declare const AppAside: ({ children, className, collapsed, narrow, forwardRef, pinned, wide, ...props }: Props) => React.JSX.Element;
|
|
33
|
+
export default AppAside;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
const AppAside = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
collapsed,
|
|
16
|
+
narrow,
|
|
17
|
+
forwardRef,
|
|
18
|
+
pinned,
|
|
19
|
+
wide,
|
|
20
|
+
...props
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement("aside", _extends({
|
|
23
|
+
className: (0, _classnames.default)("l-aside", className, {
|
|
24
|
+
"is-collapsed": collapsed,
|
|
25
|
+
"is-narrow": narrow,
|
|
26
|
+
"is-pinned": pinned,
|
|
27
|
+
"is-wide": wide
|
|
28
|
+
})
|
|
29
|
+
}, props, {
|
|
30
|
+
ref: forwardRef
|
|
31
|
+
}), children);
|
|
32
|
+
};
|
|
33
|
+
var _default = exports.default = AppAside;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import AppAside from "./AppAside";
|
|
3
|
+
declare const meta: Meta<typeof AppAside>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AppAside>;
|
|
6
|
+
/**
|
|
7
|
+
* In most common cases an `AppAside` should contain a `<Panel>` to display the
|
|
8
|
+
* content as intended in the application layout.
|
|
9
|
+
*
|
|
10
|
+
* `AppAside` should be a direct child of an `<Application>` or passed to the
|
|
11
|
+
* application layout `<ApplicationLayout aside={<AppAside .../>}>`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Application = _interopRequireDefault(require("../Application"));
|
|
9
|
+
var _AppMain = _interopRequireDefault(require("../AppMain"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("../../Button"));
|
|
11
|
+
var _Col = _interopRequireDefault(require("../../Col"));
|
|
12
|
+
var _Form = _interopRequireDefault(require("../../Form"));
|
|
13
|
+
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
14
|
+
var _Input = _interopRequireDefault(require("../../Input"));
|
|
15
|
+
var _Panel = _interopRequireDefault(require("../../Panel"));
|
|
16
|
+
var _Row = _interopRequireDefault(require("../../Row"));
|
|
17
|
+
var _AppAside = _interopRequireDefault(require("./AppAside"));
|
|
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
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /* eslint-disable react-hooks/rules-of-hooks */
|
|
22
|
+
const meta = {
|
|
23
|
+
component: _AppAside.default,
|
|
24
|
+
tags: ["autodocs"],
|
|
25
|
+
argTypes: {
|
|
26
|
+
children: {
|
|
27
|
+
control: false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var _default = exports.default = meta;
|
|
32
|
+
/**
|
|
33
|
+
* In most common cases an `AppAside` should contain a `<Panel>` to display the
|
|
34
|
+
* content as intended in the application layout.
|
|
35
|
+
*
|
|
36
|
+
* `AppAside` should be a direct child of an `<Application>` or passed to the
|
|
37
|
+
* application layout `<ApplicationLayout aside={<AppAside .../>}>`.
|
|
38
|
+
*/
|
|
39
|
+
const Default = exports.Default = {
|
|
40
|
+
render: args => {
|
|
41
|
+
const [pinned, setPinned] = (0, _react.useState)(false);
|
|
42
|
+
const [width, setWidth] = (0, _react.useState)(null);
|
|
43
|
+
const [collapsed, setCollapsed] = (0, _react.useState)(false);
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_Application.default, null, /*#__PURE__*/_react.default.createElement(_AppMain.default, null, /*#__PURE__*/_react.default.createElement("p", null, "Scroll to the right to see the panel."), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
45
|
+
onClick: () => setCollapsed(false)
|
|
46
|
+
}, "Open"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
47
|
+
onClick: () => setWidth("narrow")
|
|
48
|
+
}, "Narrow"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
49
|
+
onClick: () => setWidth(null)
|
|
50
|
+
}, "Default"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
51
|
+
onClick: () => setWidth("wide")
|
|
52
|
+
}, "Wide")), /*#__PURE__*/_react.default.createElement(_AppAside.default, _extends({}, args, {
|
|
53
|
+
pinned: pinned,
|
|
54
|
+
wide: width === "wide",
|
|
55
|
+
narrow: width === "narrow",
|
|
56
|
+
collapsed: collapsed
|
|
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: () => setPinned(!pinned),
|
|
60
|
+
dense: true,
|
|
61
|
+
className: "u-no-margin--bottom"
|
|
62
|
+
}, "Pin"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
63
|
+
appearance: "base",
|
|
64
|
+
className: "u-no-margin--bottom",
|
|
65
|
+
hasIcon: true,
|
|
66
|
+
onClick: () => setCollapsed(!collapsed)
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
68
|
+
name: "close"
|
|
69
|
+
}, "Close"))),
|
|
70
|
+
title: "App aside"
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_Form.default, {
|
|
72
|
+
stacked: true
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
74
|
+
label: "Full name",
|
|
75
|
+
type: "text",
|
|
76
|
+
name: "fullName",
|
|
77
|
+
autoComplete: "name",
|
|
78
|
+
stacked: true
|
|
79
|
+
}), /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
80
|
+
label: "Username",
|
|
81
|
+
type: "text",
|
|
82
|
+
name: "username-stacked",
|
|
83
|
+
autoComplete: "username",
|
|
84
|
+
"aria-describedby": "exampleHelpTextMessage",
|
|
85
|
+
stacked: true,
|
|
86
|
+
help: "30 characters or fewer."
|
|
87
|
+
}), /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
88
|
+
type: "text",
|
|
89
|
+
label: "Email address",
|
|
90
|
+
"aria-invalid": "true",
|
|
91
|
+
name: "username-stackederror",
|
|
92
|
+
autoComplete: "email",
|
|
93
|
+
required: true,
|
|
94
|
+
error: "This field is required.",
|
|
95
|
+
stacked: true
|
|
96
|
+
}), /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
97
|
+
label: "Address line 1",
|
|
98
|
+
type: "text",
|
|
99
|
+
name: "address-optional-stacked",
|
|
100
|
+
autoComplete: "address-line1",
|
|
101
|
+
stacked: true
|
|
102
|
+
}), /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
103
|
+
label: "Address line 2",
|
|
104
|
+
type: "text",
|
|
105
|
+
name: "address-optional-stacked",
|
|
106
|
+
autoComplete: "address-line3",
|
|
107
|
+
stacked: true
|
|
108
|
+
}), /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
|
|
109
|
+
size: 12
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
111
|
+
appearance: "positive",
|
|
112
|
+
className: "u-float-right",
|
|
113
|
+
name: "add-details"
|
|
114
|
+
}, "Add details")))))));
|
|
115
|
+
}
|
|
116
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AppAside.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _AppAside = _interopRequireDefault(require("./AppAside"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { HTMLProps, PropsWithChildren } from "react";
|
|
3
|
+
export type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* The main content.
|
|
6
|
+
*/
|
|
7
|
+
children?: PropsWithChildren["children"];
|
|
8
|
+
} & HTMLProps<HTMLDivElement>;
|
|
9
|
+
/**
|
|
10
|
+
* This is a [React](https://reactjs.org/) component for main content area in the Vanilla
|
|
11
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
12
|
+
*/
|
|
13
|
+
declare const AppMain: ({ children, className, ...props }: Props) => React.JSX.Element;
|
|
14
|
+
export default AppMain;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
/**
|
|
12
|
+
* This is a [React](https://reactjs.org/) component for main content area in the Vanilla
|
|
13
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
14
|
+
*/
|
|
15
|
+
const AppMain = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("main", _extends({
|
|
22
|
+
className: (0, _classnames.default)("l-main", className)
|
|
23
|
+
}, props), children);
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = AppMain;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import AppMain from "./AppMain";
|
|
3
|
+
declare const meta: Meta<typeof AppMain>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AppMain>;
|
|
6
|
+
/**
|
|
7
|
+
* In most common cases an `AppMain` should contain a `<Panel>` to display the
|
|
8
|
+
* content as intended in the application layout.
|
|
9
|
+
*
|
|
10
|
+
* `AppMain` should be a direct child of an `<Application>` or when using `ApplicationLayout`
|
|
11
|
+
* it will automatically wrap the component's children.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Default: Story;
|
|
14
|
+
export declare const Content: Story;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = exports.Content = void 0;
|
|
7
|
+
var _Application = _interopRequireDefault(require("../Application"));
|
|
8
|
+
var _Button = _interopRequireDefault(require("../../Button"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _Panel = _interopRequireDefault(require("../../Panel"));
|
|
11
|
+
var _AppMain = _interopRequireDefault(require("./AppMain"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
const meta = {
|
|
14
|
+
component: _AppMain.default,
|
|
15
|
+
tags: ["autodocs"]
|
|
16
|
+
};
|
|
17
|
+
var _default = exports.default = meta;
|
|
18
|
+
/**
|
|
19
|
+
* In most common cases an `AppMain` should contain a `<Panel>` to display the
|
|
20
|
+
* content as intended in the application layout.
|
|
21
|
+
*
|
|
22
|
+
* `AppMain` should be a direct child of an `<Application>` or when using `ApplicationLayout`
|
|
23
|
+
* it will automatically wrap the component's children.
|
|
24
|
+
*/
|
|
25
|
+
const Default = exports.Default = {
|
|
26
|
+
args: {
|
|
27
|
+
children: "AppMain"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const Content = exports.Content = {
|
|
31
|
+
render: args => {
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_Application.default, null, /*#__PURE__*/_react.default.createElement(_AppMain.default, args, /*#__PURE__*/_react.default.createElement(_Panel.default, {
|
|
33
|
+
controls: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
34
|
+
appearance: "positive",
|
|
35
|
+
onClick: () => {},
|
|
36
|
+
className: "u-no-margin--bottom"
|
|
37
|
+
}, "Add"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
38
|
+
appearance: "negative",
|
|
39
|
+
onClick: () => {},
|
|
40
|
+
className: "u-no-margin--bottom"
|
|
41
|
+
}, "Delete")),
|
|
42
|
+
title: "App main"
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "App main content."), /*#__PURE__*/_react.default.createElement("p", null, "Scroll to the right to see the controls."))));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AppMain.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _AppMain = _interopRequireDefault(require("./AppMain"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { PropsWithSpread } from "../../../types";
|
|
3
|
+
import type { HTMLProps, PropsWithChildren } from "react";
|
|
4
|
+
export type Props = PropsWithSpread<{
|
|
5
|
+
/**
|
|
6
|
+
* Whether the navigation panel should be collapsed.
|
|
7
|
+
*/
|
|
8
|
+
collapsed?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The navigation drawer content.
|
|
11
|
+
*/
|
|
12
|
+
children?: PropsWithChildren["children"];
|
|
13
|
+
/**
|
|
14
|
+
* Whether the navigation panel should be pinned.
|
|
15
|
+
*/
|
|
16
|
+
pinned?: boolean;
|
|
17
|
+
}, HTMLProps<HTMLDivElement>>;
|
|
18
|
+
/**
|
|
19
|
+
* This is a [React](https://reactjs.org/) component for the navigation panel in the Vanilla
|
|
20
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
21
|
+
*
|
|
22
|
+
* This component is used to display the left navigation panel. It should be
|
|
23
|
+
* used alongside [`AppNavigationBar`](/docs/components-applicationlayout-appnavigationbar--docs).
|
|
24
|
+
*/
|
|
25
|
+
declare const AppNavigation: ({ children, className, collapsed, pinned, ...props }: Props) => React.JSX.Element;
|
|
26
|
+
export default AppNavigation;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
/**
|
|
12
|
+
* This is a [React](https://reactjs.org/) component for the navigation panel in the Vanilla
|
|
13
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
14
|
+
*
|
|
15
|
+
* This component is used to display the left navigation panel. It should be
|
|
16
|
+
* used alongside [`AppNavigationBar`](/docs/components-applicationlayout-appnavigationbar--docs).
|
|
17
|
+
*/
|
|
18
|
+
const AppNavigation = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
collapsed,
|
|
23
|
+
pinned,
|
|
24
|
+
...props
|
|
25
|
+
} = _ref;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("header", _extends({
|
|
27
|
+
className: (0, _classnames.default)("l-navigation", className, {
|
|
28
|
+
"is-collapsed": collapsed,
|
|
29
|
+
"is-pinned": pinned
|
|
30
|
+
})
|
|
31
|
+
}, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: "l-navigation__drawer"
|
|
33
|
+
}, children));
|
|
34
|
+
};
|
|
35
|
+
var _default = exports.default = AppNavigation;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import AppNavigation from "./AppNavigation";
|
|
3
|
+
declare const meta: Meta<typeof AppNavigation>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AppNavigation>;
|
|
6
|
+
/**
|
|
7
|
+
* In most common cases an `AppNavigation` should contain a `<Panel>` and `<SideNavigation>`.
|
|
8
|
+
*
|
|
9
|
+
* `AppNavigation` should be a direct child of an `<Application>` or when using `ApplicationLayout`
|
|
10
|
+
* it will wrap `navItems` and `sideNavigation`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _Application = _interopRequireDefault(require("../Application"));
|
|
10
|
+
var _AppMain = _interopRequireDefault(require("../AppMain"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("../../Button"));
|
|
12
|
+
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
13
|
+
var _Panel = _interopRequireDefault(require("../../Panel"));
|
|
14
|
+
var _SideNavigation = _interopRequireDefault(require("../../SideNavigation"));
|
|
15
|
+
var _Strip = _interopRequireDefault(require("../../Strip"));
|
|
16
|
+
var _AppNavigation = _interopRequireDefault(require("./AppNavigation"));
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /* eslint-disable react-hooks/rules-of-hooks */
|
|
21
|
+
const meta = {
|
|
22
|
+
component: _AppNavigation.default,
|
|
23
|
+
tags: ["autodocs"]
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = meta;
|
|
26
|
+
/**
|
|
27
|
+
* In most common cases an `AppNavigation` should contain a `<Panel>` and `<SideNavigation>`.
|
|
28
|
+
*
|
|
29
|
+
* `AppNavigation` should be a direct child of an `<Application>` or when using `ApplicationLayout`
|
|
30
|
+
* it will wrap `navItems` and `sideNavigation`.
|
|
31
|
+
*/
|
|
32
|
+
const Default = exports.Default = {
|
|
33
|
+
render: args => {
|
|
34
|
+
const [pinned, setPinned] = (0, _react.useState)(false);
|
|
35
|
+
const [collapsed, setCollapsed] = (0, _react.useState)(true);
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_Application.default, null, /*#__PURE__*/_react.default.createElement(_AppNavigation.default, _extends({}, args, {
|
|
37
|
+
pinned: pinned,
|
|
38
|
+
collapsed: collapsed
|
|
39
|
+
}), /*#__PURE__*/_react.default.createElement(_Panel.default, {
|
|
40
|
+
dark: true,
|
|
41
|
+
controls: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
42
|
+
hasIcon: true,
|
|
43
|
+
appearance: "base",
|
|
44
|
+
className: (0, _classnames.default)("u-no-margin u-hide--medium", {
|
|
45
|
+
"is-dark": true
|
|
46
|
+
}),
|
|
47
|
+
onClick: evt => {
|
|
48
|
+
setCollapsed(true);
|
|
49
|
+
// The menu stays open while its content has focus, so the
|
|
50
|
+
// close button must blur to actually close the menu.
|
|
51
|
+
evt.currentTarget.blur();
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
54
|
+
name: "close",
|
|
55
|
+
className: (0, _classnames.default)({
|
|
56
|
+
"is-light": true
|
|
57
|
+
})
|
|
58
|
+
}, "Close menu")), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
59
|
+
hasIcon: true,
|
|
60
|
+
appearance: "base",
|
|
61
|
+
className: (0, _classnames.default)("u-no-margin u-hide--small", {
|
|
62
|
+
"is-dark": true
|
|
63
|
+
}),
|
|
64
|
+
onClick: () => {
|
|
65
|
+
setPinned(!pinned);
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
68
|
+
name: pinned ? "close" : "pin",
|
|
69
|
+
className: (0, _classnames.default)({
|
|
70
|
+
"is-light": true
|
|
71
|
+
})
|
|
72
|
+
}, pinned ? "Unpin menu" : "Pin menu"))),
|
|
73
|
+
controlsClassName: "u-hide--large",
|
|
74
|
+
stickyHeader: true,
|
|
75
|
+
logo: {
|
|
76
|
+
icon: "https://assets.ubuntu.com/v1/7144ec6d-logo-jaas-icon.svg",
|
|
77
|
+
name: "https://assets.ubuntu.com/v1/2e04d794-logo-jaas.svg",
|
|
78
|
+
nameAlt: "JAAS",
|
|
79
|
+
href: "/"
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(_SideNavigation.default, {
|
|
82
|
+
dark: true,
|
|
83
|
+
items: [{
|
|
84
|
+
items: [{
|
|
85
|
+
icon: "drag",
|
|
86
|
+
label: "Models",
|
|
87
|
+
href: "/models"
|
|
88
|
+
}, {
|
|
89
|
+
icon: "menu",
|
|
90
|
+
label: "Controllers",
|
|
91
|
+
href: "/controllers"
|
|
92
|
+
}, {
|
|
93
|
+
icon: "user",
|
|
94
|
+
label: "Permissions",
|
|
95
|
+
href: "/permissions"
|
|
96
|
+
}]
|
|
97
|
+
}]
|
|
98
|
+
}))), /*#__PURE__*/_react.default.createElement(_AppMain.default, null, /*#__PURE__*/_react.default.createElement(_Strip.default, null, /*#__PURE__*/_react.default.createElement("p", null, "These behaviours are only available at smaller screen sizes:"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
99
|
+
onClick: () => setPinned(!pinned)
|
|
100
|
+
}, "Pin"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
101
|
+
onClick: () => setCollapsed(!collapsed)
|
|
102
|
+
}, "Toggle"))));
|
|
103
|
+
}
|
|
104
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AppNavigation.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _AppNavigation = _interopRequireDefault(require("./AppNavigation"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { PropsWithSpread } from "../../../types";
|
|
3
|
+
import type { HTMLProps, PropsWithChildren } from "react";
|
|
4
|
+
export type Props = PropsWithSpread<{
|
|
5
|
+
/**
|
|
6
|
+
* The navigation content.
|
|
7
|
+
*/
|
|
8
|
+
children?: PropsWithChildren["children"];
|
|
9
|
+
}, HTMLProps<HTMLElement>>;
|
|
10
|
+
/**
|
|
11
|
+
* This is a [React](https://reactjs.org/) component for navigation bar in the Vanilla
|
|
12
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
13
|
+
*
|
|
14
|
+
* This component is used to display the navigation panel on mobile or small
|
|
15
|
+
* screens. It should be used alongside [`AppNavigation`](/docs/components-applicationlayout-appnavigation--docs).
|
|
16
|
+
*/
|
|
17
|
+
declare const AppNavigationBar: ({ children, className, ...props }: Props) => React.JSX.Element;
|
|
18
|
+
export default AppNavigationBar;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
/**
|
|
12
|
+
* This is a [React](https://reactjs.org/) component for navigation bar in the Vanilla
|
|
13
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
14
|
+
*
|
|
15
|
+
* This component is used to display the navigation panel on mobile or small
|
|
16
|
+
* screens. It should be used alongside [`AppNavigation`](/docs/components-applicationlayout-appnavigation--docs).
|
|
17
|
+
*/
|
|
18
|
+
const AppNavigationBar = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("header", _extends({
|
|
25
|
+
className: (0, _classnames.default)("l-navigation-bar", className)
|
|
26
|
+
}, props), children);
|
|
27
|
+
};
|
|
28
|
+
var _default = exports.default = AppNavigationBar;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import AppNavigationBar from "./AppNavigationBar";
|
|
3
|
+
declare const meta: Meta<typeof AppNavigationBar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AppNavigationBar>;
|
|
6
|
+
/**
|
|
7
|
+
* In most common cases an `AppNavigationBar` should contain a `<Panel>`.
|
|
8
|
+
*
|
|
9
|
+
* `AppNavigationBar` should be a direct child of an `<Application>` or when using `ApplicationLayout`
|
|
10
|
+
* it will already be included.
|
|
11
|
+
*
|
|
12
|
+
* The toggle state should control the collapsed state of `AppNavigation`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Default: Story;
|
|
15
|
+
export declare const States: Story;
|