@steroidsjs/bootstrap 3.0.0-beta.29 → 3.0.0-beta.30
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.
- package/content/Accordion/AccordionItemView.scss +15 -10
- package/content/Alert/AlertView.scss +2 -0
- package/content/Avatar/AvatarView.scss +9 -1
- package/content/Badge/BadgeView.js +6 -6
- package/content/Badge/BadgeView.scss +40 -30
- package/content/Card/CardView.js +34 -14
- package/content/Card/CardView.scss +126 -110
- package/content/Detail/DetailView.scss +1 -0
- package/form/Button/ButtonView.js +1 -0
- package/form/Button/ButtonView.scss +18 -8
- package/form/CheckboxField/CheckboxFieldView.js +6 -3
- package/form/CheckboxField/CheckboxFieldView.scss +66 -1
- package/form/DropDownField/DropDownFieldView.js +46 -47
- package/form/DropDownField/DropDownFieldView.scss +390 -183
- package/form/DropDownField/views/DropDownItem/DropDownItemView.d.ts +3 -0
- package/form/DropDownField/views/DropDownItem/DropDownItemView.js +80 -0
- package/form/DropDownField/views/DropDownItem/DropDownItemView.scss +217 -0
- package/form/DropDownField/views/DropDownItem/index.d.ts +2 -0
- package/form/DropDownField/views/DropDownItem/index.js +7 -0
- package/form/Form/FormView.js +3 -3
- package/form/Form/FormView.scss +10 -14
- package/form/InputField/InputFieldView.scss +0 -27
- package/form/NumberField/NumberFieldView.scss +14 -32
- package/form/PasswordField/PasswordFieldView.scss +3 -6
- package/form/RadioListField/RadioListFieldView.js +7 -4
- package/form/RadioListField/RadioListFieldView.scss +115 -19
- package/form/TextField/TextFieldView.scss +1 -3
- package/icons/index.js +2 -0
- package/icons/svgs/dots.svg +5 -0
- package/icons/svgs/search.svg +4 -0
- package/layout/Tooltip/TooltipView.js +6 -6
- package/layout/Tooltip/TooltipView.scss +45 -37
- package/package.json +3 -3
- package/scss/mixins/index.scss +1 -1
- package/scss/mixins/scroll.scss +31 -0
- package/scss/variables/common/colors.scss +1 -0
- package/scss/variables/index.scss +0 -1
- package/scss/mixins/card.scss +0 -26
- package/scss/variables/components/card.scss +0 -20
|
@@ -43,9 +43,12 @@ var useUniqueId_1 = __importDefault(require("@steroidsjs/core/hooks/useUniqueId"
|
|
|
43
43
|
function CheckboxFieldView(props) {
|
|
44
44
|
var bem = (0, hooks_1.useBem)('CheckboxFieldView');
|
|
45
45
|
var id = (0, useUniqueId_1["default"])('checkbox');
|
|
46
|
-
return (React.createElement("div", { className:
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
return (React.createElement("div", { className: bem(bem.block({
|
|
47
|
+
size: props.size,
|
|
48
|
+
hasErrors: !!props.errors
|
|
49
|
+
}), props.className), style: props.style, onClick: props.onChange },
|
|
50
|
+
React.createElement("input", __assign({ className: bem.element('input'), id: id }, props.inputProps, { disabled: props.disabled, required: props.required })),
|
|
51
|
+
React.createElement("label", { className: bem.element('label'), htmlFor: id },
|
|
49
52
|
React.createElement("span", { className: bem.element('label-text', { required: props.required }) }, props.label))));
|
|
50
53
|
}
|
|
51
54
|
exports["default"] = CheckboxFieldView;
|
|
@@ -115,8 +115,73 @@
|
|
|
115
115
|
border-color: none;
|
|
116
116
|
background-image: url("data:image/svg+xml,%3Csvg width='11' height='9' viewBox='0 0 11 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.8584 1.48401L4.3584 7.48401L1.8584 4.75674' stroke='black' stroke-opacity='0.1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A");
|
|
117
117
|
}
|
|
118
|
+
}
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
&_size {
|
|
121
|
+
&_lg {
|
|
122
|
+
#{$root}__label {
|
|
123
|
+
&::before {
|
|
124
|
+
width: 24px;
|
|
125
|
+
height: 24px;
|
|
126
|
+
border-radius: $radius-small;
|
|
127
|
+
margin-right: 12px;
|
|
128
|
+
}
|
|
129
|
+
&::after {
|
|
130
|
+
width: 26px;
|
|
131
|
+
height: 26px;
|
|
132
|
+
border-radius: $radius-large;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&-text {
|
|
136
|
+
font-size: $font-size-lg;
|
|
137
|
+
line-height: 24px;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&_md {
|
|
143
|
+
#{$root}__label {
|
|
144
|
+
&::before {
|
|
145
|
+
width: 20px;
|
|
146
|
+
height: 20px;
|
|
147
|
+
border-radius: 6px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&::after {
|
|
151
|
+
width: 22px;
|
|
152
|
+
height: 22px;
|
|
153
|
+
border-radius: $radius-medium;
|
|
154
|
+
transform: translate(-13.5%, -13.5%);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&-text {
|
|
158
|
+
font-size: $font-size-base;
|
|
159
|
+
line-height: 22px;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&_sm {
|
|
165
|
+
#{$root}__label {
|
|
166
|
+
&::before {
|
|
167
|
+
width: 16px;
|
|
168
|
+
height: 16px;
|
|
169
|
+
border-radius: 6px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&::after {
|
|
173
|
+
width: 18px;
|
|
174
|
+
height: 18px;
|
|
175
|
+
border-radius: $radius-medium;
|
|
176
|
+
transform: translate(-15.5%, -15.5%);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&-text {
|
|
180
|
+
font-size: $font-size-sm;
|
|
181
|
+
line-height: 18px;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
120
185
|
}
|
|
121
186
|
}
|
|
122
187
|
.has-errors label {
|
|
@@ -33,20 +33,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
33
|
__setModuleDefault(result, mod);
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
if (ar || !(i in from)) {
|
|
39
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40
|
-
ar[i] = from[i];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
38
|
};
|
|
45
39
|
exports.__esModule = true;
|
|
46
40
|
var React = __importStar(require("react"));
|
|
47
41
|
var react_1 = require("react");
|
|
48
42
|
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
43
|
+
var Icon_1 = __importDefault(require("@steroidsjs/core/ui/content/Icon"));
|
|
44
|
+
var content_1 = require("@steroidsjs/core/ui/content");
|
|
45
|
+
var DropDownItem_1 = __importDefault(require("./views/DropDownItem"));
|
|
46
|
+
var getSelectedItemsLabel = function (selectedItems) { return (selectedItems
|
|
47
|
+
.map(function (selectedItem) { return selectedItem.label; })
|
|
48
|
+
.join(', ')); };
|
|
49
|
+
var getSelectedItemsCount = function (selectedItems) {
|
|
50
|
+
var _a;
|
|
51
|
+
if (selectedItems.length <= 1) {
|
|
52
|
+
return (_a = selectedItems[0]) === null || _a === void 0 ? void 0 : _a.label;
|
|
53
|
+
}
|
|
54
|
+
return "".concat(__('Выбрано'), " (").concat(selectedItems.length, ")");
|
|
55
|
+
};
|
|
56
|
+
var toDropDownItem = function (props) { return function (item, itemIndex) { return (React.createElement(DropDownItem_1["default"], __assign({}, props, { key: itemIndex, item: item }))); }; };
|
|
49
57
|
function DropDownFieldView(props) {
|
|
58
|
+
var _a;
|
|
50
59
|
var bem = (0, hooks_1.useBem)('DropDownFieldView');
|
|
51
60
|
var inputRef = (0, react_1.useRef)(null);
|
|
52
61
|
// Auto focus on search
|
|
@@ -55,48 +64,38 @@ function DropDownFieldView(props) {
|
|
|
55
64
|
inputRef.current.focus();
|
|
56
65
|
}
|
|
57
66
|
}, [props.isAutoComplete, props.isOpened, props.isSearchAutoFocus]);
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return (React.createElement("div", { ref: props.forwardedRef, className: bem(bem.block({ size: props.size }), props.className), style: props.style },
|
|
67
|
+
var renderPlaceholder = React.useCallback(function () {
|
|
68
|
+
var _a;
|
|
69
|
+
return props.placeholder && !((_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.length)
|
|
70
|
+
? (React.createElement("div", { className: bem.element('placeholder') }, props.placeholder))
|
|
71
|
+
: null;
|
|
72
|
+
}, [bem, props.placeholder, props.selectedIds]);
|
|
73
|
+
var renderItems = React.useCallback(function () { return props.groupAttribute
|
|
74
|
+
? (React.createElement(content_1.Accordion, null, props.items.map(toDropDownItem(props))))
|
|
75
|
+
: (React.createElement(React.Fragment, null, props.items.map(toDropDownItem(props)))); }, [props]);
|
|
76
|
+
return (React.createElement("div", { ref: props.forwardedRef, className: bem(bem.block((_a = {
|
|
77
|
+
size: props.size
|
|
78
|
+
},
|
|
79
|
+
_a["".concat(props.color)] = !!props.color && !props.outline,
|
|
80
|
+
_a["outline_".concat(props.color)] = props.outline,
|
|
81
|
+
_a.opened = props.isOpened,
|
|
82
|
+
_a)), props.className), onKeyPress: function (e) { return e.key === 'Enter' && props.onOpen(); }, style: props.style, role: "button", tabIndex: 0 },
|
|
75
83
|
React.createElement("div", { className: bem.element('selected-items', {
|
|
76
84
|
reset: props.showReset,
|
|
77
|
-
'no-border': props.noBorder,
|
|
78
|
-
'is-invalid': !!props.errors,
|
|
79
85
|
disabled: props.disabled
|
|
80
|
-
}), onClick: props.onOpen,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
props.onItemRemove(item[props.primaryKey]);
|
|
88
|
-
}, onKeyPress: function (e) {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
e.stopPropagation();
|
|
91
|
-
props.onItemRemove(item[props.primaryKey]);
|
|
92
|
-
}, tabIndex: 0, role: 'button' },
|
|
93
|
-
React.createElement("svg", { viewBox: "64 64 896 896", className: "", width: "1em", height: "1em" },
|
|
94
|
-
React.createElement("path", { d: "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3\n 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4\n 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3\n 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" }))))))
|
|
95
|
-
: (React.createElement("span", { key: item.id, className: bem.element('selected-item') }, item.label))); })),
|
|
96
|
-
props.showReset && props.selectedIds.length > 0 && (React.createElement("button", { className: bem.element('reset'), onClick: props.onReset, "aria-label": __('Сбросить') })),
|
|
86
|
+
}), onClick: props.onOpen, tabIndex: -1, role: 'button' },
|
|
87
|
+
renderPlaceholder(),
|
|
88
|
+
React.createElement("span", { className: bem.element('selected-items') }, props.showEllipses
|
|
89
|
+
? getSelectedItemsLabel(props.selectedItems)
|
|
90
|
+
: getSelectedItemsCount(props.selectedItems))),
|
|
91
|
+
props.showReset && props.selectedIds.length > 0 && (React.createElement(Icon_1["default"], { name: "field-close", className: bem.element('icon-close'), tabIndex: -1, onClick: props.onReset, "aria-label": __('Сбросить') })),
|
|
92
|
+
React.createElement(Icon_1["default"], { name: 'accordion-chevron', className: bem.element('icon-chevron'), tabIndex: -1, onClick: props.onOpen }),
|
|
97
93
|
props.isOpened && (React.createElement("div", { className: bem.element('drop-down') },
|
|
98
|
-
props.isAutoComplete && (React.createElement("div", { className: bem.element('search'
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
props.isAutoComplete && (React.createElement("div", { className: bem.element('search', {
|
|
95
|
+
size: props.size
|
|
96
|
+
}) },
|
|
97
|
+
React.createElement(Icon_1["default"], { name: 'search', className: bem.element('search-icon') }),
|
|
98
|
+
React.createElement("input", __assign({}, props.searchInputProps, { ref: inputRef, onChange: function (e) { return props.searchInputProps.onChange(e.target.value); }, className: bem(bem.element('search-input'), props.searchInputProps.className) })))),
|
|
99
|
+
React.createElement("div", { className: bem.element('drop-down-list') }, renderItems())))));
|
|
101
100
|
}
|
|
102
101
|
exports["default"] = DropDownFieldView;
|