@steroidsjs/bootstrap 3.0.0-beta.74 → 3.0.0-beta.75

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/index.d.ts CHANGED
@@ -182,6 +182,9 @@ declare const _default: {
182
182
  'list.ContentColumnView': {
183
183
  lazy: () => any;
184
184
  };
185
+ 'list.DiagramColumnView': {
186
+ lazy: () => any;
187
+ };
185
188
  'list.ListView': {
186
189
  lazy: () => any;
187
190
  };
package/index.js CHANGED
@@ -185,6 +185,9 @@ exports["default"] = {
185
185
  'list.ContentColumnView': {
186
186
  lazy: function () { return require('./list/Grid/views/ContentColumnView/ContentColumnView')["default"]; }
187
187
  },
188
+ 'list.DiagramColumnView': {
189
+ lazy: function () { return require('./list/Grid/views/DiagramColumnView/DiagramColumnView')["default"]; }
190
+ },
188
191
  'list.ListView': {
189
192
  lazy: function () { return require('./list/List/ListView')["default"]; }
190
193
  },
@@ -90,7 +90,9 @@ function GridView(props) {
90
90
  renderSortButton(column.attribute, 'desc'))))); })),
91
91
  renderInsideSearchForm()),
92
92
  React.createElement("tbody", null,
93
- props.items && props.items.map(function (item, rowIndex) { return (React.createElement("tr", { key: item[props.primaryKey] || rowIndex }, props.columns.map(function (column, columnIndex) { return (React.createElement("td", { key: columnIndex, className: bem(bem.element('column'), column.className), "data-label": (0, isString_1["default"])(column.label) ? column.label : null }, props.renderValue(item, column))); }))); }),
93
+ props.items && props.items.map(function (item, rowIndex) { return (React.createElement("tr", { key: item[props.primaryKey] || rowIndex }, props.columns.map(function (column, columnIndex) { return (React.createElement("td", { key: columnIndex, className: bem(bem.element('column', {
94
+ isDiagram: !!column.diagram
95
+ }), column.className), "data-label": (0, isString_1["default"])(column.label) ? column.label : null }, props.renderValue(item, column))); }))); }),
94
96
  emptyContent && (React.createElement("tr", null,
95
97
  React.createElement("td", { colSpan: props.columns.length }, emptyContent))))),
96
98
  props.renderPagination()));
@@ -93,7 +93,7 @@ $grid-td-alternating-color: var(--grid-td-alternating-color);
93
93
  }
94
94
 
95
95
  th,
96
- td {
96
+ td:not(#{$root}__column_isDiagram) {
97
97
  padding: 24px 16px;
98
98
  }
99
99
  }
@@ -105,7 +105,7 @@ $grid-td-alternating-color: var(--grid-td-alternating-color);
105
105
  }
106
106
 
107
107
  th,
108
- td {
108
+ td:not(#{$root}__column_isDiagram) {
109
109
  padding: 21px 12px;
110
110
  }
111
111
  }
@@ -117,7 +117,7 @@ $grid-td-alternating-color: var(--grid-td-alternating-color);
117
117
  }
118
118
 
119
119
  th,
120
- td {
120
+ td:not(#{$root}__column_isDiagram) {
121
121
  padding: 16px 8px;
122
122
  }
123
123
  }
@@ -1,2 +1,2 @@
1
- import { IContentColumnViewProps } from '@steroidsjs/core/ui/list/Grid/Grid';
2
- export default function ContentColumnView(props: IContentColumnViewProps): JSX.Element;
1
+ import { IColumnViewProps } from '@steroidsjs/core/ui/list/Grid/Grid';
2
+ export default function ContentColumnView(props: IColumnViewProps): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { IColumnViewProps } from '@steroidsjs/core/ui/list/Grid/Grid';
2
+ import './DiagramColumnView.scss';
3
+ export default function DiagramColumnView(props: IColumnViewProps): JSX.Element;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ var react_1 = __importDefault(require("react"));
7
+ var useBem_1 = __importDefault(require("@steroidsjs/core/hooks/useBem"));
8
+ require("./DiagramColumnView.scss");
9
+ var DiagramType;
10
+ (function (DiagramType) {
11
+ DiagramType["HORIZONTAL"] = "horizontal";
12
+ DiagramType["VERTICAL"] = "vertical";
13
+ DiagramType["CIRCLE"] = "circle";
14
+ })(DiagramType || (DiagramType = {}));
15
+ function DiagramColumnView(props) {
16
+ var _a, _b, _c, _d, _e, _f;
17
+ var bem = (0, useBem_1["default"])('DiagramColumnView');
18
+ var isHorizontal = ((_a = props.diagram) === null || _a === void 0 ? void 0 : _a.type) === DiagramType.HORIZONTAL;
19
+ var isVertical = ((_b = props.diagram) === null || _b === void 0 ? void 0 : _b.type) === DiagramType.VERTICAL;
20
+ var isCircle = ((_c = props.diagram) === null || _c === void 0 ? void 0 : _c.type) === DiagramType.CIRCLE;
21
+ var getItemData = function (item) { return ({
22
+ itemPercentage: props.item[item === null || item === void 0 ? void 0 : item.percentageAttribute],
23
+ itemColor: item === null || item === void 0 ? void 0 : item.color
24
+ }); };
25
+ var renderDiagram = function (diagramItems, hasPercentSign, hasSubtitle, fillingProperty) {
26
+ var _a;
27
+ if (fillingProperty === void 0) { fillingProperty = null; }
28
+ return (react_1["default"].createElement("div", { className: bem(bem.block({
29
+ size: props.size,
30
+ type: (_a = props.diagram) === null || _a === void 0 ? void 0 : _a.type
31
+ })) },
32
+ react_1["default"].createElement("div", { className: bem.element('wrapper') },
33
+ react_1["default"].createElement("div", { className: bem.element('wrapper-diagrams') }, diagramItems.map(function (item, itemIndex) {
34
+ var _a;
35
+ var _b;
36
+ var _c = getItemData(item), itemColor = _c.itemColor, itemPercentage = _c.itemPercentage;
37
+ return (react_1["default"].createElement("div", { key: itemIndex, className: bem.element('diagram', {
38
+ type: (_b = props.diagram) === null || _b === void 0 ? void 0 : _b.type
39
+ }) },
40
+ react_1["default"].createElement("span", { className: bem.element('diagram-percentage') },
41
+ itemPercentage,
42
+ hasPercentSign && ' %'),
43
+ react_1["default"].createElement("div", { className: bem.element('diagram-filling', {
44
+ color: itemColor
45
+ }), style: (_a = {}, _a[fillingProperty] = "".concat(itemPercentage, "%"), _a) })));
46
+ })),
47
+ hasSubtitle && (react_1["default"].createElement("span", { className: bem.element('subtitle') }, props.item[props.subtitleAttribute])))));
48
+ };
49
+ if (isHorizontal) {
50
+ return (renderDiagram((_d = props.diagram) === null || _d === void 0 ? void 0 : _d.items, true, false, 'width'));
51
+ }
52
+ if (isVertical) {
53
+ return (renderDiagram((_e = props.diagram) === null || _e === void 0 ? void 0 : _e.items, true, false, 'height'));
54
+ }
55
+ if (isCircle) {
56
+ return (renderDiagram((_f = props.diagram) === null || _f === void 0 ? void 0 : _f.items, false, !!props.subtitleAttribute));
57
+ }
58
+ return null;
59
+ }
60
+ exports["default"] = DiagramColumnView;
@@ -0,0 +1,170 @@
1
+ @import "style/variables";
2
+
3
+ .DiagramColumnView {
4
+ $root: &;
5
+
6
+ &_size {
7
+ &_sm {
8
+ #{$root}__diagram_type_horizontal,
9
+ #{$root}__diagram_type_vertical {
10
+ min-height: 51px !important;
11
+ }
12
+
13
+ #{$root}__diagram_type_circle {
14
+ width: 30px;
15
+ height: 30px;
16
+ }
17
+ }
18
+ &_md {
19
+ #{$root}__diagram_type_horizontal,
20
+ #{$root}__diagram_type_vertical {
21
+ min-height: 65px !important;
22
+ }
23
+
24
+ #{$root}__diagram_type_circle {
25
+ width: 36px;
26
+ height: 36px;
27
+ }
28
+ }
29
+ &_lg {
30
+ #{$root}__diagram_type_horizontal,
31
+ #{$root}__diagram_type_vertical {
32
+ min-height: 73px !important;
33
+ }
34
+
35
+ #{$root}__diagram_type_circle {
36
+ width: 40px;
37
+ height: 40px;
38
+ }
39
+ }
40
+ }
41
+
42
+ &__diagram {
43
+ font-weight: $font-weight-lg;
44
+ font-size: $font-size-xs;
45
+ line-height: $line-height-xs;
46
+ color: $text-color;
47
+ width: 100%;
48
+ }
49
+
50
+ &_type_horizontal {
51
+ #{$root}__diagram {
52
+ position: relative;
53
+
54
+ &-percentage {
55
+ position: absolute;
56
+ z-index: 2;
57
+ left: 50%;
58
+ top: 50%;
59
+ transform: translateX(-50%) translateY(-50%);
60
+ }
61
+
62
+ &-filling {
63
+ height: 100%;
64
+ position: absolute;
65
+ left: 0;
66
+ top: 0;
67
+
68
+ &_color {
69
+ @each $color, $color-map in $diagram-colors {
70
+ &_#{$color} {
71
+ background-color: map-get($color-map, color-themed);
72
+ border-right: 1px solid map-get($color-map, color);
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ &_type_vertical {
81
+ #{$root}__wrapper-diagrams {
82
+ display: flex;
83
+ flex-flow: row nowrap;
84
+ height: 100%;
85
+ }
86
+
87
+ #{$root}__diagram {
88
+ position: relative;
89
+
90
+ &-percentage {
91
+ position: absolute;
92
+ white-space: nowrap;
93
+ width: 100%;
94
+ text-align: center;
95
+ z-index: 2;
96
+ left: 50%;
97
+ top: 50%;
98
+ transform: translateX(-50%) translateY(-50%);
99
+ }
100
+
101
+ &-filling {
102
+ width: 100%;
103
+ position: absolute;
104
+ left: 0;
105
+ bottom: 0;
106
+
107
+ &_color {
108
+ @each $color, $color-map in $diagram-colors {
109
+ &_#{$color} {
110
+ background-color: map-get($color-map, color-themed);
111
+ border-top: 1px solid map-get($color-map, color);
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+ &_type_circle {
120
+ display: flex;
121
+ justify-content: center;
122
+
123
+ #{$root}__wrapper {
124
+ display: flex;
125
+ flex-flow: column nowrap;
126
+
127
+ &-diagrams {
128
+ display: flex;
129
+ flex-flow: row nowrap;
130
+ justify-content: center;
131
+ }
132
+
133
+ #{$root}__subtitle {
134
+ margin: 0 auto;
135
+
136
+ font-weight: $font-weight-sm;
137
+ font-size: $font-size-base;
138
+ line-height: $line-height-base;
139
+ color: $element-placeholder-color;
140
+ }
141
+ }
142
+
143
+ #{$root}__diagram {
144
+ position: relative;
145
+ margin: -1px;
146
+
147
+ &-filling {
148
+ width: 100%;
149
+ height: 100%;
150
+ border-radius: 100%;
151
+
152
+ &_color {
153
+ @each $color, $color-map in $diagram-colors {
154
+ &_#{$color} {
155
+ border: 2px solid map-get($color-map, color);
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ &-percentage {
162
+ position: absolute;
163
+ z-index: 2;
164
+ left: 50%;
165
+ top: 50%;
166
+ transform: translateX(-50%) translateY(-50%);
167
+ }
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,2 @@
1
+ import DiagramColumnView from './DiagramColumnView';
2
+ export default DiagramColumnView;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ var DiagramColumnView_1 = __importDefault(require("./DiagramColumnView"));
7
+ exports["default"] = DiagramColumnView_1["default"];
@@ -48,7 +48,7 @@ function NavIconView(props) {
48
48
  active: item.isActive,
49
49
  disabled: item.disabled
50
50
  }), props.navClassName) },
51
- React.createElement(Button_1["default"], __assign({ icon: props.icon ? props.icon : DEFAULT_ICON, link: true, onClick: function () { return props.onClick(item, index); } }, item, { label: null, hint: item.hint || item.label || null })))); })),
51
+ React.createElement(Button_1["default"], __assign({ icon: props.icon ? props.icon : DEFAULT_ICON, link: true, onClick: function () { return props.onClick(item, index); } }, item, { label: item.label, hint: item.hint || item.label || null })))); })),
52
52
  React.createElement("div", { className: bem.element('content') }, props.children)));
53
53
  }
54
54
  exports["default"] = NavIconView;
@@ -4,5 +4,25 @@
4
4
  flex-flow: row nowrap;
5
5
  align-items: center;
6
6
  column-gap: 24px;
7
+
8
+ &-item {
9
+ display: flex;
10
+ flex-flow: row nowrap;
11
+ align-items: center;
12
+ color: $text-color;
13
+ column-gap: 8px;
14
+
15
+ .ButtonView__text {
16
+ color: $text-color;
17
+ }
18
+
19
+ &_disabled .ButtonView_disabled .ButtonView__link:hover .ButtonView__text {
20
+ color: $element-placeholder-color-disabled;
21
+ }
22
+
23
+ &_disabled .ButtonView_disabled .ButtonView__link .ButtonView__text {
24
+ color: $element-placeholder-color-disabled;
25
+ }
26
+ }
7
27
  }
8
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/bootstrap",
3
- "version": "3.0.0-beta.74",
3
+ "version": "3.0.0-beta.75",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
@@ -46,6 +46,11 @@
46
46
 
47
47
  --scroll-thumb-color: #cbd5db;
48
48
  --scroll-track-color: #f1f5f7;
49
+
50
+ --diagram-success: var(--success-light);
51
+ --diagram-warning: var(--warning-light);
52
+ --diagram-danger: var(--danger-light);
53
+ --diagram-secondary: var(--secondary-light);
49
54
  }
50
55
 
51
56
  html[data-theme="dark"] {
@@ -95,6 +100,11 @@ html[data-theme="dark"] {
95
100
 
96
101
  --scroll-thumb-color: #333646;
97
102
  --scroll-track-color: #26272f;
103
+
104
+ --diagram-success: var(--success-dark);
105
+ --diagram-warning: var(--warning-dark);
106
+ --diagram-danger: var(--danger-dark);
107
+ --diagram-secondary: var(--secondary-dark);
98
108
  }
99
109
 
100
110
  $primary: var(--primary);
@@ -144,6 +154,11 @@ $element-field-background-color: var(--element-field-background-color);
144
154
 
145
155
  $scroll-thumb-color: var(--scroll-thumb-color);
146
156
  $scroll-track-color: var(--scroll-track-color);
157
+
158
+ $diagram-success: var(--diagram-success);
159
+ $diagram-warning: var(--diagram-warning);
160
+ $diagram-danger: var(--diagram-danger);
161
+ $diagram-secondary: var(--diagram-secondary);
147
162
  //** Themed colors **//
148
163
 
149
164
  //! Base colors !//
@@ -219,3 +234,27 @@ $color-themes: map-merge(
219
234
  ),
220
235
  $color-themes
221
236
  );
237
+
238
+
239
+ $diagram-colors: () !default;
240
+ $diagram-colors: map-merge(
241
+ (
242
+ "success": (
243
+ "color": $success,
244
+ "color-themed": $diagram-success,
245
+ ),
246
+ "warning": (
247
+ "color": $warning,
248
+ "color-themed": $diagram-warning,
249
+ ),
250
+ "danger": (
251
+ "color": $danger,
252
+ "color-themed": $diagram-danger,
253
+ ),
254
+ "secondary": (
255
+ "color": $secondary,
256
+ "color-themed": $diagram-secondary,
257
+ ),
258
+ ),
259
+ $diagram-colors
260
+ );