@canonical/react-components 3.8.3 → 3.9.1
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/README.md +2 -3
- package/dist/components/Accordion/Accordion.js +15 -11
- package/dist/components/ActionButton/ActionButton.js +13 -10
- package/dist/components/ApplicationLayout/AppAside/AppAside.js +12 -9
- package/dist/components/ApplicationLayout/AppMain/AppMain.js +7 -4
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.js +9 -6
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.js +7 -4
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.js +7 -4
- package/dist/components/ApplicationLayout/Application/Application.js +7 -4
- package/dist/components/ApplicationLayout/ApplicationLayout.js +22 -19
- package/dist/components/ArticlePagination/ArticlePagination.js +10 -7
- package/dist/components/Badge/Badge.js +9 -6
- package/dist/components/Button/Button.js +15 -12
- package/dist/components/Card/Card.js +11 -8
- package/dist/components/Card/Card.stories.d.ts +5 -0
- package/dist/components/Card/Card.stories.js +13 -4
- package/dist/components/CheckboxInput/CheckableInput/CheckableInput.js +10 -7
- package/dist/components/CheckboxInput/CheckboxInput.js +7 -4
- package/dist/components/Chip/Chip.js +18 -15
- package/dist/components/Code/Code.js +10 -7
- package/dist/components/CodeSnippet/CodeSnippet.js +7 -4
- package/dist/components/CodeSnippet/CodeSnippetDropdown.js +12 -8
- package/dist/components/Col/Col.js +15 -12
- package/dist/components/ColumnSelector/columnSelectorHelper.js +7 -3
- package/dist/components/ConfirmationButton/ConfirmationButton.js +10 -7
- package/dist/components/ConfirmationModal/ConfirmationModal.js +15 -12
- package/dist/components/ContextualMenu/ContextualMenu.js +27 -24
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +47 -44
- package/dist/components/CustomSelect/CustomSelect.js +25 -22
- package/dist/components/CustomSelect/CustomSelect.stories.js +8 -5
- package/dist/components/EmptyState/EmptyState.js +9 -6
- package/dist/components/Field/Field.js +22 -19
- package/dist/components/Form/Form.js +9 -6
- package/dist/components/FormikField/FormikField.js +10 -7
- package/dist/components/Icon/Icon.js +8 -5
- package/dist/components/Input/Input.js +28 -21
- package/dist/components/Label/Label.js +9 -6
- package/dist/components/Link/Link.js +11 -8
- package/dist/components/List/List.js +28 -19
- package/dist/components/MainTable/MainTable.js +34 -28
- package/dist/components/Modal/Modal.js +13 -10
- package/dist/components/ModularTable/ModularTable.d.ts +5 -1
- package/dist/components/ModularTable/ModularTable.js +26 -21
- package/dist/components/ModularTable/ModularTable.stories.d.ts +1 -0
- package/dist/components/ModularTable/ModularTable.stories.js +96 -1
- package/dist/components/MultiSelect/MultiSelect.js +17 -14
- package/dist/components/MultiSelect/MultiSelect.stories.js +14 -14
- package/dist/components/Navigation/Navigation.js +31 -23
- package/dist/components/Navigation/NavigationLink/NavigationLink.js +26 -17
- package/dist/components/Navigation/NavigationMenu/NavigationMenu.js +16 -9
- package/dist/components/Notifications/Notification/Notification.js +19 -16
- package/dist/components/Notifications/ToastNotification/ToastNotificationProvider.js +15 -15
- package/dist/components/Pagination/Pagination.js +20 -17
- package/dist/components/Panel/Panel.js +29 -25
- package/dist/components/PasswordToggle/PasswordToggle.js +16 -13
- package/dist/components/RadioInput/RadioInput.js +6 -3
- package/dist/components/Row/Row.js +7 -4
- package/dist/components/ScrollableTable/ScrollableTable.stories.js +7 -3
- package/dist/components/SearchAndFilter/SearchAndFilter.js +10 -7
- package/dist/components/SearchBox/SearchBox.js +18 -15
- package/dist/components/Select/Select.js +25 -21
- package/dist/components/SideNavigation/SideNavigation.js +19 -13
- package/dist/components/SideNavigation/SideNavigationBase/SideNavigationBase.js +11 -8
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.js +12 -6
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.js +7 -4
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.js +7 -4
- package/dist/components/Slider/Slider.js +17 -14
- package/dist/components/Spinner/Spinner.js +11 -8
- package/dist/components/StatusLabel/StatusLabel.js +8 -5
- package/dist/components/Stepper/Step/Step.js +15 -12
- package/dist/components/Strip/Strip.js +18 -15
- package/dist/components/Strip/Strip.stories.js +6 -1
- package/dist/components/Switch/Switch.js +9 -6
- package/dist/components/Table/Table.js +9 -6
- package/dist/components/TableCell/TableCell.js +11 -8
- package/dist/components/TableHeader/TableHeader.js +7 -4
- package/dist/components/TablePagination/TablePagination.js +14 -11
- package/dist/components/TablePagination/TablePaginationControls/TablePaginationControls.js +22 -19
- package/dist/components/TableRow/TableRow.js +6 -3
- package/dist/components/Tabs/Tabs.js +10 -7
- package/dist/components/Textarea/Textarea.js +29 -22
- package/dist/esm/components/Card/Card.stories.d.ts +5 -0
- package/dist/esm/components/Card/Card.stories.js +6 -1
- package/dist/esm/components/ModularTable/ModularTable.d.ts +5 -1
- package/dist/esm/components/ModularTable/ModularTable.js +4 -3
- package/dist/esm/components/ModularTable/ModularTable.stories.d.ts +1 -0
- package/dist/esm/components/ModularTable/ModularTable.stories.js +111 -0
- package/dist/esm/components/Strip/Strip.stories.js +6 -1
- package/dist/external/useSSR.js +6 -4
- package/package.json +50 -47
|
@@ -7,10 +7,18 @@ exports.default = void 0;
|
|
|
7
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _Field = _interopRequireDefault(require("../Field"));
|
|
10
|
+
const _excluded = ["caution", "className", "error", "grow", "help", "id", "label", "labelClassName", "onKeyUp", "onControlEnter", "required", "stacked", "style", "success", "takeFocus", "wrapperClassName"];
|
|
10
11
|
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
12
|
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
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
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); }
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
22
|
/**
|
|
15
23
|
* The props for the Textarea component.
|
|
16
24
|
*/
|
|
@@ -23,24 +31,24 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
23
31
|
const Textarea = _ref => {
|
|
24
32
|
var _props$value;
|
|
25
33
|
let {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
caution,
|
|
35
|
+
className,
|
|
36
|
+
error,
|
|
37
|
+
grow = false,
|
|
38
|
+
help,
|
|
39
|
+
id,
|
|
40
|
+
label,
|
|
41
|
+
labelClassName,
|
|
42
|
+
onKeyUp,
|
|
43
|
+
onControlEnter,
|
|
44
|
+
required,
|
|
45
|
+
stacked,
|
|
46
|
+
style,
|
|
47
|
+
success,
|
|
48
|
+
takeFocus = false,
|
|
49
|
+
wrapperClassName
|
|
50
|
+
} = _ref,
|
|
51
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
44
52
|
const textareaRef = (0, _react.useRef)(null);
|
|
45
53
|
const validationId = (0, _react.useId)();
|
|
46
54
|
const helpId = (0, _react.useId)();
|
|
@@ -102,13 +110,12 @@ const Textarea = _ref => {
|
|
|
102
110
|
}
|
|
103
111
|
},
|
|
104
112
|
ref: textareaRef,
|
|
105
|
-
style: grow && {
|
|
113
|
+
style: grow && _objectSpread({
|
|
106
114
|
minHeight: "5rem",
|
|
107
115
|
resize: "none",
|
|
108
116
|
overflow: "hidden",
|
|
109
|
-
boxSizing: "border-box"
|
|
110
|
-
|
|
111
|
-
} || style,
|
|
117
|
+
boxSizing: "border-box"
|
|
118
|
+
}, style) || style,
|
|
112
119
|
required: required
|
|
113
120
|
}, props, {
|
|
114
121
|
value: (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : innerValue
|
|
@@ -44,5 +44,10 @@ export var Overlay = {
|
|
|
44
44
|
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
|
|
45
45
|
size: 6,
|
|
46
46
|
emptyLarge: 7
|
|
47
|
-
}, /*#__PURE__*/React.createElement(Card, args))))
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Card, args)))),
|
|
48
|
+
parameters: {
|
|
49
|
+
percy: {
|
|
50
|
+
waitForTimeout: 1000 // Wait for 1 second before taking a snapshot to allow the image to load
|
|
51
|
+
}
|
|
52
|
+
}
|
|
48
53
|
};
|
|
@@ -48,6 +48,10 @@ export type Props<D extends Record<string, unknown>> = PropsWithSpread<{
|
|
|
48
48
|
* Whether the sort by needs to be reset after each data change.
|
|
49
49
|
*/
|
|
50
50
|
autoResetSortBy?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* This will render between the header and the content.
|
|
53
|
+
*/
|
|
54
|
+
subhead?: ReactNode;
|
|
51
55
|
}, HTMLProps<HTMLTableElement>>;
|
|
52
56
|
/**
|
|
53
57
|
This is a [React](https://reactjs.org/) component to support many table use cases.
|
|
@@ -101,5 +105,5 @@ columns = {
|
|
|
101
105
|
};
|
|
102
106
|
```
|
|
103
107
|
*/
|
|
104
|
-
declare function ModularTable<D extends Record<string, unknown>>({ data, columns, emptyMsg, footer, sortable, getHeaderProps, getRowProps, getCellProps, getRowId, initialSortColumn, initialSortDirection, autoResetSortBy, ...props }: Props<D>): React.JSX.Element;
|
|
108
|
+
declare function ModularTable<D extends Record<string, unknown>>({ data, columns, emptyMsg, footer, sortable, getHeaderProps, getRowProps, getCellProps, getRowId, initialSortColumn, initialSortDirection, autoResetSortBy, subhead, ...props }: Props<D>): React.JSX.Element;
|
|
105
109
|
export default ModularTable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["data", "columns", "emptyMsg", "footer", "sortable", "getHeaderProps", "getRowProps", "getCellProps", "getRowId", "initialSortColumn", "initialSortDirection", "autoResetSortBy"];
|
|
1
|
+
var _excluded = ["data", "columns", "emptyMsg", "footer", "sortable", "getHeaderProps", "getRowProps", "getCellProps", "getRowId", "initialSortColumn", "initialSortDirection", "autoResetSortBy", "subhead"];
|
|
2
2
|
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); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -107,7 +107,8 @@ function ModularTable(_ref) {
|
|
|
107
107
|
getRowId,
|
|
108
108
|
initialSortColumn,
|
|
109
109
|
initialSortDirection,
|
|
110
|
-
autoResetSortBy = false
|
|
110
|
+
autoResetSortBy = false,
|
|
111
|
+
subhead
|
|
111
112
|
} = _ref,
|
|
112
113
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
113
114
|
var sortBy = useMemo(() => initialSortColumn ? [{
|
|
@@ -157,7 +158,7 @@ function ModularTable(_ref) {
|
|
|
157
158
|
// Only call this if we want it to be sortable too.
|
|
158
159
|
sortable && isColumnSortable(column) ? column.getSortByToggleProps({
|
|
159
160
|
title: undefined
|
|
160
|
-
}) : {}])), column.render("Header")))))), /*#__PURE__*/React.createElement("tbody", getTableBodyProps(), generateRows(rows, prepareRow, getRowProps, getCellProps), showEmpty && /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
|
|
161
|
+
}) : {}])), column.render("Header"))))), subhead), /*#__PURE__*/React.createElement("tbody", getTableBodyProps(), generateRows(rows, prepareRow, getRowProps, getCellProps), showEmpty && /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
|
|
161
162
|
colSpan: columns.length
|
|
162
163
|
}, emptyMsg)), footer && /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
|
|
163
164
|
colSpan: columns.length
|
|
@@ -12,6 +12,7 @@ at the start of the group. In the following example sorting the columns will
|
|
|
12
12
|
sort the group rows, then sort the sub-rows, but the group header always comes first.
|
|
13
13
|
*/
|
|
14
14
|
export declare const Subrows: Story;
|
|
15
|
+
export declare const Subheading: Story;
|
|
15
16
|
/**
|
|
16
17
|
Example below shows a basic `ModularTable` with `SummaryButton` component in the footer.
|
|
17
18
|
```
|
|
@@ -338,6 +338,117 @@ export var Subrows = {
|
|
|
338
338
|
}),
|
|
339
339
|
name: "Subrows"
|
|
340
340
|
};
|
|
341
|
+
export var Subheading = {
|
|
342
|
+
render: () => /*#__PURE__*/React.createElement(ModularTable, {
|
|
343
|
+
getCellProps: _ref9 => {
|
|
344
|
+
var {
|
|
345
|
+
value
|
|
346
|
+
} = _ref9;
|
|
347
|
+
return {
|
|
348
|
+
className: value === "1 minute" ? "p-heading--5" : ""
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
352
|
+
,
|
|
353
|
+
columns: React.useMemo(() => [{
|
|
354
|
+
Header: "ID",
|
|
355
|
+
accessor: "buildId",
|
|
356
|
+
Cell: function (_Cell7) {
|
|
357
|
+
function Cell(_x7) {
|
|
358
|
+
return _Cell7.apply(this, arguments);
|
|
359
|
+
}
|
|
360
|
+
Cell.toString = function () {
|
|
361
|
+
return _Cell7.toString();
|
|
362
|
+
};
|
|
363
|
+
return Cell;
|
|
364
|
+
}(_ref10 => {
|
|
365
|
+
var {
|
|
366
|
+
value
|
|
367
|
+
} = _ref10;
|
|
368
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
369
|
+
href: "#test"
|
|
370
|
+
}, "#", value);
|
|
371
|
+
})
|
|
372
|
+
}, {
|
|
373
|
+
Header: "Architecture",
|
|
374
|
+
accessor: "arch"
|
|
375
|
+
}, {
|
|
376
|
+
Header: "Build Duration",
|
|
377
|
+
accessor: "duration",
|
|
378
|
+
className: "u-hide--small"
|
|
379
|
+
}, {
|
|
380
|
+
Header: "Result",
|
|
381
|
+
accessor: "result",
|
|
382
|
+
Cell: function (_Cell8) {
|
|
383
|
+
function Cell(_x8) {
|
|
384
|
+
return _Cell8.apply(this, arguments);
|
|
385
|
+
}
|
|
386
|
+
Cell.toString = function () {
|
|
387
|
+
return _Cell8.toString();
|
|
388
|
+
};
|
|
389
|
+
return Cell;
|
|
390
|
+
}(_ref11 => {
|
|
391
|
+
var {
|
|
392
|
+
value
|
|
393
|
+
} = _ref11;
|
|
394
|
+
switch (value) {
|
|
395
|
+
case "released":
|
|
396
|
+
return "Released";
|
|
397
|
+
case "failed":
|
|
398
|
+
return "Failed";
|
|
399
|
+
default:
|
|
400
|
+
return "Unknown";
|
|
401
|
+
}
|
|
402
|
+
}),
|
|
403
|
+
getCellIcon: _ref12 => {
|
|
404
|
+
var {
|
|
405
|
+
value
|
|
406
|
+
} = _ref12;
|
|
407
|
+
switch (value) {
|
|
408
|
+
case "released":
|
|
409
|
+
return ICONS.success;
|
|
410
|
+
case "failed":
|
|
411
|
+
return ICONS.error;
|
|
412
|
+
default:
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}, {
|
|
417
|
+
Header: "Build Finished",
|
|
418
|
+
accessor: "finished",
|
|
419
|
+
className: "u-align-text--right"
|
|
420
|
+
}], [])
|
|
421
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
422
|
+
,
|
|
423
|
+
data: React.useMemo(() => [{
|
|
424
|
+
buildId: "5432",
|
|
425
|
+
arch: "arm64",
|
|
426
|
+
duration: "5 minutes",
|
|
427
|
+
result: "released",
|
|
428
|
+
finished: "10 minutes ago"
|
|
429
|
+
}, {
|
|
430
|
+
buildId: "1234",
|
|
431
|
+
arch: "armhf",
|
|
432
|
+
duration: "5 minutes",
|
|
433
|
+
result: "failed",
|
|
434
|
+
finished: "over 1 year ago"
|
|
435
|
+
}, {
|
|
436
|
+
buildId: "1111",
|
|
437
|
+
arch: "test64",
|
|
438
|
+
duration: "1 minute",
|
|
439
|
+
result: "other",
|
|
440
|
+
finished: "ages ago"
|
|
441
|
+
}], []),
|
|
442
|
+
subhead: /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
443
|
+
colSpan: 5,
|
|
444
|
+
className: "p-text--default",
|
|
445
|
+
style: {
|
|
446
|
+
textTransform: "none"
|
|
447
|
+
}
|
|
448
|
+
}, "Showing 3 of 3 results"))
|
|
449
|
+
}),
|
|
450
|
+
name: "Subheading"
|
|
451
|
+
};
|
|
341
452
|
|
|
342
453
|
/**
|
|
343
454
|
Example below shows a basic `ModularTable` with `SummaryButton` component in the footer.
|
|
@@ -75,7 +75,12 @@ export var ImageStrip = {
|
|
|
75
75
|
src: "https://assets.ubuntu.com/v1/9c74eb2d-logo-canonical-white.svg",
|
|
76
76
|
alt: "Placeholder"
|
|
77
77
|
}))))),
|
|
78
|
-
name: "Image strip"
|
|
78
|
+
name: "Image strip",
|
|
79
|
+
parameters: {
|
|
80
|
+
percy: {
|
|
81
|
+
waitForTimeout: 1000 // Wait for 1 second before taking a snapshot to allow the image to load
|
|
82
|
+
}
|
|
83
|
+
}
|
|
79
84
|
};
|
|
80
85
|
export var BorderedStrip = {
|
|
81
86
|
render: () => /*#__PURE__*/React.createElement(Strip, {
|
package/dist/external/useSSR.js
CHANGED
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.weAreServer = exports.useSSR = exports.Device = void 0;
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
12
|
/**
|
|
8
13
|
* This is a reference implementation of the useSSR hook from use-ssr: https://github.com/iamthesiz/use-ssr/blob/master/useSSR.ts
|
|
9
14
|
* The license for the content in this file is goverened by the original project's license: https://github.com/iamthesiz/use-ssr/blob/master/license.md
|
|
@@ -31,10 +36,7 @@ const assign = function () {
|
|
|
31
36
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
37
|
args[_key] = arguments[_key];
|
|
33
38
|
}
|
|
34
|
-
return args.reduce((acc, obj) => ({
|
|
35
|
-
...acc,
|
|
36
|
-
...obj
|
|
37
|
-
}), {});
|
|
39
|
+
return args.reduce((acc, obj) => _objectSpread(_objectSpread({}, acc), obj), {});
|
|
38
40
|
};
|
|
39
41
|
const values = obj => Object.keys(obj).map(key => obj[key]);
|
|
40
42
|
const toArrayObject = () => assign((values(SSRObject), SSRObject));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"author": {
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"!dist/testing",
|
|
17
17
|
"!dist/setupTests.js"
|
|
18
18
|
],
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"**/*.scss"
|
|
21
|
+
],
|
|
19
22
|
"repository": {
|
|
20
23
|
"type": "git",
|
|
21
24
|
"url": "git@github.com:canonical/react-components.git"
|
|
@@ -25,66 +28,66 @@
|
|
|
25
28
|
},
|
|
26
29
|
"homepage": "https://canonical.github.io/react-components",
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"@babel/cli": "7.
|
|
29
|
-
"@babel/eslint-parser": "7.
|
|
30
|
-
"@babel/plugin-transform-class-properties": "7.
|
|
31
|
-
"@babel/preset-env": "7.
|
|
32
|
-
"@babel/preset-react": "7.
|
|
33
|
-
"@babel/preset-typescript": "7.
|
|
34
|
-
"@eslint/compat": "1.
|
|
35
|
-
"@eslint/eslintrc": "3.
|
|
36
|
-
"@eslint/js": "9.
|
|
37
|
-
"@percy/cli": "1.
|
|
38
|
-
"@percy/storybook": "6.0.
|
|
31
|
+
"@babel/cli": "7.28.6",
|
|
32
|
+
"@babel/eslint-parser": "7.28.6",
|
|
33
|
+
"@babel/plugin-transform-class-properties": "7.28.6",
|
|
34
|
+
"@babel/preset-env": "7.28.6",
|
|
35
|
+
"@babel/preset-react": "7.28.5",
|
|
36
|
+
"@babel/preset-typescript": "7.28.5",
|
|
37
|
+
"@eslint/compat": "1.4.1",
|
|
38
|
+
"@eslint/eslintrc": "3.3.3",
|
|
39
|
+
"@eslint/js": "9.39.2",
|
|
40
|
+
"@percy/cli": "1.31.8",
|
|
41
|
+
"@percy/storybook": "6.0.4",
|
|
39
42
|
"@semantic-release/changelog": "6.0.3",
|
|
40
43
|
"@semantic-release/git": "10.0.1",
|
|
41
|
-
"@storybook/addon-a11y": "8.
|
|
42
|
-
"@storybook/addon-essentials": "8.
|
|
43
|
-
"@storybook/addon-interactions": "8.
|
|
44
|
-
"@storybook/addon-links": "8.
|
|
45
|
-
"@storybook/addon-onboarding": "8.
|
|
46
|
-
"@storybook/addon-webpack5-compiler-babel": "3.0.
|
|
47
|
-
"@storybook/blocks": "8.
|
|
48
|
-
"@storybook/react": "8.
|
|
49
|
-
"@storybook/react-webpack5": "8.
|
|
50
|
-
"@testing-library/cypress": "10.0
|
|
51
|
-
"@testing-library/dom": "10.4.
|
|
52
|
-
"@testing-library/jest-dom": "6.
|
|
53
|
-
"@testing-library/react": "16.
|
|
44
|
+
"@storybook/addon-a11y": "8.6.15",
|
|
45
|
+
"@storybook/addon-essentials": "8.6.14",
|
|
46
|
+
"@storybook/addon-interactions": "8.6.14",
|
|
47
|
+
"@storybook/addon-links": "8.6.15",
|
|
48
|
+
"@storybook/addon-onboarding": "8.6.15",
|
|
49
|
+
"@storybook/addon-webpack5-compiler-babel": "3.0.6",
|
|
50
|
+
"@storybook/blocks": "8.6.14",
|
|
51
|
+
"@storybook/react": "8.6.15",
|
|
52
|
+
"@storybook/react-webpack5": "8.6.15",
|
|
53
|
+
"@testing-library/cypress": "10.1.0",
|
|
54
|
+
"@testing-library/dom": "10.4.1",
|
|
55
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
56
|
+
"@testing-library/react": "16.3.1",
|
|
54
57
|
"@testing-library/user-event": "14.6.1",
|
|
55
58
|
"babel-jest": "29.7.0",
|
|
56
59
|
"babel-loader": "9.2.1",
|
|
57
60
|
"babel-plugin-module-resolver": "5.0.2",
|
|
58
61
|
"babel-plugin-typescript-to-proptypes": "2.1.0",
|
|
59
|
-
"concurrently": "9.1
|
|
62
|
+
"concurrently": "9.2.1",
|
|
60
63
|
"css-loader": "7.1.2",
|
|
61
|
-
"cypress": "14.
|
|
64
|
+
"cypress": "14.5.4",
|
|
62
65
|
"deepmerge": "4.3.1",
|
|
63
|
-
"eslint": "9.
|
|
64
|
-
"eslint-config-prettier": "10.
|
|
65
|
-
"eslint-plugin-cypress": "4.
|
|
66
|
+
"eslint": "9.39.2",
|
|
67
|
+
"eslint-config-prettier": "10.1.8",
|
|
68
|
+
"eslint-plugin-cypress": "4.3.0",
|
|
66
69
|
"eslint-plugin-flowtype": "8.0.3",
|
|
67
|
-
"eslint-plugin-import": "2.
|
|
70
|
+
"eslint-plugin-import": "2.32.0",
|
|
68
71
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
69
|
-
"eslint-plugin-prettier": "5.
|
|
70
|
-
"eslint-plugin-react": "7.37.
|
|
71
|
-
"eslint-plugin-react-hooks": "5.
|
|
72
|
-
"eslint-plugin-storybook": "0.
|
|
73
|
-
"eslint-plugin-testing-library": "7.
|
|
74
|
-
"formik": "2.4.
|
|
72
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
73
|
+
"eslint-plugin-react": "7.37.5",
|
|
74
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
75
|
+
"eslint-plugin-storybook": "0.12.0",
|
|
76
|
+
"eslint-plugin-testing-library": "7.15.4",
|
|
77
|
+
"formik": "2.4.9",
|
|
75
78
|
"jest": "29.7.0",
|
|
76
79
|
"npm-package-json-lint": "8.0.0",
|
|
77
|
-
"prettier": "3.
|
|
78
|
-
"react": "19.
|
|
80
|
+
"prettier": "3.8.0",
|
|
81
|
+
"react": "19.2.3",
|
|
79
82
|
"react-docgen-typescript-loader": "3.7.2",
|
|
80
|
-
"react-dom": "19.
|
|
81
|
-
"sass": "1.
|
|
82
|
-
"sass-loader": "16.0.
|
|
83
|
+
"react-dom": "19.2.3",
|
|
84
|
+
"sass": "1.97.2",
|
|
85
|
+
"sass-loader": "16.0.6",
|
|
83
86
|
"semantic-release": "25.0.2",
|
|
84
87
|
"storybook": "8.6.15",
|
|
85
|
-
"strip-ansi": "7.1.
|
|
88
|
+
"strip-ansi": "7.1.2",
|
|
86
89
|
"style-loader": "4.0.0",
|
|
87
|
-
"stylelint": "16.
|
|
90
|
+
"stylelint": "16.26.1",
|
|
88
91
|
"stylelint-config-prettier": "9.0.5",
|
|
89
92
|
"stylelint-config-recommended-scss": "14.1.0",
|
|
90
93
|
"stylelint-order": "6.0.4",
|
|
@@ -93,13 +96,13 @@
|
|
|
93
96
|
"tsc-alias": "1.8.10",
|
|
94
97
|
"typescript": "5.7.3",
|
|
95
98
|
"typescript-eslint": "8.24.1",
|
|
96
|
-
"vanilla-framework": "4.
|
|
99
|
+
"vanilla-framework": "4.44.0",
|
|
97
100
|
"wait-on": "8.0.2",
|
|
98
|
-
"webpack": "5.
|
|
101
|
+
"webpack": "5.105.0"
|
|
99
102
|
},
|
|
100
103
|
"dependencies": {
|
|
101
104
|
"@types/jest": "29.5.14",
|
|
102
|
-
"@types/node": "20.
|
|
105
|
+
"@types/node": "20.19.30",
|
|
103
106
|
"@types/react": "19.0.10",
|
|
104
107
|
"@types/react-dom": "19.0.4",
|
|
105
108
|
"@types/react-table": "7.7.20",
|