@pareto-engineering/design-system 4.0.0-alpha.61 → 4.0.0-alpha.63

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 (198) hide show
  1. package/dist/cjs/a/TextSteps/TextSteps.js +4 -4
  2. package/dist/cjs/a/TextSteps/styles.scss +1 -1
  3. package/dist/cjs/f/FormInput/FormInput.js +43 -13
  4. package/dist/cjs/f/common/V2/Description/Description.js +76 -0
  5. package/dist/cjs/f/common/V2/Description/index.js +13 -0
  6. package/dist/cjs/f/common/V2/Description/styles.scss +10 -0
  7. package/dist/cjs/f/common/V2/Label/Label.js +84 -0
  8. package/dist/cjs/f/common/V2/Label/index.js +13 -0
  9. package/dist/cjs/f/common/V2/Label/styles.scss +9 -0
  10. package/dist/cjs/f/common/V2/index.js +19 -0
  11. package/dist/cjs/f/common/index.js +12 -0
  12. package/dist/cjs/f/fields/V2/Checkbox/Checkbox.js +122 -0
  13. package/dist/cjs/f/fields/V2/Checkbox/index.js +13 -0
  14. package/dist/cjs/f/fields/V2/Checkbox/styles.scss +16 -0
  15. package/dist/cjs/f/fields/V2/ChoicesInput/ChoicesInput.js +154 -0
  16. package/dist/cjs/f/fields/V2/ChoicesInput/common/Choice/Choice.js +104 -0
  17. package/dist/cjs/f/fields/V2/ChoicesInput/common/Choice/index.js +13 -0
  18. package/dist/cjs/f/fields/V2/ChoicesInput/common/index.js +12 -0
  19. package/dist/cjs/f/fields/V2/ChoicesInput/index.js +13 -0
  20. package/dist/cjs/f/fields/V2/ChoicesInput/styles.scss +79 -0
  21. package/dist/cjs/f/fields/V2/EditorInput/EditorInput.js +197 -0
  22. package/dist/cjs/f/fields/V2/EditorInput/common/Toolbar.js +257 -0
  23. package/dist/cjs/f/fields/V2/EditorInput/common/TreeViewPlugin.js +18 -0
  24. package/dist/cjs/f/fields/V2/EditorInput/common/index.js +20 -0
  25. package/dist/cjs/f/fields/V2/EditorInput/index.js +13 -0
  26. package/dist/cjs/f/fields/V2/EditorInput/styles.scss +149 -0
  27. package/dist/cjs/f/fields/V2/LinkInput/LinkInput.js +156 -0
  28. package/dist/cjs/f/fields/V2/LinkInput/index.js +13 -0
  29. package/dist/cjs/f/fields/V2/LinkInput/styles.scss +90 -0
  30. package/dist/cjs/f/fields/V2/QueryChoices/QueryChoices.js +137 -0
  31. package/dist/cjs/f/fields/V2/QueryChoices/index.js +13 -0
  32. package/dist/cjs/f/fields/V2/QueryCombobox/QueryCombobox.js +229 -0
  33. package/dist/cjs/f/fields/V2/QueryCombobox/common/Combobox/Combobox.js +236 -0
  34. package/dist/cjs/f/fields/V2/QueryCombobox/common/Combobox/index.js +13 -0
  35. package/dist/cjs/f/fields/V2/QueryCombobox/common/Menu/Menu.js +83 -0
  36. package/dist/cjs/f/fields/V2/QueryCombobox/common/Menu/index.js +13 -0
  37. package/dist/cjs/f/fields/V2/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +300 -0
  38. package/dist/cjs/f/fields/V2/QueryCombobox/common/MultipleCombobox/index.js +13 -0
  39. package/dist/cjs/f/fields/V2/QueryCombobox/common/index.js +26 -0
  40. package/dist/cjs/f/fields/V2/QueryCombobox/index.js +13 -0
  41. package/dist/cjs/f/fields/V2/QueryCombobox/styles.scss +127 -0
  42. package/dist/cjs/f/fields/V2/QuerySelect/QuerySelect.js +198 -0
  43. package/dist/cjs/f/fields/V2/QuerySelect/index.js +13 -0
  44. package/dist/cjs/f/fields/V2/RatingsInput/RatingsInput.js +130 -0
  45. package/dist/cjs/f/fields/V2/RatingsInput/common/Rating/Rating.js +117 -0
  46. package/dist/cjs/f/fields/V2/RatingsInput/common/Rating/index.js +13 -0
  47. package/dist/cjs/f/fields/V2/RatingsInput/common/index.js +12 -0
  48. package/dist/cjs/f/fields/V2/RatingsInput/index.js +13 -0
  49. package/dist/cjs/f/fields/V2/RatingsInput/styles.scss +48 -0
  50. package/dist/cjs/f/fields/V2/SelectInput/SelectInput.js +154 -0
  51. package/dist/cjs/f/fields/V2/SelectInput/index.js +13 -0
  52. package/dist/cjs/f/fields/V2/SelectInput/styles.scss +87 -0
  53. package/dist/cjs/f/fields/V2/TextInput/TextInput.js +155 -0
  54. package/dist/cjs/f/fields/V2/TextInput/index.js +13 -0
  55. package/dist/cjs/f/fields/V2/TextInput/styles.scss +78 -0
  56. package/dist/cjs/f/fields/V2/TextareaInput/TextareaInput.js +152 -0
  57. package/dist/cjs/f/fields/V2/TextareaInput/index.js +13 -0
  58. package/dist/cjs/f/fields/V2/TextareaInput/styles.scss +53 -0
  59. package/dist/cjs/f/fields/V2/index.js +82 -0
  60. package/dist/cjs/f/fields/index.js +26 -1
  61. package/dist/es/a/TextSteps/TextSteps.js +4 -4
  62. package/dist/es/a/TextSteps/styles.scss +1 -1
  63. package/dist/es/f/FormInput/FormInput.js +33 -3
  64. package/dist/es/f/common/V2/Description/Description.js +68 -0
  65. package/dist/es/f/common/V2/Description/index.js +2 -0
  66. package/dist/es/f/common/V2/Description/styles.scss +10 -0
  67. package/dist/es/f/common/V2/Label/Label.js +76 -0
  68. package/dist/es/f/common/V2/Label/index.js +2 -0
  69. package/dist/es/f/common/V2/Label/styles.scss +9 -0
  70. package/dist/es/f/common/V2/index.js +2 -0
  71. package/dist/es/f/common/index.js +2 -1
  72. package/dist/es/f/fields/V2/Checkbox/Checkbox.js +114 -0
  73. package/dist/es/f/fields/V2/Checkbox/index.js +2 -0
  74. package/dist/es/f/fields/V2/Checkbox/styles.scss +16 -0
  75. package/dist/es/f/fields/V2/ChoicesInput/ChoicesInput.js +148 -0
  76. package/dist/es/f/fields/V2/ChoicesInput/common/Choice/Choice.js +97 -0
  77. package/dist/es/f/fields/V2/ChoicesInput/common/Choice/index.js +2 -0
  78. package/dist/es/f/fields/V2/ChoicesInput/common/index.js +1 -0
  79. package/dist/es/f/fields/V2/ChoicesInput/index.js +2 -0
  80. package/dist/es/f/fields/V2/ChoicesInput/styles.scss +79 -0
  81. package/dist/es/f/fields/V2/EditorInput/EditorInput.js +192 -0
  82. package/dist/es/f/fields/V2/EditorInput/common/Toolbar.js +246 -0
  83. package/dist/es/f/fields/V2/EditorInput/common/TreeViewPlugin.js +11 -0
  84. package/dist/es/f/fields/V2/EditorInput/common/index.js +2 -0
  85. package/dist/es/f/fields/V2/EditorInput/index.js +2 -0
  86. package/dist/es/f/fields/V2/EditorInput/styles.scss +149 -0
  87. package/dist/es/f/fields/V2/LinkInput/LinkInput.js +148 -0
  88. package/dist/es/f/fields/V2/LinkInput/index.js +2 -0
  89. package/dist/es/f/fields/V2/LinkInput/styles.scss +90 -0
  90. package/dist/es/f/fields/V2/QueryChoices/QueryChoices.js +126 -0
  91. package/dist/es/f/fields/V2/QueryChoices/index.js +2 -0
  92. package/dist/es/f/fields/V2/QueryCombobox/QueryCombobox.js +221 -0
  93. package/dist/es/f/fields/V2/QueryCombobox/common/Combobox/Combobox.js +229 -0
  94. package/dist/es/f/fields/V2/QueryCombobox/common/Combobox/index.js +2 -0
  95. package/dist/es/f/fields/V2/QueryCombobox/common/Menu/Menu.js +73 -0
  96. package/dist/es/f/fields/V2/QueryCombobox/common/Menu/index.js +2 -0
  97. package/dist/es/f/fields/V2/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +293 -0
  98. package/dist/es/f/fields/V2/QueryCombobox/common/MultipleCombobox/index.js +2 -0
  99. package/dist/es/f/fields/V2/QueryCombobox/common/index.js +3 -0
  100. package/dist/es/f/fields/V2/QueryCombobox/index.js +2 -0
  101. package/dist/es/f/fields/V2/QueryCombobox/styles.scss +127 -0
  102. package/dist/es/f/fields/V2/QuerySelect/QuerySelect.js +186 -0
  103. package/dist/es/f/fields/V2/QuerySelect/index.js +2 -0
  104. package/dist/es/f/fields/V2/RatingsInput/RatingsInput.js +124 -0
  105. package/dist/es/f/fields/V2/RatingsInput/common/Rating/Rating.js +109 -0
  106. package/dist/es/f/fields/V2/RatingsInput/common/Rating/index.js +2 -0
  107. package/dist/es/f/fields/V2/RatingsInput/common/index.js +1 -0
  108. package/dist/es/f/fields/V2/RatingsInput/index.js +2 -0
  109. package/dist/es/f/fields/V2/RatingsInput/styles.scss +48 -0
  110. package/dist/es/f/fields/V2/SelectInput/SelectInput.js +146 -0
  111. package/dist/es/f/fields/V2/SelectInput/index.js +2 -0
  112. package/dist/es/f/fields/V2/SelectInput/styles.scss +87 -0
  113. package/dist/es/f/fields/V2/TextInput/TextInput.js +147 -0
  114. package/dist/es/f/fields/V2/TextInput/index.js +2 -0
  115. package/dist/es/f/fields/V2/TextInput/styles.scss +78 -0
  116. package/dist/es/f/fields/V2/TextareaInput/TextareaInput.js +146 -0
  117. package/dist/es/f/fields/V2/TextareaInput/index.js +2 -0
  118. package/dist/es/f/fields/V2/TextareaInput/styles.scss +53 -0
  119. package/dist/es/f/fields/V2/index.js +11 -0
  120. package/dist/es/f/fields/index.js +2 -1
  121. package/package.json +3 -3
  122. package/src/stories/f/v2/Checkbox.stories.jsx +102 -0
  123. package/src/stories/f/v2/ChoicesInput.stories.jsx +139 -0
  124. package/src/stories/f/v2/EditorInput.stories.jsx +81 -0
  125. package/src/stories/f/v2/LinkInput.stories.jsx +93 -0
  126. package/src/stories/f/v2/QueryChoices.stories.jsx +144 -0
  127. package/src/stories/f/v2/QueryCombobox.stories.jsx +301 -0
  128. package/src/stories/f/v2/QuerySelect.stories.jsx +150 -0
  129. package/src/stories/f/v2/RatingsInput.stories.jsx +77 -0
  130. package/src/stories/f/v2/SelectInput.stories.jsx +95 -0
  131. package/src/stories/f/v2/TextInput.stories.jsx +120 -0
  132. package/src/stories/f/v2/TextareaInput.stories.jsx +107 -0
  133. package/src/stories/f/v2/__generated__/FormInputAllTaskStatusesQuery.graphql.js +122 -0
  134. package/src/stories/f/v2/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
  135. package/src/stories/f/v2/__generated__/QueryChoicesAllTaskStatusesQuery.graphql.js +122 -0
  136. package/src/stories/f/v2/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
  137. package/src/stories/f/v2/__generated__/QuerySelectAllTaskStatusesQuery.graphql.js +122 -0
  138. package/src/ui/a/TextSteps/TextSteps.jsx +4 -4
  139. package/src/ui/a/TextSteps/styles.scss +1 -1
  140. package/src/ui/f/FormInput/FormInput.jsx +57 -12
  141. package/src/ui/f/common/V2/Description/Description.jsx +94 -0
  142. package/src/ui/f/common/V2/Description/index.js +2 -0
  143. package/src/ui/f/common/V2/Description/styles.scss +10 -0
  144. package/src/ui/f/common/V2/Label/Label.jsx +102 -0
  145. package/src/ui/f/common/V2/Label/index.js +2 -0
  146. package/src/ui/f/common/V2/Label/styles.scss +9 -0
  147. package/src/ui/f/common/V2/index.js +2 -0
  148. package/src/ui/f/common/index.js +1 -0
  149. package/src/ui/f/fields/V2/Checkbox/Checkbox.jsx +146 -0
  150. package/src/ui/f/fields/V2/Checkbox/index.js +2 -0
  151. package/src/ui/f/fields/V2/Checkbox/styles.scss +16 -0
  152. package/src/ui/f/fields/V2/ChoicesInput/ChoicesInput.jsx +183 -0
  153. package/src/ui/f/fields/V2/ChoicesInput/common/Choice/Choice.jsx +125 -0
  154. package/src/ui/f/fields/V2/ChoicesInput/common/Choice/index.js +2 -0
  155. package/src/ui/f/fields/V2/ChoicesInput/common/index.js +1 -0
  156. package/src/ui/f/fields/V2/ChoicesInput/index.js +2 -0
  157. package/src/ui/f/fields/V2/ChoicesInput/styles.scss +79 -0
  158. package/src/ui/f/fields/V2/EditorInput/EditorInput.jsx +244 -0
  159. package/src/ui/f/fields/V2/EditorInput/common/Toolbar.jsx +356 -0
  160. package/src/ui/f/fields/V2/EditorInput/common/TreeViewPlugin.jsx +16 -0
  161. package/src/ui/f/fields/V2/EditorInput/common/index.jsx +2 -0
  162. package/src/ui/f/fields/V2/EditorInput/index.js +2 -0
  163. package/src/ui/f/fields/V2/EditorInput/styles.scss +149 -0
  164. package/src/ui/f/fields/V2/LinkInput/LinkInput.jsx +187 -0
  165. package/src/ui/f/fields/V2/LinkInput/index.js +2 -0
  166. package/src/ui/f/fields/V2/LinkInput/styles.scss +90 -0
  167. package/src/ui/f/fields/V2/QueryChoices/QueryChoices.jsx +153 -0
  168. package/src/ui/f/fields/V2/QueryChoices/index.js +2 -0
  169. package/src/ui/f/fields/V2/QueryCombobox/QueryCombobox.jsx +254 -0
  170. package/src/ui/f/fields/V2/QueryCombobox/common/Combobox/Combobox.jsx +276 -0
  171. package/src/ui/f/fields/V2/QueryCombobox/common/Combobox/index.js +2 -0
  172. package/src/ui/f/fields/V2/QueryCombobox/common/Menu/Menu.jsx +103 -0
  173. package/src/ui/f/fields/V2/QueryCombobox/common/Menu/index.js +2 -0
  174. package/src/ui/f/fields/V2/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +362 -0
  175. package/src/ui/f/fields/V2/QueryCombobox/common/MultipleCombobox/index.js +2 -0
  176. package/src/ui/f/fields/V2/QueryCombobox/common/index.js +3 -0
  177. package/src/ui/f/fields/V2/QueryCombobox/index.js +2 -0
  178. package/src/ui/f/fields/V2/QueryCombobox/styles.scss +127 -0
  179. package/src/ui/f/fields/V2/QuerySelect/QuerySelect.jsx +220 -0
  180. package/src/ui/f/fields/V2/QuerySelect/index.js +2 -0
  181. package/src/ui/f/fields/V2/RatingsInput/RatingsInput.jsx +152 -0
  182. package/src/ui/f/fields/V2/RatingsInput/common/Rating/Rating.jsx +142 -0
  183. package/src/ui/f/fields/V2/RatingsInput/common/Rating/index.js +2 -0
  184. package/src/ui/f/fields/V2/RatingsInput/common/index.js +1 -0
  185. package/src/ui/f/fields/V2/RatingsInput/index.js +2 -0
  186. package/src/ui/f/fields/V2/RatingsInput/styles.scss +48 -0
  187. package/src/ui/f/fields/V2/SelectInput/SelectInput.jsx +187 -0
  188. package/src/ui/f/fields/V2/SelectInput/index.js +2 -0
  189. package/src/ui/f/fields/V2/SelectInput/styles.scss +87 -0
  190. package/src/ui/f/fields/V2/TextInput/TextInput.jsx +192 -0
  191. package/src/ui/f/fields/V2/TextInput/index.js +2 -0
  192. package/src/ui/f/fields/V2/TextInput/styles.scss +78 -0
  193. package/src/ui/f/fields/V2/TextareaInput/TextareaInput.jsx +180 -0
  194. package/src/ui/f/fields/V2/TextareaInput/index.js +2 -0
  195. package/src/ui/f/fields/V2/TextareaInput/styles.scss +53 -0
  196. package/src/ui/f/fields/V2/index.js +11 -0
  197. package/src/ui/f/fields/index.js +1 -0
  198. package/tests/__snapshots__/Storyshots.test.js.snap +5910 -1
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var React = _react;
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
11
+ var _common = require("./common");
12
+ var _common2 = require("../../../common");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } /* @pareto-engineering/generator-front 1.0.12 */ // Local Definitions
17
+ const baseClassName = _exports.default.base;
18
+ const componentClassName = 'choices-input';
19
+
20
+ /**
21
+ * This is the component description.
22
+ */
23
+ const ChoicesInput = _ref => {
24
+ let {
25
+ id,
26
+ className: userClassName,
27
+ style,
28
+ name,
29
+ validate,
30
+ options,
31
+ multiple,
32
+ color,
33
+ label,
34
+ labelColor,
35
+ optional,
36
+ disabled,
37
+ description,
38
+ spaceBetween,
39
+ ...otherProps
40
+ } = _ref;
41
+ (0, _react.useInsertionEffect)(() => {
42
+ Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
43
+ }, []);
44
+ return /*#__PURE__*/React.createElement("div", {
45
+ id: id,
46
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
47
+ style: style
48
+ }, label && /*#__PURE__*/React.createElement(_common2.FormLabelV2, {
49
+ name: name,
50
+ color: labelColor,
51
+ optional: optional
52
+ // {...otherProps}
53
+ }, label), /*#__PURE__*/React.createElement("div", {
54
+ className: ['choices', spaceBetween && 'space-between'].filter(Boolean).join(' ')
55
+ }, options.map(choice => /*#__PURE__*/React.createElement(_common.Choice, _extends({
56
+ className: `x-${color}`,
57
+ key: choice.value,
58
+ name: name,
59
+ id: `${name}-${choice.value}`,
60
+ multiple: multiple,
61
+ validate: validate,
62
+ disabled: disabled
63
+ }, otherProps, choice)))), /*#__PURE__*/React.createElement(_common2.FormDescriptionV2, {
64
+ className: "s-1",
65
+ description: description,
66
+ name: name
67
+ }));
68
+ };
69
+ ChoicesInput.propTypes = {
70
+ /**
71
+ * The HTML id for this element
72
+ */
73
+ id: _propTypes.default.string,
74
+ /**
75
+ * The HTML class names for this element
76
+ */
77
+ className: _propTypes.default.string,
78
+ /**
79
+ * The React-written, css properties for this element.
80
+ */
81
+ style: _propTypes.default.objectOf(_propTypes.default.string),
82
+ /**
83
+ * The choices name
84
+ */
85
+ name: _propTypes.default.string.isRequired,
86
+ /**
87
+ * The input field validator function
88
+ */
89
+ validate: _propTypes.default.string,
90
+ /**
91
+ * The choices input options
92
+ */
93
+ options: _propTypes.default.arrayOf(_propTypes.default.shape({
94
+ value: _propTypes.default.string,
95
+ label: _propTypes.default.string
96
+ })),
97
+ /**
98
+ * If the input should be multiple - checkbox
99
+ */
100
+ multiple: _propTypes.default.bool,
101
+ /**
102
+ * how many columns should be displayed on the mobile grid
103
+ */
104
+ gridColumnsMobile: _propTypes.default.number,
105
+ /**
106
+ * The choice color
107
+ */
108
+ color: _propTypes.default.string,
109
+ /**
110
+ * The selected choice color
111
+ */
112
+ colorChecked: _propTypes.default.string,
113
+ /**
114
+ * The label of the choices input
115
+ */
116
+ label: _propTypes.default.string,
117
+ /**
118
+ * Whether all the Choices inputs should be disabled
119
+ */
120
+ disabled: _propTypes.default.bool,
121
+ /**
122
+ * Whether the input is optional or not
123
+ */
124
+ optional: _propTypes.default.bool,
125
+ /**
126
+ * The select input description
127
+ */
128
+ description: _propTypes.default.string,
129
+ /**
130
+ * The number of columns the label should span
131
+ */
132
+ labelSpan: _propTypes.default.number,
133
+ /**
134
+ * The number of columns the input should span
135
+ */
136
+ inputSpan: _propTypes.default.number,
137
+ /**
138
+ * The number of columns the label should span on desktop
139
+ */
140
+ desktopLabelSpan: _propTypes.default.number,
141
+ /**
142
+ * The number of columns the input should span on desktop
143
+ */
144
+ desktopInputSpan: _propTypes.default.number,
145
+ /**
146
+ * The color of the label
147
+ */
148
+ labelColor: _propTypes.default.string
149
+ };
150
+ ChoicesInput.defaultProps = {
151
+ color: 'interactive',
152
+ disabled: false
153
+ };
154
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(ChoicesInput);
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _formik = require("formik");
10
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /* @pareto-engineering/generator-front 1.0.12 */ // Local Definitions
15
+ const baseClassName = _exports.default.base;
16
+ const componentClassName = 'choice';
17
+
18
+ /**
19
+ * This is the component description.
20
+ */
21
+ const Choice = _ref => {
22
+ let {
23
+ id,
24
+ className: userClassName,
25
+ style,
26
+ name,
27
+ label,
28
+ labelClassName,
29
+ labelStyle,
30
+ value,
31
+ multiple,
32
+ validate,
33
+ disabled
34
+ } = _ref;
35
+ const type = multiple ? 'checkbox' : 'radio';
36
+ const [field] = (0, _formik.useField)({
37
+ name,
38
+ validate,
39
+ type,
40
+ value
41
+ });
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
44
+ style: style
45
+ }, /*#__PURE__*/React.createElement("input", _extends({
46
+ type: type,
47
+ id: id,
48
+ name: name
49
+ }, field, {
50
+ value: value,
51
+ disabled: disabled
52
+ })), /*#__PURE__*/React.createElement("label", {
53
+ htmlFor: id,
54
+ className: [labelClassName, disabled && 'disabled'].filter(e => e).join(' '),
55
+ style: labelStyle
56
+ }, label));
57
+ };
58
+ Choice.propTypes = {
59
+ /**
60
+ * The HTML id for this element
61
+ */
62
+ id: _propTypes.default.string,
63
+ /**
64
+ * The HTML class names for this element
65
+ */
66
+ className: _propTypes.default.string,
67
+ /**
68
+ * The React-written, css properties for this element.
69
+ */
70
+ style: _propTypes.default.objectOf(_propTypes.default.string),
71
+ /**
72
+ * The input name.
73
+ */
74
+ name: _propTypes.default.string.isRequired,
75
+ /**
76
+ * The input label.
77
+ */
78
+ label: _propTypes.default.string.isRequired,
79
+ /**
80
+ * The input label class name.
81
+ */
82
+ labelClassName: _propTypes.default.string,
83
+ /**
84
+ * The input label styles.
85
+ */
86
+ labelStyle: _propTypes.default.objectOf(_propTypes.default.string),
87
+ /**
88
+ * The input value.
89
+ */
90
+ value: _propTypes.default.string.isRequired,
91
+ /**
92
+ * If the input should be multiple - checkbox
93
+ */
94
+ multiple: _propTypes.default.bool,
95
+ /**
96
+ * The input field validator function
97
+ */
98
+ validate: _propTypes.default.func,
99
+ /**
100
+ * Whether the radio or checkbox choice should be disabled
101
+ */
102
+ disabled: _propTypes.default.bool
103
+ };
104
+ var _default = exports.default = Choice;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Choice", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Choice.default;
10
+ }
11
+ });
12
+ var _Choice = _interopRequireDefault(require("./Choice"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Choice", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Choice.Choice;
10
+ }
11
+ });
12
+ var _Choice = require("./Choice");
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ChoicesInput", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ChoicesInput.default;
10
+ }
11
+ });
12
+ var _ChoicesInput = _interopRequireDefault(require("./ChoicesInput"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,79 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ /* stylelint-disable selector-max-compound-selectors -- exception */
3
+ /* stylelint-disable max-nesting-depth -- exception */
4
+
5
+ @use "@pareto-engineering/bem";
6
+ @use "@pareto-engineering/styles/src/mixins";
7
+ @use "@pareto-engineering/styles/src/globals" as *;
8
+
9
+ $default-flex-separator:calc(1em / 2) calc(.75em / 2);
10
+ $default-transition:var(--theme-default-transition);
11
+ $default-label-padding: .3em 1em calc(2em - .3em);
12
+ $default-label-height: .5em;
13
+ $default-input-border-radius: var(--theme-default-input-border-radius);
14
+ $default-border: var(--theme-default-input-border);
15
+ $hover-border: var(--theme-hover-input-border);
16
+ $focus-border: var(--theme-focus-input-border);
17
+ $default-background: var(--background-inputs);
18
+ $disabled-background: var(--background-inputs-30);
19
+
20
+ .#{bem.$base}.choices-input {
21
+ display: flex;
22
+ flex-direction: column;
23
+
24
+ > .#{bem.$base}.form-label {
25
+ margin-bottom: var(--gap);
26
+ }
27
+
28
+ > .choices {
29
+ display: flex;
30
+ flex-wrap: wrap;
31
+ gap: $default-flex-separator;
32
+
33
+ &.space-between {
34
+ justify-content: space-between;
35
+ }
36
+
37
+ >.choice {
38
+ display: flex;
39
+
40
+ input {
41
+ opacity: 0;
42
+ position: fixed;
43
+ visibility: none;
44
+ z-index: -1;
45
+ }
46
+
47
+ input:disabled + label {
48
+ background-color: $disabled-background;
49
+ }
50
+
51
+ > label {
52
+ background-color: $default-background;
53
+ border: $default-border;
54
+ border-radius: $default-input-border-radius;
55
+ color: var(--paragraph);
56
+ cursor: pointer;
57
+ display: block;
58
+ height: $default-label-height;
59
+ max-width: 100%;
60
+ padding: $default-label-padding;
61
+ position: relative;
62
+ transition: $default-transition;
63
+ white-space: nowrap;
64
+
65
+ &:not(.disabled) {
66
+ &:hover {
67
+ border: $hover-border;
68
+ }
69
+ }
70
+ }
71
+
72
+ input:checked + label {
73
+ background: var(--x);
74
+ color: var(--on-x);
75
+ }
76
+ }
77
+ }
78
+ }
79
+
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var React = _react;
9
+ var _formik = require("formik");
10
+ var _LexicalComposer = require("@lexical/react/LexicalComposer");
11
+ var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
12
+ var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
13
+ var _LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
14
+ var _LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
15
+ var _LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
16
+ var _LexicalListPlugin = require("@lexical/react/LexicalListPlugin");
17
+ var _LexicalTabIndentationPlugin = require("@lexical/react/LexicalTabIndentationPlugin");
18
+ var _link = require("@lexical/link");
19
+ var _list = require("@lexical/list");
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
22
+ var _common = require("../../../common");
23
+ var _common2 = require("./common");
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
26
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } /* @pareto-engineering/generator-front 1.0.12 */ /* eslint-disable import/no-extraneous-dependencies -- required here */ // Local Definitions
27
+ const baseClassName = _exports.default.base;
28
+ const componentClassName = 'editor-input';
29
+
30
+ /**
31
+ * This is the component description.
32
+ */
33
+ const EditorInput = _ref => {
34
+ let {
35
+ id,
36
+ className: userClassName,
37
+ style,
38
+ name,
39
+ label,
40
+ // validate,
41
+ resize,
42
+ color,
43
+ rows,
44
+ optional,
45
+ labelColor,
46
+ description,
47
+ disabled,
48
+ showDebugger
49
+ // ...otherProps
50
+ } = _ref;
51
+ (0, _react.useInsertionEffect)(() => {
52
+ Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
53
+ }, []);
54
+ const formik = (0, _formik.useFormikContext)();
55
+ const setInitialValue = () => {
56
+ const value = formik.values[name];
57
+ try {
58
+ JSON.parse(value);
59
+ return value;
60
+ } catch {
61
+ const defaultValue = {
62
+ root: {
63
+ children: [{
64
+ children: [{
65
+ detail: 0,
66
+ format: 0,
67
+ mode: 'normal',
68
+ style: '',
69
+ text: '',
70
+ type: 'text',
71
+ version: 1
72
+ }],
73
+ direction: 'ltr',
74
+ format: '',
75
+ indent: 0,
76
+ type: 'paragraph',
77
+ version: 1
78
+ }],
79
+ direction: 'ltr',
80
+ format: '',
81
+ indent: 0,
82
+ type: 'root',
83
+ version: 1
84
+ }
85
+ };
86
+ defaultValue.root.children[0].children[0].text = value;
87
+ return JSON.stringify(defaultValue);
88
+ }
89
+ };
90
+ const onChange = state => {
91
+ formik.setValues({
92
+ ...formik.values,
93
+ [name]: JSON.stringify(state)
94
+ });
95
+ };
96
+ const initialConfig = {
97
+ nameSpace: name,
98
+ editable: !disabled,
99
+ editorState: setInitialValue(),
100
+ theme: {
101
+ text: {
102
+ italic: 'italic',
103
+ strikethrough: 'strikethrough',
104
+ underline: 'underlined'
105
+ }
106
+ },
107
+ nodes: [_link.AutoLinkNode, _link.LinkNode, _list.ListNode, _list.ListItemNode]
108
+ };
109
+ return /*#__PURE__*/React.createElement(_LexicalComposer.LexicalComposer, {
110
+ initialConfig: initialConfig
111
+ }, /*#__PURE__*/React.createElement("div", {
112
+ id: id,
113
+ className: [baseClassName, componentClassName, userClassName, `y-${color}`, disabled && 'disabled'].filter(e => e).join(' '),
114
+ style: {
115
+ ...style,
116
+ '--resize': resize,
117
+ '--rows': `${rows}em`
118
+ }
119
+ }, /*#__PURE__*/React.createElement(_common.FormLabelV2, {
120
+ name: name,
121
+ color: labelColor,
122
+ optional: optional
123
+ }, label), !disabled && /*#__PURE__*/React.createElement(_common2.Toolbar, null), /*#__PURE__*/React.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
124
+ contentEditable: /*#__PURE__*/React.createElement(_LexicalContentEditable.ContentEditable, {
125
+ id: name,
126
+ className: "content-editable"
127
+ })
128
+ }), /*#__PURE__*/React.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
129
+ onChange: onChange
130
+ }), /*#__PURE__*/React.createElement(_LexicalLinkPlugin.LinkPlugin, null), /*#__PURE__*/React.createElement(_LexicalListPlugin.ListPlugin, null), /*#__PURE__*/React.createElement(_LexicalTabIndentationPlugin.TabIndentationPlugin, null), /*#__PURE__*/React.createElement(_LexicalHistoryPlugin.HistoryPlugin, null), /*#__PURE__*/React.createElement(_common.FormDescriptionV2, {
131
+ className: "s-1",
132
+ description: description,
133
+ name: name
134
+ }), showDebugger && /*#__PURE__*/React.createElement(_common2.TreeViewPlugin, null)));
135
+ };
136
+ EditorInput.propTypes = {
137
+ /**
138
+ * The HTML id for this element
139
+ */
140
+ id: _propTypes.default.string,
141
+ /**
142
+ * The HTML class names for this element
143
+ */
144
+ className: _propTypes.default.string,
145
+ /**
146
+ * The React-written, css properties for this element.
147
+ */
148
+ style: _propTypes.default.objectOf(_propTypes.default.string),
149
+ /**
150
+ * The input name (html - and Formik state)
151
+ */
152
+ name: _propTypes.default.string.isRequired,
153
+ /**
154
+ * The input label
155
+ */
156
+ label: _propTypes.default.string.isRequired,
157
+ /**
158
+ * The input value validator function
159
+ */
160
+ // validate:PropTypes.func,
161
+
162
+ /**
163
+ * The number of rows int the text area
164
+ */
165
+ rows: _propTypes.default.number,
166
+ /**
167
+ * Color of the text
168
+ */
169
+ color: _propTypes.default.string,
170
+ /**
171
+ * Label base color
172
+ */
173
+ labelColor: _propTypes.default.string,
174
+ /**
175
+ * Text area description
176
+ */
177
+ description: _propTypes.default.string,
178
+ /**
179
+ * Whether the text area should be disabled
180
+ */
181
+ disabled: _propTypes.default.bool,
182
+ /**
183
+ * Whether the input is optional or not
184
+ */
185
+ optional: _propTypes.default.bool,
186
+ /**
187
+ * The resize property of the text area
188
+ */
189
+ resize: _propTypes.default.oneOf(['none', 'both', 'horizontal', 'vertical'])
190
+ };
191
+ EditorInput.defaultProps = {
192
+ rows: 10,
193
+ disabled: false,
194
+ color: 'paragraph',
195
+ resize: 'vertical'
196
+ };
197
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(EditorInput);