iguazio.dashboard-react-controls 0.0.6 → 0.0.9
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/dist/components/FormCheckBox/FormCheckBox.js +57 -0
- package/dist/components/FormCheckBox/formCheckBox.scss +33 -0
- package/dist/components/FormInput/FormInput.js +447 -0
- package/dist/components/FormInput/formInput.scss +93 -0
- package/dist/components/FormKeyValueTable/FormKeyValueTable.js +353 -0
- package/dist/components/FormKeyValueTable/formKeyValueTable.scss +117 -0
- package/dist/components/FormSelect/FormSelect.js +342 -0
- package/dist/components/FormSelect/FormSelect.test.js +158 -0
- package/dist/components/FormSelect/formSelect.scss +93 -0
- package/dist/components/Modal/Modal.js +9 -12
- package/dist/components/Tip/Tip.js +132 -0
- package/dist/components/Tip/Tip.test.js +96 -0
- package/dist/components/Tip/tip.scss +89 -0
- package/dist/components/Wizard/Wizard.js +50 -81
- package/dist/components/Wizard/Wizard.scss +11 -13
- package/dist/components/index.js +40 -0
- package/dist/constants.js +20 -2
- package/dist/elements/OptionsMenu/OptionsMenu.js +63 -0
- package/dist/elements/OptionsMenu/optionsMenu.scss +49 -0
- package/dist/elements/SelectOption/SelectOption.js +95 -0
- package/dist/elements/SelectOption/SelectOption.test.js +99 -0
- package/dist/elements/SelectOption/selectOption.scss +61 -0
- package/dist/elements/ValidationTemplate/ValidationTemplate.js +48 -0
- package/dist/elements/ValidationTemplate/ValidationTemplate.scss +36 -0
- package/dist/elements/index.js +31 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/useDetectOutsideClick.js +34 -0
- package/dist/index.js +13 -5
- package/dist/scss/mixins.scss +98 -23
- package/dist/types.js +34 -2
- package/dist/utils/form.util.js +22 -0
- package/dist/utils/validation.util.js +269 -0
- package/package.json +11 -7
package/dist/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TERTIARY_BUTTON = exports.SECONDARY_BUTTON = exports.PRIMARY_BUTTON = exports.MODAL_SM = exports.MODAL_MD = exports.MODAL_LG = exports.LABEL_BUTTON = exports.INTERNAL_SERVER_ERROR_STATUS_CODE = exports.FORBIDDEN_ERROR_STATUS_CODE = exports.DANGER_BUTTON = exports.CONFLICT_ERROR_STATUS_CODE = void 0;
|
|
6
|
+
exports.validation = exports.TERTIARY_BUTTON = exports.SECONDARY_BUTTON = exports.PRIMARY_BUTTON = exports.MODAL_SM = exports.MODAL_MD = exports.MODAL_LG = exports.LABEL_BUTTON = exports.INTERNAL_SERVER_ERROR_STATUS_CODE = exports.FORBIDDEN_ERROR_STATUS_CODE = exports.DANGER_BUTTON = exports.CONFLICT_ERROR_STATUS_CODE = void 0;
|
|
7
7
|
|
|
8
8
|
/*=========== BUTTONS =============*/
|
|
9
9
|
var PRIMARY_BUTTON = 'primary';
|
|
@@ -15,9 +15,27 @@ exports.TERTIARY_BUTTON = TERTIARY_BUTTON;
|
|
|
15
15
|
var DANGER_BUTTON = 'danger';
|
|
16
16
|
exports.DANGER_BUTTON = DANGER_BUTTON;
|
|
17
17
|
var LABEL_BUTTON = 'label';
|
|
18
|
-
/*===========
|
|
18
|
+
/*=========== VALITATION =============*/
|
|
19
19
|
|
|
20
20
|
exports.LABEL_BUTTON = LABEL_BUTTON;
|
|
21
|
+
var validation = {
|
|
22
|
+
BEGIN_END_NOT_WITH: 'Must not begin and end with',
|
|
23
|
+
BEGIN_END_WITH: 'Must begin and end with',
|
|
24
|
+
BEGIN_NOT_WITH: 'Must not begin with',
|
|
25
|
+
BEGIN_WITH: 'Must begin with',
|
|
26
|
+
END_NOT_WITH: 'Must not end with',
|
|
27
|
+
END_WITH: 'Must end with',
|
|
28
|
+
MUST_CONTAIN_EXACTLY_ONE: 'Must contain exactly one',
|
|
29
|
+
MUST_HAVE_DOT_AFTER_AT: 'Must have at least one . after @',
|
|
30
|
+
MUST_NOT_BE: 'Must not be',
|
|
31
|
+
NO_CONSECUTIVE_CHARACTER: 'No consecutive characters',
|
|
32
|
+
ONLY_AT_THE_BEGINNING: 'Only at the beginning',
|
|
33
|
+
REQUIRED: 'This field is required',
|
|
34
|
+
VALID_CHARACTERS: 'Valid characters'
|
|
35
|
+
};
|
|
36
|
+
/*=========== STATUS CODES =============*/
|
|
37
|
+
|
|
38
|
+
exports.validation = validation;
|
|
21
39
|
var INTERNAL_SERVER_ERROR_STATUS_CODE = 500;
|
|
22
40
|
exports.INTERNAL_SERVER_ERROR_STATUS_CODE = INTERNAL_SERVER_ERROR_STATUS_CODE;
|
|
23
41
|
var CONFLICT_ERROR_STATUS_CODE = 409;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _reactTransitionGroup = require("react-transition-group");
|
|
13
|
+
|
|
14
|
+
var _components = require("../../components");
|
|
15
|
+
|
|
16
|
+
require("./optionsMenu.scss");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
var OptionsMenu = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
23
|
+
var children = _ref.children,
|
|
24
|
+
show = _ref.show,
|
|
25
|
+
timeout = _ref.timeout;
|
|
26
|
+
|
|
27
|
+
var _ref2 = ref.current ? ref.current.getBoundingClientRect() : {},
|
|
28
|
+
dropdownWidth = _ref2.width;
|
|
29
|
+
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
31
|
+
in: show,
|
|
32
|
+
timeout: timeout,
|
|
33
|
+
classNames: "options-menu-transition",
|
|
34
|
+
unmountOnExit: true,
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PopUpDialog, {
|
|
36
|
+
className: "options-menu",
|
|
37
|
+
customPosition: {
|
|
38
|
+
element: ref,
|
|
39
|
+
position: 'bottom-right'
|
|
40
|
+
},
|
|
41
|
+
style: {
|
|
42
|
+
width: "".concat(dropdownWidth, "px")
|
|
43
|
+
},
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
45
|
+
className: "options-menu__body",
|
|
46
|
+
children: children
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
OptionsMenu.defaultProps = {
|
|
53
|
+
children: [],
|
|
54
|
+
show: false,
|
|
55
|
+
timeout: 300
|
|
56
|
+
};
|
|
57
|
+
OptionsMenu.propTypes = {
|
|
58
|
+
children: _propTypes.default.arrayOf(_propTypes.default.element),
|
|
59
|
+
show: _propTypes.default.bool.isRequired,
|
|
60
|
+
timout: _propTypes.default.number
|
|
61
|
+
};
|
|
62
|
+
var _default = OptionsMenu;
|
|
63
|
+
exports.default = _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@import '../../scss/colors';
|
|
2
|
+
@import '../../scss/shadows';
|
|
3
|
+
@import '../../scss/borders';
|
|
4
|
+
|
|
5
|
+
.options-menu {
|
|
6
|
+
&__body {
|
|
7
|
+
width: 100%;
|
|
8
|
+
max-height: 250px;
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
overflow-y: auto;
|
|
12
|
+
color: $mulledWineTwo;
|
|
13
|
+
font-size: 1rem;
|
|
14
|
+
list-style-type: none;
|
|
15
|
+
background-color: $white;
|
|
16
|
+
border: $primaryBorder;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
box-shadow: $previewBoxShadow;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.pop-up-dialog {
|
|
22
|
+
width: 100%;
|
|
23
|
+
padding: 0;
|
|
24
|
+
|
|
25
|
+
&__header {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-transition {
|
|
31
|
+
&-enter {
|
|
32
|
+
opacity: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-enter-active {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
transition: opacity 300ms ease-in-out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-exit {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&-exit-active {
|
|
45
|
+
opacity: 0;
|
|
46
|
+
transition: opacity 300ms ease-in-out;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _components = require("../../components");
|
|
15
|
+
|
|
16
|
+
var _types = require("../../types");
|
|
17
|
+
|
|
18
|
+
var _checkmark = require("../../images/checkmark.svg");
|
|
19
|
+
|
|
20
|
+
require("./selectOption.scss");
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
var SelectOption = function SelectOption(_ref) {
|
|
27
|
+
var item = _ref.item,
|
|
28
|
+
_onClick = _ref.onClick,
|
|
29
|
+
selectType = _ref.selectType,
|
|
30
|
+
selectedId = _ref.selectedId,
|
|
31
|
+
withSelectedIcon = _ref.withSelectedIcon;
|
|
32
|
+
var selectClassName = (0, _classnames.default)('select__item', item.hidden && 'hidden', item.disabled && 'disabled');
|
|
33
|
+
|
|
34
|
+
if (selectType === 'checkbox') {
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
36
|
+
"data-testid": "select-checkbox",
|
|
37
|
+
className: "select__item",
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.FormCheckBox, {
|
|
39
|
+
item: item,
|
|
40
|
+
selectedId: selectedId,
|
|
41
|
+
onChange: _onClick,
|
|
42
|
+
children: [item.status && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
43
|
+
className: "state-".concat(item.status, "-job status")
|
|
44
|
+
}), item.label]
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
50
|
+
"data-testid": "select-option",
|
|
51
|
+
className: selectClassName,
|
|
52
|
+
onClick: function onClick() {
|
|
53
|
+
!item.disabled && _onClick(item.id);
|
|
54
|
+
},
|
|
55
|
+
children: [item.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
56
|
+
"data-testid": "select-icon",
|
|
57
|
+
className: "select__icon",
|
|
58
|
+
children: item.icon
|
|
59
|
+
}), item.status && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
60
|
+
className: "state-".concat(item.status, "-job status")
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
62
|
+
className: "data-ellipsis label-row",
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
64
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
65
|
+
text: item.label
|
|
66
|
+
}),
|
|
67
|
+
children: item.label
|
|
68
|
+
}), withSelectedIcon && item.id === selectedId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkmark.ReactComponent, {
|
|
69
|
+
className: "checkmark"
|
|
70
|
+
})]
|
|
71
|
+
}), item.subLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
72
|
+
className: "sub-label",
|
|
73
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
74
|
+
text: item.subLabel
|
|
75
|
+
}),
|
|
76
|
+
children: item.subLabel
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
SelectOption.defaultProps = {
|
|
82
|
+
onClick: function onClick() {},
|
|
83
|
+
selectType: '',
|
|
84
|
+
withSelectedIcon: true
|
|
85
|
+
};
|
|
86
|
+
SelectOption.propTypes = {
|
|
87
|
+
disabled: _propTypes.default.bool,
|
|
88
|
+
item: _types.SELECT_OPTION.isRequired,
|
|
89
|
+
onClick: _propTypes.default.func,
|
|
90
|
+
selectType: _propTypes.default.string,
|
|
91
|
+
selectedId: _propTypes.default.string,
|
|
92
|
+
withSelectedIcon: _propTypes.default.bool
|
|
93
|
+
};
|
|
94
|
+
var _default = SelectOption;
|
|
95
|
+
exports.default = _default;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
|
|
7
|
+
var _SelectOption = _interopRequireDefault(require("./SelectOption"));
|
|
8
|
+
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
+
|
|
17
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
|
|
19
|
+
var renderComponent = function renderComponent(props) {
|
|
20
|
+
return (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, _objectSpread({}, props)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
jest.mock('igz-controls/images/checkbox-unchecked.svg', function () {
|
|
24
|
+
return {
|
|
25
|
+
ReactComponent: 'unchecked-icon'
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
jest.mock('igz-controls/images/checkbox-checked.svg', function () {
|
|
29
|
+
return {
|
|
30
|
+
ReactComponent: 'unchecked-icon'
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
describe('SelectOption component', function () {
|
|
34
|
+
var wrapper;
|
|
35
|
+
beforeEach(function () {
|
|
36
|
+
var props = {
|
|
37
|
+
item: {
|
|
38
|
+
label: 'Test1',
|
|
39
|
+
id: 'test1',
|
|
40
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
41
|
+
children: "icon"
|
|
42
|
+
}),
|
|
43
|
+
subLabel: 'Test1'
|
|
44
|
+
},
|
|
45
|
+
selectType: ''
|
|
46
|
+
};
|
|
47
|
+
wrapper = renderComponent(props);
|
|
48
|
+
});
|
|
49
|
+
afterEach(_react2.cleanup);
|
|
50
|
+
it('renders without crashing', function () {
|
|
51
|
+
expect(wrapper.queryByTestId('select-option')).not.toBeNull();
|
|
52
|
+
});
|
|
53
|
+
it('should display checkbox inside option if props selectType is "checkbox"', function () {
|
|
54
|
+
wrapper.rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
55
|
+
item: {
|
|
56
|
+
label: 'Test1',
|
|
57
|
+
id: 'test1'
|
|
58
|
+
},
|
|
59
|
+
selectType: "checkbox",
|
|
60
|
+
selectedId: "test1"
|
|
61
|
+
}));
|
|
62
|
+
expect(wrapper.queryByTestId('select-checkbox')).not.toBeNull();
|
|
63
|
+
});
|
|
64
|
+
it('should display select icon if it exists in the props "item"', function () {
|
|
65
|
+
expect(wrapper.getByTestId('select-icon')).not.toBeNull();
|
|
66
|
+
});
|
|
67
|
+
it('should won\'t call onClick callback if props disable set to "true"', function () {
|
|
68
|
+
var mockCLick = jest.fn();
|
|
69
|
+
wrapper.rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
70
|
+
item: {
|
|
71
|
+
label: 'Test1',
|
|
72
|
+
id: 'test1'
|
|
73
|
+
},
|
|
74
|
+
onCLick: mockCLick,
|
|
75
|
+
selectType: "test1",
|
|
76
|
+
disabled: true
|
|
77
|
+
}));
|
|
78
|
+
var selectOption = wrapper.getByTestId('select-option');
|
|
79
|
+
|
|
80
|
+
_react2.fireEvent.click(selectOption);
|
|
81
|
+
|
|
82
|
+
expect(mockCLick).toHaveBeenCalledTimes(0);
|
|
83
|
+
});
|
|
84
|
+
it('should display subLabel if it exists in props item', function () {
|
|
85
|
+
expect(wrapper.queryByTestId('tooltip-wrapper')).not.toBeNull();
|
|
86
|
+
});
|
|
87
|
+
it('should add class "disabled" to SelectOption if props disabled set to "true"', function () {
|
|
88
|
+
wrapper.rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
89
|
+
item: {
|
|
90
|
+
label: 'Test1',
|
|
91
|
+
id: 'test1'
|
|
92
|
+
},
|
|
93
|
+
selectType: "test1",
|
|
94
|
+
disabled: true
|
|
95
|
+
}));
|
|
96
|
+
var selectOption = wrapper.getByTestId('select-option');
|
|
97
|
+
expect(selectOption.className).toMatch('disabled');
|
|
98
|
+
});
|
|
99
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@import '../../scss/colors';
|
|
2
|
+
@import '../../scss/mixins';
|
|
3
|
+
|
|
4
|
+
.select {
|
|
5
|
+
&__icon {
|
|
6
|
+
display: flex;
|
|
7
|
+
margin-right: 10px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&__item {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 49px;
|
|
15
|
+
padding: 0 15px;
|
|
16
|
+
|
|
17
|
+
&.hidden {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.checkbox {
|
|
22
|
+
flex: 1;
|
|
23
|
+
height: 100%;
|
|
24
|
+
|
|
25
|
+
svg {
|
|
26
|
+
margin: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: $alabaster;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.status {
|
|
36
|
+
margin: 0 10px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.all {
|
|
40
|
+
margin: 0;
|
|
41
|
+
|
|
42
|
+
@include statusState(none);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.label-row {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-flow: row nowrap;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
width: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.checkmark {
|
|
54
|
+
margin: 0 0 0 10px;
|
|
55
|
+
|
|
56
|
+
path {
|
|
57
|
+
fill: $chateauGreen;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _success_done = require("../../images/success_done.svg");
|
|
15
|
+
|
|
16
|
+
var _close = require("../../images/close.svg");
|
|
17
|
+
|
|
18
|
+
require("./ValidationTemplate.scss");
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
var ValidationTemplate = function ValidationTemplate(_ref) {
|
|
25
|
+
var valid = _ref.valid,
|
|
26
|
+
validationMessage = _ref.validationMessage;
|
|
27
|
+
var validationClasses = (0, _classnames.default)('validation-option', valid && 'text-muted');
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
29
|
+
className: validationClasses,
|
|
30
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
31
|
+
className: "validation-option__icon",
|
|
32
|
+
children: valid ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_success_done.ReactComponent, {
|
|
33
|
+
className: "validation-option__icon_valid"
|
|
34
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_close.ReactComponent, {
|
|
35
|
+
className: "validation-option__icon_invalid"
|
|
36
|
+
})
|
|
37
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
38
|
+
children: validationMessage
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
ValidationTemplate.propTypes = {
|
|
44
|
+
valid: _propTypes.default.bool.isRequired,
|
|
45
|
+
validationMessage: _propTypes.default.string.isRequired
|
|
46
|
+
};
|
|
47
|
+
var _default = ValidationTemplate;
|
|
48
|
+
exports.default = _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@import '../../scss/colors';
|
|
2
|
+
|
|
3
|
+
.validation-option {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: flex-start;
|
|
6
|
+
margin: 0.6rem 0;
|
|
7
|
+
padding: 0 1rem;
|
|
8
|
+
font-size: 0.875rem;
|
|
9
|
+
|
|
10
|
+
&__icon {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
width: 20px;
|
|
15
|
+
height: 20px;
|
|
16
|
+
margin-right: 0.5rem;
|
|
17
|
+
|
|
18
|
+
&_valid {
|
|
19
|
+
width: 14px;
|
|
20
|
+
height: 15px;
|
|
21
|
+
|
|
22
|
+
path {
|
|
23
|
+
fill: $brightTurquoise;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&_invalid {
|
|
28
|
+
width: 12px;
|
|
29
|
+
height: 12px;
|
|
30
|
+
|
|
31
|
+
path {
|
|
32
|
+
fill: $amaranth;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "OptionsMenu", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _OptionsMenu.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SelectOption", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _SelectOption.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "ValidationTemplate", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _ValidationTemplate.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _OptionsMenu = _interopRequireDefault(require("./OptionsMenu/OptionsMenu"));
|
|
26
|
+
|
|
27
|
+
var _SelectOption = _interopRequireDefault(require("./SelectOption/SelectOption"));
|
|
28
|
+
|
|
29
|
+
var _ValidationTemplate = _interopRequireDefault(require("./ValidationTemplate/ValidationTemplate"));
|
|
30
|
+
|
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useDetectOutsideClick", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _useDetectOutsideClick.useDetectOutsideClick;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _useDetectOutsideClick = require("./useDetectOutsideClick");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDetectOutsideClick = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Hook for handling closing when clicking outside of an element
|
|
12
|
+
* @function useDetectOutsideClick
|
|
13
|
+
* @param {React.node} ref
|
|
14
|
+
* @param {function} handler A callback function to use on outside click
|
|
15
|
+
*/
|
|
16
|
+
var useDetectOutsideClick = function useDetectOutsideClick(ref, handler) {
|
|
17
|
+
(0, _react.useEffect)(function () {
|
|
18
|
+
var onClick = function onClick(e) {
|
|
19
|
+
e.stopPropagation(); // If the active element exists and is clicked outside of
|
|
20
|
+
|
|
21
|
+
if (ref.current !== null && !ref.current.contains(e.target)) {
|
|
22
|
+
handler(e);
|
|
23
|
+
}
|
|
24
|
+
}; // If the item is active (ie open) then listen for clicks outside
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
window.addEventListener('click', onClick);
|
|
28
|
+
return function () {
|
|
29
|
+
window.removeEventListener('click', onClick);
|
|
30
|
+
};
|
|
31
|
+
}, [ref, handler]);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.useDetectOutsideClick = useDetectOutsideClick;
|
package/dist/index.js
CHANGED
|
@@ -5,20 +5,28 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.types = exports.constants = exports.components = void 0;
|
|
8
|
+
exports.types = exports.hooks = exports.elements = exports.constants = exports.components = void 0;
|
|
9
9
|
|
|
10
10
|
var components = _interopRequireWildcard(require("./components"));
|
|
11
11
|
|
|
12
12
|
exports.components = components;
|
|
13
13
|
|
|
14
|
-
var types = _interopRequireWildcard(require("./types"));
|
|
15
|
-
|
|
16
|
-
exports.types = types;
|
|
17
|
-
|
|
18
14
|
var constants = _interopRequireWildcard(require("./constants"));
|
|
19
15
|
|
|
20
16
|
exports.constants = constants;
|
|
21
17
|
|
|
18
|
+
var elements = _interopRequireWildcard(require("./elements"));
|
|
19
|
+
|
|
20
|
+
exports.elements = elements;
|
|
21
|
+
|
|
22
|
+
var hooks = _interopRequireWildcard(require("./hooks"));
|
|
23
|
+
|
|
24
|
+
exports.hooks = hooks;
|
|
25
|
+
|
|
26
|
+
var types = _interopRequireWildcard(require("./types"));
|
|
27
|
+
|
|
28
|
+
exports.types = types;
|
|
29
|
+
|
|
22
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
31
|
|
|
24
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|