@canonical/react-components 0.50.4 → 0.50.6
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/Card/Card.d.ts +5 -0
- package/dist/components/Card/Card.js +6 -0
- package/dist/components/Card/Card.stories.d.ts +28 -0
- package/dist/components/Card/Card.stories.js +50 -0
- package/dist/components/Icon/Icon.stories.scss +1 -4
- package/dist/components/MultiSelect/MultiSelect.scss +17 -18
- package/dist/components/NotificationProvider/NotificationProvider.js +1 -1
- package/dist/components/NotificationProvider/messageBuilder.d.ts +1 -1
- package/dist/components/NotificationProvider/messageBuilder.js +2 -1
- package/dist/components/NotificationProvider/types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -26,5 +26,10 @@ export type Props = PropsWithSpread<{
|
|
|
26
26
|
*/
|
|
27
27
|
title?: ReactNode;
|
|
28
28
|
}, HTMLProps<HTMLDivElement>>;
|
|
29
|
+
/**
|
|
30
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Card](https://docs.vanillaframework.io/patterns/card/).
|
|
31
|
+
*
|
|
32
|
+
* There are four card styles available to use in Vanilla: default, header, highlighted and overlay. Our card component will expand to fill the full width of its parent container.
|
|
33
|
+
*/
|
|
29
34
|
declare const Card: ({ children, className, highlighted, overlay, thumbnail, title, ...props }: Props) => JSX.Element;
|
|
30
35
|
export default Card;
|
|
@@ -10,6 +10,12 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
10
10
|
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; }
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
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); }
|
|
13
|
+
/**
|
|
14
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Card](https://docs.vanillaframework.io/patterns/card/).
|
|
15
|
+
*
|
|
16
|
+
* There are four card styles available to use in Vanilla: default, header, highlighted and overlay. Our card component will expand to fill the full width of its parent container.
|
|
17
|
+
*/
|
|
18
|
+
|
|
13
19
|
const Card = _ref => {
|
|
14
20
|
let {
|
|
15
21
|
children,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta } from "@storybook/react";
|
|
3
|
+
import Card from "./";
|
|
4
|
+
declare const meta: Meta<typeof Card>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: {
|
|
7
|
+
args: {
|
|
8
|
+
title: string;
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const Header: {
|
|
13
|
+
args: {
|
|
14
|
+
title: string;
|
|
15
|
+
thumbnail: string;
|
|
16
|
+
children: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const Highlighted: {
|
|
20
|
+
args: {
|
|
21
|
+
highlighted: boolean;
|
|
22
|
+
title: string;
|
|
23
|
+
children: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const Overlay: {
|
|
27
|
+
render: () => React.JSX.Element;
|
|
28
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Overlay = exports.Highlighted = exports.Header = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = _interopRequireDefault(require("./"));
|
|
9
|
+
var _Col = _interopRequireDefault(require("../Col"));
|
|
10
|
+
var _Row = _interopRequireDefault(require("../Row"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const meta = {
|
|
13
|
+
title: "Card",
|
|
14
|
+
component: _.default,
|
|
15
|
+
tags: ["autodocs"]
|
|
16
|
+
};
|
|
17
|
+
var _default = exports.default = meta;
|
|
18
|
+
const Default = exports.Default = {
|
|
19
|
+
args: {
|
|
20
|
+
title: "We'd love to have you join us as a partner.",
|
|
21
|
+
children: "If you are an independent software vendor or bundle author, it's easy to apply. You can find out more below."
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const Header = exports.Header = {
|
|
25
|
+
args: {
|
|
26
|
+
title: "Raspberry Pi2 and Pi3",
|
|
27
|
+
thumbnail: "https://assets.ubuntu.com/v1/dca2e4c4-raspberry-logo.png",
|
|
28
|
+
children: "For fun, for education and for profit, the RPi makes device development personal and entertaining. With support for both the Pi2 and the new Pi3, Ubuntu Core supports the world’s most beloved board."
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const Highlighted = exports.Highlighted = {
|
|
32
|
+
args: {
|
|
33
|
+
...Default.args,
|
|
34
|
+
highlighted: true
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const Overlay = exports.Overlay = {
|
|
38
|
+
render: () => /*#__PURE__*/_react.default.createElement("section", {
|
|
39
|
+
className: "p-strip--image is-light",
|
|
40
|
+
style: {
|
|
41
|
+
backgroundImage: "url('https://assets.ubuntu.com/v1/0a98afcd-screenshot_desktop.jpg')"
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
|
|
44
|
+
size: 6,
|
|
45
|
+
emptyLarge: 7
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, {
|
|
47
|
+
title: "Web browsing",
|
|
48
|
+
overlay: true
|
|
49
|
+
}, "Renowned for speed and security, Ubuntu and Firefox make browsing the web a pleasure again. Ubuntu also includes Chrome, Opera and other browsers that can be installed from the Ubuntu Software Centre."))))
|
|
50
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
@import "
|
|
2
|
-
@import "~vanilla-framework/scss/base_placeholders";
|
|
3
|
-
@import "~vanilla-framework/scss/base_icon-definitions";
|
|
4
|
-
@import "~vanilla-framework/scss/patterns_icons";
|
|
1
|
+
@import "vanilla-framework";
|
|
5
2
|
|
|
6
3
|
@include vf-b-placeholders;
|
|
7
4
|
@include vf-p-icons-common;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
@use "sass:map";
|
|
2
2
|
@import "vanilla-framework";
|
|
3
|
-
@include vf-base
|
|
4
|
-
@include vf-p-lists;
|
|
3
|
+
@include vf-b-placeholders; // Vanilla base placeholders to extend from
|
|
5
4
|
|
|
6
5
|
$dropdown-max-height: 20rem;
|
|
7
6
|
|
|
8
7
|
.multi-select {
|
|
8
|
+
// Scope Vanilla form includes to multi select component only
|
|
9
|
+
// to avoid overriding any Vanilla base styles
|
|
10
|
+
// XXX: This is a workaround for https://github.com/canonical/vanilla-framework/issues/5030
|
|
11
|
+
@include vf-b-forms;
|
|
12
|
+
|
|
9
13
|
position: relative;
|
|
10
14
|
}
|
|
11
15
|
|
|
@@ -37,12 +41,12 @@ $dropdown-max-height: 20rem;
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
.multi-select__dropdown {
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
background-color: $colors--theme--background-default;
|
|
45
|
+
box-shadow: $box-shadow;
|
|
46
|
+
color: $colors--theme--text-default;
|
|
42
47
|
left: 0;
|
|
43
48
|
max-height: $dropdown-max-height;
|
|
44
49
|
overflow: auto;
|
|
45
|
-
|
|
46
50
|
padding-top: $spv--small;
|
|
47
51
|
position: absolute;
|
|
48
52
|
right: 0;
|
|
@@ -59,14 +63,15 @@ $dropdown-max-height: 20rem;
|
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
.multi-select__dropdown-list {
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
list-style: none;
|
|
64
67
|
margin-bottom: $sph--x-small;
|
|
68
|
+
margin-left: 0;
|
|
69
|
+
padding-left: 0;
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
.multi-select__footer {
|
|
68
|
-
background:
|
|
69
|
-
border-top: 1px solid $
|
|
73
|
+
background: $colors--theme--background-default;
|
|
74
|
+
border-top: 1px solid $colors--theme--border-default;
|
|
70
75
|
bottom: 0;
|
|
71
76
|
display: flex;
|
|
72
77
|
flex-wrap: wrap;
|
|
@@ -97,12 +102,6 @@ $dropdown-max-height: 20rem;
|
|
|
97
102
|
}
|
|
98
103
|
}
|
|
99
104
|
|
|
100
|
-
.multi-select__dropdown-item-description {
|
|
101
|
-
@extend %small-text;
|
|
102
|
-
|
|
103
|
-
color: $color-mid-dark;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
105
|
.multi-select__dropdown-button {
|
|
107
106
|
border: 0;
|
|
108
107
|
margin-bottom: 0;
|
|
@@ -113,7 +112,7 @@ $dropdown-max-height: 20rem;
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
.multi-select__selected-list {
|
|
116
|
-
background-color: $colors--
|
|
115
|
+
background-color: $colors--theme--background-inputs;
|
|
117
116
|
border-bottom: 0;
|
|
118
117
|
margin: 0;
|
|
119
118
|
overflow: hidden;
|
|
@@ -142,12 +141,12 @@ $dropdown-max-height: 20rem;
|
|
|
142
141
|
transform: translateY(-50%) rotate(-180deg);
|
|
143
142
|
|
|
144
143
|
@extend %icon;
|
|
145
|
-
@include vf-icon-chevron
|
|
144
|
+
@include vf-icon-chevron-themed;
|
|
146
145
|
@include vf-transition($property: transform, $duration: fast);
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
&[aria-expanded="true"] {
|
|
150
|
-
background-color: $colors--
|
|
149
|
+
background-color: $colors--theme--background-hover;
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
&[aria-expanded="false"] {
|
|
@@ -49,7 +49,7 @@ const NotificationProvider = _ref => {
|
|
|
49
49
|
queue: _messageBuilder.queue,
|
|
50
50
|
failure: (title, error, message, actions) => setDeduplicated((0, _messageBuilder.failure)(title, error, message, actions)),
|
|
51
51
|
info: (message, title) => setDeduplicated((0, _messageBuilder.info)(message, title)),
|
|
52
|
-
success: message => setDeduplicated((0, _messageBuilder.success)(message)),
|
|
52
|
+
success: (message, title) => setDeduplicated((0, _messageBuilder.success)(message, title)),
|
|
53
53
|
setDeduplicated
|
|
54
54
|
};
|
|
55
55
|
return /*#__PURE__*/_react.default.createElement(NotifyContext.Provider, {
|
|
@@ -2,5 +2,5 @@ import { NotificationAction, NotificationType, QueuedNotification } from "./type
|
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
export declare const queue: (notification: NotificationType) => QueuedNotification;
|
|
4
4
|
export declare const info: (message: ReactNode, title?: string) => NotificationType;
|
|
5
|
-
export declare const success: (message: ReactNode) => NotificationType;
|
|
5
|
+
export declare const success: (message: ReactNode, title?: string) => NotificationType;
|
|
6
6
|
export declare const failure: (title: string, error: unknown, message?: ReactNode, actions?: NotificationAction[]) => NotificationType;
|
|
@@ -29,7 +29,7 @@ export interface NotificationHelper {
|
|
|
29
29
|
clear: () => void;
|
|
30
30
|
failure: (title: string, error: unknown, message?: ReactNode, actions?: NotificationAction[]) => NotificationType;
|
|
31
31
|
info: (message: ReactNode, title?: string) => NotificationType;
|
|
32
|
-
success: (message: ReactNode) => NotificationType;
|
|
32
|
+
success: (message: ReactNode, title?: string) => NotificationType;
|
|
33
33
|
queue: (notification: NotificationType) => QueuedNotification;
|
|
34
34
|
setDeduplicated: (value: NotificationType) => NotificationType;
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-components",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"author": "Huw Wilkins <huw.wilkins@canonical.com>",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"ts-jest": "29.1.2",
|
|
86
86
|
"tsc-alias": "1.8.8",
|
|
87
87
|
"typescript": "5.3.3",
|
|
88
|
-
"vanilla-framework": "4.
|
|
88
|
+
"vanilla-framework": "4.9.0",
|
|
89
89
|
"wait-on": "7.2.0",
|
|
90
90
|
"webpack": "5.89.0"
|
|
91
91
|
},
|