pallote-react 0.3.3 → 0.3.5

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.
@@ -49,11 +49,11 @@ const Button = _ref => {
49
49
  };
50
50
  exports.Button = Button;
51
51
  Button.propTypes = {
52
- color: _propTypes.default.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error', 'main', 'contrast']),
53
- size: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg']),
52
+ component: _propTypes.default.oneOf(['button', 'a']),
54
53
  kind: _propTypes.default.oneOf(['text', 'icon']),
55
54
  variant: _propTypes.default.oneOf(['fill', 'stroke', 'transparent']),
56
- component: _propTypes.default.oneOf(['button', 'a']),
55
+ size: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg']),
56
+ color: _propTypes.default.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error', 'main', 'contrast']),
57
57
  fullWidth: _propTypes.default.bool,
58
58
  disabled: _propTypes.default.bool,
59
59
  iconLeft: _propTypes.default.node,
@@ -62,11 +62,11 @@ Button.propTypes = {
62
62
  children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object])
63
63
  };
64
64
  Button.defaultProps = {
65
- color: 'primary',
66
- size: 'md',
65
+ component: 'button',
67
66
  kind: 'text',
68
67
  variant: 'fill',
69
- component: 'button',
68
+ size: 'md',
69
+ color: 'primary',
70
70
  fullWidth: false,
71
71
  disabled: false,
72
72
  isTransparent: false,
@@ -9,35 +9,31 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _Text = require("../utilities/Text");
12
- const _excluded = ["icon", "dense", "bold", "className", "children"];
12
+ const _excluded = ["icon", "bold", "className", "children"];
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
17
17
  const ListItem = _ref => {
18
+ var _icon$props$className;
18
19
  let {
19
20
  icon,
20
- dense,
21
21
  bold,
22
22
  className,
23
23
  children
24
24
  } = _ref,
25
25
  props = _objectWithoutProperties(_ref, _excluded);
26
- return /*#__PURE__*/_react.default.createElement("div", _extends({
26
+ return /*#__PURE__*/_react.default.createElement(_Text.Text, _extends({
27
27
  className: (0, _classnames.default)(['list_item', {
28
- 'list_item-dense': dense,
29
28
  'list_item-bold': bold
30
29
  }, className])
31
- }, props), icon ? /*#__PURE__*/_react.default.createElement("div", {
32
- className: 'list_itemIcon'
33
- }, icon) : null, /*#__PURE__*/_react.default.createElement(_Text.Text, {
34
- weight: bold === true ? 'bold' : ''
35
- }, children));
30
+ }, props), icon ? /*#__PURE__*/_react.default.cloneElement(icon, {
31
+ className: "".concat((_icon$props$className = icon.props.className) !== null && _icon$props$className !== void 0 ? _icon$props$className : '', " list_itemIcon")
32
+ }) : null, children);
36
33
  };
37
34
  exports.ListItem = ListItem;
38
35
  ListItem.propTypes = {
39
36
  icon: _propTypes.default.node,
40
- dense: _propTypes.default.bool,
41
37
  bold: _propTypes.default.bool,
42
38
  className: _propTypes.default.node,
43
39
  children: _propTypes.default.string
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _SectionHeader = require("./SectionHeader");
12
- const _excluded = ["align", "color", "landing", "header", "label", "title", "subtitle", "className", "children"];
12
+ const _excluded = ["align", "fill", "landing", "header", "className", "children"];
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -17,40 +17,37 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
17
17
  const Section = _ref => {
18
18
  let {
19
19
  align,
20
- color,
20
+ fill,
21
21
  landing,
22
22
  header,
23
- label,
24
- title,
25
- subtitle,
26
23
  className,
27
24
  children
28
25
  } = _ref,
29
26
  props = _objectWithoutProperties(_ref, _excluded);
30
27
  return /*#__PURE__*/_react.default.createElement("div", _extends({
31
28
  className: (0, _classnames.default)(['section', {
32
- ["section--".concat(align)]: align,
33
- ["section--".concat(color)]: color,
34
- 'section--landing': landing,
35
- 'section--header': header
29
+ ["section-".concat(align)]: align,
30
+ ["section-".concat(fill)]: fill,
31
+ 'section-landing': landing,
32
+ 'section-header': header
36
33
  }, className])
37
34
  }, props), /*#__PURE__*/_react.default.createElement("div", {
38
- className: 'section__container'
39
- }, label || title || subtitle ? /*#__PURE__*/_react.default.createElement(_SectionHeader.SectionHeader, {
40
- label: label,
41
- title: title,
42
- subtitle: subtitle
43
- }) : null, children));
35
+ className: 'section_container'
36
+ }, _react.default.Children.map(children, child => {
37
+ if ( /*#__PURE__*/_react.default.isValidElement(child) && child.type === _SectionHeader.SectionHeader) {
38
+ return /*#__PURE__*/_react.default.cloneElement(child, {
39
+ promoteTitle: landing || header
40
+ });
41
+ }
42
+ return child;
43
+ })));
44
44
  };
45
45
  exports.Section = Section;
46
46
  Section.propTypes = {
47
47
  align: _propTypes.default.oneOf(['left', 'center', 'right']),
48
- color: _propTypes.default.oneOf(['default', 'paper', 'primary', 'primaryLight']),
48
+ fill: _propTypes.default.oneOf(['default', 'paper', 'primary', 'primaryLight']),
49
49
  landing: _propTypes.default.bool,
50
50
  header: _propTypes.default.bool,
51
- label: _propTypes.default.string,
52
- title: _propTypes.default.string,
53
- subtitle: _propTypes.default.string,
54
51
  className: _propTypes.default.node,
55
52
  children: _propTypes.default.any
56
53
  };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.assign.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SectionContent = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ const _excluded = ["align", "className", "children"];
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
14
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
16
+ const SectionContent = _ref => {
17
+ let {
18
+ align,
19
+ className,
20
+ children
21
+ } = _ref,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+ return /*#__PURE__*/_react.default.createElement("div", _extends({
24
+ className: (0, _classnames.default)(['section_content', {
25
+ ["section_content-".concat(align)]: align
26
+ }, className])
27
+ }, props), children);
28
+ };
29
+ exports.SectionContent = SectionContent;
30
+ SectionContent.propTypes = {
31
+ align: _propTypes.default.oneOf(['left', 'center', 'right']),
32
+ className: _propTypes.default.node,
33
+ children: _propTypes.default.any
34
+ };
35
+ SectionContent.defaultProps = {
36
+ align: 'left'
37
+ };
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _Text = require("../utilities/Text");
12
- const _excluded = ["label", "title", "subtitle", "dense", "className"];
12
+ const _excluded = ["label", "title", "promoteTitle", "titleComponent", "subtitle", "className"];
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -18,28 +18,32 @@ const SectionHeader = _ref => {
18
18
  let {
19
19
  label,
20
20
  title,
21
+ promoteTitle,
22
+ titleComponent,
21
23
  subtitle,
22
- dense,
23
24
  className
24
25
  } = _ref,
25
26
  props = _objectWithoutProperties(_ref, _excluded);
26
27
  return /*#__PURE__*/_react.default.createElement("div", _extends({
27
- className: (0, _classnames.default)(['section__header', {
28
- 'section__header--dense': dense
29
- }, className])
28
+ className: (0, _classnames.default)(['section_header', className])
30
29
  }, props), label ? /*#__PURE__*/_react.default.createElement(_Text.Text, {
31
- className: (0, _classnames.default)('section__label')
32
- }, label) : null, title ? /*#__PURE__*/_react.default.createElement(_Text.Text, {
33
- className: (0, _classnames.default)('section__title')
34
- }, title) : null, subtitle ? /*#__PURE__*/_react.default.createElement(_Text.Text, {
35
- className: (0, _classnames.default)('section__subtitle')
30
+ className: (0, _classnames.default)('section_label')
31
+ }, label) : null, /*#__PURE__*/_react.default.createElement(_Text.Text, {
32
+ className: "section_title",
33
+ component: titleComponent || (promoteTitle ? 'h1' : 'h2')
34
+ }, title), subtitle ? /*#__PURE__*/_react.default.createElement(_Text.Text, {
35
+ className: (0, _classnames.default)('section_subtitle')
36
36
  }, subtitle) : null);
37
37
  };
38
38
  exports.SectionHeader = SectionHeader;
39
39
  SectionHeader.propTypes = {
40
40
  label: _propTypes.default.string,
41
- title: _propTypes.default.string,
41
+ title: _propTypes.default.string.isRequired,
42
+ promoteTitle: _propTypes.default.bool,
43
+ titleComponent: _propTypes.default.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p']),
42
44
  subtitle: _propTypes.default.string,
43
- dense: _propTypes.default.bool,
44
45
  className: _propTypes.default.bool
46
+ };
47
+ SectionHeader.defaultProps = {
48
+ promoteTitle: false
45
49
  };
@@ -31,7 +31,7 @@ const Status = _ref => {
31
31
  };
32
32
  exports.Status = Status;
33
33
  Status.propTypes = {
34
- color: _propTypes.default.oneOf(['success', 'info', 'warning', 'error', 'inactive']),
34
+ color: _propTypes.default.oneOf(['inactive', 'success', 'info', 'warning', 'error']),
35
35
  dense: _propTypes.default.bool,
36
36
  className: _propTypes.default.node,
37
37
  children: _propTypes.default.string
package/dist/index.js CHANGED
@@ -219,6 +219,12 @@ Object.defineProperty(exports, "Section", {
219
219
  return _Section.Section;
220
220
  }
221
221
  });
222
+ Object.defineProperty(exports, "SectionContent", {
223
+ enumerable: true,
224
+ get: function get() {
225
+ return _SectionContent.SectionContent;
226
+ }
227
+ });
222
228
  Object.defineProperty(exports, "SectionHeader", {
223
229
  enumerable: true,
224
230
  get: function get() {
@@ -364,6 +370,7 @@ var _PageHeader = require("./components/PageHeader");
364
370
  var _Radio = require("./components/Radio");
365
371
  var _RadioButtons = require("./components/RadioButtons");
366
372
  var _Section = require("./components/Section");
373
+ var _SectionContent = require("./components/SectionContent");
367
374
  var _SectionHeader = require("./components/SectionHeader");
368
375
  var _Select = require("./components/Select");
369
376
  var _Snippet = require("./components/Snippet");
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "arnymax"
6
6
  },
7
- "version": "0.3.3",
7
+ "version": "0.3.5",
8
8
  "private": false,
9
9
  "keywords": [
10
10
  "react",
@@ -30,7 +30,7 @@
30
30
  "@testing-library/user-event": "^13.5.0",
31
31
  "classnames": "^2.3.2",
32
32
  "eslint": "^8.48.0",
33
- "pallote-css": "^0.3.5",
33
+ "pallote-css": "^0.3.7",
34
34
  "react": "^18.2.0",
35
35
  "react-dom": "^18.2.0",
36
36
  "react-router-dom": "^6.15.0",