@pareto-engineering/design-system 2.0.0-alpha.61 → 2.0.0-alpha.62

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 (183) hide show
  1. package/dist/cjs/a/GradientBackground/GradientBackground.js +140 -0
  2. package/dist/cjs/a/GradientBackground/index.js +15 -0
  3. package/dist/cjs/a/GradientBackground/styles.scss +191 -0
  4. package/dist/cjs/a/Popover/common/Divider/Divider.js +67 -0
  5. package/dist/cjs/a/Popover/common/Divider/index.js +15 -0
  6. package/dist/cjs/a/Popover/common/Item/Item.js +67 -0
  7. package/dist/cjs/a/Popover/common/Item/index.js +15 -0
  8. package/dist/cjs/a/Popover/common/index.js +21 -0
  9. package/dist/cjs/c/AcceptCookies/AcceptCookies.js +134 -0
  10. package/dist/cjs/c/AcceptCookies/index.js +15 -0
  11. package/dist/cjs/c/AcceptCookies/styles.scss +49 -0
  12. package/dist/cjs/c/BlogCategoryButton/BlogCategoryButton.js +95 -0
  13. package/dist/cjs/c/BlogCategoryButton/index.js +15 -0
  14. package/dist/cjs/c/BlogContext/BlogContextProvider.js +63 -0
  15. package/dist/cjs/c/BlogContext/Context.js +16 -0
  16. package/dist/cjs/c/BlogContext/ContextProvider.js +63 -0
  17. package/dist/cjs/c/BlogContext/index.js +31 -0
  18. package/dist/cjs/c/BlogContext/useBlog.js +16 -0
  19. package/dist/cjs/c/BlogPost/BlogPost.js +147 -0
  20. package/dist/cjs/c/BlogPost/index.js +15 -0
  21. package/dist/cjs/c/BlogPost/styles.scss +33 -0
  22. package/dist/cjs/c/BlogPostsList/BlogPostsList.js +73 -0
  23. package/dist/cjs/c/BlogPostsList/common/Card/Card.js +170 -0
  24. package/dist/cjs/c/BlogPostsList/common/Card/index.js +15 -0
  25. package/dist/cjs/c/BlogPostsList/common/index.js +13 -0
  26. package/dist/cjs/c/BlogPostsList/index.js +15 -0
  27. package/dist/cjs/c/BlogPostsList/styles.scss +72 -0
  28. package/dist/cjs/c/SiteFooter/SiteFooter.js +73 -0
  29. package/dist/cjs/c/SiteFooter/common/Section/Section.js +95 -0
  30. package/dist/cjs/c/SiteFooter/common/Section/index.js +15 -0
  31. package/dist/cjs/c/SiteFooter/common/index.js +13 -0
  32. package/dist/cjs/c/SiteFooter/index.js +15 -0
  33. package/dist/cjs/c/SiteFooter/styles.scss +34 -0
  34. package/dist/cjs/c/SiteHeaderCTA/SiteHeaderCTA.js +108 -0
  35. package/dist/cjs/c/SiteHeaderCTA/index.js +15 -0
  36. package/dist/cjs/c/SiteHeaderCTA/styles.scss +44 -0
  37. package/dist/cjs/c/SiteMission/SiteMission.js +113 -0
  38. package/dist/cjs/{a/ColumnLabel → c/SiteMission}/index.js +3 -3
  39. package/dist/cjs/c/SiteMission/styles.scss +30 -0
  40. package/dist/cjs/c/SiteNavigation/SiteNavigation.js +130 -0
  41. package/dist/cjs/c/SiteNavigation/index.js +15 -0
  42. package/dist/cjs/c/SiteNavigation/styles.scss +118 -0
  43. package/dist/cjs/c/SiteOnboardingStep/SiteOnboardingStep.js +98 -0
  44. package/dist/cjs/c/SiteOnboardingStep/index.js +15 -0
  45. package/dist/cjs/c/SiteOnboardingStep/styles.scss +51 -0
  46. package/dist/cjs/c/SitePricing/SitePricing.js +108 -0
  47. package/dist/cjs/c/SitePricing/index.js +15 -0
  48. package/dist/cjs/c/SitePricing/styles.scss +73 -0
  49. package/dist/cjs/c/SiteServices/SiteServices.js +211 -0
  50. package/dist/cjs/c/SiteServices/index.js +15 -0
  51. package/dist/cjs/c/SiteServices/styles.scss +138 -0
  52. package/dist/cjs/c/TeamGallery/TeamGallery.js +80 -0
  53. package/dist/cjs/c/TeamGallery/common/PersonCard/PersonCard.js +84 -0
  54. package/dist/cjs/c/TeamGallery/common/PersonCard/index.js +15 -0
  55. package/dist/cjs/c/TeamGallery/common/index.js +13 -0
  56. package/dist/cjs/c/TeamGallery/index.js +15 -0
  57. package/dist/cjs/c/TeamGallery/styles.scss +100 -0
  58. package/dist/cjs/c/Testimonials/Testimonials.js +119 -0
  59. package/dist/cjs/c/Testimonials/index.js +15 -0
  60. package/dist/cjs/c/Testimonials/styles.scss +112 -0
  61. package/dist/cjs/{a/ColumnLabel/ColumnLabel.js → experimental/GradientBackground/GradientBackground.js} +30 -32
  62. package/dist/cjs/experimental/GradientBackground/index.js +15 -0
  63. package/dist/cjs/experimental/GradientBackground/styles.scss +64 -0
  64. package/dist/cjs/experimental/index.js +13 -0
  65. package/dist/cjs/f/FormInput/FormInput.js +6 -0
  66. package/dist/cjs/f/fields/Checkbox/Checkbox.js +117 -0
  67. package/dist/cjs/f/fields/Checkbox/index.js +15 -0
  68. package/dist/cjs/f/fields/Checkbox/styles.scss +14 -0
  69. package/dist/cjs/f/fields/IntlTelInput/IntlTelInput.js +170 -0
  70. package/dist/cjs/f/fields/IntlTelInput/index.js +15 -0
  71. package/dist/cjs/f/fields/IntlTelInput/styles.scss +37 -0
  72. package/dist/cjs/f/fields/PhoneIntlTelInput/PhoneIntlTelInput.js +180 -0
  73. package/dist/cjs/f/fields/PhoneIntlTelInput/index.js +15 -0
  74. package/dist/cjs/f/fields/PhoneIntlTelInput/styles.scss +43 -0
  75. package/dist/cjs/f/fields/QuerySelect/styles.scss +21 -0
  76. package/dist/cjs/f/fields/TaskRecommendation/TaskRecommendation.js +129 -0
  77. package/dist/cjs/f/fields/TaskRecommendation/index.js +15 -0
  78. package/dist/cjs/f/fields/TaskRecommendation/styles.scss +37 -0
  79. package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  80. package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +4 -0
  81. package/dist/cjs/f/fields/TextArea/TextArea.js +141 -0
  82. package/dist/cjs/f/fields/TextArea/index.js +15 -0
  83. package/dist/cjs/f/fields/TextArea/styles.scss +19 -0
  84. package/dist/cjs/f/fields/index.js +9 -1
  85. package/dist/cjs/test/QueryLoader/styles.scss +9 -0
  86. package/dist/es/a/GradientBackground/GradientBackground.js +118 -0
  87. package/dist/es/a/GradientBackground/index.js +2 -0
  88. package/dist/es/a/GradientBackground/styles.scss +191 -0
  89. package/dist/es/a/Popover/common/Divider/Divider.js +47 -0
  90. package/dist/es/a/Popover/common/Divider/index.js +2 -0
  91. package/dist/es/a/Popover/common/Item/Item.js +47 -0
  92. package/dist/es/a/Popover/common/Item/index.js +2 -0
  93. package/dist/es/a/Popover/common/index.js +2 -0
  94. package/dist/es/c/AcceptCookies/AcceptCookies.js +117 -0
  95. package/dist/es/c/AcceptCookies/index.js +2 -0
  96. package/dist/es/c/AcceptCookies/styles.scss +49 -0
  97. package/dist/es/c/BlogCategoryButton/BlogCategoryButton.js +68 -0
  98. package/dist/es/c/BlogCategoryButton/index.js +2 -0
  99. package/dist/es/c/BlogContext/BlogContextProvider.js +45 -0
  100. package/dist/es/c/BlogContext/Context.js +2 -0
  101. package/dist/es/c/BlogContext/ContextProvider.js +45 -0
  102. package/dist/es/c/BlogContext/index.js +4 -0
  103. package/dist/es/c/BlogContext/useBlog.js +3 -0
  104. package/dist/es/c/BlogPost/BlogPost.js +128 -0
  105. package/dist/es/c/BlogPost/index.js +2 -0
  106. package/dist/es/c/BlogPost/styles.scss +33 -0
  107. package/dist/es/c/BlogPostsList/BlogPostsList.js +56 -0
  108. package/dist/es/c/BlogPostsList/common/Card/Card.js +143 -0
  109. package/dist/es/c/BlogPostsList/common/Card/index.js +2 -0
  110. package/dist/es/c/BlogPostsList/common/index.js +1 -0
  111. package/dist/es/c/BlogPostsList/index.js +2 -0
  112. package/dist/es/c/BlogPostsList/styles.scss +72 -0
  113. package/dist/es/c/SiteFooter/SiteFooter.js +56 -0
  114. package/dist/es/c/SiteFooter/common/Section/Section.js +73 -0
  115. package/dist/es/c/SiteFooter/common/Section/index.js +2 -0
  116. package/dist/es/c/SiteFooter/common/index.js +1 -0
  117. package/dist/es/c/SiteFooter/index.js +2 -0
  118. package/dist/es/c/SiteFooter/styles.scss +34 -0
  119. package/dist/es/c/SiteHeaderCTA/SiteHeaderCTA.js +92 -0
  120. package/dist/es/c/SiteHeaderCTA/index.js +2 -0
  121. package/dist/es/c/SiteHeaderCTA/styles.scss +44 -0
  122. package/dist/es/c/SiteMission/SiteMission.js +96 -0
  123. package/dist/es/c/SiteMission/index.js +2 -0
  124. package/dist/es/c/SiteMission/styles.scss +30 -0
  125. package/dist/es/c/SiteNavigation/SiteNavigation.js +111 -0
  126. package/dist/es/c/SiteNavigation/index.js +2 -0
  127. package/dist/es/c/SiteNavigation/styles.scss +118 -0
  128. package/dist/es/c/SiteOnboardingStep/SiteOnboardingStep.js +81 -0
  129. package/dist/es/c/SiteOnboardingStep/index.js +2 -0
  130. package/dist/es/c/SiteOnboardingStep/styles.scss +51 -0
  131. package/dist/es/c/SitePricing/SitePricing.js +91 -0
  132. package/dist/es/c/SitePricing/index.js +2 -0
  133. package/dist/es/c/SitePricing/styles.scss +73 -0
  134. package/dist/es/c/SiteServices/SiteServices.js +195 -0
  135. package/dist/es/c/SiteServices/index.js +2 -0
  136. package/dist/es/c/SiteServices/styles.scss +138 -0
  137. package/dist/es/c/TeamGallery/TeamGallery.js +64 -0
  138. package/dist/es/c/TeamGallery/common/PersonCard/PersonCard.js +64 -0
  139. package/dist/es/c/TeamGallery/common/PersonCard/index.js +2 -0
  140. package/dist/es/c/TeamGallery/common/index.js +1 -0
  141. package/dist/es/c/TeamGallery/index.js +2 -0
  142. package/dist/es/c/TeamGallery/styles.scss +100 -0
  143. package/dist/es/c/Testimonials/Testimonials.js +99 -0
  144. package/dist/es/c/Testimonials/index.js +2 -0
  145. package/dist/es/c/Testimonials/styles.scss +112 -0
  146. package/dist/es/experimental/GradientBackground/GradientBackground.js +76 -0
  147. package/dist/es/experimental/GradientBackground/index.js +2 -0
  148. package/dist/es/experimental/GradientBackground/styles.scss +64 -0
  149. package/dist/es/experimental/index.js +1 -0
  150. package/dist/es/f/FormInput/FormInput.js +7 -1
  151. package/dist/es/f/fields/Checkbox/Checkbox.js +99 -0
  152. package/dist/es/f/fields/Checkbox/index.js +2 -0
  153. package/dist/es/f/fields/Checkbox/styles.scss +14 -0
  154. package/dist/es/f/fields/IntlTelInput/IntlTelInput.js +152 -0
  155. package/dist/es/f/fields/IntlTelInput/index.js +2 -0
  156. package/dist/es/f/fields/IntlTelInput/styles.scss +37 -0
  157. package/dist/es/f/fields/PhoneIntlTelInput/PhoneIntlTelInput.js +163 -0
  158. package/dist/es/f/fields/PhoneIntlTelInput/index.js +2 -0
  159. package/dist/es/f/fields/PhoneIntlTelInput/styles.scss +43 -0
  160. package/dist/es/f/fields/QuerySelect/styles.scss +21 -0
  161. package/dist/es/f/fields/TaskRecommendation/TaskRecommendation.js +111 -0
  162. package/dist/es/f/fields/TaskRecommendation/index.js +2 -0
  163. package/dist/es/f/fields/TaskRecommendation/styles.scss +37 -0
  164. package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  165. package/dist/es/f/fields/TaskRecommendationInput/styles.scss +4 -0
  166. package/dist/es/f/fields/TextArea/TextArea.js +124 -0
  167. package/dist/es/f/fields/TextArea/index.js +2 -0
  168. package/dist/es/f/fields/TextArea/styles.scss +19 -0
  169. package/dist/es/f/fields/index.js +2 -1
  170. package/dist/es/test/QueryLoader/styles.scss +9 -0
  171. package/package.json +1 -1
  172. package/src/__snapshots__/Storyshots.test.js.snap +236 -1
  173. package/src/stories/f/Checkbox.stories.jsx +95 -0
  174. package/src/stories/f/FormInput.stories.jsx +5 -0
  175. package/src/ui/f/FormInput/FormInput.jsx +11 -0
  176. package/src/ui/f/fields/Checkbox/Checkbox.jsx +118 -0
  177. package/src/ui/f/fields/Checkbox/index.js +2 -0
  178. package/src/ui/f/fields/Checkbox/styles.scss +14 -0
  179. package/src/ui/f/fields/index.js +1 -0
  180. package/dist/cjs/a/ColumnLabel/styles.scss +0 -22
  181. package/dist/es/a/ColumnLabel/ColumnLabel.js +0 -78
  182. package/dist/es/a/ColumnLabel/index.js +0 -2
  183. package/dist/es/a/ColumnLabel/styles.scss +0 -22
@@ -0,0 +1,124 @@
1
+ function _extends() { _extends = Object.assign || 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); }
2
+
3
+ /* @pareto-engineering/generator-front 1.0.12 */
4
+ import * as React from 'react';
5
+ import { useLayoutEffect } from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import styleNames from '@pareto-engineering/bem';
8
+ import { useField } from 'formik'; // Local Definitions
9
+
10
+ import { FormLabel, FormDescription } from "../../common";
11
+ const baseClassName = styleNames.base;
12
+ const componentClassName = 'text-area';
13
+ /**
14
+ * This is the component description.
15
+ */
16
+
17
+ const TextArea = ({
18
+ id,
19
+ className: userClassName,
20
+ style,
21
+ name,
22
+ label,
23
+ validate,
24
+ labelAsDescription,
25
+ textAreaId,
26
+ rows,
27
+ textAreaColor,
28
+ labelColor,
29
+ description // ...otherProps
30
+
31
+ }) => {
32
+ useLayoutEffect(() => {
33
+ import("./styles.scss");
34
+ }, []);
35
+ const [field, meta] = useField({
36
+ name,
37
+ validate
38
+ });
39
+ return /*#__PURE__*/React.createElement("div", {
40
+ id: id,
41
+ className: [baseClassName, componentClassName, userClassName, `x-${textAreaColor}`, `y-${labelColor}`].filter(e => e).join(' '),
42
+ style: style // {...otherProps}
43
+
44
+ }, /*#__PURE__*/React.createElement(FormLabel, {
45
+ className: ['c-y', labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
46
+ name: name
47
+ }, label), /*#__PURE__*/React.createElement("textarea", _extends({
48
+ id: textAreaId,
49
+ className: `textarea v50 pv-v ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`
50
+ }, field, {
51
+ rows: rows
52
+ })), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
53
+ isError: !!meta.error,
54
+ className: "v50 mt-v s-1"
55
+ }, meta.error || description), ' ');
56
+ };
57
+
58
+ TextArea.propTypes = {
59
+ /**
60
+ * The HTML id for this element
61
+ */
62
+ id: PropTypes.string,
63
+
64
+ /**
65
+ * The HTML class names for this element
66
+ */
67
+ className: PropTypes.string,
68
+
69
+ /**
70
+ * The React-written, css properties for this element.
71
+ */
72
+ style: PropTypes.objectOf(PropTypes.string),
73
+
74
+ /**
75
+ * The input name (html - and Formik state)
76
+ */
77
+ name: PropTypes.string.isRequired,
78
+
79
+ /**
80
+ * The input label
81
+ */
82
+ label: PropTypes.string.isRequired,
83
+
84
+ /**
85
+ * The input value validator function
86
+ */
87
+ validate: PropTypes.func,
88
+
89
+ /**
90
+ * If the text area depends on it's label's text as the default description
91
+ */
92
+ labelAsDescription: PropTypes.bool,
93
+
94
+ /**
95
+ * The textarea id
96
+ */
97
+ textAreaId: PropTypes.string,
98
+
99
+ /**
100
+ * The number of rows int the text area
101
+ */
102
+ rows: PropTypes.number,
103
+
104
+ /**
105
+ * Text area base color
106
+ */
107
+ textAreaColor: PropTypes.string,
108
+
109
+ /**
110
+ * Label base color
111
+ */
112
+ labelColor: PropTypes.string,
113
+
114
+ /**
115
+ * Text area description
116
+ */
117
+ description: PropTypes.string
118
+ };
119
+ TextArea.defaultProps = {
120
+ rows: 3,
121
+ textAreaColor: 'background',
122
+ labelColor: 'main1'
123
+ };
124
+ export default TextArea;
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as TextArea } from "./TextArea";
@@ -0,0 +1,19 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ @use "@pareto-engineering/bem";
3
+
4
+ .#{bem.$base}.text-area{
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ .textarea {
9
+ background: var(--light-x);
10
+ color: var(--on-x);
11
+
12
+ &:focus {
13
+ background: var(--dark-x);
14
+ }
15
+ }
16
+ }
17
+
18
+
19
+
@@ -4,4 +4,5 @@ export { ChoicesInput } from "./ChoicesInput";
4
4
  export { TextareaInput } from "./TextareaInput";
5
5
  export { RatingsInput } from "./RatingsInput";
6
6
  export { QueryCombobox } from "./QueryCombobox";
7
- export { QuerySelect } from "./QuerySelect";
7
+ export { QuerySelect } from "./QuerySelect";
8
+ export { Checkbox } from "./Checkbox";
@@ -0,0 +1,9 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ @use "@pareto-engineering/bem";
3
+
4
+ .#{bem.$base}.query-loader{
5
+
6
+ }
7
+
8
+
9
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "2.0.0-alpha.61",
3
+ "version": "2.0.0-alpha.62",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -3729,7 +3729,7 @@ exports[`Storyshots a/Timestamp Distance Format 1`] = `
3729
3729
  className="base timestamp"
3730
3730
  onClick={[Function]}
3731
3731
  >
3732
- 15 days ago
3732
+ 23 days ago
3733
3733
  </p>
3734
3734
  `;
3735
3735
 
@@ -11373,6 +11373,26 @@ exports[`Storyshots f/FormInput Base 1`] = `
11373
11373
  }
11374
11374
  />
11375
11375
  </div>
11376
+ <div
11377
+ className="base checkbox form-input"
11378
+ >
11379
+ <label
11380
+ className="base label x-main2"
11381
+ htmlFor="urgent"
11382
+ >
11383
+ Urgent
11384
+ </label>
11385
+ <input
11386
+ checked={false}
11387
+ className="input"
11388
+ disabled={false}
11389
+ id="urgent"
11390
+ name="urgent"
11391
+ onBlur={[Function]}
11392
+ onChange={[Function]}
11393
+ type="checkbox"
11394
+ />
11395
+ </div>
11376
11396
  <div
11377
11397
  className="base choices-input form-input x-background2 y-main2"
11378
11398
  style={
@@ -12265,6 +12285,221 @@ exports[`Storyshots f/common/Label Base 1`] = `
12265
12285
  </label>
12266
12286
  `;
12267
12287
 
12288
+ exports[`Storyshots f/fields/Checkbox Base 1`] = `
12289
+ <form
12290
+ action="#"
12291
+ onReset={[Function]}
12292
+ onSubmit={[Function]}
12293
+ >
12294
+ <div
12295
+ className="base checkbox"
12296
+ >
12297
+ <input
12298
+ checked={false}
12299
+ className="input"
12300
+ disabled={false}
12301
+ id="urgent"
12302
+ name="urgent"
12303
+ onBlur={[Function]}
12304
+ onChange={[Function]}
12305
+ type="checkbox"
12306
+ />
12307
+ </div>
12308
+ <div
12309
+ className="debugger"
12310
+ >
12311
+ <button
12312
+ className="base button x-main2"
12313
+ onClick={[Function]}
12314
+ type="button"
12315
+ >
12316
+ Open FormDebugger
12317
+ </button>
12318
+ </div>
12319
+ </form>
12320
+ `;
12321
+
12322
+ exports[`Storyshots f/fields/Checkbox Disabled 1`] = `
12323
+ <form
12324
+ action="#"
12325
+ onReset={[Function]}
12326
+ onSubmit={[Function]}
12327
+ >
12328
+ <div
12329
+ className="base checkbox"
12330
+ >
12331
+ <input
12332
+ checked={false}
12333
+ className="input"
12334
+ disabled={true}
12335
+ id="urgent"
12336
+ name="urgent"
12337
+ onBlur={[Function]}
12338
+ onChange={[Function]}
12339
+ type="checkbox"
12340
+ />
12341
+ </div>
12342
+ <div
12343
+ className="debugger"
12344
+ >
12345
+ <button
12346
+ className="base button x-main2"
12347
+ onClick={[Function]}
12348
+ type="button"
12349
+ >
12350
+ Open FormDebugger
12351
+ </button>
12352
+ </div>
12353
+ </form>
12354
+ `;
12355
+
12356
+ exports[`Storyshots f/fields/Checkbox Optional 1`] = `
12357
+ <form
12358
+ action="#"
12359
+ onReset={[Function]}
12360
+ onSubmit={[Function]}
12361
+ >
12362
+ <div
12363
+ className="base checkbox"
12364
+ >
12365
+ <input
12366
+ checked={false}
12367
+ className="input"
12368
+ disabled={false}
12369
+ id="urgent"
12370
+ name="urgent"
12371
+ onBlur={[Function]}
12372
+ onChange={[Function]}
12373
+ type="checkbox"
12374
+ />
12375
+ </div>
12376
+ <div
12377
+ className="debugger"
12378
+ >
12379
+ <button
12380
+ className="base button x-main2"
12381
+ onClick={[Function]}
12382
+ type="button"
12383
+ >
12384
+ Open FormDebugger
12385
+ </button>
12386
+ </div>
12387
+ </form>
12388
+ `;
12389
+
12390
+ exports[`Storyshots f/fields/Checkbox With Default Formik Value 1`] = `
12391
+ <form
12392
+ action="#"
12393
+ onReset={[Function]}
12394
+ onSubmit={[Function]}
12395
+ >
12396
+ <div
12397
+ className="base checkbox"
12398
+ >
12399
+ <input
12400
+ checked={false}
12401
+ className="input"
12402
+ disabled={false}
12403
+ id="urgent"
12404
+ name="urgent"
12405
+ onBlur={[Function]}
12406
+ onChange={[Function]}
12407
+ type="checkbox"
12408
+ />
12409
+ </div>
12410
+ <div
12411
+ className="debugger"
12412
+ >
12413
+ <button
12414
+ className="base button x-main2"
12415
+ onClick={[Function]}
12416
+ type="button"
12417
+ >
12418
+ Open FormDebugger
12419
+ </button>
12420
+ </div>
12421
+ </form>
12422
+ `;
12423
+
12424
+ exports[`Storyshots f/fields/Checkbox With Description 1`] = `
12425
+ <form
12426
+ action="#"
12427
+ onReset={[Function]}
12428
+ onSubmit={[Function]}
12429
+ >
12430
+ <div
12431
+ className="base checkbox"
12432
+ >
12433
+ <input
12434
+ checked={false}
12435
+ className="input"
12436
+ disabled={false}
12437
+ id="urgent"
12438
+ name="urgent"
12439
+ onBlur={[Function]}
12440
+ onChange={[Function]}
12441
+ type="checkbox"
12442
+ />
12443
+ <div
12444
+ className="base description v50 mt-v s-1 x-metadata"
12445
+ >
12446
+ Click on the checkbox
12447
+ </div>
12448
+ </div>
12449
+ <div
12450
+ className="debugger"
12451
+ >
12452
+ <button
12453
+ className="base button x-main2"
12454
+ onClick={[Function]}
12455
+ type="button"
12456
+ >
12457
+ Open FormDebugger
12458
+ </button>
12459
+ </div>
12460
+ </form>
12461
+ `;
12462
+
12463
+ exports[`Storyshots f/fields/Checkbox With Label 1`] = `
12464
+ <form
12465
+ action="#"
12466
+ onReset={[Function]}
12467
+ onSubmit={[Function]}
12468
+ >
12469
+ <div
12470
+ className="base checkbox"
12471
+ >
12472
+ <label
12473
+ className="base label x-main2"
12474
+ htmlFor="urgent"
12475
+ >
12476
+ Urgent
12477
+ </label>
12478
+ <input
12479
+ checked={false}
12480
+ className="input"
12481
+ disabled={false}
12482
+ id="urgent"
12483
+ name="urgent"
12484
+ onBlur={[Function]}
12485
+ onChange={[Function]}
12486
+ type="checkbox"
12487
+ />
12488
+ </div>
12489
+ <div
12490
+ className="debugger"
12491
+ >
12492
+ <button
12493
+ className="base button x-main2"
12494
+ onClick={[Function]}
12495
+ type="button"
12496
+ >
12497
+ Open FormDebugger
12498
+ </button>
12499
+ </div>
12500
+ </form>
12501
+ `;
12502
+
12268
12503
  exports[`Storyshots f/fields/ChoicesInput Base 1`] = `
12269
12504
  <form
12270
12505
  action="#"
@@ -0,0 +1,95 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { useEffect } from 'react'
5
+
6
+ import { Formik, Form, useField } from 'formik'
7
+
8
+ import { Checkbox, FormDebugger } from 'ui'
9
+
10
+ export default {
11
+ title :'f/fields/Checkbox',
12
+ component :Checkbox,
13
+ subcomponents:{
14
+ // Item:Checkbox.Item
15
+ },
16
+ decorators:[
17
+ // storyfn => <div className="">{ storyfn() }</div>,
18
+ (storyfn) => (
19
+ <Formik
20
+ initialValues={{}}
21
+ >
22
+ <Form>
23
+
24
+ { storyfn() }
25
+ </Form>
26
+ </Formik>
27
+ ),
28
+ ],
29
+ argTypes:{
30
+ label :{ control: 'text' },
31
+ description :{ control: 'text' },
32
+ defaultValue:{ control: 'boolean' },
33
+ disabled :{ control: 'boolean' },
34
+ optional :{ control: 'boolean' },
35
+ },
36
+ }
37
+
38
+ // eslint-disable-next-line react/prop-types
39
+ const Template = ({ defaultValue, ...args }) => {
40
+ const Content = () => {
41
+ const { name } = args
42
+ const [, , helpers] = useField(name)
43
+ const { setValue } = helpers
44
+
45
+ useEffect(() => {
46
+ if (defaultValue) {
47
+ setValue(defaultValue)
48
+ }
49
+ }, [defaultValue])
50
+
51
+ return (
52
+ <>
53
+ <Checkbox {...args} />
54
+ <FormDebugger />
55
+ </>
56
+ )
57
+ }
58
+
59
+ return <Content />
60
+ }
61
+
62
+ export const Base = Template.bind({})
63
+ Base.args = {
64
+ name:'urgent',
65
+ }
66
+
67
+ export const WithLabel = Template.bind({})
68
+ WithLabel.args = {
69
+ ...Base.args,
70
+ label:'Urgent',
71
+ }
72
+
73
+ export const WithDescription = Template.bind({})
74
+ WithDescription.args = {
75
+ ...Base.args,
76
+ description:'Click on the checkbox',
77
+ }
78
+
79
+ export const WithDefaultFormikValue = Template.bind({})
80
+ WithDefaultFormikValue.args = {
81
+ ...Base.args,
82
+ defaultValue:true,
83
+ }
84
+
85
+ export const Disabled = Template.bind({})
86
+ Disabled.args = {
87
+ ...Base.args,
88
+ disabled:true,
89
+ }
90
+
91
+ export const Optional = Template.bind({})
92
+ Optional.args = {
93
+ ...Base.args,
94
+ optional:true,
95
+ }
@@ -62,6 +62,11 @@ export const Base = () => {
62
62
  name :'description',
63
63
  label:'Describe yourself in a few sentences',
64
64
  },
65
+ {
66
+ type :'checkbox',
67
+ name :'urgent',
68
+ label:'Urgent',
69
+ },
65
70
  {
66
71
  type :'choices',
67
72
  name :'colors',
@@ -13,6 +13,7 @@ import {
13
13
  QueryCombobox,
14
14
  QuerySelect,
15
15
  RatingsInput,
16
+ Checkbox,
16
17
  } from '../fields'
17
18
 
18
19
  // Local Definitions
@@ -94,6 +95,16 @@ const FormInput = ({
94
95
  />
95
96
  )
96
97
  }
98
+
99
+ if (type === 'checkbox') {
100
+ return (
101
+ <Checkbox
102
+ className={newClassName}
103
+ {...otherProps}
104
+ />
105
+ )
106
+ }
107
+
97
108
  if (extraTypes?.[type]) {
98
109
  const Component = extraTypes[type]
99
110
  return (
@@ -0,0 +1,118 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { useLayoutEffect } from 'react'
5
+
6
+ import PropTypes from 'prop-types'
7
+
8
+ import styleNames from '@pareto-engineering/bem'
9
+
10
+ import { useField } from 'formik'
11
+
12
+ import { FormLabel, FormDescription } from '../../common'
13
+
14
+ // Local Definitions
15
+
16
+ const baseClassName = styleNames.base
17
+
18
+ const componentClassName = 'checkbox'
19
+
20
+ /**
21
+ * This is the component description.
22
+ */
23
+ const Checkbox = ({
24
+ id,
25
+ className:userClassName,
26
+ style,
27
+ name,
28
+ label,
29
+ description,
30
+ disabled,
31
+ optional,
32
+ // ...otherProps
33
+ }) => {
34
+ useLayoutEffect(() => {
35
+ import('./styles.scss')
36
+ }, [])
37
+
38
+ const [field] = useField({ name, type: 'checkbox' })
39
+
40
+ return (
41
+ <div
42
+ id={id}
43
+ className={[
44
+
45
+ baseClassName,
46
+
47
+ componentClassName,
48
+ userClassName,
49
+ ]
50
+ .filter((e) => e)
51
+ .join(' ')}
52
+ style={style}
53
+ // {...otherProps}
54
+ >
55
+ {label && (
56
+ <FormLabel name={name} optional={optional}>
57
+ {label}
58
+ </FormLabel>
59
+ )}
60
+ <input
61
+ id={name}
62
+ className="input"
63
+ type="checkbox"
64
+ disabled={disabled}
65
+ {...field}
66
+ />
67
+ <FormDescription className="v50 mt-v s-1" description={description} name={name} />
68
+ </div>
69
+ )
70
+ }
71
+
72
+ Checkbox.propTypes = {
73
+ /**
74
+ * The HTML id for this element
75
+ */
76
+ id:PropTypes.string,
77
+
78
+ /**
79
+ * The HTML class names for this element
80
+ */
81
+ className:PropTypes.string,
82
+
83
+ /**
84
+ * The React-written, css properties for this element.
85
+ */
86
+ style:PropTypes.objectOf(PropTypes.string),
87
+
88
+ /**
89
+ * The input name (html - and Formik state)
90
+ */
91
+ name:PropTypes.string.isRequired,
92
+
93
+ /**
94
+ * The Input description to guide the user if it's not obvious
95
+ */
96
+ description:PropTypes.string,
97
+
98
+ /**
99
+ * Whether the input should be disabled
100
+ */
101
+ disabled:PropTypes.bool,
102
+
103
+ /**
104
+ * The input label
105
+ */
106
+ label:PropTypes.string,
107
+
108
+ /**
109
+ * Whether the input should have an optional tag
110
+ */
111
+ optional:PropTypes.bool,
112
+ }
113
+
114
+ Checkbox.defaultProps = {
115
+ disabled:false,
116
+ }
117
+
118
+ export default Checkbox
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Checkbox } from './Checkbox'
@@ -0,0 +1,14 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ @use "@pareto-engineering/bem";
3
+
4
+ $default-margin: 1em;
5
+
6
+ .#{bem.$base}.checkbox {
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: flex-start;
10
+
11
+ .#{bem.$base}.label {
12
+ margin-bottom: $default-margin
13
+ }
14
+ }
@@ -5,3 +5,4 @@ export { TextareaInput } from './TextareaInput'
5
5
  export { RatingsInput } from './RatingsInput'
6
6
  export { QueryCombobox } from './QueryCombobox'
7
7
  export { QuerySelect } from './QuerySelect'
8
+ export { Checkbox } from './Checkbox'