@punch-in/buffet-modern-custom 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.
@@ -0,0 +1,149 @@
1
+ var _excluded = ["disabled", "name", "onChange", "value", "tabIndex", "step"];
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
+ * DateTime
14
+ *
15
+ */
16
+
17
+ import React, { useState, useEffect } from 'react';
18
+ import moment from 'moment';
19
+ import PropTypes from 'prop-types';
20
+ import momentPropTypes from 'react-moment-proptypes';
21
+ import { isEmpty, cloneDeep } from 'lodash';
22
+ import { DatePicker, TimePicker } from '@punch-in/buffet-modern-core';
23
+ import Wrapper from './Wrapper';
24
+ var UNITS = ['hour', 'minute', 'second'];
25
+ export var getTimeString = function getTimeString(time) {
26
+ if (!time) {
27
+ return '';
28
+ }
29
+ var currTime = time || moment();
30
+ var timeObj = getTimeObject(currTime);
31
+ var timeString = Object.keys(timeObj).map(function (key) {
32
+ return timeObj[key] < 10 ? "0".concat(timeObj[key]) : timeObj[key];
33
+ }).join(':');
34
+ return timeString;
35
+ };
36
+ export var getTimeObject = function getTimeObject(time) {
37
+ var timeObj = {};
38
+ UNITS.forEach(function (unit) {
39
+ timeObj[unit] = time.get(unit);
40
+ });
41
+ return timeObj;
42
+ };
43
+ function DateTime(_ref) {
44
+ var disabled = _ref.disabled,
45
+ name = _ref.name,
46
+ onChange = _ref.onChange,
47
+ value = _ref.value,
48
+ tabIndex = _ref.tabIndex,
49
+ step = _ref.step,
50
+ rest = _objectWithoutProperties(_ref, _excluded);
51
+ var _useState = useState(null),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ timestamp = _useState2[0],
54
+ setTimestamp = _useState2[1];
55
+ var setData = function setData(time) {
56
+ var _time$split = time.split(':'),
57
+ _time$split2 = _slicedToArray(_time$split, 3),
58
+ hour = _time$split2[0],
59
+ minute = _time$split2[1],
60
+ second = _time$split2[2];
61
+ var timeObj = {
62
+ hour: hour,
63
+ minute: minute,
64
+ second: second
65
+ };
66
+ var currentDate = isEmpty(timestamp) ? moment() : cloneDeep(timestamp);
67
+ currentDate.set('hours', timeObj.hour);
68
+ currentDate.set('minute', timeObj.minute);
69
+ currentDate.set('second', timeObj.second);
70
+ setDate(currentDate);
71
+ };
72
+ var setDate = function setDate(date, time) {
73
+ // Clearing the date
74
+ if (date === null) {
75
+ setTimestamp(null);
76
+ onChange({
77
+ target: {
78
+ name: name,
79
+ type: 'datetime',
80
+ value: null
81
+ }
82
+ });
83
+ return;
84
+ }
85
+ var newDate = time || date;
86
+ date.set(getTimeObject(newDate));
87
+ date.toISOString();
88
+ date.format();
89
+ setTimestamp(date);
90
+ onChange({
91
+ target: {
92
+ name: name,
93
+ type: 'datetime',
94
+ value: date
95
+ }
96
+ });
97
+ };
98
+ useEffect(function () {
99
+ if (!!value && moment(value).isValid()) {
100
+ var newDate = value._isAMomentObject === true ? value : moment(value);
101
+ setTimestamp(newDate);
102
+ }
103
+ }, [value]);
104
+ return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(DatePicker, _extends({}, rest, {
105
+ name: "datetime",
106
+ disabled: disabled,
107
+ onChange: function onChange(_ref2) {
108
+ var target = _ref2.target;
109
+ setDate(target.value, timestamp);
110
+ },
111
+ tabIndex: tabIndex,
112
+ value: timestamp
113
+ })), /*#__PURE__*/React.createElement(TimePicker, {
114
+ name: "time",
115
+ disabled: disabled,
116
+ onChange: function onChange(_ref3) {
117
+ var target = _ref3.target;
118
+ setData(target.value);
119
+ },
120
+ seconds: false,
121
+ tabIndex: tabIndex,
122
+ value: getTimeString(timestamp) || '',
123
+ step: step
124
+ }));
125
+ }
126
+ DateTime.defaultProps = {
127
+ autoFocus: false,
128
+ disabled: false,
129
+ id: null,
130
+ onChange: function onChange() {},
131
+ placeholder: null,
132
+ tabIndex: '0',
133
+ value: null,
134
+ withDefaultValue: false,
135
+ step: 30
136
+ };
137
+ DateTime.propTypes = {
138
+ autoFocus: PropTypes.bool,
139
+ disabled: PropTypes.bool,
140
+ id: PropTypes.string,
141
+ name: PropTypes.string.isRequired,
142
+ onChange: PropTypes.func,
143
+ placeholder: PropTypes.string,
144
+ step: PropTypes.number,
145
+ tabIndex: PropTypes.string,
146
+ value: PropTypes.oneOfType([momentPropTypes.momentObj, PropTypes.string, PropTypes.instanceOf(Date)]),
147
+ withDefaultValue: PropTypes.bool
148
+ };
149
+ export default DateTime;
@@ -0,0 +1,86 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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; } }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ /**
8
+ *
9
+ * Header
10
+ *
11
+ */
12
+
13
+ import React, { useEffect, useRef, useState } from 'react';
14
+ import PropTypes from 'prop-types';
15
+ import { HeaderTitle, HeaderActions } from '@punch-in/buffet-modern-core';
16
+ import { Header as Wrapper, LoadingBar } from '@punch-in/buffet-modern';
17
+ function Header(_ref) {
18
+ var actions = _ref.actions,
19
+ content = _ref.content,
20
+ isLoading = _ref.isLoading,
21
+ stickable = _ref.stickable,
22
+ title = _ref.title;
23
+ var _useState = useState(false),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ isHeaderSticky = _useState2[0],
26
+ setHeaderSticky = _useState2[1];
27
+ var headerRef = useRef(null);
28
+ var label = title.label,
29
+ cta = title.cta;
30
+ var handleScroll = function handleScroll() {
31
+ if (headerRef.current) {
32
+ setHeaderSticky(headerRef.current.getBoundingClientRect().top <= 20);
33
+ }
34
+ };
35
+ useEffect(function () {
36
+ window.addEventListener('scroll', handleScroll);
37
+ return function () {
38
+ window.removeEventListener('scroll', function () {
39
+ return handleScroll;
40
+ });
41
+ };
42
+ }, []);
43
+ return /*#__PURE__*/React.createElement(Wrapper, {
44
+ ref: headerRef
45
+ }, /*#__PURE__*/React.createElement("div", {
46
+ className: "sticky-wrapper".concat(isHeaderSticky && stickable ? ' sticky' : '')
47
+ }, /*#__PURE__*/React.createElement("div", {
48
+ className: "row"
49
+ }, /*#__PURE__*/React.createElement("div", {
50
+ className: "col-sm-6 header-title"
51
+ }, /*#__PURE__*/React.createElement(HeaderTitle, {
52
+ title: label,
53
+ cta: cta
54
+ }), isLoading ? /*#__PURE__*/React.createElement(LoadingBar, null) : /*#__PURE__*/React.createElement("p", null, content)), /*#__PURE__*/React.createElement("div", {
55
+ className: "col-sm-6 justify-content-end"
56
+ }, /*#__PURE__*/React.createElement(HeaderActions, {
57
+ actions: actions
58
+ })))));
59
+ }
60
+ Header.defaultProps = {
61
+ actions: [],
62
+ content: null,
63
+ isLoading: false,
64
+ stickable: true,
65
+ title: {
66
+ label: null,
67
+ cta: null
68
+ }
69
+ };
70
+ Header.propTypes = {
71
+ actions: PropTypes.arrayOf(PropTypes.shape({
72
+ onClick: PropTypes.func,
73
+ title: PropTypes.string
74
+ })),
75
+ content: PropTypes.string,
76
+ isLoading: PropTypes.bool,
77
+ stickable: PropTypes.bool,
78
+ title: PropTypes.shape({
79
+ cta: PropTypes.shape({
80
+ icon: PropTypes.string,
81
+ onClick: PropTypes.func
82
+ }),
83
+ label: PropTypes.string
84
+ })
85
+ };
86
+ export default Header;
@@ -0,0 +1,17 @@
1
+ var _templateObject, _templateObject2, _templateObject3;
2
+ function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
3
+ /**
4
+ *
5
+ * Wrapper
6
+ *
7
+ */
8
+
9
+ import styled, { css } from 'styled-components';
10
+ import { colors, sizes } from '@punch-in/buffet-modern';
11
+ var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n padding-bottom: ", "px;\n label {\n display: block;\n margin-bottom: 1rem;\n }\n > p {\n width: 100%;\n padding-top: 10px;\n font-size: 13px;\n line-height: normal;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: -8px;\n }\n input[type='checkbox'] {\n margin-bottom: 13px;\n }\n ", "\n"])), sizes.margin * 2.7, function (_ref) {
12
+ var error = _ref.error;
13
+ return !!error && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n input,\n textarea,\n select {\n border-color: ", ";\n }\n "])), colors.darkOrange);
14
+ });
15
+ var IconWrapper = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: 5px;\n cursor: pointer;\n"])));
16
+ export default Wrapper;
17
+ export { IconWrapper };
@@ -0,0 +1,197 @@
1
+ var _excluded = ["customInputs", "description", "error", "id", "label", "name", "onBlur", "onChange", "translatedErrors", "type", "validations", "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
+ * Inputs
14
+ *
15
+ */
16
+
17
+ import React, { useMemo, useRef, useState } from 'react';
18
+ import PropTypes from 'prop-types';
19
+ import { get, isEmpty, isFunction, isUndefined } from 'lodash';
20
+ import { DatePicker, Checkbox, Enumeration, Error, InputNumber, InputText, Label, Select, Textarea, TimePicker, Toggle, UnknownInput } from '@punch-in/buffet-modern-core';
21
+ import { Description, ErrorMessage, Tooltip } from '@punch-in/buffet-modern';
22
+ import DateTime from '../DateTime';
23
+ import Wrapper, { IconWrapper } from './Wrapper';
24
+ /* eslint-disable react/forbid-prop-types */
25
+
26
+ var inputs = {
27
+ bool: Toggle,
28
+ checkbox: Checkbox,
29
+ date: DatePicker,
30
+ datetime: DateTime,
31
+ "enum": Enumeration,
32
+ number: InputNumber,
33
+ text: InputText,
34
+ textarea: Textarea,
35
+ time: TimePicker,
36
+ select: Select,
37
+ email: InputText,
38
+ password: InputText,
39
+ search: InputText
40
+ };
41
+ function Inputs(_ref) {
42
+ var customInputs = _ref.customInputs,
43
+ description = _ref.description,
44
+ inputError = _ref.error,
45
+ id = _ref.id,
46
+ label = _ref.label,
47
+ name = _ref.name,
48
+ handleBlur = _ref.onBlur,
49
+ _onChange = _ref.onChange,
50
+ translatedErrors = _ref.translatedErrors,
51
+ type = _ref.type,
52
+ validations = _ref.validations,
53
+ value = _ref.value,
54
+ rest = _objectWithoutProperties(_ref, _excluded);
55
+ var _useState = useState(false),
56
+ _useState2 = _slicedToArray(_useState, 2),
57
+ isOver = _useState2[0],
58
+ setIsOver = _useState2[1];
59
+ var inputValue = useMemo(function () {
60
+ var ret;
61
+ switch (type) {
62
+ case 'checkbox':
63
+ ret = value || false;
64
+ break;
65
+ case 'bool':
66
+ ret = value;
67
+ break;
68
+ case 'number':
69
+ ret = isUndefined(value) ? '' : value;
70
+ break;
71
+ default:
72
+ ret = value || '';
73
+ }
74
+ return ret;
75
+ }, [type, value]);
76
+ var allInputs = useRef(Object.assign(inputs, customInputs));
77
+ var InputComponent = allInputs.current[type] || UnknownInput;
78
+ var inputId = useMemo(function () {
79
+ return id || name;
80
+ }, [id, name]);
81
+ var descriptionId = "description-".concat(inputId);
82
+ var errorId = "error-".concat(inputId);
83
+ var handleMouseEvent = function handleMouseEvent() {
84
+ setIsOver(function (prev) {
85
+ return !prev;
86
+ });
87
+ };
88
+ if (get(customInputs, type, null) !== null) {
89
+ return /*#__PURE__*/React.createElement(InputComponent, _extends({
90
+ description: description,
91
+ error: inputError,
92
+ label: label,
93
+ name: name,
94
+ onBlur: handleBlur,
95
+ onChange: _onChange,
96
+ type: type,
97
+ validations: validations,
98
+ value: value
99
+ }, rest));
100
+ }
101
+ return /*#__PURE__*/React.createElement(Error, {
102
+ inputError: inputError,
103
+ name: name,
104
+ translatedErrors: translatedErrors,
105
+ type: type,
106
+ validations: validations
107
+ }, function (_ref2) {
108
+ var canCheck = _ref2.canCheck,
109
+ onBlur = _ref2.onBlur,
110
+ error = _ref2.error,
111
+ dispatch = _ref2.dispatch;
112
+ return /*#__PURE__*/React.createElement(Wrapper, {
113
+ error: error
114
+ }, type !== 'checkbox' && /*#__PURE__*/React.createElement(Label, {
115
+ htmlFor: inputId
116
+ }, /*#__PURE__*/React.createElement("span", null, label, isEmpty(label) && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0")), rest.labelIcon && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconWrapper, {
117
+ "data-tip": rest.labelIcon.title,
118
+ "data-for": "icon-title",
119
+ onMouseEnter: handleMouseEvent,
120
+ onMouseLeave: handleMouseEvent
121
+ }, rest.labelIcon.icon), isOver && /*#__PURE__*/React.createElement(Tooltip, {
122
+ id: "icon-title"
123
+ }))), /*#__PURE__*/React.createElement(InputComponent, _extends({}, rest, {
124
+ message: label // Only for the checkbox
125
+ ,
126
+ name: name,
127
+ id: inputId,
128
+ "aria-describedby": "".concat(!error && description ? descriptionId : '', " ").concat(error ? errorId : ''),
129
+ "aria-invalid": error ? 'true' : 'false',
130
+ onBlur: isFunction(handleBlur) ? handleBlur : onBlur,
131
+ onChange: function onChange(e) {
132
+ if (!canCheck) {
133
+ dispatch({
134
+ type: 'SET_CHECK'
135
+ });
136
+ }
137
+ dispatch({
138
+ type: 'SET_ERROR',
139
+ error: null
140
+ });
141
+ _onChange(e);
142
+ },
143
+ type: type,
144
+ value: inputValue
145
+ })), !error && description && /*#__PURE__*/React.createElement(Description, {
146
+ id: descriptionId,
147
+ title: description
148
+ }, description), error && /*#__PURE__*/React.createElement(ErrorMessage, {
149
+ id: errorId
150
+ }, error));
151
+ });
152
+ }
153
+ Inputs.defaultProps = {
154
+ customInputs: null,
155
+ description: null,
156
+ id: null,
157
+ error: null,
158
+ label: null,
159
+ labelIcon: null,
160
+ onBlur: null,
161
+ onChange: function onChange() {},
162
+ translatedErrors: {
163
+ date: 'This is not a date',
164
+ email: 'This is not an email',
165
+ string: 'This is not a string',
166
+ number: 'This is not a number',
167
+ json: 'This is not a JSON',
168
+ max: 'This is too high',
169
+ maxLength: 'This is too long',
170
+ min: 'This is too small',
171
+ minLength: 'This is too short',
172
+ required: 'This value is required',
173
+ regex: 'This does not match the format',
174
+ uppercase: 'This must be a upper case string'
175
+ },
176
+ validations: {},
177
+ value: null
178
+ };
179
+ Inputs.propTypes = {
180
+ customInputs: PropTypes.object,
181
+ description: PropTypes.string,
182
+ error: PropTypes.string,
183
+ id: PropTypes.string,
184
+ label: PropTypes.string,
185
+ labelIcon: PropTypes.shape({
186
+ icon: PropTypes.any,
187
+ title: PropTypes.string
188
+ }),
189
+ name: PropTypes.string.isRequired,
190
+ onBlur: PropTypes.func,
191
+ onChange: function onChange() {},
192
+ translatedErrors: PropTypes.objectOf(PropTypes.string),
193
+ type: PropTypes.string.isRequired,
194
+ validations: PropTypes.object,
195
+ value: PropTypes.any
196
+ };
197
+ export default Inputs;
@@ -0,0 +1,56 @@
1
+ var _excluded = ["title", "subtitle", "button", "isLoading", "items", "customRowComponent"];
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
+ /**
5
+ *
6
+ * List
7
+ *
8
+ */
9
+
10
+ import React from 'react';
11
+ import PropTypes from 'prop-types';
12
+ import { List as ListCompo, ListHeader, Padded } from '@punch-in/buffet-modern-core';
13
+ import { Card } from '@punch-in/buffet-modern';
14
+ function List(_ref) {
15
+ var title = _ref.title,
16
+ subtitle = _ref.subtitle,
17
+ button = _ref.button,
18
+ isLoading = _ref.isLoading,
19
+ items = _ref.items,
20
+ customRowComponent = _ref.customRowComponent,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+ return /*#__PURE__*/React.createElement(Card, props, /*#__PURE__*/React.createElement(Padded, {
23
+ right: true,
24
+ left: true,
25
+ size: "md"
26
+ }, /*#__PURE__*/React.createElement(ListHeader, {
27
+ title: title,
28
+ subtitle: subtitle,
29
+ button: button
30
+ })), /*#__PURE__*/React.createElement(ListCompo, {
31
+ items: items,
32
+ isLoading: isLoading,
33
+ customRowComponent: customRowComponent
34
+ }));
35
+ }
36
+ List.defaultProps = {
37
+ button: null,
38
+ customRowComponent: null,
39
+ isLoading: false,
40
+ items: [],
41
+ title: null,
42
+ subtitle: null
43
+ };
44
+ List.propTypes = {
45
+ button: PropTypes.shape({
46
+ color: PropTypes.string,
47
+ icon: PropTypes.bool,
48
+ type: PropTypes.string
49
+ }),
50
+ customRowComponent: PropTypes.func,
51
+ isLoading: PropTypes.bool,
52
+ items: PropTypes.instanceOf(Array),
53
+ subtitle: PropTypes.string,
54
+ title: PropTypes.string
55
+ };
56
+ export default List;
@@ -0,0 +1,4 @@
1
+ export { default as DateTime } from './components/DateTime';
2
+ export { default as Header } from './components/Header';
3
+ export { default as Inputs } from './components/Inputs';
4
+ export { default as List } from './components/List';
package/build/index.js ADDED
@@ -0,0 +1,8 @@
1
+
2
+ 'use strict';
3
+
4
+ if (process.env.NODE_ENV === "production") {
5
+ module.exports = require("./bundle.production.js");
6
+ } else {
7
+ module.exports = require("./bundle.development.js");
8
+ }
@@ -0,0 +1,3 @@
1
+ const createIndexFile = require('../../scripts/createBuildIndexFile');
2
+
3
+ createIndexFile(__dirname);
package/jest.config.js ADDED
@@ -0,0 +1,14 @@
1
+ const rootConf = require('../../tools-configuration/jest.config.js');
2
+
3
+ module.exports = Object.assign({}, rootConf, {
4
+ moduleNameMapper: {
5
+ ...rootConf.moduleNameMapper,
6
+ },
7
+ testPathIgnorePatterns: [
8
+ '/node_modules/',
9
+ '/OLD/',
10
+ '/dist/',
11
+ '<rootDir>/build/',
12
+ ],
13
+ setupFilesAfterEnv: ['./test-bundler.js'],
14
+ });
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@punch-in/buffet-modern-custom",
3
+ "version": "3.3.11",
4
+ "description": "Buffetjs Custom Components",
5
+ "main": "build",
6
+ "module": "build/esm/index.js",
7
+ "sideEffects": [
8
+ "*.css"
9
+ ],
10
+ "scripts": {
11
+ "prebuild": "rimraf build",
12
+ "build": "npm run build:development && npm run build:production && npm run build:esm && npm run create:index",
13
+ "build:analyze": "cross-env NODE_ENV=production webpack-cli --json > build/stats.production.json && webpack-bundle-analyzer build/stats.production.json",
14
+ "build:development": "cross-env NODE_ENV=development webpack-cli",
15
+ "build:esm": "cross-env BABEL_ENV=esm babel ./src --out-dir ./build/esm --ignore \"**/*.test.js\" --ignore \"**/test.js\"",
16
+ "build:production": "cross-env NODE_ENV=production webpack-cli",
17
+ "build:watch": "npm run create:index && cross-env NODE_ENV=development webpack-cli -w",
18
+ "build:watch:esm": "cross-env BABEL_ENV=esm babel ./src --out-dir ./build/esm --ignore \"**/*.test.js\" --ignore \"**/test.js\" --watch",
19
+ "create:index": "node ./createBuildIndex.js",
20
+ "test": "cross-env NODE_ENV=development npm run test:lint && npm run test:style && npm run test:jest",
21
+ "test:jest": "jest --runInBand --no-cache --config=jest.config.js",
22
+ "test:jest:update": "jest --runInBand --no-cache --config=jest.config.js -u",
23
+ "test:jest:watch": "jest --config=jest.config.js --watchAll",
24
+ "test:lint": "eslint .",
25
+ "test:lint:quiet": "eslint . --quiet",
26
+ "test:prettier": "echo \"Error: no test specified\"",
27
+ "test:prettiers": "prettier-check \"**/*.js\"",
28
+ "test:style": "stylelint src/components/**/*.js",
29
+ "test:style:quiet": "stylelint src/components/**/*.js --quiet",
30
+ "lint:fix": "eslint . --fix",
31
+ "prepublishOnly": "npm run build"
32
+ },
33
+ "dependencies": {
34
+ "@punch-in/buffet-modern": "^3.3.11",
35
+ "@punch-in/buffet-modern-core": "^3.3.11",
36
+ "@punch-in/buffet-modern-utils": "^3.3.11",
37
+ "lodash": "4.17.21",
38
+ "moment": "^2.24.0",
39
+ "prop-types": "^15.7.2",
40
+ "react": "^16.14.0",
41
+ "react-dom": "^16.14.0",
42
+ "react-moment-proptypes": "^1.7.0",
43
+ "styled-components": "^5.3.10"
44
+ },
45
+ "devDependencies": {
46
+ "@babel/cli": "^7.1.5",
47
+ "@babel/core": "^7.1.6",
48
+ "@babel/eslint-parser": "^7.22.0",
49
+ "@babel/plugin-proposal-export-default-from": "^7.0.0",
50
+ "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
51
+ "@babel/plugin-proposal-function-bind": "^7.0.0",
52
+ "@babel/plugin-transform-class-properties": "^7.1.0",
53
+ "@babel/plugin-transform-flow-strip-types": "^7.1.6",
54
+ "@babel/preset-env": "^7.1.6",
55
+ "@babel/preset-flow": "^7.0.0",
56
+ "@babel/preset-react": "^7.0.0",
57
+ "@testing-library/jest-dom": "^5.11.2",
58
+ "@testing-library/react": "^10.4.7",
59
+ "@testing-library/react-hooks": "^3.4.1",
60
+ "babel-jest": "^23.6.0",
61
+ "babel-loader": "^8.0.4",
62
+ "babel-plugin-module-resolver": "3.0.0",
63
+ "bundlesize": "^0.17.0",
64
+ "cross-env": "^5.1.4",
65
+ "enzyme": "^3.10.0",
66
+ "enzyme-adapter-react-16": "^1.15.2",
67
+ "enzyme-to-json": "^3.5.0",
68
+ "eslint": "^7.5.0",
69
+ "eslint-config-airbnb": "^18.2.0",
70
+ "eslint-config-prettier": "^6.11.0",
71
+ "eslint-import-resolver-lerna": "^1.1.0",
72
+ "eslint-import-resolver-webpack": "^0.12.2",
73
+ "eslint-plugin-import": "^2.22.0",
74
+ "eslint-plugin-jest": "^23.19.0",
75
+ "eslint-plugin-jsx-a11y": "^6.3.1",
76
+ "eslint-plugin-react": "^7.20.5",
77
+ "eslint-plugin-react-hooks": "^4.0.8",
78
+ "jest-styled-components": "^7.0.0",
79
+ "mini-css-extract-plugin": "^0.4.0",
80
+ "rimraf": "^3.0.2",
81
+ "stylelint": "^13.6.1",
82
+ "stylelint-config-prettier": "^8.0.2",
83
+ "stylelint-config-rational-order": "^0.1.2",
84
+ "stylelint-config-standard": "^20.0.0",
85
+ "stylelint-config-styled-components": "^0.1.1",
86
+ "stylelint-processor-styled-components": "^1.10.0",
87
+ "url-loader": "^1.0.1",
88
+ "webpack": "~4.44.0",
89
+ "webpack-bundle-analyzer": "^3.8.0",
90
+ "webpack-cli": "~3.3.12"
91
+ },
92
+ "peerDependencies": {
93
+ "lodash": "4.17.21",
94
+ "react": "^16.9.0",
95
+ "react-dom": "^16.9.0",
96
+ "styled-components": "^5.0.0"
97
+ },
98
+ "keywords": [
99
+ "Buffetjs",
100
+ "react",
101
+ "components",
102
+ "styled-components"
103
+ ],
104
+ "author": "Strapi team",
105
+ "license": "MIT",
106
+ "publishConfig": {
107
+ "access": "public"
108
+ },
109
+ "repository": {
110
+ "type": "git",
111
+ "url": "https://github.com/strapi/buffet"
112
+ },
113
+ "gitHead": "63c6c13e0fd7feed8e0ea89f751b68b02ef767ea"
114
+ }
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components';
2
+
3
+ const Wrapper = styled.div`
4
+ display: flex;
5
+ > div:first-of-type {
6
+ margin-right: 10px;
7
+ }
8
+ > div:last-of-type {
9
+ width: 90px;
10
+ }
11
+ `;
12
+
13
+ export default Wrapper;