@digigov/react-experimental 1.1.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/FloatingButton/index.d.ts +21 -0
  3. package/FloatingButton/index.js +24 -0
  4. package/FloatingButton/index.test/index.js +19 -0
  5. package/FloatingButton/index.test/package.json +6 -0
  6. package/FloatingButton/index.test.d.ts +1 -0
  7. package/FloatingButton/package.json +6 -0
  8. package/LICENSE +0 -0
  9. package/OptionButtonBase/index.d.ts +19 -0
  10. package/OptionButtonBase/index.js +24 -0
  11. package/OptionButtonBase/index.test/index.js +19 -0
  12. package/OptionButtonBase/index.test/package.json +6 -0
  13. package/OptionButtonBase/index.test.d.ts +1 -0
  14. package/OptionButtonBase/package.json +6 -0
  15. package/OptionButtonSteps/index.d.ts +25 -0
  16. package/OptionButtonSteps/index.js +31 -0
  17. package/OptionButtonSteps/index.test/index.js +32 -0
  18. package/OptionButtonSteps/index.test/package.json +6 -0
  19. package/OptionButtonSteps/index.test.d.ts +1 -0
  20. package/OptionButtonSteps/package.json +6 -0
  21. package/README.md +0 -0
  22. package/cjs/FloatingButton/index.js +31 -0
  23. package/cjs/FloatingButton/index.test/index.js +22 -0
  24. package/cjs/OptionButtonBase/index.js +31 -0
  25. package/cjs/OptionButtonBase/index.test/index.js +22 -0
  26. package/cjs/OptionButtonSteps/index.js +38 -0
  27. package/cjs/OptionButtonSteps/index.test/index.js +35 -0
  28. package/cjs/index.js +38 -0
  29. package/index.d.ts +3 -0
  30. package/index.js +8 -0
  31. package/package.json +22 -0
  32. package/src/FloatingButton/index.test.tsx +14 -0
  33. package/src/FloatingButton/index.tsx +44 -0
  34. package/src/OptionButtonBase/index.test.tsx +14 -0
  35. package/src/OptionButtonBase/index.tsx +44 -0
  36. package/src/OptionButtonSteps/index.test.tsx +20 -0
  37. package/src/OptionButtonSteps/index.tsx +62 -0
  38. package/src/index.ts +3 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Change Log - @digigov/react-experimental
2
+
3
+ This log was last generated on Mon, 29 Jan 2024 17:45:11 GMT and should not be manually modified.
4
+
5
+ ## 1.1.1
6
+ Mon, 29 Jan 2024 17:45:11 GMT
7
+
8
+ ### Patches
9
+
10
+ - Add react-experimental folder
11
+
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '@digigov/react-core/Button';
3
+ export interface FloatingButtonProps extends ButtonProps {
4
+ /**
5
+ * direction is optional.
6
+ * direction sets the position of the button to either left or right side of the screen.
7
+ * The default value is 'left'.
8
+ * @value 'right'
9
+ * @value 'left'
10
+ * @default 'left'
11
+ */
12
+ direction?: 'right' | 'left';
13
+ }
14
+ /**
15
+ *
16
+ * A FloatingButton performs the primary, or most common, action on a screen.
17
+ * Use it primary in mobile applications.
18
+ * Avoid using text in this type of button, use icons instead.
19
+ */
20
+ export declare const FloatingButton: React.ForwardRefExoticComponent<Pick<FloatingButtonProps, "form" | "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "name" | "type" | "role" | "tabIndex" | "direction" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "printVisible" | "xsUpHidden" | "smUpHidden" | "mdUpHidden" | "lgUpHidden" | "xlUpHidden" | "xsHidden" | "smHidden" | "mdHidden" | "lgHidden" | "xlHidden" | "variant" | "dense"> & React.RefAttributes<HTMLButtonElement>>;
21
+ export default FloatingButton;
@@ -0,0 +1,24 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["direction", "className", "children"];
4
+ import React from 'react';
5
+ import clsx from 'clsx';
6
+ import Button from '@digigov/react-core/Button';
7
+ /**
8
+ *
9
+ * A FloatingButton performs the primary, or most common, action on a screen.
10
+ * Use it primary in mobile applications.
11
+ * Avoid using text in this type of button, use icons instead.
12
+ */
13
+ export var FloatingButton = /*#__PURE__*/React.forwardRef(function FloatingButton(_ref, ref) {
14
+ var _ref$direction = _ref.direction,
15
+ direction = _ref$direction === void 0 ? 'right' : _ref$direction,
16
+ className = _ref.className,
17
+ children = _ref.children,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ return /*#__PURE__*/React.createElement(Button, _extends({
20
+ ref: ref,
21
+ className: clsx(className, direction === 'right' && 'govgr-floating-btn--right', direction === 'left' && 'govgr-floating-btn--left', true && 'govgr-floating-btn')
22
+ }, props), children);
23
+ });
24
+ export default FloatingButton;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+ import FloatingButton from '@digigov/react-experimental/FloatingButton';
4
+ var _ref = /*#__PURE__*/React.createElement(FloatingButton, null, "+");
5
+ it('renders the FloatingButton with no props', function () {
6
+ expect(mount(_ref)).toMatchSnapshot();
7
+ });
8
+ var _ref2 = /*#__PURE__*/React.createElement(FloatingButton, {
9
+ direction: "right"
10
+ }, "+");
11
+ it('renders the FloatingButton with direction="right"', function () {
12
+ expect(mount(_ref2)).toMatchSnapshot();
13
+ });
14
+ var _ref3 = /*#__PURE__*/React.createElement(FloatingButton, {
15
+ direction: "left"
16
+ }, "+");
17
+ it('renders the FloatingButton with direction="left"', function () {
18
+ expect(mount(_ref3)).toMatchSnapshot();
19
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../../cjs/FloatingButton/index.test/index.js"
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/FloatingButton/index.js"
6
+ }
package/LICENSE ADDED
File without changes
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { BaseProps } from '@digigov/react-core/Base';
3
+ export interface OptionButtonBaseProps extends BaseProps<'button'> {
4
+ /**
5
+ * selected is optional.
6
+ * Use selected prop to set selected styling.
7
+ * @value true
8
+ * @value false
9
+ * @default false
10
+ */
11
+ selected?: boolean;
12
+ }
13
+ /**
14
+ *
15
+ * OptionButtonBases can be used to represent small blocks of information.
16
+ * OptionButtonBase component must be inside OptionButtonBaseSection component.
17
+ */
18
+ export declare const OptionButtonBase: React.ForwardRefExoticComponent<Pick<OptionButtonBaseProps, "form" | "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "name" | "type" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "selected" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "printVisible" | "xsUpHidden" | "smUpHidden" | "mdUpHidden" | "lgUpHidden" | "xlUpHidden" | "xsHidden" | "smHidden" | "mdHidden" | "lgHidden" | "xlHidden"> & React.RefAttributes<HTMLButtonElement>>;
19
+ export default OptionButtonBase;
@@ -0,0 +1,24 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["selected", "className", "children"];
4
+ import React from 'react';
5
+ import clsx from 'clsx';
6
+ import Base from '@digigov/react-core/Base';
7
+ /**
8
+ *
9
+ * OptionButtonBases can be used to represent small blocks of information.
10
+ * OptionButtonBase component must be inside OptionButtonBaseSection component.
11
+ */
12
+ export var OptionButtonBase = /*#__PURE__*/React.forwardRef(function OptionButtonBase(_ref, ref) {
13
+ var _ref$selected = _ref.selected,
14
+ selected = _ref$selected === void 0 ? false : _ref$selected,
15
+ className = _ref.className,
16
+ children = _ref.children,
17
+ props = _objectWithoutProperties(_ref, _excluded);
18
+ return /*#__PURE__*/React.createElement(Base, _extends({
19
+ as: "button",
20
+ ref: ref,
21
+ className: clsx(className, selected && 'govgr-option-btn--selected', true && ['govgr-btn', 'govgr-option-btn'])
22
+ }, props), children);
23
+ });
24
+ export default OptionButtonBase;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+ import OptionButtonBase from '@digigov/react-experimental/OptionButtonBase';
4
+ var _ref = /*#__PURE__*/React.createElement(OptionButtonBase, null, "+");
5
+ it('renders the OptionButtonBase with no props', function () {
6
+ expect(mount(_ref)).toMatchSnapshot();
7
+ });
8
+ var _ref2 = /*#__PURE__*/React.createElement(OptionButtonBase, {
9
+ selected: true
10
+ }, "+");
11
+ it('renders the OptionButtonBase with selected=true', function () {
12
+ expect(mount(_ref2)).toMatchSnapshot();
13
+ });
14
+ var _ref3 = /*#__PURE__*/React.createElement(OptionButtonBase, {
15
+ selected: false
16
+ }, "+");
17
+ it('renders the OptionButtonBase with selected=false', function () {
18
+ expect(mount(_ref3)).toMatchSnapshot();
19
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../../cjs/OptionButtonBase/index.test/index.js"
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/OptionButtonBase/index.js"
6
+ }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { BaseProps } from '@digigov/react-core/Base';
3
+ export interface OptionButtonStepsProps extends BaseProps<'div'> {
4
+ /**
5
+ * @value 0
6
+ * @value 1
7
+ * @value 2
8
+ * @value 3
9
+ * @value 4
10
+ * @default 0
11
+ */
12
+ steps?: stepsProps;
13
+ /**
14
+ * @default 0
15
+ */
16
+ activeStep?: number;
17
+ }
18
+ export type stepsProps = 0 | 1 | 2 | 3 | 4;
19
+ /**
20
+ *
21
+ * OptionButtonSteps can be used to represent small blocks of information.
22
+ * OptionButtonSteps component must be inside OptionButtonStepsSection component.
23
+ */
24
+ export declare const OptionButtonSteps: React.ForwardRefExoticComponent<Pick<OptionButtonStepsProps, "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "printVisible" | "xsUpHidden" | "smUpHidden" | "mdUpHidden" | "lgUpHidden" | "xlUpHidden" | "xsHidden" | "smHidden" | "mdHidden" | "lgHidden" | "xlHidden" | "steps" | "activeStep"> & React.RefAttributes<HTMLDivElement>>;
25
+ export default OptionButtonSteps;
@@ -0,0 +1,31 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["steps", "activeStep", "className"];
4
+ import React from 'react';
5
+ import clsx from 'clsx';
6
+ import Base from '@digigov/react-core/Base';
7
+ /**
8
+ *
9
+ * OptionButtonSteps can be used to represent small blocks of information.
10
+ * OptionButtonSteps component must be inside OptionButtonStepsSection component.
11
+ */
12
+ export var OptionButtonSteps = /*#__PURE__*/React.forwardRef(function OptionButtonSteps(_ref, ref) {
13
+ var _ref$steps = _ref.steps,
14
+ steps = _ref$steps === void 0 ? 0 : _ref$steps,
15
+ _ref$activeStep = _ref.activeStep,
16
+ activeStep = _ref$activeStep === void 0 ? 0 : _ref$activeStep,
17
+ className = _ref.className,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ var renderStep = function renderStep(step) {
20
+ return /*#__PURE__*/React.createElement(Base, {
21
+ as: "div",
22
+ className: clsx(className, activeStep >= step && 'govgr-option-btn__step--active', true && 'govgr-option-btn__step')
23
+ });
24
+ };
25
+ return /*#__PURE__*/React.createElement(Base, _extends({
26
+ as: "div",
27
+ ref: ref,
28
+ className: clsx(className, true && 'govgr-option-btn__steps')
29
+ }, props), steps >= 1 && renderStep(1), steps >= 2 && renderStep(2), steps >= 3 && renderStep(3), steps >= 4 && renderStep(4));
30
+ });
31
+ export default OptionButtonSteps;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+ import OptionButtonSteps from '@digigov/react-experimental/OptionButtonSteps';
4
+ var _ref = /*#__PURE__*/React.createElement(OptionButtonSteps, null, "+");
5
+ it('renders the OptionButtonSteps with no props', function () {
6
+ expect(mount(_ref)).toMatchSnapshot();
7
+ });
8
+ var _ref2 = /*#__PURE__*/React.createElement(OptionButtonSteps, {
9
+ steps: 3
10
+ }, "+");
11
+ it('renders the OptionButtonSteps with steps="3"', function () {
12
+ expect(mount(_ref2)).toMatchSnapshot();
13
+ });
14
+ var _ref3 = /*#__PURE__*/React.createElement(OptionButtonSteps, {
15
+ steps: 4
16
+ }, "+");
17
+ it('renders the OptionButtonSteps with steps=4', function () {
18
+ expect(mount(_ref3)).toMatchSnapshot();
19
+ });
20
+ var _ref4 = /*#__PURE__*/React.createElement(OptionButtonSteps, {
21
+ activeStep: 1
22
+ }, "+");
23
+ it('renders the OptionButtonSteps with activeStep=1', function () {
24
+ expect(mount(_ref4)).toMatchSnapshot();
25
+ });
26
+ var _ref5 = /*#__PURE__*/React.createElement(OptionButtonSteps, {
27
+ steps: 3,
28
+ activeStep: 1
29
+ }, "+");
30
+ it('renders the OptionButtonSteps with steps=3 activeStep=1', function () {
31
+ expect(mount(_ref5)).toMatchSnapshot();
32
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../../cjs/OptionButtonSteps/index.test/index.js"
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/OptionButtonSteps/index.js"
6
+ }
package/README.md ADDED
File without changes
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.FloatingButton = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _clsx = _interopRequireDefault(require("clsx"));
12
+ var _Button = _interopRequireDefault(require("@digigov/react-core/Button"));
13
+ var _excluded = ["direction", "className", "children"];
14
+ /**
15
+ *
16
+ * A FloatingButton performs the primary, or most common, action on a screen.
17
+ * Use it primary in mobile applications.
18
+ * Avoid using text in this type of button, use icons instead.
19
+ */
20
+ var FloatingButton = exports.FloatingButton = /*#__PURE__*/_react["default"].forwardRef(function FloatingButton(_ref, ref) {
21
+ var _ref$direction = _ref.direction,
22
+ direction = _ref$direction === void 0 ? 'right' : _ref$direction,
23
+ className = _ref.className,
24
+ children = _ref.children,
25
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
26
+ return /*#__PURE__*/_react["default"].createElement(_Button["default"], (0, _extends2["default"])({
27
+ ref: ref,
28
+ className: (0, _clsx["default"])(className, direction === 'right' && 'govgr-floating-btn--right', direction === 'left' && 'govgr-floating-btn--left', true && 'govgr-floating-btn')
29
+ }, props), children);
30
+ });
31
+ var _default = exports["default"] = FloatingButton;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _enzyme = require("enzyme");
6
+ var _FloatingButton = _interopRequireDefault(require("@digigov/react-experimental/FloatingButton"));
7
+ var _ref = /*#__PURE__*/_react["default"].createElement(_FloatingButton["default"], null, "+");
8
+ it('renders the FloatingButton with no props', function () {
9
+ expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
10
+ });
11
+ var _ref2 = /*#__PURE__*/_react["default"].createElement(_FloatingButton["default"], {
12
+ direction: "right"
13
+ }, "+");
14
+ it('renders the FloatingButton with direction="right"', function () {
15
+ expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
16
+ });
17
+ var _ref3 = /*#__PURE__*/_react["default"].createElement(_FloatingButton["default"], {
18
+ direction: "left"
19
+ }, "+");
20
+ it('renders the FloatingButton with direction="left"', function () {
21
+ expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
22
+ });
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.OptionButtonBase = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _clsx = _interopRequireDefault(require("clsx"));
12
+ var _Base = _interopRequireDefault(require("@digigov/react-core/Base"));
13
+ var _excluded = ["selected", "className", "children"];
14
+ /**
15
+ *
16
+ * OptionButtonBases can be used to represent small blocks of information.
17
+ * OptionButtonBase component must be inside OptionButtonBaseSection component.
18
+ */
19
+ var OptionButtonBase = exports.OptionButtonBase = /*#__PURE__*/_react["default"].forwardRef(function OptionButtonBase(_ref, ref) {
20
+ var _ref$selected = _ref.selected,
21
+ selected = _ref$selected === void 0 ? false : _ref$selected,
22
+ className = _ref.className,
23
+ children = _ref.children,
24
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
25
+ return /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
26
+ as: "button",
27
+ ref: ref,
28
+ className: (0, _clsx["default"])(className, selected && 'govgr-option-btn--selected', true && ['govgr-btn', 'govgr-option-btn'])
29
+ }, props), children);
30
+ });
31
+ var _default = exports["default"] = OptionButtonBase;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _enzyme = require("enzyme");
6
+ var _OptionButtonBase = _interopRequireDefault(require("@digigov/react-experimental/OptionButtonBase"));
7
+ var _ref = /*#__PURE__*/_react["default"].createElement(_OptionButtonBase["default"], null, "+");
8
+ it('renders the OptionButtonBase with no props', function () {
9
+ expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
10
+ });
11
+ var _ref2 = /*#__PURE__*/_react["default"].createElement(_OptionButtonBase["default"], {
12
+ selected: true
13
+ }, "+");
14
+ it('renders the OptionButtonBase with selected=true', function () {
15
+ expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
16
+ });
17
+ var _ref3 = /*#__PURE__*/_react["default"].createElement(_OptionButtonBase["default"], {
18
+ selected: false
19
+ }, "+");
20
+ it('renders the OptionButtonBase with selected=false', function () {
21
+ expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
22
+ });
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.OptionButtonSteps = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _clsx = _interopRequireDefault(require("clsx"));
12
+ var _Base = _interopRequireDefault(require("@digigov/react-core/Base"));
13
+ var _excluded = ["steps", "activeStep", "className"];
14
+ /**
15
+ *
16
+ * OptionButtonSteps can be used to represent small blocks of information.
17
+ * OptionButtonSteps component must be inside OptionButtonStepsSection component.
18
+ */
19
+ var OptionButtonSteps = exports.OptionButtonSteps = /*#__PURE__*/_react["default"].forwardRef(function OptionButtonSteps(_ref, ref) {
20
+ var _ref$steps = _ref.steps,
21
+ steps = _ref$steps === void 0 ? 0 : _ref$steps,
22
+ _ref$activeStep = _ref.activeStep,
23
+ activeStep = _ref$activeStep === void 0 ? 0 : _ref$activeStep,
24
+ className = _ref.className,
25
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
26
+ var renderStep = function renderStep(step) {
27
+ return /*#__PURE__*/_react["default"].createElement(_Base["default"], {
28
+ as: "div",
29
+ className: (0, _clsx["default"])(className, activeStep >= step && 'govgr-option-btn__step--active', true && 'govgr-option-btn__step')
30
+ });
31
+ };
32
+ return /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
33
+ as: "div",
34
+ ref: ref,
35
+ className: (0, _clsx["default"])(className, true && 'govgr-option-btn__steps')
36
+ }, props), steps >= 1 && renderStep(1), steps >= 2 && renderStep(2), steps >= 3 && renderStep(3), steps >= 4 && renderStep(4));
37
+ });
38
+ var _default = exports["default"] = OptionButtonSteps;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _enzyme = require("enzyme");
6
+ var _OptionButtonSteps = _interopRequireDefault(require("@digigov/react-experimental/OptionButtonSteps"));
7
+ var _ref = /*#__PURE__*/_react["default"].createElement(_OptionButtonSteps["default"], null, "+");
8
+ it('renders the OptionButtonSteps with no props', function () {
9
+ expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
10
+ });
11
+ var _ref2 = /*#__PURE__*/_react["default"].createElement(_OptionButtonSteps["default"], {
12
+ steps: 3
13
+ }, "+");
14
+ it('renders the OptionButtonSteps with steps="3"', function () {
15
+ expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
16
+ });
17
+ var _ref3 = /*#__PURE__*/_react["default"].createElement(_OptionButtonSteps["default"], {
18
+ steps: 4
19
+ }, "+");
20
+ it('renders the OptionButtonSteps with steps=4', function () {
21
+ expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
22
+ });
23
+ var _ref4 = /*#__PURE__*/_react["default"].createElement(_OptionButtonSteps["default"], {
24
+ activeStep: 1
25
+ }, "+");
26
+ it('renders the OptionButtonSteps with activeStep=1', function () {
27
+ expect((0, _enzyme.mount)(_ref4)).toMatchSnapshot();
28
+ });
29
+ var _ref5 = /*#__PURE__*/_react["default"].createElement(_OptionButtonSteps["default"], {
30
+ steps: 3,
31
+ activeStep: 1
32
+ }, "+");
33
+ it('renders the OptionButtonSteps with steps=3 activeStep=1', function () {
34
+ expect((0, _enzyme.mount)(_ref5)).toMatchSnapshot();
35
+ });
package/cjs/index.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _FloatingButton = require("@digigov/react-experimental/FloatingButton");
7
+ Object.keys(_FloatingButton).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _FloatingButton[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _FloatingButton[key];
14
+ }
15
+ });
16
+ });
17
+ var _OptionButtonBase = require("@digigov/react-experimental/OptionButtonBase");
18
+ Object.keys(_OptionButtonBase).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _OptionButtonBase[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _OptionButtonBase[key];
25
+ }
26
+ });
27
+ });
28
+ var _OptionButtonSteps = require("@digigov/react-experimental/OptionButtonSteps");
29
+ Object.keys(_OptionButtonSteps).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _OptionButtonSteps[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _OptionButtonSteps[key];
36
+ }
37
+ });
38
+ });
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from '@digigov/react-experimental/FloatingButton';
2
+ export * from '@digigov/react-experimental/OptionButtonBase';
3
+ export * from '@digigov/react-experimental/OptionButtonSteps';
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /** @license Digigov v1.1.1
2
+ *
3
+ * This source code is licensed under the BSD-2-Clause license found in the
4
+ * LICENSE file in the root directory of this source tree.
5
+ */
6
+ export * from '@digigov/react-experimental/FloatingButton';
7
+ export * from '@digigov/react-experimental/OptionButtonBase';
8
+ export * from '@digigov/react-experimental/OptionButtonSteps';
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@digigov/react-experimental",
3
+ "version": "1.1.1",
4
+ "description": "@digigov react experimental components",
5
+ "author": "GRNET Developers <devs@lists.grnet.gr>",
6
+ "license": "BSD-2-Clause",
7
+ "main": "./cjs/index.js",
8
+ "module": "./index.js",
9
+ "peerDependencies": {
10
+ "@digigov/css": "1.1.1",
11
+ "@digigov/react-experimental": "1.1.1",
12
+ "@digigov/react-icons": "1.1.1",
13
+ "clsx": "1.1.1",
14
+ "react": "^16.8.0 || ^17.0.0",
15
+ "react-dom": "^16.8.0 || ^17.0.0"
16
+ },
17
+ "dependencies": {
18
+ "ts-morph": "18.0.0"
19
+ },
20
+ "private": false,
21
+ "typings": "./index.d.ts"
22
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+
4
+ import FloatingButton from '@digigov/react-experimental/FloatingButton';
5
+
6
+ it('renders the FloatingButton with no props', () => {
7
+ expect(mount(<FloatingButton>+</FloatingButton>)).toMatchSnapshot();
8
+ });
9
+ it('renders the FloatingButton with direction="right"', () => {
10
+ expect(mount(<FloatingButton direction="right">+</FloatingButton>)).toMatchSnapshot();
11
+ });
12
+ it('renders the FloatingButton with direction="left"', () => {
13
+ expect(mount(<FloatingButton direction="left">+</FloatingButton>)).toMatchSnapshot();
14
+ });
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Button, { ButtonProps } from '@digigov/react-core/Button';
4
+
5
+ export interface FloatingButtonProps extends ButtonProps {
6
+ /**
7
+ * direction is optional.
8
+ * direction sets the position of the button to either left or right side of the screen.
9
+ * The default value is 'left'.
10
+ * @value 'right'
11
+ * @value 'left'
12
+ * @default 'left'
13
+ */
14
+ direction?: 'right' | 'left';
15
+ }
16
+ /**
17
+ *
18
+ * A FloatingButton performs the primary, or most common, action on a screen.
19
+ * Use it primary in mobile applications.
20
+ * Avoid using text in this type of button, use icons instead.
21
+ */
22
+ export const FloatingButton = React.forwardRef<
23
+ HTMLButtonElement,
24
+ FloatingButtonProps
25
+ >(function FloatingButton(
26
+ { direction = 'right', className, children, ...props },
27
+ ref
28
+ ) {
29
+ return (
30
+ <Button
31
+ ref={ref}
32
+ className={clsx(className, {
33
+ 'govgr-floating-btn': true,
34
+ 'govgr-floating-btn--right': direction === 'right',
35
+ 'govgr-floating-btn--left': direction === 'left',
36
+ })}
37
+ {...props}
38
+ >
39
+ {children}
40
+ </Button>
41
+ );
42
+ });
43
+
44
+ export default FloatingButton;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+
4
+ import OptionButtonBase from '@digigov/react-experimental/OptionButtonBase';
5
+
6
+ it('renders the OptionButtonBase with no props', () => {
7
+ expect(mount(<OptionButtonBase>+</OptionButtonBase>)).toMatchSnapshot();
8
+ });
9
+ it('renders the OptionButtonBase with selected=true', () => {
10
+ expect(mount(<OptionButtonBase selected={true}>+</OptionButtonBase>)).toMatchSnapshot();
11
+ });
12
+ it('renders the OptionButtonBase with selected=false', () => {
13
+ expect(mount(<OptionButtonBase selected={false}>+</OptionButtonBase>)).toMatchSnapshot();
14
+ });
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Base, { BaseProps } from '@digigov/react-core/Base';
4
+
5
+ export interface OptionButtonBaseProps
6
+ extends BaseProps<'button'> {
7
+ /**
8
+ * selected is optional.
9
+ * Use selected prop to set selected styling.
10
+ * @value true
11
+ * @value false
12
+ * @default false
13
+ */
14
+ selected?: boolean
15
+ }
16
+ /**
17
+ *
18
+ * OptionButtonBases can be used to represent small blocks of information.
19
+ * OptionButtonBase component must be inside OptionButtonBaseSection component.
20
+ */
21
+ export const OptionButtonBase = React.forwardRef<
22
+ HTMLButtonElement,
23
+ OptionButtonBaseProps
24
+ >(function OptionButtonBase(
25
+ { selected = false, className, children, ...props },
26
+ ref
27
+ ) {
28
+ return (
29
+ <Base
30
+ as="button"
31
+ ref={ref}
32
+ className={clsx(className, {
33
+ 'govgr-btn': true,
34
+ 'govgr-option-btn': true,
35
+ 'govgr-option-btn--selected': selected,
36
+ })}
37
+ {...props}
38
+ >
39
+ {children}
40
+ </Base>
41
+ );
42
+ });
43
+
44
+ export default OptionButtonBase;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+
4
+ import OptionButtonSteps from '@digigov/react-experimental/OptionButtonSteps';
5
+
6
+ it('renders the OptionButtonSteps with no props', () => {
7
+ expect(mount(<OptionButtonSteps>+</OptionButtonSteps>)).toMatchSnapshot();
8
+ });
9
+ it('renders the OptionButtonSteps with steps="3"', () => {
10
+ expect(mount(<OptionButtonSteps steps={3}>+</OptionButtonSteps>)).toMatchSnapshot();
11
+ });
12
+ it('renders the OptionButtonSteps with steps=4', () => {
13
+ expect(mount(<OptionButtonSteps steps={4}>+</OptionButtonSteps>)).toMatchSnapshot();
14
+ });
15
+ it('renders the OptionButtonSteps with activeStep=1', () => {
16
+ expect(mount(<OptionButtonSteps activeStep={1}>+</OptionButtonSteps>)).toMatchSnapshot();
17
+ });
18
+ it('renders the OptionButtonSteps with steps=3 activeStep=1', () => {
19
+ expect(mount(<OptionButtonSteps steps={3} activeStep={1}>+</OptionButtonSteps>)).toMatchSnapshot();
20
+ });
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Base, { BaseProps } from '@digigov/react-core/Base';
4
+
5
+ export interface OptionButtonStepsProps extends BaseProps<'div'> {
6
+ /**
7
+ * @value 0
8
+ * @value 1
9
+ * @value 2
10
+ * @value 3
11
+ * @value 4
12
+ * @default 0
13
+ */
14
+ steps?: stepsProps;
15
+ /**
16
+ * @default 0
17
+ */
18
+ activeStep?: number;
19
+ }
20
+
21
+ export type stepsProps = 0 | 1 | 2 | 3 | 4;
22
+ /**
23
+ *
24
+ * OptionButtonSteps can be used to represent small blocks of information.
25
+ * OptionButtonSteps component must be inside OptionButtonStepsSection component.
26
+ */
27
+ export const OptionButtonSteps = React.forwardRef<
28
+ HTMLDivElement,
29
+ OptionButtonStepsProps
30
+ >(function OptionButtonSteps(
31
+ { steps = 0, activeStep = 0, className, ...props },
32
+ ref
33
+ ) {
34
+
35
+ const renderStep = (step: number) => (
36
+ <Base
37
+ as="div"
38
+ className={clsx(className, {
39
+ 'govgr-option-btn__step': true,
40
+ 'govgr-option-btn__step--active': activeStep >= step,
41
+ })}
42
+ ></Base>
43
+ );
44
+
45
+ return (
46
+ <Base
47
+ as="div"
48
+ ref={ref}
49
+ className={clsx(className, {
50
+ 'govgr-option-btn__steps': true,
51
+ })}
52
+ {...props}
53
+ >
54
+ {steps >= 1 && renderStep(1)}
55
+ {steps >= 2 && renderStep(2)}
56
+ {steps >= 3 && renderStep(3)}
57
+ {steps >= 4 && renderStep(4)}
58
+ </Base>
59
+ );
60
+ });
61
+
62
+ export default OptionButtonSteps;
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from '@digigov/react-experimental/FloatingButton';
2
+ export * from '@digigov/react-experimental/OptionButtonBase';
3
+ export * from '@digigov/react-experimental/OptionButtonSteps';