@cashub/ui 0.21.1 → 0.22.1

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.
@@ -8,7 +8,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _templateObject;
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
- const FlexContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n\n ", ";\n\n ", ";\n"])), _ref => {
11
+ const FlexContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n\n ", ";\n\n ", ";\n\n ", "\n"])), _ref => {
12
12
  let {
13
13
  marginBottom
14
14
  } = _ref;
@@ -18,5 +18,10 @@ const FlexContainer = _styledComponents.default.div(_templateObject || (_templat
18
18
  wrap
19
19
  } = _ref2;
20
20
  return wrap && 'flex-wrap: wrap';
21
+ }, _ref3 => {
22
+ let {
23
+ alignCenter
24
+ } = _ref3;
25
+ return alignCenter && 'align-items: center;';
21
26
  });
22
27
  var _default = exports.default = FlexContainer;
package/form/Input.js CHANGED
@@ -9,7 +9,7 @@ var _inputPlaceholder = _interopRequireDefault(require("../styles/mixin/inputPla
9
9
  var _templateObject, _templateObject2;
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
- const Input = _styledComponents.default.input(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n width: 100%;\n height: 36px;\n border: var(--border-width) solid var(--border-color);\n padding: 10px var(--spacing-s);\n border-radius: var(--border-radius-l);\n background: transparent;\n color: var(--font-on-background);\n transition: 0.3s;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &:focus {\n border: var(--border-width) solid var(--color-primary);\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n"])), (0, _inputPlaceholder.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: var(--font-on-mute);\n "]))), _ref => {
12
+ const Input = _styledComponents.default.input(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n width: 100%;\n height: 36px;\n border: var(--border-width) solid var(--border-color);\n padding: 10px var(--spacing-s);\n border-radius: var(--border-radius-l);\n background: transparent;\n color: var(--font-on-background);\n transition: 0.3s;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &:focus {\n border: var(--border-width) solid var(--color-primary);\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", ";\n"])), (0, _inputPlaceholder.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: var(--font-on-mute);\n "]))), _ref => {
13
13
  let {
14
14
  hidden
15
15
  } = _ref;
@@ -24,5 +24,10 @@ const Input = _styledComponents.default.input(_templateObject || (_templateObjec
24
24
  alignCenter
25
25
  } = _ref3;
26
26
  return alignCenter && 'text-align: center;';
27
+ }, _ref4 => {
28
+ let {
29
+ autoWidth
30
+ } = _ref4;
31
+ return autoWidth && 'width: auto;';
27
32
  });
28
33
  var _default = exports.default = Input;
package/form/Label.js CHANGED
@@ -8,7 +8,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _templateObject;
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
- const Label = _styledComponents.default.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n color: var(--font-on-background);\n font-size: var(--font-body1);\n margin-bottom: var(--spacing-xs);\n\n ", "\n\n ", "\n"])), _ref => {
11
+ const Label = _styledComponents.default.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n color: var(--font-on-background);\n font-size: var(--font-body1);\n word-break: break-word;\n white-space: pre-wrap;\n margin-bottom: var(--spacing-xs);\n\n ", "\n\n ", "\n\n ", "\n\n /* use float to make element align to right */\n /* use text-align to make all text(multiple line) align to right */\n ", "\n"])), _ref => {
12
12
  let {
13
13
  required
14
14
  } = _ref;
@@ -18,5 +18,15 @@ const Label = _styledComponents.default.label(_templateObject || (_templateObjec
18
18
  noMarginBottom
19
19
  } = _ref2;
20
20
  return noMarginBottom && 'margin-bottom: 0;';
21
+ }, _ref3 => {
22
+ let {
23
+ noBreakWord
24
+ } = _ref3;
25
+ return noBreakWord && 'word-break: keep-all;';
26
+ }, _ref4 => {
27
+ let {
28
+ alignRight
29
+ } = _ref4;
30
+ return alignRight && "\n text-align: right;\n float: right;\n ";
21
31
  });
22
32
  var _default = exports.default = Label;
package/form/Slider.js CHANGED
@@ -4,11 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
7
8
  var _jsxRuntime = require("react/jsx-runtime");
9
+ var _templateObject;
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
8
12
  const Slider = props => {
9
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
10
- type: "range",
13
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(RangeInput, {
11
14
  ...props
12
15
  });
13
16
  };
17
+ const RangeInput = _styledComponents.default.input.attrs(() => ({
18
+ type: 'range'
19
+ }))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n appearance: none;\n width: 100%;\n height: 8px;\n border-radius: var(--border-radius);\n background: var(--color-grey);\n\n ", ";\n\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n width: 16px;\n height: 16px;\n border-radius: var(--border-radius-round);\n background: var(--color-primary);\n }\n\n &::-moz-range-thumb {\n width: 16px;\n height: 16px;\n border-radius: var(--border-radius-round);\n background: var(--color-primary);\n }\n"])), _ref => {
20
+ let {
21
+ autoWidth
22
+ } = _ref;
23
+ return autoWidth && 'width: auto;';
24
+ });
14
25
  var _default = exports.default = Slider;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ var _Label = _interopRequireDefault(require("./Label"));
9
+ var _Checkbox = _interopRequireDefault(require("./Checkbox"));
10
+ var _Input = _interopRequireDefault(require("./Input"));
11
+ var _container = require("../container");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ var _templateObject;
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
16
+ const TreeView = _ref => {
17
+ let {
18
+ data,
19
+ onChange,
20
+ onBlur
21
+ } = _ref;
22
+ const renderList = function (data) {
23
+ let parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
24
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(UnorderedList, {
25
+ children: data.map(item => {
26
+ var _item$children;
27
+ const id = "".concat(parentPath.join('')).concat(item.id).replace(/\s/g, '');
28
+ const currentPath = parentPath.concat(item.id);
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
30
+ children: [item.type === 'checkbox' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
31
+ noMargin: true,
32
+ htmlFor: id,
33
+ checked: item.value,
34
+ text: item.text,
35
+ onChange: event => {
36
+ onChange(event, currentPath);
37
+ },
38
+ disabled: item.disabled
39
+ }), item.type === 'text' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_container.FlexContainer, {
40
+ alignCenter: true,
41
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.default, {
42
+ noMarginBottom: true,
43
+ htmlFor: id,
44
+ children: item.text
45
+ }), "\xA0", /*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, {
46
+ autoWidth: true,
47
+ type: "text",
48
+ id: id,
49
+ value: item.value,
50
+ onChange: event => {
51
+ onChange(event, currentPath);
52
+ },
53
+ onBlur: onBlur,
54
+ disabled: item.disabled
55
+ })]
56
+ }), ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0 ? renderList(item.children, parentPath.concat(item.id)) : null]
57
+ }, item.id);
58
+ })
59
+ });
60
+ };
61
+ return renderList(data);
62
+ };
63
+ const UnorderedList = _styledComponents.default.ul(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: var(--font-on-background);\n\n ul {\n margin-left: var(--spacing-s);\n }\n\n li {\n margin-top: var(--spacing-xs);\n }\n"])));
64
+ var _default = exports.default = TreeView;
package/form/index.js CHANGED
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "Searchbox", {
45
45
  return _Searchbox.default;
46
46
  }
47
47
  });
48
+ Object.defineProperty(exports, "Slider", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _Slider.default;
52
+ }
53
+ });
48
54
  Object.defineProperty(exports, "SwitchButton", {
49
55
  enumerable: true,
50
56
  get: function () {
@@ -57,6 +63,12 @@ Object.defineProperty(exports, "Textarea", {
57
63
  return _Textarea.default;
58
64
  }
59
65
  });
66
+ Object.defineProperty(exports, "TreeView", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _TreeView.default;
70
+ }
71
+ });
60
72
  var _Checkbox = _interopRequireDefault(require("./Checkbox"));
61
73
  var _FormItem = _interopRequireDefault(require("./FormItem"));
62
74
  var _Input = _interopRequireDefault(require("./Input"));
@@ -64,6 +76,8 @@ var _Label = _interopRequireDefault(require("./Label"));
64
76
  var _MutedText = _interopRequireDefault(require("./MutedText"));
65
77
  var _RadioButton = _interopRequireDefault(require("./RadioButton"));
66
78
  var _Searchbox = _interopRequireDefault(require("./Searchbox"));
79
+ var _Slider = _interopRequireDefault(require("./Slider"));
67
80
  var _SwitchButton = _interopRequireDefault(require("./SwitchButton"));
68
81
  var _Textarea = _interopRequireDefault(require("./Textarea"));
82
+ var _TreeView = _interopRequireDefault(require("./TreeView"));
69
83
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.21.1",
3
+ "version": "0.22.1",
4
4
  "private": false,
5
5
  "author": "CASHUB Team",
6
6
  "description": "CASHUB UI components library",
@@ -8,7 +8,7 @@ var _styledComponents = require("styled-components");
8
8
  require("../assets/css/global.css");
9
9
  var _templateObject;
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
- const GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n body {\n --color-white: ", ";\n --color-dark: ", ";\n --color-grey: ", ";\n --color-primary: ", ";\n --color-success: ", ";\n --color-warning: ", ";\n --color-danger: ", ";\n --color-hover: ", ";\n --color-active: ", ";\n --color-scroll-bar: ", ";\n --color-background1: ", ";\n --color-background2: ", ";\n --color-background3: ", ";\n --color-backdrop: ", ";\n\n --font-h1: ", ";\n --font-h2: ", ";\n --font-h3: ", ";\n --font-body1: ", ";\n --font-body2: ", ";\n --font-button: ", ";\n --font-caption: ", ";\n --font-family: ", ";\n --font-normal: ", ";\n --font-bold: ", ";\n --font-on-primary: ", ";\n --font-on-success: ", ";\n --font-on-warning: ", ";\n --font-on-danger: ", ";\n --font-on-background: ", ";\n --font-on-mute: ", ";\n\n --box-shadow: ", ";\n --border-color: ", ";\n --border-width: ", ";\n --border-radius-s: ", ";\n --border-radius: ", ";\n --border-radius-l: ", ";\n --border-radius-round: ", ";\n\n --spacing-xs: ", ";\n --spacing-s: ", ";\n --spacing: ", ";\n --spacing-l: ", ";\n\n background : ", ";\n }\n"])), _ref => {
11
+ const GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n body {\n --color-white: ", ";\n --color-dark: ", ";\n --color-grey: ", ";\n --color-primary: ", ";\n --color-success: ", ";\n --color-warning: ", ";\n --color-danger: ", ";\n --color-hover: ", ";\n --color-active: ", ";\n --color-scroll-bar: ", ";\n --color-background1: ", ";\n --color-background2: ", ";\n --color-background3: ", ";\n --color-backdrop: ", ";\n\n --font-h1: ", ";\n --font-h2: ", ";\n --font-h3: ", ";\n --font-body1: ", ";\n --font-body2: ", ";\n --font-button: ", ";\n --font-caption: ", ";\n --font-family: ", ";\n --font-normal: ", ";\n --font-bold: ", ";\n --font-on-primary: ", ";\n --font-on-success: ", ";\n --font-on-warning: ", ";\n --font-on-danger: ", ";\n --font-on-background: ", ";\n --font-on-mute: ", ";\n\n --box-shadow: ", ";\n --border-color: ", ";\n --border-width: ", ";\n --border-radius-s: ", ";\n --border-radius: ", ";\n --border-radius-l: ", ";\n --border-radius-round: ", ";\n\n --spacing-xs: ", ";\n --spacing-s: ", ";\n --spacing: ", ";\n --spacing-l: ", ";\n\n background : ", ";\n }\n\n .margin-bottom-s {\n margin-bottom: var(--spacing-s);\n }\n"])), _ref => {
12
12
  let {
13
13
  theme
14
14
  } = _ref;