@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,232 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Search = exports.OverridingTheLogo = exports.OverridingTheLinkComponent = exports.NoMenuItems = exports.Dropdown = exports.Default = exports.Dark = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _Navigation = _interopRequireDefault(require("./Navigation"));
9
+ var _enums = require("../../enums");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const meta = {
12
+ component: _Navigation.default,
13
+ tags: ["autodocs"]
14
+ };
15
+ var _default = exports.default = meta;
16
+ /**
17
+ * The default navigation is constrained to the max width of the Vanilla grid and
18
+ uses the light theme.
19
+ */
20
+ const Default = exports.Default = {
21
+ name: "Default",
22
+ args: {
23
+ items: [{
24
+ label: "Products",
25
+ url: "#"
26
+ }, {
27
+ label: "Services",
28
+ url: "#"
29
+ }, {
30
+ label: "Partners",
31
+ url: "#"
32
+ }],
33
+ logo: {
34
+ src: "https://assets.ubuntu.com/v1/82818827-CoF_white.svg",
35
+ title: "Canonical",
36
+ url: "#"
37
+ }
38
+ }
39
+ };
40
+
41
+ /**
42
+ * You can switch to a dark themed Navigation by using the `dark` prop. This will
43
+ automatically update the Navigation items to use lighter text and hover state
44
+ colours.
45
+ */
46
+ const Dark = exports.Dark = {
47
+ name: "Dark",
48
+ args: {
49
+ items: [{
50
+ label: "Products",
51
+ url: "#"
52
+ }, {
53
+ label: "Services",
54
+ url: "#"
55
+ }, {
56
+ label: "Partners",
57
+ url: "#"
58
+ }],
59
+ logo: {
60
+ src: "https://assets.ubuntu.com/v1/82818827-CoF_white.svg",
61
+ title: "Canonical",
62
+ url: "#"
63
+ },
64
+ theme: _enums.Theme.DARK
65
+ }
66
+ };
67
+
68
+ /**
69
+ * Sub-navigation dropdown menus can be added to Navigation by adding an `items`
70
+ array instead of a URL. By default, the dropdown items will align to the left of the
71
+ parent item. This can be changed by adding `alignRight` to the subnav
72
+ object.
73
+ */
74
+ const Dropdown = exports.Dropdown = {
75
+ name: "Dropdown",
76
+ args: {
77
+ items: [{
78
+ items: [{
79
+ label: "Introduction",
80
+ url: "#"
81
+ }, {
82
+ label: "News",
83
+ url: "#"
84
+ }, {
85
+ label: "Getting started - Command line",
86
+ url: "#"
87
+ }, {
88
+ label: "Getting started - OpenStack",
89
+ url: "#"
90
+ }, {
91
+ label: "Getting started - OpenNebula",
92
+ url: "#"
93
+ }],
94
+ label: "LXD"
95
+ }, {
96
+ items: [{
97
+ label: "Introduction",
98
+ url: "#"
99
+ }, {
100
+ label: "News",
101
+ url: "#"
102
+ }, {
103
+ label: "Getting started",
104
+ url: "#"
105
+ }],
106
+ label: "LXCFS"
107
+ }],
108
+ itemsRight: [{
109
+ alignRight: true,
110
+ items: [{
111
+ label: "Sign out",
112
+ url: "#"
113
+ }],
114
+ label: "My account"
115
+ }],
116
+ logo: {
117
+ src: "https://assets.ubuntu.com/v1/82818827-CoF_white.svg",
118
+ title: "LXD",
119
+ url: "#"
120
+ }
121
+ }
122
+ };
123
+
124
+ /**
125
+ * Expanding search can be enabled by providing props to the underlying [`SearchBox`](/?path=/docs/searchbox--default-story)
126
+ component. Elements to toggle the Searchbox will be included automatically if
127
+ the SearchBox props are provided.
128
+ */
129
+ const Search = exports.Search = {
130
+ name: "Search",
131
+ args: {
132
+ items: [{
133
+ label: "Products",
134
+ url: "#"
135
+ }, {
136
+ label: "Services",
137
+ url: "#"
138
+ }, {
139
+ label: "Partners",
140
+ url: "#"
141
+ }],
142
+ logo: {
143
+ src: "https://assets.ubuntu.com/v1/82818827-CoF_white.svg",
144
+ title: "Canonical",
145
+ url: "#"
146
+ },
147
+ searchProps: {
148
+ onSearch: () => null
149
+ }
150
+ }
151
+ };
152
+
153
+ /**
154
+ * Logos can be displayed using the new tag design. In cases where another logo
155
+ style is required then an element can be provided to the `logo` prop.
156
+ */
157
+ const OverridingTheLogo = exports.OverridingTheLogo = {
158
+ name: "Overriding the logo",
159
+ args: {
160
+ items: [{
161
+ label: "Products",
162
+ url: "#"
163
+ }, {
164
+ label: "Services",
165
+ url: "#"
166
+ }, {
167
+ label: "Partners",
168
+ url: "#"
169
+ }],
170
+ logo: /*#__PURE__*/_react.default.createElement("img", {
171
+ alt: "",
172
+ src: "https://assets.ubuntu.com/v1/5d6da5c4-logo-canonical-aubergine.svg",
173
+ width: "100"
174
+ })
175
+ }
176
+ };
177
+
178
+ /**
179
+ * In some cases such as when using [React Router](https://reactrouter.com/) it is
180
+ necessary to use custom components for links. When this is required then a
181
+ function can be passed to `generateLink` which should return your component.
182
+ Bear in mind that some props like classes and on-click events might be passed to
183
+ this function so take care in overriding any link props.
184
+ */
185
+ const OverridingTheLinkComponent = exports.OverridingTheLinkComponent = {
186
+ name: "Overriding the link component",
187
+ args: {
188
+ generateLink: _ref => {
189
+ let {
190
+ label,
191
+ className
192
+ } = _ref;
193
+ return /*#__PURE__*/_react.default.createElement("button", {
194
+ className: className
195
+ }, label);
196
+ },
197
+ items: [{
198
+ label: "Products",
199
+ url: "#"
200
+ }, {
201
+ label: "Services",
202
+ url: "#"
203
+ }, {
204
+ label: "Partners",
205
+ url: "#"
206
+ }],
207
+ logo: {
208
+ src: "https://assets.ubuntu.com/v1/82818827-CoF_white.svg",
209
+ title: "Canonical",
210
+ url: "#"
211
+ }
212
+ }
213
+ };
214
+ const NoMenuItems = exports.NoMenuItems = {
215
+ name: "No menu items",
216
+ args: {
217
+ generateLink: _ref2 => {
218
+ let {
219
+ label,
220
+ className
221
+ } = _ref2;
222
+ return /*#__PURE__*/_react.default.createElement("button", {
223
+ className: className
224
+ }, label);
225
+ },
226
+ logo: {
227
+ src: "https://assets.ubuntu.com/v1/82818827-CoF_white.svg",
228
+ title: "Canonical",
229
+ url: "#"
230
+ }
231
+ }
232
+ };
@@ -81,5 +81,30 @@ export type Props = PropsWithSpread<{
81
81
  */
82
82
  type?: never;
83
83
  }, HTMLProps<HTMLDivElement>>;
84
+ /**
85
+ This is a [React](https://reactjs.org/) component for the Vanilla [Notification](https://docs.vanillaframework.io/patterns/notification/).
86
+
87
+ Notifications are used to display global information, our notification variants consist of default, caution, negative or positive.
88
+
89
+ The `NotificationProvider` component can be used to manage the notification state globally. Wrap your application components with it and then in any child component you can get the helper with `const notify = useNotify()` to easily trigger notifications:
90
+
91
+ * `notify.info("You should keep this in mind")`
92
+ * `notify.failure("Error when fooing a bar", errorObjectFromCatch)`
93
+ * `notify.success("The bar was foo'd", "Success")`
94
+
95
+ The `NotificationConsumer` component can be used to display notifications. It will automatically display any notifications that are added to the `NotificationProvider` state.
96
+
97
+ The Notification API has changed since v0.18 in order to support new variants
98
+ and align with our component prop naming conventions.
99
+
100
+ | Deprecated prop names | Replaced by |
101
+ | --------------------- | ----------- |
102
+ | `type` | `severity` |
103
+ | `status` | `title` |
104
+ | `close` | `onDismiss` |
105
+
106
+ The `notificationTypes` const has also been replaced with `NotificationSeverity`
107
+ to reflect the new prop name.
108
+ */
84
109
  declare const Notification: ({ actions, borderless, children, className, close, inline, onDismiss, severity, status, timeout, timestamp, title, titleElement: TitleComponent, type, ...props }: Props) => JSX.Element;
85
110
  export default Notification;
@@ -33,6 +33,31 @@ const DefaultTitles = exports.DefaultTitles = {
33
33
  * The props for the Notification component.
34
34
  */
35
35
 
36
+ /**
37
+ This is a [React](https://reactjs.org/) component for the Vanilla [Notification](https://docs.vanillaframework.io/patterns/notification/).
38
+
39
+ Notifications are used to display global information, our notification variants consist of default, caution, negative or positive.
40
+
41
+ The `NotificationProvider` component can be used to manage the notification state globally. Wrap your application components with it and then in any child component you can get the helper with `const notify = useNotify()` to easily trigger notifications:
42
+
43
+ * `notify.info("You should keep this in mind")`
44
+ * `notify.failure("Error when fooing a bar", errorObjectFromCatch)`
45
+ * `notify.success("The bar was foo'd", "Success")`
46
+
47
+ The `NotificationConsumer` component can be used to display notifications. It will automatically display any notifications that are added to the `NotificationProvider` state.
48
+
49
+ The Notification API has changed since v0.18 in order to support new variants
50
+ and align with our component prop naming conventions.
51
+
52
+ | Deprecated prop names | Replaced by |
53
+ | --------------------- | ----------- |
54
+ | `type` | `severity` |
55
+ | `status` | `title` |
56
+ | `close` | `onDismiss` |
57
+
58
+ The `notificationTypes` const has also been replaced with `NotificationSeverity`
59
+ to reflect the new prop name.
60
+ */
36
61
  const Notification = _ref => {
37
62
  let {
38
63
  actions,
@@ -0,0 +1,45 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import Notification from "./Notification";
3
+ declare const meta: Meta<typeof Notification>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Notification>;
6
+ /**
7
+ * The information severity should be used to convey an information message.
8
+ */
9
+ export declare const Information: Story;
10
+ /**
11
+ * The caution severity should be used to convey information that is not critical but the user should be aware of.
12
+ */
13
+ export declare const Caution: Story;
14
+ /**
15
+ * The negative severity should be used to convey information that is critical and the user should take action.
16
+ */
17
+ export declare const Negative: Story;
18
+ /**
19
+ * The positive severity should be used to convey success or completion.
20
+ */
21
+ export declare const Positive: Story;
22
+ /**
23
+ * When vertical space is limited, you can use the inline variant.
24
+ */
25
+ export declare const Inline: Story;
26
+ /**
27
+ * In cases where a notification sits inside another component, such as a table cell or a card, it may be useful to remove the outer border and highlight bar.
28
+ */
29
+ export declare const Borderless: Story;
30
+ /**
31
+ * Actions will appear below the notification message.
32
+ */
33
+ export declare const Actions: Story;
34
+ /**
35
+ * Notifications that can be dismissed should be given an onDismiss function.
36
+ */
37
+ export declare const Dismissible: Story;
38
+ /**
39
+ * Notifications can be automatically dismissed after a timeout interval.
40
+ */
41
+ export declare const Timeout: Story;
42
+ /**
43
+ * For notifications in which recency is important, you can include a section for time.
44
+ */
45
+ export declare const Timestamp: Story;
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Timestamp = exports.Timeout = exports.Positive = exports.Negative = exports.Inline = exports.Information = exports.Dismissible = exports.Caution = exports.Borderless = exports.Actions = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Notification = _interopRequireWildcard(require("./Notification"));
9
+ 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); }
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
+ const meta = {
12
+ component: _Notification.default,
13
+ tags: ["autodocs"],
14
+ argTypes: {
15
+ borderless: {
16
+ control: {
17
+ type: "boolean"
18
+ }
19
+ },
20
+ children: {
21
+ control: {
22
+ type: "text"
23
+ }
24
+ },
25
+ inline: {
26
+ control: {
27
+ type: "boolean"
28
+ }
29
+ },
30
+ severity: {
31
+ control: {
32
+ type: "radio"
33
+ },
34
+ options: Object.values(_Notification.NotificationSeverity)
35
+ },
36
+ timestamp: {
37
+ control: {
38
+ type: "text"
39
+ }
40
+ },
41
+ title: {
42
+ control: {
43
+ type: "text"
44
+ }
45
+ }
46
+ },
47
+ args: {
48
+ borderless: false,
49
+ inline: false,
50
+ severity: _Notification.NotificationSeverity.INFORMATION
51
+ }
52
+ };
53
+ var _default = exports.default = meta;
54
+ /**
55
+ * The information severity should be used to convey an information message.
56
+ */
57
+ const Information = exports.Information = {
58
+ name: "Information",
59
+ args: {
60
+ children: "Anyone with access can view your invited users.",
61
+ severity: "information",
62
+ title: "Permissions changed"
63
+ }
64
+ };
65
+
66
+ /**
67
+ * The caution severity should be used to convey information that is not critical but the user should be aware of.
68
+ */
69
+ const Caution = exports.Caution = {
70
+ name: "Caution",
71
+ args: {
72
+ children: "Custom storage configuration is only supported on Ubuntu, CentOS and RHEL.",
73
+ severity: "caution",
74
+ title: "Blocked"
75
+ }
76
+ };
77
+
78
+ /**
79
+ * The negative severity should be used to convey information that is critical and the user should take action.
80
+ */
81
+ const Negative = exports.Negative = {
82
+ name: "Negative",
83
+ args: {
84
+ children: "Node must be connected to a network.",
85
+ severity: "negative",
86
+ title: "Error"
87
+ }
88
+ };
89
+
90
+ /**
91
+ * The positive severity should be used to convey success or completion.
92
+ */
93
+ const Positive = exports.Positive = {
94
+ name: "Positive",
95
+ args: {
96
+ children: "Code successfully reformatted.",
97
+ severity: "positive",
98
+ title: "Success"
99
+ }
100
+ };
101
+
102
+ /**
103
+ * When vertical space is limited, you can use the inline variant.
104
+ */
105
+ const Inline = exports.Inline = {
106
+ name: "Inline",
107
+ args: {
108
+ children: "Not enough space.",
109
+ inline: true,
110
+ severity: "negative",
111
+ title: "Error:"
112
+ }
113
+ };
114
+
115
+ /**
116
+ * In cases where a notification sits inside another component, such as a table cell or a card, it may be useful to remove the outer border and highlight bar.
117
+ */
118
+ const Borderless = exports.Borderless = {
119
+ name: "Borderless",
120
+ args: {
121
+ borderless: true,
122
+ children: "Only 8GB storage remaining.",
123
+ severity: "caution",
124
+ title: "Warning"
125
+ }
126
+ };
127
+
128
+ /**
129
+ * Actions will appear below the notification message.
130
+ */
131
+ const Actions = exports.Actions = {
132
+ name: "Actions",
133
+ args: {
134
+ actions: [{
135
+ label: "Action 1",
136
+ onClick: () => null
137
+ }, {
138
+ label: "Action 2",
139
+ onClick: () => null
140
+ }],
141
+ children: "Body lorem ipsum dolor sit amet consequiteor. Lorem ipsum dolor sit amet consequiteor.",
142
+ severity: "information",
143
+ title: "Title"
144
+ }
145
+ };
146
+
147
+ /**
148
+ * Notifications that can be dismissed should be given an onDismiss function.
149
+ */
150
+ const Dismissible = exports.Dismissible = {
151
+ render: () => {
152
+ // eslint-disable-next-line react-hooks/rules-of-hooks
153
+ const [show, setShow] = (0, _react.useState)(true);
154
+ if (!show) {
155
+ return null;
156
+ }
157
+ return /*#__PURE__*/_react.default.createElement(_Notification.default, {
158
+ onDismiss: () => setShow(false),
159
+ title: "Dismissible"
160
+ }, "Click the dismiss button to get rid of me.");
161
+ },
162
+ name: "Dismissible"
163
+ };
164
+
165
+ /**
166
+ * Notifications can be automatically dismissed after a timeout interval.
167
+ */
168
+ const Timeout = exports.Timeout = {
169
+ render: () => {
170
+ // eslint-disable-next-line react-hooks/rules-of-hooks
171
+ const [show, setShow] = (0, _react.useState)(true);
172
+ // eslint-disable-next-line react-hooks/rules-of-hooks
173
+ const [timer, setTimer] = (0, _react.useState)(0);
174
+ if (!show) {
175
+ return null;
176
+ }
177
+ return /*#__PURE__*/_react.default.createElement(_Notification.default, {
178
+ actions: [{
179
+ label: "Start timer",
180
+ onClick: () => setTimer(3000)
181
+ }],
182
+ onDismiss: () => setShow(false),
183
+ timeout: timer,
184
+ title: "Timeout"
185
+ }, "Click the action to start a 3 second timer.");
186
+ },
187
+ name: "Timeout"
188
+ };
189
+
190
+ /**
191
+ * For notifications in which recency is important, you can include a section for time.
192
+ */
193
+ const Timestamp = exports.Timestamp = {
194
+ name: "Timestamp",
195
+ args: {
196
+ children: "Body lorem ipsum dolor sit amet consequiteor. Lorem ipsum dolor sit amet consequiteor.",
197
+ severity: "information",
198
+ timestamp: "1h ago",
199
+ title: "Title"
200
+ }
201
+ };
@@ -86,5 +86,17 @@ type ButtonsOnlyPagination = BaseProps & {
86
86
  onBack: () => void;
87
87
  };
88
88
  export type Props = PropsWithSpread<NumberedPagination | ButtonsOnlyPagination, HTMLProps<HTMLElement>>;
89
+ /**
90
+ This is a [React](https://reactjs.org/) component for the Vanilla [Pagination](https://docs.vanillaframework.io/patterns/pagination/).
91
+
92
+ The pagination component should be used to navigate between pages of content. There are two types of pagination being provided:
93
+
94
+ * **Numbered Pagination:** used when the total number of items is known.<br />
95
+ Depending on the length provided, the pagination component will automatically scale.<br />
96
+ **Required props:** itemsPerPage, totalItems, paginate, currentPage.
97
+
98
+ * **Buttons-only Pagination:** used when the total number of items is unknown.<br />
99
+ **Required props:** onForward, onBack.
100
+ */
89
101
  declare const Pagination: ({ itemsPerPage, totalItems, paginate, currentPage, scrollToTop, truncateThreshold, centered, showLabels, hideNumbers, onForward, onBack, forwardDisabled, backDisabled, forwardLabel, backLabel, ...navProps }: Props) => JSX.Element;
90
102
  export default Pagination;
@@ -90,6 +90,18 @@ const PaginationItemSeparator = () => /*#__PURE__*/_react.default.createElement(
90
90
  // current page and paginate function are undefined.
91
91
  // Pagination is handled by onForward and onBack function.
92
92
 
93
+ /**
94
+ This is a [React](https://reactjs.org/) component for the Vanilla [Pagination](https://docs.vanillaframework.io/patterns/pagination/).
95
+
96
+ The pagination component should be used to navigate between pages of content. There are two types of pagination being provided:
97
+
98
+ * **Numbered Pagination:** used when the total number of items is known.<br />
99
+ Depending on the length provided, the pagination component will automatically scale.<br />
100
+ **Required props:** itemsPerPage, totalItems, paginate, currentPage.
101
+
102
+ * **Buttons-only Pagination:** used when the total number of items is unknown.<br />
103
+ **Required props:** onForward, onBack.
104
+ */
93
105
  const Pagination = _ref => {
94
106
  let {
95
107
  itemsPerPage,
@@ -0,0 +1,14 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import Pagination from "./Pagination";
3
+ declare const meta: Meta<typeof Pagination>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Pagination>;
6
+ export declare const Default: Story;
7
+ export declare const TruncatedNumberedPagination: Story;
8
+ export declare const DisabledControlsNumberedPagination: Story;
9
+ export declare const CenteredNumberedPagination: Story;
10
+ export declare const DisabledPaginationItemsNumberedPagination: Story;
11
+ export declare const DefaultButtonsOnlyPagination: Story;
12
+ export declare const DefaultButtonLabelsButtonsOnlyPagination: Story;
13
+ export declare const CustomButtonLabelsButtonsOnlyPagination: Story;
14
+ export declare const CenteredButtonsOnlyPagination: Story;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.TruncatedNumberedPagination = exports.DisabledPaginationItemsNumberedPagination = exports.DisabledControlsNumberedPagination = exports.DefaultButtonsOnlyPagination = exports.DefaultButtonLabelsButtonsOnlyPagination = exports.Default = exports.CustomButtonLabelsButtonsOnlyPagination = exports.CenteredNumberedPagination = exports.CenteredButtonsOnlyPagination = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _Pagination = _interopRequireDefault(require("./Pagination"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const meta = {
11
+ component: _Pagination.default,
12
+ tags: ["autodocs"]
13
+ };
14
+ var _default = exports.default = meta;
15
+ const Default = exports.Default = {
16
+ name: "Default",
17
+ args: {
18
+ itemsPerPage: 20,
19
+ totalItems: 100,
20
+ paginate: () => {},
21
+ currentPage: 3
22
+ }
23
+ };
24
+ const TruncatedNumberedPagination = exports.TruncatedNumberedPagination = {
25
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
26
+ itemsPerPage: 10,
27
+ totalItems: 1000,
28
+ paginate: () => {},
29
+ currentPage: 34
30
+ }),
31
+ name: "Truncated (Numbered Pagination)"
32
+ };
33
+ const DisabledControlsNumberedPagination = exports.DisabledControlsNumberedPagination = {
34
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
35
+ itemsPerPage: 20,
36
+ totalItems: 100,
37
+ paginate: () => {},
38
+ currentPage: 1
39
+ }),
40
+ name: "Disabled controls (Numbered Pagination)"
41
+ };
42
+ const CenteredNumberedPagination = exports.CenteredNumberedPagination = {
43
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
44
+ itemsPerPage: 10,
45
+ totalItems: 50,
46
+ paginate: () => {},
47
+ currentPage: 1,
48
+ centered: true
49
+ }),
50
+ name: "Centered (Numbered Pagination)"
51
+ };
52
+ const DisabledPaginationItemsNumberedPagination = exports.DisabledPaginationItemsNumberedPagination = {
53
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
54
+ itemsPerPage: 10,
55
+ totalItems: 50,
56
+ paginate: () => {},
57
+ currentPage: 1,
58
+ hideNumbers: true
59
+ }),
60
+ name: "Disabled pagination items (Numbered Pagination)"
61
+ };
62
+ const DefaultButtonsOnlyPagination = exports.DefaultButtonsOnlyPagination = {
63
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
64
+ onForward: () => {},
65
+ onBack: () => {}
66
+ }),
67
+ name: "Default (Buttons-only Pagination)"
68
+ };
69
+ const DefaultButtonLabelsButtonsOnlyPagination = exports.DefaultButtonLabelsButtonsOnlyPagination = {
70
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
71
+ onForward: () => {},
72
+ onBack: () => {},
73
+ showLabels: true
74
+ }),
75
+ name: "Default button labels (Buttons-only Pagination)"
76
+ };
77
+ const CustomButtonLabelsButtonsOnlyPagination = exports.CustomButtonLabelsButtonsOnlyPagination = {
78
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
79
+ onForward: () => {},
80
+ onBack: () => {},
81
+ showLabels: true,
82
+ forwardLabel: "Custom forward label",
83
+ backLabel: "Custom back label"
84
+ }),
85
+ name: "Custom button labels (Buttons-only Pagination)"
86
+ };
87
+ const CenteredButtonsOnlyPagination = exports.CenteredButtonsOnlyPagination = {
88
+ render: () => /*#__PURE__*/_react.default.createElement(_Pagination.default, {
89
+ onForward: () => {},
90
+ onBack: () => {},
91
+ centered: true
92
+ }),
93
+ name: "Centered (Buttons-only Pagination)"
94
+ };