@codacy/ui-components 0.49.2 → 0.50.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.
@@ -2,3 +2,4 @@
2
2
  export declare const CheckIcon: () => JSX.Element;
3
3
  export declare const MinusIcon: () => JSX.Element;
4
4
  export declare const CloseIcon: () => JSX.Element;
5
+ export declare const DangerIcon: () => JSX.Element;
@@ -33,4 +33,23 @@ export var CloseIcon = function CloseIcon() {
33
33
  d: "M368 368L144 144M368 144L144 368",
34
34
  className: "ionicon-fill-none ionicon-stroke-width"
35
35
  }));
36
+ };
37
+ export var DangerIcon = function DangerIcon() {
38
+ return /*#__PURE__*/React.createElement("svg", {
39
+ xmlns: "http://www.w3.org/2000/svg",
40
+ className: "ionicon",
41
+ viewBox: "0 0 512 512"
42
+ }, /*#__PURE__*/React.createElement("path", {
43
+ d: "M85.57 446.25h340.86a32 32 0 0028.17-47.17L284.18 82.58c-12.09-22.44-44.27-22.44-56.36 0L57.4 399.08a32 32 0 0028.17 47.17z",
44
+ "stroke-linecap": "round",
45
+ "stroke-linejoin": "round",
46
+ className: "ionicon-fill-none ionicon-stroke-width"
47
+ }), /*#__PURE__*/React.createElement("path", {
48
+ d: "M250.26 195.39l5.74 122 5.73-121.95a5.74 5.74 0 00-5.79-6h0a5.74 5.74 0 00-5.68 5.95z",
49
+ "stroke-linecap": "round",
50
+ "stroke-linejoin": "round",
51
+ className: "ionicon-fill-none ionicon-stroke-width"
52
+ }), /*#__PURE__*/React.createElement("path", {
53
+ d: "M256 397.25a20 20 0 1120-20 20 20 0 01-20 20z"
54
+ }));
36
55
  };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ConfirmationModalProps } from './types';
3
+ import { DialogStateReturn } from 'reakit/ts/Dialog';
4
+ export declare const ConfirmationModal: React.FC<ConfirmationModalProps & DialogStateReturn>;
@@ -0,0 +1,44 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import React, { useCallback, useRef } from 'react';
3
+ import { Modal } from '.';
4
+ import { Button, ButtonGroup, IconAndText, Subheader } from '..';
5
+ export var ConfirmationModal = function ConfirmationModal(_ref) {
6
+ var title = _ref.title,
7
+ confirmText = _ref.confirmText,
8
+ onConfirm = _ref.onConfirm,
9
+ _ref$cancelText = _ref.cancelText,
10
+ cancelText = _ref$cancelText === void 0 ? 'Cancel' : _ref$cancelText,
11
+ onCancel = _ref.onCancel,
12
+ _ref$variant = _ref.variant,
13
+ variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
14
+ icon = _ref.icon,
15
+ children = _ref.children,
16
+ dialog = _objectWithoutProperties(_ref, ["title", "confirmText", "onConfirm", "cancelText", "onCancel", "variant", "icon", "children"]);
17
+
18
+ var cancelRef = useRef(null);
19
+ var handleCancel = useCallback(function () {
20
+ if (onCancel) onCancel();
21
+ dialog.hide();
22
+ }, [onCancel, dialog]);
23
+ return /*#__PURE__*/React.createElement(Modal, Object.assign({
24
+ focusRef: cancelRef
25
+ }, dialog), /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Subheader, null, icon ? /*#__PURE__*/React.createElement(IconAndText, {
26
+ icon: icon,
27
+ iconProps: {
28
+ color: "icon-".concat(variant)
29
+ }
30
+ }, title) : /*#__PURE__*/React.createElement(React.Fragment, null, title))), /*#__PURE__*/React.createElement(Modal.Body, {
31
+ mt: 4
32
+ }, children), /*#__PURE__*/React.createElement(Modal.Footer, null, /*#__PURE__*/React.createElement(ButtonGroup, {
33
+ mt: 5
34
+ }, /*#__PURE__*/React.createElement(Button, {
35
+ variant: "primary",
36
+ color: variant,
37
+ onClick: onConfirm
38
+ }, confirmText), /*#__PURE__*/React.createElement(Button, {
39
+ variant: "link",
40
+ color: "subtle",
41
+ onClick: handleCancel,
42
+ ref: cancelRef
43
+ }, cancelText))));
44
+ };
@@ -40,3 +40,12 @@ export interface ModalProps extends ModalHeaderProps {
40
40
  /** Vertical positioning */
41
41
  vPos?: 'top' | 'center';
42
42
  }
43
+ export interface ConfirmationModalProps extends Omit<ModalProps, 'title' | 'description' | 'headerImg' | 'focusRef'> {
44
+ title: string;
45
+ confirmText: string;
46
+ onConfirm: () => void;
47
+ cancelText?: string;
48
+ onCancel?: () => void;
49
+ variant?: 'primary' | 'danger';
50
+ icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
51
+ }
@@ -1,2 +1 @@
1
1
  export * from './Toast';
2
- export { TypeOptions as ToastType } from 'react-toastify';
@@ -1,2 +1 @@
1
- export * from './Toast';
2
- export { TypeOptions as ToastType } from 'react-toastify';
1
+ export * from './Toast';
@@ -7,3 +7,4 @@ export declare type ToastContent = React.ReactChild | {
7
7
  export interface ToastConfig extends Pick<ToastOptions, 'onClose' | 'onOpen' | 'toastId' | 'type'> {
8
8
  duration?: number | null;
9
9
  }
10
+ export declare type ToastType = 'info' | 'success' | 'warning' | 'error' | 'default';
@@ -144,6 +144,7 @@ var Tooltip = function Tooltip(_ref) {
144
144
  return removeEvents;
145
145
  }, [visible, selfClose, handleClick, handleScroll]);
146
146
  var tooltipCard = /*#__PURE__*/React.createElement(TooltipCard, Object.assign({
147
+ id: "tooltip",
147
148
  ref: setPopperRef,
148
149
  style: styles.popper
149
150
  }, attributes.popper, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/ui-components",
3
- "version": "0.49.2",
3
+ "version": "0.50.1",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -42,7 +42,6 @@
42
42
  "react-popper": "^2.2.4",
43
43
  "react-select": "3.1.0",
44
44
  "react-spring": "^8.0.27",
45
- "react-toastify": "^8.0.2",
46
45
  "styled-system": "^5.1.5"
47
46
  },
48
47
  "devDependencies": {
@@ -63,11 +62,11 @@
63
62
  "@types/react": "^16.9.56",
64
63
  "@types/react-dom": "^16.9.9",
65
64
  "@types/react-select": "3.0.13",
65
+ "@types/resize-observer-browser": "^0.1.6",
66
66
  "@types/styled-system": "^5.1.10",
67
67
  "@types/styled-system__should-forward-prop": "^5.1.2",
68
68
  "@typescript-eslint/eslint-plugin": "^2.34.0",
69
69
  "@typescript-eslint/parser": "^2.34.0",
70
- "@types/resize-observer-browser": "^0.1.6",
71
70
  "babel-eslint": "^10.1.0",
72
71
  "babel-loader": "^8.2.1",
73
72
  "babel-plugin-emotion": "^10.0.33",
@@ -94,17 +93,19 @@
94
93
  "react": "^17.0.1",
95
94
  "react-docgen-typescript-loader": "^3.7.2",
96
95
  "react-dom": "^17.0.1",
96
+ "react-toastify": "^8.0.2",
97
+ "reakit": "1.1.1",
97
98
  "rimraf": "^3.0.2",
98
99
  "typeface-clear-sans": "0.0.44",
99
- "typescript": "^3.8.3",
100
- "reakit": "1.1.1"
100
+ "typescript": "^3.8.3"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@emotion/styled": "10.x",
104
104
  "react": ">=16.13",
105
105
  "react-dom": ">=16.13",
106
106
  "typeface-clear-sans": "0.0.44",
107
- "reakit": "1.1.1"
107
+ "reakit": "1.1.1",
108
+ "react-toastify": "^8.0.2"
108
109
  },
109
110
  "husky": {
110
111
  "hooks": {