@punch-in/buffet-modern-core 3.3.11
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/README.md +50 -0
- package/babel.config.js +18 -0
- package/build/bundle.development.js +850 -0
- package/build/bundle.production.js +1 -0
- package/build/esm/components/AttributeIcon/Div.js +51 -0
- package/build/esm/components/AttributeIcon/index.js +53 -0
- package/build/esm/components/Button/index.js +75 -0
- package/build/esm/components/Checkbox/index.js +78 -0
- package/build/esm/components/Count/Wrapper.js +32 -0
- package/build/esm/components/Count/index.js +27 -0
- package/build/esm/components/DatePicker/index.js +206 -0
- package/build/esm/components/DatePicker/reducer.js +42 -0
- package/build/esm/components/Enumeration/index.js +54 -0
- package/build/esm/components/Error/index.js +137 -0
- package/build/esm/components/Error/reducer.js +23 -0
- package/build/esm/components/Flex/index.js +29 -0
- package/build/esm/components/HeaderActions/index.js +41 -0
- package/build/esm/components/HeaderTitle/index.js +45 -0
- package/build/esm/components/Icon/index.js +26 -0
- package/build/esm/components/IconLinks/index.js +36 -0
- package/build/esm/components/InputNumber/index.js +70 -0
- package/build/esm/components/InputText/PrefixIcon.js +32 -0
- package/build/esm/components/InputText/index.js +89 -0
- package/build/esm/components/Label/index.js +40 -0
- package/build/esm/components/List/index.js +50 -0
- package/build/esm/components/ListHeader/BaselineAlignement.js +5 -0
- package/build/esm/components/ListHeader/index.js +52 -0
- package/build/esm/components/ListRow/index.js +30 -0
- package/build/esm/components/ListRow/tests/index.tests.js +21 -0
- package/build/esm/components/NavTabs/index.js +38 -0
- package/build/esm/components/Option/RemoveButton.js +5 -0
- package/build/esm/components/Option/index.js +32 -0
- package/build/esm/components/Padded/index.js +56 -0
- package/build/esm/components/Paging/index.js +57 -0
- package/build/esm/components/Picker/PickerButton.js +61 -0
- package/build/esm/components/Picker/PickerSection.js +48 -0
- package/build/esm/components/Picker/PickerWrapper.js +5 -0
- package/build/esm/components/Picker/index.js +50 -0
- package/build/esm/components/PrefixIcon/index.js +7 -0
- package/build/esm/components/Select/index.js +82 -0
- package/build/esm/components/Separator/index.js +44 -0
- package/build/esm/components/Table/ActionCollapse.js +40 -0
- package/build/esm/components/Table/index.js +140 -0
- package/build/esm/components/Table/tests/index.js +130 -0
- package/build/esm/components/TableHeader/index.js +88 -0
- package/build/esm/components/TableRow/index.js +93 -0
- package/build/esm/components/Text/index.js +67 -0
- package/build/esm/components/Textarea/index.js +16 -0
- package/build/esm/components/TimePicker/index.js +288 -0
- package/build/esm/components/Toggle/index.js +72 -0
- package/build/esm/components/UnknownInput/index.js +19 -0
- package/build/esm/index.js +33 -0
- package/build/esm/theme/colors.js +48 -0
- package/build/index.js +8 -0
- package/package.json +123 -0
- package/src/components/AttributeIcon/Div.js +63 -0
- package/src/components/AttributeIcon/index.js +72 -0
- package/src/components/Button/index.js +95 -0
- package/src/components/Checkbox/index.js +86 -0
- package/src/components/Checkbox/tests/Checkbox.test.js +49 -0
- package/src/components/Count/Wrapper.js +36 -0
- package/src/components/Count/index.js +30 -0
- package/src/components/DatePicker/index.js +213 -0
- package/src/components/DatePicker/reducer.js +27 -0
- package/src/components/DatePicker/tests/__snapshots__/index.test.js.snap +301 -0
- package/src/components/DatePicker/tests/index.test.js +111 -0
- package/src/components/Enumeration/index.js +71 -0
- package/src/components/Enumeration/tests/index.test.js +41 -0
- package/src/components/Error/index.js +118 -0
- package/src/components/Error/reducer.js +14 -0
- package/src/components/Flex/index.js +25 -0
- package/src/components/Flex/tests/__snapshots__/index.test.js.snap +28 -0
- package/src/components/Flex/tests/index.test.js +11 -0
- package/src/components/HeaderActions/index.js +52 -0
- package/src/components/HeaderActions/tests/index.test.js +15 -0
- package/src/components/HeaderTitle/index.js +59 -0
- package/src/components/HeaderTitle/tests/index.test.js +15 -0
- package/src/components/Icon/index.js +50 -0
- package/src/components/Icon/tests/Icon.test.js +33 -0
- package/src/components/IconLinks/index.js +39 -0
- package/src/components/IconLinks/tests/index.test.js +27 -0
- package/src/components/InputNumber/index.js +74 -0
- package/src/components/InputText/PrefixIcon.js +38 -0
- package/src/components/InputText/index.js +88 -0
- package/src/components/Label/index.js +53 -0
- package/src/components/Label/tests/Label.test.js +38 -0
- package/src/components/List/index.js +56 -0
- package/src/components/List/tests/index.test.js +19 -0
- package/src/components/ListHeader/BaselineAlignement.js +7 -0
- package/src/components/ListHeader/index.js +58 -0
- package/src/components/ListHeader/tests/index.test.js +11 -0
- package/src/components/ListRow/index.js +34 -0
- package/src/components/ListRow/tests/index.tests.js +32 -0
- package/src/components/NavTabs/index.js +51 -0
- package/src/components/Option/RemoveButton.js +18 -0
- package/src/components/Option/index.js +32 -0
- package/src/components/Padded/index.js +47 -0
- package/src/components/Padded/tests/__snapshots__/index.test.js.snap +8 -0
- package/src/components/Padded/tests/index.test.js +11 -0
- package/src/components/Paging/index.js +66 -0
- package/src/components/Picker/PickerButton.js +84 -0
- package/src/components/Picker/PickerSection.js +41 -0
- package/src/components/Picker/PickerWrapper.js +7 -0
- package/src/components/Picker/index.js +44 -0
- package/src/components/Picker/tests/__snapshots__/pickerButton.test.js.snap +54 -0
- package/src/components/Picker/tests/__snapshots__/pickerSection.test.js.snap +20 -0
- package/src/components/Picker/tests/pickerButton.test.js +11 -0
- package/src/components/Picker/tests/pickerSection.test.js +11 -0
- package/src/components/PrefixIcon/index.js +11 -0
- package/src/components/Select/index.js +110 -0
- package/src/components/Select/tests/index.test.js +85 -0
- package/src/components/Separator/index.js +49 -0
- package/src/components/Table/ActionCollapse.js +53 -0
- package/src/components/Table/index.js +172 -0
- package/src/components/Table/tests/index.js +146 -0
- package/src/components/TableHeader/index.js +103 -0
- package/src/components/TableHeader/tests/index.test.js +85 -0
- package/src/components/TableRow/index.js +116 -0
- package/src/components/TableRow/tests/index.test.js +89 -0
- package/src/components/Text/index.js +62 -0
- package/src/components/Text/tests/__snapshots__/index.test.js.snap +19 -0
- package/src/components/Text/tests/index.test.js +11 -0
- package/src/components/Textarea/index.js +19 -0
- package/src/components/Textarea/tests/index.test.js +23 -0
- package/src/components/TimePicker/index.js +328 -0
- package/src/components/TimePicker/tests/index.test.js +95 -0
- package/src/components/Toggle/index.js +83 -0
- package/src/components/Toggle/tests/index.test.js +40 -0
- package/src/components/UnknownInput/index.js +20 -0
- package/src/index.js +33 -0
- package/src/theme/colors.js +48 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var _excluded = ["autoFocus", "id", "className", "name", "onChange", "tabIndex", "value"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* InputNumber
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import RcInputNumber from 'rc-input-number';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import { InputNumber as StyledInputNumber } from '@punch-in/buffet-modern';
|
|
15
|
+
function InputNumber(_ref) {
|
|
16
|
+
var autoFocus = _ref.autoFocus,
|
|
17
|
+
id = _ref.id,
|
|
18
|
+
className = _ref.className,
|
|
19
|
+
name = _ref.name,
|
|
20
|
+
onChange = _ref.onChange,
|
|
21
|
+
tabIndex = _ref.tabIndex,
|
|
22
|
+
value = _ref.value,
|
|
23
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
var handleChange = function handleChange(data) {
|
|
25
|
+
if (data !== null) {
|
|
26
|
+
var target = {
|
|
27
|
+
id: id,
|
|
28
|
+
name: name,
|
|
29
|
+
type: 'number',
|
|
30
|
+
value: data
|
|
31
|
+
};
|
|
32
|
+
onChange({
|
|
33
|
+
target: target
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/React.createElement(StyledInputNumber, {
|
|
38
|
+
className: className
|
|
39
|
+
}, /*#__PURE__*/React.createElement(RcInputNumber, _extends({}, rest, {
|
|
40
|
+
autoFocus: autoFocus,
|
|
41
|
+
id: id || name,
|
|
42
|
+
name: name,
|
|
43
|
+
onChange: handleChange,
|
|
44
|
+
tabIndex: tabIndex,
|
|
45
|
+
value: value,
|
|
46
|
+
className: "inputNumber"
|
|
47
|
+
})));
|
|
48
|
+
}
|
|
49
|
+
InputNumber.defaultProps = {
|
|
50
|
+
autoComplete: 'off',
|
|
51
|
+
autoFocus: false,
|
|
52
|
+
className: null,
|
|
53
|
+
id: null,
|
|
54
|
+
onChange: function onChange() {},
|
|
55
|
+
placeholder: null,
|
|
56
|
+
tabIndex: '0',
|
|
57
|
+
value: 0
|
|
58
|
+
};
|
|
59
|
+
InputNumber.propTypes = {
|
|
60
|
+
autoComplete: PropTypes.string,
|
|
61
|
+
autoFocus: PropTypes.bool,
|
|
62
|
+
className: PropTypes.string,
|
|
63
|
+
id: PropTypes.string,
|
|
64
|
+
name: PropTypes.string.isRequired,
|
|
65
|
+
onChange: PropTypes.func,
|
|
66
|
+
placeholder: PropTypes.string,
|
|
67
|
+
tabIndex: PropTypes.string,
|
|
68
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
69
|
+
};
|
|
70
|
+
export default InputNumber;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { IconText, IconWrapper } from '@punch-in/buffet-modern';
|
|
4
|
+
import Icon from '../Icon';
|
|
5
|
+
function PrefixIcon(_ref) {
|
|
6
|
+
var type = _ref.type,
|
|
7
|
+
icon = _ref.icon;
|
|
8
|
+
if (icon) {
|
|
9
|
+
return /*#__PURE__*/React.createElement(IconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
10
|
+
icon: icon
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
if (type === 'search') {
|
|
14
|
+
return /*#__PURE__*/React.createElement(IconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
15
|
+
icon: type
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
if (type === 'email') {
|
|
19
|
+
return /*#__PURE__*/React.createElement(IconText, {
|
|
20
|
+
text: "@"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
PrefixIcon.defaultProps = {
|
|
26
|
+
icon: null
|
|
27
|
+
};
|
|
28
|
+
PrefixIcon.propTypes = {
|
|
29
|
+
icon: PropTypes.node,
|
|
30
|
+
type: PropTypes.string.isRequired
|
|
31
|
+
};
|
|
32
|
+
export default PrefixIcon;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var _excluded = ["autoFocus", "className", "icon", "id", "name", "onChange", "tabIndex", "type", "value"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* InputText
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import PropTypes from 'prop-types';
|
|
19
|
+
import { IconWrapper, InputText as Input, InputWrapper } from '@punch-in/buffet-modern';
|
|
20
|
+
import Icon from '../Icon';
|
|
21
|
+
import PrefixIcon from './PrefixIcon';
|
|
22
|
+
function InputText(_ref) {
|
|
23
|
+
var autoFocus = _ref.autoFocus,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
icon = _ref.icon,
|
|
26
|
+
id = _ref.id,
|
|
27
|
+
name = _ref.name,
|
|
28
|
+
onChange = _ref.onChange,
|
|
29
|
+
tabIndex = _ref.tabIndex,
|
|
30
|
+
type = _ref.type,
|
|
31
|
+
value = _ref.value,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
var _useState = useState(false),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
showPassword = _useState2[0],
|
|
36
|
+
togglePassword = _useState2[1];
|
|
37
|
+
return /*#__PURE__*/React.createElement(InputWrapper, {
|
|
38
|
+
className: className
|
|
39
|
+
}, /*#__PURE__*/React.createElement(PrefixIcon, {
|
|
40
|
+
icon: icon,
|
|
41
|
+
type: type
|
|
42
|
+
}), type === 'password' && /*#__PURE__*/React.createElement("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
onClick: function onClick() {
|
|
45
|
+
return togglePassword(!showPassword);
|
|
46
|
+
},
|
|
47
|
+
className: showPassword ? 'shown' : '',
|
|
48
|
+
tabIndex: "-1"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(IconWrapper, {
|
|
50
|
+
background: false
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
+
icon: type
|
|
53
|
+
}))), /*#__PURE__*/React.createElement(Input, _extends({
|
|
54
|
+
autoFocus: autoFocus,
|
|
55
|
+
id: id || name,
|
|
56
|
+
name: name,
|
|
57
|
+
onChange: onChange,
|
|
58
|
+
tabIndex: tabIndex,
|
|
59
|
+
type: showPassword ? 'text' : type,
|
|
60
|
+
value: value,
|
|
61
|
+
icon: icon
|
|
62
|
+
}, rest)));
|
|
63
|
+
}
|
|
64
|
+
InputText.defaultProps = {
|
|
65
|
+
autoComplete: 'off',
|
|
66
|
+
autoFocus: false,
|
|
67
|
+
className: null,
|
|
68
|
+
icon: null,
|
|
69
|
+
id: null,
|
|
70
|
+
onChange: function onChange() {},
|
|
71
|
+
placeholder: null,
|
|
72
|
+
tabIndex: '0',
|
|
73
|
+
type: 'text',
|
|
74
|
+
value: ''
|
|
75
|
+
};
|
|
76
|
+
InputText.propTypes = {
|
|
77
|
+
autoComplete: PropTypes.string,
|
|
78
|
+
autoFocus: PropTypes.bool,
|
|
79
|
+
className: PropTypes.string,
|
|
80
|
+
icon: PropTypes.node,
|
|
81
|
+
id: PropTypes.string,
|
|
82
|
+
name: PropTypes.string.isRequired,
|
|
83
|
+
onChange: PropTypes.func,
|
|
84
|
+
placeholder: PropTypes.string,
|
|
85
|
+
tabIndex: PropTypes.string,
|
|
86
|
+
type: PropTypes.string,
|
|
87
|
+
value: PropTypes.string
|
|
88
|
+
};
|
|
89
|
+
export default InputText;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Label
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { isFunction } from 'lodash';
|
|
10
|
+
import { Label as StyledLabel } from '@punch-in/buffet-modern';
|
|
11
|
+
function Label(props) {
|
|
12
|
+
var content = function () {
|
|
13
|
+
if (isFunction(props.message)) {
|
|
14
|
+
return props.message();
|
|
15
|
+
}
|
|
16
|
+
if (props.message) {
|
|
17
|
+
return props.message;
|
|
18
|
+
}
|
|
19
|
+
return props.children;
|
|
20
|
+
}();
|
|
21
|
+
return /*#__PURE__*/React.createElement(StyledLabel, {
|
|
22
|
+
htmlFor: props.htmlFor,
|
|
23
|
+
className: props.className
|
|
24
|
+
}, content);
|
|
25
|
+
}
|
|
26
|
+
Label.defaultProps = {
|
|
27
|
+
children: null,
|
|
28
|
+
className: null,
|
|
29
|
+
message: null
|
|
30
|
+
};
|
|
31
|
+
Label.propTypes = {
|
|
32
|
+
children: PropTypes.node,
|
|
33
|
+
className: PropTypes.string,
|
|
34
|
+
htmlFor: PropTypes.string.isRequired,
|
|
35
|
+
message: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({
|
|
36
|
+
id: PropTypes.string,
|
|
37
|
+
params: PropTypes.object
|
|
38
|
+
})])
|
|
39
|
+
};
|
|
40
|
+
export default Label;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* List
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { List as StyledList, LoadingIndicator } from '@punch-in/buffet-modern';
|
|
10
|
+
import ListRow from '../ListRow';
|
|
11
|
+
import Padded from '../Padded';
|
|
12
|
+
function List(_ref) {
|
|
13
|
+
var className = _ref.className,
|
|
14
|
+
items = _ref.items,
|
|
15
|
+
isLoading = _ref.isLoading,
|
|
16
|
+
customRowComponent = _ref.customRowComponent;
|
|
17
|
+
return /*#__PURE__*/React.createElement(StyledList, {
|
|
18
|
+
className: className
|
|
19
|
+
}, isLoading ? /*#__PURE__*/React.createElement(Padded, {
|
|
20
|
+
top: true,
|
|
21
|
+
bottom: true,
|
|
22
|
+
size: "md"
|
|
23
|
+
}, /*#__PURE__*/React.createElement(LoadingIndicator, null)) : /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, items.map(function (item, index) {
|
|
24
|
+
return customRowComponent ?
|
|
25
|
+
/*#__PURE__*/
|
|
26
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
27
|
+
React.createElement(React.Fragment, {
|
|
28
|
+
key: index
|
|
29
|
+
}, customRowComponent(item)) :
|
|
30
|
+
/*#__PURE__*/
|
|
31
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
32
|
+
React.createElement(ListRow, {
|
|
33
|
+
cells: item,
|
|
34
|
+
key: index
|
|
35
|
+
});
|
|
36
|
+
}))));
|
|
37
|
+
}
|
|
38
|
+
List.defaultProps = {
|
|
39
|
+
className: null,
|
|
40
|
+
customRowComponent: null,
|
|
41
|
+
isLoading: false,
|
|
42
|
+
items: []
|
|
43
|
+
};
|
|
44
|
+
List.propTypes = {
|
|
45
|
+
className: PropTypes.string,
|
|
46
|
+
customRowComponent: PropTypes.func,
|
|
47
|
+
isLoading: PropTypes.bool,
|
|
48
|
+
items: PropTypes.instanceOf(Array)
|
|
49
|
+
};
|
|
50
|
+
export default List;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
var BaselineAlignement = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 17px;\n"])));
|
|
5
|
+
export default BaselineAlignement;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* ListHeader
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { ListHeader as StyledListHeader } from '@punch-in/buffet-modern';
|
|
10
|
+
import Button from '../Button';
|
|
11
|
+
import Flex from '../Flex';
|
|
12
|
+
import Padded from '../Padded';
|
|
13
|
+
import Text from '../Text';
|
|
14
|
+
import BaselineAlignement from './BaselineAlignement';
|
|
15
|
+
function ListHeader(_ref) {
|
|
16
|
+
var button = _ref.button,
|
|
17
|
+
title = _ref.title,
|
|
18
|
+
subtitle = _ref.subtitle;
|
|
19
|
+
return /*#__PURE__*/React.createElement(StyledListHeader, null, /*#__PURE__*/React.createElement(Flex, {
|
|
20
|
+
justifyContent: "space-between"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Padded, {
|
|
22
|
+
top: true,
|
|
23
|
+
bottom: true,
|
|
24
|
+
size: "smd"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
26
|
+
fontSize: "lg",
|
|
27
|
+
fontWeight: "bold",
|
|
28
|
+
lineHeight: "18px"
|
|
29
|
+
}, title), subtitle && /*#__PURE__*/React.createElement(Padded, {
|
|
30
|
+
top: true,
|
|
31
|
+
size: "xs"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
33
|
+
fontSize: "md",
|
|
34
|
+
color: "grey",
|
|
35
|
+
lineHeight: "13px"
|
|
36
|
+
}, subtitle))), button && /*#__PURE__*/React.createElement(BaselineAlignement, null, /*#__PURE__*/React.createElement(Button, button))));
|
|
37
|
+
}
|
|
38
|
+
ListHeader.defaultProps = {
|
|
39
|
+
button: null,
|
|
40
|
+
title: null,
|
|
41
|
+
subtitle: null
|
|
42
|
+
};
|
|
43
|
+
ListHeader.propTypes = {
|
|
44
|
+
button: PropTypes.shape({
|
|
45
|
+
color: PropTypes.string,
|
|
46
|
+
icon: PropTypes.bool,
|
|
47
|
+
type: PropTypes.string
|
|
48
|
+
}),
|
|
49
|
+
subtitle: PropTypes.string,
|
|
50
|
+
title: PropTypes.string
|
|
51
|
+
};
|
|
52
|
+
export default ListHeader;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* ListRow
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { ListRow as StyledListRow } from '@punch-in/buffet-modern';
|
|
10
|
+
function ListRow(_ref) {
|
|
11
|
+
var cells = _ref.cells,
|
|
12
|
+
onClick = _ref.onClick;
|
|
13
|
+
return /*#__PURE__*/React.createElement(StyledListRow, {
|
|
14
|
+
onClick: onClick
|
|
15
|
+
}, Object.keys(cells).map(function (key) {
|
|
16
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
17
|
+
key: key,
|
|
18
|
+
className: "".concat(key, "-cell")
|
|
19
|
+
}, /*#__PURE__*/React.createElement("p", null, cells[key]));
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
ListRow.defaultProps = {
|
|
23
|
+
cells: {},
|
|
24
|
+
onClick: function onClick() {}
|
|
25
|
+
};
|
|
26
|
+
ListRow.propTypes = {
|
|
27
|
+
cells: PropTypes.instanceOf(Object),
|
|
28
|
+
onClick: PropTypes.func
|
|
29
|
+
};
|
|
30
|
+
export default ListRow;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import ListRow from '../index';
|
|
4
|
+
describe('<ListRow />', function () {
|
|
5
|
+
// eslint-disable-next-line jest/expect-expect
|
|
6
|
+
it('Should not crash', function () {
|
|
7
|
+
mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(ListRow, null))));
|
|
8
|
+
});
|
|
9
|
+
it('should display some cells', function () {
|
|
10
|
+
var cells = {
|
|
11
|
+
name: 'name',
|
|
12
|
+
test: 'test'
|
|
13
|
+
};
|
|
14
|
+
var renderedComponent = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(ListRow, {
|
|
15
|
+
cells: cells
|
|
16
|
+
}))));
|
|
17
|
+
var tds = renderedComponent.find('td');
|
|
18
|
+
expect(tds.at(0).text()).toBe('name');
|
|
19
|
+
expect(tds.at(1).text()).toBe('test');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* NavTabs
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { NavLink } from 'react-router-dom';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { Tab as StyledTab, colors } from '@punch-in/buffet-modern';
|
|
11
|
+
import { gradient } from '@punch-in/buffet-modern-utils';
|
|
12
|
+
function NavTabs(_ref) {
|
|
13
|
+
var links = _ref.links;
|
|
14
|
+
var color = colors.greyLink;
|
|
15
|
+
return /*#__PURE__*/React.createElement("ul", null, links.map(function (link, index) {
|
|
16
|
+
color = gradient(color, 1.5);
|
|
17
|
+
var content = link.label ? /*#__PURE__*/React.createElement("p", null, link.label) : link.compo || null;
|
|
18
|
+
return /*#__PURE__*/React.createElement(StyledTab, {
|
|
19
|
+
key: link.to,
|
|
20
|
+
index: index,
|
|
21
|
+
count: links.length,
|
|
22
|
+
background: color
|
|
23
|
+
}, /*#__PURE__*/React.createElement(NavLink, {
|
|
24
|
+
to: link.to
|
|
25
|
+
}, content));
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
NavTabs.defaultProps = {
|
|
29
|
+
links: []
|
|
30
|
+
};
|
|
31
|
+
NavTabs.propTypes = {
|
|
32
|
+
links: PropTypes.arrayOf(PropTypes.shape({
|
|
33
|
+
compo: PropTypes.node,
|
|
34
|
+
label: PropTypes.string,
|
|
35
|
+
to: PropTypes.string
|
|
36
|
+
}))
|
|
37
|
+
};
|
|
38
|
+
export default NavTabs;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
var RemoveButton = styled.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-items: center;\n height: 13px;\n padding-left: 10px;\n padding-right: 10px;\n margin-left: 10px;\n background-color: transparent;\n border: 0;\n border-left: 1px solid rgba(0, 126, 255, 0.1);\n &:focus {\n outline: 0;\n }\n"])));
|
|
5
|
+
export default RemoveButton;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var _excluded = ["label", "onClick"];
|
|
2
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { Remove } from '@punch-in/buffet-modern-icons';
|
|
7
|
+
import { Option as Wrapper } from '@punch-in/buffet-modern';
|
|
8
|
+
import { upperFirst } from 'lodash';
|
|
9
|
+
import RemoveButton from './RemoveButton';
|
|
10
|
+
function Filter(_ref) {
|
|
11
|
+
var label = _ref.label,
|
|
12
|
+
onClick = _ref.onClick,
|
|
13
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
var content = typeof label === 'string' ? /*#__PURE__*/React.createElement("span", null, upperFirst(label)) : label;
|
|
15
|
+
return /*#__PURE__*/React.createElement(Wrapper, rest, content, /*#__PURE__*/React.createElement(RemoveButton, {
|
|
16
|
+
type: "button",
|
|
17
|
+
onClick: onClick
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Remove, {
|
|
19
|
+
width: "11px",
|
|
20
|
+
height: "11px",
|
|
21
|
+
fill: "#007eff"
|
|
22
|
+
})));
|
|
23
|
+
}
|
|
24
|
+
Filter.defaultProps = {
|
|
25
|
+
label: '',
|
|
26
|
+
onClick: function onClick() {}
|
|
27
|
+
};
|
|
28
|
+
Filter.propTypes = {
|
|
29
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
30
|
+
onClick: PropTypes.func
|
|
31
|
+
};
|
|
32
|
+
export default Filter;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
var Padded = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (_ref) {
|
|
6
|
+
var theme = _ref.theme,
|
|
7
|
+
size = _ref.size,
|
|
8
|
+
top = _ref.top;
|
|
9
|
+
return top && (theme.main.sizes.paddings[size] || size);
|
|
10
|
+
}, function (_ref2) {
|
|
11
|
+
var theme = _ref2.theme,
|
|
12
|
+
size = _ref2.size,
|
|
13
|
+
right = _ref2.right;
|
|
14
|
+
return right && (theme.main.sizes.paddings[size] || size);
|
|
15
|
+
}, function (_ref3) {
|
|
16
|
+
var theme = _ref3.theme,
|
|
17
|
+
size = _ref3.size,
|
|
18
|
+
bottom = _ref3.bottom;
|
|
19
|
+
return bottom && (theme.main.sizes.paddings[size] || size);
|
|
20
|
+
}, function (_ref4) {
|
|
21
|
+
var theme = _ref4.theme,
|
|
22
|
+
size = _ref4.size,
|
|
23
|
+
left = _ref4.left;
|
|
24
|
+
return left && (theme.main.sizes.paddings[size] || size);
|
|
25
|
+
});
|
|
26
|
+
Padded.defaultProps = {
|
|
27
|
+
bottom: false,
|
|
28
|
+
left: false,
|
|
29
|
+
right: false,
|
|
30
|
+
size: 'sm',
|
|
31
|
+
top: false,
|
|
32
|
+
// TODO : This is temporary
|
|
33
|
+
theme: {
|
|
34
|
+
main: {
|
|
35
|
+
sizes: {
|
|
36
|
+
paddings: {
|
|
37
|
+
xs: '5px',
|
|
38
|
+
sm: '10px',
|
|
39
|
+
smd: '20px',
|
|
40
|
+
md: '30px',
|
|
41
|
+
lg: '40px'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
Padded.propTypes = {
|
|
48
|
+
bottom: PropTypes.bool,
|
|
49
|
+
left: PropTypes.bool,
|
|
50
|
+
right: PropTypes.bool,
|
|
51
|
+
size: PropTypes.string,
|
|
52
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
53
|
+
theme: PropTypes.object,
|
|
54
|
+
top: PropTypes.bool
|
|
55
|
+
};
|
|
56
|
+
export default Padded;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Paging
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Pagination, PaginationItem, PaginationLink } from 'reactstrap';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { Paging as StyledPaging } from '@punch-in/buffet-modern';
|
|
11
|
+
import Icon from '../Icon';
|
|
12
|
+
/* eslint-disable react/no-array-index-key */
|
|
13
|
+
|
|
14
|
+
function Paging(_ref) {
|
|
15
|
+
var count = _ref.count,
|
|
16
|
+
page = _ref.page,
|
|
17
|
+
onChange = _ref.onChange,
|
|
18
|
+
range = _ref.range;
|
|
19
|
+
var pagesCount = Math.ceil(count / range);
|
|
20
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledPaging, null), /*#__PURE__*/React.createElement(Pagination, {
|
|
21
|
+
"aria-label": "Page navigation"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(PaginationItem, null, /*#__PURE__*/React.createElement(PaginationLink, {
|
|
23
|
+
onClick: onChange,
|
|
24
|
+
value: 0
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
26
|
+
icon: "left"
|
|
27
|
+
}))), Array(pagesCount).fill(1).map(function (item, index) {
|
|
28
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
29
|
+
key: index
|
|
30
|
+
}, /*#__PURE__*/React.createElement(PaginationItem, {
|
|
31
|
+
key: index,
|
|
32
|
+
onClick: onChange,
|
|
33
|
+
className: page === index * range ? 'selected' : ''
|
|
34
|
+
}, /*#__PURE__*/React.createElement(PaginationLink, {
|
|
35
|
+
onClick: onChange,
|
|
36
|
+
value: index * range
|
|
37
|
+
}, index + 1)));
|
|
38
|
+
}), /*#__PURE__*/React.createElement(PaginationItem, null, /*#__PURE__*/React.createElement(PaginationLink, {
|
|
39
|
+
onClick: onChange,
|
|
40
|
+
value: (pagesCount - 1) * range
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
42
|
+
icon: "right"
|
|
43
|
+
})))));
|
|
44
|
+
}
|
|
45
|
+
Paging.defaultProps = {
|
|
46
|
+
count: 0,
|
|
47
|
+
onChange: function onChange() {},
|
|
48
|
+
page: 0,
|
|
49
|
+
range: 15
|
|
50
|
+
};
|
|
51
|
+
Paging.propTypes = {
|
|
52
|
+
count: PropTypes.number,
|
|
53
|
+
onChange: PropTypes.func,
|
|
54
|
+
page: PropTypes.number,
|
|
55
|
+
range: PropTypes.number
|
|
56
|
+
};
|
|
57
|
+
export default Paging;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import Text from '../Text';
|
|
8
|
+
import colors from '../../theme/colors';
|
|
9
|
+
var PickerButton = styled(function (props) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
11
|
+
as: "button",
|
|
12
|
+
fontWeight: "semiBold",
|
|
13
|
+
color: props.isActive ? 'mediumBlue' : 'greyDark'
|
|
14
|
+
}, props));
|
|
15
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n height: 30px;\n padding: 0 10px;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", ";\n &:active,\n &:focus {\n outline: 0;\n }\n\n > svg + span,\n > span + svg {\n margin-left: 10px;\n }\n > svg g {\n stroke: ", ";\n }\n\n ", "\n"])), function (_ref) {
|
|
16
|
+
var theme = _ref.theme;
|
|
17
|
+
return theme.main.colors.white;
|
|
18
|
+
}, function (_ref2) {
|
|
19
|
+
var theme = _ref2.theme;
|
|
20
|
+
return theme.main.colors.darkGrey;
|
|
21
|
+
}, function (_ref3) {
|
|
22
|
+
var theme = _ref3.theme;
|
|
23
|
+
return theme.main.sizes.borderRadius;
|
|
24
|
+
}, function (_ref4) {
|
|
25
|
+
var theme = _ref4.theme;
|
|
26
|
+
return theme.main.colors.greyDark;
|
|
27
|
+
}, function (_ref5) {
|
|
28
|
+
var isActive = _ref5.isActive,
|
|
29
|
+
theme = _ref5.theme;
|
|
30
|
+
return isActive ? "\n background-color: ".concat(theme.main.colors.lightBlue, ";\n border: 1px solid ").concat(theme.main.colors.darkBlue, ";\n color: ").concat(theme.main.colors.mediumBlue, ";\n > svg g {\n stroke: ").concat(theme.main.colors.mediumBlue, ";\n }\n ") : "\n &:hover {\n background-color: ".concat(theme.main.colors.lightestGrey, ";\n }\n ");
|
|
31
|
+
});
|
|
32
|
+
PickerButton.defaultProps = {
|
|
33
|
+
isActive: false,
|
|
34
|
+
type: 'button',
|
|
35
|
+
// TODO : This is temporary
|
|
36
|
+
theme: {
|
|
37
|
+
main: {
|
|
38
|
+
colors: colors,
|
|
39
|
+
sizes: {
|
|
40
|
+
borderRadius: '2px',
|
|
41
|
+
fonts: {
|
|
42
|
+
xs: '11px',
|
|
43
|
+
sm: '12px',
|
|
44
|
+
md: '13px',
|
|
45
|
+
lg: '18px'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
fontWeights: {
|
|
49
|
+
regular: 400,
|
|
50
|
+
semiBold: 500,
|
|
51
|
+
bold: 600,
|
|
52
|
+
black: 900
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
PickerButton.propTypes = {
|
|
58
|
+
isActive: PropTypes.bool,
|
|
59
|
+
type: PropTypes.string
|
|
60
|
+
};
|
|
61
|
+
export default PickerButton;
|