@pareto-engineering/design-system 2.0.0-alpha.48 → 2.0.0-alpha.49
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/dist/cjs/f/FormInput/FormInput.js +7 -0
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +11 -5
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +201 -0
- package/dist/cjs/f/fields/QuerySelect/index.js +15 -0
- package/dist/cjs/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +15 -3
- package/dist/cjs/f/fields/SelectInput/styles.scss +27 -14
- package/dist/cjs/f/fields/index.js +9 -1
- package/dist/es/f/FormInput/FormInput.js +8 -1
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +11 -5
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +179 -0
- package/dist/es/f/fields/QuerySelect/index.js +2 -0
- package/dist/es/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/es/f/fields/SelectInput/SelectInput.js +14 -3
- package/dist/es/f/fields/SelectInput/styles.scss +27 -14
- package/dist/es/f/fields/index.js +2 -1
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +582 -246
- package/src/stories/f/FormInput.stories.jsx +122 -4
- package/src/stories/f/QueryCombobox.stories.jsx +4 -2
- package/src/stories/f/QuerySelect.stories.jsx +134 -0
- package/src/stories/f/__generated__/FormInputAllTaskStatusesQuery.graphql.js +122 -0
- package/src/stories/f/__generated__/QuerySelectAllTaskStatusesQuery.graphql.js +122 -0
- package/src/ui/f/FormInput/FormInput.jsx +10 -0
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +12 -8
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +200 -0
- package/src/ui/f/fields/QuerySelect/index.js +2 -0
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +16 -3
- package/src/ui/f/fields/SelectInput/styles.scss +27 -14
- package/src/ui/f/fields/index.js +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
$default-loading-circle-displacement: .8em;
|
|
5
|
+
|
|
6
|
+
.#{bem.$base}.query-select {
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
>.#{bem.$base}.select-input {
|
|
11
|
+
select:disabled {
|
|
12
|
+
appearance: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
>.#{bem.$base}.loading-circle {
|
|
17
|
+
position: absolute;
|
|
18
|
+
right: $default-loading-circle-displacement;
|
|
19
|
+
bottom: $default-loading-circle-displacement;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -6,6 +6,7 @@ import { useLayoutEffect, memo } from 'react';
|
|
|
6
6
|
import { useField } from 'formik';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import styleNames from '@pareto-engineering/bem';
|
|
9
|
+
import { LoadingCircle } from "../../../a";
|
|
9
10
|
import { FormLabel, FormDescription } from "../../common"; // Local Definitions
|
|
10
11
|
|
|
11
12
|
const baseClassName = styleNames.base;
|
|
@@ -24,7 +25,8 @@ const SelectInput = ({
|
|
|
24
25
|
options,
|
|
25
26
|
validate,
|
|
26
27
|
description,
|
|
27
|
-
disabled
|
|
28
|
+
disabled,
|
|
29
|
+
isLoading // ...otherProps
|
|
28
30
|
|
|
29
31
|
}) => {
|
|
30
32
|
useLayoutEffect(() => {
|
|
@@ -41,7 +43,9 @@ const SelectInput = ({
|
|
|
41
43
|
|
|
42
44
|
}, /*#__PURE__*/React.createElement(FormLabel, {
|
|
43
45
|
name: name
|
|
44
|
-
}, label), /*#__PURE__*/React.createElement("
|
|
46
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: "select-wrapper"
|
|
48
|
+
}, /*#__PURE__*/React.createElement("select", _extends({
|
|
45
49
|
className: "input"
|
|
46
50
|
}, field, {
|
|
47
51
|
value: field.value || '',
|
|
@@ -58,6 +62,8 @@ const SelectInput = ({
|
|
|
58
62
|
value: newOption.value,
|
|
59
63
|
disabled: (newOption === null || newOption === void 0 ? void 0 : newOption.disabled) || false
|
|
60
64
|
}, newOption.label);
|
|
65
|
+
})), isLoading && /*#__PURE__*/React.createElement(LoadingCircle, {
|
|
66
|
+
className: "x-main2"
|
|
61
67
|
})), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
|
|
62
68
|
isError: !!meta.error,
|
|
63
69
|
className: "v50 mt-v s-1"
|
|
@@ -117,7 +123,12 @@ SelectInput.propTypes = {
|
|
|
117
123
|
/**
|
|
118
124
|
* The color of the select input
|
|
119
125
|
*/
|
|
120
|
-
color: PropTypes.string
|
|
126
|
+
color: PropTypes.string,
|
|
127
|
+
|
|
128
|
+
/*
|
|
129
|
+
* Whether the query that is fetching the select options is still in flight
|
|
130
|
+
*/
|
|
131
|
+
isLoading: PropTypes.bool
|
|
121
132
|
};
|
|
122
133
|
SelectInput.defaultProps = {
|
|
123
134
|
disabled: false,
|
|
@@ -16,22 +16,35 @@ $default-margin: 1em;
|
|
|
16
16
|
margin-bottom: $default-margin
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
.select-wrapper {
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
>.#{bem.$base}.loading-circle {
|
|
23
|
+
position: absolute;
|
|
24
|
+
right: 0;
|
|
25
|
+
top: 50%;
|
|
26
|
+
transform: translateY(-50%);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
>.input {
|
|
30
|
+
width: 100%;
|
|
31
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
32
|
+
background: var(--light-y);
|
|
33
|
+
color: var(--on-y);
|
|
34
|
+
padding: $default-padding;
|
|
35
|
+
|
|
36
|
+
&:not(:disabled):hover {
|
|
37
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:disabled {
|
|
41
|
+
background-color: var(--dark-y);
|
|
42
|
+
appearance: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:focus {
|
|
46
|
+
background: var(--y);
|
|
47
|
+
}
|
|
35
48
|
}
|
|
36
49
|
}
|
|
37
50
|
}
|
|
@@ -3,4 +3,5 @@ export { SelectInput } from "./SelectInput";
|
|
|
3
3
|
export { ChoicesInput } from "./ChoicesInput";
|
|
4
4
|
export { TextareaInput } from "./TextareaInput";
|
|
5
5
|
export { RatingsInput } from "./RatingsInput";
|
|
6
|
-
export { QueryCombobox } from "./QueryCombobox";
|
|
6
|
+
export { QueryCombobox } from "./QueryCombobox";
|
|
7
|
+
export { QuerySelect } from "./QuerySelect";
|