@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
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Sortable = exports.Responsive = exports.Paginated = exports.Overflow = exports.Expanding = exports.Empty = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _MainTable = _interopRequireDefault(require("./MainTable"));
|
|
9
|
+
var _Row = _interopRequireDefault(require("../Row"));
|
|
10
|
+
var _Col = _interopRequireDefault(require("../Col"));
|
|
11
|
+
var _ContextualMenu = _interopRequireDefault(require("../ContextualMenu"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
const meta = {
|
|
16
|
+
component: _MainTable.default,
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
argTypes: {
|
|
19
|
+
headers: {
|
|
20
|
+
control: {
|
|
21
|
+
disable: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
rows: {
|
|
25
|
+
control: {
|
|
26
|
+
disable: true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var _default = exports.default = meta;
|
|
32
|
+
const Default = exports.Default = {
|
|
33
|
+
name: "Default",
|
|
34
|
+
args: {
|
|
35
|
+
headers: [{
|
|
36
|
+
content: null
|
|
37
|
+
}, {
|
|
38
|
+
content: "Foundation Cloud"
|
|
39
|
+
}, {
|
|
40
|
+
content: "Foundation Cloud Plus"
|
|
41
|
+
}],
|
|
42
|
+
rows: [{
|
|
43
|
+
columns: [{
|
|
44
|
+
content: "Expert delivery of an Ubuntu OpenStack cloud",
|
|
45
|
+
role: "rowheader"
|
|
46
|
+
}, {
|
|
47
|
+
content: "Reference architecture"
|
|
48
|
+
}, {
|
|
49
|
+
content: "Custom architecture"
|
|
50
|
+
}]
|
|
51
|
+
}, {
|
|
52
|
+
columns: [{
|
|
53
|
+
content: "Workshop and training",
|
|
54
|
+
role: "rowheader"
|
|
55
|
+
}, {
|
|
56
|
+
content: "2-days"
|
|
57
|
+
}, {
|
|
58
|
+
content: "4-days"
|
|
59
|
+
}]
|
|
60
|
+
}, {
|
|
61
|
+
columns: [{
|
|
62
|
+
content: "One-time price",
|
|
63
|
+
role: "rowheader"
|
|
64
|
+
}, {
|
|
65
|
+
content: "$75,000"
|
|
66
|
+
}, {
|
|
67
|
+
content: "$150,000"
|
|
68
|
+
}]
|
|
69
|
+
}]
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const Sortable = exports.Sortable = {
|
|
73
|
+
render: () => /*#__PURE__*/_react.default.createElement(_MainTable.default, {
|
|
74
|
+
headers: [{
|
|
75
|
+
content: "Status",
|
|
76
|
+
sortKey: "status"
|
|
77
|
+
}, {
|
|
78
|
+
content: "Cores",
|
|
79
|
+
sortKey: "cores",
|
|
80
|
+
className: "u-align--right"
|
|
81
|
+
}, {
|
|
82
|
+
content: "RAM",
|
|
83
|
+
sortKey: "ram",
|
|
84
|
+
className: "u-align--right"
|
|
85
|
+
}, {
|
|
86
|
+
content: "Disks",
|
|
87
|
+
sortKey: "disks",
|
|
88
|
+
className: "u-align--right"
|
|
89
|
+
}, {
|
|
90
|
+
content: "Networks",
|
|
91
|
+
className: "u-align--right"
|
|
92
|
+
}],
|
|
93
|
+
rows: [{
|
|
94
|
+
columns: [{
|
|
95
|
+
content: "Ready",
|
|
96
|
+
role: "rowheader"
|
|
97
|
+
}, {
|
|
98
|
+
content: 1,
|
|
99
|
+
className: "u-align--right"
|
|
100
|
+
}, {
|
|
101
|
+
content: "1 GiB",
|
|
102
|
+
className: "u-align--right"
|
|
103
|
+
}, {
|
|
104
|
+
content: 2,
|
|
105
|
+
className: "u-align--right"
|
|
106
|
+
}, {
|
|
107
|
+
content: 42,
|
|
108
|
+
className: "u-align--right"
|
|
109
|
+
}],
|
|
110
|
+
sortData: {
|
|
111
|
+
status: "ready",
|
|
112
|
+
cores: 2,
|
|
113
|
+
ram: 1,
|
|
114
|
+
disks: 2
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
columns: [{
|
|
118
|
+
content: "Idle",
|
|
119
|
+
role: "rowheader"
|
|
120
|
+
}, {
|
|
121
|
+
content: 1,
|
|
122
|
+
className: "u-align--right"
|
|
123
|
+
}, {
|
|
124
|
+
content: "1 GiB",
|
|
125
|
+
className: "u-align--right"
|
|
126
|
+
}, {
|
|
127
|
+
content: 2,
|
|
128
|
+
className: "u-align--right"
|
|
129
|
+
}, {
|
|
130
|
+
content: 23,
|
|
131
|
+
className: "u-align--right"
|
|
132
|
+
}],
|
|
133
|
+
sortData: {
|
|
134
|
+
status: "idle",
|
|
135
|
+
cores: 1,
|
|
136
|
+
ram: 1,
|
|
137
|
+
disks: 2
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
columns: [{
|
|
141
|
+
content: "Waiting",
|
|
142
|
+
role: "rowheader"
|
|
143
|
+
}, {
|
|
144
|
+
content: 8,
|
|
145
|
+
className: "u-align--right"
|
|
146
|
+
}, {
|
|
147
|
+
content: "3.9 GiB",
|
|
148
|
+
className: "u-align--right"
|
|
149
|
+
}, {
|
|
150
|
+
content: 3,
|
|
151
|
+
className: "u-align--right"
|
|
152
|
+
}, {
|
|
153
|
+
content: 0,
|
|
154
|
+
className: "u-align--right"
|
|
155
|
+
}],
|
|
156
|
+
sortData: {
|
|
157
|
+
status: "waiting",
|
|
158
|
+
cores: 8,
|
|
159
|
+
ram: 3.9,
|
|
160
|
+
disks: 3
|
|
161
|
+
}
|
|
162
|
+
}],
|
|
163
|
+
sortable: true
|
|
164
|
+
}),
|
|
165
|
+
name: "Sortable"
|
|
166
|
+
};
|
|
167
|
+
const Expanding = exports.Expanding = {
|
|
168
|
+
render: () => {
|
|
169
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
170
|
+
let [expandedRow, setExpandedRow] = (0, _react.useState)(1);
|
|
171
|
+
return /*#__PURE__*/_react.default.createElement(_MainTable.default, {
|
|
172
|
+
expanding: true,
|
|
173
|
+
headers: [{
|
|
174
|
+
content: "Name"
|
|
175
|
+
}, {
|
|
176
|
+
content: "Mac address"
|
|
177
|
+
}, {
|
|
178
|
+
content: "IP"
|
|
179
|
+
}, {
|
|
180
|
+
content: "Rack"
|
|
181
|
+
}, {
|
|
182
|
+
content: "Last seen"
|
|
183
|
+
}, {
|
|
184
|
+
content: "Actions",
|
|
185
|
+
className: "u-align--right"
|
|
186
|
+
}],
|
|
187
|
+
rows: [{
|
|
188
|
+
columns: [{
|
|
189
|
+
content: "Unknown",
|
|
190
|
+
role: "rowheader"
|
|
191
|
+
}, {
|
|
192
|
+
content: "2c:44:fd:80:3f:25"
|
|
193
|
+
}, {
|
|
194
|
+
content: "10.249.0.1"
|
|
195
|
+
}, {
|
|
196
|
+
content: "karura"
|
|
197
|
+
}, {
|
|
198
|
+
content: "Thu, 25 Oct. 2018 13:55:21"
|
|
199
|
+
}, {
|
|
200
|
+
content: /*#__PURE__*/_react.default.createElement("button", {
|
|
201
|
+
className: "u-toggle",
|
|
202
|
+
onClick: () => setExpandedRow(1)
|
|
203
|
+
}, "Show"),
|
|
204
|
+
className: "u-align--right"
|
|
205
|
+
}],
|
|
206
|
+
expanded: expandedRow === 1,
|
|
207
|
+
expandedContent: /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
|
|
208
|
+
size: 8
|
|
209
|
+
}, /*#__PURE__*/_react.default.createElement("h4", null, "Expanding table cell"), /*#__PURE__*/_react.default.createElement("p", null, "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur cum dicta beatae nostrum eligendi similique earum, dolorem fuga quis, sequi voluptates architecto ipsa dolorum eaque rem expedita inventore voluptas odit aspernatur alias molestias facere.")))
|
|
210
|
+
}, {
|
|
211
|
+
columns: [{
|
|
212
|
+
content: "Unknown",
|
|
213
|
+
role: "rowheader"
|
|
214
|
+
}, {
|
|
215
|
+
content: "52:54:00:3a:fe:e9"
|
|
216
|
+
}, {
|
|
217
|
+
content: "172.16.99.191"
|
|
218
|
+
}, {
|
|
219
|
+
content: "karura"
|
|
220
|
+
}, {
|
|
221
|
+
content: "Wed, 3 Oct. 2018 23:08:06"
|
|
222
|
+
}, {
|
|
223
|
+
content: /*#__PURE__*/_react.default.createElement("button", {
|
|
224
|
+
className: "u-toggle",
|
|
225
|
+
onClick: () => setExpandedRow(2)
|
|
226
|
+
}, "Show"),
|
|
227
|
+
className: "u-align--right"
|
|
228
|
+
}],
|
|
229
|
+
expanded: expandedRow === 2,
|
|
230
|
+
expandedContent: /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
|
|
231
|
+
size: 8
|
|
232
|
+
}, /*#__PURE__*/_react.default.createElement("h4", null, "Expanding table cell"), /*#__PURE__*/_react.default.createElement("p", null, "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur cum dicta beatae nostrum eligendi similique earum, dolorem fuga quis, sequi voluptates architecto ipsa dolorum eaque rem expedita inventore voluptas odit aspernatur alias molestias facere.")))
|
|
233
|
+
}, {
|
|
234
|
+
columns: [{
|
|
235
|
+
content: "Unknown",
|
|
236
|
+
role: "rowheader"
|
|
237
|
+
}, {
|
|
238
|
+
content: "52:54:00:74:c2:10"
|
|
239
|
+
}, {
|
|
240
|
+
content: "172.16.99.192"
|
|
241
|
+
}, {
|
|
242
|
+
content: "karura"
|
|
243
|
+
}, {
|
|
244
|
+
content: "Wed, 17 Oct. 2018 12:18:18"
|
|
245
|
+
}, {
|
|
246
|
+
content: /*#__PURE__*/_react.default.createElement("button", {
|
|
247
|
+
className: "u-toggle",
|
|
248
|
+
onClick: () => setExpandedRow(3)
|
|
249
|
+
}, "Show"),
|
|
250
|
+
className: "u-align--right"
|
|
251
|
+
}],
|
|
252
|
+
expanded: expandedRow === 3,
|
|
253
|
+
expandedContent: /*#__PURE__*/_react.default.createElement(_Row.default, null, /*#__PURE__*/_react.default.createElement(_Col.default, {
|
|
254
|
+
size: 8
|
|
255
|
+
}, /*#__PURE__*/_react.default.createElement("h4", null, "Expanding table cell"), /*#__PURE__*/_react.default.createElement("p", null, "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur cum dicta beatae nostrum eligendi similique earum, dolorem fuga quis, sequi voluptates architecto ipsa dolorum eaque rem expedita inventore voluptas odit aspernatur alias molestias facere.")))
|
|
256
|
+
}]
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
name: "Expanding"
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* If the table cell may have overflowing content (such as contextual menu) use `hasOverflow` prop to avoid cropping it.
|
|
264
|
+
*/
|
|
265
|
+
const Overflow = exports.Overflow = {
|
|
266
|
+
render: () => {
|
|
267
|
+
return /*#__PURE__*/_react.default.createElement(_MainTable.default, {
|
|
268
|
+
headers: [{
|
|
269
|
+
content: "Name"
|
|
270
|
+
}, {
|
|
271
|
+
content: "Mac address"
|
|
272
|
+
}, {
|
|
273
|
+
content: "IP"
|
|
274
|
+
}, {
|
|
275
|
+
content: "Rack"
|
|
276
|
+
}, {
|
|
277
|
+
content: "Last seen"
|
|
278
|
+
}, {
|
|
279
|
+
content: "Actions",
|
|
280
|
+
className: "u-align--right"
|
|
281
|
+
}],
|
|
282
|
+
rows: [{
|
|
283
|
+
columns: [{
|
|
284
|
+
content: "Unknown",
|
|
285
|
+
role: "rowheader"
|
|
286
|
+
}, {
|
|
287
|
+
content: "2c:44:fd:80:3f:25"
|
|
288
|
+
}, {
|
|
289
|
+
content: "10.249.0.1"
|
|
290
|
+
}, {
|
|
291
|
+
content: "karura"
|
|
292
|
+
}, {
|
|
293
|
+
content: "Thu, 25 Oct. 2018 13:55:21"
|
|
294
|
+
}, {
|
|
295
|
+
content: /*#__PURE__*/_react.default.createElement(_ContextualMenu.default, {
|
|
296
|
+
links: [{
|
|
297
|
+
children: "Link 1",
|
|
298
|
+
onClick: () => {}
|
|
299
|
+
}, {
|
|
300
|
+
children: "Link 2",
|
|
301
|
+
onClick: () => {}
|
|
302
|
+
}],
|
|
303
|
+
hasToggleIcon: true,
|
|
304
|
+
position: "right"
|
|
305
|
+
}),
|
|
306
|
+
className: "u-align--right",
|
|
307
|
+
hasOverflow: true
|
|
308
|
+
}]
|
|
309
|
+
}, {
|
|
310
|
+
columns: [{
|
|
311
|
+
content: "Unknown",
|
|
312
|
+
role: "rowheader"
|
|
313
|
+
}, {
|
|
314
|
+
content: "52:54:00:3a:fe:e9"
|
|
315
|
+
}, {
|
|
316
|
+
content: "172.16.99.191"
|
|
317
|
+
}, {
|
|
318
|
+
content: "karura"
|
|
319
|
+
}, {
|
|
320
|
+
content: "Wed, 3 Oct. 2018 23:08:06"
|
|
321
|
+
}, {
|
|
322
|
+
content: /*#__PURE__*/_react.default.createElement(_ContextualMenu.default, {
|
|
323
|
+
links: [{
|
|
324
|
+
children: "Link 1",
|
|
325
|
+
onClick: () => {}
|
|
326
|
+
}, {
|
|
327
|
+
children: "Link 2",
|
|
328
|
+
onClick: () => {}
|
|
329
|
+
}],
|
|
330
|
+
hasToggleIcon: true,
|
|
331
|
+
position: "right"
|
|
332
|
+
}),
|
|
333
|
+
className: "u-align--right",
|
|
334
|
+
hasOverflow: true
|
|
335
|
+
}]
|
|
336
|
+
}, {
|
|
337
|
+
columns: [{
|
|
338
|
+
content: "Unknown",
|
|
339
|
+
role: "rowheader"
|
|
340
|
+
}, {
|
|
341
|
+
content: "52:54:00:74:c2:10"
|
|
342
|
+
}, {
|
|
343
|
+
content: "172.16.99.192"
|
|
344
|
+
}, {
|
|
345
|
+
content: "karura"
|
|
346
|
+
}, {
|
|
347
|
+
content: "Wed, 17 Oct. 2018 12:18:18"
|
|
348
|
+
}, {
|
|
349
|
+
content: /*#__PURE__*/_react.default.createElement(_ContextualMenu.default, {
|
|
350
|
+
links: [{
|
|
351
|
+
children: "Link 1",
|
|
352
|
+
onClick: () => {}
|
|
353
|
+
}, {
|
|
354
|
+
children: "Link 2",
|
|
355
|
+
onClick: () => {}
|
|
356
|
+
}],
|
|
357
|
+
hasToggleIcon: true,
|
|
358
|
+
position: "right"
|
|
359
|
+
}),
|
|
360
|
+
className: "u-align--right",
|
|
361
|
+
hasOverflow: true
|
|
362
|
+
}]
|
|
363
|
+
}]
|
|
364
|
+
});
|
|
365
|
+
},
|
|
366
|
+
name: "Overflow"
|
|
367
|
+
};
|
|
368
|
+
const Responsive = exports.Responsive = {
|
|
369
|
+
render: () => /*#__PURE__*/_react.default.createElement(_MainTable.default, {
|
|
370
|
+
headers: [{
|
|
371
|
+
content: /*#__PURE__*/_react.default.createElement("span", null, "Name", /*#__PURE__*/_react.default.createElement("i", {
|
|
372
|
+
className: "p-icon--information"
|
|
373
|
+
})),
|
|
374
|
+
heading: "Name"
|
|
375
|
+
}, {
|
|
376
|
+
content: "Users",
|
|
377
|
+
className: "u-align--right"
|
|
378
|
+
}, {
|
|
379
|
+
content: "Units",
|
|
380
|
+
className: "u-align--right"
|
|
381
|
+
}],
|
|
382
|
+
rows: [{
|
|
383
|
+
columns: [{
|
|
384
|
+
content: "Ready",
|
|
385
|
+
role: "rowheader"
|
|
386
|
+
}, {
|
|
387
|
+
content: 1,
|
|
388
|
+
className: "u-align--right"
|
|
389
|
+
}, {
|
|
390
|
+
content: "1 GiB",
|
|
391
|
+
className: "u-align--right"
|
|
392
|
+
}]
|
|
393
|
+
}, {
|
|
394
|
+
columns: [{
|
|
395
|
+
content: "Ready",
|
|
396
|
+
role: "rowheader"
|
|
397
|
+
}, {
|
|
398
|
+
content: 1,
|
|
399
|
+
className: "u-align--right"
|
|
400
|
+
}, {
|
|
401
|
+
content: "1 GiB",
|
|
402
|
+
className: "u-align--right"
|
|
403
|
+
}]
|
|
404
|
+
}, {
|
|
405
|
+
columns: [{
|
|
406
|
+
content: "Ready",
|
|
407
|
+
role: "rowheader"
|
|
408
|
+
}, {
|
|
409
|
+
content: 1,
|
|
410
|
+
className: "u-align--right"
|
|
411
|
+
}, {
|
|
412
|
+
content: "1 GiB",
|
|
413
|
+
className: "u-align--right"
|
|
414
|
+
}]
|
|
415
|
+
}],
|
|
416
|
+
responsive: true
|
|
417
|
+
}),
|
|
418
|
+
name: "Responsive"
|
|
419
|
+
};
|
|
420
|
+
const Paginated = exports.Paginated = {
|
|
421
|
+
render: () => /*#__PURE__*/_react.default.createElement(_MainTable.default, {
|
|
422
|
+
headers: [{
|
|
423
|
+
content: "Status"
|
|
424
|
+
}, {
|
|
425
|
+
content: "Cores"
|
|
426
|
+
}],
|
|
427
|
+
paginate: 5,
|
|
428
|
+
rows: [{
|
|
429
|
+
columns: [{
|
|
430
|
+
content: "Ready"
|
|
431
|
+
}, {
|
|
432
|
+
content: 1
|
|
433
|
+
}]
|
|
434
|
+
}, {
|
|
435
|
+
columns: [{
|
|
436
|
+
content: "Idle"
|
|
437
|
+
}, {
|
|
438
|
+
content: 4
|
|
439
|
+
}]
|
|
440
|
+
}, {
|
|
441
|
+
columns: [{
|
|
442
|
+
content: "Waiting"
|
|
443
|
+
}, {
|
|
444
|
+
content: 2
|
|
445
|
+
}]
|
|
446
|
+
}, {
|
|
447
|
+
columns: [{
|
|
448
|
+
content: "Ready"
|
|
449
|
+
}, {
|
|
450
|
+
content: 1
|
|
451
|
+
}]
|
|
452
|
+
}, {
|
|
453
|
+
columns: [{
|
|
454
|
+
content: "Idle"
|
|
455
|
+
}, {
|
|
456
|
+
content: 4
|
|
457
|
+
}]
|
|
458
|
+
}, {
|
|
459
|
+
columns: [{
|
|
460
|
+
content: "Waiting"
|
|
461
|
+
}, {
|
|
462
|
+
content: 2
|
|
463
|
+
}]
|
|
464
|
+
}, {
|
|
465
|
+
columns: [{
|
|
466
|
+
content: "Ready"
|
|
467
|
+
}, {
|
|
468
|
+
content: 1
|
|
469
|
+
}]
|
|
470
|
+
}, {
|
|
471
|
+
columns: [{
|
|
472
|
+
content: "Idle"
|
|
473
|
+
}, {
|
|
474
|
+
content: 4
|
|
475
|
+
}]
|
|
476
|
+
}, {
|
|
477
|
+
columns: [{
|
|
478
|
+
content: "Waiting"
|
|
479
|
+
}, {
|
|
480
|
+
content: 2
|
|
481
|
+
}]
|
|
482
|
+
}, {
|
|
483
|
+
columns: [{
|
|
484
|
+
content: "Ready"
|
|
485
|
+
}, {
|
|
486
|
+
content: 1
|
|
487
|
+
}]
|
|
488
|
+
}, {
|
|
489
|
+
columns: [{
|
|
490
|
+
content: "Idle"
|
|
491
|
+
}, {
|
|
492
|
+
content: 4
|
|
493
|
+
}]
|
|
494
|
+
}, {
|
|
495
|
+
columns: [{
|
|
496
|
+
content: "Waiting"
|
|
497
|
+
}, {
|
|
498
|
+
content: 2
|
|
499
|
+
}]
|
|
500
|
+
}, {
|
|
501
|
+
columns: [{
|
|
502
|
+
content: "Ready"
|
|
503
|
+
}, {
|
|
504
|
+
content: 1
|
|
505
|
+
}]
|
|
506
|
+
}, {
|
|
507
|
+
columns: [{
|
|
508
|
+
content: "Idle"
|
|
509
|
+
}, {
|
|
510
|
+
content: 4
|
|
511
|
+
}]
|
|
512
|
+
}, {
|
|
513
|
+
columns: [{
|
|
514
|
+
content: "Waiting"
|
|
515
|
+
}, {
|
|
516
|
+
content: 2
|
|
517
|
+
}]
|
|
518
|
+
}, {
|
|
519
|
+
columns: [{
|
|
520
|
+
content: "Ready"
|
|
521
|
+
}, {
|
|
522
|
+
content: 1
|
|
523
|
+
}]
|
|
524
|
+
}, {
|
|
525
|
+
columns: [{
|
|
526
|
+
content: "Idle"
|
|
527
|
+
}, {
|
|
528
|
+
content: 4
|
|
529
|
+
}]
|
|
530
|
+
}, {
|
|
531
|
+
columns: [{
|
|
532
|
+
content: "Waiting"
|
|
533
|
+
}, {
|
|
534
|
+
content: 2
|
|
535
|
+
}]
|
|
536
|
+
}]
|
|
537
|
+
}),
|
|
538
|
+
name: "Paginated"
|
|
539
|
+
};
|
|
540
|
+
const Empty = exports.Empty = {
|
|
541
|
+
render: () => /*#__PURE__*/_react.default.createElement(_MainTable.default, {
|
|
542
|
+
headers: [{
|
|
543
|
+
content: "Plan"
|
|
544
|
+
}, {
|
|
545
|
+
content: "Foundation Cloud"
|
|
546
|
+
}, {
|
|
547
|
+
content: "Foundation Cloud Plus"
|
|
548
|
+
}],
|
|
549
|
+
rows: [],
|
|
550
|
+
emptyStateMsg: "No data to display"
|
|
551
|
+
}),
|
|
552
|
+
name: "Empty"
|
|
553
|
+
};
|
|
@@ -27,5 +27,10 @@ export type Props = PropsWithSpread<{
|
|
|
27
27
|
*/
|
|
28
28
|
shouldPropagateClickEvent?: boolean;
|
|
29
29
|
}, HTMLProps<HTMLDivElement>>;
|
|
30
|
+
/**
|
|
31
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Modal](https://docs.vanillaframework.io/patterns/modal/).
|
|
32
|
+
*
|
|
33
|
+
* The modal component can be used to overlay an area of the screen which can contain a prompt, dialog or interaction.
|
|
34
|
+
*/
|
|
30
35
|
export declare const Modal: ({ buttonRow, children, className, close, title, shouldPropagateClickEvent, ...wrapperProps }: Props) => ReactElement;
|
|
31
36
|
export default Modal;
|
|
@@ -10,6 +10,11 @@ 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 [Modal](https://docs.vanillaframework.io/patterns/modal/).
|
|
15
|
+
*
|
|
16
|
+
* The modal component can be used to overlay an area of the screen which can contain a prompt, dialog or interaction.
|
|
17
|
+
*/
|
|
13
18
|
const Modal = _ref => {
|
|
14
19
|
let {
|
|
15
20
|
buttonRow,
|
|
@@ -0,0 +1,57 @@
|
|
|
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 _Modal = _interopRequireDefault(require("./Modal"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
+
const Template = args => {
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
14
|
+
style: {
|
|
15
|
+
height: "100vh",
|
|
16
|
+
position: "relative"
|
|
17
|
+
}
|
|
18
|
+
}, /*#__PURE__*/_react.default.createElement(_Modal.default, args));
|
|
19
|
+
};
|
|
20
|
+
const meta = {
|
|
21
|
+
component: _Modal.default,
|
|
22
|
+
render: Template,
|
|
23
|
+
tags: ["autodocs"],
|
|
24
|
+
argTypes: {
|
|
25
|
+
buttonRow: {
|
|
26
|
+
control: {
|
|
27
|
+
disable: true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
children: {
|
|
31
|
+
control: {
|
|
32
|
+
disable: true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var _default = exports.default = meta;
|
|
38
|
+
const Default = exports.Default = {
|
|
39
|
+
render: () => {
|
|
40
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
|
+
const [modalOpen, setModalOpen] = (0, _react.useState)(true);
|
|
42
|
+
const closeHandler = () => setModalOpen(false);
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
44
|
+
onClick: () => setModalOpen(true)
|
|
45
|
+
}, "Open modal"), modalOpen ? /*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
46
|
+
close: closeHandler,
|
|
47
|
+
title: "Confirm delete",
|
|
48
|
+
buttonRow: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
49
|
+
className: "u-no-margin--bottom",
|
|
50
|
+
onClick: closeHandler
|
|
51
|
+
}, "Cancel"), /*#__PURE__*/_react.default.createElement("button", {
|
|
52
|
+
className: "p-button--negative u-no-margin--bottom"
|
|
53
|
+
}, "Delete"))
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "This will permanently delete the user \"Simon\".", /*#__PURE__*/_react.default.createElement("br", null), "You cannot undo this action.")) : null);
|
|
55
|
+
},
|
|
56
|
+
name: "Default"
|
|
57
|
+
};
|
|
@@ -49,5 +49,57 @@ export type Props<D extends Record<string, unknown>> = PropsWithSpread<{
|
|
|
49
49
|
*/
|
|
50
50
|
autoResetSortBy?: boolean;
|
|
51
51
|
}, HTMLProps<HTMLTableElement>>;
|
|
52
|
+
/**
|
|
53
|
+
This is a [React](https://reactjs.org/) component to support many table use cases.
|
|
54
|
+
|
|
55
|
+
ModularTable components accepts `columns` and `data` arguments in the same format as [`useTable`](https://react-table.tanstack.com/docs/api/useTable) hook of the ReactTable library.
|
|
56
|
+
|
|
57
|
+
`columns` - The core columns configuration object for the entire table. https://react-table.tanstack.com/docs/api/useTable#column-options
|
|
58
|
+
`data` - The data array that you want to display on the table.
|
|
59
|
+
### Important note!
|
|
60
|
+
Values passed to both of these params have to me memoized (for example via{" "}
|
|
61
|
+
<code>React.useMemo</code>). Memoization ensures that our data isn't recreated
|
|
62
|
+
on every render. If we didn't use <code>React.useMemo</code>, the table would
|
|
63
|
+
think it was receiving new data on every render and attempt to recalulate a
|
|
64
|
+
lot of logic every single time.
|
|
65
|
+
|
|
66
|
+
#### Custom column options
|
|
67
|
+
|
|
68
|
+
In addition to standard column propeties from [`useTable`](https://react-table.tanstack.com/docs/api/useTable) `ModularTable` accepts some custom properties.
|
|
69
|
+
|
|
70
|
+
##### Class names
|
|
71
|
+
|
|
72
|
+
Custom `className` can be used to provide a specific CSS class name that will be added to all cells in given column.
|
|
73
|
+
You can also provide `getHeaderProps`, `getRowProps` and `getCellProps` to resolve additional custom props for a specific element. More on this in [`useTable - cell properties`](https://react-table.tanstack.com/docs/api/useTable#cell-properties).
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
getCellProps={({ value, column }) => ({
|
|
77
|
+
className: `table__cell--${column.id} ${value === "1 minute" ? "p-heading--5" : ""}`,
|
|
78
|
+
})}
|
|
79
|
+
columns = {
|
|
80
|
+
Header: "Hidden on mobile",
|
|
81
|
+
accessor: "example",
|
|
82
|
+
className: "u-hide--small"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
##### Icons
|
|
87
|
+
|
|
88
|
+
To show an icon in the cells of a column `getCellIcon` function should be defined. The function takes a cell data as an argument and should return one of built in icons (from the `ICONS` const), a string with a custom icon name, or `false` if no icon should be shown.
|
|
89
|
+
|
|
90
|
+
The `ICONS` const contains all [the Vanilla built in icons](https://vanillaframework.io/docs/patterns/icons) such as "plus", "minus", "success", "error", etc.
|
|
91
|
+
|
|
92
|
+
Product specific icons can be used as well, assuming that the product provides the necessary CSS styling and the icon follows the Vanilla naming convention `p-icon--{name}`.
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
columns = {
|
|
96
|
+
Header: "With icons",
|
|
97
|
+
accessor: "status",
|
|
98
|
+
getCellIcon: ({ value }) => {
|
|
99
|
+
return value === "released" ? ICONS.success : false;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
*/
|
|
52
104
|
declare function ModularTable<D extends Record<string, unknown>>({ data, columns, emptyMsg, footer, sortable, getHeaderProps, getRowProps, getCellProps, getRowId, initialSortColumn, initialSortDirection, autoResetSortBy, ...props }: Props<D>): JSX.Element;
|
|
53
105
|
export default ModularTable;
|