@seeqdev/qomponents 0.0.171 → 0.0.173

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.
@@ -1,32 +1,32 @@
1
- {
2
- "name": "example",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "vite",
8
- "build": "tsc && vite build",
9
- "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
- "preview": "vite preview"
11
- },
12
- "dependencies": {
13
- "@fortawesome/fontawesome-free": "^6.4.0",
14
- "@seeqdev/qomponents": "0.0.153",
15
- "@tailwindcss/vite": "4.1.8",
16
- "react": "18.2.0",
17
- "react-dom": "18.2.0",
18
- "tailwindcss": "4.1.8"
19
- },
20
- "devDependencies": {
21
- "@types/react": "18.0.37",
22
- "@types/react-dom": "18.0.11",
23
- "@typescript-eslint/eslint-plugin": "5.59.0",
24
- "@typescript-eslint/parser": "5.59.0",
25
- "@vitejs/plugin-react": "4.5.1",
26
- "eslint": "8.38.0",
27
- "eslint-plugin-react-hooks": "4.6.0",
28
- "eslint-plugin-react-refresh": "0.3.4",
29
- "typescript": "5.0.2",
30
- "vite": "6.3.5"
31
- }
32
- }
1
+ {
2
+ "name": "example",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
+ "preview": "vite preview"
11
+ },
12
+ "dependencies": {
13
+ "@fortawesome/fontawesome-free": "^6.4.0",
14
+ "@seeqdev/qomponents": "0.0.153",
15
+ "@tailwindcss/vite": "4.1.8",
16
+ "react": "18.2.0",
17
+ "react-dom": "18.2.0",
18
+ "tailwindcss": "4.1.8"
19
+ },
20
+ "devDependencies": {
21
+ "@types/react": "18.0.37",
22
+ "@types/react-dom": "18.0.11",
23
+ "@typescript-eslint/eslint-plugin": "5.59.0",
24
+ "@typescript-eslint/parser": "5.59.0",
25
+ "@vitejs/plugin-react": "4.5.1",
26
+ "eslint": "8.38.0",
27
+ "eslint-plugin-react-hooks": "4.6.0",
28
+ "eslint-plugin-react-refresh": "0.3.4",
29
+ "typescript": "5.0.2",
30
+ "vite": "6.3.5"
31
+ }
32
+ }
@@ -1,81 +1,81 @@
1
- import React from 'react';
2
- import { Icon, Select } from '@seeqdev/qomponents';
3
-
4
- export interface SelectOption {
5
- id: string;
6
- label: string;
7
- color: string;
8
- asset: string;
9
- type: 'SCALAR' | 'STRING' | 'NUMERIC';
10
- }
11
-
12
- const options: SelectOption[] = [
13
- { id: '1', label: 'Label for the first entry', color: 'pink', asset: 'Asset 1', type: 'NUMERIC' },
14
- { id: '2', label: 'Label for the second entry', color: 'green', asset: 'Asset 2', type: 'SCALAR' },
15
- { id: '3', label: 'Label for the third entry', color: 'orange', asset: 'Asset 3', type: 'STRING' },
16
- ];
17
-
18
- interface ComplexSelectExampleProps {
19
- onChange: (selectedOption: SelectOption) => void;
20
- value: SelectOption | undefined;
21
- }
22
-
23
- function ComplexSelectExample({ onChange, value }: ComplexSelectExampleProps) {
24
- const getIcon = (type: string) => {
25
- switch (type) {
26
- case 'STRING':
27
- return 'fa fa-font';
28
- case 'SCALAR':
29
- return 'fc-scalar';
30
- default:
31
- return 'fc-series';
32
- }
33
- };
34
- /**
35
- * This function formats the select option as desired. You can apply css styling here or use additional qomponents
36
- * to style the select option display.
37
- *
38
- * You can use the same function to format the selected value or use a different one (sometimes having a separate
39
- * function is helpful if you want to limit the space that is taken up by the selected option).
40
- *
41
- * This example shows how to use an additional Icon component (styled in color based on the select option) as well
42
- * as how to display the properties of the select option
43
- */
44
- const getOptionLabel = (optionValue: SelectOption): React.ReactNode => {
45
- return (
46
- <div className="selectOptionWrapperDiv">
47
- <Icon icon={getIcon(optionValue.type)} type="color" color={optionValue.color} extraClassNames="mr-10" />
48
- <div className="selectOptionDiv">
49
- <div className="selectOption">
50
- <strong>{optionValue.label}</strong>
51
- </div>
52
- <div className="selectOptionSubText">{optionValue.asset}</div>
53
- </div>
54
- </div>
55
- );
56
- };
57
- const getOptionValue = (option: SelectOption) => {
58
- return option.id;
59
- };
60
-
61
- return (
62
- // use the getOptionLabel function to provide a custom render function that determines how the select options
63
- // are displayed
64
- // use the getSelectedValueLabel function to provide a custom render function that determines how the selected
65
- // option is displayed
66
- <Select
67
- placeholder="formatted select options"
68
- extraClassNames="formElementWidth"
69
- options={options}
70
- value={value}
71
- getOptionLabel={getOptionLabel}
72
- getOptionValue={getOptionValue}
73
- getSelectedValueLabel={getOptionLabel}
74
- onChange={(selectedOption: SelectOption) => {
75
- onChange(selectedOption);
76
- }}
77
- />
78
- );
79
- }
80
-
81
- export default ComplexSelectExample;
1
+ import React from 'react';
2
+ import { Icon, Select } from '@seeqdev/qomponents';
3
+
4
+ export interface SelectOption {
5
+ id: string;
6
+ label: string;
7
+ color: string;
8
+ asset: string;
9
+ type: 'SCALAR' | 'STRING' | 'NUMERIC';
10
+ }
11
+
12
+ const options: SelectOption[] = [
13
+ { id: '1', label: 'Label for the first entry', color: 'pink', asset: 'Asset 1', type: 'NUMERIC' },
14
+ { id: '2', label: 'Label for the second entry', color: 'green', asset: 'Asset 2', type: 'SCALAR' },
15
+ { id: '3', label: 'Label for the third entry', color: 'orange', asset: 'Asset 3', type: 'STRING' },
16
+ ];
17
+
18
+ interface ComplexSelectExampleProps {
19
+ onChange: (selectedOption: SelectOption) => void;
20
+ value: SelectOption | undefined;
21
+ }
22
+
23
+ function ComplexSelectExample({ onChange, value }: ComplexSelectExampleProps) {
24
+ const getIcon = (type: string) => {
25
+ switch (type) {
26
+ case 'STRING':
27
+ return 'fa fa-font';
28
+ case 'SCALAR':
29
+ return 'fc-scalar';
30
+ default:
31
+ return 'fc-series';
32
+ }
33
+ };
34
+ /**
35
+ * This function formats the select option as desired. You can apply css styling here or use additional qomponents
36
+ * to style the select option display.
37
+ *
38
+ * You can use the same function to format the selected value or use a different one (sometimes having a separate
39
+ * function is helpful if you want to limit the space that is taken up by the selected option).
40
+ *
41
+ * This example shows how to use an additional Icon component (styled in color based on the select option) as well
42
+ * as how to display the properties of the select option
43
+ */
44
+ const getOptionLabel = (optionValue: SelectOption): React.ReactNode => {
45
+ return (
46
+ <div className="selectOptionWrapperDiv">
47
+ <Icon icon={getIcon(optionValue.type)} type="color" color={optionValue.color} extraClassNames="mr-10" />
48
+ <div className="selectOptionDiv">
49
+ <div className="selectOption">
50
+ <strong>{optionValue.label}</strong>
51
+ </div>
52
+ <div className="selectOptionSubText">{optionValue.asset}</div>
53
+ </div>
54
+ </div>
55
+ );
56
+ };
57
+ const getOptionValue = (option: SelectOption) => {
58
+ return option.id;
59
+ };
60
+
61
+ return (
62
+ // use the getOptionLabel function to provide a custom render function that determines how the select options
63
+ // are displayed
64
+ // use the getSelectedValueLabel function to provide a custom render function that determines how the selected
65
+ // option is displayed
66
+ <Select
67
+ placeholder="formatted select options"
68
+ extraClassNames="formElementWidth"
69
+ options={options}
70
+ value={value}
71
+ getOptionLabel={getOptionLabel}
72
+ getOptionValue={getOptionValue}
73
+ getSelectedValueLabel={getOptionLabel}
74
+ onChange={(selectedOption: SelectOption) => {
75
+ onChange(selectedOption);
76
+ }}
77
+ />
78
+ );
79
+ }
80
+
81
+ export default ComplexSelectExample;