dibk-design 1.0.15 → 1.1.2

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,21 @@
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 _CheckBoxListModule = _interopRequireDefault(require("./CheckBoxList.module.scss"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ var CheckBoxList = function CheckBoxList(props) {
15
+ return /*#__PURE__*/_react.default.createElement("ul", {
16
+ className: _CheckBoxListModule.default.checkBoxList
17
+ }, props.children);
18
+ };
19
+
20
+ var _default = CheckBoxList;
21
+ exports.default = _default;
@@ -0,0 +1,26 @@
1
+ Ordered List example:
2
+
3
+ ```js
4
+ import CheckBoxListItem from "lib/components/CheckBoxListItem";
5
+ <CheckBoxList>
6
+ <CheckBoxListItem
7
+ onChange={() => {
8
+ console.log("onchange");
9
+ }}
10
+ checked={true}
11
+ name="checkboxlist"
12
+ id="checkboxList-listItem-1"
13
+ >
14
+ Label for checked checkbox
15
+ </CheckBoxListItem>
16
+ <CheckBoxListItem
17
+ onChange={() => {
18
+ console.log("onchange");
19
+ }}
20
+ name="checkboxlist"
21
+ id="checkboxList-listItem-2"
22
+ >
23
+ Label for unchecked checkbox
24
+ </CheckBoxListItem>
25
+ </CheckBoxList>;
26
+ ```
@@ -0,0 +1,5 @@
1
+ :local(.checkBoxList) {
2
+ margin: 0;
3
+ padding: 0;
4
+ list-style: none;
5
+ }
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -13,64 +11,35 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
 
14
12
  var _CheckBoxInput = _interopRequireDefault(require("./CheckBoxInput"));
15
13
 
14
+ var _helpers = require("../functions/helpers");
15
+
16
16
  var _CheckBoxListItemModule = _interopRequireDefault(require("./CheckBoxListItem.module.scss"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
22
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
-
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
-
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
-
30
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
-
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
33
-
34
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
-
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
-
40
- var CheckBoxListItem = /*#__PURE__*/function (_React$Component) {
41
- _inherits(CheckBoxListItem, _React$Component);
42
-
43
- var _super = _createSuper(CheckBoxListItem);
44
-
45
- function CheckBoxListItem() {
46
- _classCallCheck(this, CheckBoxListItem);
47
-
48
- return _super.apply(this, arguments);
49
- }
50
-
51
- _createClass(CheckBoxListItem, [{
52
- key: "render",
53
- value: function render() {
54
- return /*#__PURE__*/_react.default.createElement("div", {
55
- className: "".concat(_CheckBoxListItemModule.default.checkBoxListItem, " ").concat(this.props.checked ? _CheckBoxListItemModule.default.checked : '', " ").concat(this.props.disabled ? _CheckBoxListItemModule.default.disabled : '', " ").concat(this.props.contentOnly ? _CheckBoxListItemModule.default.contentOnly : '', " ").concat(this.props.compact ? _CheckBoxListItemModule.default.compact : '', " ").concat(this.props.hasErrors ? _CheckBoxListItemModule.default.hasErrors : '')
56
- }, /*#__PURE__*/_react.default.createElement(_CheckBoxInput.default, {
57
- onChange: this.props.onChange,
58
- checked: this.props.checked,
59
- disabled: this.props.disabled,
60
- contentOnly: this.props.contentOnly,
61
- hasErrors: this.props.hasErrors,
62
- id: this.props.id,
63
- theme: this.props.theme,
64
- checkmarkCharacter: this.props.checkmarkCharacter
65
- }, this.props.children));
66
- }
67
- }]);
68
-
69
- return CheckBoxListItem;
70
- }(_react.default.Component);
20
+ // Dependencies
21
+ // Components
22
+ // Functions
23
+ // Stylesheets
24
+ var CheckBoxListItem = function CheckBoxListItem(props) {
25
+ var listItemClassNameArray = [_CheckBoxListItemModule.default.checkBoxListItem, props.checked ? _CheckBoxListItemModule.default.checked : null, props.disabled ? _CheckBoxListItemModule.default.disabled : null, props.compact ? _CheckBoxListItemModule.default.compact : null, props.contentOnly ? _CheckBoxListItemModule.default.contentOnly : null, props.hasErrors ? _CheckBoxListItemModule.default.hasErrors : null];
26
+ var listItemClassNameString = (0, _helpers.classNameArrayToClassNameString)(listItemClassNameArray);
27
+ var inputProps = {
28
+ onChange: props.onChange,
29
+ checked: props.checked,
30
+ disabled: props.disabled,
31
+ contentOnly: props.contentOnly,
32
+ hasErrors: props.hasErrors,
33
+ id: props.id,
34
+ theme: props.theme,
35
+ checkmarkCharacter: props.checkmarkCharacter
36
+ };
37
+ return /*#__PURE__*/_react.default.createElement("li", {
38
+ className: listItemClassNameString
39
+ }, /*#__PURE__*/_react.default.createElement(_CheckBoxInput.default, inputProps, props.children));
40
+ };
71
41
 
72
42
  CheckBoxListItem.propTypes = {
73
- /** Text content inside list item */
74
43
  checked: _propTypes.default.bool,
75
44
  disabled: _propTypes.default.bool,
76
45
  id: _propTypes.default.string.isRequired,
@@ -85,11 +54,11 @@ CheckBoxListItem.propTypes = {
85
54
  CheckBoxListItem.defaultProps = {
86
55
  checked: false,
87
56
  disabled: false,
88
- id: '',
89
- name: '',
57
+ id: "",
58
+ name: "",
90
59
  contentOnly: false,
91
60
  hasErrors: false,
92
- checkmarkCharacter: ''
61
+ checkmarkCharacter: ""
93
62
  };
94
63
  var _default = CheckBoxListItem;
95
64
  exports.default = _default;
@@ -112,7 +112,7 @@ var InputField = /*#__PURE__*/function (_React$Component) {
112
112
  max: this.props.max || null,
113
113
  onChange: this.props.onChange,
114
114
  onBlur: this.props.onBlur
115
- }, _defineProperty(_ref, defaultValue ? "defaultValue" : "value", defaultValue || this.props.value), _defineProperty(_ref, "placeholder", this.props.placeholder || null), _defineProperty(_ref, "className", this.props.hasErrors ? _InputFieldModule.default.hasErrors : ""), _defineProperty(_ref, "aria-required", this.props.mandatory), _defineProperty(_ref, "style", styleRules), _ref;
115
+ }, _defineProperty(_ref, defaultValue ? "defaultValue" : "value", defaultValue || this.props.value), _defineProperty(_ref, "placeholder", this.props.placeholder || null), _defineProperty(_ref, "className", this.props.hasErrors ? _InputFieldModule.default.hasErrors : null), _defineProperty(_ref, "aria-required", this.props.mandatory), _defineProperty(_ref, "aria-describedby", this.props["aria-describedby"] || null), _defineProperty(_ref, "style", styleRules), _ref;
116
116
  }
117
117
  }, {
118
118
  key: "render",
@@ -0,0 +1,21 @@
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 _RadioButtonListModule = _interopRequireDefault(require("./RadioButtonList.module.scss"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ var RadioButtonList = function RadioButtonList(props) {
15
+ return /*#__PURE__*/_react.default.createElement("ul", {
16
+ className: _RadioButtonListModule.default.radioButtonList
17
+ }, props.children);
18
+ };
19
+
20
+ var _default = RadioButtonList;
21
+ exports.default = _default;
@@ -0,0 +1,28 @@
1
+ Ordered List example:
2
+
3
+ ```js
4
+ import RadioButtonListItem from "lib/components/RadioButtonListItem";
5
+ <RadioButtonList>
6
+ <RadioButtonListItem
7
+ onChange={() => {
8
+ console.log("onchange");
9
+ }}
10
+ inputValue="value 1"
11
+ name="radio-button-list-list-item"
12
+ id="radioButtonList-listItem-1"
13
+ checked={true}
14
+ >
15
+ Checked radio button
16
+ </RadioButtonListItem>
17
+ <RadioButtonListItem
18
+ onChange={() => {
19
+ console.log("onchange");
20
+ }}
21
+ inputValue="value 2"
22
+ name="radio-button-list-list-item"
23
+ id="radioButtonList-listItem-1"
24
+ >
25
+ Unchecked radio button
26
+ </RadioButtonListItem>
27
+ </RadioButtonList>;
28
+ ```
@@ -0,0 +1,5 @@
1
+ :local(.radioButtonList) {
2
+ margin: 0;
3
+ padding: 0;
4
+ list-style: none;
5
+ }
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -13,64 +11,35 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
 
14
12
  var _RadioButtonInput = _interopRequireDefault(require("./RadioButtonInput"));
15
13
 
14
+ var _helpers = require("../functions/helpers");
15
+
16
16
  var _RadioButtonListItemModule = _interopRequireDefault(require("./RadioButtonListItem.module.scss"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
22
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
-
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
-
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
-
30
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
-
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
33
-
34
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
-
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
-
40
- var RadioButtonListItem = /*#__PURE__*/function (_React$Component) {
41
- _inherits(RadioButtonListItem, _React$Component);
42
-
43
- var _super = _createSuper(RadioButtonListItem);
44
-
45
- function RadioButtonListItem() {
46
- _classCallCheck(this, RadioButtonListItem);
47
-
48
- return _super.apply(this, arguments);
49
- }
50
-
51
- _createClass(RadioButtonListItem, [{
52
- key: "render",
53
- value: function render() {
54
- return /*#__PURE__*/_react.default.createElement("div", {
55
- className: "".concat(_RadioButtonListItemModule.default.radioButtonListItem, " ").concat(this.props.disabled ? _RadioButtonListItemModule.default.disabled : '', " ").concat(this.props.compact ? _RadioButtonListItemModule.default.compact : '', " ").concat(this.props.contentOnly ? _RadioButtonListItemModule.default.contentOnly : '', " ").concat(this.props.hasErrors ? _RadioButtonListItemModule.default.hasErrors : '')
56
- }, /*#__PURE__*/_react.default.createElement(_RadioButtonInput.default, {
57
- onChange: this.props.onChange,
58
- inputValue: this.props.inputValue,
59
- checked: this.props.checked,
60
- disabled: this.props.disabled,
61
- contentOnly: this.props.contentOnly,
62
- hasErrors: this.props.hasErrors,
63
- id: this.props.id,
64
- theme: this.props.theme
65
- }, this.props.children));
66
- }
67
- }]);
68
-
69
- return RadioButtonListItem;
70
- }(_react.default.Component);
20
+ // Dependencies
21
+ // Components
22
+ // Functions
23
+ // Stylesheets
24
+ var RadioButtonListItem = function RadioButtonListItem(props) {
25
+ var listItemClassNameArray = [_RadioButtonListItemModule.default.radioButtonListItem, props.disabled ? _RadioButtonListItemModule.default.disabled : null, props.compact ? _RadioButtonListItemModule.default.compact : null, props.contentOnly ? _RadioButtonListItemModule.default.contentOnly : null, props.hasErrors ? _RadioButtonListItemModule.default.hasErrors : null];
26
+ var listItemClassNameString = (0, _helpers.classNameArrayToClassNameString)(listItemClassNameArray);
27
+ var inputProps = {
28
+ onChange: props.onChange,
29
+ inputValue: props.inputValue,
30
+ checked: props.checked,
31
+ disabled: props.disabled,
32
+ contentOnly: props.contentOnly,
33
+ hasErrors: props.hasErrors,
34
+ id: props.id,
35
+ theme: props.theme
36
+ };
37
+ return /*#__PURE__*/_react.default.createElement("li", {
38
+ className: listItemClassNameString
39
+ }, /*#__PURE__*/_react.default.createElement(_RadioButtonInput.default, inputProps, props.children));
40
+ };
71
41
 
72
42
  RadioButtonListItem.propTypes = {
73
- /** Text content inside list item */
74
43
  inputValue: _propTypes.default.string.isRequired,
75
44
  checked: _propTypes.default.bool,
76
45
  disabled: _propTypes.default.bool,
@@ -82,7 +51,7 @@ RadioButtonListItem.propTypes = {
82
51
  hasErrors: _propTypes.default.bool
83
52
  };
84
53
  RadioButtonListItem.defaultProps = {
85
- name: '',
54
+ name: "",
86
55
  checked: false,
87
56
  disabled: false,
88
57
  contentOnly: false,
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.classNameArrayToClassNameString = void 0;
7
+
8
+ var classNameArrayToClassNameString = function classNameArrayToClassNameString(classNameArray) {
9
+ var _classNameArray$filte;
10
+
11
+ return (classNameArray === null || classNameArray === void 0 ? void 0 : (_classNameArray$filte = classNameArray.filter(function (className) {
12
+ return className;
13
+ })) === null || _classNameArray$filte === void 0 ? void 0 : _classNameArray$filte.join(" ")) || "";
14
+ };
15
+
16
+ exports.classNameArrayToClassNameString = classNameArrayToClassNameString;
package/dist/index.js CHANGED
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "CheckBoxInput", {
27
27
  return _CheckBoxInput.default;
28
28
  }
29
29
  });
30
+ Object.defineProperty(exports, "CheckBoxList", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _CheckBoxList.default;
34
+ }
35
+ });
30
36
  Object.defineProperty(exports, "CheckBoxListItem", {
31
37
  enumerable: true,
32
38
  get: function get() {
@@ -147,6 +153,12 @@ Object.defineProperty(exports, "RadioButtonInput", {
147
153
  return _RadioButtonInput.default;
148
154
  }
149
155
  });
156
+ Object.defineProperty(exports, "RadioButtonList", {
157
+ enumerable: true,
158
+ get: function get() {
159
+ return _RadioButtonList.default;
160
+ }
161
+ });
150
162
  Object.defineProperty(exports, "RadioButtonListItem", {
151
163
  enumerable: true,
152
164
  get: function get() {
@@ -192,6 +204,8 @@ var _CheckBoxIcon = _interopRequireDefault(require("./components/CheckBoxIcon"))
192
204
 
193
205
  var _CheckBoxInput = _interopRequireDefault(require("./components/CheckBoxInput"));
194
206
 
207
+ var _CheckBoxList = _interopRequireDefault(require("./components/CheckBoxList"));
208
+
195
209
  var _CheckBoxListItem = _interopRequireDefault(require("./components/CheckBoxListItem"));
196
210
 
197
211
  var _Container = _interopRequireDefault(require("./components/Container"));
@@ -232,6 +246,8 @@ var _RadioButtonIcon = _interopRequireDefault(require("./components/RadioButtonI
232
246
 
233
247
  var _RadioButtonInput = _interopRequireDefault(require("./components/RadioButtonInput"));
234
248
 
249
+ var _RadioButtonList = _interopRequireDefault(require("./components/RadioButtonList"));
250
+
235
251
  var _RadioButtonListItem = _interopRequireDefault(require("./components/RadioButtonListItem"));
236
252
 
237
253
  var _Select = _interopRequireDefault(require("./components/Select"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dibk-design",
3
- "version": "1.0.15",
3
+ "version": "1.1.2",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",