@steroidsjs/bootstrap 2.1.0-beta.7 → 2.1.4

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.
@@ -59,7 +59,7 @@
59
59
 
60
60
  &_link {
61
61
  justify-content: flex-start;
62
- background-color: #fff;
62
+ background-color: transparent;
63
63
  }
64
64
 
65
65
  &__icon {
@@ -1,7 +1,7 @@
1
1
  .DateFieldView {
2
2
  $root: &;
3
3
 
4
- padding: 0 8px;
4
+ padding-right: 8px;
5
5
  position: relative;
6
6
 
7
7
  background-color: $white;
@@ -46,8 +46,7 @@
46
46
  border: none;
47
47
  outline: none;
48
48
  background-color: transparent;
49
-
50
- padding: 10px 5px;
49
+ padding: $input-padding-y $input-padding-x;
51
50
  }
52
51
 
53
52
  &__icon-container {
@@ -53,7 +53,7 @@
53
53
  outline: none;
54
54
  background-color: transparent;
55
55
 
56
- padding: 10px 5px;
56
+ padding: $input-padding-y $input-padding-x;
57
57
  }
58
58
 
59
59
  &__icon-container {
@@ -29,25 +29,39 @@ var __importStar = (this && this.__importStar) || function (mod) {
29
29
  __setModuleDefault(result, mod);
30
30
  return result;
31
31
  };
32
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
33
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
34
+ to[j] = from[i];
35
+ return to;
36
+ };
32
37
  exports.__esModule = true;
33
38
  var React = __importStar(require("react"));
39
+ var react_1 = require("react");
34
40
  var hooks_1 = require("@steroidsjs/core/hooks");
35
41
  function DropDownFieldView(props) {
36
- /* TODO Move to core component
37
- static defaultProps = {
38
- searchAutoFocus: true,
39
- };
40
-
41
- componentDidUpdate(prevProps) {
42
- // Auto focus on search
43
- if (props.searchAutoFocus && props.autoComplete && !prevProps.isOpened && props.isOpened) {
44
- const element: any = findDOMNode(this);
45
- const input = element.querySelector('.' + props.bem.element('search-input'));
46
- if (input) {
47
- input.focus();
48
- }
42
+ var inputRef = react_1.useRef(null);
43
+ // Auto focus on search
44
+ react_1.useEffect(function () {
45
+ if (props.isSearchAutoFocus && props.isAutoComplete && props.isOpened && (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current)) {
46
+ inputRef.current.focus();
49
47
  }
50
- }*/
48
+ }, [props.isAutoComplete, props.isOpened, props.isSearchAutoFocus]);
49
+ var renderItem = function (item, level) {
50
+ if (level === void 0) { level = 0; }
51
+ if (props.groupAttribute && Array.isArray(item[props.groupAttribute])) {
52
+ return __spreadArray([
53
+ (React.createElement("div", { key: String(item[props.primaryKey]), className: bem.element('drop-down-item', 'group') }, item.label))
54
+ ], item[props.groupAttribute].map(function (subItem) { return renderItem(subItem, level + 1); }));
55
+ }
56
+ return (React.createElement("div", { key: String(item[props.primaryKey]), className: bem.element('drop-down-item', {
57
+ hover: props.hoveredId === item[props.primaryKey],
58
+ select: props.selectedIds.includes(item[props.primaryKey]),
59
+ level: level
60
+ }), onClick: function (e) {
61
+ e.preventDefault();
62
+ props.onItemSelect(item[props.primaryKey]);
63
+ }, onFocus: function () { return props.onItemHover(item[props.primaryKey]); }, onMouseOver: function () { return props.onItemHover(item[props.primaryKey]); } }, item.label));
64
+ };
51
65
  var bem = hooks_1.useBem('DropDownFieldView');
52
66
  return (React.createElement("div", { ref: props.forwardedRef, className: bem(bem.block({ size: props.size }), props.className), style: props.style },
53
67
  React.createElement("div", { className: bem.element('selected-items', {
@@ -79,13 +93,7 @@ function DropDownFieldView(props) {
79
93
  props.showReset && props.selectedIds.length > 0 && (React.createElement("button", { className: bem.element('reset'), onClick: props.onReset, "aria-label": __('Сбросить') })),
80
94
  props.isOpened && (React.createElement("div", { className: bem.element('drop-down') },
81
95
  props.isAutoComplete && (React.createElement("div", { className: bem.element('search') },
82
- React.createElement("input", __assign({}, props.searchInputProps, { onChange: function (e) { return props.searchInputProps.onChange(e.target.value); }, className: bem('form-control', 'form-control-' + props.size, bem.element('search-input'), props.searchInputProps.className) })))),
83
- React.createElement("div", { className: bem.element('drop-down-list') }, props.items.map(function (item) { return (React.createElement("button", { key: String(item[props.primaryKey]), type: 'button', className: bem.element('drop-down-item', {
84
- hover: props.hoveredId === item[props.primaryKey],
85
- select: props.selectedIds.includes(item[props.primaryKey])
86
- }), onClick: function (e) {
87
- e.preventDefault();
88
- props.onItemSelect(item[props.primaryKey]);
89
- }, onFocus: function () { return props.onItemHover(item[props.primaryKey]); }, onMouseOver: function () { return props.onItemHover(item[props.primaryKey]); } }, item.label)); }))))));
96
+ React.createElement("input", __assign({}, props.searchInputProps, { ref: inputRef, onChange: function (e) { return props.searchInputProps.onChange(e.target.value); }, className: bem('form-control', 'form-control-' + props.size, bem.element('search-input'), props.searchInputProps.className) })))),
97
+ React.createElement("div", { className: bem.element('drop-down-list') }, props.items.map(function (item) { return renderItem(item); }))))));
90
98
  }
91
99
  exports["default"] = DropDownFieldView;
@@ -7,6 +7,7 @@
7
7
  &_size_sm {
8
8
  font-size: 0.7875rem;
9
9
  }
10
+
10
11
  &_size_lg {
11
12
  font-size: 1.25rem;
12
13
  }
@@ -21,7 +22,6 @@
21
22
  background-clip: padding-box;
22
23
 
23
24
  background-color: #fff;
24
- box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
25
25
  border: 1px solid $border-default;
26
26
  border-radius: 0.25rem;
27
27
  color: $heading;
@@ -74,12 +74,14 @@
74
74
  opacity: .5;
75
75
  }
76
76
  }
77
+
77
78
  &_size_sm &__selected-items {
78
79
  padding: 0.25rem 0.5rem;
79
80
  line-height: 1.5;
80
81
  border-radius: 0.2rem;
81
82
  height: 31px;
82
83
  }
84
+
83
85
  &_size_lg &__selected-items {
84
86
  padding: 0.5rem 1rem;
85
87
  line-height: 1.5;
@@ -87,7 +89,7 @@
87
89
  height: 48px;
88
90
  }
89
91
 
90
- &__selected-item-multiple{
92
+ &__selected-item-multiple {
91
93
  cursor: default;
92
94
  margin-right: 5px;
93
95
  padding: 0 4px 0 8px;
@@ -97,21 +99,22 @@
97
99
  border-radius: 2px;
98
100
  background: #f5f5f5;
99
101
  }
100
- &__selected-item-multiple-remove{
102
+
103
+ &__selected-item-multiple-remove {
101
104
  cursor: pointer;
102
105
  margin-left: 6px;
103
106
 
104
107
  display: flex;
105
108
  align-items: center;
106
109
 
107
- svg{
110
+ svg {
108
111
  width: 10px;
109
112
  opacity: .5;
110
113
  transition: opacity .1s ease-in;
111
114
  }
112
115
 
113
- &:hover{
114
- svg{
116
+ &:hover {
117
+ svg {
115
118
  opacity: 1;
116
119
  }
117
120
  }
@@ -127,8 +130,7 @@
127
130
  cursor: pointer;
128
131
 
129
132
  &::before,
130
- &::after
131
- {
133
+ &::after {
132
134
  display: block;
133
135
  position: absolute;
134
136
  top: 50%;
@@ -177,6 +179,7 @@
177
179
  width: 100%;
178
180
  }
179
181
  }
182
+
180
183
  &_size_sm &__search {
181
184
  padding: 0.1rem 0.2rem;
182
185
  }
@@ -190,6 +193,14 @@
190
193
  background-color: transparent;
191
194
  border: unset;
192
195
 
196
+ &_group {
197
+ font-weight: bold;
198
+ }
199
+
200
+ &_level_1 {
201
+ padding-left: 1.25rem
202
+ }
203
+
193
204
  &_hover {
194
205
  background-color: $dropdown-divider-bg;
195
206
  }
@@ -199,12 +210,15 @@
199
210
  color: #152536;
200
211
  }
201
212
  }
213
+
202
214
  &_size_sm &__drop-down-item {
203
215
  padding: 0.25rem 0.5rem;
204
216
  }
217
+
205
218
  &_size_lg &__drop-down-item {
206
219
  padding: 0.5rem 1rem;
207
220
  }
221
+
208
222
  &__placeholder {
209
223
  color: #fff;
210
224
  }
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { IFieldListItemViewProps } from '@steroidsjs/core/ui/form/FieldList/FieldList';
3
- declare const _default: React.NamedExoticComponent<IFieldListItemViewProps>;
3
+ declare const _default: React.MemoExoticComponent<(props: IFieldListItemViewProps) => JSX.Element>;
4
4
  export default _default;
@@ -33,7 +33,7 @@ exports.__esModule = true;
33
33
  var React = __importStar(require("react"));
34
34
  var hooks_1 = require("@steroidsjs/core/hooks");
35
35
  var form_1 = require("@steroidsjs/core/ui/form");
36
- exports["default"] = React.memo(function FieldListItemView(props) {
36
+ exports["default"] = React.memo(function (props) {
37
37
  var bem = hooks_1.useBem('FieldListItemView');
38
38
  return (React.createElement("tr", null,
39
39
  props.items.map(function (field, index) { return (React.createElement("td", { key: index, className: bem(bem.element('table-cell'), field.className) },
@@ -21,21 +21,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
  exports.__esModule = true;
22
22
  var React = __importStar(require("react"));
23
23
  var hooks_1 = require("@steroidsjs/core/hooks");
24
+ var form_1 = require("@steroidsjs/core/ui/form");
24
25
  function FieldListView(props) {
25
26
  var bem = hooks_1.useBem('FieldListView');
26
27
  return (React.createElement("div", { className: bem(bem.block(), props.className), style: props.style, ref: props.forwardedRef },
27
- React.createElement("table", { className: bem(bem.element('table'), 'table', props.size && 'table-' + props.size) },
28
+ React.createElement("table", { className: bem(bem.element('table'), 'table', props.size && 'table-' + props.size, props.tableClassName) },
28
29
  React.createElement("thead", null,
29
30
  React.createElement("tr", null,
30
31
  props.items.map(function (field, rowIndex) { return (React.createElement("th", { key: rowIndex, className: bem(bem.element('table-cell-header'), field.headerClassName) }, field.label)); }),
31
32
  props.showRemove && (
32
33
  // eslint-disable-next-line jsx-a11y/control-has-associated-label
33
34
  React.createElement("th", null)))),
34
- React.createElement("tbody", null, props.children)),
35
- props.showAdd && !props.disabled && (React.createElement("button", { className: bem.element('link-add'), onClick: function (e) {
36
- e.preventDefault();
37
- props.onAdd();
38
- } }, __('Добавить ещё')))));
35
+ React.createElement("tbody", null, props.children),
36
+ React.createElement("tfoot", null,
37
+ React.createElement("tr", null,
38
+ React.createElement("td", { colSpan: props.items.length }, props.showAdd && !props.disabled && (React.createElement(form_1.Button, { formId: false, layout: false, color: 'secondary', className: bem.element('button-add'), onClick: function (e) {
39
+ e.preventDefault();
40
+ props.onAdd();
41
+ } }, __('Добавить ещё')))))))));
39
42
  }
40
43
  exports["default"] = FieldListView;
41
- ;
@@ -25,13 +25,8 @@
25
25
  color: $danger;
26
26
  }
27
27
 
28
- &__link-add {
28
+ &__button-add {
29
29
  margin-left: 0.75rem;
30
- border-bottom: 1px dashed $link-color;
31
-
32
- &:hover {
33
- text-decoration: none;
34
- }
35
30
  }
36
31
 
37
32
  .FileFieldView__files {
@@ -50,6 +50,6 @@ function ImageFieldModalView(props) {
50
50
  }
51
51
  }] },
52
52
  React.createElement("div", { className: 'mb-3' },
53
- React.createElement(react_image_crop_1["default"], __assign({}, props.crop.reactImageCropProps, { className: bem.element('crop'), src: props.image.url, crop: crop, onChange: setCrop })))));
53
+ React.createElement(react_image_crop_1["default"], __assign({}, props.crop.reactImageCropProps, { className: bem.element('crop'), src: props.image && props.image.url, crop: crop, onChange: setCrop })))));
54
54
  }
55
55
  exports["default"] = ImageFieldModalView;
@@ -36,16 +36,14 @@ var hooks_1 = require("@steroidsjs/core/hooks");
36
36
  function NumberFieldView(props) {
37
37
  // Input ref
38
38
  var inputRef = react_1.useRef(null);
39
- // Value state
40
- var _a = react_1.useState(null), value = _a[0], setValue = _a[1];
41
- var onStepUp = function () {
39
+ var onStepUp = react_1.useCallback(function () {
42
40
  inputRef.current.stepUp();
43
- setValue(inputRef.current.value);
44
- };
45
- var onStepDown = function () {
41
+ props.inputProps.onChange(inputRef.current.value);
42
+ }, [inputRef.current]);
43
+ var onStepDown = react_1.useCallback(function () {
46
44
  inputRef.current.stepDown();
47
- setValue(inputRef.current.value);
48
- };
45
+ props.inputProps.onChange(inputRef.current.value);
46
+ }, [inputRef.current]);
49
47
  var bem = hooks_1.useBem('NumberFieldView');
50
48
  return (React.createElement("div", { className: bem(bem.block({
51
49
  disabled: props.inputProps.disabled
@@ -55,13 +53,13 @@ function NumberFieldView(props) {
55
53
  }), !!props.errors && 'is-invalid') }, props.inputProps)),
56
54
  !props.disabled && !props.errors && (React.createElement("div", { className: bem.element('arrows-container') },
57
55
  React.createElement("button", { className: bem.element('arrow', {
58
- disabled: props.inputProps.max && value >= props.inputProps.max
59
- }), onClick: onStepUp },
56
+ disabled: props.inputProps.max && props.inputProps.value >= props.inputProps.max
57
+ }), type: 'button', onClick: onStepUp },
60
58
  React.createElement("svg", { viewBox: '64 64 896 896', width: '1em', height: '1em' },
61
59
  React.createElement("path", { d: 'M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140\n 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1\n 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z' }))),
62
60
  React.createElement("button", { className: bem.element('arrow', {
63
- disabled: props.inputProps.min && value <= props.inputProps.min
64
- }), onClick: onStepDown },
61
+ disabled: props.inputProps.min && props.inputProps.value <= props.inputProps.min
62
+ }), type: 'button', onClick: onStepDown },
65
63
  React.createElement("svg", { viewBox: '64 64 896 896', width: '1em', height: '1em' },
66
64
  React.createElement("path", { d: 'M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5\n 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39\n 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z' })))))));
67
65
  }
@@ -15,6 +15,7 @@ $tooltip-arrow-offset-vertical-bottom: 7px;
15
15
  transform: translate(0,0);
16
16
  opacity: 0;
17
17
  transition: opacity .15s ease-in, transform .15s ease-in;
18
+ z-index: 150;
18
19
 
19
20
  &_show {
20
21
  opacity: 1;
@@ -1,4 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { IBemHocOutput } from '@steroidsjs/core/hoc/bem';
3
2
  import { IBreadcrumbsViewProps } from '@steroidsjs/core/ui/nav/Breadcrumbs/Breadcrumbs';
4
- export default function BreadcrumbsView(props: IBreadcrumbsViewProps & IBemHocOutput): JSX.Element;
3
+ export default function BreadcrumbsView(props: IBreadcrumbsViewProps): JSX.Element;
@@ -32,7 +32,7 @@ function BreadcrumbsView(props) {
32
32
  React.createElement("ol", { className: bem.element('list') }, items.map(function (item, index) {
33
33
  var isLastItem = items.length === index + 1;
34
34
  return (React.createElement("li", { key: item.id || index, className: bem.element('item') },
35
- !isLastItem && item.id && (React.createElement(Link_1["default"], { toRoute: item.id, href: item.id }, item.title)),
35
+ !isLastItem && item.id && (React.createElement(Link_1["default"], { toRoute: item.id, toRouteParams: props.routeParams, href: item.id }, item.title)),
36
36
  (isLastItem || !item.id) && (React.createElement("span", null, props.pageTitle || item.title))));
37
37
  }))));
38
38
  }
@@ -4,6 +4,7 @@
4
4
  &__list {
5
5
  display: flex;
6
6
  list-style: none;
7
+ padding: 0;
7
8
  }
8
9
 
9
10
  &__item {
@@ -39,7 +39,7 @@ var hooks_1 = require("@steroidsjs/core/hooks");
39
39
  function NavIconView(props) {
40
40
  var bem = hooks_1.useBem('NavIconView');
41
41
  return (React.createElement("div", { className: bem(bem.block(), props.className) },
42
- props.items.map(function (item, index) { return (React.createElement(Button_1["default"], __assign({ icon: props.icon ? props.icon : 'circle-notch', key: item.id || index, link: true, onClick: function () { return props.onClick(item, index); } }, item, { label: null, hint: item.hint || item.label || null }))); }),
42
+ props.items.map(function (item, index) { return (React.createElement(Button_1["default"], __assign({ icon: props.icon ? props.icon : 'circle-notch', key: item.id || index, link: true, onClick: function () { return props.onClick(item, index); }, layout: false }, item, { label: null, hint: item.hint || item.label || null }))); }),
43
43
  props.children));
44
44
  }
45
45
  exports["default"] = NavIconView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/bootstrap",
3
- "version": "2.1.0-beta.7",
3
+ "version": "2.1.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@ckeditor/ckeditor5-react": "^3.0.2",
21
21
  "@steroidsjs/ckeditor5": "^27.0.2-rc.2",
22
- "@steroidsjs/core": "^2.1.0-beta.30",
22
+ "@steroidsjs/core": "^2.2.9",
23
23
  "bootstrap": "^4.5.2",
24
24
  "lodash": "^4.17.20",
25
25
  "lodash-es": "^4.17.20",
@@ -1,52 +1,52 @@
1
- $primary: #651FFF;
2
- $primary-dark: #410FAD;
3
- $primary-light: #D8CCF7;
1
+ $primary: #651FFF !default;
2
+ $primary-dark: darken($primary, 25) !default;
3
+ $primary-light: lighten($primary, 50) !default;
4
4
 
5
- $secondary: #97A7C8;
6
- $secondary-dark: #596886;
7
- $secondary-light: #E3EAF9;
5
+ $secondary: #97A7C8 !default;
6
+ $secondary-dark: darken($secondary, 25) !default;
7
+ $secondary-light: lighten($secondary, 50) !default;
8
8
 
9
- $heading: #152536;
10
- $body: #68717A;
11
- $white: #FFFFFF;
9
+ $success: #64D03E !default;
10
+ $success-dark: darken($success, 25) !default;
11
+ $success-light: lighten($success, 50) !default;
12
12
 
13
- $success: #64D03E;
14
- $success-dark: #218838;
15
- $success-light: #ABED94;
13
+ $danger: #FF4557 !default;
14
+ $danger-dark: darken($danger, 25) !default;
15
+ $danger-light: lighten($danger, 50) !default;
16
16
 
17
- $danger: #FF4557;
18
- $danger-dark: #DA2839;
19
- $danger-light: #ff99a3;
17
+ $warning: #fad826 !default;
18
+ $warning-dark: darken($warning, 25) !default;
19
+ $warning-light: lighten($warning, 50) !default;
20
20
 
21
- $warning: #fad826;
22
- $warning-dark: #dcc131;
23
- $warning-light: #fff3b2;
21
+ $info: #39bbd8 !default;
22
+ $info-dark: darken($info, 25) !default;
23
+ $info-light: lighten($info, 50) !default;
24
24
 
25
- $info: #39bbd8;
26
- $info-dark: #2796af;
27
- $info-light: #a7efff;
25
+ $light: #f8f9fa !default;
26
+ $light-dark: darken($light, 25) !default;
27
+ $light-light: lighten($light, 50) !default;
28
28
 
29
- $light: #f8f9fa;
30
- $light-dark: #e2e6ea;
31
- $light-light: #fafafa;
29
+ $dark: #343a40 !default;
30
+ $dark-dark: darken($dark, 25) !default;
31
+ $dark-light: lighten($dark, 50) !default;
32
32
 
33
- $dark: #343a40;
34
- $dark-dark: #1a1c1e;
35
- $dark-light: #acacac;
33
+ $heading: #152536 !default;
34
+ $body: #68717A !default;
35
+ $white: #FFFFFF !default;
36
36
 
37
37
  $color-themes: () !default;
38
38
  $color-themes: map-merge(
39
- (
40
- "primary": ("color": $primary, "color-dark": $primary-dark, "color-light": $primary-light, "text-color": $white),
41
- "secondary": ("color": $secondary, "color-dark": $secondary-dark, "color-light": $secondary-light, "text-color": $white),
42
- "success": ("color": $success, "color-dark": $success-dark, "color-light": $success-light, "text-color": $white),
43
- "danger": ("color": $danger, "color-dark": $danger-dark, "color-light": $danger-light, "text-color": $white),
44
- "warning": ("color": $warning, "color-dark": $warning-dark, "color-light": $warning-light, "text-color": $dark),
45
- "info": ("color": $info, "color-dark": $info-dark, "color-light": $info-light, "text-color": $white),
46
- "light": ("color": $light, "color-dark": $light-dark, "color-light": $light-light, "text-color": $dark),
47
- "dark": ("color": $dark, "color-dark": $dark-dark, "color-light": $dark-light, "text-color": $white)
48
- ),
49
- $color-themes
39
+ (
40
+ "primary": ("color": $primary, "color-dark": $primary-dark, "color-light": $primary-light, "text-color": $white),
41
+ "secondary": ("color": $secondary, "color-dark": $secondary-dark, "color-light": $secondary-light, "text-color": $white),
42
+ "success": ("color": $success, "color-dark": $success-dark, "color-light": $success-light, "text-color": $white),
43
+ "danger": ("color": $danger, "color-dark": $danger-dark, "color-light": $danger-light, "text-color": $white),
44
+ "warning": ("color": $warning, "color-dark": $warning-dark, "color-light": $warning-light, "text-color": $dark),
45
+ "info": ("color": $info, "color-dark": $info-dark, "color-light": $info-light, "text-color": $white),
46
+ "light": ("color": $light, "color-dark": $light-dark, "color-light": $light-light, "text-color": $dark),
47
+ "dark": ("color": $dark, "color-dark": $dark-dark, "color-light": $dark-light, "text-color": $white)
48
+ ),
49
+ $color-themes
50
50
  );
51
51
 
52
52
  $grey-light: #D9D9D9;