@digigov/form 0.4.8 → 0.5.0

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 (111) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/Field/index.js +9 -2
  3. package/Questions/Step/index.js +1 -0
  4. package/es/Field/index.js +8 -2
  5. package/es/Questions/Step/index.js +2 -0
  6. package/es/index.js +2 -0
  7. package/es/index.mdx +0 -3
  8. package/es/inputs/Checkboxes/index.js +7 -1
  9. package/es/inputs/DateInput/index.js +149 -0
  10. package/es/inputs/FileInput/index.js +1 -0
  11. package/es/inputs/Input/index.js +5 -2
  12. package/es/utils.js +1 -0
  13. package/es/validators.js +83 -4
  14. package/esm/Field/index.js +8 -2
  15. package/esm/Questions/Step/index.js +2 -0
  16. package/esm/index.js +3 -1
  17. package/esm/index.mdx +0 -3
  18. package/esm/inputs/Checkboxes/index.js +7 -1
  19. package/esm/inputs/DateInput/index.js +149 -0
  20. package/esm/inputs/FileInput/index.js +1 -0
  21. package/esm/inputs/Input/index.js +5 -2
  22. package/esm/utils.js +1 -0
  23. package/esm/validators.js +83 -4
  24. package/index.js +1 -0
  25. package/index.mdx +0 -3
  26. package/inputs/Checkboxes/index.js +7 -1
  27. package/inputs/DateInput/index.js +173 -0
  28. package/inputs/FileInput/index.js +1 -0
  29. package/inputs/Input/index.js +5 -2
  30. package/libs/form/src/Field/index.d.ts +7 -6
  31. package/libs/form/src/Fieldset/index.d.ts +9 -3
  32. package/libs/form/src/inputs/Checkboxes/index.d.ts +2 -1
  33. package/libs/form/src/inputs/DateInput/index.d.ts +14 -0
  34. package/libs/form/src/validators.d.ts +4 -2
  35. package/libs/ui/src/core/Accordion/index.d.ts +3 -3
  36. package/libs/ui/src/core/Blockquote/index.d.ts +1 -1
  37. package/libs/ui/src/core/Button/BackButton.d.ts +1 -1
  38. package/libs/ui/src/core/Button/ButtonLink.d.ts +1 -1
  39. package/libs/ui/src/core/Button/index.d.ts +2 -1
  40. package/libs/ui/src/core/Link/index.d.ts +3 -8
  41. package/libs/ui/src/core/NavList/NavList.d.ts +1 -1
  42. package/libs/ui/src/core/NavList/NavListItemBase.d.ts +1 -1
  43. package/libs/ui/src/core/NotificationBanner/index.d.ts +9 -8
  44. package/libs/ui/src/core/ServiceBadge/index.d.ts +1 -0
  45. package/libs/ui/src/locales/el.d.ts +10 -0
  46. package/libs/ui/src/typography/Caption.d.ts +1 -1
  47. package/libs-ui/react-core/src/Accordion/index.d.ts +1 -1
  48. package/libs-ui/react-core/src/AccordionControls/index.d.ts +1 -1
  49. package/libs-ui/react-core/src/AccordionSection/index.d.ts +1 -1
  50. package/libs-ui/react-core/src/AccordionSectionContent/index.d.ts +1 -1
  51. package/libs-ui/react-core/src/AccordionSectionHeader/index.d.ts +1 -1
  52. package/libs-ui/react-core/src/ArrowIcon/index.d.ts +15 -0
  53. package/libs-ui/react-core/src/BackLink/index.d.ts +1 -1
  54. package/libs-ui/react-core/src/Blockquote/index.d.ts +1 -1
  55. package/libs-ui/react-core/src/Button/index.d.ts +1 -1
  56. package/libs-ui/react-core/src/ButtonGroup/index.d.ts +9 -0
  57. package/libs-ui/react-core/src/ButtonLink/index.d.ts +1 -1
  58. package/libs-ui/react-core/src/CallToAction/index.d.ts +1 -1
  59. package/libs-ui/react-core/src/CaretIcon/index.d.ts +15 -0
  60. package/libs-ui/react-core/src/Checkbox/index.d.ts +1 -1
  61. package/libs-ui/react-core/src/CheckboxItem/index.d.ts +1 -1
  62. package/libs-ui/react-core/src/DateInput/index.d.ts +12 -0
  63. package/libs-ui/react-core/src/DateInputItem/index.d.ts +25 -0
  64. package/libs-ui/react-core/src/Details/index.d.ts +1 -1
  65. package/libs-ui/react-core/src/DetailsContent/index.d.ts +1 -1
  66. package/libs-ui/react-core/src/DetailsSummary/index.d.ts +1 -1
  67. package/libs-ui/react-core/src/ErrorMessage/index.d.ts +1 -1
  68. package/libs-ui/react-core/src/ErrorSummary/index.d.ts +1 -1
  69. package/libs-ui/react-core/src/Field/index.d.ts +1 -1
  70. package/libs-ui/react-core/src/Fieldset/index.d.ts +1 -1
  71. package/libs-ui/react-core/src/FieldsetLegend/index.d.ts +1 -1
  72. package/libs-ui/react-core/src/FileUpload/index.d.ts +1 -1
  73. package/libs-ui/react-core/src/Heading/index.d.ts +1 -1
  74. package/libs-ui/react-core/src/HeadingCaption/index.d.ts +1 -1
  75. package/libs-ui/react-core/src/Hint/index.d.ts +1 -1
  76. package/libs-ui/react-core/src/Label/index.d.ts +1 -1
  77. package/libs-ui/react-core/src/LabelTitle/index.d.ts +1 -1
  78. package/libs-ui/react-core/src/Link/index.d.ts +14 -0
  79. package/libs-ui/react-core/src/List/index.d.ts +1 -1
  80. package/libs-ui/react-core/src/ListItem/index.d.ts +1 -1
  81. package/libs-ui/react-core/src/NormalText/index.d.ts +1 -1
  82. package/libs-ui/react-core/src/NotificationBanner/index.d.ts +1 -1
  83. package/libs-ui/react-core/src/NotificationBannerContent/index.d.ts +1 -1
  84. package/libs-ui/react-core/src/NotificationBannerHeader/index.d.ts +1 -1
  85. package/libs-ui/react-core/src/NotificationBannerHeading/index.d.ts +1 -1
  86. package/libs-ui/react-core/src/NotificationBannerLink/index.d.ts +15 -0
  87. package/libs-ui/react-core/src/Paragraph/index.d.ts +1 -1
  88. package/libs-ui/react-core/src/PhaseBanner/index.d.ts +1 -1
  89. package/libs-ui/react-core/src/PhaseBannerTag/index.d.ts +1 -1
  90. package/libs-ui/react-core/src/PhaseBannerText/index.d.ts +11 -0
  91. package/libs-ui/react-core/src/Radio/index.d.ts +1 -1
  92. package/libs-ui/react-core/src/RadioItem/index.d.ts +1 -1
  93. package/libs-ui/react-core/src/SectionBreak/index.d.ts +1 -1
  94. package/libs-ui/react-core/src/Select/index.d.ts +1 -1
  95. package/libs-ui/react-core/src/SelectOption/index.d.ts +1 -1
  96. package/libs-ui/react-core/src/SummaryList/index.d.ts +1 -1
  97. package/libs-ui/react-core/src/SummaryListItem/index.d.ts +1 -1
  98. package/libs-ui/react-core/src/SummaryListItemAction/index.d.ts +1 -1
  99. package/libs-ui/react-core/src/SummaryListItemKey/index.d.ts +1 -1
  100. package/libs-ui/react-core/src/SummaryListItemValue/index.d.ts +1 -1
  101. package/libs-ui/react-core/src/Tabs/index.d.ts +1 -1
  102. package/libs-ui/react-core/src/TabsHeading/index.d.ts +1 -1
  103. package/libs-ui/react-core/src/TabsList/index.d.ts +1 -1
  104. package/libs-ui/react-core/src/TabsListItem/index.d.ts +1 -1
  105. package/libs-ui/react-core/src/TabsPanel/index.d.ts +1 -1
  106. package/libs-ui/react-core/src/TextArea/index.d.ts +1 -1
  107. package/libs-ui/react-core/src/TextInput/index.d.ts +1 -1
  108. package/libs-ui/react-core/src/WarningText/index.d.ts +1 -1
  109. package/package.json +4 -3
  110. package/utils.js +1 -0
  111. package/validators.js +86 -4
@@ -24,5 +24,5 @@ export interface TextInputProps extends InputElementAttributes {
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, "type" | "className" | "children" | "key" | "disabled" | "form" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "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" | "pattern" | "list" | "step" | "size" | "required" | "error" | "min" | "max" | "maxLength" | "minLength" | "characterWidth" | "cellWidth" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "multiple" | "readOnly" | "src" | "value" | "width"> & React.RefAttributes<HTMLInputElement>>;
27
+ export declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputProps, "type" | "className" | "style" | "form" | "slot" | "title" | "pattern" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "required" | "disabled" | "name" | "list" | "step" | "size" | "error" | "min" | "max" | "maxLength" | "minLength" | "characterWidth" | "cellWidth" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "multiple" | "readOnly" | "src" | "value" | "width"> & React.RefAttributes<HTMLInputElement>>;
28
28
  export default TextInput;
@@ -7,5 +7,5 @@ export interface WarningTextProps extends DivElementAttributes {
7
7
  * Use the WarningText component when you need to warn users about something important.
8
8
  * The component is used with a text inside it.
9
9
  */
10
- export declare const WarningText: React.ForwardRefExoticComponent<Pick<WarningTextProps, "className" | "children" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "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"> & React.RefAttributes<HTMLDivElement>>;
10
+ export declare const WarningText: React.ForwardRefExoticComponent<Pick<WarningTextProps, "className" | "style" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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"> & React.RefAttributes<HTMLDivElement>>;
11
11
  export default WarningText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/form",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
4
4
  "description": "@digigov form builder",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "MIT",
@@ -13,10 +13,11 @@
13
13
  "dependencies": {
14
14
  "react-hook-form": "6.12.2",
15
15
  "yup": "0.30.0",
16
- "google-libphonenumber": "3.2.8"
16
+ "google-libphonenumber": "3.2.8",
17
+ "dayjs": "1.10.4"
17
18
  },
18
19
  "peerDependencies": {
19
- "@digigov/ui": "0.10.2",
20
+ "@digigov/ui": "0.12.0",
20
21
  "@material-ui/core": "4.11.3",
21
22
  "@material-ui/icons": "4.11.2",
22
23
  "clsx": "1.1.1",
package/utils.js CHANGED
@@ -17,6 +17,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
17
17
 
18
18
  var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
19
19
 
20
+ /* eslint-disable @typescript-eslint/no-explicit-any */
20
21
  var parseErrorSchema = function parseErrorSchema(error, validateAllFieldCriteria) {
21
22
  return Array.isArray(error.inner) && error.inner.length ? error.inner.reduce(function (previous, _ref) {
22
23
  var path = _ref.path,
package/validators.js CHANGED
@@ -22,6 +22,10 @@ var gPhoneNumber = _interopRequireWildcard(require("google-libphonenumber"));
22
22
 
23
23
  var _react = require("react");
24
24
 
25
+ var _dayjs = _interopRequireDefault(require("dayjs"));
26
+
27
+ var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
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 || _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; }
@@ -32,6 +36,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
32
36
 
33
37
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
34
38
 
39
+ _dayjs["default"].extend(_customParseFormat["default"]);
40
+
35
41
  var DEFAULT_FILE_MAX_SIZE = 10000000;
36
42
 
37
43
  function validateAFM(afm) {
@@ -306,6 +312,13 @@ var IBAN_VALIDATOR = function IBAN_VALIDATOR(field) {
306
312
  };
307
313
  };
308
314
 
315
+ var VALID_DATE_FORMATS = ['DD/MM/YYYY'];
316
+ var DATE_CACHE = {};
317
+
318
+ var getDate = function getDate(v) {
319
+ return DATE_CACHE[v] ? DATE_CACHE[v] : (0, _dayjs["default"])(v, VALID_DATE_FORMATS, true);
320
+ };
321
+
309
322
  function getYupField(field, yupTypeMap) {
310
323
  var yupField = yupTypeMap[field.type] || yupTypeMap.string;
311
324
  return yupField(field);
@@ -392,7 +405,8 @@ function computeShape(fields, yupTypeMap, validatorRegistry) {
392
405
  return fieldSchemas;
393
406
  }
394
407
 
395
- function getYupObjectShape(fields, yupTypeMap, validatorRegistry) {
408
+ function getYupObjectShape( // eslint-disable-next-line @typescript-eslint/no-explicit-any
409
+ fields, yupTypeMap, validatorRegistry) {
396
410
  if (!fields.current) {
397
411
  var fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);
398
412
  return yup.object().shape(fieldSchemas);
@@ -433,7 +447,6 @@ var getYUPTypeMap = function getYUPTypeMap() {
433
447
  iban: function iban(field) {
434
448
  return yup.string().test(IBAN_VALIDATOR(field));
435
449
  },
436
- // eslint-disable-next-line @typescript-eslint/camelcase
437
450
  mobile_phone: function mobile_phone() {
438
451
  return yup.string().test(MOBILE_PHONE_VALIDATOR);
439
452
  },
@@ -442,12 +455,81 @@ var getYUPTypeMap = function getYUPTypeMap() {
442
455
  },
443
456
  'choice:single': function choiceSingle() {
444
457
  return yup.string().nullable();
458
+ },
459
+ date: function date(field) {
460
+ var simpleDate = yup.string().nullable(true).test('date', 'form.error.date.invalid', function (value) {
461
+ if (!value) return true;
462
+ value = getDate(value);
463
+ return value.isValid();
464
+ });
465
+ var params = field.extra || {};
466
+
467
+ if (params.max) {
468
+ var maxDate;
469
+
470
+ if (params.max === 'now') {
471
+ var today = new Date();
472
+ maxDate = new Date(today);
473
+ } else {
474
+ maxDate = getDate(params.max).toDate();
475
+ }
476
+
477
+ var maxNextDate = new Date(maxDate);
478
+ maxNextDate.setDate(maxDate.getDate() + 1);
479
+ simpleDate = simpleDate.test({
480
+ name: 'earlier-than',
481
+ message: {
482
+ key: 'form.error.date.earlier_than',
483
+ context: {
484
+ maxDate: maxNextDate.toLocaleDateString()
485
+ }
486
+ },
487
+ test: function test(value) {
488
+ if (!value) return true;
489
+ value = getDate(value);
490
+ var isValid = +value.toDate() < +maxDate;
491
+ return isValid;
492
+ }
493
+ });
494
+ }
495
+
496
+ if (params.min) {
497
+ var minDate;
498
+
499
+ if (params.min === 'now') {
500
+ var _today = new Date();
501
+
502
+ minDate = new Date(_today);
503
+ } else {
504
+ minDate = getDate(params.min).toDate();
505
+ }
506
+
507
+ var minPreviousDate = new Date(minDate);
508
+ minPreviousDate.setDate(minDate.getDate() - 1);
509
+ simpleDate = simpleDate.test({
510
+ name: 'later-than',
511
+ message: {
512
+ key: 'form.error.date.later_than',
513
+ context: {
514
+ minDate: minPreviousDate.toLocaleDateString()
515
+ }
516
+ },
517
+ test: function test(value) {
518
+ if (!value) return true;
519
+ value = getDate(value);
520
+ var isValid = +value.toDate() > +minDate;
521
+ return isValid;
522
+ }
523
+ });
524
+ }
525
+
526
+ return simpleDate;
445
527
  }
446
528
  };
447
529
  return yupTypeMap;
448
- }; // Create a yup validation schema from given fields input
449
-
530
+ };
450
531
 
532
+ // Create a yup validation schema from given fields input
451
533
  function useValidationSchema(fields, validatorRegistry) {
452
534
  return (0, _react.useMemo)(function () {
453
535
  var yupTypeMap = getYUPTypeMap();