@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.
Files changed (30) hide show
  1. package/dist/cjs/f/FormInput/FormInput.js +7 -0
  2. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +11 -5
  3. package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +201 -0
  4. package/dist/cjs/f/fields/QuerySelect/index.js +15 -0
  5. package/dist/cjs/f/fields/QuerySelect/styles.scss +21 -0
  6. package/dist/cjs/f/fields/SelectInput/SelectInput.js +15 -3
  7. package/dist/cjs/f/fields/SelectInput/styles.scss +27 -14
  8. package/dist/cjs/f/fields/index.js +9 -1
  9. package/dist/es/f/FormInput/FormInput.js +8 -1
  10. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +11 -5
  11. package/dist/es/f/fields/QuerySelect/QuerySelect.js +179 -0
  12. package/dist/es/f/fields/QuerySelect/index.js +2 -0
  13. package/dist/es/f/fields/QuerySelect/styles.scss +21 -0
  14. package/dist/es/f/fields/SelectInput/SelectInput.js +14 -3
  15. package/dist/es/f/fields/SelectInput/styles.scss +27 -14
  16. package/dist/es/f/fields/index.js +2 -1
  17. package/package.json +1 -1
  18. package/src/__snapshots__/Storyshots.test.js.snap +582 -246
  19. package/src/stories/f/FormInput.stories.jsx +122 -4
  20. package/src/stories/f/QueryCombobox.stories.jsx +4 -2
  21. package/src/stories/f/QuerySelect.stories.jsx +134 -0
  22. package/src/stories/f/__generated__/FormInputAllTaskStatusesQuery.graphql.js +122 -0
  23. package/src/stories/f/__generated__/QuerySelectAllTaskStatusesQuery.graphql.js +122 -0
  24. package/src/ui/f/FormInput/FormInput.jsx +10 -0
  25. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +12 -8
  26. package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +200 -0
  27. package/src/ui/f/fields/QuerySelect/index.js +2 -0
  28. package/src/ui/f/fields/SelectInput/SelectInput.jsx +16 -3
  29. package/src/ui/f/fields/SelectInput/styles.scss +27 -14
  30. 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 // ...otherProps
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("select", _extends({
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
- .input {
20
- border: var(--theme-border-style) var(--dark-y);
21
- background: var(--light-y);
22
- color: var(--on-y);
23
- padding: $default-padding;
24
-
25
- &:not(:disabled):hover {
26
- border: var(--theme-border-style) var(--light-background4);
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
- &:disabled {
30
- background-color: var(--dark-y);
31
- }
32
-
33
- &:focus {
34
- background: var(--y);
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "2.0.0-alpha.48",
3
+ "version": "2.0.0-alpha.49",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",