@steroidsjs/bootstrap 3.0.30 → 3.0.34

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 (48) hide show
  1. package/content/Accordion/AccordionItemView.js +0 -1
  2. package/content/Accordion/AccordionItemView.scss +56 -7
  3. package/content/Accordion/AccordionView.scss +2 -0
  4. package/content/Calendar/CalendarView.js +8 -3
  5. package/content/Calendar/CalendarView.scss +2 -2
  6. package/form/CheckboxListField/CheckboxListFieldView.js +1 -1
  7. package/form/DateRangeField/DateRangeFieldView.js +10 -1
  8. package/form/DateRangeField/DateRangeFieldView.scss +54 -0
  9. package/form/DateRangeField/views/RangeButtons/RangeButtons.d.ts +11 -0
  10. package/form/DateRangeField/views/RangeButtons/RangeButtons.js +60 -0
  11. package/form/DateRangeField/views/RangeButtons/RangeButtons.scss +126 -0
  12. package/form/DateRangeField/views/RangeButtons/consts.d.ts +34 -0
  13. package/form/DateRangeField/views/RangeButtons/consts.js +71 -0
  14. package/form/DateRangeField/views/RangeButtons/index.d.ts +2 -0
  15. package/form/DateRangeField/views/RangeButtons/index.js +7 -0
  16. package/form/DateRangeField/views/RangeButtons/utils.d.ts +14 -0
  17. package/form/DateRangeField/views/RangeButtons/utils.js +36 -0
  18. package/form/DateTimeRangeField/DateTimeRangeFieldView.js +12 -3
  19. package/form/DateTimeRangeField/DateTimeRangeFieldView.scss +54 -0
  20. package/form/DropDownField/DropDownFieldView.js +54 -35
  21. package/form/DropDownField/DropDownFieldView.scss +57 -45
  22. package/form/InputField/InputFieldView.js +4 -4
  23. package/form/InputField/InputFieldView.scss +128 -174
  24. package/form/RadioField/RadioFieldView.d.ts +2 -2
  25. package/form/RadioListField/RadioListFieldView.d.ts +2 -2
  26. package/form/RadioListField/RadioListFieldView.js +1 -1
  27. package/form/SwitcherField/SwitcherFieldView.d.ts +2 -2
  28. package/form/SwitcherField/SwitcherFieldView.js +17 -35
  29. package/form/SwitcherField/SwitcherFieldView.scss +63 -69
  30. package/form/SwitcherListField/SwitcherListFieldView.d.ts +3 -0
  31. package/form/SwitcherListField/SwitcherListFieldView.js +54 -0
  32. package/form/SwitcherListField/SwitcherListFieldView.scss +9 -0
  33. package/hooks/index.d.ts +2 -0
  34. package/hooks/index.js +8 -0
  35. package/hooks/useHideScroll.d.ts +1 -0
  36. package/hooks/useHideScroll.js +37 -0
  37. package/icons/index.js +2 -0
  38. package/icons/svgs/long-arrow-alt-down.svg +3 -0
  39. package/icons/svgs/long-arrow-alt-up.svg +3 -0
  40. package/index.d.ts +3 -0
  41. package/index.js +3 -0
  42. package/index.scss +1 -0
  43. package/list/Grid/GridView.js +2 -3
  44. package/list/Grid/GridView.scss +46 -0
  45. package/modal/Modal/ModalView.js +3 -1
  46. package/modal/Modal/ModalView.scss +0 -5
  47. package/package.json +2 -2
  48. package/scss/normalize.scss +5 -0
@@ -0,0 +1,9 @@
1
+ @use "sass:map";
2
+ @use "../../scss/variables";
3
+
4
+ .SwitcherListFieldView {
5
+ display: flex;
6
+ flex-flow: column nowrap;
7
+ align-items: flex-start;
8
+ row-gap: 10px;
9
+ }
@@ -0,0 +1,2 @@
1
+ import useHideScroll from './useHideScroll';
2
+ export { useHideScroll };
package/hooks/index.js ADDED
@@ -0,0 +1,8 @@
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
+ exports.useHideScroll = void 0;
7
+ var useHideScroll_1 = __importDefault(require("./useHideScroll"));
8
+ exports.useHideScroll = useHideScroll_1["default"];
@@ -0,0 +1 @@
1
+ export default function useHideScroll(): void;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var react_1 = require("react");
4
+ var react_use_1 = require("react-use");
5
+ var onlyNumbersRegExp = /^\D/g;
6
+ /*
7
+ * Хук устанавливает padding-right для body при открытии модальных окон.
8
+ * Помогает избежать нежелательного смещения контента, когда для body задается свойство overflow: hidden (убирается скролл)
9
+ * */
10
+ var BODY_HIDE_SCROLL_CLASS_NAME = 'body-hide-scroll';
11
+ function useHideScroll() {
12
+ var defaultPadding = (0, react_1.useRef)(null);
13
+ (0, react_use_1.useMount)(function () {
14
+ if (process.env.IS_SSR) {
15
+ return;
16
+ }
17
+ var fullWindowWidth = window.innerWidth; // полная ширина окна;
18
+ var windowWidthWithoutScrollbar = document.documentElement.clientWidth; // ширина окна за вычетом скролла
19
+ defaultPadding.current = document.body.style.paddingRight;
20
+ if (windowWidthWithoutScrollbar < fullWindowWidth) {
21
+ var defaultPaddingInt = defaultPadding.current
22
+ ? Number(defaultPadding.current.replace(onlyNumbersRegExp, ''))
23
+ : 0;
24
+ var paddingRight = "".concat(fullWindowWidth - windowWidthWithoutScrollbar + defaultPaddingInt, "px");
25
+ document.body.style.paddingRight = paddingRight;
26
+ document.body.classList.add(BODY_HIDE_SCROLL_CLASS_NAME);
27
+ }
28
+ });
29
+ (0, react_use_1.useUnmount)(function () {
30
+ if (process.env.IS_SSR) {
31
+ return;
32
+ }
33
+ document.body.style.paddingRight = defaultPadding.current;
34
+ document.body.classList.remove(BODY_HIDE_SCROLL_CLASS_NAME);
35
+ });
36
+ }
37
+ exports["default"] = useHideScroll;
package/icons/index.js CHANGED
@@ -28,6 +28,8 @@ exports["default"] = (function (customIcons) {
28
28
  'arrow_right_24x24',
29
29
  'arrow_up_18x18',
30
30
  'arrow_up_24x24',
31
+ 'long-arrow-alt-down',
32
+ 'long-arrow-alt-up',
31
33
  'blank',
32
34
  'calendar_check',
33
35
  'chart',
@@ -0,0 +1,3 @@
1
+ <svg width="10" height="14" viewBox="0 0 10 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M1 9.44916L5 13.4492M5 13.4492L9 9.44916M5 13.4492L5 1.44916" stroke="#323232" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="10" height="14" viewBox="0 0 10 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9 5.44916L5 1.44916M5 1.44916L1 5.44916M5 1.44916L5 13.4492" stroke="#323232" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
package/index.d.ts CHANGED
@@ -161,6 +161,9 @@ declare const _default: {
161
161
  'form.SwitcherFieldView': {
162
162
  lazy: () => any;
163
163
  };
164
+ 'form.SwitcherListFieldView': {
165
+ lazy: () => any;
166
+ };
164
167
  'form.TextFieldView': {
165
168
  lazy: () => any;
166
169
  };
package/index.js CHANGED
@@ -164,6 +164,9 @@ exports["default"] = {
164
164
  'form.SwitcherFieldView': {
165
165
  lazy: function () { return require('./form/SwitcherField/SwitcherFieldView')["default"]; }
166
166
  },
167
+ 'form.SwitcherListFieldView': {
168
+ lazy: function () { return require('./form/SwitcherListField/SwitcherListFieldView')["default"]; }
169
+ },
167
170
  'form.TextFieldView': {
168
171
  lazy: function () { return require('./form/TextField/TextFieldView')["default"]; }
169
172
  },
package/index.scss CHANGED
@@ -65,6 +65,7 @@
65
65
  @include meta.load-css('form/ReCaptchaField/ReCaptchaFieldView');
66
66
  @include meta.load-css('form/SliderField/SliderFieldView');
67
67
  @include meta.load-css('form/SwitcherField/SwitcherFieldView');
68
+ @include meta.load-css('form/SwitcherListField/SwitcherListFieldView');
68
69
  @include meta.load-css('form/TextField/TextFieldView');
69
70
  @include meta.load-css('form/TimeField/TimeFieldView');
70
71
  @include meta.load-css('form/TimeField/TimePanelView');
@@ -62,9 +62,8 @@ function GridView(props) {
62
62
  })));
63
63
  }, [props.searchForm, props.columns]);
64
64
  var renderSortButton = (0, react_1.useCallback)(function (attribute, direction) {
65
- var _a;
66
65
  var sortKey = (direction === 'desc' ? '-' : '') + attribute;
67
- var isActive = [].concat(((_a = props.list) === null || _a === void 0 ? void 0 : _a.sort) || []).includes(sortKey);
66
+ var isActive = [].concat((props === null || props === void 0 ? void 0 : props.sort) || []).includes(sortKey);
68
67
  return (React.createElement(Button_1["default"], { icon: direction === 'asc' ? 'long-arrow-alt-up' : 'long-arrow-alt-down', className: bem.element('sort-button', {
69
68
  'is-active': isActive
70
69
  }), link: true, onClick: function (e) {
@@ -86,7 +85,7 @@ function GridView(props) {
86
85
  React.createElement("thead", null,
87
86
  React.createElement("tr", null, props.columns.map(function (column, columnIndex) { return (React.createElement("th", { key: columnIndex, className: column.headerClassName },
88
87
  column.label,
89
- column.sortable && column.attribute && (React.createElement("span", null,
88
+ column.sortable && column.attribute && (React.createElement("span", { className: bem.element('sort-buttons') },
90
89
  column.label && React.createElement("span", null, "\u00A0"),
91
90
  renderSortButton(column.attribute, 'asc'),
92
91
  renderSortButton(column.attribute, 'desc'))))); })),
@@ -6,6 +6,9 @@
6
6
 
7
7
  --grid-td-background-color: #FFFFFF;
8
8
  --grid-td-alternating-color: var(--additional-light-gray);
9
+
10
+ --sort-button-color: var(--graphite);
11
+ --sort-button-color-active: var(--graphite-dark);
9
12
  }
10
13
 
11
14
  html[data-theme="dark"] {
@@ -14,6 +17,10 @@ html[data-theme="dark"] {
14
17
 
15
18
  --grid-td-background-color: var(--graphite);
16
19
  --grid-td-alternating-color: var(--graphite-dark);
20
+
21
+
22
+ --sort-button-color: var(--secondary-dark);
23
+ --sort-button-color-active: var(--secondary);
17
24
  }
18
25
 
19
26
  $grid-header-background-color: var(--grid-header-background-color);
@@ -97,6 +104,13 @@ $grid-td-alternating-color: var(--grid-td-alternating-color);
97
104
  td:not(#{$root}__column_isDiagram) {
98
105
  padding: 24px 16px;
99
106
  }
107
+
108
+ &:has(#{$root}__sort-buttons) {
109
+ th {
110
+ position: relative;
111
+ padding: 24px 30px 24px 16px;
112
+ }
113
+ }
100
114
  }
101
115
 
102
116
  &_md {
@@ -109,6 +123,13 @@ $grid-td-alternating-color: var(--grid-td-alternating-color);
109
123
  td:not(#{$root}__column_isDiagram) {
110
124
  padding: 21px 12px;
111
125
  }
126
+
127
+ &:has(#{$root}__sort-buttons) {
128
+ th {
129
+ position: relative;
130
+ padding: 21px 30px 21px 12px;
131
+ }
132
+ }
112
133
  }
113
134
 
114
135
  &_sm {
@@ -121,6 +142,13 @@ $grid-td-alternating-color: var(--grid-td-alternating-color);
121
142
  td:not(#{$root}__column_isDiagram) {
122
143
  padding: 16px 8px;
123
144
  }
145
+
146
+ &:has(#{$root}__sort-buttons) {
147
+ th {
148
+ position: relative;
149
+ padding: 16px 30px 16px 8px;
150
+ }
151
+ }
124
152
  }
125
153
  }
126
154
 
@@ -171,4 +199,22 @@ $grid-td-alternating-color: var(--grid-td-alternating-color);
171
199
  width: 100%;
172
200
  }
173
201
  }
202
+
203
+ &__sort-buttons {
204
+ position: absolute;
205
+ right: 5px;
206
+ top: 50%;
207
+ transform: translateY(-50%);
208
+ }
209
+ &__sort-button {
210
+ path {
211
+ stroke: var(--sort-button-color);
212
+ }
213
+ &_is-active {
214
+ path {
215
+ stroke: var(--sort-button-color-active);
216
+ stroke-width: 2px;
217
+ }
218
+ }
219
+ }
174
220
  }
@@ -42,14 +42,16 @@ var react_modal_1 = __importDefault(require("react-modal"));
42
42
  var hooks_1 = require("@steroidsjs/core/hooks");
43
43
  var content_1 = require("@steroidsjs/core/ui/content");
44
44
  var form_1 = require("@steroidsjs/core/ui/form");
45
+ var hooks_2 = require("../../hooks");
45
46
  function ModalView(props) {
46
47
  var bem = (0, hooks_1.useBem)('ModalView');
48
+ (0, hooks_2.useHideScroll)();
47
49
  var overrideDefaultClasses = {
48
50
  base: bem.block('overlay'),
49
51
  afterOpen: 'ModalView_overlay-after',
50
52
  beforeClose: 'ModalView_overlay-before'
51
53
  };
52
- return (React.createElement(react_modal_1["default"], __assign({}, props, { ariaHideApp: false, bodyOpenClassName: 'ModalView_body-hide-scroll', className: bem(bem.element('body', { size: props.size }), props.className), closeTimeoutMS: props.closeTimeoutMs, isOpen: !props.isClosing, onRequestClose: props.onClose, overlayClassName: overrideDefaultClasses, shouldCloseOnEsc: props.shouldCloseOnEsc, shouldCloseOnOverlayClick: props.shouldCloseOnOverlayClick }),
54
+ return (React.createElement(react_modal_1["default"], __assign({}, props, { ariaHideApp: false, className: bem(bem.element('body', { size: props.size }), props.className), closeTimeoutMS: props.closeTimeoutMs, isOpen: !props.isClosing, onRequestClose: props.onClose, overlayClassName: overrideDefaultClasses, shouldCloseOnEsc: props.shouldCloseOnEsc, shouldCloseOnOverlayClick: props.shouldCloseOnOverlayClick }),
53
55
  React.createElement("div", { className: bem.element('header') },
54
56
  React.createElement("span", { className: bem.element('title') }, props.title),
55
57
  React.createElement(content_1.Icon, { name: 'cross_12x12', className: bem.element('close'), onClick: props.onClose })),
@@ -148,8 +148,3 @@ $modal-background-color: var(--modal-background-color);
148
148
  opacity: 0;
149
149
  }
150
150
  }
151
-
152
- // Class to hide body scroll, when Modal is opened
153
- .ModalView_body-hide-scroll {
154
- overflow: hidden;
155
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/bootstrap",
3
- "version": "3.0.30",
3
+ "version": "3.0.34",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
@@ -35,7 +35,7 @@
35
35
  "react-use": "^17.4.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@steroidsjs/core": "3.0.52",
38
+ "@steroidsjs/core": "3.0.59",
39
39
  "@steroidsjs/eslint-config": "^2.1.6",
40
40
  "@types/enzyme": "^3.10.8",
41
41
  "@types/googlemaps": "^3.43.3",
@@ -23,3 +23,8 @@ button {
23
23
  input {
24
24
  outline: none;
25
25
  }
26
+
27
+ // Class to hide body scroll, when Modal is opened
28
+ .body-hide-scroll {
29
+ overflow: hidden;
30
+ }