@canonical/react-components 0.59.0 → 0.60.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/Accordion/Accordion.d.ts +5 -0
- package/dist/components/Accordion/Accordion.js +6 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +18 -0
- package/dist/components/Accordion/Accordion.stories.js +117 -0
- package/dist/components/ActionButton/ActionButton.d.ts +7 -0
- package/dist/components/ActionButton/ActionButton.js +7 -0
- package/dist/components/ActionButton/ActionButton.stories.d.ts +7 -0
- package/dist/components/ActionButton/ActionButton.stories.js +36 -0
- package/dist/components/ApplicationLayout/ApplicationLayout.d.ts +3 -3
- package/dist/components/ApplicationLayout/ApplicationLayout.js +4 -4
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.d.ts +5 -0
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.js +16 -2
- package/dist/components/ArticlePagination/ArticlePagination.d.ts +5 -0
- package/dist/components/ArticlePagination/ArticlePagination.js +5 -0
- package/dist/components/ArticlePagination/ArticlePagination.stories.d.ts +6 -0
- package/dist/components/ArticlePagination/ArticlePagination.stories.js +22 -0
- package/dist/components/Badge/Badge.d.ts +5 -0
- package/dist/components/Badge/Badge.js +6 -0
- package/dist/components/Badge/Badge.stories.d.ts +15 -0
- package/dist/components/Badge/Badge.stories.js +62 -0
- package/dist/components/Button/Button.d.ts +3 -1
- package/dist/components/Button/Button.js +3 -1
- package/dist/components/Button/Button.stories.d.ts +32 -0
- package/dist/components/Button/Button.stories.js +180 -0
- package/dist/components/Card/Card.stories.js +0 -1
- package/dist/components/CheckboxInput/CheckboxInput.d.ts +5 -0
- package/dist/components/CheckboxInput/CheckboxInput.js +5 -0
- package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +11 -0
- package/dist/components/CheckboxInput/CheckboxInput.stories.js +84 -0
- package/dist/components/Chip/Chip.d.ts +5 -0
- package/dist/components/Chip/Chip.js +5 -0
- package/dist/components/Chip/Chip.stories.d.ts +9 -0
- package/dist/components/Chip/Chip.stories.js +45 -0
- package/dist/components/CodeSnippet/CodeSnippet.d.ts +7 -0
- package/dist/components/CodeSnippet/CodeSnippet.js +7 -0
- package/dist/components/CodeSnippet/CodeSnippet.stories.d.ts +45 -0
- package/dist/components/CodeSnippet/CodeSnippet.stories.js +279 -0
- package/dist/components/Col/Col.d.ts +5 -0
- package/dist/components/Col/Col.js +5 -0
- package/dist/components/Col/Col.stories.d.ts +11 -0
- package/dist/components/Col/Col.stories.js +154 -0
- package/dist/components/ConfirmationButton/ConfirmationButton.d.ts +3 -0
- package/dist/components/ConfirmationButton/ConfirmationButton.js +13 -1
- package/dist/components/ConfirmationButton/ConfirmationButton.stories.d.ts +9 -0
- package/dist/components/ConfirmationButton/ConfirmationButton.stories.js +108 -0
- package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +16 -4
- package/dist/components/ConfirmationModal/ConfirmationModal.js +8 -3
- package/dist/components/ConfirmationModal/ConfirmationModal.stories.d.ts +18 -0
- package/dist/components/ConfirmationModal/ConfirmationModal.stories.js +135 -0
- package/dist/components/ContextualMenu/ContextualMenu.d.ts +3 -20
- package/dist/components/ContextualMenu/ContextualMenu.js +3 -20
- package/dist/components/ContextualMenu/ContextualMenu.stories.d.ts +13 -0
- package/dist/components/ContextualMenu/ContextualMenu.stories.js +107 -0
- package/dist/components/EmptyState/EmptyState.d.ts +3 -0
- package/dist/components/EmptyState/EmptyState.js +3 -0
- package/dist/components/EmptyState/EmptyState.stories.d.ts +7 -0
- package/dist/components/EmptyState/EmptyState.stories.js +49 -0
- package/dist/components/Form/Form.d.ts +5 -0
- package/dist/components/Form/Form.js +5 -0
- package/dist/components/Form/Form.stories.d.ts +12 -0
- package/dist/components/Form/Form.stories.js +179 -0
- package/dist/components/FormikField/FormikField.stories.js +0 -1
- package/dist/components/Icon/Icon.d.ts +3 -1
- package/dist/components/Icon/Icon.js +3 -1
- package/dist/components/Icon/Icon.stories.d.ts +16 -0
- package/dist/components/Icon/Icon.stories.js +49 -0
- package/dist/components/Input/Input.d.ts +5 -0
- package/dist/components/Input/Input.js +5 -0
- package/dist/components/Input/Input.stories.d.ts +14 -0
- package/dist/components/Input/Input.stories.js +148 -0
- package/dist/components/Link/Link.d.ts +5 -0
- package/dist/components/Link/Link.js +5 -0
- package/dist/components/Link/Link.stories.d.ts +9 -0
- package/dist/components/Link/Link.stories.js +48 -0
- package/dist/components/List/List.d.ts +5 -0
- package/dist/components/List/List.js +6 -0
- package/dist/components/List/List.stories.d.ts +15 -0
- package/dist/components/List/List.stories.js +122 -0
- package/dist/components/LoginPageLayout/LoginPageLayout.d.ts +4 -0
- package/dist/components/LoginPageLayout/LoginPageLayout.js +4 -0
- package/dist/components/LoginPageLayout/LoginPageLayout.stories.d.ts +9 -0
- package/dist/components/LoginPageLayout/LoginPageLayout.stories.js +58 -0
- package/dist/components/MainTable/MainTable.d.ts +3 -0
- package/dist/components/MainTable/MainTable.js +4 -0
- package/dist/components/MainTable/MainTable.stories.d.ts +15 -0
- package/dist/components/MainTable/MainTable.stories.js +553 -0
- package/dist/components/Modal/Modal.d.ts +5 -0
- package/dist/components/Modal/Modal.js +5 -0
- package/dist/components/Modal/Modal.stories.d.ts +6 -0
- package/dist/components/Modal/Modal.stories.js +57 -0
- package/dist/components/ModularTable/ModularTable.d.ts +52 -0
- package/dist/components/ModularTable/ModularTable.js +53 -0
- package/dist/components/ModularTable/ModularTable.stories.d.ts +27 -0
- package/dist/components/ModularTable/ModularTable.stories.js +343 -0
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +5 -64
- package/dist/components/MultiSelect/MultiSelect.stories.js +0 -1
- package/dist/components/Navigation/Navigation.d.ts +8 -0
- package/dist/components/Navigation/Navigation.js +9 -0
- package/dist/components/Navigation/Navigation.stories.d.ts +43 -0
- package/dist/components/Navigation/Navigation.stories.js +232 -0
- package/dist/components/Notification/Notification.d.ts +25 -0
- package/dist/components/Notification/Notification.js +25 -0
- package/dist/components/Notification/Notification.stories.d.ts +45 -0
- package/dist/components/Notification/Notification.stories.js +201 -0
- package/dist/components/Pagination/Pagination.d.ts +12 -0
- package/dist/components/Pagination/Pagination.js +12 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +14 -0
- package/dist/components/Pagination/Pagination.stories.js +94 -0
- package/dist/components/PasswordToggle/PasswordToggle.d.ts +5 -0
- package/dist/components/PasswordToggle/PasswordToggle.js +5 -0
- package/dist/components/PasswordToggle/PasswordToggle.stories.d.ts +12 -0
- package/dist/components/PasswordToggle/PasswordToggle.stories.js +74 -0
- package/dist/components/RadioInput/RadioInput.d.ts +5 -0
- package/dist/components/RadioInput/RadioInput.js +5 -0
- package/dist/components/RadioInput/RadioInput.stories.d.ts +10 -0
- package/dist/components/RadioInput/RadioInput.stories.js +83 -0
- package/dist/components/Row/Row.d.ts +5 -0
- package/dist/components/Row/Row.js +5 -0
- package/dist/components/Row/Row.stories.d.ts +9 -0
- package/dist/components/Row/Row.stories.js +29 -0
- package/dist/components/SearchAndFilter/SearchAndFilter.d.ts +3 -0
- package/dist/components/SearchAndFilter/SearchAndFilter.js +3 -0
- package/dist/components/SearchAndFilter/SearchAndFilter.stories.d.ts +8 -0
- package/dist/components/SearchAndFilter/SearchAndFilter.stories.js +218 -0
- package/dist/components/SearchBox/SearchBox.d.ts +5 -0
- package/dist/components/SearchBox/SearchBox.js +5 -0
- package/dist/components/SearchBox/SearchBox.stories.d.ts +14 -0
- package/dist/components/SearchBox/SearchBox.stories.js +106 -0
- package/dist/components/Select/Select.d.ts +5 -0
- package/dist/components/Select/Select.js +6 -0
- package/dist/components/Select/Select.stories.d.ts +7 -0
- package/dist/components/Select/Select.stories.js +97 -0
- package/dist/components/Slider/Slider.d.ts +6 -0
- package/dist/components/Slider/Slider.js +6 -0
- package/dist/components/Slider/Slider.stories.d.ts +10 -0
- package/dist/components/Slider/Slider.stories.js +74 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -0
- package/dist/components/Spinner/Spinner.js +3 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +8 -0
- package/dist/components/Spinner/Spinner.stories.js +28 -0
- package/dist/components/StatusLabel/StatusLabel.d.ts +3 -1
- package/dist/components/StatusLabel/StatusLabel.js +3 -1
- package/dist/components/StatusLabel/StatusLabel.stories.d.ts +10 -0
- package/dist/components/StatusLabel/StatusLabel.stories.js +61 -0
- package/dist/components/Strip/Strip.d.ts +5 -0
- package/dist/components/Strip/Strip.js +5 -0
- package/dist/components/Strip/Strip.stories.d.ts +12 -0
- package/dist/components/Strip/Strip.stories.js +130 -0
- package/dist/components/SummaryButton/SummaryButton.d.ts +3 -0
- package/dist/components/SummaryButton/SummaryButton.js +3 -0
- package/dist/components/SummaryButton/SummaryButton.stories.d.ts +18 -0
- package/dist/components/SummaryButton/SummaryButton.stories.js +59 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.js +3 -0
- package/dist/components/Switch/Switch.stories.d.ts +7 -0
- package/dist/components/Switch/Switch.stories.js +26 -0
- package/dist/components/TablePagination/TablePagination.d.ts +21 -0
- package/dist/components/TablePagination/TablePagination.js +21 -0
- package/dist/components/TablePagination/TablePagination.stories.d.ts +10 -0
- package/dist/components/TablePagination/TablePagination.stories.js +302 -0
- package/dist/components/Tabs/Tabs.d.ts +5 -0
- package/dist/components/Tabs/Tabs.js +5 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +11 -0
- package/dist/components/Tabs/Tabs.stories.js +56 -0
- package/dist/components/Textarea/Textarea.d.ts +5 -0
- package/dist/components/Textarea/Textarea.js +5 -0
- package/dist/components/Textarea/Textarea.stories.d.ts +7 -0
- package/dist/components/Textarea/Textarea.stories.js +62 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -11
- package/dist/components/Tooltip/Tooltip.js +7 -11
- package/dist/components/Tooltip/Tooltip.stories.d.ts +12 -0
- package/dist/components/Tooltip/Tooltip.stories.js +71 -0
- package/package.json +14 -14
|
@@ -8,6 +8,11 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
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 the [React](https://reactjs.org/) component for Vanilla [Tabs](https://vanillaframework.io/docs/patterns/tabs).
|
|
13
|
+
Tabs organise and allow navigation between groups of content that are related and at the same level
|
|
14
|
+
of hierarchy.
|
|
15
|
+
*/
|
|
11
16
|
const Tabs = _ref => {
|
|
12
17
|
let {
|
|
13
18
|
className,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Tabs from "./Tabs";
|
|
3
|
+
declare const meta: Meta<typeof Tabs>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Tabs>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
/**
|
|
8
|
+
* To horizontally align the Tabs with other content, they can be contained within a Row component to
|
|
9
|
+
provide correct gutters.
|
|
10
|
+
*/
|
|
11
|
+
export declare const HorizontallyAligned: Story;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.HorizontallyAligned = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Row = _interopRequireDefault(require("../Row"));
|
|
9
|
+
var _Tabs = _interopRequireDefault(require("./Tabs"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const meta = {
|
|
12
|
+
component: _Tabs.default,
|
|
13
|
+
tags: ["autodocs"]
|
|
14
|
+
};
|
|
15
|
+
var _default = exports.default = meta;
|
|
16
|
+
const Default = exports.Default = {
|
|
17
|
+
name: "Default",
|
|
18
|
+
args: {
|
|
19
|
+
links: [{
|
|
20
|
+
active: true,
|
|
21
|
+
label: "Summary"
|
|
22
|
+
}, {
|
|
23
|
+
active: false,
|
|
24
|
+
label: "Network"
|
|
25
|
+
}, {
|
|
26
|
+
active: false,
|
|
27
|
+
label: "Storage"
|
|
28
|
+
}, {
|
|
29
|
+
active: false,
|
|
30
|
+
label: "Settings"
|
|
31
|
+
}]
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* To horizontally align the Tabs with other content, they can be contained within a Row component to
|
|
37
|
+
provide correct gutters.
|
|
38
|
+
*/
|
|
39
|
+
const HorizontallyAligned = exports.HorizontallyAligned = {
|
|
40
|
+
render: () => /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Tabs.default, {
|
|
41
|
+
links: [{
|
|
42
|
+
active: true,
|
|
43
|
+
label: "Summary"
|
|
44
|
+
}, {
|
|
45
|
+
active: false,
|
|
46
|
+
label: "Network"
|
|
47
|
+
}, {
|
|
48
|
+
active: false,
|
|
49
|
+
label: "Storage"
|
|
50
|
+
}, {
|
|
51
|
+
active: false,
|
|
52
|
+
label: "Settings"
|
|
53
|
+
}]
|
|
54
|
+
}), /*#__PURE__*/_react.default.createElement("p", null, "There should be gutters and the text should be horizontally aligned")),
|
|
55
|
+
name: "Horizontally aligned"
|
|
56
|
+
};
|
|
@@ -61,5 +61,10 @@ export type Props = PropsWithSpread<{
|
|
|
61
61
|
*/
|
|
62
62
|
onControlEnter?: () => void;
|
|
63
63
|
}, TextareaHTMLAttributes<HTMLTextAreaElement>>;
|
|
64
|
+
/**
|
|
65
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Textarea](https://docs.vanillaframework.io/base/forms/#textarea).
|
|
66
|
+
*
|
|
67
|
+
* The Textarea component defines a multi-line text input control.
|
|
68
|
+
*/
|
|
64
69
|
declare const Textarea: ({ caution, className, error, grow, help, id, label, labelClassName, onKeyUp, onControlEnter, required, stacked, style, success, takeFocus, wrapperClassName, ...props }: Props) => JSX.Element;
|
|
65
70
|
export default Textarea;
|
|
@@ -15,6 +15,11 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
15
15
|
* The props for the Textarea component.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Textarea](https://docs.vanillaframework.io/base/forms/#textarea).
|
|
20
|
+
*
|
|
21
|
+
* The Textarea component defines a multi-line text input control.
|
|
22
|
+
*/
|
|
18
23
|
const Textarea = _ref => {
|
|
19
24
|
var _props$value;
|
|
20
25
|
let {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Textarea from "./Textarea";
|
|
3
|
+
declare const meta: Meta<typeof Textarea>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Textarea>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const DynamicHeight: Story;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.DynamicHeight = exports.Default = void 0;
|
|
7
|
+
var _Textarea = _interopRequireDefault(require("./Textarea"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const meta = {
|
|
10
|
+
component: _Textarea.default,
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
argTypes: {
|
|
13
|
+
caution: {
|
|
14
|
+
control: {
|
|
15
|
+
type: "text"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
error: {
|
|
19
|
+
control: {
|
|
20
|
+
type: "text"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
help: {
|
|
24
|
+
control: {
|
|
25
|
+
type: "text"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
label: {
|
|
29
|
+
control: {
|
|
30
|
+
type: "text"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
success: {
|
|
34
|
+
control: {
|
|
35
|
+
type: "text"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
id: {
|
|
39
|
+
control: {
|
|
40
|
+
disable: true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var _default = exports.default = meta;
|
|
46
|
+
const Default = exports.Default = {
|
|
47
|
+
name: "Default",
|
|
48
|
+
args: {
|
|
49
|
+
label: "Tell us about your project or interest",
|
|
50
|
+
id: "textarea2",
|
|
51
|
+
rows: 3,
|
|
52
|
+
defaultValue: "Ubuntu"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const DynamicHeight = exports.DynamicHeight = {
|
|
56
|
+
name: "Dynamic Height",
|
|
57
|
+
args: {
|
|
58
|
+
label: "Text area that will dynamically adjust its height based on content",
|
|
59
|
+
defaultValue: "Ubuntu",
|
|
60
|
+
grow: true
|
|
61
|
+
}
|
|
62
|
+
};
|
|
@@ -63,17 +63,13 @@ export type Props = {
|
|
|
63
63
|
};
|
|
64
64
|
export declare const adjustForWindow: (position: Position, fitsWindow: WindowFitment) => Position;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @param positionElementClassName An optional class to apply to the element that wraps the children.
|
|
74
|
-
* @param tooltipClassName An optional class to apply to the tooltip message element.
|
|
75
|
-
* @param zIndex The z-index value of the tooltip message element.
|
|
76
|
-
* @param delay Delay in ms after which Tooltip will appear (defaults to 350ms).
|
|
66
|
+
* This is the [React](https://reactjs.org/) component for Vanilla [Tooltips](https://vanillaframework.io/docs/patterns/tooltips).
|
|
67
|
+
*
|
|
68
|
+
* Tooltips are text labels that appear when the user hovers over, focuses on, or touches an element on the screen.
|
|
69
|
+
*
|
|
70
|
+
* They can be used to provide information about concepts/terms/actions that are not self-explanatory or well known.
|
|
71
|
+
*
|
|
72
|
+
* An alternative use of tooltips is to provide information on a disabled actionable element, e.g. for disabled buttons, providing information about why they are disabled.
|
|
77
73
|
*/
|
|
78
74
|
declare const Tooltip: ({ autoAdjust, children, className, followMouse, message, position, positionElementClassName, tooltipClassName, zIndex, delay, }: Props) => JSX.Element;
|
|
79
75
|
export default Tooltip;
|
|
@@ -105,17 +105,13 @@ const adjustForWindow = (position, fitsWindow) => {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* @param positionElementClassName An optional class to apply to the element that wraps the children.
|
|
116
|
-
* @param tooltipClassName An optional class to apply to the tooltip message element.
|
|
117
|
-
* @param zIndex The z-index value of the tooltip message element.
|
|
118
|
-
* @param delay Delay in ms after which Tooltip will appear (defaults to 350ms).
|
|
108
|
+
* This is the [React](https://reactjs.org/) component for Vanilla [Tooltips](https://vanillaframework.io/docs/patterns/tooltips).
|
|
109
|
+
*
|
|
110
|
+
* Tooltips are text labels that appear when the user hovers over, focuses on, or touches an element on the screen.
|
|
111
|
+
*
|
|
112
|
+
* They can be used to provide information about concepts/terms/actions that are not self-explanatory or well known.
|
|
113
|
+
*
|
|
114
|
+
* An alternative use of tooltips is to provide information on a disabled actionable element, e.g. for disabled buttons, providing information about why they are disabled.
|
|
119
115
|
*/
|
|
120
116
|
exports.adjustForWindow = adjustForWindow;
|
|
121
117
|
const Tooltip = _ref => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Tooltip from "./Tooltip";
|
|
3
|
+
declare const meta: Meta<typeof Tooltip>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const FollowMouse: Story;
|
|
8
|
+
/**
|
|
9
|
+
* The tooltip elements are displayed inside a [Portal](https://reactjs.org/docs/portals.html) so that the tooltip is not constrained by its current position in the DOM.
|
|
10
|
+
* Sometimes however, you need to target the tooltip elements. This can be achieved by passing class names to the tooltip elements. You can also pass classes to the elements that trigger and position the tooltip.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TargetingElements: Story;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.TargetingElements = exports.FollowMouse = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
9
|
+
var _Tooltip = _interopRequireWildcard(require("./Tooltip"));
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
const Template = args => {
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
15
|
+
style: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
padding: "3rem"
|
|
19
|
+
}
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, args, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
21
|
+
className: "u-no-margin--bottom"
|
|
22
|
+
}, "Hover over me!")));
|
|
23
|
+
};
|
|
24
|
+
const meta = {
|
|
25
|
+
component: _Tooltip.default,
|
|
26
|
+
render: Template,
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
argTypes: {
|
|
29
|
+
position: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "radio"
|
|
32
|
+
},
|
|
33
|
+
options: Object.values(_Tooltip.position)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var _default = exports.default = meta;
|
|
38
|
+
const Default = exports.Default = {
|
|
39
|
+
render: Template.bind({}),
|
|
40
|
+
name: "Default",
|
|
41
|
+
args: {
|
|
42
|
+
message: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Tooltip", " ", /*#__PURE__*/_react.default.createElement("a", {
|
|
43
|
+
href: "#todo",
|
|
44
|
+
target: "_blank"
|
|
45
|
+
}, "Link1"))
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const FollowMouse = exports.FollowMouse = {
|
|
49
|
+
render: Template.bind({}),
|
|
50
|
+
name: "Follow mouse",
|
|
51
|
+
args: {
|
|
52
|
+
followMouse: true,
|
|
53
|
+
message: "Tooltip message to display.",
|
|
54
|
+
position: "top-center"
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The tooltip elements are displayed inside a [Portal](https://reactjs.org/docs/portals.html) so that the tooltip is not constrained by its current position in the DOM.
|
|
60
|
+
* Sometimes however, you need to target the tooltip elements. This can be achieved by passing class names to the tooltip elements. You can also pass classes to the elements that trigger and position the tooltip.
|
|
61
|
+
*/
|
|
62
|
+
const TargetingElements = exports.TargetingElements = {
|
|
63
|
+
render: Template.bind({}),
|
|
64
|
+
name: "Targeting elements",
|
|
65
|
+
args: {
|
|
66
|
+
className: "custom-wrapping-class",
|
|
67
|
+
positionElementClassName: "custom-position-class",
|
|
68
|
+
tooltipClassName: "custom-tooltip-class",
|
|
69
|
+
message: "Tooltip message to display."
|
|
70
|
+
}
|
|
71
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"author": {
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"@babel/cli": "7.24.5",
|
|
29
29
|
"@babel/eslint-parser": "7.24.5",
|
|
30
30
|
"@babel/preset-typescript": "7.24.1",
|
|
31
|
-
"@percy/cli": "1.28.
|
|
32
|
-
"@percy/storybook": "
|
|
31
|
+
"@percy/cli": "1.28.8",
|
|
32
|
+
"@percy/storybook": "6.0.0",
|
|
33
33
|
"@semantic-release/changelog": "6.0.3",
|
|
34
34
|
"@semantic-release/git": "10.0.1",
|
|
35
|
-
"@storybook/addon-a11y": "
|
|
36
|
-
"@storybook/addon-essentials": "
|
|
37
|
-
"@storybook/addon-interactions": "
|
|
38
|
-
"@storybook/addon-links": "
|
|
39
|
-
"@storybook/addon-
|
|
40
|
-
"@storybook/addon-
|
|
41
|
-
"@storybook/blocks": "
|
|
42
|
-
"@storybook/react": "
|
|
43
|
-
"@storybook/react-webpack5": "
|
|
35
|
+
"@storybook/addon-a11y": "8.1.11",
|
|
36
|
+
"@storybook/addon-essentials": "8.1.11",
|
|
37
|
+
"@storybook/addon-interactions": "8.1.11",
|
|
38
|
+
"@storybook/addon-links": "8.1.11",
|
|
39
|
+
"@storybook/addon-onboarding": "8.1.11",
|
|
40
|
+
"@storybook/addon-webpack5-compiler-babel": "3.0.3",
|
|
41
|
+
"@storybook/blocks": "8.1.11",
|
|
42
|
+
"@storybook/react": "8.1.11",
|
|
43
|
+
"@storybook/react-webpack5": "8.1.11",
|
|
44
44
|
"@testing-library/cypress": "10.0.1",
|
|
45
45
|
"@testing-library/dom": "10.1.0",
|
|
46
46
|
"@testing-library/jest-dom": "6.4.5",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"sass": "1.77.0",
|
|
80
80
|
"sass-loader": "14.2.1",
|
|
81
81
|
"semantic-release": "23.0.8",
|
|
82
|
-
"storybook": "
|
|
82
|
+
"storybook": "8.1.11",
|
|
83
83
|
"style-loader": "4.0.0",
|
|
84
84
|
"stylelint": "16.5.0",
|
|
85
85
|
"stylelint-config-prettier": "9.0.5",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"@types/react": "18.3.1",
|
|
111
111
|
"@types/react-dom": "18.3.0",
|
|
112
112
|
"postcss": "^8.3.11",
|
|
113
|
-
"jackspeak": "2.
|
|
113
|
+
"jackspeak": "2.1.1"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"@types/react": "^17.0.2 || ^18.0.0",
|