@digigov/react-core 0.4.0 → 0.4.1
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/Button/index.d.ts +5 -1
- package/Button/index.js +4 -2
- package/CHANGELOG.md +9 -1
- package/CheckboxConditional/__snapshots__/index.test.tsx.snap +2 -11
- package/CheckboxConditional/index.d.ts +1 -1
- package/CheckboxConditional/index.js +2 -6
- package/CheckboxItem/__snapshots__/index.test.tsx.snap +14 -14
- package/CheckboxItem/index.d.ts +2 -2
- package/CheckboxItem/index.js +4 -4
- package/DateInputItem/__snapshots__/index.test.tsx.snap +37 -13
- package/DateInputItem/index.d.ts +12 -2
- package/DateInputItem/index.js +7 -4
- package/DateInputItem/index.test.js +9 -0
- package/Field/__snapshots__/index.test.tsx.snap +35 -0
- package/Field/index.d.ts +13 -0
- package/{FormGroup → Field}/index.js +6 -6
- package/{FormGroup → Field}/index.test.d.ts +0 -0
- package/Field/index.test.js +31 -0
- package/FieldsetLegend/__snapshots__/index.test.tsx.snap +102 -876
- package/FieldsetLegend/index.d.ts +4 -4
- package/FieldsetLegend/index.js +9 -8
- package/FieldsetLegend/index.test.js +48 -144
- package/FooterImage/index.d.ts +1 -1
- package/Grid/index.d.ts +1 -1
- package/Header/index.js +1 -1
- package/HellenicRepublicLogo/index.d.ts +1 -1
- package/Label/index.d.ts +1 -6
- package/Label/index.js +3 -5
- package/LabelTitle/__snapshots__/index.test.tsx.snap +133 -0
- package/LabelTitle/index.d.ts +19 -0
- package/LabelTitle/index.js +41 -0
- package/LabelTitle/index.test.d.ts +1 -0
- package/LabelTitle/index.test.js +91 -0
- package/RadioConditional/__snapshots__/index.test.tsx.snap +39 -0
- package/RadioConditional/index.d.ts +15 -0
- package/RadioConditional/index.js +42 -0
- package/RadioConditional/index.test.d.ts +1 -0
- package/RadioConditional/index.test.js +23 -0
- package/RadioItem/__snapshots__/index.test.tsx.snap +20 -20
- package/RadioItem/index.d.ts +2 -2
- package/RadioItem/index.js +4 -4
- package/TableDataCell/index.d.ts +1 -1
- package/TextInput/index.d.ts +1 -1
- package/es/Button/index.js +4 -2
- package/es/CheckboxConditional/__snapshots__/index.test.tsx.snap +2 -11
- package/es/CheckboxConditional/index.js +2 -6
- package/es/CheckboxItem/__snapshots__/index.test.tsx.snap +14 -14
- package/es/CheckboxItem/index.js +4 -4
- package/es/DateInputItem/__snapshots__/index.test.tsx.snap +37 -13
- package/es/DateInputItem/index.js +7 -4
- package/es/DateInputItem/index.test.js +9 -0
- package/es/Field/__snapshots__/index.test.tsx.snap +35 -0
- package/es/{FormGroup → Field}/index.js +4 -4
- package/es/Field/index.test.js +25 -0
- package/es/FieldsetLegend/__snapshots__/index.test.tsx.snap +102 -876
- package/es/FieldsetLegend/index.js +9 -8
- package/es/FieldsetLegend/index.test.js +48 -139
- package/es/Header/index.js +1 -1
- package/es/Label/index.js +3 -5
- package/es/LabelTitle/__snapshots__/index.test.tsx.snap +133 -0
- package/es/LabelTitle/index.js +26 -0
- package/es/LabelTitle/index.test.js +85 -0
- package/es/RadioConditional/__snapshots__/index.test.tsx.snap +39 -0
- package/es/RadioConditional/index.js +27 -0
- package/es/RadioConditional/index.test.js +17 -0
- package/es/RadioItem/__snapshots__/index.test.tsx.snap +20 -20
- package/es/RadioItem/index.js +4 -4
- package/es/index.js +3 -1
- package/esm/Button/index.js +4 -2
- package/esm/CheckboxConditional/__snapshots__/index.test.tsx.snap +2 -11
- package/esm/CheckboxConditional/index.js +2 -6
- package/esm/CheckboxItem/__snapshots__/index.test.tsx.snap +14 -14
- package/esm/CheckboxItem/index.js +4 -4
- package/esm/DateInputItem/__snapshots__/index.test.tsx.snap +37 -13
- package/esm/DateInputItem/index.js +7 -4
- package/esm/DateInputItem/index.test.js +9 -0
- package/esm/Field/__snapshots__/index.test.tsx.snap +35 -0
- package/esm/{FormGroup → Field}/index.js +4 -4
- package/esm/Field/index.test.js +25 -0
- package/esm/FieldsetLegend/__snapshots__/index.test.tsx.snap +102 -876
- package/esm/FieldsetLegend/index.js +9 -8
- package/esm/FieldsetLegend/index.test.js +48 -139
- package/esm/Header/index.js +1 -1
- package/esm/Label/index.js +3 -5
- package/esm/LabelTitle/__snapshots__/index.test.tsx.snap +133 -0
- package/esm/LabelTitle/index.js +26 -0
- package/esm/LabelTitle/index.test.js +85 -0
- package/esm/RadioConditional/__snapshots__/index.test.tsx.snap +39 -0
- package/esm/RadioConditional/index.js +27 -0
- package/esm/RadioConditional/index.test.js +17 -0
- package/esm/RadioItem/__snapshots__/index.test.tsx.snap +20 -20
- package/esm/RadioItem/index.js +4 -4
- package/esm/index.js +4 -2
- package/index.d.ts +3 -1
- package/index.js +23 -7
- package/package.json +2 -2
- package/FormGroup/__snapshots__/index.test.tsx.snap +0 -35
- package/FormGroup/index.d.ts +0 -13
- package/FormGroup/index.test.js +0 -31
- package/es/FormGroup/__snapshots__/index.test.tsx.snap +0 -35
- package/es/FormGroup/index.test.js +0 -25
- package/esm/FormGroup/__snapshots__/index.test.tsx.snap +0 -35
- package/esm/FormGroup/index.test.js +0 -25
package/Button/index.d.ts
CHANGED
|
@@ -13,9 +13,13 @@ export interface ButtonProps extends ButtonElementAttributes {
|
|
|
13
13
|
* disabled is optional.
|
|
14
14
|
*/
|
|
15
15
|
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* variant is optional.
|
|
18
|
+
*/
|
|
19
|
+
variant?: 'link' | 'button';
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* Use the Button component to help users carry out an action.
|
|
19
23
|
*/
|
|
20
|
-
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "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" | "form" | "type" | "value" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name"> & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "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" | "form" | "type" | "value" | "variant" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
25
|
export default Button;
|
package/Button/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["color", "disabled", "className", "children"];
|
|
18
|
+
var _excluded = ["color", "variant", "disabled", "className", "children"];
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Use the Button component to help users carry out an action.
|
|
@@ -23,6 +23,8 @@ var _excluded = ["color", "disabled", "className", "children"];
|
|
|
23
23
|
var Button = /*#__PURE__*/_react["default"].forwardRef(function Button(_ref, ref) {
|
|
24
24
|
var _ref$color = _ref.color,
|
|
25
25
|
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
26
|
+
_ref$variant = _ref.variant,
|
|
27
|
+
variant = _ref$variant === void 0 ? 'button' : _ref$variant,
|
|
26
28
|
disabled = _ref.disabled,
|
|
27
29
|
className = _ref.className,
|
|
28
30
|
children = _ref.children,
|
|
@@ -30,7 +32,7 @@ var Button = /*#__PURE__*/_react["default"].forwardRef(function Button(_ref, ref
|
|
|
30
32
|
return /*#__PURE__*/_react["default"].createElement("button", (0, _extends2["default"])({
|
|
31
33
|
disabled: disabled,
|
|
32
34
|
ref: ref,
|
|
33
|
-
className: (0, _clsx["default"])(className, color === 'secondary' && 'govgr-btn-secondary', color === 'primary' && 'govgr-btn-primary', color === 'warning' && 'govgr-btn-warning', disabled === true && 'govgr-btn-disabled',
|
|
35
|
+
className: (0, _clsx["default"])(className, variant === 'button' && [color === 'secondary' && 'govgr-btn-secondary', color === 'primary' && 'govgr-btn-primary', color === 'warning' && 'govgr-btn-warning', disabled === true && 'govgr-btn-disabled', 'govgr-btn'], variant === 'link' && 'govgr-link')
|
|
34
36
|
}, props), children);
|
|
35
37
|
});
|
|
36
38
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Change Log - @digigov/react-core
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 20 Jan 2022 10:45:21 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.4.1
|
|
6
|
+
Thu, 20 Jan 2022 10:45:21 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Add 'variant' prop to Button to enable activation of 'govgr-link' class on demand
|
|
11
|
+
- put input tag inside label tag in form react components
|
|
4
12
|
|
|
5
13
|
## 0.4.0
|
|
6
14
|
Mon, 17 Jan 2022 14:50:34 GMT
|
|
@@ -8,18 +8,13 @@ exports[`renders the Blockquote with name prop 1`] = `
|
|
|
8
8
|
className="govgr-checkboxes__conditional"
|
|
9
9
|
>
|
|
10
10
|
<div
|
|
11
|
-
className="govgr-
|
|
11
|
+
className="govgr-field"
|
|
12
12
|
>
|
|
13
13
|
<label
|
|
14
14
|
className="govgr-label"
|
|
15
15
|
>
|
|
16
16
|
hello
|
|
17
17
|
</label>
|
|
18
|
-
<input
|
|
19
|
-
className="govgr-input govgr-!-width-one-third"
|
|
20
|
-
name="some-name"
|
|
21
|
-
type="text"
|
|
22
|
-
/>
|
|
23
18
|
</div>
|
|
24
19
|
</div>
|
|
25
20
|
</ForwardRef(CheckboxConditional)>
|
|
@@ -31,17 +26,13 @@ exports[`renders the Blockquote with no props 1`] = `
|
|
|
31
26
|
className="govgr-checkboxes__conditional"
|
|
32
27
|
>
|
|
33
28
|
<div
|
|
34
|
-
className="govgr-
|
|
29
|
+
className="govgr-field"
|
|
35
30
|
>
|
|
36
31
|
<label
|
|
37
32
|
className="govgr-label"
|
|
38
33
|
>
|
|
39
34
|
hello
|
|
40
35
|
</label>
|
|
41
|
-
<input
|
|
42
|
-
className="govgr-input govgr-!-width-one-third"
|
|
43
|
-
type="text"
|
|
44
|
-
/>
|
|
45
36
|
</div>
|
|
46
37
|
</div>
|
|
47
38
|
</ForwardRef(CheckboxConditional)>
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
declare type DivElementAttributes = JSX.IntrinsicElements['div'];
|
|
3
3
|
export interface CheckboxConditionalProps extends DivElementAttributes {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Name property is optional and it contains a single value which describes the name of the <input> element.
|
|
6
6
|
*/
|
|
7
7
|
name?: string;
|
|
8
8
|
}
|
|
@@ -31,14 +31,10 @@ var CheckboxConditional = /*#__PURE__*/_react["default"].forwardRef(function Che
|
|
|
31
31
|
ref: ref,
|
|
32
32
|
className: (0, _clsx["default"])(className, true && 'govgr-checkboxes__conditional')
|
|
33
33
|
}, props), /*#__PURE__*/_react["default"].createElement("div", {
|
|
34
|
-
className: (0, _clsx["default"])(true && 'govgr-
|
|
34
|
+
className: (0, _clsx["default"])(true && 'govgr-field')
|
|
35
35
|
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
36
36
|
className: (0, _clsx["default"])(true && 'govgr-label')
|
|
37
|
-
}, children)
|
|
38
|
-
type: "text",
|
|
39
|
-
name: name,
|
|
40
|
-
className: (0, _clsx["default"])(true && 'govgr-input govgr-!-width-one-third')
|
|
41
|
-
})));
|
|
37
|
+
}, children)));
|
|
42
38
|
});
|
|
43
39
|
|
|
44
40
|
exports.CheckboxConditional = CheckboxConditional;
|
|
@@ -7,15 +7,15 @@ exports[`renders the CheckboxItem with \`name\` prop 1`] = `
|
|
|
7
7
|
<div
|
|
8
8
|
className="govgr-checkboxes__item"
|
|
9
9
|
>
|
|
10
|
-
<input
|
|
11
|
-
className="govgr-checkboxes__input"
|
|
12
|
-
name="example"
|
|
13
|
-
type="checkbox"
|
|
14
|
-
/>
|
|
15
10
|
<label
|
|
16
11
|
className="govgr-label govgr-checkboxes__label"
|
|
17
12
|
>
|
|
18
13
|
hello
|
|
14
|
+
<input
|
|
15
|
+
className="govgr-checkboxes__input"
|
|
16
|
+
name="example"
|
|
17
|
+
type="checkbox"
|
|
18
|
+
/>
|
|
19
19
|
</label>
|
|
20
20
|
</div>
|
|
21
21
|
</ForwardRef(CheckboxItem)>
|
|
@@ -28,15 +28,15 @@ exports[`renders the CheckboxItem with \`value\` prop 1`] = `
|
|
|
28
28
|
<div
|
|
29
29
|
className="govgr-checkboxes__item"
|
|
30
30
|
>
|
|
31
|
-
<input
|
|
32
|
-
className="govgr-checkboxes__input"
|
|
33
|
-
type="checkbox"
|
|
34
|
-
value="example"
|
|
35
|
-
/>
|
|
36
31
|
<label
|
|
37
32
|
className="govgr-label govgr-checkboxes__label"
|
|
38
33
|
>
|
|
39
34
|
hello
|
|
35
|
+
<input
|
|
36
|
+
className="govgr-checkboxes__input"
|
|
37
|
+
type="checkbox"
|
|
38
|
+
value="example"
|
|
39
|
+
/>
|
|
40
40
|
</label>
|
|
41
41
|
</div>
|
|
42
42
|
</ForwardRef(CheckboxItem)>
|
|
@@ -47,14 +47,14 @@ exports[`renders the CheckboxItem with no props 1`] = `
|
|
|
47
47
|
<div
|
|
48
48
|
className="govgr-checkboxes__item"
|
|
49
49
|
>
|
|
50
|
-
<input
|
|
51
|
-
className="govgr-checkboxes__input"
|
|
52
|
-
type="checkbox"
|
|
53
|
-
/>
|
|
54
50
|
<label
|
|
55
51
|
className="govgr-label govgr-checkboxes__label"
|
|
56
52
|
>
|
|
57
53
|
hello
|
|
54
|
+
<input
|
|
55
|
+
className="govgr-checkboxes__input"
|
|
56
|
+
type="checkbox"
|
|
57
|
+
/>
|
|
58
58
|
</label>
|
|
59
59
|
</div>
|
|
60
60
|
</ForwardRef(CheckboxItem)>
|
package/CheckboxItem/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
declare type DivElementAttributes = JSX.IntrinsicElements['div'];
|
|
3
3
|
export interface CheckboxItemProps extends DivElementAttributes {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Name property is optional and it contains a single value which describes the name of the <input> element.
|
|
6
6
|
*/
|
|
7
7
|
name?: string;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Value property is optional and it specifies the value of an <input> element.
|
|
10
10
|
*/
|
|
11
11
|
value?: string;
|
|
12
12
|
}
|
package/CheckboxItem/index.js
CHANGED
|
@@ -31,14 +31,14 @@ var CheckboxItem = /*#__PURE__*/_react["default"].forwardRef(function CheckboxIt
|
|
|
31
31
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
32
32
|
ref: ref,
|
|
33
33
|
className: (0, _clsx["default"])(className, true && 'govgr-checkboxes__item')
|
|
34
|
-
}, props), /*#__PURE__*/_react["default"].createElement("
|
|
34
|
+
}, props), /*#__PURE__*/_react["default"].createElement("label", {
|
|
35
|
+
className: (0, _clsx["default"])(true && 'govgr-label govgr-checkboxes__label')
|
|
36
|
+
}, children, /*#__PURE__*/_react["default"].createElement("input", {
|
|
35
37
|
type: "checkbox",
|
|
36
38
|
name: name,
|
|
37
39
|
value: value,
|
|
38
40
|
className: (0, _clsx["default"])(true && 'govgr-checkboxes__input')
|
|
39
|
-
})
|
|
40
|
-
className: (0, _clsx["default"])(true && 'govgr-label govgr-checkboxes__label')
|
|
41
|
-
}, children));
|
|
41
|
+
})));
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
exports.CheckboxItem = CheckboxItem;
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders the DateInputItem with name and width===4 props 1`] = `
|
|
4
|
+
<ForwardRef(DateInputItem)
|
|
5
|
+
name="date-input"
|
|
6
|
+
width={4}
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
className="govgr-date-input__item"
|
|
10
|
+
>
|
|
11
|
+
<label
|
|
12
|
+
className="govgr-label"
|
|
13
|
+
>
|
|
14
|
+
hello
|
|
15
|
+
<input
|
|
16
|
+
className="govgr-input--width-4 govgr-input"
|
|
17
|
+
inputMode="numeric"
|
|
18
|
+
name="date-input"
|
|
19
|
+
pattern="[0-9]*"
|
|
20
|
+
type="text"
|
|
21
|
+
/>
|
|
22
|
+
</label>
|
|
23
|
+
</div>
|
|
24
|
+
</ForwardRef(DateInputItem)>
|
|
25
|
+
`;
|
|
26
|
+
|
|
3
27
|
exports[`renders the DateInputItem with name prop 1`] = `
|
|
4
28
|
<ForwardRef(DateInputItem)
|
|
5
29
|
name="date-input"
|
|
@@ -11,14 +35,14 @@ exports[`renders the DateInputItem with name prop 1`] = `
|
|
|
11
35
|
className="govgr-label"
|
|
12
36
|
>
|
|
13
37
|
hello
|
|
38
|
+
<input
|
|
39
|
+
className="govgr-input--width-2 govgr-input"
|
|
40
|
+
inputMode="numeric"
|
|
41
|
+
name="date-input"
|
|
42
|
+
pattern="[0-9]*"
|
|
43
|
+
type="text"
|
|
44
|
+
/>
|
|
14
45
|
</label>
|
|
15
|
-
<input
|
|
16
|
-
className="govgr-input govgr-input--width-2"
|
|
17
|
-
inputMode="numeric"
|
|
18
|
-
name="date-input"
|
|
19
|
-
pattern="[0-9]*"
|
|
20
|
-
type="text"
|
|
21
|
-
/>
|
|
22
46
|
</div>
|
|
23
47
|
</ForwardRef(DateInputItem)>
|
|
24
48
|
`;
|
|
@@ -32,13 +56,13 @@ exports[`renders the DateInputItem with no props 1`] = `
|
|
|
32
56
|
className="govgr-label"
|
|
33
57
|
>
|
|
34
58
|
hello
|
|
59
|
+
<input
|
|
60
|
+
className="govgr-input--width-2 govgr-input"
|
|
61
|
+
inputMode="numeric"
|
|
62
|
+
pattern="[0-9]*"
|
|
63
|
+
type="text"
|
|
64
|
+
/>
|
|
35
65
|
</label>
|
|
36
|
-
<input
|
|
37
|
-
className="govgr-input govgr-input--width-2"
|
|
38
|
-
inputMode="numeric"
|
|
39
|
-
pattern="[0-9]*"
|
|
40
|
-
type="text"
|
|
41
|
-
/>
|
|
42
66
|
</div>
|
|
43
67
|
</ForwardRef(DateInputItem)>
|
|
44
68
|
`;
|
package/DateInputItem/index.d.ts
CHANGED
|
@@ -2,14 +2,24 @@ import React from 'react';
|
|
|
2
2
|
declare type DivElementAttributes = JSX.IntrinsicElements['div'];
|
|
3
3
|
export interface DateInputItemProps extends DivElementAttributes {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Name property is optional and it contains a single value which describes the name of the <input> element.
|
|
6
6
|
*/
|
|
7
7
|
name?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Width property is optional.
|
|
10
|
+
* Use this property for year field to grow width.
|
|
11
|
+
*/
|
|
12
|
+
width?: 2 | 4;
|
|
13
|
+
/**
|
|
14
|
+
* error is optional. The default value is false.
|
|
15
|
+
* Use this prop when there is an error at the input.
|
|
16
|
+
*/
|
|
17
|
+
error?: boolean;
|
|
8
18
|
}
|
|
9
19
|
/**
|
|
10
20
|
* Details for the DateInputItem.
|
|
11
21
|
* DateInputItem component is used for displaying date.
|
|
12
22
|
* DateInputItem component must be included inside DateInput component as children component
|
|
13
23
|
*/
|
|
14
|
-
export declare const DateInputItem: React.ForwardRefExoticComponent<Pick<DateInputItemProps, "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" | "name"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export declare const DateInputItem: React.ForwardRefExoticComponent<Pick<DateInputItemProps, "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" | "name" | "width" | "error"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
25
|
export default DateInputItem;
|
package/DateInputItem/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["name", "className", "children"];
|
|
18
|
+
var _excluded = ["name", "width", "error", "className", "children"];
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Details for the DateInputItem.
|
|
@@ -24,6 +24,9 @@ var _excluded = ["name", "className", "children"];
|
|
|
24
24
|
*/
|
|
25
25
|
var DateInputItem = /*#__PURE__*/_react["default"].forwardRef(function DateInputItem(_ref, ref) {
|
|
26
26
|
var name = _ref.name,
|
|
27
|
+
_ref$width = _ref.width,
|
|
28
|
+
width = _ref$width === void 0 ? 2 : _ref$width,
|
|
29
|
+
error = _ref.error,
|
|
27
30
|
className = _ref.className,
|
|
28
31
|
children = _ref.children,
|
|
29
32
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
@@ -32,13 +35,13 @@ var DateInputItem = /*#__PURE__*/_react["default"].forwardRef(function DateInput
|
|
|
32
35
|
className: (0, _clsx["default"])(className, true && 'govgr-date-input__item')
|
|
33
36
|
}, props), /*#__PURE__*/_react["default"].createElement("label", {
|
|
34
37
|
className: (0, _clsx["default"])(true && 'govgr-label')
|
|
35
|
-
}, children
|
|
38
|
+
}, children, /*#__PURE__*/_react["default"].createElement("input", {
|
|
36
39
|
type: "text",
|
|
37
40
|
pattern: "[0-9]*",
|
|
38
41
|
inputMode: "numeric",
|
|
39
42
|
name: name,
|
|
40
|
-
className: (0, _clsx["default"])(true &&
|
|
41
|
-
}));
|
|
43
|
+
className: (0, _clsx["default"])(error === true && 'govgr-error-input', width === 2 && 'govgr-input--width-2', width === 4 && 'govgr-input--width-4', true && 'govgr-input')
|
|
44
|
+
})));
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
exports.DateInputItem = DateInputItem;
|
|
@@ -20,4 +20,13 @@ var _ref2 = /*#__PURE__*/_react["default"].createElement(_DateInputItem["default
|
|
|
20
20
|
|
|
21
21
|
it('renders the DateInputItem with name prop', function () {
|
|
22
22
|
expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _ref3 = /*#__PURE__*/_react["default"].createElement(_DateInputItem["default"], {
|
|
26
|
+
width: 4,
|
|
27
|
+
name: 'date-input'
|
|
28
|
+
}, "hello");
|
|
29
|
+
|
|
30
|
+
it('renders the DateInputItem with name and width===4 props', function () {
|
|
31
|
+
expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
|
|
23
32
|
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the Field with error=false 1`] = `
|
|
4
|
+
<ForwardRef(Field)
|
|
5
|
+
error={false}
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="govgr-field"
|
|
9
|
+
>
|
|
10
|
+
hello
|
|
11
|
+
</div>
|
|
12
|
+
</ForwardRef(Field)>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`renders the Field with error=true 1`] = `
|
|
16
|
+
<ForwardRef(Field)
|
|
17
|
+
error={true}
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
className="govgr-field__error govgr-field"
|
|
21
|
+
>
|
|
22
|
+
hello
|
|
23
|
+
</div>
|
|
24
|
+
</ForwardRef(Field)>
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`renders the Field with no props 1`] = `
|
|
28
|
+
<ForwardRef(Field)>
|
|
29
|
+
<div
|
|
30
|
+
className="govgr-field"
|
|
31
|
+
>
|
|
32
|
+
hello
|
|
33
|
+
</div>
|
|
34
|
+
</ForwardRef(Field)>
|
|
35
|
+
`;
|
package/Field/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type DivElementAttributes = JSX.IntrinsicElements['div'];
|
|
3
|
+
export interface FieldProps extends DivElementAttributes {
|
|
4
|
+
/**
|
|
5
|
+
* error is optional.
|
|
6
|
+
*/
|
|
7
|
+
error?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Field component wraps form components such as Checkbox TextInput TextArea etc.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Field: React.ForwardRefExoticComponent<Pick<FieldProps, "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" | "error"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export default Field;
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.
|
|
8
|
+
exports["default"] = exports.Field = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -18,19 +18,19 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
18
18
|
var _excluded = ["error", "className", "children"];
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Field component wraps form components such as Checkbox TextInput TextArea etc.
|
|
22
22
|
*/
|
|
23
|
-
var
|
|
23
|
+
var Field = /*#__PURE__*/_react["default"].forwardRef(function Field(_ref, ref) {
|
|
24
24
|
var error = _ref.error,
|
|
25
25
|
className = _ref.className,
|
|
26
26
|
children = _ref.children,
|
|
27
27
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
28
28
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
29
29
|
ref: ref,
|
|
30
|
-
className: (0, _clsx["default"])(className, error === true && 'govgr-
|
|
30
|
+
className: (0, _clsx["default"])(className, error === true && 'govgr-field__error', true && 'govgr-field')
|
|
31
31
|
}, props), children);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
exports.
|
|
35
|
-
var _default =
|
|
34
|
+
exports.Field = Field;
|
|
35
|
+
var _default = Field;
|
|
36
36
|
exports["default"] = _default;
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _enzyme = require("enzyme");
|
|
8
|
+
|
|
9
|
+
var _Field = _interopRequireDefault(require("@digigov/react-core/Field"));
|
|
10
|
+
|
|
11
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_Field["default"], null, "hello");
|
|
12
|
+
|
|
13
|
+
it('renders the Field with no props', function () {
|
|
14
|
+
expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var _ref2 = /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
18
|
+
error: true
|
|
19
|
+
}, "hello");
|
|
20
|
+
|
|
21
|
+
it('renders the Field with error=true', function () {
|
|
22
|
+
expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _ref3 = /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
26
|
+
error: false
|
|
27
|
+
}, "hello");
|
|
28
|
+
|
|
29
|
+
it('renders the Field with error=false', function () {
|
|
30
|
+
expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
|
|
31
|
+
});
|