@councilbox/councilbox-ui 0.0.5 → 0.0.8

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/build-index.js +26 -2
  3. package/dist/components/Avatar/Avatar.js +42 -55
  4. package/dist/components/Avatar/Avatar.stories.js +10 -0
  5. package/dist/components/Avatar/DesignAvatar.stories.js +104 -4
  6. package/dist/components/Avatar/DesignAvatarText.stories.js +65 -4
  7. package/dist/components/AvatarGroup/AvatarGroup.css +33 -0
  8. package/dist/components/AvatarGroup/AvatarGroup.js +4 -7
  9. package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +73 -4
  10. package/dist/components/Button/Button.js +104 -16
  11. package/dist/components/Button/Button.stories.js +23 -25
  12. package/dist/components/Button/button.css +47 -0
  13. package/dist/components/Checkbox/Checkbox.css +0 -0
  14. package/dist/components/Checkbox/Checkbox.js +94 -0
  15. package/dist/components/Checkbox/Checkbox.stories.js +28 -0
  16. package/dist/components/InputPassword/InputPassword.css +26 -0
  17. package/dist/components/InputPassword/InputPassword.js +78 -107
  18. package/dist/components/InputPassword/InputPassword.stories.js +33 -2
  19. package/dist/components/InputText/InputText.css +19 -0
  20. package/dist/components/InputText/InputText.js +114 -52
  21. package/dist/components/InputText/InputText.stories.js +26 -2
  22. package/dist/components/RadioButton/Radio.css +0 -0
  23. package/dist/components/RadioButton/Radio.js +94 -0
  24. package/dist/components/RadioButton/Radio.stories.js +28 -0
  25. package/dist/components/Spacing/Spacing.css +0 -0
  26. package/dist/components/Spacing/Spacing.js +137 -0
  27. package/dist/components/Spacing/Spacing.stories.js +28 -0
  28. package/dist/components/ThemeProvider/Colors.js +102 -0
  29. package/dist/components/ThemeProvider/ThemeProvider.js +17 -8
  30. package/dist/components/Typography/Typography.js +37 -13
  31. package/dist/components/Typography/Typography.stories.js +11 -2
  32. package/dist/styles/main.css +96 -30
  33. package/dist/styles/stylesheet.js +40 -9
  34. package/dist/testing/TestComponents.js +57 -24
  35. package/package.json +3 -2
  36. package/dist/components/Button/ButtonV1.js +0 -63
@@ -13,45 +13,133 @@ var _Button = _interopRequireDefault(require("@mui/material/Button"));
13
13
 
14
14
  require("../../styles/main.css");
15
15
 
16
+ require("./button.css");
17
+
18
+ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
19
+
20
+ var _excluded = ["id", "text", "onClick", "disabled", "loading", "variant", "fullWidth", "icon"];
21
+
16
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
23
 
24
+ function _extends() { _extends = Object.assign || 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); }
25
+
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
+
28
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
+
30
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
+
32
+ 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; }
33
+
34
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
35
+
18
36
  var Button = function Button(_ref) {
19
- var text = _ref.text,
37
+ var id = _ref.id,
38
+ text = _ref.text,
20
39
  onClick = _ref.onClick,
21
40
  disabled = _ref.disabled,
22
41
  loading = _ref.loading,
23
- color = _ref.color,
24
- variant = _ref.variant;
25
- return /*#__PURE__*/_react.default.createElement(_Button.default, {
26
- variant: variant,
27
- className: "councilbox-button",
42
+ variant = _ref.variant,
43
+ fullWidth = _ref.fullWidth,
44
+ icon = _ref.icon,
45
+ props = _objectWithoutProperties(_ref, _excluded);
46
+
47
+ var buttonVariant;
48
+ var buttonColor;
49
+ var background;
50
+
51
+ if (variant === 'primary') {
52
+ buttonVariant = 'contained';
53
+ background = 'var(--primary)';
54
+ buttonColor = 'var(--neutral50)';
55
+ } else if (variant === 'secondary') {
56
+ buttonVariant = 'outlined';
57
+ buttonColor = 'var(--primary)';
58
+ } else if (variant === 'error') {
59
+ // this better as an state, not a variant
60
+ buttonVariant = 'contained';
61
+ background = 'var(--error600)';
62
+ buttonColor = 'var(--neutral50)';
63
+ } else if (variant === 'warning') {
64
+ buttonVariant = 'contained';
65
+ background = 'var(--warnig600)';
66
+ buttonColor = 'var(--neutral50)';
67
+ } else if (variant === 'success') {
68
+ buttonVariant = 'contained';
69
+ background = 'var(--success600)';
70
+ buttonColor = 'var(--neutral50)';
71
+ } else {
72
+ buttonVariant = 'text';
73
+ buttonColor = 'var(--primary)';
74
+ }
75
+
76
+ var isSecondaryOrTernary = function isSecondaryOrTernary(variantBtn) {
77
+ return variantBtn === 'secondary' || variantBtn === 'tertiary';
78
+ };
79
+
80
+ return /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
81
+ id: id,
82
+ sx: {
83
+ minWidth: !isSecondaryOrTernary(variant) ? '140px' : '100px',
84
+ height: '48px',
85
+ boxShadow: 'none',
86
+ letterSpacing: '1px',
87
+ lineHeight: 'calc(24px - 1.25rem)'
88
+ },
89
+ className: "cbx-button ".concat(isSecondaryOrTernary(variant) && disabled ? 'cbx-button-outlined-disabled' : '', " ").concat(buttonVariant, " ").concat(icon ? 'cbx-button-with-icon' : '', " ").concat(!isSecondaryOrTernary(variant) && "cbx-button-hoverAndAnimation".concat(fullWidth ? '-fullWidth' : '')),
28
90
  disabled: loading || disabled,
29
- color: color // style={{
30
- // backgroundColor: `var(--${color})`
31
- // }}
32
- ,
33
- onClick: onClick
34
- }, text);
91
+ variant: buttonVariant,
92
+ style: _objectSpread({
93
+ backgroundColor: background,
94
+ color: buttonColor
95
+ }, disabled || loading ? {
96
+ opacity: '0.4'
97
+ } : {}),
98
+ disableFocusRipple: true,
99
+ fullWidth: fullWidth,
100
+ onClick: onClick,
101
+ startIcon: icon && icon === 'arrow' ? /*#__PURE__*/_react.default.createElement("i", {
102
+ className: "ri-arrow-left-s-line"
103
+ }) : icon
104
+ }, props), /*#__PURE__*/_react.default.createElement("span", {
105
+ className: "button-text"
106
+ }, text), buttonVariant === 'contained' && !loading && /*#__PURE__*/_react.default.createElement("span", {
107
+ className: "cbx-button-containerArrow"
108
+ }, /*#__PURE__*/_react.default.createElement("i", {
109
+ className: "ri-arrow-right-s-line arrow-primary"
110
+ })), loading && /*#__PURE__*/_react.default.createElement("span", {
111
+ className: "cbx-button-containerLoading"
112
+ }, /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
113
+ sx: {
114
+ color: 'white'
115
+ },
116
+ style: {
117
+ height: 'var(--spacing24)',
118
+ width: 'var(--spacing24)'
119
+ }
120
+ })));
35
121
  };
36
122
 
37
123
  Button.displayName = "Button";
38
124
  Button.propTypes = {
39
125
  backgroundColor: _propTypes.default.string,
40
- color: _propTypes.default.string,
41
126
  text: _propTypes.default.string.isRequired,
42
127
  onClick: _propTypes.default.func,
43
128
  disabled: _propTypes.default.bool,
44
129
  loading: _propTypes.default.bool,
45
- variant: _propTypes.default.string
130
+ variant: _propTypes.default.string,
131
+ fullWidth: _propTypes.default.bool,
132
+ icon: _propTypes.default.node
46
133
  };
47
134
  Button.defaultProps = {
48
135
  backgroundColor: null,
49
136
  text: null,
50
137
  onClick: undefined,
51
- color: 'primary',
52
138
  disabled: false,
53
139
  loading: false,
54
- variant: 'contained'
140
+ variant: 'primary',
141
+ fullWidth: false,
142
+ icon: null
55
143
  };
56
144
  var _default = Button;
57
145
  exports.default = _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.Secondary = exports.Primary = exports.Default = void 0;
6
+ exports.default = exports.Default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -11,36 +11,49 @@ var _Button = _interopRequireDefault(require("./Button"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
+ var ICONS = {
15
+ none: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null),
16
+ save: /*#__PURE__*/_react.default.createElement("i", {
17
+ className: "ri-save-line"
18
+ }),
19
+ edit: /*#__PURE__*/_react.default.createElement("i", {
20
+ className: "ri-pencil-line"
21
+ }),
22
+ arrowLeft: 'arrow'
23
+ };
14
24
  var _default = {
15
25
  title: 'Example/Button',
16
26
  component: _Button.default,
17
27
  argTypes: {
18
- backgroundColor: {
19
- control: 'color'
20
- },
21
- color: {
22
- options: ['primary', 'secondary'],
28
+ loading: {
29
+ options: [true, false],
23
30
  control: {
24
31
  type: 'radio'
25
32
  }
26
33
  },
27
- loading: {
34
+ disabled: {
28
35
  options: [true, false],
29
36
  control: {
30
37
  type: 'radio'
31
38
  }
32
39
  },
33
- disabled: {
40
+ fullWidth: {
34
41
  options: [true, false],
35
42
  control: {
36
43
  type: 'radio'
37
44
  }
38
45
  },
39
46
  variant: {
40
- options: ['contained', 'outlined', 'text'],
47
+ options: ['primary', 'secondary', 'tertiary', 'success', 'warning', 'error'],
41
48
  control: {
42
49
  type: 'radio'
43
50
  }
51
+ },
52
+ icon: {
53
+ control: {
54
+ type: 'select'
55
+ },
56
+ options: ICONS
44
57
  }
45
58
  }
46
59
  };
@@ -55,20 +68,5 @@ var Default = Template.bind({});
55
68
  exports.Default = Default;
56
69
  Default.args = {
57
70
  text: 'Label',
58
- color: 'primary',
59
- variant: 'contained'
60
- };
61
- var Primary = Template.bind({});
62
- exports.Primary = Primary;
63
- Primary.args = {
64
- text: 'Primary Label',
65
- color: 'primary',
66
- variant: 'outlined'
67
- };
68
- var Secondary = Template.bind({});
69
- exports.Secondary = Secondary;
70
- Secondary.args = {
71
- text: 'Secondary Label',
72
- color: 'secondary',
73
- variant: 'contained'
71
+ variant: 'primary'
74
72
  };
@@ -0,0 +1,47 @@
1
+ .cbx-button-with-icon {
2
+ padding-left: var(--spacing20) !important;
3
+ }
4
+
5
+ .cbx-button:focus-visible {
6
+ box-shadow: inset 0 0 0 2px white, 0px 0px 5px 3px rgb(56 57 140 / 75%);
7
+ }
8
+
9
+ .cbx-button-hoverAndAnimation{
10
+ justify-content: start!important;
11
+ }
12
+
13
+ .cbx-button-hoverAndAnimation-fullWidth{
14
+ justify-content: center;
15
+ }
16
+
17
+ .cbx-button-containerArrow {
18
+ width: 15px;
19
+ height: var(--spacing4);
20
+ }
21
+
22
+ .cbx-button-containerLoading {
23
+ width: 15px;
24
+ height: var(--spacing24);
25
+ }
26
+
27
+ .cbx-button-hoverAndAnimation .cbx-button-containerArrow, .cbx-button-hoverAndAnimation-fullWidth .cbx-button-containerArrow, .cbx-button-hoverAndAnimation .cbx-button-containerLoading, .cbx-button-hoverAndAnimation-fullWidth .cbx-button-containerLoading {
28
+ margin-left: var(--spacing24);
29
+ margin-right: var(--spacing8);
30
+ position: relative;
31
+ transition: padding .4s ease-in-out;
32
+ }
33
+
34
+ .cbx-button-hoverAndAnimation span i , .cbx-button-hoverAndAnimation-fullWidth span i {
35
+ position: absolute;
36
+ transition: .4s ease-in-out;
37
+ left: 0;
38
+ }
39
+
40
+ .cbx-button-hoverAndAnimation:hover span i , .cbx-button-hoverAndAnimation-fullWidth:hover span i {
41
+ padding-left: var(--spacing8);
42
+ }
43
+
44
+ .cbx-button-outlined-disabled{
45
+ color: var(--neutral900)!important;
46
+ border-color: var(--primary)!important;
47
+ }
File without changes
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
13
+
14
+ require("../../styles/main.css");
15
+
16
+ var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
17
+
18
+ var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
19
+
20
+ var _excluded = ["id", "className", "disabled", "indeterminate", "label", "onChange"];
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _extends() { _extends = Object.assign || 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); }
25
+
26
+ 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; }
27
+
28
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
+
30
+ var CssFormControlLabel = (0, _styled.default)(_FormControlLabel.default)(function (_ref) {
31
+ var theme = _ref.theme;
32
+ return {
33
+ '& .MuiFormControlLabel-label': {
34
+ marginLeft: 'var(--spacing8)'
35
+ },
36
+ '& .MuiCheckbox-root.Mui-disabled': {
37
+ color: '#acadce'
38
+ },
39
+ '& .MuiCheckbox-root': {
40
+ transition: 'all .2s'
41
+ },
42
+ '& .MuiCheckbox-root:hover': {
43
+ color: theme.palette.primary700
44
+ }
45
+ };
46
+ });
47
+
48
+ var Checkbox = function Checkbox(_ref2) {
49
+ var id = _ref2.id,
50
+ className = _ref2.className,
51
+ disabled = _ref2.disabled,
52
+ indeterminate = _ref2.indeterminate,
53
+ label = _ref2.label,
54
+ onChange = _ref2.onChange,
55
+ props = _objectWithoutProperties(_ref2, _excluded);
56
+
57
+ return /*#__PURE__*/_react.default.createElement(CssFormControlLabel, _extends({
58
+ id: id,
59
+ className: className,
60
+ style: {
61
+ margin: '0px'
62
+ },
63
+ onChange: onChange,
64
+ control: /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
65
+ indeterminate: indeterminate,
66
+ style: {
67
+ padding: '0px'
68
+ },
69
+ sx: {
70
+ '& .MuiSvgIcon-root': {
71
+ fontSize: 24
72
+ }
73
+ }
74
+ }),
75
+ disabled: disabled,
76
+ label: label
77
+ }, props));
78
+ };
79
+
80
+ Checkbox.displayName = "Checkbox";
81
+ Checkbox.propTypes = {
82
+ onChange: _propTypes.default.func,
83
+ disabled: _propTypes.default.bool,
84
+ indeterminate: _propTypes.default.bool,
85
+ label: _propTypes.default.string
86
+ };
87
+ Checkbox.defaultProps = {
88
+ onChange: undefined,
89
+ disabled: false,
90
+ indeterminate: false,
91
+ label: 'Label'
92
+ };
93
+ var _default = Checkbox;
94
+ exports.default = _default;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _Checkbox = _interopRequireDefault(require("./Checkbox"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ var _default = {
15
+ title: 'Example/Checkbox',
16
+ component: _Checkbox.default,
17
+ argTypes: {}
18
+ };
19
+ exports.default = _default;
20
+
21
+ var Template = function Template(args) {
22
+ return /*#__PURE__*/_react.default.createElement(_Checkbox.default, args);
23
+ };
24
+
25
+ Template.displayName = "Template";
26
+ var Default = Template.bind({});
27
+ exports.Default = Default;
28
+ Default.args = {};
@@ -0,0 +1,26 @@
1
+ .cbx-inputPassword-validation {
2
+ width: 100%;
3
+ background: #DBDBDB;
4
+ height: var(--spacing8);
5
+ border-radius: 20px;
6
+ margin-top: var(--spacing4);
7
+ margin-bottom: var(--spacing4);
8
+
9
+ }
10
+ .cbx-inputPassword-validation > div {
11
+ height: var(--spacing8);
12
+ border-radius: 20px;
13
+ transition: all .5s;
14
+ }
15
+
16
+
17
+ .cbx-inputPassword-icon-button {
18
+ outline: none;
19
+ width: var(--spacing24);
20
+ height: var(--spacing24);
21
+
22
+ }
23
+ .cbx-inputPassword-icon-size {
24
+ width: var(--spacing24);
25
+ height: var(--spacing24);
26
+ }