@digigov/form 1.0.0-6b93ebf2 → 1.0.0-758a1807

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 (46) hide show
  1. package/FormBuilder/FormBuilder.mdx +6 -8
  2. package/MultiplicityField/__stories__/PreviewDisplay.js +1 -1
  3. package/Questions/Step/StepArrayReview.js +2 -2
  4. package/Questions/Step/StepTitle.d.ts +2 -2
  5. package/Questions/Step/StepTitle.js +8 -4
  6. package/Questions/Step/index.d.ts +4 -4
  7. package/Questions/Step/index.js +53 -36
  8. package/Questions/__snapshots__/index.spec.tsx.snap +69 -356
  9. package/Questions/__stories__/Default.js +1 -1
  10. package/Questions/index.mdx +4 -4
  11. package/es/FormBuilder/FormBuilder.mdx +6 -8
  12. package/es/MultiplicityField/__stories__/PreviewDisplay.js +1 -1
  13. package/es/Questions/Step/StepArrayReview.js +2 -2
  14. package/es/Questions/Step/StepTitle.js +7 -4
  15. package/es/Questions/Step/index.js +4 -4
  16. package/es/Questions/__snapshots__/index.spec.tsx.snap +69 -356
  17. package/es/Questions/__stories__/Default.js +1 -1
  18. package/es/Questions/index.mdx +4 -4
  19. package/es/inputs/FileInput/index.js +1 -1
  20. package/es/inputs/OtpInput/index.js +5 -5
  21. package/esm/FormBuilder/FormBuilder.mdx +6 -8
  22. package/esm/MultiplicityField/__stories__/PreviewDisplay.js +1 -1
  23. package/esm/Questions/Step/StepArrayReview.js +2 -2
  24. package/esm/Questions/Step/StepTitle.js +7 -4
  25. package/esm/Questions/Step/index.js +4 -4
  26. package/esm/Questions/__snapshots__/index.spec.tsx.snap +69 -356
  27. package/esm/Questions/__stories__/Default.js +1 -1
  28. package/esm/Questions/index.mdx +4 -4
  29. package/esm/index.js +1 -1
  30. package/esm/inputs/FileInput/index.js +1 -1
  31. package/esm/inputs/OtpInput/index.js +5 -5
  32. package/inputs/FileInput/index.js +1 -1
  33. package/inputs/OtpInput/index.js +5 -5
  34. package/package.json +4 -4
  35. package/src/FormBuilder/FormBuilder.mdx +6 -8
  36. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +4 -4
  37. package/src/Questions/Step/StepArrayReview.tsx +3 -3
  38. package/src/Questions/Step/StepTitle.tsx +12 -14
  39. package/src/Questions/Step/index.ts +4 -4
  40. package/src/Questions/__snapshots__/index.spec.tsx.snap +69 -356
  41. package/src/Questions/__stories__/Default.tsx +4 -4
  42. package/src/Questions/index.mdx +4 -4
  43. package/src/inputs/FileInput/index.tsx +1 -1
  44. package/src/inputs/OtpInput/index.tsx +8 -8
  45. package/src/types.tsx +1 -1
  46. package/types.d.ts +1 -1
@@ -4,7 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  var _excluded = ["name", "maxLength"];
6
6
  import React, { useState, useCallback } from 'react';
7
- import SingleCharacterInputContainer, { SingleCharacterInputItem } from '@digigov/ui/form/SingleCharacterInputContainer';
7
+ import SingleCharacterInputs, { SingleCharacterInput } from '@digigov/ui/form/SingleCharacterInputs';
8
8
  export var RE_DIGIT = new RegExp(/^\d+$/);
9
9
  export var REMOVE_SPACES = new RegExp(/\s+/g);
10
10
 
@@ -113,10 +113,10 @@ function useOtp(onChange, maxLength) {
113
113
  };
114
114
  }
115
115
 
116
- var SingleCharacterInputItemPart = function SingleCharacterInputItemPart(_ref) {
116
+ var SingleCharacterInputPart = function SingleCharacterInputPart(_ref) {
117
117
  var props = _extends({}, _ref);
118
118
 
119
- return /*#__PURE__*/React.createElement(SingleCharacterInputItem, props);
119
+ return /*#__PURE__*/React.createElement(SingleCharacterInput, props);
120
120
  };
121
121
 
122
122
  export var OtpInput = function OtpInput(_ref2) {
@@ -126,8 +126,8 @@ export var OtpInput = function OtpInput(_ref2) {
126
126
  props = _objectWithoutProperties(_ref2, _excluded);
127
127
 
128
128
  var otp = useOtp(props.onChange, maxLength);
129
- return /*#__PURE__*/React.createElement(SingleCharacterInputContainer, null, otp.otpValues.map(function (digit, idx) {
130
- return /*#__PURE__*/React.createElement(SingleCharacterInputItemPart, {
129
+ return /*#__PURE__*/React.createElement(SingleCharacterInputs, null, otp.otpValues.map(function (digit, idx) {
130
+ return /*#__PURE__*/React.createElement(SingleCharacterInputPart, {
131
131
  name: "".concat(name, "-").concat(idx),
132
132
  type: "text",
133
133
  key: idx,
@@ -68,7 +68,7 @@ var FileInput = /*#__PURE__*/_react["default"].forwardRef(function FileInput(_re
68
68
  };
69
69
 
70
70
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_FileUploadContainer["default"], {
71
- hasUploadedFile: files && files.length > 0
71
+ hasFiles: files && files.length > 0
72
72
  }, files !== null && files !== void 0 && files.length ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Paragraph["default"], null, /*#__PURE__*/_react["default"].createElement("b", null, t('upload.file'), ":"), " ", "".concat(files.join(', ')))) : /*#__PURE__*/_react["default"].createElement(_Hint["default"], null, t('upload.no_file')), /*#__PURE__*/_react["default"].createElement(_FileUpload["default"], (0, _extends2["default"])({
73
73
  ref: ref,
74
74
  hasFiles: !!(files !== null && files !== void 0 && files.length),
@@ -19,7 +19,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
- var _SingleCharacterInputContainer = _interopRequireWildcard(require("@digigov/ui/form/SingleCharacterInputContainer"));
22
+ var _SingleCharacterInputs = _interopRequireWildcard(require("@digigov/ui/form/SingleCharacterInputs"));
23
23
 
24
24
  var _excluded = ["name", "maxLength"];
25
25
 
@@ -137,9 +137,9 @@ function useOtp(onChange, maxLength) {
137
137
  };
138
138
  }
139
139
 
140
- var SingleCharacterInputItemPart = function SingleCharacterInputItemPart(_ref) {
140
+ var SingleCharacterInputPart = function SingleCharacterInputPart(_ref) {
141
141
  var props = (0, _extends2["default"])({}, _ref);
142
- return /*#__PURE__*/_react["default"].createElement(_SingleCharacterInputContainer.SingleCharacterInputItem, props);
142
+ return /*#__PURE__*/_react["default"].createElement(_SingleCharacterInputs.SingleCharacterInput, props);
143
143
  };
144
144
 
145
145
  var OtpInput = function OtpInput(_ref2) {
@@ -148,8 +148,8 @@ var OtpInput = function OtpInput(_ref2) {
148
148
  maxLength = _ref2$maxLength === void 0 ? 6 : _ref2$maxLength,
149
149
  props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
150
150
  var otp = useOtp(props.onChange, maxLength);
151
- return /*#__PURE__*/_react["default"].createElement(_SingleCharacterInputContainer["default"], null, otp.otpValues.map(function (digit, idx) {
152
- return /*#__PURE__*/_react["default"].createElement(SingleCharacterInputItemPart, {
151
+ return /*#__PURE__*/_react["default"].createElement(_SingleCharacterInputs["default"], null, otp.otpValues.map(function (digit, idx) {
152
+ return /*#__PURE__*/_react["default"].createElement(SingleCharacterInputPart, {
153
153
  name: "".concat(name, "-").concat(idx),
154
154
  type: "text",
155
155
  key: idx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/form",
3
- "version": "1.0.0-6b93ebf2",
3
+ "version": "1.0.0-758a1807",
4
4
  "description": "@digigov form builder",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
@@ -17,11 +17,11 @@
17
17
  "dayjs": "1.10.4",
18
18
  "@hookform/resolvers": "2.9.6",
19
19
  "publint": "0.1.8",
20
- "@digigov/react-icons": "1.0.0-6b93ebf2"
20
+ "@digigov/react-icons": "1.0.0-758a1807"
21
21
  },
22
22
  "peerDependencies": {
23
- "@digigov/ui": "1.0.0-6b93ebf2",
24
- "@digigov/react-core": "1.0.0-6b93ebf2",
23
+ "@digigov/ui": "1.0.0-758a1807",
24
+ "@digigov/react-core": "1.0.0-758a1807",
25
25
  "clsx": "1.1.1",
26
26
  "react": "^16.8.0 || ^17.0.0",
27
27
  "react-dom": "^16.8.0 || ^17.0.0"
@@ -95,10 +95,10 @@ import Header, { HeaderTitle } from '@digigov/ui/app/Header';
95
95
  import GovGRLogo from '@digigov/ui/govgr/GovGRLogo';
96
96
  import GovGRFooter from '@digigov/ui/govgr/Footer';
97
97
  import Button from '@digigov/ui/form/Button';
98
- import Section, {
98
+ import PageTitleContainer, {
99
+ PageTitleCaption,
99
100
  PageTitleHeading,
100
- } from '@digigov/ui/app/PageTitle';
101
- import { HeadingCaption } from '@digigov/ui/typography/HeadingCaption';
101
+ } from '@digigov/ui/app/PageTitleContainer';
102
102
  import BackButton from '@digigov/ui/form/Button/BackButton';
103
103
  import FormBuilder, { Fieldset, FieldsetLabel, Field } from '@digigov/form';
104
104
  import { useTranslation } from '@digigov/ui/i18n';
@@ -227,12 +227,10 @@ export default function Index() {
227
227
  <Content>
228
228
  <Main className={styles.main}>
229
229
  <BackButton>{t('button.back')}</BackButton>
230
- <Section>
231
- <Section>
232
- <HeadingCaption>Before we start</HeadingCaption>
233
- </Section>
230
+ <PageTitleContainer>
231
+ <PageTitleCaption>Before we start</PageTitleCaption>
234
232
  <PageTitleHeading>Submit a form</PageTitleHeading>
235
- </Section>
233
+ </PageTitleContainer>
236
234
  <FormBuilder
237
235
  fields={FIELDS}
238
236
  onSubmit={setData}
@@ -64,12 +64,12 @@ const fields = [
64
64
  export const PreviewDisplay = () => (
65
65
  <Layout>
66
66
  <Header>
67
- <HeaderSection>
68
- <HeaderContent>
67
+ <HeaderContent>
68
+ <HeaderSection>
69
69
  <GovGRLogo href="#" />
70
70
  <HeaderTitle>Πρότυπο-Αναφοράς</HeaderTitle>
71
- </HeaderContent>
72
- </HeaderSection>
71
+ </HeaderSection>
72
+ </HeaderContent>
73
73
  </Header>
74
74
  <Content>
75
75
  <Main>
@@ -7,7 +7,7 @@ import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
7
7
  import { getAddMoreFields } from '@digigov/form/Questions/Step/getAddMoreFields';
8
8
  import { StepArrayReviewInterface } from '@digigov/form/Questions/Step/types';
9
9
  import { FieldSpec } from '@digigov/form/types';
10
- import Section, { PageTitleHeading } from '@digigov/ui/app/PageTitle';
10
+ import PageTitleContainer, { PageTitleHeading } from '@digigov/ui/app/PageTitleContainer';
11
11
  import {
12
12
  SummaryList,
13
13
  SummaryListItem,
@@ -28,11 +28,11 @@ export const StepArrayReview: React.FC<StepArrayReviewInterface> = (props) => {
28
28
  ) || {};
29
29
  return (
30
30
  <>
31
- <Section>
31
+ <PageTitleContainer>
32
32
  <PageTitleHeading>
33
33
  {currentStep.review?.title && t(currentStep.review?.title)}
34
34
  </PageTitleHeading>
35
- </Section>
35
+ </PageTitleContainer>
36
36
  <SummaryList>
37
37
  {props.array.map(
38
38
  (item: { [x: string]: React.ReactNode }, idx: number) => (
@@ -1,12 +1,12 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { StepContext } from '@digigov/form/Questions/Step/StepContext';
3
- import Section, {
4
- PageTitleHeading,
5
- PageTitleHeadingProps,
6
- } from '@digigov/ui/app/PageTitle';
3
+ import PageTitleContainer, {
4
+ PageTitleCaption,
5
+ } from '@digigov/ui/app/PageTitleContainer';
7
6
  import BackButton from '@digigov/ui/form/Button/BackButton';
8
7
  import { useTranslation } from '@digigov/ui/i18n';
9
- import { HeadingCaption } from '@digigov/ui/typography/HeadingCaption';
8
+ import HeadingCaption from '@digigov/react-core/HeadingCaption';
9
+ import Heading, { HeadingProps } from '@digigov/react-core/Heading';
10
10
 
11
11
  export interface StepTitleInterface {
12
12
  title?: string;
@@ -15,8 +15,8 @@ export interface StepTitleInterface {
15
15
  step?: string;
16
16
  }
17
17
 
18
- export const StepTitleHeading: React.FC<PageTitleHeadingProps> = (props) => {
19
- return <PageTitleHeading>{props.children}</PageTitleHeading>;
18
+ export const StepTitleHeading: React.FC<HeadingProps> = (props) => {
19
+ return <Heading>{props.children}</Heading>;
20
20
  };
21
21
 
22
22
  export const StepTitleBase: React.FC<StepTitleInterface> = ({
@@ -29,18 +29,16 @@ export const StepTitleBase: React.FC<StepTitleInterface> = ({
29
29
  const { t } = useTranslation();
30
30
  return (
31
31
  <>
32
- <BackButton>{backButton || t('back.button')}</BackButton>
33
- <Section>
32
+ <BackButton>{backButton || t('button.back')}</BackButton>
33
+ <PageTitleContainer>
34
34
  {children || (
35
35
  <>
36
- <Section>
37
- <HeadingCaption>{caption && t(caption)}</HeadingCaption>
38
- {step && <HeadingCaption>{step}</HeadingCaption>}
39
- </Section>
36
+ <HeadingCaption size="xl">{caption && t(caption)}</HeadingCaption>
37
+ {step && <PageTitleCaption>{step}</PageTitleCaption>}
40
38
  <StepTitleHeading>{title && t(title)}</StepTitleHeading>
41
39
  </>
42
40
  )}
43
- </Section>
41
+ </PageTitleContainer>
44
42
  </>
45
43
  );
46
44
  };
@@ -2,10 +2,10 @@ export * from '@digigov/form/Questions/Step/ReviewStep';
2
2
  export * from '@digigov/form/Questions/Step/Step';
3
3
  export * from '@digigov/form/Questions/Step/StepArrayReview';
4
4
  export * from '@digigov/form/Questions/Step/StepContext';
5
- export { default as StepDescription } from '@digigov/form/Questions/Step/StepDescription';
6
- export { default as StepForm } from '@digigov/form/Questions/Step/StepForm';
7
- export { default as StepQuote } from '@digigov/form/Questions/Step/StepQuote';
8
- export { default as StepTitle } from '@digigov/form/Questions/Step/StepTitle';
5
+ export * from '@digigov/form/Questions/Step/StepDescription';
6
+ export * from '@digigov/form/Questions/Step/StepForm';
7
+ export * from '@digigov/form/Questions/Step/StepQuote';
8
+ export * from '@digigov/form/Questions/Step/StepTitle';
9
9
  export * from '@digigov/form/Questions/Step/getAddMoreFields';
10
10
  export * from '@digigov/form/Questions/Step/';
11
11
  export * from '@digigov/form/Questions/Step/types';