@digigov/react-core 0.3.1 → 0.5.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 +36 -1
- package/CallToAction/index.js +11 -4
- package/Card/__snapshots__/index.test.tsx.snap +21 -5
- package/Card/index.d.ts +4 -3
- package/Card/index.js +4 -3
- package/Card/index.test.js +10 -2
- 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 +5 -5
- package/CheckboxItem/index.js +6 -6
- package/Container/index.d.ts +10 -2
- package/Container/index.js +9 -5
- 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/FileUpload/index.d.ts +3 -3
- package/FileUpload/index.js +3 -3
- package/FooterImage/index.d.ts +1 -1
- package/GovGRLogo/index.js +1 -1
- package/Grid/index.d.ts +1 -1
- package/Header/index.js +1 -1
- package/HellenicRepublicLogo/index.d.ts +1 -1
- package/Hidden/index.d.ts +17 -0
- package/Hidden/index.js +47 -0
- package/Hidden/index.test.d.ts +1 -0
- package/Hidden/index.test.js +49 -0
- 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/Masthead/index.js +3 -7
- 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 +5 -5
- package/RadioItem/index.js +6 -6
- package/Select/index.d.ts +1 -1
- package/Table/index.d.ts +1 -1
- package/TextArea/index.d.ts +1 -1
- package/TextInput/index.d.ts +1 -1
- package/es/Button/index.js +4 -2
- package/es/CallToAction/index.js +11 -4
- package/es/Card/__snapshots__/index.test.tsx.snap +21 -5
- package/es/Card/index.js +4 -3
- package/es/Card/index.test.js +10 -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 +6 -6
- package/es/Container/index.js +9 -5
- 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/FileUpload/index.js +3 -3
- package/es/GovGRLogo/index.js +1 -1
- package/es/Header/index.js +1 -1
- package/es/Hidden/index.js +32 -0
- package/es/Hidden/index.test.js +43 -0
- 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/Masthead/index.js +2 -7
- 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 +6 -6
- package/es/index.js +4 -1
- package/esm/Button/index.js +4 -2
- package/esm/CallToAction/index.js +11 -4
- package/esm/Card/__snapshots__/index.test.tsx.snap +21 -5
- package/esm/Card/index.js +4 -3
- package/esm/Card/index.test.js +10 -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 +6 -6
- package/esm/Container/index.js +9 -5
- 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/FileUpload/index.js +3 -3
- package/esm/GovGRLogo/index.js +1 -1
- package/esm/Header/index.js +1 -1
- package/esm/Hidden/index.js +32 -0
- package/esm/Hidden/index.test.js +43 -0
- 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/Masthead/index.js +2 -7
- 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 +6 -6
- package/esm/index.js +5 -2
- package/index.d.ts +4 -1
- package/index.js +31 -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/Hidden/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.Hidden = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
|
+
|
|
18
|
+
var _excluded = ["className", "children", "lgUp", "mdUp", "smUp", "xlUp", "xsUp"];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Hidden is used to responsively hide children based on the screen size.
|
|
22
|
+
* Each property refers to a specific screen sizes and applies the "invisible"
|
|
23
|
+
* property at the selected screen size and above.
|
|
24
|
+
*/
|
|
25
|
+
var Hidden = /*#__PURE__*/_react["default"].forwardRef(function Hidden(_ref, ref) {
|
|
26
|
+
var className = _ref.className,
|
|
27
|
+
children = _ref.children,
|
|
28
|
+
_ref$lgUp = _ref.lgUp,
|
|
29
|
+
lgUp = _ref$lgUp === void 0 ? false : _ref$lgUp,
|
|
30
|
+
_ref$mdUp = _ref.mdUp,
|
|
31
|
+
mdUp = _ref$mdUp === void 0 ? false : _ref$mdUp,
|
|
32
|
+
_ref$smUp = _ref.smUp,
|
|
33
|
+
smUp = _ref$smUp === void 0 ? false : _ref$smUp,
|
|
34
|
+
_ref$xlUp = _ref.xlUp,
|
|
35
|
+
xlUp = _ref$xlUp === void 0 ? false : _ref$xlUp,
|
|
36
|
+
_ref$xsUp = _ref.xsUp,
|
|
37
|
+
xsUp = _ref$xsUp === void 0 ? false : _ref$xsUp,
|
|
38
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
39
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
40
|
+
ref: ref,
|
|
41
|
+
className: (0, _clsx["default"])(className, lgUp && 'govgr-lg-up', mdUp && 'govgr-md-up', smUp && 'govgr-sm-up', xlUp && 'govgr-xl-up', xsUp && 'govgr-xs-up')
|
|
42
|
+
}, props), children);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
exports.Hidden = Hidden;
|
|
46
|
+
var _default = Hidden;
|
|
47
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
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 _Hidden = _interopRequireDefault(require("@digigov/react-core/Hidden"));
|
|
10
|
+
|
|
11
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_Hidden["default"], {
|
|
12
|
+
lgUp: true
|
|
13
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "hello"));
|
|
14
|
+
|
|
15
|
+
it('renders the Hidden with `lgUp` props', function () {
|
|
16
|
+
expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _ref2 = /*#__PURE__*/_react["default"].createElement(_Hidden["default"], {
|
|
20
|
+
mdUp: true
|
|
21
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "hello"));
|
|
22
|
+
|
|
23
|
+
it('renders the Hidden with `mdUp` props', function () {
|
|
24
|
+
expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var _ref3 = /*#__PURE__*/_react["default"].createElement(_Hidden["default"], {
|
|
28
|
+
smUp: true
|
|
29
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "hello"));
|
|
30
|
+
|
|
31
|
+
it('renders the Hidden with `smUp` props', function () {
|
|
32
|
+
expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
var _ref4 = /*#__PURE__*/_react["default"].createElement(_Hidden["default"], {
|
|
36
|
+
xlUp: true
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "hello"));
|
|
38
|
+
|
|
39
|
+
it('renders the Hidden with `xlUp` props', function () {
|
|
40
|
+
expect((0, _enzyme.mount)(_ref4)).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var _ref5 = /*#__PURE__*/_react["default"].createElement(_Hidden["default"], {
|
|
44
|
+
xsUp: true
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "hello"));
|
|
46
|
+
|
|
47
|
+
it('renders the Hidden with `xsUp` props', function () {
|
|
48
|
+
expect((0, _enzyme.mount)(_ref5)).toMatchSnapshot();
|
|
49
|
+
});
|
package/Label/index.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare type LabelElementAttributes = JSX.IntrinsicElements['label'];
|
|
3
3
|
export interface LabelProps extends LabelElementAttributes {
|
|
4
|
-
/**
|
|
5
|
-
* labelFile is optional.
|
|
6
|
-
* labelFile prop is used only for upload file.
|
|
7
|
-
*/
|
|
8
|
-
labelFile?: boolean;
|
|
9
4
|
}
|
|
10
5
|
/**
|
|
11
6
|
* Label component defines a label for several elements at forms.
|
|
12
7
|
*/
|
|
13
|
-
export declare const Label: React.ForwardRefExoticComponent<Pick<LabelProps, "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" | "
|
|
8
|
+
export declare const Label: React.ForwardRefExoticComponent<Pick<LabelProps, "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" | "htmlFor"> & React.RefAttributes<HTMLLabelElement>>;
|
|
14
9
|
export default Label;
|
package/Label/index.js
CHANGED
|
@@ -15,20 +15,18 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["
|
|
18
|
+
var _excluded = ["className", "children"];
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Label component defines a label for several elements at forms.
|
|
22
22
|
*/
|
|
23
23
|
var Label = /*#__PURE__*/_react["default"].forwardRef(function Label(_ref, ref) {
|
|
24
|
-
var
|
|
25
|
-
labelFile = _ref$labelFile === void 0 ? false : _ref$labelFile,
|
|
26
|
-
className = _ref.className,
|
|
24
|
+
var className = _ref.className,
|
|
27
25
|
children = _ref.children,
|
|
28
26
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
29
27
|
return /*#__PURE__*/_react["default"].createElement("label", (0, _extends2["default"])({
|
|
30
28
|
ref: ref,
|
|
31
|
-
className: (0, _clsx["default"])(className,
|
|
29
|
+
className: (0, _clsx["default"])(className, true && 'govgr-label')
|
|
32
30
|
}, props), children);
|
|
33
31
|
});
|
|
34
32
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the Label with heading and size l props 1`] = `
|
|
4
|
+
<ForwardRef(LabelTitle)
|
|
5
|
+
heading={true}
|
|
6
|
+
size="l"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
aria-level={1}
|
|
10
|
+
className="govgr-heading-l"
|
|
11
|
+
role="heading"
|
|
12
|
+
>
|
|
13
|
+
hello
|
|
14
|
+
</span>
|
|
15
|
+
</ForwardRef(LabelTitle)>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[`renders the Label with heading and size m props 1`] = `
|
|
19
|
+
<ForwardRef(LabelTitle)
|
|
20
|
+
heading={true}
|
|
21
|
+
size="m"
|
|
22
|
+
>
|
|
23
|
+
<span
|
|
24
|
+
aria-level={1}
|
|
25
|
+
className="govgr-heading-m"
|
|
26
|
+
role="heading"
|
|
27
|
+
>
|
|
28
|
+
hello
|
|
29
|
+
</span>
|
|
30
|
+
</ForwardRef(LabelTitle)>
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`renders the Label with heading and size xl props 1`] = `
|
|
34
|
+
<ForwardRef(LabelTitle)
|
|
35
|
+
heading={true}
|
|
36
|
+
size="xl"
|
|
37
|
+
>
|
|
38
|
+
<span
|
|
39
|
+
aria-level={1}
|
|
40
|
+
className="govgr-heading-xl"
|
|
41
|
+
role="heading"
|
|
42
|
+
>
|
|
43
|
+
hello
|
|
44
|
+
</span>
|
|
45
|
+
</ForwardRef(LabelTitle)>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`renders the Label with heading and size s props 1`] = `
|
|
49
|
+
<ForwardRef(LabelTitle)
|
|
50
|
+
heading={true}
|
|
51
|
+
size="s"
|
|
52
|
+
>
|
|
53
|
+
<span
|
|
54
|
+
aria-level={1}
|
|
55
|
+
className="govgr-heading-s"
|
|
56
|
+
role="heading"
|
|
57
|
+
>
|
|
58
|
+
hello
|
|
59
|
+
</span>
|
|
60
|
+
</ForwardRef(LabelTitle)>
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
exports[`renders the Label with heading prop 1`] = `
|
|
64
|
+
<ForwardRef(LabelTitle)
|
|
65
|
+
heading={true}
|
|
66
|
+
>
|
|
67
|
+
<span
|
|
68
|
+
aria-level={1}
|
|
69
|
+
className=""
|
|
70
|
+
role="heading"
|
|
71
|
+
>
|
|
72
|
+
hello
|
|
73
|
+
</span>
|
|
74
|
+
</ForwardRef(LabelTitle)>
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
exports[`renders the Label with size l prop 1`] = `
|
|
78
|
+
<ForwardRef(LabelTitle)
|
|
79
|
+
size="l"
|
|
80
|
+
>
|
|
81
|
+
<span
|
|
82
|
+
className="govgr-heading-l"
|
|
83
|
+
>
|
|
84
|
+
hello
|
|
85
|
+
</span>
|
|
86
|
+
</ForwardRef(LabelTitle)>
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
exports[`renders the Label with size m prop 1`] = `
|
|
90
|
+
<ForwardRef(LabelTitle)
|
|
91
|
+
size="m"
|
|
92
|
+
>
|
|
93
|
+
<span
|
|
94
|
+
className="govgr-heading-m"
|
|
95
|
+
>
|
|
96
|
+
hello
|
|
97
|
+
</span>
|
|
98
|
+
</ForwardRef(LabelTitle)>
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
exports[`renders the Label with size s prop 1`] = `
|
|
102
|
+
<ForwardRef(LabelTitle)
|
|
103
|
+
size="s"
|
|
104
|
+
>
|
|
105
|
+
<span
|
|
106
|
+
className="govgr-heading-s"
|
|
107
|
+
>
|
|
108
|
+
hello
|
|
109
|
+
</span>
|
|
110
|
+
</ForwardRef(LabelTitle)>
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
exports[`renders the Label with size xl prop 1`] = `
|
|
114
|
+
<ForwardRef(LabelTitle)
|
|
115
|
+
size="xl"
|
|
116
|
+
>
|
|
117
|
+
<span
|
|
118
|
+
className="govgr-heading-xl"
|
|
119
|
+
>
|
|
120
|
+
hello
|
|
121
|
+
</span>
|
|
122
|
+
</ForwardRef(LabelTitle)>
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
exports[`renders the LabelTitle with no props 1`] = `
|
|
126
|
+
<ForwardRef(LabelTitle)>
|
|
127
|
+
<span
|
|
128
|
+
className=""
|
|
129
|
+
>
|
|
130
|
+
hello
|
|
131
|
+
</span>
|
|
132
|
+
</ForwardRef(LabelTitle)>
|
|
133
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type SpanElementAttributes = JSX.IntrinsicElements['span'];
|
|
3
|
+
export interface LabelFieldProps extends SpanElementAttributes {
|
|
4
|
+
/**
|
|
5
|
+
* size is optional. The default value is 'l'
|
|
6
|
+
*/
|
|
7
|
+
size?: 'xl' | 'l' | 'm' | 's';
|
|
8
|
+
/**
|
|
9
|
+
* heading is optional.
|
|
10
|
+
* Add this prop if this Field component is the only one in this page.
|
|
11
|
+
* The default value is false.
|
|
12
|
+
*/
|
|
13
|
+
heading?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Label component defines a label for several elements at forms.
|
|
17
|
+
*/
|
|
18
|
+
export declare const LabelTitle: React.ForwardRefExoticComponent<Pick<LabelFieldProps, "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" | "heading" | "size"> & React.RefAttributes<HTMLSpanElement>>;
|
|
19
|
+
export default LabelTitle;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.LabelTitle = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
|
+
|
|
18
|
+
var _excluded = ["size", "className", "heading", "children"];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Label component defines a label for several elements at forms.
|
|
22
|
+
*/
|
|
23
|
+
var LabelTitle = /*#__PURE__*/_react["default"].forwardRef(function LabelTitle(_ref, ref) {
|
|
24
|
+
var size = _ref.size,
|
|
25
|
+
className = _ref.className,
|
|
26
|
+
_ref$heading = _ref.heading,
|
|
27
|
+
heading = _ref$heading === void 0 ? false : _ref$heading,
|
|
28
|
+
children = _ref.children,
|
|
29
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement("span", (0, _extends2["default"])({
|
|
31
|
+
ref: ref,
|
|
32
|
+
className: (0, _clsx["default"])(className, size === 'xl' && 'govgr-heading-xl', size === 'l' && 'govgr-heading-l', size === 'm' && 'govgr-heading-m', size === 's' && 'govgr-heading-s')
|
|
33
|
+
}, heading && {
|
|
34
|
+
role: "heading",
|
|
35
|
+
"aria-level": 1
|
|
36
|
+
}, props), children);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.LabelTitle = LabelTitle;
|
|
40
|
+
var _default = LabelTitle;
|
|
41
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
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 _LabelTitle = _interopRequireDefault(require("@digigov/react-core/LabelTitle"));
|
|
10
|
+
|
|
11
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], null, "hello");
|
|
12
|
+
|
|
13
|
+
it('renders the LabelTitle with no props', function () {
|
|
14
|
+
expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var _ref2 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
18
|
+
heading: true
|
|
19
|
+
}, "hello");
|
|
20
|
+
|
|
21
|
+
it('renders the Label with heading prop', function () {
|
|
22
|
+
expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _ref3 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
26
|
+
size: "s"
|
|
27
|
+
}, "hello");
|
|
28
|
+
|
|
29
|
+
it('renders the Label with size s prop', function () {
|
|
30
|
+
expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _ref4 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
34
|
+
size: "m"
|
|
35
|
+
}, "hello");
|
|
36
|
+
|
|
37
|
+
it('renders the Label with size m prop', function () {
|
|
38
|
+
expect((0, _enzyme.mount)(_ref4)).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
var _ref5 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
42
|
+
size: "l"
|
|
43
|
+
}, "hello");
|
|
44
|
+
|
|
45
|
+
it('renders the Label with size l prop', function () {
|
|
46
|
+
expect((0, _enzyme.mount)(_ref5)).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
var _ref6 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
50
|
+
size: "xl"
|
|
51
|
+
}, "hello");
|
|
52
|
+
|
|
53
|
+
it('renders the Label with size xl prop', function () {
|
|
54
|
+
expect((0, _enzyme.mount)(_ref6)).toMatchSnapshot();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
var _ref7 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
58
|
+
heading: true,
|
|
59
|
+
size: "s"
|
|
60
|
+
}, "hello");
|
|
61
|
+
|
|
62
|
+
it('renders the Label with heading and size s props', function () {
|
|
63
|
+
expect((0, _enzyme.mount)(_ref7)).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
var _ref8 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
67
|
+
heading: true,
|
|
68
|
+
size: "m"
|
|
69
|
+
}, "hello");
|
|
70
|
+
|
|
71
|
+
it('renders the Label with heading and size m props', function () {
|
|
72
|
+
expect((0, _enzyme.mount)(_ref8)).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
var _ref9 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
76
|
+
heading: true,
|
|
77
|
+
size: "l"
|
|
78
|
+
}, "hello");
|
|
79
|
+
|
|
80
|
+
it('renders the Label with heading and size l props', function () {
|
|
81
|
+
expect((0, _enzyme.mount)(_ref9)).toMatchSnapshot();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var _ref10 = /*#__PURE__*/_react["default"].createElement(_LabelTitle["default"], {
|
|
85
|
+
heading: true,
|
|
86
|
+
size: "xl"
|
|
87
|
+
}, "hello");
|
|
88
|
+
|
|
89
|
+
it('renders the Label with heading and size xl props', function () {
|
|
90
|
+
expect((0, _enzyme.mount)(_ref10)).toMatchSnapshot();
|
|
91
|
+
});
|
package/Masthead/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
17
|
|
|
18
|
+
var _Container = _interopRequireDefault(require("@digigov/react-core/Container"));
|
|
19
|
+
|
|
18
20
|
var _excluded = ["className", "children"];
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -27,13 +29,7 @@ var Masthead = /*#__PURE__*/_react["default"].forwardRef(function Masthead(_ref,
|
|
|
27
29
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
28
30
|
ref: ref,
|
|
29
31
|
className: (0, _clsx["default"])(className, true && ['govgr-masthead', 'govgr-background-dark'])
|
|
30
|
-
}, props), /*#__PURE__*/_react["default"].createElement("
|
|
31
|
-
ref: ref,
|
|
32
|
-
className: (0, _clsx["default"])(true && 'govgr-width-container')
|
|
33
|
-
}, props), /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
34
|
-
ref: ref,
|
|
35
|
-
className: (0, _clsx["default"])(true && 'govgr-main-wrapper')
|
|
36
|
-
}, props), children)));
|
|
32
|
+
}, props), /*#__PURE__*/_react["default"].createElement(_Container["default"], null, children));
|
|
37
33
|
});
|
|
38
34
|
|
|
39
35
|
exports.Masthead = Masthead;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the Blockquote with name prop 1`] = `
|
|
4
|
+
<ForwardRef(RadioConditional)
|
|
5
|
+
name="some-name"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="govgr-radios__conditional"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
className="govgr-field"
|
|
12
|
+
>
|
|
13
|
+
<label
|
|
14
|
+
className="govgr-label"
|
|
15
|
+
>
|
|
16
|
+
hello
|
|
17
|
+
</label>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</ForwardRef(RadioConditional)>
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
exports[`renders the Blockquote with no props 1`] = `
|
|
24
|
+
<ForwardRef(RadioConditional)>
|
|
25
|
+
<div
|
|
26
|
+
className="govgr-radios__conditional"
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
className="govgr-field"
|
|
30
|
+
>
|
|
31
|
+
<label
|
|
32
|
+
className="govgr-label"
|
|
33
|
+
>
|
|
34
|
+
hello
|
|
35
|
+
</label>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</ForwardRef(RadioConditional)>
|
|
39
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type DivElementAttributes = JSX.IntrinsicElements['div'];
|
|
3
|
+
export interface RadioConditionalProps extends DivElementAttributes {
|
|
4
|
+
/**
|
|
5
|
+
* Name property is optional and it contains a single value which describes the name of the <input> element.
|
|
6
|
+
*/
|
|
7
|
+
name?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* RadioConditional asks the user a related question when they select a particular radios,
|
|
11
|
+
* so they only see the question when it’s relevant to them.
|
|
12
|
+
* RadioConditional must be used inside Radio component
|
|
13
|
+
*/
|
|
14
|
+
export declare const RadioConditional: React.ForwardRefExoticComponent<Pick<RadioConditionalProps, "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>>;
|
|
15
|
+
export default RadioConditional;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.RadioConditional = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
|
+
|
|
18
|
+
var _excluded = ["name", "className", "children"];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* RadioConditional asks the user a related question when they select a particular radios,
|
|
22
|
+
* so they only see the question when it’s relevant to them.
|
|
23
|
+
* RadioConditional must be used inside Radio component
|
|
24
|
+
*/
|
|
25
|
+
var RadioConditional = /*#__PURE__*/_react["default"].forwardRef(function RadioConditional(_ref, ref) {
|
|
26
|
+
var name = _ref.name,
|
|
27
|
+
className = _ref.className,
|
|
28
|
+
children = _ref.children,
|
|
29
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
31
|
+
ref: ref,
|
|
32
|
+
className: (0, _clsx["default"])(className, true && 'govgr-radios__conditional')
|
|
33
|
+
}, props), /*#__PURE__*/_react["default"].createElement("div", {
|
|
34
|
+
className: (0, _clsx["default"])(true && 'govgr-field')
|
|
35
|
+
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
36
|
+
className: (0, _clsx["default"])(true && 'govgr-label')
|
|
37
|
+
}, children)));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
exports.RadioConditional = RadioConditional;
|
|
41
|
+
var _default = RadioConditional;
|
|
42
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 _RadioConditional = _interopRequireDefault(require("@digigov/react-core/RadioConditional"));
|
|
10
|
+
|
|
11
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_RadioConditional["default"], null, "hello");
|
|
12
|
+
|
|
13
|
+
it('renders the Blockquote with no props', function () {
|
|
14
|
+
expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var _ref2 = /*#__PURE__*/_react["default"].createElement(_RadioConditional["default"], {
|
|
18
|
+
name: 'some-name'
|
|
19
|
+
}, "hello");
|
|
20
|
+
|
|
21
|
+
it('renders the Blockquote with name prop', function () {
|
|
22
|
+
expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
|
|
23
|
+
});
|