@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,108 @@
1
+ import React from "react";
2
+ import type { InputHTMLAttributes, ReactNode } from "react";
3
+ import type { ClassName, PropsWithSpread } from "../../types";
4
+ export declare enum Label {
5
+ Hide = "Hide",
6
+ Show = "Show"
7
+ }
8
+ /**
9
+ * The props for the Password Toggle component.
10
+ */
11
+ export type Props = PropsWithSpread<{
12
+ /**
13
+ * The content for caution validation.
14
+ */
15
+ caution?: ReactNode;
16
+ /**
17
+ * Optional class(es) to pass to the input element.
18
+ */
19
+ className?: ClassName;
20
+ /**
21
+ * The content for error validation.
22
+ */
23
+ error?: ReactNode;
24
+ /**
25
+ * Help text to show below the field.
26
+ */
27
+ help?: ReactNode;
28
+ /**
29
+ * The id of the input.
30
+ */
31
+ id: string;
32
+ /**
33
+ * The label for the field.
34
+ */
35
+ label?: ReactNode;
36
+ /**
37
+ * Whether the field is read only.
38
+ */
39
+ readOnly?: boolean;
40
+ /**
41
+ * Whether the field is required.
42
+ */
43
+ required?: boolean;
44
+ /**
45
+ * The content for success validation.
46
+ */
47
+ success?: ReactNode;
48
+ /**
49
+ * The content for success validation.
50
+ */
51
+ type?: "submit" | "reset" | "button";
52
+ /**
53
+ * Optional class(es) to pass to the wrapping Field component
54
+ */
55
+ wrapperClassName?: string;
56
+ }, InputHTMLAttributes<HTMLInputElement>>;
57
+ /**
58
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Password Toggle](https://docs.vanillaframework.io/base/forms/#password-toggle).
59
+ *
60
+ * It can be used when an input needs to obscure its value, whilst giving the user a way to reveal it if needed.
61
+ */
62
+ declare const PasswordToggle: React.ForwardRefExoticComponent<{
63
+ /**
64
+ * The content for caution validation.
65
+ */
66
+ caution?: ReactNode;
67
+ /**
68
+ * Optional class(es) to pass to the input element.
69
+ */
70
+ className?: ClassName;
71
+ /**
72
+ * The content for error validation.
73
+ */
74
+ error?: ReactNode;
75
+ /**
76
+ * Help text to show below the field.
77
+ */
78
+ help?: ReactNode;
79
+ /**
80
+ * The id of the input.
81
+ */
82
+ id: string;
83
+ /**
84
+ * The label for the field.
85
+ */
86
+ label?: ReactNode;
87
+ /**
88
+ * Whether the field is read only.
89
+ */
90
+ readOnly?: boolean;
91
+ /**
92
+ * Whether the field is required.
93
+ */
94
+ required?: boolean;
95
+ /**
96
+ * The content for success validation.
97
+ */
98
+ success?: ReactNode;
99
+ /**
100
+ * The content for success validation.
101
+ */
102
+ type?: "submit" | "reset" | "button";
103
+ /**
104
+ * Optional class(es) to pass to the wrapping Field component
105
+ */
106
+ wrapperClassName?: string;
107
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "className" | "error" | "label" | "id" | "type" | "readOnly" | "required" | "help" | "success" | "caution" | "wrapperClassName"> & React.RefAttributes<HTMLInputElement>>;
108
+ export default PasswordToggle;
@@ -0,0 +1,2 @@
1
+ export { default } from "./PasswordToggle";
2
+ export type { Props as PasswordToggleProps } from "./PasswordToggle";
@@ -0,0 +1,9 @@
1
+ import type { CheckableInputProps } from "../CheckboxInput/CheckableInput";
2
+ export type Props = Omit<CheckableInputProps, "inputType">;
3
+ /**
4
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Radio input](https://docs.vanillaframework.io/base/forms#radio-button).
5
+ *
6
+ * Use radio buttons to select one of the given set of options.
7
+ */
8
+ declare const RadioInput: ({ label, ...radioProps }: Props) => JSX.Element;
9
+ export default RadioInput;
@@ -0,0 +1,2 @@
1
+ export { default } from "./RadioInput";
2
+ export type { Props as RadioInputProps } from "./RadioInput";
@@ -0,0 +1,19 @@
1
+ import type { HTMLProps, ReactNode } from "react";
2
+ import type { ClassName, PropsWithSpread } from "../../types";
3
+ export type Props = PropsWithSpread<{
4
+ /**
5
+ * The content of the row.
6
+ */
7
+ children: ReactNode;
8
+ /**
9
+ * Optional class(es) to pass to the wrapping div element.
10
+ */
11
+ className?: ClassName;
12
+ }, HTMLProps<HTMLDivElement>>;
13
+ /**
14
+ * This is a [React](https://reactjs.org/) component for use within the Vanilla [Grid](https://docs.vanillaframework.io/patterns/grid/).
15
+ *
16
+ * Vanilla has a responsive grid using a combination of rows and columns.
17
+ */
18
+ declare const Row: ({ children, className, ...props }: Props) => JSX.Element;
19
+ export default Row;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Row";
2
+ export type { Props as RowProps } from "./Row";
@@ -0,0 +1,25 @@
1
+ import type { SearchAndFilterChip, SearchAndFilterData } from "../types";
2
+ export type Props = {
3
+ /**
4
+ * The chip data to display in the panel.
5
+ */
6
+ data: SearchAndFilterData;
7
+ /**
8
+ * The current search chips.
9
+ */
10
+ searchData: SearchAndFilterChip[];
11
+ /**
12
+ * A search string.
13
+ */
14
+ searchTerm: string;
15
+ /**
16
+ * Whether the chips should be hidden.
17
+ */
18
+ sectionHidden?: boolean;
19
+ /**
20
+ * A function to toggle whether a chip is selected.
21
+ */
22
+ toggleSelected: (chip: SearchAndFilterChip) => void;
23
+ };
24
+ declare const FilterPanelSection: ({ data, searchData, searchTerm, sectionHidden, toggleSelected, }: Props) => JSX.Element;
25
+ export default FilterPanelSection;
@@ -0,0 +1 @@
1
+ export { default } from "./FilterPanelSection";
@@ -0,0 +1,33 @@
1
+ import type { SearchAndFilterChip, SearchAndFilterData } from "./types";
2
+ export declare enum Label {
3
+ AddFilter = "Add filter",
4
+ Clear = "Clear input",
5
+ SearchAndFilter = "Search and filter"
6
+ }
7
+ export type Props = {
8
+ /**
9
+ * A list of chips to initialise inside the input.
10
+ */
11
+ existingSearchData?: SearchAndFilterChip[];
12
+ /**
13
+ * The data for the filter panel.
14
+ */
15
+ filterPanelData: SearchAndFilterData[];
16
+ /**
17
+ * A function that is called when the search data changes.
18
+ */
19
+ returnSearchData: (searchData: SearchAndFilterChip[]) => void;
20
+ /**
21
+ * A function that is called when the filter panel is shown/hidden.
22
+ */
23
+ onPanelToggle?: () => void;
24
+ /**
25
+ * A function that is called when the height of the search container changes.
26
+ */
27
+ onExpandChange?: () => void;
28
+ };
29
+ /**
30
+ * This component allows searching and filtering of large datasets.
31
+ */
32
+ declare const SearchAndFilter: ({ existingSearchData, filterPanelData, returnSearchData, onPanelToggle, onExpandChange, ...props }: Props) => JSX.Element;
33
+ export default SearchAndFilter;
@@ -0,0 +1,2 @@
1
+ export { default } from "./SearchAndFilter";
2
+ export type { Props as SearchAndFilterProps } from "./SearchAndFilter";
@@ -0,0 +1,11 @@
1
+ export type SearchAndFilterChip = {
2
+ id?: number;
3
+ lead?: string;
4
+ quoteValue?: boolean;
5
+ value: string;
6
+ };
7
+ export type SearchAndFilterData = {
8
+ id: number;
9
+ chips?: SearchAndFilterChip[];
10
+ heading?: string;
11
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Return number of overflowing chips given a row threshold
3
+ * @param {array} chips - An array of chips
4
+ * @param {Integer} overflowRowLimit - Number of rows to show before counting
5
+ * overflow
6
+ */
7
+ export declare const overflowingChipsCount: (chips: any, overflowRowLimit: any) => number;
8
+ /**
9
+ * Check if supplied chip object already exists in searchData prop
10
+ * @param {Object} chip - A chip object {lead: 'foo', value: 'bar'}
11
+ * @param {Array} existingArr - An array of chip objects
12
+ */
13
+ export declare const isChipInArray: (chip: any, existingArr: any) => any;
@@ -0,0 +1,63 @@
1
+ import React, { HTMLProps } from "react";
2
+ import type { ClassName, PropsWithSpread } from "../../types";
3
+ export declare enum Label {
4
+ Clear = "Clear search field",
5
+ Search = "Search"
6
+ }
7
+ export type Props = PropsWithSpread<{
8
+ /**
9
+ * Whether autocomplete should be enabled for the search input.
10
+ */
11
+ autocomplete?: "on" | "off";
12
+ /**
13
+ * Optional classes to pass to the form element.
14
+ */
15
+ className?: ClassName;
16
+ /**
17
+ * Whether the input and buttons should be disabled.
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * Whether the input value will be controlled via external state.
22
+ */
23
+ externallyControlled?: boolean;
24
+ /**
25
+ * A function that will be called when the input value changes.
26
+ */
27
+ onChange?: (inputValue: string) => void;
28
+ /**
29
+ * A function that is called when the user clicks the search icon or presses enter
30
+ */
31
+ onSearch?: (inputValue: string) => void;
32
+ /**
33
+ * A function that is called when the user clicks the reset icon
34
+ */
35
+ onClear?: () => void;
36
+ /**
37
+ * A search input placeholder message.
38
+ */
39
+ placeholder?: string;
40
+ /**
41
+ * Whether the search input should lose focus when searching.
42
+ */
43
+ shouldBlurOnSearch?: boolean;
44
+ /**
45
+ * Whether the search input should receive focus after pressing the reset button
46
+ */
47
+ shouldRefocusAfterReset?: boolean;
48
+ /**
49
+ * A ref that is passed to the input element.
50
+ */
51
+ ref?: string;
52
+ /**
53
+ * The value of the search input when the state is externally controlled.
54
+ */
55
+ value?: string;
56
+ }, HTMLProps<HTMLInputElement>>;
57
+ /**
58
+ * This is a [React](https://reactjs.org/) component for the Vanilla [SearchBox](https://docs.vanillaframework.io/patterns/search-box/).
59
+ *
60
+ * Search boxes enable search functionality on a page and are typically used in a navigation bar. SearchBox elements should be wrapped within a form element that handles its own submit action.
61
+ */
62
+ declare const SearchBox: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
63
+ export default SearchBox;
@@ -0,0 +1,2 @@
1
+ export { default } from "./SearchBox";
2
+ export type { Props as SearchBoxProps } from "./SearchBox";
@@ -0,0 +1,71 @@
1
+ import type { ChangeEventHandler, ReactNode, OptionHTMLAttributes, SelectHTMLAttributes } from "react";
2
+ import type { ClassName, PropsWithSpread } from "../../types";
3
+ type Option = OptionHTMLAttributes<HTMLOptionElement>;
4
+ /**
5
+ * The props for the Select component.
6
+ */
7
+ export type Props = PropsWithSpread<{
8
+ /**
9
+ * The content for caution validation.
10
+ */
11
+ caution?: ReactNode;
12
+ /**
13
+ * Optional class(es) to pass to the input element.
14
+ */
15
+ className?: ClassName;
16
+ /**
17
+ * The content for error validation.
18
+ */
19
+ error?: ReactNode;
20
+ /**
21
+ * Help text to show below the field.
22
+ */
23
+ help?: ReactNode;
24
+ /**
25
+ * The id of the input.
26
+ */
27
+ id?: string | null;
28
+ /**
29
+ * The label for the field.
30
+ */
31
+ label?: ReactNode;
32
+ /**
33
+ * Optional class(es) to pass to the label component.
34
+ */
35
+ labelClassName?: string | null;
36
+ /**
37
+ * Function to run when select value changes.
38
+ */
39
+ onChange?: ChangeEventHandler<HTMLSelectElement> | null;
40
+ /**
41
+ * Array of options that the select can choose from.
42
+ */
43
+ options?: Option[] | null;
44
+ /**
45
+ * Whether the field is required.
46
+ */
47
+ required?: boolean;
48
+ /**
49
+ * Whether the form field should have a stacked appearance.
50
+ */
51
+ stacked?: boolean;
52
+ /**
53
+ * The content for success validation.
54
+ */
55
+ success?: ReactNode;
56
+ /**
57
+ * Whether to focus on the input on initial render.
58
+ */
59
+ takeFocus?: boolean;
60
+ /**
61
+ * Optional class(es) to pass to the wrapping Field component
62
+ */
63
+ wrapperClassName?: ClassName;
64
+ }, SelectHTMLAttributes<HTMLSelectElement>>;
65
+ /**
66
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Select](https://docs.vanillaframework.io/base/forms/#select).
67
+ *
68
+ * Use the Select component to create a drop-down list.
69
+ */
70
+ declare const Select: ({ caution, className, error, help, id, label, labelClassName, onChange, options, required, stacked, success, takeFocus, wrapperClassName, ...selectProps }: Props) => JSX.Element;
71
+ export default Select;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Select";
2
+ export type { Props as SelectProps } from "./Select";
@@ -0,0 +1,50 @@
1
+ import React, { PropsWithChildren, ReactNode } from "react";
2
+ import type { PropsWithSpread } from "../../types";
3
+ import { type HTMLProps } from "react";
4
+ import type { SideNavigationItemProps } from "./SideNavigationItem";
5
+ import type { SideNavigationLinkDefaultElement, SideNavigationLinkProps } from "./SideNavigationLink";
6
+ export type NavItem<L = SideNavigationLinkDefaultElement> = SideNavigationItemProps<L> | ReactNode | null;
7
+ export type NavItemGroup<L = SideNavigationLinkDefaultElement> = NavItem<L>[];
8
+ export type NavGroup<L = SideNavigationLinkDefaultElement> = PropsWithSpread<{
9
+ /**
10
+ * The navigation items.
11
+ */
12
+ items: NavItemGroup<L>;
13
+ }, HTMLProps<HTMLUListElement>>;
14
+ export type Props<L = SideNavigationLinkDefaultElement> = PropsWithSpread<{
15
+ /**
16
+ * The navigation content. This can be used instead of supplying `items`.
17
+ */
18
+ children?: PropsWithChildren["children"];
19
+ /**
20
+ * Whether to use the dark theme.
21
+ */
22
+ dark?: boolean;
23
+ /**
24
+ * Whether the navigation items contain icons.
25
+ */
26
+ hasIcons?: boolean;
27
+ /**
28
+ * The navigation items.
29
+ */
30
+ items?: (NavGroup<L> | null)[];
31
+ /**
32
+ * The component or element to use for the link elements e.g. `a` or `NavLink`.
33
+ * @default a
34
+ */
35
+ linkComponent?: SideNavigationLinkProps["component"];
36
+ /**
37
+ * Classes to apply to the navigation list(s).
38
+ */
39
+ listClassName?: string;
40
+ /**
41
+ * Classes to apply to the nav element.
42
+ */
43
+ navClassName?: string;
44
+ }, HTMLProps<HTMLDivElement>>;
45
+ /**
46
+ * This is a [React](https://reactjs.org/) component for side navigation, used
47
+ * in the [Vanilla](https://vanillaframework.io/docs/) layouts.
48
+ */
49
+ declare const SideNavigation: <L = SideNavigationLinkDefaultElement>({ children, className, dark, hasIcons, items, linkComponent, listClassName, navClassName, ...props }: Props<L>) => React.JSX.Element;
50
+ export default SideNavigation;
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import type { PropsWithSpread } from "../../../types";
3
+ import type { ComponentType, ElementType, ReactNode } from "react";
4
+ export type Props<C> = PropsWithSpread<{
5
+ /**
6
+ * The component or element to use for the element e.g. `span` or `NavLink`.
7
+ */
8
+ component: ElementType | ComponentType<C>;
9
+ /**
10
+ * Whether to use the dark theme.
11
+ */
12
+ dark?: boolean;
13
+ /**
14
+ * The navigation item's icon.
15
+ */
16
+ icon?: string;
17
+ /**
18
+ * The navigation item's label.
19
+ */
20
+ label: ReactNode;
21
+ /**
22
+ * The navigation item's status.
23
+ */
24
+ status?: ReactNode;
25
+ /**
26
+ * A ref to pass to the element.
27
+ */
28
+ forwardRef?: React.Ref<C> | null;
29
+ }, C>;
30
+ declare const SideNavigationBase: <C>({ component: Component, dark, icon, label, status, forwardRef, ...props }: Props<C>) => React.JSX.Element;
31
+ export default SideNavigationBase;
@@ -0,0 +1 @@
1
+ export { default, type Props as SideNavigationBaseProps, } from "./SideNavigationBase";
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import type { HTMLProps, PropsWithChildren } from "react";
3
+ import type { SideNavigationLinkProps } from "../SideNavigationLink";
4
+ import type { SideNavigationLinkDefaultElement } from "../SideNavigationLink";
5
+ import { SideNavigationTextProps } from "../SideNavigationText";
6
+ type ItemProps = {
7
+ /**
8
+ * The item content.
9
+ */
10
+ children: NonNullable<PropsWithChildren["children"]>;
11
+ } & HTMLProps<HTMLLIElement>;
12
+ type ContentProps<L = SideNavigationLinkDefaultElement> = SideNavigationLinkProps<L> | (SideNavigationTextProps & {
13
+ /**
14
+ * Whether this should be a content-only item.
15
+ */
16
+ nonInteractive: true;
17
+ });
18
+ export type Props<L = SideNavigationLinkDefaultElement> = ItemProps | ContentProps<L>;
19
+ declare const SideNavigationItem: <L = SideNavigationLinkDefaultElement>(props: Props<L>) => React.JSX.Element;
20
+ export default SideNavigationItem;
@@ -0,0 +1 @@
1
+ export { default, type Props as SideNavigationItemProps, } from "./SideNavigationItem";
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import type { HTMLProps } from "react";
3
+ import type { SideNavigationBaseProps } from "../SideNavigationBase";
4
+ import { PropsWithSpread } from "../../../types";
5
+ export type LinkDefaultElement = HTMLProps<HTMLAnchorElement>;
6
+ export type Props<L = LinkDefaultElement, E = HTMLAnchorElement> = PropsWithSpread<{
7
+ /**
8
+ * The component or element to use for the link element e.g. `a` or `NavLink`.
9
+ * @default a
10
+ */
11
+ component?: SideNavigationBaseProps<L>["component"];
12
+ /**
13
+ * A ref to pass to the link element.
14
+ */
15
+ forwardRef?: React.Ref<E> | null;
16
+ }, Omit<SideNavigationBaseProps<L>, "component">>;
17
+ declare const SideNavigationLink: <L = LinkDefaultElement, E = HTMLAnchorElement>({ component, forwardRef, ...props }: Props<L, E>) => React.JSX.Element;
18
+ export default SideNavigationLink;
@@ -0,0 +1 @@
1
+ export { default, type LinkDefaultElement as SideNavigationLinkDefaultElement, type Props as SideNavigationLinkProps, } from "./SideNavigationLink";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { HTMLProps } from "react";
3
+ import type { SideNavigationBaseProps } from "../SideNavigationBase";
4
+ export type TextDefaultElement = HTMLProps<HTMLSpanElement>;
5
+ export type Props = Omit<SideNavigationBaseProps<TextDefaultElement>, "component" | "label">;
6
+ declare const SideNavigationText: ({ children, className, ...props }: Props) => React.JSX.Element;
7
+ export default SideNavigationText;
@@ -0,0 +1 @@
1
+ export { default, type Props as SideNavigationTextProps, } from "./SideNavigationText";
@@ -0,0 +1,5 @@
1
+ export { default } from "./SideNavigation";
2
+ export type { Props as SideNavigationProps } from "./SideNavigation";
3
+ export { default as SideNavigationItem } from "./SideNavigationItem";
4
+ export { default as SideNavigationText } from "./SideNavigationText";
5
+ export { default as SideNavigationLink, type SideNavigationLinkDefaultElement, } from "./SideNavigationLink";
@@ -0,0 +1,62 @@
1
+ import type { ChangeEventHandler, HTMLProps, ReactNode } from "react";
2
+ import type { PropsWithSpread } from "../../types";
3
+ export declare const FILLED_COLOR = "#0066CC";
4
+ export declare const EMPTY_COLOR = "#D9D9D9";
5
+ export type Props = PropsWithSpread<{
6
+ /**
7
+ * Field caution message.
8
+ */
9
+ caution?: ReactNode;
10
+ /**
11
+ * Whether to disable the slider and input (if showInput is true).
12
+ */
13
+ disabled?: boolean;
14
+ /**
15
+ * Field error message.
16
+ */
17
+ error?: ReactNode;
18
+ /**
19
+ * Field help message.
20
+ */
21
+ help?: ReactNode;
22
+ /**
23
+ * Field id. Only passed to range input, not to number input.
24
+ */
25
+ id?: string;
26
+ /**
27
+ * Whether to disable only the input, but not the slider.
28
+ */
29
+ inputDisabled?: boolean;
30
+ /**
31
+ * Field label.
32
+ */
33
+ label?: ReactNode;
34
+ /**
35
+ * Maximum value of the slider.
36
+ */
37
+ max: number;
38
+ /**
39
+ * Minimum value of the slider.
40
+ */
41
+ min: number;
42
+ /**
43
+ * Change event handler.
44
+ */
45
+ onChange: ChangeEventHandler<HTMLInputElement>;
46
+ /**
47
+ * Whether the field is required for the form to submit.
48
+ */
49
+ required?: boolean;
50
+ /**
51
+ * Whether to show a number input with the numerical value next to the slider.
52
+ */
53
+ showInput?: boolean;
54
+ }, HTMLProps<HTMLInputElement>>;
55
+ /**
56
+ * This is the [React](https://reactjs.org/) component for the Vanilla [Slider](https://vanillaframework.io/docs/patterns/slider).
57
+ *
58
+ * Sliders should be used to let a user specify a numeric value between a defined
59
+ minimum and maximum value, however the precise value is not especially important.
60
+ */
61
+ export declare const Slider: ({ caution, disabled, error, help, id, inputDisabled, label, max, min, onChange, required, showInput, ...inputProps }: Props) => JSX.Element;
62
+ export default Slider;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Slider";
2
+ export type { Props as SliderProps } from "./Slider";
@@ -0,0 +1,29 @@
1
+ import { HTMLProps } from "react";
2
+ import type { ClassName } from "../../types";
3
+ export type Props = {
4
+ /**
5
+ * Optional class(es) to pass to the wrapping span element.
6
+ */
7
+ className?: ClassName;
8
+ /**
9
+ * Whether the spinner should have a light appearance.
10
+ */
11
+ isLight?: boolean;
12
+ /**
13
+ * Text to display next to the spinner.
14
+ */
15
+ text?: string;
16
+ /**
17
+ * What the role of the spinner should be.
18
+ */
19
+ role?: string;
20
+ /**
21
+ * The politeness setting of the spinner alert.
22
+ */
23
+ ariaLive?: "assertive" | "off" | "polite";
24
+ } & HTMLProps<HTMLSpanElement>;
25
+ /**
26
+ * This is a [React](https://reactjs.org/) component for the Vanilla [Spin](https://docs.vanillaframework.io/settings/animation-settings/#spin) animation.
27
+ */
28
+ declare const Spinner: ({ className, text, isLight, ariaLive, role, ...props }: Props) => JSX.Element;
29
+ export default Spinner;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Spinner";
2
+ export type { Props as SpinnerProps } from "./Spinner";