@utrecht/component-library-react 1.0.0-alpha.337 → 1.0.0-alpha.338

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.
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @license EUPL-1.2
3
+ * Copyright (c) 2023 Robbert Broersma
4
+ */
5
+ import { DownshiftProps } from 'downshift';
6
+ import React from 'react';
7
+ type InputTypes = {
8
+ name?: string;
9
+ placeholder?: string;
10
+ ariaLabel?: string;
11
+ };
12
+ type ButtonTypes = {
13
+ label: string;
14
+ };
15
+ export interface SearchBarProps extends DownshiftProps<any> {
16
+ /**
17
+ * @property
18
+ * `input`:
19
+ * input={{
20
+ * label: string
21
+ * }}
22
+ *
23
+ * */
24
+ input?: InputTypes;
25
+ /**
26
+ * @property
27
+ * `itemToString`:
28
+ *
29
+ * ```ts
30
+ * function(item: any) | defaults to: item => (item ? String(item) : '')
31
+ * ```
32
+ * @description
33
+ * This function responsible for displaying the list item text
34
+ * Example: if your data is an object {name: Python, year: 1990 },
35
+ * you can use just the name as the list item text or you can use them together
36
+ *
37
+ * @example
38
+ * - Return just the name
39
+ * ```ts
40
+ * const itemToString = (item: any) => {
41
+ * return item ? item.name : '';
42
+ * };
43
+ * ```
44
+ * - Return the name, and the year
45
+ * ```ts
46
+ * const itemToString = (item: any) => {
47
+ * return i ? `${i.name} ${i.year}` : '';
48
+ * };
49
+ * ```
50
+ *
51
+ * */
52
+ itemToString: (_item?: any) => string;
53
+ /**
54
+ * @property
55
+ * `items`:
56
+ *
57
+ * ```ts
58
+ * items: [
59
+ * {
60
+ * title: string,
61
+ * list: []
62
+ * }
63
+ * ]
64
+ * ```
65
+ * */
66
+ items?: any[];
67
+ /**
68
+ * @property
69
+ * `button`:
70
+ * button={{
71
+ * label: string
72
+ * }}
73
+ *
74
+ * */
75
+ button: ButtonTypes;
76
+ }
77
+ interface SearchBarDropdownProps {
78
+ children: React.ReactNode;
79
+ }
80
+ export declare const SearchBarDropdown: React.FC<SearchBarDropdownProps>;
81
+ interface SearchBarSectionProps {
82
+ children: React.ReactNode;
83
+ title?: string;
84
+ }
85
+ export declare const SearchBarSection: React.FC<SearchBarSectionProps>;
86
+ /**
87
+ * SearchBar
88
+ * This component extends the [Downshift](https://www.npmjs.com/package/downshift#onstatechange) Component
89
+ * Thant means you can use `Downshift` props
90
+ */
91
+ export declare const SearchBar: React.FC<SearchBarProps>;
92
+ export {};
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @license EUPL-1.2
3
+ * Copyright (c) 2023 Robbert Broersma
4
+ */
5
+ import { DownshiftProps } from 'downshift';
6
+ import React from 'react';
7
+ type InputTypes = {
8
+ name?: string;
9
+ placeholder?: string;
10
+ ariaLabel?: string;
11
+ };
12
+ type ButtonTypes = {
13
+ label: string;
14
+ };
15
+ export interface SearchBarProps extends DownshiftProps<any> {
16
+ /**
17
+ * @property
18
+ * `input`:
19
+ * input={{
20
+ * label: string
21
+ * }}
22
+ *
23
+ * */
24
+ input?: InputTypes;
25
+ /**
26
+ * @property
27
+ * `itemToString`:
28
+ *
29
+ * ```ts
30
+ * function(item: any) | defaults to: item => (item ? String(item) : '')
31
+ * ```
32
+ * @description
33
+ * This function responsible for displaying the list item text
34
+ * Example: if your data is an object {name: Python, year: 1990 },
35
+ * you can use just the name as the list item text or you can use them together
36
+ *
37
+ * @example
38
+ * - Return just the name
39
+ * ```ts
40
+ * const itemToString = (item: any) => {
41
+ * return item ? item.name : '';
42
+ * };
43
+ * ```
44
+ * - Return the name, and the year
45
+ * ```ts
46
+ * const itemToString = (item: any) => {
47
+ * return i ? `${i.name} ${i.year}` : '';
48
+ * };
49
+ * ```
50
+ *
51
+ * */
52
+ itemToString: (_item?: any) => string;
53
+ /**
54
+ * @property
55
+ * `items`:
56
+ *
57
+ * ```ts
58
+ * items: [
59
+ * {
60
+ * title: string,
61
+ * list: []
62
+ * }
63
+ * ]
64
+ * ```
65
+ * */
66
+ items?: any[];
67
+ /**
68
+ * @property
69
+ * `button`:
70
+ * button={{
71
+ * label: string
72
+ * }}
73
+ *
74
+ * */
75
+ button: ButtonTypes;
76
+ }
77
+ interface SearchBarDropdownProps {
78
+ children: React.ReactNode;
79
+ }
80
+ export declare const SearchBarDropdown: React.FC<SearchBarDropdownProps>;
81
+ interface SearchBarSectionProps {
82
+ children: React.ReactNode;
83
+ title?: string;
84
+ }
85
+ export declare const SearchBarSection: React.FC<SearchBarSectionProps>;
86
+ /**
87
+ * SearchBar
88
+ * This component extends the [Downshift](https://www.npmjs.com/package/downshift#onstatechange) Component
89
+ * Thant means you can use `Downshift` props
90
+ */
91
+ export declare const SearchBar: React.FC<SearchBarProps>;
92
+ export {};
@@ -0,0 +1,2 @@
1
+ import '../../../../components/search-bar/css/index.scss';
2
+ export * from '../SearchBar';
@@ -57,6 +57,7 @@ export { PageHeader } from './PageHeader';
57
57
  export { Paragraph } from './Paragraph';
58
58
  export { PreHeading } from './PreHeading';
59
59
  export { RadioButton } from './RadioButton';
60
+ export { SearchBar } from './SearchBar';
60
61
  export { Select, SelectOption } from './Select';
61
62
  export { Separator } from './Separator';
62
63
  export { SkipLink } from './SkipLink';
@@ -57,6 +57,7 @@ export { PageHeader } from './PageHeader';
57
57
  export { Paragraph } from './Paragraph';
58
58
  export { PreHeading } from './PreHeading';
59
59
  export { RadioButton } from './RadioButton';
60
+ export { SearchBar } from './SearchBar';
60
61
  export { Select, SelectOption } from './Select';
61
62
  export { Separator } from './Separator';
62
63
  export { SkipLink } from './SkipLink';