@etsoo/react 1.4.73 → 1.4.74

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.
package/lib/index.d.ts CHANGED
@@ -64,6 +64,7 @@ export * from './mu/ScrollTopFab';
64
64
  export * from './mu/SearchBar';
65
65
  export * from './mu/SearchField';
66
66
  export * from './mu/SearchOptionGroup';
67
+ export * from './mu/SelectBool';
67
68
  export * from './mu/SelectEx';
68
69
  export * from './mu/Switch';
69
70
  export * from './mu/SwitchAnt';
package/lib/index.js CHANGED
@@ -67,6 +67,7 @@ export * from './mu/ScrollTopFab';
67
67
  export * from './mu/SearchBar';
68
68
  export * from './mu/SearchField';
69
69
  export * from './mu/SearchOptionGroup';
70
+ export * from './mu/SelectBool';
70
71
  export * from './mu/SelectEx';
71
72
  export * from './mu/Switch';
72
73
  export * from './mu/SwitchAnt';
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { IdLabelDto } from '@etsoo/appscript';
3
+ import { SelectExProps } from './SelectEx';
4
+ /**
5
+ * SelectBool props
6
+ */
7
+ export interface SelectBoolProps extends Omit<SelectExProps<IdLabelDto<string>>, 'options' | 'loadData'> {
8
+ }
9
+ /**
10
+ * SelectBool (yes/no)
11
+ * @param props Props
12
+ * @returns Component
13
+ */
14
+ export declare function SelectBool(props: SelectBoolProps): JSX.Element;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { globalApp } from '..';
3
+ import { SelectEx } from './SelectEx';
4
+ /**
5
+ * SelectBool (yes/no)
6
+ * @param props Props
7
+ * @returns Component
8
+ */
9
+ export function SelectBool(props) {
10
+ // Destruct
11
+ const { search = true, ...rest } = props;
12
+ // Options
13
+ const options = [
14
+ { id: 'false', label: globalApp.get('no') },
15
+ { id: 'true', label: globalApp.get('yes') }
16
+ ];
17
+ if (search)
18
+ options.unshift({ id: '', label: '---' });
19
+ // Layout
20
+ return React.createElement(SelectEx, { options: options, search: search, ...rest });
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.73",
3
+ "version": "1.4.74",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/index.ts CHANGED
@@ -71,6 +71,7 @@ export * from './mu/ScrollTopFab';
71
71
  export * from './mu/SearchBar';
72
72
  export * from './mu/SearchField';
73
73
  export * from './mu/SearchOptionGroup';
74
+ export * from './mu/SelectBool';
74
75
  export * from './mu/SelectEx';
75
76
  export * from './mu/Switch';
76
77
  export * from './mu/SwitchAnt';
@@ -0,0 +1,31 @@
1
+ import { IdLabelDto } from '@etsoo/appscript';
2
+ import React from 'react';
3
+ import { globalApp } from '..';
4
+ import { SelectEx, SelectExProps } from './SelectEx';
5
+
6
+ /**
7
+ * SelectBool props
8
+ */
9
+ export interface SelectBoolProps
10
+ extends Omit<SelectExProps<IdLabelDto<string>>, 'options' | 'loadData'> {}
11
+
12
+ /**
13
+ * SelectBool (yes/no)
14
+ * @param props Props
15
+ * @returns Component
16
+ */
17
+ export function SelectBool(props: SelectBoolProps) {
18
+ // Destruct
19
+ const { search = true, ...rest } = props;
20
+
21
+ // Options
22
+ const options: IdLabelDto<string>[] = [
23
+ { id: 'false', label: globalApp.get('no')! },
24
+ { id: 'true', label: globalApp.get('yes')! }
25
+ ];
26
+
27
+ if (search) options.unshift({ id: '', label: '---' });
28
+
29
+ // Layout
30
+ return <SelectEx options={options} search={search} {...rest} />;
31
+ }