@digigov/form 0.7.1 → 0.8.2
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/CHANGELOG.md +26 -1
- package/Field/FieldBase.js +4 -14
- package/Field/FieldConditional.js +4 -0
- package/Field/FieldContainer.js +6 -3
- package/Field/index.js +39 -1
- package/Field/utils.js +19 -1
- package/FieldArray/FieldArray.stories.js +44 -0
- package/FieldArray/__stories__/Default.js +109 -0
- package/FieldArray/__stories__/WithExactLength.js +108 -0
- package/FieldArray/index.js +84 -0
- package/FieldObject/index.js +84 -0
- package/Form.stories.js +25 -0
- package/FormBuilder.js +22 -12
- package/MultiplicityField/MultiplicityField.stories.js +86 -0
- package/MultiplicityField/__stories__/Default.js +121 -0
- package/MultiplicityField/__stories__/WithExactLength.js +116 -0
- package/MultiplicityField/__stories__/WithMaxLength.js +119 -0
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js +120 -0
- package/MultiplicityField/__stories__/WithMinLength.js +119 -0
- package/MultiplicityField/add-objects.js +182 -0
- package/MultiplicityField/index.js +142 -0
- package/__stories__/IntField.js +60 -0
- package/es/Field/FieldBase.js +4 -14
- package/es/Field/FieldConditional.js +4 -0
- package/es/Field/FieldContainer.js +6 -3
- package/es/Field/index.js +37 -1
- package/es/Field/utils.js +19 -1
- package/es/FieldArray/FieldArray.stories.js +7 -0
- package/es/FieldArray/__stories__/Default.js +88 -0
- package/es/FieldArray/__stories__/WithExactLength.js +87 -0
- package/es/FieldArray/index.js +62 -0
- package/es/FieldObject/index.js +59 -0
- package/es/Form.stories.js +4 -0
- package/es/FormBuilder.js +22 -11
- package/es/MultiplicityField/MultiplicityField.stories.js +10 -0
- package/es/MultiplicityField/__stories__/Default.js +100 -0
- package/es/MultiplicityField/__stories__/WithExactLength.js +95 -0
- package/es/MultiplicityField/__stories__/WithMaxLength.js +98 -0
- package/es/MultiplicityField/__stories__/WithMinAndMaxLength.js +99 -0
- package/es/MultiplicityField/__stories__/WithMinLength.js +98 -0
- package/es/MultiplicityField/add-objects.js +158 -0
- package/es/MultiplicityField/index.js +113 -0
- package/es/__stories__/IntField.js +40 -0
- package/es/inputs/FileInput/FileInput.stories.js +6 -0
- package/es/inputs/FileInput/__stories__/Default.js +23 -0
- package/es/inputs/FileInput/index.js +33 -23
- package/es/inputs/Input/index.js +1 -1
- package/es/inputs/Radio/index.js +8 -13
- package/es/internal.js +2 -0
- package/es/utils.js +61 -46
- package/es/validators/index.js +31 -11
- package/es/validators/utils/index.js +1 -19
- package/es/validators/utils/int.js +20 -0
- package/es/validators/utils/number.js +16 -0
- package/esm/Field/FieldBase.js +4 -14
- package/esm/Field/FieldConditional.js +4 -0
- package/esm/Field/FieldContainer.js +6 -3
- package/esm/Field/index.js +37 -1
- package/esm/Field/utils.js +19 -1
- package/esm/FieldArray/FieldArray.stories.js +7 -0
- package/esm/FieldArray/__stories__/Default.js +88 -0
- package/esm/FieldArray/__stories__/WithExactLength.js +87 -0
- package/esm/FieldArray/index.js +62 -0
- package/esm/FieldObject/index.js +59 -0
- package/esm/Form.stories.js +4 -0
- package/esm/FormBuilder.js +22 -11
- package/esm/MultiplicityField/MultiplicityField.stories.js +10 -0
- package/esm/MultiplicityField/__stories__/Default.js +100 -0
- package/esm/MultiplicityField/__stories__/WithExactLength.js +95 -0
- package/esm/MultiplicityField/__stories__/WithMaxLength.js +98 -0
- package/esm/MultiplicityField/__stories__/WithMinAndMaxLength.js +99 -0
- package/esm/MultiplicityField/__stories__/WithMinLength.js +98 -0
- package/esm/MultiplicityField/add-objects.js +158 -0
- package/esm/MultiplicityField/index.js +113 -0
- package/esm/__stories__/IntField.js +40 -0
- package/esm/index.js +1 -1
- package/esm/inputs/FileInput/FileInput.stories.js +6 -0
- package/esm/inputs/FileInput/__stories__/Default.js +23 -0
- package/esm/inputs/FileInput/index.js +33 -23
- package/esm/inputs/Input/index.js +1 -1
- package/esm/inputs/Radio/index.js +8 -13
- package/esm/internal.js +2 -0
- package/esm/utils.js +61 -46
- package/esm/validators/index.js +31 -11
- package/esm/validators/utils/index.js +1 -19
- package/esm/validators/utils/int.js +20 -0
- package/esm/validators/utils/number.js +16 -0
- package/inputs/FileInput/FileInput.stories.js +30 -0
- package/inputs/FileInput/__stories__/Default.js +43 -0
- package/inputs/FileInput/index.js +37 -23
- package/inputs/Input/index.js +1 -1
- package/inputs/Radio/index.js +8 -20
- package/internal.js +21 -0
- package/libs/form/src/Field/types.d.ts +24 -13
- package/libs/form/src/FieldArray/FieldArray.stories.d.ts +8 -0
- package/libs/form/src/FieldArray/__stories__/Default.d.ts +1 -0
- package/libs/form/src/FieldArray/__stories__/WithExactLength.d.ts +1 -0
- package/libs/form/src/FieldArray/index.d.ts +11 -0
- package/libs/form/src/FieldObject/index.d.ts +22 -0
- package/libs/form/src/Form.stories.d.ts +5 -0
- package/libs/form/src/MultiplicityField/MultiplicityField.stories.d.ts +11 -0
- package/libs/form/src/MultiplicityField/__stories__/Default.d.ts +1 -0
- package/libs/form/src/MultiplicityField/__stories__/WithExactLength.d.ts +1 -0
- package/libs/form/src/MultiplicityField/__stories__/WithMaxLength.d.ts +1 -0
- package/libs/form/src/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +1 -0
- package/libs/form/src/MultiplicityField/__stories__/WithMinLength.d.ts +1 -0
- package/libs/form/src/MultiplicityField/add-objects.d.ts +13 -0
- package/libs/form/src/MultiplicityField/index.d.ts +32 -0
- package/libs/form/src/__stories__/IntField.d.ts +1 -0
- package/libs/form/src/inputs/FileInput/FileInput.stories.d.ts +7 -0
- package/libs/form/src/inputs/FileInput/__stories__/Default.d.ts +2 -0
- package/libs/form/src/inputs/Label/index.d.ts +1 -0
- package/libs/form/src/internal.d.ts +2 -0
- package/libs/form/src/types.d.ts +20 -12
- package/libs/form/src/utils.d.ts +8 -3
- package/libs/form/src/validators/index.d.ts +4 -3
- package/libs/form/src/validators/types.d.ts +1 -1
- package/libs/form/src/validators/utils/file.d.ts +3 -1
- package/libs/form/src/validators/utils/iban.d.ts +3 -1
- package/libs/form/src/validators/utils/index.d.ts +15 -3
- package/libs/form/src/validators/utils/int.d.ts +3 -0
- package/libs/form/src/validators/utils/number.d.ts +3 -0
- package/libs/form/src/validators/utils/phone.d.ts +3 -1
- package/libs/form/src/validators/utils/postal_code.d.ts +3 -1
- package/libs/ui/src/app/i18n.d.ts +2 -2
- package/libs/ui/src/core/Button/BackButton.d.ts +1 -1
- package/libs/ui/src/core/Button/ButtonLink.d.ts +1 -1
- package/libs/ui/src/core/Button/index.d.ts +1 -1
- package/libs/ui/src/core/List/ListItemContent.d.ts +0 -1
- package/libs/ui/src/core/List/ListItemIcon.d.ts +1 -3
- package/libs/ui/src/core/List/ListItemText.d.ts +0 -1
- package/libs/ui/src/core/List/ListItemTitle.d.ts +0 -1
- package/libs/ui/src/locales/el.d.ts +8 -1
- package/libs-ui/react-core/src/Aside/index.d.ts +10 -0
- package/libs-ui/react-core/src/BackLink/index.d.ts +1 -1
- package/libs-ui/react-core/src/Bottom/index.d.ts +9 -0
- package/libs-ui/react-core/src/BreadcrumbsList/index.d.ts +1 -1
- package/libs-ui/react-core/src/Button/index.d.ts +1 -1
- package/libs-ui/react-core/src/ButtonLink/index.d.ts +1 -1
- package/libs-ui/react-core/src/CallToAction/index.d.ts +1 -1
- package/libs-ui/react-core/src/CheckboxConditional/index.d.ts +11 -0
- package/libs-ui/react-core/src/CheckboxItem/index.d.ts +1 -1
- package/libs-ui/react-core/src/Container/index.d.ts +17 -0
- package/libs-ui/react-core/src/Copyright/index.d.ts +10 -0
- package/libs-ui/react-core/src/DateInputItem/index.d.ts +1 -1
- package/libs-ui/react-core/src/FileUpload/index.d.ts +9 -1
- package/libs-ui/react-core/src/Footer/index.d.ts +9 -0
- package/libs-ui/react-core/src/FooterContainer/index.d.ts +16 -0
- package/libs-ui/react-core/src/FooterContent/index.d.ts +10 -0
- package/libs-ui/react-core/src/FooterContentLogos/index.d.ts +11 -0
- package/libs-ui/react-core/src/FooterHeading/index.d.ts +15 -0
- package/libs-ui/react-core/src/FooterImage/index.d.ts +15 -0
- package/libs-ui/react-core/src/FooterInlineList/index.d.ts +11 -0
- package/libs-ui/react-core/src/FooterInlineListItem/index.d.ts +9 -0
- package/libs-ui/react-core/src/FooterLink/index.d.ts +13 -0
- package/libs-ui/react-core/src/FooterList/index.d.ts +15 -0
- package/libs-ui/react-core/src/FooterListItem/index.d.ts +10 -0
- package/libs-ui/react-core/src/FooterMeta/index.d.ts +11 -0
- package/libs-ui/react-core/src/FooterMetaItem/index.d.ts +14 -0
- package/libs-ui/react-core/src/FooterNavigation/index.d.ts +11 -0
- package/libs-ui/react-core/src/FooterSection/index.d.ts +11 -0
- package/libs-ui/react-core/src/GovGRFooter/index.d.ts +9 -0
- package/libs-ui/react-core/src/GovGRLogo/govgr-logo-base64.d.ts +2 -0
- package/libs-ui/react-core/src/GovGRLogo/index.d.ts +9 -0
- package/libs-ui/react-core/src/Header/index.d.ts +10 -0
- package/libs-ui/react-core/src/HeaderContent/index.d.ts +9 -0
- package/libs-ui/react-core/src/HeaderLogo/index.d.ts +21 -0
- package/libs-ui/react-core/src/HeaderSecondaryLogo/index.d.ts +21 -0
- package/libs-ui/react-core/src/HeaderSection/index.d.ts +9 -0
- package/libs-ui/react-core/src/HeaderSubtitle/index.d.ts +9 -0
- package/libs-ui/react-core/src/HeaderTitle/index.d.ts +13 -0
- package/libs-ui/react-core/src/HellenicRepublicLogo/index.d.ts +20 -0
- package/libs-ui/react-core/src/HellenicRepublicLogo/logo-el.d.ts +2 -0
- package/libs-ui/react-core/src/HellenicRepublicLogo/logo-en.d.ts +2 -0
- package/libs-ui/react-core/src/Layout/index.d.ts +10 -0
- package/libs-ui/react-core/src/Link/index.d.ts +1 -1
- package/libs-ui/react-core/src/List/index.d.ts +1 -1
- package/libs-ui/react-core/src/Main/index.d.ts +9 -0
- package/libs-ui/react-core/src/Masthead/index.d.ts +9 -0
- package/libs-ui/react-core/src/MastheadBody/index.d.ts +9 -0
- package/libs-ui/react-core/src/NavHorizontalListItem/index.d.ts +1 -1
- package/libs-ui/react-core/src/NavVerticalItem/index.d.ts +1 -1
- package/libs-ui/react-core/src/NotificationBannerLink/index.d.ts +1 -1
- package/libs-ui/react-core/src/PageTitle/index.d.ts +9 -0
- package/libs-ui/react-core/src/PageTitleCaption/index.d.ts +14 -0
- package/libs-ui/react-core/src/PageTitleHeading/index.d.ts +13 -0
- package/libs-ui/react-core/src/PageTitleSection/index.d.ts +10 -0
- package/libs-ui/react-core/src/RadioConditional/index.d.ts +11 -0
- package/libs-ui/react-core/src/RadioItem/index.d.ts +1 -1
- package/libs-ui/react-core/src/ServiceBadge/index.d.ts +11 -0
- package/libs-ui/react-core/src/SkipLink/index.d.ts +1 -1
- package/libs-ui/react-core/src/SvgIcon/index.d.ts +1 -1
- package/libs-ui/react-core/src/Table/index.d.ts +1 -1
- package/libs-ui/react-core/src/TabsListItem/index.d.ts +1 -1
- package/libs-ui/react-core/src/TextInput/index.d.ts +1 -1
- package/libs-ui/react-core/src/Top/index.d.ts +9 -0
- package/libs-ui/react-core/src/index.d.ts +141 -0
- package/package.json +7 -6
- package/utils.js +61 -47
- package/validators/index.js +33 -11
- package/validators/utils/index.js +1 -23
- package/validators/utils/int.js +31 -0
- package/validators/utils/number.js +27 -0
|
@@ -24,5 +24,5 @@ export interface TextInputProps extends BaseProps<'input'> {
|
|
|
24
24
|
* TextInput component when you need to let users enter text that’s no
|
|
25
25
|
* longer than a single line, such as their name or phone number.
|
|
26
26
|
*/
|
|
27
|
-
export declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputProps, "
|
|
27
|
+
export declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputProps, "form" | "slot" | "style" | "title" | "pattern" | "as" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "name" | "type" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "list" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "size" | "step" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "error" | "characterWidth" | "cellWidth"> & React.RefAttributes<HTMLInputElement>>;
|
|
28
28
|
export default TextInput;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseProps } from '@digigov/react-core/Base';
|
|
3
|
+
export interface TopProps extends BaseProps<'div'> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Top is used inside the Layout component and it must be the first component in order.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Top: React.ForwardRefExoticComponent<Pick<TopProps, "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default Top;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export { default as Accordion } from '@digigov/react-core/Accordion';
|
|
2
|
+
export { default as AccordionControls } from '@digigov/react-core/AccordionControls';
|
|
3
|
+
export { default as AccordionSection } from '@digigov/react-core/AccordionSection';
|
|
4
|
+
export { default as AccordionSectionContent } from '@digigov/react-core/AccordionSectionContent';
|
|
5
|
+
export { default as AccordionSectionHeader } from '@digigov/react-core/AccordionSectionHeader';
|
|
6
|
+
export { default as AccordionSectionSummary } from '@digigov/react-core/AccordionSectionSummary';
|
|
7
|
+
export { default as AccordionSectionSummaryHeading } from '@digigov/react-core/AccordionSectionSummaryHeading';
|
|
8
|
+
export { default as ArrowIcon } from '@digigov/react-core/ArrowIcon';
|
|
9
|
+
export { default as Aside } from '@digigov/react-core/Aside';
|
|
10
|
+
export { default as BackLink } from '@digigov/react-core/BackLink';
|
|
11
|
+
export { default as Blockquote } from '@digigov/react-core/Blockquote';
|
|
12
|
+
export { default as Bottom } from '@digigov/react-core/Bottom';
|
|
13
|
+
export { default as Breadcrumbs } from '@digigov/react-core/Breadcrumbs';
|
|
14
|
+
export { default as BreadcrumbsList } from '@digigov/react-core/BreadcrumbsList';
|
|
15
|
+
export { default as BreadcrumbsListItem } from '@digigov/react-core/BreadcrumbsListItem';
|
|
16
|
+
export { default as BurgerIcon } from '@digigov/react-core/BurgerIcon';
|
|
17
|
+
export { default as Button } from '@digigov/react-core/Button';
|
|
18
|
+
export { default as ButtonGroup } from '@digigov/react-core/ButtonGroup';
|
|
19
|
+
export { default as ButtonLink } from '@digigov/react-core/ButtonLink';
|
|
20
|
+
export { default as CallToAction } from '@digigov/react-core/CallToAction';
|
|
21
|
+
export { default as Card } from '@digigov/react-core/Card';
|
|
22
|
+
export { default as CardAction } from '@digigov/react-core/CardAction';
|
|
23
|
+
export { default as CardHeading } from '@digigov/react-core/CardHeading';
|
|
24
|
+
export { default as CardText } from '@digigov/react-core/CardText';
|
|
25
|
+
export { default as CaretIcon } from '@digigov/react-core/CaretIcon';
|
|
26
|
+
export { default as Checkbox } from '@digigov/react-core/Checkbox';
|
|
27
|
+
export { default as CheckboxConditional } from '@digigov/react-core/CheckboxConditional';
|
|
28
|
+
export { default as CheckboxItem } from '@digigov/react-core/CheckboxItem';
|
|
29
|
+
export { default as CheckIcon } from '@digigov/react-core/CheckIcon';
|
|
30
|
+
export { default as UncheckIcon } from '@digigov/react-core/UncheckIcon';
|
|
31
|
+
export { default as CloseIcon } from '@digigov/react-core/CloseIcon';
|
|
32
|
+
export { default as Confirmation } from '@digigov/react-core/Confirmation';
|
|
33
|
+
export { default as ConfirmationBody } from '@digigov/react-core/ConfirmationBody';
|
|
34
|
+
export { default as ConfirmationTitle } from '@digigov/react-core/ConfirmationTitle';
|
|
35
|
+
export { default as Container } from '@digigov/react-core/Container';
|
|
36
|
+
export { default as Copyright } from '@digigov/react-core/Copyright';
|
|
37
|
+
export { default as DateInput } from '@digigov/react-core/DateInput';
|
|
38
|
+
export { default as DateInputItem } from '@digigov/react-core/DateInputItem';
|
|
39
|
+
export { default as Details } from '@digigov/react-core/Details';
|
|
40
|
+
export { default as DetailsContent } from '@digigov/react-core/DetailsContent';
|
|
41
|
+
export { default as DetailsSummary } from '@digigov/react-core/DetailsSummary';
|
|
42
|
+
export { default as ErrorMessage } from '@digigov/react-core/ErrorMessage';
|
|
43
|
+
export { default as ErrorSummary } from '@digigov/react-core/ErrorSummary';
|
|
44
|
+
export { default as Fieldset } from '@digigov/react-core/Fieldset';
|
|
45
|
+
export { default as FieldsetLegend } from '@digigov/react-core/FieldsetLegend';
|
|
46
|
+
export { default as FileUpload } from '@digigov/react-core/FileUpload';
|
|
47
|
+
export { default as Footer } from '@digigov/react-core/Footer';
|
|
48
|
+
export { default as FooterContainer } from '@digigov/react-core/FooterContainer';
|
|
49
|
+
export { default as FooterContent } from '@digigov/react-core/FooterContent';
|
|
50
|
+
export { default as FooterContentLogos } from '@digigov/react-core/FooterContentLogos';
|
|
51
|
+
export { default as FooterHeading } from '@digigov/react-core/FooterHeading';
|
|
52
|
+
export { default as FooterImage } from '@digigov/react-core/FooterImage';
|
|
53
|
+
export { default as FooterInlineList } from '@digigov/react-core/FooterInlineList';
|
|
54
|
+
export { default as FooterInlineListItem } from '@digigov/react-core/FooterInlineListItem';
|
|
55
|
+
export { default as FooterLink } from '@digigov/react-core/FooterLink';
|
|
56
|
+
export { default as FooterList } from '@digigov/react-core/FooterList';
|
|
57
|
+
export { default as FooterListItem } from '@digigov/react-core/FooterListItem';
|
|
58
|
+
export { default as FooterMeta } from '@digigov/react-core/FooterMeta';
|
|
59
|
+
export { default as FooterMetaItem } from '@digigov/react-core/FooterMetaItem';
|
|
60
|
+
export { default as FooterNavigation } from '@digigov/react-core/FooterNavigation';
|
|
61
|
+
export { default as FooterSection } from '@digigov/react-core/FooterSection';
|
|
62
|
+
export { default as Field } from '@digigov/react-core/Field';
|
|
63
|
+
export { default as GovGRFooter } from '@digigov/react-core/GovGRFooter';
|
|
64
|
+
export { default as GovGRLogo } from '@digigov/react-core/GovGRLogo';
|
|
65
|
+
export { default as Grid } from '@digigov/react-core/Grid';
|
|
66
|
+
export { default as Header } from '@digigov/react-core/Header';
|
|
67
|
+
export { default as HeaderContent } from '@digigov/react-core/HeaderContent';
|
|
68
|
+
export { default as HeaderLogo } from '@digigov/react-core/HeaderLogo';
|
|
69
|
+
export { default as HeaderSecondaryLogo } from '@digigov/react-core/HeaderSecondaryLogo';
|
|
70
|
+
export { default as HeaderSection } from '@digigov/react-core/HeaderSection';
|
|
71
|
+
export { default as HeaderSubtitle } from '@digigov/react-core/HeaderSubtitle';
|
|
72
|
+
export { default as HeaderTitle } from '@digigov/react-core/HeaderTitle';
|
|
73
|
+
export { default as Heading } from '@digigov/react-core/Heading';
|
|
74
|
+
export { default as HeadingCaption } from '@digigov/react-core/HeadingCaption';
|
|
75
|
+
export { default as HellenicRepublicLogo } from '@digigov/react-core/HellenicRepublicLogo';
|
|
76
|
+
export { default as Hidden } from '@digigov/react-core/Hidden';
|
|
77
|
+
export { default as Hint } from '@digigov/react-core/Hint';
|
|
78
|
+
export { default as Label } from '@digigov/react-core/Label';
|
|
79
|
+
export { default as LabelTitle } from '@digigov/react-core/LabelTitle';
|
|
80
|
+
export { default as Layout } from '@digigov/react-core/Layout';
|
|
81
|
+
export { default as Link } from '@digigov/react-core/Link';
|
|
82
|
+
export { default as List } from '@digigov/react-core/List';
|
|
83
|
+
export { default as ListItem } from '@digigov/react-core/ListItem';
|
|
84
|
+
export { default as Main } from '@digigov/react-core/Main';
|
|
85
|
+
export { default as Masthead } from '@digigov/react-core/Masthead';
|
|
86
|
+
export { default as MastheadBody } from '@digigov/react-core/MastheadBody';
|
|
87
|
+
export { default as MoreVertIcon } from '@digigov/react-core/MoreVertIcon';
|
|
88
|
+
export { default as NavHorizontal } from '@digigov/react-core/NavHorizontal';
|
|
89
|
+
export { default as NavHorizontalList } from '@digigov/react-core/NavHorizontalList';
|
|
90
|
+
export { default as NavHorizontalListItem } from '@digigov/react-core/NavHorizontalListItem';
|
|
91
|
+
export { default as NavVertical } from '@digigov/react-core/NavVertical';
|
|
92
|
+
export { default as NavVerticalItem } from '@digigov/react-core/NavVerticalItem';
|
|
93
|
+
export { default as NormalText } from '@digigov/react-core/NormalText';
|
|
94
|
+
export { default as NotificationBanner } from '@digigov/react-core/NotificationBanner';
|
|
95
|
+
export { default as NotificationBannerContent } from '@digigov/react-core/NotificationBannerContent';
|
|
96
|
+
export { default as NotificationBannerHeader } from '@digigov/react-core/NotificationBannerHeader';
|
|
97
|
+
export { default as NotificationBannerHeading } from '@digigov/react-core/NotificationBannerHeading';
|
|
98
|
+
export { default as NotificationBannerLink } from '@digigov/react-core/NotificationBannerLink';
|
|
99
|
+
export { default as PageTitle } from '@digigov/react-core/PageTitle';
|
|
100
|
+
export { default as PageTitleCaption } from '@digigov/react-core/PageTitleCaption';
|
|
101
|
+
export { default as PageTitleHeading } from '@digigov/react-core/PageTitleHeading';
|
|
102
|
+
export { default as PageTitleSection } from '@digigov/react-core/PageTitleSection';
|
|
103
|
+
export { default as Paragraph } from '@digigov/react-core/Paragraph';
|
|
104
|
+
export { default as PhaseBannerHeaderContainer } from '@digigov/react-core/PhaseBannerHeaderContainer';
|
|
105
|
+
export { default as PhaseBanner } from '@digigov/react-core/PhaseBanner';
|
|
106
|
+
export { default as PhaseBannerTag } from '@digigov/react-core/PhaseBannerTag';
|
|
107
|
+
export { default as PhaseBannerText } from '@digigov/react-core/PhaseBannerText';
|
|
108
|
+
export { default as Radio } from '@digigov/react-core/Radio';
|
|
109
|
+
export { default as RadioItem } from '@digigov/react-core/RadioItem';
|
|
110
|
+
export { default as RadioConditional } from '@digigov/react-core/RadioConditional';
|
|
111
|
+
export { default as SectionBreak } from '@digigov/react-core/SectionBreak';
|
|
112
|
+
export { default as Select } from '@digigov/react-core/Select';
|
|
113
|
+
export { default as SelectOption } from '@digigov/react-core/SelectOption';
|
|
114
|
+
export { default as ServiceBadge } from '@digigov/react-core/ServiceBadge';
|
|
115
|
+
export { default as SkipLink } from '@digigov/react-core/SkipLink';
|
|
116
|
+
export { default as SummaryList } from '@digigov/react-core/SummaryList';
|
|
117
|
+
export { default as SummaryListItem } from '@digigov/react-core/SummaryListItem';
|
|
118
|
+
export { default as SummaryListItemAction } from '@digigov/react-core/SummaryListItemAction';
|
|
119
|
+
export { default as SummaryListItemKey } from '@digigov/react-core/SummaryListItemKey';
|
|
120
|
+
export { default as SummaryListItemValue } from '@digigov/react-core/SummaryListItemValue';
|
|
121
|
+
export { default as SvgIcon } from '@digigov/react-core/SvgIcon';
|
|
122
|
+
export { default as Table } from '@digigov/react-core/Table';
|
|
123
|
+
export { default as TableBody } from '@digigov/react-core/TableBody';
|
|
124
|
+
export { default as TableCaption } from '@digigov/react-core/TableCaption';
|
|
125
|
+
export { default as TableContainer } from '@digigov/react-core/TableContainer';
|
|
126
|
+
export { default as TableDataCell } from '@digigov/react-core/TableDataCell';
|
|
127
|
+
export { default as TableNoDataRow } from '@digigov/react-core/TableNoDataRow';
|
|
128
|
+
export { default as TableHead } from '@digigov/react-core/TableHead';
|
|
129
|
+
export { default as TableHeadCell } from '@digigov/react-core/TableHeadCell';
|
|
130
|
+
export { default as TableRow } from '@digigov/react-core/TableRow';
|
|
131
|
+
export { default as Tabs } from '@digigov/react-core/Tabs';
|
|
132
|
+
export { default as TabsHeading } from '@digigov/react-core/TabsHeading';
|
|
133
|
+
export { default as TabsList } from '@digigov/react-core/TabsList';
|
|
134
|
+
export { default as TabsListItem } from '@digigov/react-core/TabsListItem';
|
|
135
|
+
export { default as TabsPanel } from '@digigov/react-core/TabsPanel';
|
|
136
|
+
export { default as TextArea } from '@digigov/react-core/TextArea';
|
|
137
|
+
export { default as TextInput } from '@digigov/react-core/TextInput';
|
|
138
|
+
export { default as Top } from '@digigov/react-core/Top';
|
|
139
|
+
export { default as Base } from '@digigov/react-core/Base';
|
|
140
|
+
export { default as VisuallyHidden } from '@digigov/react-core/VisuallyHidden';
|
|
141
|
+
export { default as WarningText } from '@digigov/react-core/WarningText';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "@digigov form builder",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -11,14 +11,15 @@
|
|
|
11
11
|
"directory": "dist"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"react-hook-form": "
|
|
15
|
-
"yup": "0.
|
|
14
|
+
"react-hook-form": "7.33.1",
|
|
15
|
+
"yup": "0.32.11",
|
|
16
16
|
"google-libphonenumber": "3.2.8",
|
|
17
|
-
"dayjs": "1.10.4"
|
|
17
|
+
"dayjs": "1.10.4",
|
|
18
|
+
"@hookform/resolvers": "2.9.6"
|
|
18
19
|
},
|
|
19
20
|
"peerDependencies": {
|
|
20
|
-
"@digigov/ui": "0.
|
|
21
|
-
"@digigov/react-core": "0.16.
|
|
21
|
+
"@digigov/ui": "0.26.2",
|
|
22
|
+
"@digigov/react-core": "0.16.2",
|
|
22
23
|
"clsx": "1.1.1",
|
|
23
24
|
"react": "16.14.0",
|
|
24
25
|
"react-dom": "16.14.0"
|
package/utils.js
CHANGED
|
@@ -9,89 +9,103 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.yupResolver = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _resolvers = require("@hookform/resolvers");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _reactHookForm = require("react-hook-form");
|
|
19
19
|
|
|
20
20
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Why `path!` ? because it could be `undefined` in some case
|
|
24
|
+
* https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
|
|
25
|
+
*/
|
|
23
26
|
var parseErrorSchema = function parseErrorSchema(error, validateAllFieldCriteria) {
|
|
24
|
-
return
|
|
25
|
-
var path
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
return (error.inner || []).reduce(function (previous, error) {
|
|
28
|
+
var _error$path;
|
|
29
|
+
|
|
30
|
+
error.path = (_error$path = error.path) === null || _error$path === void 0 ? void 0 : _error$path.replace(/\[([0-9]+)\]/g, '.$1');
|
|
31
|
+
|
|
32
|
+
if (!previous[error.path]) {
|
|
33
|
+
previous[error.path] = {
|
|
34
|
+
message: error.message,
|
|
35
|
+
type: error.type
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (validateAllFieldCriteria) {
|
|
40
|
+
var types = previous[error.path].types;
|
|
41
|
+
var messages = types && types[error.type];
|
|
42
|
+
previous[error.path] = (0, _reactHookForm.appendErrors)(error.path, validateAllFieldCriteria, previous, error.type, messages ? [].concat(messages, error.message) : error.message);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return previous;
|
|
46
|
+
}, {});
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
var yupResolver = function yupResolver(schema) {
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
};
|
|
50
|
+
var schemaOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
51
|
+
var resolverOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
46
52
|
return /*#__PURE__*/function () {
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
parsedErrors,
|
|
50
|
-
_args = arguments;
|
|
53
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values, context, options) {
|
|
54
|
+
var result, parsed;
|
|
51
55
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
52
56
|
while (1) {
|
|
53
57
|
switch (_context.prev = _context.next) {
|
|
54
58
|
case 0:
|
|
55
|
-
|
|
56
|
-
_context.prev = 1;
|
|
59
|
+
_context.prev = 0;
|
|
57
60
|
|
|
58
|
-
if (
|
|
61
|
+
if (schemaOptions.context && process.env.NODE_ENV === 'development') {
|
|
59
62
|
// eslint-disable-next-line no-console
|
|
60
63
|
console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead");
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
_context.next =
|
|
64
|
-
return schema.validate(values, (0,
|
|
66
|
+
_context.next = 4;
|
|
67
|
+
return schema[resolverOptions.mode === 'sync' ? 'validateSync' : 'validate'](values, (0, _extends2["default"])({
|
|
68
|
+
abortEarly: false
|
|
69
|
+
}, schemaOptions, {
|
|
65
70
|
context: context
|
|
66
71
|
}));
|
|
67
72
|
|
|
68
|
-
case
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
case 4:
|
|
74
|
+
result = _context.sent;
|
|
75
|
+
options.shouldUseNativeValidation && (0, _resolvers.validateFieldsNatively)({}, options);
|
|
71
76
|
return _context.abrupt("return", {
|
|
72
|
-
values:
|
|
73
|
-
errors:
|
|
77
|
+
values: resolverOptions.rawValues ? values : result,
|
|
78
|
+
errors: {}
|
|
74
79
|
});
|
|
75
80
|
|
|
76
|
-
case
|
|
77
|
-
_context.prev =
|
|
78
|
-
_context.
|
|
79
|
-
|
|
81
|
+
case 9:
|
|
82
|
+
_context.prev = 9;
|
|
83
|
+
_context.t0 = _context["catch"](0);
|
|
84
|
+
|
|
85
|
+
if (_context.t0.inner) {
|
|
86
|
+
_context.next = 13;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
throw _context.t0;
|
|
91
|
+
|
|
92
|
+
case 13:
|
|
93
|
+
parsed = parseErrorSchema(_context.t0, !options.shouldUseNativeValidation && options.criteriaMode === 'all');
|
|
80
94
|
return _context.abrupt("return", {
|
|
81
95
|
values: {},
|
|
82
|
-
errors:
|
|
96
|
+
errors: parsed
|
|
83
97
|
});
|
|
84
98
|
|
|
85
|
-
case
|
|
99
|
+
case 15:
|
|
86
100
|
case "end":
|
|
87
101
|
return _context.stop();
|
|
88
102
|
}
|
|
89
103
|
}
|
|
90
|
-
}, _callee, null, [[
|
|
104
|
+
}, _callee, null, [[0, 9]]);
|
|
91
105
|
}));
|
|
92
106
|
|
|
93
|
-
return function (_x, _x2) {
|
|
94
|
-
return
|
|
107
|
+
return function (_x, _x2, _x3) {
|
|
108
|
+
return _ref.apply(this, arguments);
|
|
95
109
|
};
|
|
96
110
|
}();
|
|
97
111
|
};
|
package/validators/index.js
CHANGED
|
@@ -22,6 +22,10 @@ var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customPars
|
|
|
22
22
|
|
|
23
23
|
var _utils = require("@digigov/form/validators/utils");
|
|
24
24
|
|
|
25
|
+
var _number = require("@digigov/form/validators/utils/number");
|
|
26
|
+
|
|
27
|
+
var _int = require("@digigov/form/validators/utils/int");
|
|
28
|
+
|
|
25
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
30
|
|
|
27
31
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -56,10 +60,26 @@ var getYUPTypeMap = function getYUPTypeMap() {
|
|
|
56
60
|
if ((0, _typeof2["default"])(field.extra.of) === 'object') {
|
|
57
61
|
// else if the field is an object then it is a scalar type
|
|
58
62
|
// eg. number, string etc.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
var arrayValidator = yup.array().of(yupTypeMap[field.extra.of.type](field.extra.of)).required(field.required);
|
|
64
|
+
if (field.extra.length) arrayValidator = arrayValidator.length(field.extra.length, {
|
|
65
|
+
key: 'form.error.array.length',
|
|
66
|
+
context: {
|
|
67
|
+
length: field.extra.length
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (field.extra.min) arrayValidator = arrayValidator.min(field.extra.min, {
|
|
71
|
+
key: 'form.error.array.min',
|
|
72
|
+
context: {
|
|
73
|
+
min: field.extra.min
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
if (field.extra.max) arrayValidator = arrayValidator.max(field.extra.max, {
|
|
77
|
+
key: 'form.error.array.max',
|
|
78
|
+
context: {
|
|
79
|
+
max: field.extra.max
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return arrayValidator;
|
|
63
83
|
} else if (typeof field.extra.of === 'string') {
|
|
64
84
|
return yup.array().of(yupTypeMap[field.extra.of]());
|
|
65
85
|
} else {
|
|
@@ -68,7 +88,9 @@ var getYUPTypeMap = function getYUPTypeMap() {
|
|
|
68
88
|
}
|
|
69
89
|
},
|
|
70
90
|
"int": function int() {
|
|
71
|
-
return yup.
|
|
91
|
+
return yup.mixed().transform(function (_, val) {
|
|
92
|
+
return val !== '' ? Number(val) : null;
|
|
93
|
+
}).test((0, _number.NUMBER_VALIDATOR)()).test((0, _int.INT_VALIDATOR)());
|
|
72
94
|
},
|
|
73
95
|
email: function email() {
|
|
74
96
|
return yup.string().email('form.error.email');
|
|
@@ -100,8 +122,8 @@ var getYUPTypeMap = function getYUPTypeMap() {
|
|
|
100
122
|
date: function date(field) {
|
|
101
123
|
var simpleDate = yup.string().nullable(true).test('date', 'form.error.date.invalid', function (value) {
|
|
102
124
|
if (!value) return true;
|
|
103
|
-
|
|
104
|
-
return
|
|
125
|
+
var date = getDate(value);
|
|
126
|
+
return date.isValid();
|
|
105
127
|
});
|
|
106
128
|
var params = field.extra || {};
|
|
107
129
|
|
|
@@ -127,8 +149,8 @@ var getYUPTypeMap = function getYUPTypeMap() {
|
|
|
127
149
|
},
|
|
128
150
|
test: function test(value) {
|
|
129
151
|
if (!value) return true;
|
|
130
|
-
|
|
131
|
-
var isValid = +
|
|
152
|
+
var date = getDate(value);
|
|
153
|
+
var isValid = +date.toDate() < +maxDate;
|
|
132
154
|
return isValid;
|
|
133
155
|
}
|
|
134
156
|
});
|
|
@@ -157,8 +179,8 @@ var getYUPTypeMap = function getYUPTypeMap() {
|
|
|
157
179
|
},
|
|
158
180
|
test: function test(value) {
|
|
159
181
|
if (!value) return true;
|
|
160
|
-
|
|
161
|
-
var isValid = +
|
|
182
|
+
var date = getDate(value);
|
|
183
|
+
var isValid = +date.toDate() > +minDate;
|
|
162
184
|
return isValid;
|
|
163
185
|
}
|
|
164
186
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
4
|
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -16,10 +14,6 @@ exports.computeShape = computeShape;
|
|
|
16
14
|
exports.getYupField = getYupField;
|
|
17
15
|
exports.getYupObjectShape = getYupObjectShape;
|
|
18
16
|
|
|
19
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
20
|
-
|
|
21
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
22
|
-
|
|
23
17
|
var yup = _interopRequireWildcard(require("yup"));
|
|
24
18
|
|
|
25
19
|
var _afm = require("@digigov/form/validators/utils/afm");
|
|
@@ -111,7 +105,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
111
105
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
112
106
|
|
|
113
107
|
function getYupField(field, yupTypeMap) {
|
|
114
|
-
var yupField = yupTypeMap[field.type] || yupTypeMap
|
|
108
|
+
var yupField = yupTypeMap[(field === null || field === void 0 ? void 0 : field.type) || 'string'] || yupTypeMap['string'];
|
|
115
109
|
return yupField(field);
|
|
116
110
|
}
|
|
117
111
|
|
|
@@ -119,22 +113,6 @@ function computeShape(fields, yupTypeMap, validatorRegistry) {
|
|
|
119
113
|
var fieldSchemas = {};
|
|
120
114
|
var objectFields = {};
|
|
121
115
|
fields.forEach(function (field) {
|
|
122
|
-
if (field.key.includes('.')) {
|
|
123
|
-
var _field$key$split = field.key.split(/\.(.+)/),
|
|
124
|
-
_field$key$split2 = (0, _slicedToArray2["default"])(_field$key$split, 2),
|
|
125
|
-
objectKey = _field$key$split2[0],
|
|
126
|
-
fieldKey = _field$key$split2[1];
|
|
127
|
-
|
|
128
|
-
if (!objectFields[objectKey]) {
|
|
129
|
-
objectFields[objectKey] = [];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
objectFields[objectKey].push((0, _extends2["default"])({}, field, {
|
|
133
|
-
key: fieldKey
|
|
134
|
-
}));
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
116
|
var yupField = getYupField(field, yupTypeMap);
|
|
139
117
|
|
|
140
118
|
if (field.condition) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.INT_VALIDATOR = void 0;
|
|
7
|
+
exports.validateIntNumber = validateIntNumber;
|
|
8
|
+
|
|
9
|
+
function validateIntNumber(number) {
|
|
10
|
+
if (number === undefined) {
|
|
11
|
+
return false;
|
|
12
|
+
} else {
|
|
13
|
+
return Number.isInteger(number) && Number(number) > 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var INT_VALIDATOR = function INT_VALIDATOR() {
|
|
18
|
+
return {
|
|
19
|
+
name: 'int-validator',
|
|
20
|
+
message: 'form.error.positive_integer_number',
|
|
21
|
+
test: function test(value) {
|
|
22
|
+
if (value === null) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return validateIntNumber(value);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.INT_VALIDATOR = INT_VALIDATOR;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NUMBER_VALIDATOR = void 0;
|
|
7
|
+
exports.validateNumber = validateNumber;
|
|
8
|
+
|
|
9
|
+
function validateNumber(number) {
|
|
10
|
+
return !Number.isNaN(number);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
var NUMBER_VALIDATOR = function NUMBER_VALIDATOR() {
|
|
14
|
+
return {
|
|
15
|
+
name: 'number-validator',
|
|
16
|
+
message: 'form.error.number',
|
|
17
|
+
test: function test(value) {
|
|
18
|
+
if (value === null) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return validateNumber(value);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.NUMBER_VALIDATOR = NUMBER_VALIDATOR;
|