@digigov/react-core 0.6.1 → 0.6.4
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/ArrowIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/ArrowIcon/index.d.ts +4 -3
- package/ArrowIcon/index.js +13 -27
- package/BurgerIcon/__snapshots__/index.test.tsx.snap +323 -126
- package/BurgerIcon/index.d.ts +13 -7
- package/BurgerIcon/index.js +13 -33
- package/BurgerIcon/index.test.js +47 -5
- package/Button/index.d.ts +1 -1
- package/CHANGELOG.md +23 -1
- package/CaretIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/CaretIcon/index.d.ts +4 -3
- package/CaretIcon/index.js +13 -27
- package/CheckIcon/__snapshots__/index.test.tsx.snap +196 -136
- package/CheckIcon/index.d.ts +7 -11
- package/CheckIcon/index.js +10 -34
- package/CheckboxItem/index.d.ts +1 -1
- package/CloseIcon/__snapshots__/index.test.tsx.snap +12 -8
- package/CloseIcon/index.d.ts +9 -3
- package/CloseIcon/index.js +10 -7
- package/DateInputItem/index.d.ts +1 -1
- package/Dropdown/__snapshots__/index.test.tsx.snap +144 -0
- package/Dropdown/index.d.ts +30 -0
- package/Dropdown/index.js +42 -0
- package/Dropdown/index.test.d.ts +1 -0
- package/Dropdown/index.test.js +101 -0
- package/DropdownButton/__snapshots__/index.test.tsx.snap +375 -0
- package/DropdownButton/index.d.ts +28 -0
- package/DropdownButton/index.js +47 -0
- package/DropdownButton/index.test.d.ts +1 -0
- package/DropdownButton/index.test.js +195 -0
- package/DropdownContent/__snapshots__/index.test.tsx.snap +11 -0
- package/DropdownContent/index.d.ts +9 -0
- package/DropdownContent/index.js +35 -0
- package/DropdownContent/index.test.d.ts +1 -0
- package/DropdownContent/index.test.js +15 -0
- package/FieldsetLegend/index.d.ts +1 -1
- package/FileUpload/index.d.ts +1 -1
- package/Grid/index.d.ts +1 -1
- package/LabelTitle/index.d.ts +1 -1
- package/MoreVertIcon/__snapshots__/index.test.tsx.snap +391 -315
- package/MoreVertIcon/index.d.ts +7 -11
- package/MoreVertIcon/index.js +10 -34
- package/NormalText/index.d.ts +1 -1
- package/Paragraph/index.d.ts +1 -1
- package/RadioItem/index.d.ts +1 -1
- package/Select/index.d.ts +1 -1
- package/SvgIcon/__snapshots__/index.test.tsx.snap +224 -0
- package/SvgIcon/index.d.ts +20 -0
- package/SvgIcon/index.js +41 -0
- package/SvgIcon/index.test.d.ts +1 -0
- package/SvgIcon/index.test.js +129 -0
- package/Table/index.d.ts +1 -1
- package/TableDataCell/index.d.ts +1 -1
- package/TableHeaderCell/index.d.ts +1 -1
- package/TextArea/index.d.ts +1 -1
- package/TextInput/index.d.ts +1 -1
- package/UncheckIcon/__snapshots__/index.test.tsx.snap +241 -165
- package/UncheckIcon/index.d.ts +9 -13
- package/UncheckIcon/index.js +15 -39
- package/es/ArrowIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/es/ArrowIcon/index.js +12 -19
- package/es/BurgerIcon/__snapshots__/index.test.tsx.snap +323 -126
- package/es/BurgerIcon/index.js +12 -25
- package/es/BurgerIcon/index.test.js +47 -5
- package/es/CaretIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/es/CaretIcon/index.js +12 -19
- package/es/CheckIcon/__snapshots__/index.test.tsx.snap +196 -136
- package/es/CheckIcon/index.js +9 -26
- package/es/CloseIcon/__snapshots__/index.test.tsx.snap +12 -8
- package/es/CloseIcon/index.js +9 -7
- package/es/Dropdown/__snapshots__/index.test.tsx.snap +144 -0
- package/es/Dropdown/index.js +27 -0
- package/es/Dropdown/index.test.js +95 -0
- package/es/DropdownButton/__snapshots__/index.test.tsx.snap +375 -0
- package/es/DropdownButton/index.js +31 -0
- package/es/DropdownButton/index.test.js +189 -0
- package/es/DropdownContent/__snapshots__/index.test.tsx.snap +11 -0
- package/es/DropdownContent/index.js +20 -0
- package/es/DropdownContent/index.test.js +9 -0
- package/es/MoreVertIcon/__snapshots__/index.test.tsx.snap +391 -315
- package/es/MoreVertIcon/index.js +9 -26
- package/es/SvgIcon/__snapshots__/index.test.tsx.snap +224 -0
- package/es/SvgIcon/index.js +26 -0
- package/es/SvgIcon/index.test.js +123 -0
- package/es/UncheckIcon/__snapshots__/index.test.tsx.snap +241 -165
- package/es/UncheckIcon/index.js +12 -29
- package/es/index.js +4 -0
- package/esm/ArrowIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/esm/ArrowIcon/index.js +12 -19
- package/esm/BurgerIcon/__snapshots__/index.test.tsx.snap +323 -126
- package/esm/BurgerIcon/index.js +12 -25
- package/esm/BurgerIcon/index.test.js +47 -5
- package/esm/CaretIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/esm/CaretIcon/index.js +12 -19
- package/esm/CheckIcon/__snapshots__/index.test.tsx.snap +196 -136
- package/esm/CheckIcon/index.js +9 -26
- package/esm/CloseIcon/__snapshots__/index.test.tsx.snap +12 -8
- package/esm/CloseIcon/index.js +9 -7
- package/esm/Dropdown/__snapshots__/index.test.tsx.snap +144 -0
- package/esm/Dropdown/index.js +27 -0
- package/esm/Dropdown/index.test.js +95 -0
- package/esm/DropdownButton/__snapshots__/index.test.tsx.snap +375 -0
- package/esm/DropdownButton/index.js +31 -0
- package/esm/DropdownButton/index.test.js +189 -0
- package/esm/DropdownContent/__snapshots__/index.test.tsx.snap +11 -0
- package/esm/DropdownContent/index.js +20 -0
- package/esm/DropdownContent/index.test.js +9 -0
- package/esm/MoreVertIcon/__snapshots__/index.test.tsx.snap +391 -315
- package/esm/MoreVertIcon/index.js +9 -26
- package/esm/SvgIcon/__snapshots__/index.test.tsx.snap +224 -0
- package/esm/SvgIcon/index.js +26 -0
- package/esm/SvgIcon/index.test.js +123 -0
- package/esm/UncheckIcon/__snapshots__/index.test.tsx.snap +241 -165
- package/esm/UncheckIcon/index.js +12 -29
- package/esm/index.js +5 -1
- package/index.d.ts +4 -0
- package/index.js +32 -0
- package/package.json +2 -2
package/CloseIcon/index.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface CloseIconProps extends
|
|
2
|
+
import { SvgIconProps } from '@digigov/react-core/SvgIcon';
|
|
3
|
+
export interface CloseIconProps extends SvgIconProps {
|
|
4
|
+
/**
|
|
5
|
+
* ref is optional.
|
|
6
|
+
* ref prop declares the reference of the svg icon component.
|
|
7
|
+
* It can be used to to access the DOM element and the React element.
|
|
8
|
+
*/
|
|
9
|
+
ref?: React.Ref<SVGSVGElement>;
|
|
4
10
|
}
|
|
5
11
|
/**
|
|
6
12
|
* CloseIcon component is used to add close icon.
|
|
7
13
|
* CloseIcon component can be used for dismissing contents
|
|
8
14
|
*/
|
|
9
|
-
export declare const CloseIcon: React.
|
|
15
|
+
export declare const CloseIcon: React.FC<CloseIconProps>;
|
|
10
16
|
export default CloseIcon;
|
package/CloseIcon/index.js
CHANGED
|
@@ -13,9 +13,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
+
var _SvgIcon = _interopRequireDefault(require("@digigov/react-core/SvgIcon"));
|
|
17
|
+
|
|
16
18
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
19
|
|
|
18
|
-
var _excluded = ["className"];
|
|
20
|
+
var _excluded = ["size", "variant", "className"];
|
|
19
21
|
|
|
20
22
|
var _ref2 = /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
21
23
|
points: "14.4,11.8 22,4.2 19.7,1.8 12,9.4 4.4,1.8 2,4.2 9.7,11.9 2.1,19.5 4.4,21.9 12.1,14.3 19.7,21.9 22.1,19.5 "
|
|
@@ -26,14 +28,15 @@ var _ref2 = /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
|
26
28
|
* CloseIcon component can be used for dismissing contents
|
|
27
29
|
*/
|
|
28
30
|
var CloseIcon = /*#__PURE__*/_react["default"].forwardRef(function CloseIcon(_ref, ref) {
|
|
29
|
-
var
|
|
31
|
+
var size = _ref.size,
|
|
32
|
+
variant = _ref.variant,
|
|
33
|
+
className = _ref.className,
|
|
30
34
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
31
|
-
return /*#__PURE__*/_react["default"].createElement("
|
|
32
|
-
|
|
35
|
+
return /*#__PURE__*/_react["default"].createElement(_SvgIcon["default"], (0, _extends2["default"])({
|
|
36
|
+
size: size,
|
|
37
|
+
variant: variant,
|
|
33
38
|
className: (0, _clsx["default"])(className && className, true && 'govgr-close-icon'),
|
|
34
|
-
|
|
35
|
-
viewBox: "0 0 24 24",
|
|
36
|
-
"aria-hidden": "true"
|
|
39
|
+
ref: ref
|
|
37
40
|
}, props), _ref2);
|
|
38
41
|
});
|
|
39
42
|
|
package/DateInputItem/index.d.ts
CHANGED
|
@@ -21,5 +21,5 @@ export interface DateInputItemProps extends DivElementAttributes {
|
|
|
21
21
|
* DateInputItem component is used for displaying date.
|
|
22
22
|
* DateInputItem component must be included inside DateInput component as children component
|
|
23
23
|
*/
|
|
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" | "form" | "pattern" | "list" | "step" | "height" | "max" | "min" | "name" | "type" | "width" | "crossOrigin" | "value" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "
|
|
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" | "form" | "pattern" | "list" | "step" | "error" | "size" | "height" | "max" | "min" | "name" | "type" | "width" | "crossOrigin" | "value" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "src"> & React.RefAttributes<HTMLInputElement>>;
|
|
25
25
|
export default DateInputItem;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the Dropdown disabled 1`] = `
|
|
4
|
+
<ForwardRef(Dropdown)
|
|
5
|
+
disabled={true}
|
|
6
|
+
>
|
|
7
|
+
<details
|
|
8
|
+
className="govgr-dropdown--disabled govgr-dropdown"
|
|
9
|
+
>
|
|
10
|
+
hello
|
|
11
|
+
</details>
|
|
12
|
+
</ForwardRef(Dropdown)>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`renders the Dropdown with align=left 1`] = `
|
|
16
|
+
<ForwardRef(Dropdown)
|
|
17
|
+
align="left"
|
|
18
|
+
>
|
|
19
|
+
<details
|
|
20
|
+
className="govgr-dropdown--left govgr-dropdown"
|
|
21
|
+
>
|
|
22
|
+
hello
|
|
23
|
+
</details>
|
|
24
|
+
</ForwardRef(Dropdown)>
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`renders the Dropdown with align=left and open=true 1`] = `
|
|
28
|
+
<ForwardRef(Dropdown)
|
|
29
|
+
align="left"
|
|
30
|
+
open={true}
|
|
31
|
+
>
|
|
32
|
+
<details
|
|
33
|
+
className="govgr-dropdown--left govgr-dropdown"
|
|
34
|
+
open={true}
|
|
35
|
+
>
|
|
36
|
+
hello
|
|
37
|
+
</details>
|
|
38
|
+
</ForwardRef(Dropdown)>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`renders the Dropdown with align=right and open=false 1`] = `
|
|
42
|
+
<ForwardRef(Dropdown)
|
|
43
|
+
align="right"
|
|
44
|
+
open={false}
|
|
45
|
+
>
|
|
46
|
+
<details
|
|
47
|
+
className="govgr-dropdown"
|
|
48
|
+
open={false}
|
|
49
|
+
>
|
|
50
|
+
hello
|
|
51
|
+
</details>
|
|
52
|
+
</ForwardRef(Dropdown)>
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
exports[`renders the Dropdown with no props 1`] = `
|
|
56
|
+
<ForwardRef(Dropdown)>
|
|
57
|
+
<details
|
|
58
|
+
className="govgr-dropdown"
|
|
59
|
+
>
|
|
60
|
+
hello
|
|
61
|
+
</details>
|
|
62
|
+
</ForwardRef(Dropdown)>
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
exports[`renders the Dropdown with open=false 1`] = `
|
|
66
|
+
<ForwardRef(Dropdown)
|
|
67
|
+
open={false}
|
|
68
|
+
>
|
|
69
|
+
<details
|
|
70
|
+
className="govgr-dropdown"
|
|
71
|
+
open={false}
|
|
72
|
+
>
|
|
73
|
+
hello
|
|
74
|
+
</details>
|
|
75
|
+
</ForwardRef(Dropdown)>
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
exports[`renders the Dropdown with open=true 1`] = `
|
|
79
|
+
<ForwardRef(Dropdown)
|
|
80
|
+
open={true}
|
|
81
|
+
>
|
|
82
|
+
<details
|
|
83
|
+
className="govgr-dropdown"
|
|
84
|
+
open={true}
|
|
85
|
+
>
|
|
86
|
+
hello
|
|
87
|
+
</details>
|
|
88
|
+
</ForwardRef(Dropdown)>
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
exports[`renders the Dropdown with placement=bottom and open=false 1`] = `
|
|
92
|
+
<ForwardRef(Dropdown)
|
|
93
|
+
open={false}
|
|
94
|
+
placement="bottom"
|
|
95
|
+
>
|
|
96
|
+
<details
|
|
97
|
+
className="govgr-dropdown"
|
|
98
|
+
open={false}
|
|
99
|
+
>
|
|
100
|
+
hello
|
|
101
|
+
</details>
|
|
102
|
+
</ForwardRef(Dropdown)>
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
exports[`renders the Dropdown with placement=top 1`] = `
|
|
106
|
+
<ForwardRef(Dropdown)
|
|
107
|
+
placement="top"
|
|
108
|
+
>
|
|
109
|
+
<details
|
|
110
|
+
className="govgr-dropdown--up govgr-dropdown"
|
|
111
|
+
>
|
|
112
|
+
hello
|
|
113
|
+
</details>
|
|
114
|
+
</ForwardRef(Dropdown)>
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
exports[`renders the Dropdown with placement=top align=left and open=true 1`] = `
|
|
118
|
+
<ForwardRef(Dropdown)
|
|
119
|
+
align="left"
|
|
120
|
+
open={true}
|
|
121
|
+
placement="top"
|
|
122
|
+
>
|
|
123
|
+
<details
|
|
124
|
+
className="govgr-dropdown--up govgr-dropdown--left govgr-dropdown"
|
|
125
|
+
open={true}
|
|
126
|
+
>
|
|
127
|
+
hello
|
|
128
|
+
</details>
|
|
129
|
+
</ForwardRef(Dropdown)>
|
|
130
|
+
`;
|
|
131
|
+
|
|
132
|
+
exports[`renders the Dropdown with placement=top and open=true 1`] = `
|
|
133
|
+
<ForwardRef(Dropdown)
|
|
134
|
+
open={true}
|
|
135
|
+
placement="top"
|
|
136
|
+
>
|
|
137
|
+
<details
|
|
138
|
+
className="govgr-dropdown--up govgr-dropdown"
|
|
139
|
+
open={true}
|
|
140
|
+
>
|
|
141
|
+
hello
|
|
142
|
+
</details>
|
|
143
|
+
</ForwardRef(Dropdown)>
|
|
144
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type DetailsHTMLAttributes = JSX.IntrinsicElements['details'];
|
|
3
|
+
export interface DropdownProps extends DetailsHTMLAttributes {
|
|
4
|
+
/**
|
|
5
|
+
* open is optional. The default value is false.
|
|
6
|
+
* Add this prop when an Dropdown should be open.
|
|
7
|
+
*/
|
|
8
|
+
open?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* align is optional. The default value is right.
|
|
11
|
+
* align prop adds DropdownContent right or left.
|
|
12
|
+
*/
|
|
13
|
+
align?: 'right' | 'left';
|
|
14
|
+
/**
|
|
15
|
+
* placement is optional. The default value is bottom.
|
|
16
|
+
* placement prop adds DropdownContent top or bottom.
|
|
17
|
+
*/
|
|
18
|
+
placement?: 'top' | 'bottom';
|
|
19
|
+
/**
|
|
20
|
+
* disabled is optional. The default value is false.
|
|
21
|
+
* disabled prop diables any action for Dropdown component.
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Dropdown is the main component for a dropdown.
|
|
27
|
+
* Inside this component must be DropdownButton and DropdownContent components.
|
|
28
|
+
*/
|
|
29
|
+
export declare const Dropdown: React.ForwardRefExoticComponent<Pick<DropdownProps, "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" | "open" | "disabled" | "onToggle" | "align" | "placement"> & React.RefAttributes<HTMLDetailsElement>>;
|
|
30
|
+
export default Dropdown;
|
|
@@ -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.Dropdown = 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", "align", "placement", "open", "disabled"];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Dropdown is the main component for a dropdown.
|
|
22
|
+
* Inside this component must be DropdownButton and DropdownContent components.
|
|
23
|
+
*/
|
|
24
|
+
// eslint-disable-next-line react/display-name
|
|
25
|
+
var Dropdown = /*#__PURE__*/_react["default"].forwardRef(function Dropdown(_ref, ref) {
|
|
26
|
+
var className = _ref.className,
|
|
27
|
+
children = _ref.children,
|
|
28
|
+
align = _ref.align,
|
|
29
|
+
placement = _ref.placement,
|
|
30
|
+
open = _ref.open,
|
|
31
|
+
disabled = _ref.disabled,
|
|
32
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement("details", (0, _extends2["default"])({
|
|
34
|
+
ref: ref,
|
|
35
|
+
open: open,
|
|
36
|
+
className: (0, _clsx["default"])(className, placement === 'top' && 'govgr-dropdown--up', disabled === true && 'govgr-dropdown--disabled', align === 'left' && 'govgr-dropdown--left', true && 'govgr-dropdown')
|
|
37
|
+
}, props), children);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
exports.Dropdown = Dropdown;
|
|
41
|
+
var _default = Dropdown;
|
|
42
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
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 _Dropdown = _interopRequireDefault(require("@digigov/react-core/Dropdown"));
|
|
10
|
+
|
|
11
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], null, "hello");
|
|
12
|
+
|
|
13
|
+
it('renders the Dropdown with no props', function () {
|
|
14
|
+
expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var _ref2 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
18
|
+
disabled: true
|
|
19
|
+
}, "hello");
|
|
20
|
+
|
|
21
|
+
it('renders the Dropdown disabled', function () {
|
|
22
|
+
expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _ref3 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
26
|
+
open: true
|
|
27
|
+
}, "hello");
|
|
28
|
+
|
|
29
|
+
it('renders the Dropdown with open=true', function () {
|
|
30
|
+
expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _ref4 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
34
|
+
open: false
|
|
35
|
+
}, "hello");
|
|
36
|
+
|
|
37
|
+
it('renders the Dropdown with open=false', function () {
|
|
38
|
+
expect((0, _enzyme.mount)(_ref4)).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
var _ref5 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
42
|
+
align: "left"
|
|
43
|
+
}, "hello");
|
|
44
|
+
|
|
45
|
+
it('renders the Dropdown with align=left', function () {
|
|
46
|
+
expect((0, _enzyme.mount)(_ref5)).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
var _ref6 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
50
|
+
placement: "top"
|
|
51
|
+
}, "hello");
|
|
52
|
+
|
|
53
|
+
it('renders the Dropdown with placement=top', function () {
|
|
54
|
+
expect((0, _enzyme.mount)(_ref6)).toMatchSnapshot();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
var _ref7 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
58
|
+
open: true,
|
|
59
|
+
align: "left"
|
|
60
|
+
}, "hello");
|
|
61
|
+
|
|
62
|
+
it('renders the Dropdown with align=left and open=true', function () {
|
|
63
|
+
expect((0, _enzyme.mount)(_ref7)).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
var _ref8 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
67
|
+
open: false,
|
|
68
|
+
align: "right"
|
|
69
|
+
}, "hello");
|
|
70
|
+
|
|
71
|
+
it('renders the Dropdown with align=right and open=false', function () {
|
|
72
|
+
expect((0, _enzyme.mount)(_ref8)).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
var _ref9 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
76
|
+
open: true,
|
|
77
|
+
placement: "top"
|
|
78
|
+
}, "hello");
|
|
79
|
+
|
|
80
|
+
it('renders the Dropdown with placement=top and open=true', function () {
|
|
81
|
+
expect((0, _enzyme.mount)(_ref9)).toMatchSnapshot();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var _ref10 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
85
|
+
open: false,
|
|
86
|
+
placement: "bottom"
|
|
87
|
+
}, "hello");
|
|
88
|
+
|
|
89
|
+
it('renders the Dropdown with placement=bottom and open=false', function () {
|
|
90
|
+
expect((0, _enzyme.mount)(_ref10)).toMatchSnapshot();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
var _ref11 = /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
94
|
+
open: true,
|
|
95
|
+
placement: "top",
|
|
96
|
+
align: "left"
|
|
97
|
+
}, "hello");
|
|
98
|
+
|
|
99
|
+
it('renders the Dropdown with placement=top align=left and open=true', function () {
|
|
100
|
+
expect((0, _enzyme.mount)(_ref11)).toMatchSnapshot();
|
|
101
|
+
});
|