@canonical/react-components 1.3.0 → 1.3.2

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 (174) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +46 -0
  2. package/dist/components/Accordion/AccordionSection/AccordionSection.d.ts +34 -0
  3. package/dist/components/Accordion/AccordionSection/index.d.ts +2 -0
  4. package/dist/components/Accordion/index.d.ts +2 -0
  5. package/dist/components/ActionButton/ActionButton.d.ts +48 -0
  6. package/dist/components/ActionButton/index.d.ts +2 -0
  7. package/dist/components/ApplicationLayout/AppAside/AppAside.d.ts +33 -0
  8. package/dist/components/ApplicationLayout/AppAside/index.d.ts +2 -0
  9. package/dist/components/ApplicationLayout/AppMain/AppMain.d.ts +14 -0
  10. package/dist/components/ApplicationLayout/AppMain/index.d.ts +2 -0
  11. package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.d.ts +26 -0
  12. package/dist/components/ApplicationLayout/AppNavigation/index.d.ts +2 -0
  13. package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.d.ts +18 -0
  14. package/dist/components/ApplicationLayout/AppNavigationBar/index.d.ts +2 -0
  15. package/dist/components/ApplicationLayout/AppStatus/AppStatus.d.ts +14 -0
  16. package/dist/components/ApplicationLayout/AppStatus/index.d.ts +2 -0
  17. package/dist/components/ApplicationLayout/Application/Application.d.ts +15 -0
  18. package/dist/components/ApplicationLayout/Application/index.d.ts +2 -0
  19. package/dist/components/ApplicationLayout/ApplicationLayout.d.ts +89 -0
  20. package/dist/components/ApplicationLayout/index.d.ts +7 -0
  21. package/dist/components/ArticlePagination/ArticlePagination.d.ts +31 -0
  22. package/dist/components/ArticlePagination/index.d.ts +2 -0
  23. package/dist/components/Badge/Badge.d.ts +34 -0
  24. package/dist/components/Badge/index.d.ts +2 -0
  25. package/dist/components/Button/Button.d.ts +64 -0
  26. package/dist/components/Button/index.d.ts +2 -0
  27. package/dist/components/Card/Card.d.ts +35 -0
  28. package/dist/components/Card/index.d.ts +2 -0
  29. package/dist/components/CheckboxInput/CheckableInput/CheckableInput.d.ts +27 -0
  30. package/dist/components/CheckboxInput/CheckableInput/index.d.ts +2 -0
  31. package/dist/components/CheckboxInput/CheckboxInput.d.ts +9 -0
  32. package/dist/components/CheckboxInput/index.d.ts +2 -0
  33. package/dist/components/Chip/Chip.d.ts +56 -0
  34. package/dist/components/Chip/index.d.ts +2 -0
  35. package/dist/components/Code/Code.d.ts +13 -0
  36. package/dist/components/Code/index.d.ts +2 -0
  37. package/dist/components/CodeSnippet/CodeSnippet.d.ts +21 -0
  38. package/dist/components/CodeSnippet/CodeSnippetBlock.d.ts +40 -0
  39. package/dist/components/CodeSnippet/CodeSnippetDropdown.d.ts +18 -0
  40. package/dist/components/CodeSnippet/index.d.ts +5 -0
  41. package/dist/components/Col/Col.d.ts +53 -0
  42. package/dist/components/Col/index.d.ts +2 -0
  43. package/dist/components/ConfirmationButton/ConfirmationButton.d.ts +28 -0
  44. package/dist/components/ConfirmationButton/index.d.ts +2 -0
  45. package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +53 -0
  46. package/dist/components/ConfirmationModal/index.d.ts +2 -0
  47. package/dist/components/ContextualMenu/ContextualMenu.d.ts +110 -0
  48. package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +43 -0
  49. package/dist/components/ContextualMenu/ContextualMenuDropdown/index.d.ts +2 -0
  50. package/dist/components/ContextualMenu/index.d.ts +3 -0
  51. package/dist/components/EmptyState/EmptyState.d.ts +25 -0
  52. package/dist/components/EmptyState/index.d.ts +2 -0
  53. package/dist/components/Field/Field.d.ts +77 -0
  54. package/dist/components/Field/index.d.ts +2 -0
  55. package/dist/components/Form/Form.d.ts +21 -0
  56. package/dist/components/Form/index.d.ts +2 -0
  57. package/dist/components/FormikField/FormikField.d.ts +25 -0
  58. package/dist/components/FormikField/index.d.ts +1 -0
  59. package/dist/components/Icon/Icon.d.ts +59 -0
  60. package/dist/components/Icon/index.d.ts +2 -0
  61. package/dist/components/Input/Input.d.ts +70 -0
  62. package/dist/components/Input/index.d.ts +2 -0
  63. package/dist/components/Label/Label.d.ts +25 -0
  64. package/dist/components/Label/index.d.ts +2 -0
  65. package/dist/components/Link/Link.d.ts +31 -0
  66. package/dist/components/Link/index.d.ts +2 -0
  67. package/dist/components/List/List.d.ts +36 -0
  68. package/dist/components/List/index.d.ts +2 -0
  69. package/dist/components/Loader/Loader.d.ts +6 -0
  70. package/dist/components/Loader/index.d.ts +1 -0
  71. package/dist/components/LoginPageLayout/LoginPageLayout.d.ts +17 -0
  72. package/dist/components/LoginPageLayout/index.d.ts +2 -0
  73. package/dist/components/MainTable/MainTable.d.ts +102 -0
  74. package/dist/components/MainTable/index.d.ts +2 -0
  75. package/dist/components/Modal/Modal.d.ts +36 -0
  76. package/dist/components/Modal/index.d.ts +2 -0
  77. package/dist/components/ModularTable/ModularTable.d.ts +105 -0
  78. package/dist/components/ModularTable/index.d.ts +2 -0
  79. package/dist/components/MultiSelect/FadeInDown/FadeInDown.d.ts +10 -0
  80. package/dist/components/MultiSelect/FadeInDown/index.d.ts +1 -0
  81. package/dist/components/MultiSelect/MultiSelect.d.ts +57 -0
  82. package/dist/components/MultiSelect/index.d.ts +1 -0
  83. package/dist/components/Navigation/Navigation.d.ts +66 -0
  84. package/dist/components/Navigation/NavigationLink/NavigationLink.d.ts +10 -0
  85. package/dist/components/Navigation/NavigationLink/index.d.ts +1 -0
  86. package/dist/components/Navigation/NavigationMenu/NavigationMenu.d.ts +11 -0
  87. package/dist/components/Navigation/NavigationMenu/index.d.ts +1 -0
  88. package/dist/components/Navigation/index.d.ts +3 -0
  89. package/dist/components/Navigation/types.d.ts +64 -0
  90. package/dist/components/Notification/Notification.d.ts +110 -0
  91. package/dist/components/Notification/index.d.ts +2 -0
  92. package/dist/components/NotificationProvider/NotificationProvider.d.ts +5 -0
  93. package/dist/components/NotificationProvider/index.d.ts +3 -0
  94. package/dist/components/NotificationProvider/messageBuilder.d.ts +6 -0
  95. package/dist/components/NotificationProvider/types.d.ts +35 -0
  96. package/dist/components/Pagination/Pagination.d.ts +102 -0
  97. package/dist/components/Pagination/PaginationButton/PaginationButton.d.ts +30 -0
  98. package/dist/components/Pagination/PaginationButton/index.d.ts +2 -0
  99. package/dist/components/Pagination/PaginationItem/PaginationItem.d.ts +17 -0
  100. package/dist/components/Pagination/PaginationItem/index.d.ts +2 -0
  101. package/dist/components/Pagination/index.d.ts +2 -0
  102. package/dist/components/Panel/Panel.d.ts +123 -0
  103. package/dist/components/Panel/index.d.ts +1 -0
  104. package/dist/components/PasswordToggle/PasswordToggle.d.ts +108 -0
  105. package/dist/components/PasswordToggle/index.d.ts +2 -0
  106. package/dist/components/RadioInput/RadioInput.d.ts +9 -0
  107. package/dist/components/RadioInput/index.d.ts +2 -0
  108. package/dist/components/Row/Row.d.ts +19 -0
  109. package/dist/components/Row/index.d.ts +2 -0
  110. package/dist/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.d.ts +25 -0
  111. package/dist/components/SearchAndFilter/FilterPanelSection/index.d.ts +1 -0
  112. package/dist/components/SearchAndFilter/SearchAndFilter.d.ts +33 -0
  113. package/dist/components/SearchAndFilter/index.d.ts +2 -0
  114. package/dist/components/SearchAndFilter/types.d.ts +11 -0
  115. package/dist/components/SearchAndFilter/utils.d.ts +13 -0
  116. package/dist/components/SearchBox/SearchBox.d.ts +63 -0
  117. package/dist/components/SearchBox/index.d.ts +2 -0
  118. package/dist/components/Select/Select.d.ts +71 -0
  119. package/dist/components/Select/index.d.ts +2 -0
  120. package/dist/components/SideNavigation/SideNavigation.d.ts +50 -0
  121. package/dist/components/SideNavigation/SideNavigationBase/SideNavigationBase.d.ts +31 -0
  122. package/dist/components/SideNavigation/SideNavigationBase/index.d.ts +1 -0
  123. package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.d.ts +20 -0
  124. package/dist/components/SideNavigation/SideNavigationItem/index.d.ts +1 -0
  125. package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.d.ts +18 -0
  126. package/dist/components/SideNavigation/SideNavigationLink/index.d.ts +1 -0
  127. package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.d.ts +7 -0
  128. package/dist/components/SideNavigation/SideNavigationText/index.d.ts +1 -0
  129. package/dist/components/SideNavigation/index.d.ts +5 -0
  130. package/dist/components/Slider/Slider.d.ts +62 -0
  131. package/dist/components/Slider/index.d.ts +2 -0
  132. package/dist/components/Spinner/Spinner.d.ts +29 -0
  133. package/dist/components/Spinner/index.d.ts +2 -0
  134. package/dist/components/StatusLabel/StatusLabel.d.ts +33 -0
  135. package/dist/components/StatusLabel/index.d.ts +2 -0
  136. package/dist/components/Strip/Strip.d.ts +64 -0
  137. package/dist/components/Strip/index.d.ts +2 -0
  138. package/dist/components/SummaryButton/SummaryButton.d.ts +29 -0
  139. package/dist/components/SummaryButton/index.d.ts +2 -0
  140. package/dist/components/Switch/Switch.d.ts +17 -0
  141. package/dist/components/Switch/index.d.ts +2 -0
  142. package/dist/components/Table/Table.d.ts +22 -0
  143. package/dist/components/Table/index.d.ts +2 -0
  144. package/dist/components/TableCell/TableCell.d.ts +26 -0
  145. package/dist/components/TableCell/index.d.ts +2 -0
  146. package/dist/components/TableHeader/TableHeader.d.ts +14 -0
  147. package/dist/components/TableHeader/index.d.ts +2 -0
  148. package/dist/components/TablePagination/TablePagination.d.ts +98 -0
  149. package/dist/components/TablePagination/TablePaginationControls/TablePaginationControls.d.ts +24 -0
  150. package/dist/components/TablePagination/TablePaginationControls/index.d.ts +2 -0
  151. package/dist/components/TablePagination/index.d.ts +2 -0
  152. package/dist/components/TablePagination/utils.d.ts +27 -0
  153. package/dist/components/TableRow/TableRow.d.ts +10 -0
  154. package/dist/components/TableRow/index.d.ts +2 -0
  155. package/dist/components/Tabs/Tabs.d.ts +45 -0
  156. package/dist/components/Tabs/index.d.ts +2 -0
  157. package/dist/components/Textarea/Textarea.d.ts +70 -0
  158. package/dist/components/Textarea/index.d.ts +2 -0
  159. package/dist/components/Tooltip/Tooltip.d.ts +75 -0
  160. package/dist/components/Tooltip/index.d.ts +2 -0
  161. package/dist/enums.d.ts +13 -0
  162. package/dist/hooks/index.d.ts +9 -0
  163. package/dist/hooks/useId.d.ts +4 -0
  164. package/dist/hooks/useListener.d.ts +11 -0
  165. package/dist/hooks/useOnClickOutside.d.ts +12 -0
  166. package/dist/hooks/useOnEscapePressed.d.ts +6 -0
  167. package/dist/hooks/usePagination.d.ts +19 -0
  168. package/dist/hooks/usePrevious.d.ts +7 -0
  169. package/dist/hooks/useThrottle.d.ts +9 -0
  170. package/dist/hooks/useWindowFitment.d.ts +54 -0
  171. package/dist/index.d.ts +132 -0
  172. package/dist/types/index.d.ts +38 -0
  173. package/dist/utils.d.ts +27 -0
  174. package/package.json +9 -10
@@ -0,0 +1,33 @@
1
+ import type { HTMLProps, ReactNode } from "react";
2
+ import { ClassName, PropsWithSpread, ValueOf } from "../../types";
3
+ export declare const StatusLabelAppearance: {
4
+ readonly CAUTION: "caution";
5
+ readonly DEFAULT: "";
6
+ readonly INFORMATION: "information";
7
+ readonly NEGATIVE: "negative";
8
+ readonly POSITIVE: "positive";
9
+ };
10
+ /**
11
+ * The type of the StatusLabel props.
12
+ */
13
+ export type Props = PropsWithSpread<{
14
+ /**
15
+ * The appearance of the label.
16
+ */
17
+ appearance?: ValueOf<typeof StatusLabelAppearance> | string;
18
+ /**
19
+ * The content of the label.
20
+ */
21
+ children?: ReactNode;
22
+ /**
23
+ * Optional class(es) to pass to the wrapping element.
24
+ */
25
+ className?: ClassName;
26
+ }, HTMLProps<HTMLDivElement>>;
27
+ /**
28
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Label](https://vanillaframework.io/docs/patterns/labels).
29
+ *
30
+ * Labels are static elements which you can apply to signify status, tags or any other information you find useful.
31
+ */
32
+ declare const StatusLabel: ({ appearance, children, className, ...labelProps }: Props) => JSX.Element;
33
+ export default StatusLabel;
@@ -0,0 +1,2 @@
1
+ export { default, StatusLabelAppearance } from "./StatusLabel";
2
+ export type { Props as StatusLabelProps } from "./StatusLabel";
@@ -0,0 +1,64 @@
1
+ import type { ElementType, HTMLProps, ReactNode } from "react";
2
+ import type { ColSize } from "../Col/Col";
3
+ import type { ClassName, PropsWithSpread } from "../../types";
4
+ export type Props = PropsWithSpread<{
5
+ /**
6
+ * The content of the strip.
7
+ */
8
+ children: ReactNode;
9
+ /**
10
+ * A background images for the strip.
11
+ */
12
+ background?: string;
13
+ /**
14
+ * Whether the strip should display borders.
15
+ */
16
+ bordered?: boolean;
17
+ /**
18
+ * Optional classes for the strip.
19
+ */
20
+ className?: ClassName;
21
+ /**
22
+ * The width of the column if `includeCol` has been set.
23
+ */
24
+ colSize?: ColSize;
25
+ /**
26
+ * Whether the strip should be dark.
27
+ */
28
+ dark?: boolean;
29
+ /**
30
+ * Whether the strip should be deep.
31
+ */
32
+ deep?: boolean;
33
+ /**
34
+ * The base HTML element of the strip.
35
+ */
36
+ element?: ElementType;
37
+ /**
38
+ * Whether the strip should wrap the content in a column.
39
+ */
40
+ includeCol?: boolean;
41
+ /**
42
+ * Whether the strip should be light.
43
+ */
44
+ light?: boolean;
45
+ /**
46
+ * Optional classes to apply to the row.
47
+ */
48
+ rowClassName?: string;
49
+ /**
50
+ * Whether the strip should be shallow.
51
+ */
52
+ shallow?: boolean;
53
+ /**
54
+ * The type of the strip (e.g. "accent" or "image").
55
+ */
56
+ type?: string;
57
+ }, HTMLProps<HTMLElement>>;
58
+ /**
59
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Strip](https://docs.vanillaframework.io/patterns/strip/).
60
+ *
61
+ * The strip pattern provides a full width strip container in which to wrap a row.
62
+ */
63
+ declare const Strip: ({ background, bordered, children, className, colSize, dark, deep, includeCol, element: Component, light, rowClassName, shallow, type, ...props }: Props) => JSX.Element;
64
+ export default Strip;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Strip";
2
+ export type { Props as StripProps } from "./Strip";
@@ -0,0 +1,29 @@
1
+ import type { MouseEventHandler } from "react";
2
+ import type { ClassName } from "../../types";
3
+ export type Props = {
4
+ /**
5
+ * Optional class(es) to pass to the wrapping element.
6
+ */
7
+ className?: ClassName;
8
+ /**
9
+ * Whether the summary button is loading.
10
+ */
11
+ isLoading?: boolean;
12
+ /**
13
+ * The label of the summary button.
14
+ */
15
+ label: string;
16
+ /**
17
+ * Function to handle clicking the summary button.
18
+ */
19
+ onClick: MouseEventHandler<HTMLButtonElement>;
20
+ /**
21
+ * The summary content.
22
+ */
23
+ summary?: string;
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
+ */
28
+ declare const SummaryButton: ({ className, isLoading, summary, label, onClick, }: Props) => JSX.Element;
29
+ export default SummaryButton;
@@ -0,0 +1,2 @@
1
+ export { default } from "./SummaryButton";
2
+ export type { Props as SummaryButtonProps } from "./SummaryButton";
@@ -0,0 +1,17 @@
1
+ import type { HTMLProps, ReactNode } from "react";
2
+ import type { PropsWithSpread } from "../../types";
3
+ export type Props = PropsWithSpread<{
4
+ /**
5
+ * The label name for the switch
6
+ */
7
+ label: ReactNode;
8
+ /**
9
+ * Whether the switch is disabled or not
10
+ */
11
+ disabled?: boolean;
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
+ */
16
+ export declare const Switch: ({ label, disabled, ...inputProps }: Props) => JSX.Element;
17
+ export default Switch;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Switch";
2
+ export type { Props as SwitchProps } from "./Switch";
@@ -0,0 +1,22 @@
1
+ import { HTMLProps, ReactNode } from "react";
2
+ import type { ClassName, PropsWithSpread } from "../../types";
3
+ export type Props = PropsWithSpread<{
4
+ /**
5
+ * The content of the table.
6
+ */
7
+ children?: ReactNode;
8
+ /**
9
+ * Optional class(es) to pass to the wrapping table element.
10
+ */
11
+ className?: ClassName;
12
+ /**
13
+ * Whether the table can expand hidden cells.
14
+ */
15
+ expanding?: boolean;
16
+ /**
17
+ * Whether the table should show card styling on smaller screens.
18
+ */
19
+ responsive?: boolean;
20
+ }, HTMLProps<HTMLTableElement>>;
21
+ declare const Table: ({ children, className, expanding, responsive, ...props }: Props) => JSX.Element;
22
+ export default Table;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Table";
2
+ export type { Props as TableProps } from "./Table";
@@ -0,0 +1,26 @@
1
+ import { HTMLProps, ReactNode } from "react";
2
+ import type { ClassName, PropsWithSpread } from "../../types";
3
+ export type Props = PropsWithSpread<{
4
+ /**
5
+ * The content of the table cell.
6
+ */
7
+ children?: ReactNode;
8
+ /**
9
+ * Optional class(es) to pass to the wrapping td element.
10
+ */
11
+ className?: ClassName;
12
+ /**
13
+ * Whether the cell is an expanded cell.
14
+ */
15
+ expanding?: boolean;
16
+ /**
17
+ * Whether content of the cell should be able to overflow, e.g. a dropdown.
18
+ */
19
+ hasOverflow?: boolean;
20
+ /**
21
+ * Whether the cell is currently hidden.
22
+ */
23
+ hidden?: boolean;
24
+ }, HTMLProps<HTMLTableCellElement>>;
25
+ declare const TableCell: ({ children, className, hasOverflow, expanding, hidden, role, ...props }: Props) => JSX.Element;
26
+ export default TableCell;
@@ -0,0 +1,2 @@
1
+ export { default } from "./TableCell";
2
+ export type { Props as TableCellProps } from "./TableCell";
@@ -0,0 +1,14 @@
1
+ import { HTMLProps, ReactNode } from "react";
2
+ import { PropsWithSpread, SortDirection } from "../../types";
3
+ export type Props = PropsWithSpread<{
4
+ /**
5
+ * The content of the table header.
6
+ */
7
+ children?: ReactNode;
8
+ /**
9
+ * The direction of sorting, if applicable.
10
+ */
11
+ sort?: SortDirection;
12
+ }, HTMLProps<HTMLTableHeaderCellElement>>;
13
+ declare const TableHeader: ({ children, sort, ...props }: Props) => JSX.Element;
14
+ export default TableHeader;
@@ -0,0 +1,2 @@
1
+ export { default } from "./TableHeader";
2
+ export type { Props as TableHeaderProps } from "./TableHeader";
@@ -0,0 +1,98 @@
1
+ import React, { HTMLAttributes, PropsWithChildren, ReactNode } from "react";
2
+ import "./TablePagination.scss";
3
+ export type BasePaginationProps = {
4
+ /**
5
+ * list of data elements to be paginated. This component is un-opinionated about
6
+ * the structure of the data but it should be identical to the data structure
7
+ * required by the child table component
8
+ */
9
+ data: unknown[];
10
+ /**
11
+ * prop name of the child table component that receives paginated data.
12
+ * default value is set to `rows`, which is the data prop for the `MainTable` component
13
+ */
14
+ dataForwardProp?: string;
15
+ /**
16
+ * the name of the item associated to each row within the table.
17
+ */
18
+ itemName?: string;
19
+ /**
20
+ * custom styling for the pagination container
21
+ */
22
+ className?: string;
23
+ /**
24
+ * custom description to be displayed by the pagination
25
+ */
26
+ description?: ReactNode;
27
+ /**
28
+ * custom per page limits express as an array of numbers.
29
+ */
30
+ pageLimits?: number[];
31
+ /**
32
+ * place the pagination component above or below the table?
33
+ */
34
+ position?: "above" | "below";
35
+ };
36
+ export type ExternalControlProps = BasePaginationProps & {
37
+ /**
38
+ * Whether the component will be controlled via external state.
39
+ */
40
+ externallyControlled?: true;
41
+ /**
42
+ * the total number of items available within the data. This prop is only relevant
43
+ * and will be required if `externallyControlled` is set to `true`.
44
+ */
45
+ totalItems: number;
46
+ /**
47
+ * the current page that's showing. This prop is only relevant and will be required
48
+ * if `externallyControlled` is set to `true`.
49
+ */
50
+ currentPage: number;
51
+ /**
52
+ * size per page. This prop is only relevant and will be required if
53
+ * `externallyControlled` is set to `true`.
54
+ */
55
+ pageSize: number;
56
+ /**
57
+ * callback indicating a page change event to the parent component.
58
+ * This prop is only relevant and will be required if `externallyControlled` is set
59
+ * to `true`.
60
+ */
61
+ onPageChange: (page: number) => void;
62
+ /**
63
+ * callback indicating a page size change event to the parent component.
64
+ * This prop is only relevant and will be required if `externallyControlled` is set
65
+ * to `true`.
66
+ */
67
+ onPageSizeChange: (pageSize: number) => void;
68
+ };
69
+ export type InternalControlProps = BasePaginationProps & {
70
+ /**
71
+ * Whether the component will be controlled via external state.
72
+ */
73
+ externallyControlled?: false;
74
+ };
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
+ */
97
+ declare const TablePagination: (props: Props) => React.JSX.Element;
98
+ export default TablePagination;
@@ -0,0 +1,24 @@
1
+ import { ButtonProps } from "../../Button";
2
+ import { HTMLAttributes } from "react";
3
+ import { BasePaginationProps, ExternalControlProps, InternalControlProps } from "../TablePagination";
4
+ export declare enum Label {
5
+ NEXT_PAGE = "Next page",
6
+ PREVIOUS_PAGE = "Previous page",
7
+ PAGE_NUMBER = "Page number"
8
+ }
9
+ export type AllProps = BasePaginationProps & InternalControlProps & ExternalControlProps;
10
+ export type Props = Omit<AllProps, "currentPage" | "data" | "dataForwardProp" | "externallyControlled" | "onPageChange" | "position" | "totalItems"> & {
11
+ currentPage?: AllProps["currentPage"];
12
+ displayDescription?: boolean;
13
+ onInputPageChange?: (page: number) => void;
14
+ nextButtonProps?: Partial<ButtonProps>;
15
+ onNextPage?: (page: number) => void;
16
+ onPageChange?: AllProps["onPageChange"];
17
+ onPreviousPage?: (page: number) => void;
18
+ previousButtonProps?: Partial<ButtonProps>;
19
+ totalItems?: AllProps["totalItems"];
20
+ visibleCount?: number;
21
+ showPageInput?: boolean;
22
+ } & HTMLAttributes<HTMLDivElement>;
23
+ declare const TablePaginationControls: ({ className, currentPage, description, displayDescription, onInputPageChange, itemName, nextButtonProps, onNextPage, onPageChange, onPageSizeChange, onPreviousPage, pageLimits, pageSize, previousButtonProps, showPageInput, totalItems, visibleCount, ...divProps }: Props) => JSX.Element;
24
+ export default TablePaginationControls;
@@ -0,0 +1,2 @@
1
+ export { default } from "./TablePaginationControls";
2
+ export type { Props as TablePaginationControlsProps } from "./TablePaginationControls";
@@ -0,0 +1,2 @@
1
+ export { default } from "./TablePagination";
2
+ export type { Props as TablePaginationProps } from "./TablePagination";
@@ -0,0 +1,27 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ /**
3
+ * Determine if we are working with a small screen.
4
+ * 'small screen' in this case is relative to the width of the description div
5
+ */
6
+ export declare const figureSmallScreen: () => boolean;
7
+ /**
8
+ * Iterate direct react child components and override the value of the prop specified by @param dataForwardProp
9
+ * for those child components.
10
+ * @param children - react node children to iterate
11
+ * @param dataForwardProp - the name of the prop from the children components to override
12
+ * @param data - actual data to be passed to the prop specified by @param dataForwardProp
13
+ */
14
+ export declare const renderChildren: (children: ReactNode, dataForwardProp: string, data: unknown[]) => ReactElement<any, string | import("react").JSXElementConstructor<any>>[];
15
+ export declare const DEFAULT_PAGE_LIMITS: number[];
16
+ export declare const generatePagingOptions: (pageLimits: number[]) => {
17
+ value: number;
18
+ label: string;
19
+ }[];
20
+ export declare const getDescription: ({ description, isSmallScreen, totalItems, itemName, visibleCount, }: {
21
+ description: ReactNode;
22
+ isSmallScreen: boolean;
23
+ totalItems: number;
24
+ itemName: string;
25
+ visibleCount: number;
26
+ }) => string | number | true | ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>;
27
+ export declare const useFigureSmallScreen: () => boolean;
@@ -0,0 +1,10 @@
1
+ import type { HTMLProps, ReactNode } from "react";
2
+ import type { PropsWithSpread } from "../../types";
3
+ export type Props = PropsWithSpread<{
4
+ /**
5
+ * The content of the table row.
6
+ */
7
+ children: ReactNode;
8
+ }, HTMLProps<HTMLTableRowElement>>;
9
+ declare const TableRow: ({ children, ...trProps }: Props) => JSX.Element;
10
+ export default TableRow;
@@ -0,0 +1,2 @@
1
+ export { default } from "./TableRow";
2
+ export type { Props as TableRowProps } from "./TableRow";
@@ -0,0 +1,45 @@
1
+ import type { HTMLProps, ElementType, ReactNode, ComponentType } from "react";
2
+ import type { ClassName } from "../../types";
3
+ export type TabLink<P = null> = {
4
+ /**
5
+ * Whether the tab link should have active styling.
6
+ */
7
+ active?: boolean;
8
+ /**
9
+ * Optional classes applied to the link element.
10
+ */
11
+ className?: ClassName;
12
+ /**
13
+ * Optional component to be used instead of the default "a" element.
14
+ */
15
+ component?: ElementType | ComponentType<P>;
16
+ /**
17
+ * Label to be displayed inside the tab link.
18
+ */
19
+ label: ReactNode;
20
+ /**
21
+ * Optional classes applied to the "li" element.
22
+ */
23
+ listItemClassName?: string;
24
+ } & (HTMLProps<HTMLElement> | P);
25
+ export type Props<P = null> = {
26
+ /**
27
+ * Optional classes applied to the parent "nav" element.
28
+ */
29
+ className?: ClassName;
30
+ /**
31
+ * An array of tab link objects.
32
+ */
33
+ links: TabLink<P>[];
34
+ /**
35
+ * Optional classes applied to the "ul" element.
36
+ */
37
+ listClassName?: string;
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
+ */
44
+ declare const Tabs: <P>({ className, links, listClassName, }: Props<P>) => JSX.Element;
45
+ export default Tabs;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Tabs";
2
+ export type { Props as TabsProps } from "./Tabs";
@@ -0,0 +1,70 @@
1
+ import type { TextareaHTMLAttributes, ReactNode } from "react";
2
+ import type { ClassName, PropsWithSpread } from "../../types";
3
+ /**
4
+ * The props for the Textarea component.
5
+ */
6
+ export type Props = PropsWithSpread<{
7
+ /**
8
+ * The content for caution validation.
9
+ */
10
+ caution?: ReactNode;
11
+ /**
12
+ * Optional class(es) to pass to the textarea element.
13
+ */
14
+ className?: ClassName;
15
+ /**
16
+ * The content for error validation.
17
+ */
18
+ error?: ReactNode;
19
+ /**
20
+ * Whether the textarea should grow to fit the content automatically.
21
+ */
22
+ grow?: boolean;
23
+ /**
24
+ * Help text to show below the field.
25
+ */
26
+ help?: ReactNode;
27
+ /**
28
+ * The id of the textarea.
29
+ */
30
+ id?: string;
31
+ /**
32
+ * The label for the field.
33
+ */
34
+ label?: ReactNode;
35
+ /**
36
+ * Optional class(es) to pass to the label component.
37
+ */
38
+ labelClassName?: string;
39
+ /**
40
+ * Whether the field is required.
41
+ */
42
+ required?: boolean;
43
+ /**
44
+ * Whether the form field should have a stacked appearance.
45
+ */
46
+ stacked?: boolean;
47
+ /**
48
+ * The content for success validation.
49
+ */
50
+ success?: ReactNode;
51
+ /**
52
+ * Whether to focus on the input on initial render.
53
+ */
54
+ takeFocus?: boolean;
55
+ /**
56
+ * Optional class(es) to pass to the wrapping Field component
57
+ */
58
+ wrapperClassName?: string;
59
+ /**
60
+ * Function to occur on keyboard event, 'CTRL + Enter'
61
+ */
62
+ onControlEnter?: () => void;
63
+ }, TextareaHTMLAttributes<HTMLTextAreaElement>>;
64
+ /**
65
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Textarea](https://docs.vanillaframework.io/base/forms/#textarea).
66
+ *
67
+ * The Textarea component defines a multi-line text input control.
68
+ */
69
+ declare const Textarea: ({ caution, className, error, grow, help, id, label, labelClassName, onKeyUp, onControlEnter, required, stacked, style, success, takeFocus, wrapperClassName, ...props }: Props) => JSX.Element;
70
+ export default Textarea;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Textarea";
2
+ export type { Props as TextareaProps } from "./Textarea";
@@ -0,0 +1,75 @@
1
+ import type { ReactNode } from "react";
2
+ import type { WindowFitment } from "../../hooks";
3
+ import type { ClassName, ValueOf } from "../../types";
4
+ export type CSSPosition = "static" | "absolute" | "fixed" | "relative" | "sticky" | "initial" | "inherit";
5
+ export type PositionStyle = {
6
+ left: number;
7
+ pointerEvents?: string;
8
+ position: CSSPosition;
9
+ top: number;
10
+ };
11
+ export declare const position: {
12
+ readonly btmCenter: "btm-center";
13
+ readonly btmLeft: "btm-left";
14
+ readonly btmRight: "btm-right";
15
+ readonly left: "left";
16
+ readonly right: "right";
17
+ readonly topCenter: "top-center";
18
+ readonly topLeft: "top-left";
19
+ readonly topRight: "top-right";
20
+ };
21
+ export type Position = ValueOf<typeof position>;
22
+ export type Props = {
23
+ /**
24
+ * Whether the tooltip should adjust to fit in the screen.
25
+ */
26
+ autoAdjust?: boolean;
27
+ /**
28
+ * Element on which to apply the tooltip.
29
+ */
30
+ children: ReactNode;
31
+ /**
32
+ * An optional class to apply to the wrapping element.
33
+ */
34
+ className?: ClassName;
35
+ /**
36
+ * Whether the tooltip should follow the mouse.
37
+ */
38
+ followMouse?: boolean;
39
+ /**
40
+ * Message to display when the element is hovered.
41
+ */
42
+ message?: ReactNode;
43
+ /**
44
+ * Position of the tooltip relative to the element.
45
+ */
46
+ position?: Position;
47
+ /**
48
+ * An optional class to apply to the element that wraps the children.
49
+ */
50
+ positionElementClassName?: string;
51
+ /**
52
+ * An optional class to apply to the tooltip message element.
53
+ */
54
+ tooltipClassName?: string;
55
+ /**
56
+ * The z-index value of the tooltip message element.
57
+ */
58
+ zIndex?: number;
59
+ /**
60
+ * Delay in ms after which Tooltip will appear (defaults to 350ms).
61
+ */
62
+ delay?: number;
63
+ };
64
+ export declare const adjustForWindow: (position: Position, fitsWindow: WindowFitment) => Position;
65
+ /**
66
+ * This is the [React](https://reactjs.org/) component for Vanilla [Tooltips](https://vanillaframework.io/docs/patterns/tooltips).
67
+ *
68
+ * Tooltips are text labels that appear when the user hovers over, focuses on, or touches an element on the screen.
69
+ *
70
+ * They can be used to provide information about concepts/terms/actions that are not self-explanatory or well known.
71
+ *
72
+ * An alternative use of tooltips is to provide information on a disabled actionable element, e.g. for disabled buttons, providing information about why they are disabled.
73
+ */
74
+ declare const Tooltip: ({ autoAdjust, children, className, followMouse, message, position, positionElementClassName, tooltipClassName, zIndex, delay, }: Props) => JSX.Element;
75
+ export default Tooltip;
@@ -0,0 +1,2 @@
1
+ export { default, position } from "./Tooltip";
2
+ export type { Props as TooltipProps } from "./Tooltip";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The Vanilla theme types.
3
+ */
4
+ export declare enum Theme {
5
+ /**
6
+ * The dark Vanilla theme.
7
+ */
8
+ DARK = "dark",
9
+ /**
10
+ * The light Vanilla theme.
11
+ */
12
+ LIGHT = "light"
13
+ }
@@ -0,0 +1,9 @@
1
+ export { useOnClickOutside, useClickOutside } from "./useOnClickOutside";
2
+ export { useId } from "./useId";
3
+ export { useListener } from "./useListener";
4
+ export { useOnEscapePressed } from "./useOnEscapePressed";
5
+ export { usePrevious } from "./usePrevious";
6
+ export { useThrottle } from "./useThrottle";
7
+ export { usePagination } from "./usePagination";
8
+ export { useWindowFitment } from "./useWindowFitment";
9
+ export type { WindowFitment } from "./useWindowFitment";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @deprecated Code component is deprecated. Use CodeSnippet component or inline `<code>` instead.
3
+ */
4
+ export declare const useId: () => string;