@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.
Files changed (173) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +5 -0
  2. package/dist/components/Accordion/Accordion.js +6 -0
  3. package/dist/components/Accordion/Accordion.stories.d.ts +18 -0
  4. package/dist/components/Accordion/Accordion.stories.js +117 -0
  5. package/dist/components/ActionButton/ActionButton.d.ts +7 -0
  6. package/dist/components/ActionButton/ActionButton.js +7 -0
  7. package/dist/components/ActionButton/ActionButton.stories.d.ts +7 -0
  8. package/dist/components/ActionButton/ActionButton.stories.js +36 -0
  9. package/dist/components/ApplicationLayout/ApplicationLayout.d.ts +3 -3
  10. package/dist/components/ApplicationLayout/ApplicationLayout.js +4 -4
  11. package/dist/components/ApplicationLayout/ApplicationLayout.stories.d.ts +5 -0
  12. package/dist/components/ApplicationLayout/ApplicationLayout.stories.js +16 -2
  13. package/dist/components/ArticlePagination/ArticlePagination.d.ts +5 -0
  14. package/dist/components/ArticlePagination/ArticlePagination.js +5 -0
  15. package/dist/components/ArticlePagination/ArticlePagination.stories.d.ts +6 -0
  16. package/dist/components/ArticlePagination/ArticlePagination.stories.js +22 -0
  17. package/dist/components/Badge/Badge.d.ts +5 -0
  18. package/dist/components/Badge/Badge.js +6 -0
  19. package/dist/components/Badge/Badge.stories.d.ts +15 -0
  20. package/dist/components/Badge/Badge.stories.js +62 -0
  21. package/dist/components/Button/Button.d.ts +3 -1
  22. package/dist/components/Button/Button.js +3 -1
  23. package/dist/components/Button/Button.stories.d.ts +32 -0
  24. package/dist/components/Button/Button.stories.js +180 -0
  25. package/dist/components/Card/Card.stories.js +0 -1
  26. package/dist/components/CheckboxInput/CheckboxInput.d.ts +5 -0
  27. package/dist/components/CheckboxInput/CheckboxInput.js +5 -0
  28. package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +11 -0
  29. package/dist/components/CheckboxInput/CheckboxInput.stories.js +84 -0
  30. package/dist/components/Chip/Chip.d.ts +5 -0
  31. package/dist/components/Chip/Chip.js +5 -0
  32. package/dist/components/Chip/Chip.stories.d.ts +9 -0
  33. package/dist/components/Chip/Chip.stories.js +45 -0
  34. package/dist/components/CodeSnippet/CodeSnippet.d.ts +7 -0
  35. package/dist/components/CodeSnippet/CodeSnippet.js +7 -0
  36. package/dist/components/CodeSnippet/CodeSnippet.stories.d.ts +45 -0
  37. package/dist/components/CodeSnippet/CodeSnippet.stories.js +279 -0
  38. package/dist/components/Col/Col.d.ts +5 -0
  39. package/dist/components/Col/Col.js +5 -0
  40. package/dist/components/Col/Col.stories.d.ts +11 -0
  41. package/dist/components/Col/Col.stories.js +154 -0
  42. package/dist/components/ConfirmationButton/ConfirmationButton.d.ts +3 -0
  43. package/dist/components/ConfirmationButton/ConfirmationButton.js +13 -1
  44. package/dist/components/ConfirmationButton/ConfirmationButton.stories.d.ts +9 -0
  45. package/dist/components/ConfirmationButton/ConfirmationButton.stories.js +108 -0
  46. package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +16 -4
  47. package/dist/components/ConfirmationModal/ConfirmationModal.js +8 -3
  48. package/dist/components/ConfirmationModal/ConfirmationModal.stories.d.ts +18 -0
  49. package/dist/components/ConfirmationModal/ConfirmationModal.stories.js +135 -0
  50. package/dist/components/ContextualMenu/ContextualMenu.d.ts +3 -20
  51. package/dist/components/ContextualMenu/ContextualMenu.js +3 -20
  52. package/dist/components/ContextualMenu/ContextualMenu.stories.d.ts +13 -0
  53. package/dist/components/ContextualMenu/ContextualMenu.stories.js +107 -0
  54. package/dist/components/EmptyState/EmptyState.d.ts +3 -0
  55. package/dist/components/EmptyState/EmptyState.js +3 -0
  56. package/dist/components/EmptyState/EmptyState.stories.d.ts +7 -0
  57. package/dist/components/EmptyState/EmptyState.stories.js +49 -0
  58. package/dist/components/Form/Form.d.ts +5 -0
  59. package/dist/components/Form/Form.js +5 -0
  60. package/dist/components/Form/Form.stories.d.ts +12 -0
  61. package/dist/components/Form/Form.stories.js +179 -0
  62. package/dist/components/FormikField/FormikField.stories.js +0 -1
  63. package/dist/components/Icon/Icon.d.ts +3 -1
  64. package/dist/components/Icon/Icon.js +3 -1
  65. package/dist/components/Icon/Icon.stories.d.ts +16 -0
  66. package/dist/components/Icon/Icon.stories.js +49 -0
  67. package/dist/components/Input/Input.d.ts +5 -0
  68. package/dist/components/Input/Input.js +5 -0
  69. package/dist/components/Input/Input.stories.d.ts +14 -0
  70. package/dist/components/Input/Input.stories.js +148 -0
  71. package/dist/components/Link/Link.d.ts +5 -0
  72. package/dist/components/Link/Link.js +5 -0
  73. package/dist/components/Link/Link.stories.d.ts +9 -0
  74. package/dist/components/Link/Link.stories.js +48 -0
  75. package/dist/components/List/List.d.ts +5 -0
  76. package/dist/components/List/List.js +6 -0
  77. package/dist/components/List/List.stories.d.ts +15 -0
  78. package/dist/components/List/List.stories.js +122 -0
  79. package/dist/components/LoginPageLayout/LoginPageLayout.d.ts +4 -0
  80. package/dist/components/LoginPageLayout/LoginPageLayout.js +4 -0
  81. package/dist/components/LoginPageLayout/LoginPageLayout.stories.d.ts +9 -0
  82. package/dist/components/LoginPageLayout/LoginPageLayout.stories.js +58 -0
  83. package/dist/components/MainTable/MainTable.d.ts +3 -0
  84. package/dist/components/MainTable/MainTable.js +4 -0
  85. package/dist/components/MainTable/MainTable.stories.d.ts +15 -0
  86. package/dist/components/MainTable/MainTable.stories.js +553 -0
  87. package/dist/components/Modal/Modal.d.ts +5 -0
  88. package/dist/components/Modal/Modal.js +5 -0
  89. package/dist/components/Modal/Modal.stories.d.ts +6 -0
  90. package/dist/components/Modal/Modal.stories.js +57 -0
  91. package/dist/components/ModularTable/ModularTable.d.ts +52 -0
  92. package/dist/components/ModularTable/ModularTable.js +53 -0
  93. package/dist/components/ModularTable/ModularTable.stories.d.ts +27 -0
  94. package/dist/components/ModularTable/ModularTable.stories.js +343 -0
  95. package/dist/components/MultiSelect/MultiSelect.stories.d.ts +5 -64
  96. package/dist/components/MultiSelect/MultiSelect.stories.js +0 -1
  97. package/dist/components/Navigation/Navigation.d.ts +8 -0
  98. package/dist/components/Navigation/Navigation.js +9 -0
  99. package/dist/components/Navigation/Navigation.stories.d.ts +43 -0
  100. package/dist/components/Navigation/Navigation.stories.js +232 -0
  101. package/dist/components/Notification/Notification.d.ts +25 -0
  102. package/dist/components/Notification/Notification.js +25 -0
  103. package/dist/components/Notification/Notification.stories.d.ts +45 -0
  104. package/dist/components/Notification/Notification.stories.js +201 -0
  105. package/dist/components/Pagination/Pagination.d.ts +12 -0
  106. package/dist/components/Pagination/Pagination.js +12 -0
  107. package/dist/components/Pagination/Pagination.stories.d.ts +14 -0
  108. package/dist/components/Pagination/Pagination.stories.js +94 -0
  109. package/dist/components/PasswordToggle/PasswordToggle.d.ts +5 -0
  110. package/dist/components/PasswordToggle/PasswordToggle.js +5 -0
  111. package/dist/components/PasswordToggle/PasswordToggle.stories.d.ts +12 -0
  112. package/dist/components/PasswordToggle/PasswordToggle.stories.js +74 -0
  113. package/dist/components/RadioInput/RadioInput.d.ts +5 -0
  114. package/dist/components/RadioInput/RadioInput.js +5 -0
  115. package/dist/components/RadioInput/RadioInput.stories.d.ts +10 -0
  116. package/dist/components/RadioInput/RadioInput.stories.js +83 -0
  117. package/dist/components/Row/Row.d.ts +5 -0
  118. package/dist/components/Row/Row.js +5 -0
  119. package/dist/components/Row/Row.stories.d.ts +9 -0
  120. package/dist/components/Row/Row.stories.js +29 -0
  121. package/dist/components/SearchAndFilter/SearchAndFilter.d.ts +3 -0
  122. package/dist/components/SearchAndFilter/SearchAndFilter.js +3 -0
  123. package/dist/components/SearchAndFilter/SearchAndFilter.stories.d.ts +8 -0
  124. package/dist/components/SearchAndFilter/SearchAndFilter.stories.js +218 -0
  125. package/dist/components/SearchBox/SearchBox.d.ts +5 -0
  126. package/dist/components/SearchBox/SearchBox.js +5 -0
  127. package/dist/components/SearchBox/SearchBox.stories.d.ts +14 -0
  128. package/dist/components/SearchBox/SearchBox.stories.js +106 -0
  129. package/dist/components/Select/Select.d.ts +5 -0
  130. package/dist/components/Select/Select.js +6 -0
  131. package/dist/components/Select/Select.stories.d.ts +7 -0
  132. package/dist/components/Select/Select.stories.js +97 -0
  133. package/dist/components/Slider/Slider.d.ts +6 -0
  134. package/dist/components/Slider/Slider.js +6 -0
  135. package/dist/components/Slider/Slider.stories.d.ts +10 -0
  136. package/dist/components/Slider/Slider.stories.js +74 -0
  137. package/dist/components/Spinner/Spinner.d.ts +3 -0
  138. package/dist/components/Spinner/Spinner.js +3 -0
  139. package/dist/components/Spinner/Spinner.stories.d.ts +8 -0
  140. package/dist/components/Spinner/Spinner.stories.js +28 -0
  141. package/dist/components/StatusLabel/StatusLabel.d.ts +3 -1
  142. package/dist/components/StatusLabel/StatusLabel.js +3 -1
  143. package/dist/components/StatusLabel/StatusLabel.stories.d.ts +10 -0
  144. package/dist/components/StatusLabel/StatusLabel.stories.js +61 -0
  145. package/dist/components/Strip/Strip.d.ts +5 -0
  146. package/dist/components/Strip/Strip.js +5 -0
  147. package/dist/components/Strip/Strip.stories.d.ts +12 -0
  148. package/dist/components/Strip/Strip.stories.js +130 -0
  149. package/dist/components/SummaryButton/SummaryButton.d.ts +3 -0
  150. package/dist/components/SummaryButton/SummaryButton.js +3 -0
  151. package/dist/components/SummaryButton/SummaryButton.stories.d.ts +18 -0
  152. package/dist/components/SummaryButton/SummaryButton.stories.js +59 -0
  153. package/dist/components/Switch/Switch.d.ts +3 -0
  154. package/dist/components/Switch/Switch.js +3 -0
  155. package/dist/components/Switch/Switch.stories.d.ts +7 -0
  156. package/dist/components/Switch/Switch.stories.js +26 -0
  157. package/dist/components/TablePagination/TablePagination.d.ts +21 -0
  158. package/dist/components/TablePagination/TablePagination.js +21 -0
  159. package/dist/components/TablePagination/TablePagination.stories.d.ts +10 -0
  160. package/dist/components/TablePagination/TablePagination.stories.js +302 -0
  161. package/dist/components/Tabs/Tabs.d.ts +5 -0
  162. package/dist/components/Tabs/Tabs.js +5 -0
  163. package/dist/components/Tabs/Tabs.stories.d.ts +11 -0
  164. package/dist/components/Tabs/Tabs.stories.js +56 -0
  165. package/dist/components/Textarea/Textarea.d.ts +5 -0
  166. package/dist/components/Textarea/Textarea.js +5 -0
  167. package/dist/components/Textarea/Textarea.stories.d.ts +7 -0
  168. package/dist/components/Textarea/Textarea.stories.js +62 -0
  169. package/dist/components/Tooltip/Tooltip.d.ts +7 -11
  170. package/dist/components/Tooltip/Tooltip.js +7 -11
  171. package/dist/components/Tooltip/Tooltip.stories.d.ts +12 -0
  172. package/dist/components/Tooltip/Tooltip.stories.js +71 -0
  173. package/package.json +14 -14
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.ShallowStrip = exports.LightStrip = exports.ImageStrip = exports.DeepStrip = exports.DarkStrip = exports.BorderedStrip = exports.AccentStrip = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _Col = _interopRequireDefault(require("../Col"));
9
+ var _Row = _interopRequireDefault(require("../Row"));
10
+ var _Strip = _interopRequireDefault(require("./Strip"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const meta = {
13
+ component: _Strip.default,
14
+ tags: ["autodocs"],
15
+ argTypes: {
16
+ children: {
17
+ control: {
18
+ disable: true
19
+ }
20
+ }
21
+ }
22
+ };
23
+ var _default = exports.default = meta;
24
+ const LightStrip = exports.LightStrip = {
25
+ name: "Light strip",
26
+ args: {
27
+ type: "light",
28
+ children: /*#__PURE__*/_react.default.createElement("p", null, "This is a light row")
29
+ }
30
+ };
31
+ const DarkStrip = exports.DarkStrip = {
32
+ render: () => /*#__PURE__*/_react.default.createElement(_Strip.default, {
33
+ type: "dark"
34
+ }, /*#__PURE__*/_react.default.createElement("p", null, "This is a dark row")),
35
+ name: "Dark strip"
36
+ };
37
+ const AccentStrip = exports.AccentStrip = {
38
+ render: () => /*#__PURE__*/_react.default.createElement(_Strip.default, {
39
+ type: "accent",
40
+ element: "section",
41
+ includeCol: false
42
+ }, /*#__PURE__*/_react.default.createElement(_Col.default, {
43
+ size: 8
44
+ }, /*#__PURE__*/_react.default.createElement("h1", null, "Still running Ubuntu 14.04 LTS?"), /*#__PURE__*/_react.default.createElement("p", null, "Learn how to maintain ongoing security compliance for your Ubuntu 14.04 LTS systems.")), /*#__PURE__*/_react.default.createElement(_Col.default, {
45
+ size: 4
46
+ }, /*#__PURE__*/_react.default.createElement("img", {
47
+ src: "https://assets.ubuntu.com/v1/2217d1c8-Security.svg",
48
+ alt: "Placeholder"
49
+ }))),
50
+ name: "Accent strip"
51
+ };
52
+ const ImageStrip = exports.ImageStrip = {
53
+ render: () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Strip.default, {
54
+ background: "https://assets.ubuntu.com/sites/ubuntu/latest/u/img/backgrounds/image-background-paper.png",
55
+ includeCol: false,
56
+ element: "section",
57
+ light: true,
58
+ rowClassName: "u-vertically-center",
59
+ type: "image"
60
+ }, /*#__PURE__*/_react.default.createElement(_Col.default, {
61
+ size: 8
62
+ }, /*#__PURE__*/_react.default.createElement("h1", null, "Get started with big software, fast"), /*#__PURE__*/_react.default.createElement("p", null, "conjure-up lets you summon up a big-software stack as a \u201Cspell\u201D \u2014 a model of the stack, combined with extra know-how to get you from an installed stack to a fully usable one. Start using your big software instead of learning how to deploy it.")), /*#__PURE__*/_react.default.createElement(_Col.default, {
63
+ size: 4,
64
+ className: "u-hide--small u-align--center"
65
+ }, /*#__PURE__*/_react.default.createElement("img", {
66
+ src: "https://assets.ubuntu.com/v1/1abb8716-conjure-up-illustration.svg",
67
+ alt: "Placeholder"
68
+ }))), /*#__PURE__*/_react.default.createElement(_Strip.default, {
69
+ background: "https://assets.ubuntu.com/v1/9b68976e-Aubergine_suru_background_2.png",
70
+ dark: true,
71
+ includeCol: false,
72
+ element: "section",
73
+ type: "image"
74
+ }, /*#__PURE__*/_react.default.createElement(_Row.default, {
75
+ className: "u-vertically-center"
76
+ }, /*#__PURE__*/_react.default.createElement(_Col.default, {
77
+ size: 8
78
+ }, /*#__PURE__*/_react.default.createElement("h1", null, "We are Canonical"), /*#__PURE__*/_react.default.createElement("p", null, "It is our mission to make open source software available to people everywhere. We believe the best way to fuel innovation is to give the innovators the technology they need.")), /*#__PURE__*/_react.default.createElement(_Col.default, {
79
+ size: 4,
80
+ className: "u-hide--small u-align--center"
81
+ }, /*#__PURE__*/_react.default.createElement("img", {
82
+ src: "https://assets.ubuntu.com/v1/9c74eb2d-logo-canonical-white.svg",
83
+ alt: "Placeholder"
84
+ }))))),
85
+ name: "Image strip"
86
+ };
87
+ const BorderedStrip = exports.BorderedStrip = {
88
+ render: () => /*#__PURE__*/_react.default.createElement(_Strip.default, {
89
+ bordered: true,
90
+ colSize: 8,
91
+ element: "section"
92
+ }, /*#__PURE__*/_react.default.createElement("h2", null, "The node lifecycle"), /*#__PURE__*/_react.default.createElement("p", null, "Each machine (\u201Cnode\u201D) managed by MAAS goes through a lifecycle \u2014 from its enlistment or onboarding to MAAS, through commissioning when we inventory and can setup firmware or other hardware-specific elements, then allocation to a user and deployment, and finally they are released back to the pool or retired altogether.")),
93
+ name: "Bordered strip"
94
+ };
95
+ const DeepStrip = exports.DeepStrip = {
96
+ render: () => /*#__PURE__*/_react.default.createElement(_Strip.default, {
97
+ deep: true,
98
+ includeCol: false,
99
+ element: "section",
100
+ type: "light",
101
+ rowClassName: "u-vertically-center"
102
+ }, /*#__PURE__*/_react.default.createElement(_Col.default, {
103
+ size: 8
104
+ }, /*#__PURE__*/_react.default.createElement("h2", null, "The fastest way to go from development to production in IoT"), /*#__PURE__*/_react.default.createElement("p", null, "Learn about how Ubuntu Core and snaps can help you build your connected devices.")), /*#__PURE__*/_react.default.createElement(_Col.default, {
105
+ size: 4,
106
+ className: "u-hide--small u-align--center"
107
+ }, /*#__PURE__*/_react.default.createElement("img", {
108
+ src: "https://assets.ubuntu.com/v1/808a4e5b-iot.png?h=300",
109
+ alt: "Placeholder"
110
+ }))),
111
+ name: "Deep strip"
112
+ };
113
+ const ShallowStrip = exports.ShallowStrip = {
114
+ render: () => /*#__PURE__*/_react.default.createElement(_Strip.default, {
115
+ shallow: true,
116
+ includeCol: false,
117
+ element: "section",
118
+ type: "light",
119
+ rowClassName: "u-vertically-center"
120
+ }, /*#__PURE__*/_react.default.createElement(_Col.default, {
121
+ size: 8
122
+ }, /*#__PURE__*/_react.default.createElement("h2", null, "The fastest way to go from development to production in IoT"), /*#__PURE__*/_react.default.createElement("p", null, "Learn about how Ubuntu Core and snaps can help you build your connected devices.")), /*#__PURE__*/_react.default.createElement(_Col.default, {
123
+ size: 4,
124
+ className: "u-hide--small u-align--center"
125
+ }, /*#__PURE__*/_react.default.createElement("img", {
126
+ src: "https://assets.ubuntu.com/v1/808a4e5b-iot.png?h=300",
127
+ alt: "Placeholder"
128
+ }))),
129
+ name: "Shallow strip"
130
+ };
@@ -22,5 +22,8 @@ export type Props = {
22
22
  */
23
23
  summary?: string;
24
24
  };
25
+ /**
26
+ * `SummaryButton` is a component to render a short summary with an action button. It's initial use case is a summary of table contents with action to load more items.
27
+ */
25
28
  declare const SummaryButton: ({ className, isLoading, summary, label, onClick, }: Props) => JSX.Element;
26
29
  export default SummaryButton;
@@ -8,6 +8,9 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _classnames = _interopRequireDefault(require("classnames"));
9
9
  var _ActionButton = _interopRequireDefault(require("../ActionButton"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ /**
12
+ * `SummaryButton` is a component to render a short summary with an action button. It's initial use case is a summary of table contents with action to load more items.
13
+ */
11
14
  const SummaryButton = _ref => {
12
15
  let {
13
16
  className,
@@ -0,0 +1,18 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import SummaryButton from "./SummaryButton";
3
+ declare const meta: Meta<typeof SummaryButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof SummaryButton>;
6
+ export declare const Default: Story;
7
+ /**
8
+ * Summary text is optional.
9
+ */
10
+ export declare const ActionOnly: Story;
11
+ /**
12
+ * Action is optional as well. When `onClick` prop is not provided component will render just the summary text.
13
+ */
14
+ export declare const SummaryOnly: Story;
15
+ /**
16
+ * When data is loaded asynchronusly `isLoading` prop should be set to `true` to shows a spinner animation in place of the action button.
17
+ */
18
+ export declare const Loading: Story;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.SummaryOnly = exports.Loading = exports.Default = exports.ActionOnly = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _SummaryButton = _interopRequireDefault(require("./SummaryButton"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const doNothing = () => {};
11
+ const meta = {
12
+ component: _SummaryButton.default,
13
+ tags: ["autodocs"]
14
+ };
15
+ var _default = exports.default = meta;
16
+ const Default = exports.Default = {
17
+ render: () => /*#__PURE__*/_react.default.createElement(_SummaryButton.default, {
18
+ summary: "Showing 15 out of 100 items.",
19
+ label: "Show more",
20
+ onClick: doNothing
21
+ }),
22
+ name: "Default"
23
+ };
24
+
25
+ /**
26
+ * Summary text is optional.
27
+ */
28
+ const ActionOnly = exports.ActionOnly = {
29
+ render: () => /*#__PURE__*/_react.default.createElement(_SummaryButton.default, {
30
+ label: "Show more items",
31
+ onClick: doNothing
32
+ }),
33
+ name: "Action only"
34
+ };
35
+
36
+ /**
37
+ * Action is optional as well. When `onClick` prop is not provided component will render just the summary text.
38
+ */
39
+ const SummaryOnly = exports.SummaryOnly = {
40
+ render: () => /*#__PURE__*/_react.default.createElement(_SummaryButton.default, {
41
+ summary: "Showing 100 out of 100 items.",
42
+ label: "Show more items",
43
+ onClick: doNothing
44
+ }),
45
+ name: "Summary only"
46
+ };
47
+
48
+ /**
49
+ * When data is loaded asynchronusly `isLoading` prop should be set to `true` to shows a spinner animation in place of the action button.
50
+ */
51
+ const Loading = exports.Loading = {
52
+ render: () => /*#__PURE__*/_react.default.createElement(_SummaryButton.default, {
53
+ summary: "Showing 15 out of 100 items.",
54
+ label: "Show more",
55
+ isLoading: true,
56
+ onClick: doNothing
57
+ }),
58
+ name: "Loading"
59
+ };
@@ -10,5 +10,8 @@ export type Props = PropsWithSpread<{
10
10
  */
11
11
  disabled?: boolean;
12
12
  }, HTMLProps<HTMLInputElement>>;
13
+ /**
14
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Switch](https://vanillaframework.io/docs/patterns/switch) component.
15
+ */
13
16
  export declare const Switch: ({ label, disabled, ...inputProps }: Props) => JSX.Element;
14
17
  export default Switch;
@@ -7,6 +7,9 @@ exports.default = exports.Switch = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
9
  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); }
10
+ /**
11
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Switch](https://vanillaframework.io/docs/patterns/switch) component.
12
+ */
10
13
  const Switch = _ref => {
11
14
  let {
12
15
  label,
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import Switch from "./Switch";
3
+ declare const meta: Meta<typeof Switch>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Switch>;
6
+ export declare const Default: Story;
7
+ export declare const Disabled: Story;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Disabled = exports.Default = void 0;
7
+ var _Switch = _interopRequireDefault(require("./Switch"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const meta = {
10
+ component: _Switch.default,
11
+ tags: ["autodocs"]
12
+ };
13
+ var _default = exports.default = meta;
14
+ const Default = exports.Default = {
15
+ name: "Default",
16
+ args: {
17
+ label: "Switch"
18
+ }
19
+ };
20
+ const Disabled = exports.Disabled = {
21
+ name: "Disabled",
22
+ args: {
23
+ disabled: true,
24
+ label: "Disabled switch"
25
+ }
26
+ };
@@ -73,5 +73,26 @@ export type InternalControlProps = BasePaginationProps & {
73
73
  externallyControlled?: false;
74
74
  };
75
75
  export type Props = PropsWithChildren<ExternalControlProps | InternalControlProps> & HTMLAttributes<HTMLDivElement>;
76
+ /**
77
+ This is an HOC [React](https://reactjs.org/) component for applying pagination to direct children components. This component is un-opinionated about
78
+ the structure of the input data and can be used with any child component that displays a list of data. However, the styling and behaviour of this component were designed
79
+ to work nicely with the `MainTable` component. To use this component, simply wrap a child component with it and provide the data that you want
80
+ to paginate to the `data` prop. This component will then pass the paged data to all <b>direct</b> child components via a child prop specified by `dataForwardProp`.
81
+ The component may be externally controlled, see following sections for detailed explanation.
82
+
83
+ #### Externally controlled pagination
84
+
85
+ For externally controlled mode, you will be responsible for the pagination logic and therefore the component will be purely presentational.
86
+ The pagination behaviour is controlled outside of this component. Note the data injection to child components is essentially a passthrough in this case.
87
+ To enable externally controlled mode for this component, set the `externallyControlled` prop to `true`. From there, it is your responsibility
88
+ to ensure that the following props `totalItems`, `currentPage`, `pageSize`, `onPageChange` and `onPageSizeChange` are set properly.
89
+ You can refer to the props table below on how to set these props.
90
+
91
+ #### Un-controlled pagination
92
+
93
+ In this mode, the component assumes that the input data is not paginated. The component will implement the pagination logic and apply it to the input data
94
+ then inject the paged data into direct child components. This is the default mode of operations for the component where `externallyControlled` prop is set
95
+ to `false`.
96
+ */
76
97
  declare const TablePagination: (props: Props) => React.JSX.Element;
77
98
  export default TablePagination;
@@ -13,6 +13,27 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
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
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
15
  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); }
16
+ /**
17
+ This is an HOC [React](https://reactjs.org/) component for applying pagination to direct children components. This component is un-opinionated about
18
+ the structure of the input data and can be used with any child component that displays a list of data. However, the styling and behaviour of this component were designed
19
+ to work nicely with the `MainTable` component. To use this component, simply wrap a child component with it and provide the data that you want
20
+ to paginate to the `data` prop. This component will then pass the paged data to all <b>direct</b> child components via a child prop specified by `dataForwardProp`.
21
+ The component may be externally controlled, see following sections for detailed explanation.
22
+
23
+ #### Externally controlled pagination
24
+
25
+ For externally controlled mode, you will be responsible for the pagination logic and therefore the component will be purely presentational.
26
+ The pagination behaviour is controlled outside of this component. Note the data injection to child components is essentially a passthrough in this case.
27
+ To enable externally controlled mode for this component, set the `externallyControlled` prop to `true`. From there, it is your responsibility
28
+ to ensure that the following props `totalItems`, `currentPage`, `pageSize`, `onPageChange` and `onPageSizeChange` are set properly.
29
+ You can refer to the props table below on how to set these props.
30
+
31
+ #### Un-controlled pagination
32
+
33
+ In this mode, the component assumes that the input data is not paginated. The component will implement the pagination logic and apply it to the input data
34
+ then inject the paged data into direct child components. This is the default mode of operations for the component where `externallyControlled` prop is set
35
+ to `false`.
36
+ */
16
37
  const TablePagination = props => {
17
38
  const {
18
39
  data,
@@ -0,0 +1,10 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import TablePagination from "./TablePagination";
3
+ declare const meta: Meta<typeof TablePagination>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TablePagination>;
6
+ export declare const Default: Story;
7
+ export declare const CustomPageLimit: Story;
8
+ export declare const CustomDisplayTitle: Story;
9
+ export declare const RenderAbove: Story;
10
+ export declare const RenderBelow: Story;
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.RenderBelow = exports.RenderAbove = exports.Default = exports.CustomPageLimit = exports.CustomDisplayTitle = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _TablePagination = _interopRequireDefault(require("./TablePagination"));
9
+ var _MainTable = _interopRequireDefault(require("../MainTable"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const meta = {
12
+ component: _TablePagination.default,
13
+ tags: ["autodocs"],
14
+ argTypes: {
15
+ totalItems: {
16
+ if: {
17
+ arg: "externallyControlled",
18
+ truthy: true
19
+ }
20
+ },
21
+ currentPage: {
22
+ if: {
23
+ arg: "externallyControlled",
24
+ truthy: true
25
+ }
26
+ },
27
+ pageSize: {
28
+ if: {
29
+ arg: "externallyControlled",
30
+ truthy: true
31
+ }
32
+ },
33
+ onPageChange: {
34
+ if: {
35
+ arg: "externallyControlled",
36
+ truthy: true
37
+ }
38
+ },
39
+ onPageSizeChange: {
40
+ if: {
41
+ arg: "externallyControlled",
42
+ truthy: true
43
+ }
44
+ }
45
+ }
46
+ };
47
+ var _default = exports.default = meta;
48
+ const Default = exports.Default = {
49
+ name: "Default",
50
+ args: {
51
+ data: [{
52
+ id: "row-1"
53
+ }, {
54
+ id: "row-2"
55
+ }, {
56
+ id: "row-3"
57
+ }, {
58
+ id: "row-4"
59
+ }, {
60
+ id: "row-5"
61
+ }]
62
+ }
63
+ };
64
+ const CustomPageLimit = exports.CustomPageLimit = {
65
+ name: "CustomPageLimit",
66
+ args: {
67
+ data: [{
68
+ id: "row-1"
69
+ }, {
70
+ id: "row-2"
71
+ }, {
72
+ id: "row-3"
73
+ }, {
74
+ id: "row-4"
75
+ }, {
76
+ id: "row-5"
77
+ }],
78
+ pageLimits: [1, 2, 3]
79
+ }
80
+ };
81
+ const CustomDisplayTitle = exports.CustomDisplayTitle = {
82
+ name: "CustomDisplayTitle",
83
+ args: {
84
+ data: [{
85
+ id: "row-1"
86
+ }, {
87
+ id: "row-2"
88
+ }, {
89
+ id: "row-3"
90
+ }, {
91
+ id: "row-4"
92
+ }, {
93
+ id: "row-5"
94
+ }],
95
+ description: /*#__PURE__*/_react.default.createElement("b", null, "Hello there")
96
+ }
97
+ };
98
+ const RenderAbove = exports.RenderAbove = {
99
+ render: () => {
100
+ const data = [{
101
+ columns: [{
102
+ content: "Ready",
103
+ role: "rowheader"
104
+ }, {
105
+ content: 1,
106
+ className: "u-align--right"
107
+ }, {
108
+ content: "1 GiB",
109
+ className: "u-align--right"
110
+ }, {
111
+ content: 2,
112
+ className: "u-align--right"
113
+ }, {
114
+ content: 42,
115
+ className: "u-align--right"
116
+ }],
117
+ sortData: {
118
+ status: "ready",
119
+ cores: 2,
120
+ ram: 1,
121
+ disks: 2
122
+ }
123
+ }, {
124
+ columns: [{
125
+ content: "Idle",
126
+ role: "rowheader"
127
+ }, {
128
+ content: 1,
129
+ className: "u-align--right"
130
+ }, {
131
+ content: "1 GiB",
132
+ className: "u-align--right"
133
+ }, {
134
+ content: 2,
135
+ className: "u-align--right"
136
+ }, {
137
+ content: 23,
138
+ className: "u-align--right"
139
+ }],
140
+ sortData: {
141
+ status: "idle",
142
+ cores: 1,
143
+ ram: 1,
144
+ disks: 2
145
+ }
146
+ }, {
147
+ columns: [{
148
+ content: "Waiting",
149
+ role: "rowheader"
150
+ }, {
151
+ content: 8,
152
+ className: "u-align--right"
153
+ }, {
154
+ content: "3.9 GiB",
155
+ className: "u-align--right"
156
+ }, {
157
+ content: 3,
158
+ className: "u-align--right"
159
+ }, {
160
+ content: 0,
161
+ className: "u-align--right"
162
+ }],
163
+ sortData: {
164
+ status: "waiting",
165
+ cores: 8,
166
+ ram: 3.9,
167
+ disks: 3
168
+ }
169
+ }];
170
+ const headers = [{
171
+ content: "Status",
172
+ sortKey: "status"
173
+ }, {
174
+ content: "Cores",
175
+ sortKey: "cores",
176
+ className: "u-align--right"
177
+ }, {
178
+ content: "RAM",
179
+ sortKey: "ram",
180
+ className: "u-align--right"
181
+ }, {
182
+ content: "Disks",
183
+ sortKey: "disks",
184
+ className: "u-align--right"
185
+ }, {
186
+ content: "Networks",
187
+ className: "u-align--right"
188
+ }];
189
+ return /*#__PURE__*/_react.default.createElement(_TablePagination.default, {
190
+ data: data,
191
+ pageLimits: [1, 2, 3]
192
+ }, /*#__PURE__*/_react.default.createElement(_MainTable.default, {
193
+ headers: headers,
194
+ rows: data,
195
+ sortable: true
196
+ }));
197
+ },
198
+ name: "RenderAbove"
199
+ };
200
+ const RenderBelow = exports.RenderBelow = {
201
+ render: () => {
202
+ const data = [{
203
+ columns: [{
204
+ content: "Ready",
205
+ role: "rowheader"
206
+ }, {
207
+ content: 1,
208
+ className: "u-align--right"
209
+ }, {
210
+ content: "1 GiB",
211
+ className: "u-align--right"
212
+ }, {
213
+ content: 2,
214
+ className: "u-align--right"
215
+ }, {
216
+ content: 42,
217
+ className: "u-align--right"
218
+ }],
219
+ sortData: {
220
+ status: "ready",
221
+ cores: 2,
222
+ ram: 1,
223
+ disks: 2
224
+ }
225
+ }, {
226
+ columns: [{
227
+ content: "Idle",
228
+ role: "rowheader"
229
+ }, {
230
+ content: 1,
231
+ className: "u-align--right"
232
+ }, {
233
+ content: "1 GiB",
234
+ className: "u-align--right"
235
+ }, {
236
+ content: 2,
237
+ className: "u-align--right"
238
+ }, {
239
+ content: 23,
240
+ className: "u-align--right"
241
+ }],
242
+ sortData: {
243
+ status: "idle",
244
+ cores: 1,
245
+ ram: 1,
246
+ disks: 2
247
+ }
248
+ }, {
249
+ columns: [{
250
+ content: "Waiting",
251
+ role: "rowheader"
252
+ }, {
253
+ content: 8,
254
+ className: "u-align--right"
255
+ }, {
256
+ content: "3.9 GiB",
257
+ className: "u-align--right"
258
+ }, {
259
+ content: 3,
260
+ className: "u-align--right"
261
+ }, {
262
+ content: 0,
263
+ className: "u-align--right"
264
+ }],
265
+ sortData: {
266
+ status: "waiting",
267
+ cores: 8,
268
+ ram: 3.9,
269
+ disks: 3
270
+ }
271
+ }];
272
+ const headers = [{
273
+ content: "Status",
274
+ sortKey: "status"
275
+ }, {
276
+ content: "Cores",
277
+ sortKey: "cores",
278
+ className: "u-align--right"
279
+ }, {
280
+ content: "RAM",
281
+ sortKey: "ram",
282
+ className: "u-align--right"
283
+ }, {
284
+ content: "Disks",
285
+ sortKey: "disks",
286
+ className: "u-align--right"
287
+ }, {
288
+ content: "Networks",
289
+ className: "u-align--right"
290
+ }];
291
+ return /*#__PURE__*/_react.default.createElement(_TablePagination.default, {
292
+ data: data,
293
+ pageLimits: [1, 2, 3],
294
+ position: "below"
295
+ }, /*#__PURE__*/_react.default.createElement(_MainTable.default, {
296
+ headers: headers,
297
+ rows: data,
298
+ sortable: true
299
+ }));
300
+ },
301
+ name: "RenderBelow"
302
+ };
@@ -36,5 +36,10 @@ export type Props<P = null> = {
36
36
  */
37
37
  listClassName?: string;
38
38
  };
39
+ /**
40
+ * This is the [React](https://reactjs.org/) component for Vanilla [Tabs](https://vanillaframework.io/docs/patterns/tabs).
41
+ Tabs organise and allow navigation between groups of content that are related and at the same level
42
+ of hierarchy.
43
+ */
39
44
  declare const Tabs: <P>({ className, links, listClassName, }: Props<P>) => JSX.Element;
40
45
  export default Tabs;