@steroidsjs/bootstrap 3.0.0-beta.49 → 3.0.0-beta.50

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.
@@ -30,6 +30,7 @@ var React = __importStar(require("react"));
30
30
  var Icon_1 = __importDefault(require("@steroidsjs/core/ui/content/Icon"));
31
31
  var hooks_1 = require("@steroidsjs/core/hooks");
32
32
  var renderIcon_1 = __importDefault(require("../../utils/renderIcon"));
33
+ var ICON_SIZE = '_24x24';
33
34
  function AccordionItemView(props) {
34
35
  var _a;
35
36
  var bem = (0, hooks_1.useBem)('AccordionItemView');
@@ -1,198 +1,231 @@
1
+ :root {
2
+ --day-background-color-hover: rgba(0, 0, 0, 0.1);
3
+ --calendar-border-color: #f1f5f7;
4
+ }
5
+
6
+ html[data-theme="dark"] {
7
+ --day-background-color-hover: rgba(255, 255, 255, 0.1);
8
+ --calendar-border-color: #5b5c6b;
9
+ }
10
+
11
+ $day-background-color-hover: var(--day-background-color-hover);
12
+ $calendar-border-color: var(--calendar-border-color);
13
+
1
14
  .CalendarView {
2
- $root: &;
3
-
4
- position: relative;
5
- color: $calendar-text-color;
6
- font-weight: $calendar-font-weight;
7
- user-select: none;
8
-
9
- .DayPicker-wrapper {
10
- padding-bottom: 0;
11
- }
12
- .DayPicker-Months {
13
- display: flex;
14
- flex-wrap: wrap;
15
- justify-content: center;
16
- }
17
- .DayPicker-Month {
18
- display: table;
19
- border-collapse: separate;
20
- border-spacing: 10px;
21
- margin: 0;
22
- }
23
-
24
- // Body
25
-
26
- .DayPicker-Weekdays {
27
- display: table-header-group;
28
- margin-top: 1em;
29
- }
30
- .DayPicker-WeekdaysRow {
31
- display: table-row;
32
- }
33
- .DayPicker-Weekday {
34
- display: table-cell;
35
- width: 30px;
36
- height: 30px;
37
- padding: 0;
38
- color: inherit;
39
- text-align: center;
40
- font-size: 0.875em;
41
- }
42
- .DayPicker-Weekday abbr[title] {
43
- border-bottom: none;
44
- text-decoration: none;
45
- }
46
-
47
- .DayPicker-Body {
48
- display: table-row-group;
49
- }
50
- .DayPicker-Week {
51
- display: table-row;
52
-
53
- &--disabled {
54
- pointer-events: none;
55
- opacity: .5;
56
- }
57
- }
58
- .DayPicker-Day {
59
- position: relative;
60
- display: table-cell;
61
-
62
- padding: 0;
63
- border-radius: $calendar-day-border-radius;
64
-
65
- vertical-align: middle;
66
- text-align: center;
67
- cursor: pointer;
68
-
69
- transition-property: background-color, box-shadow, color;
70
- transition-duration: .1s;
71
-
72
- &::before {
73
- content: '';
74
- height: 30px;
75
- left: 0;
76
- position: absolute;
77
- right: 0;
78
- top: 50%;
79
- transform: translate(-5px, -50%);
80
- width: 40px;
81
- z-index: 1;
82
- }
83
-
84
- &--outside {
85
- color: $calendar-secondary-color;
86
- }
87
-
88
- &--today {
89
- #{$root}__day {
90
- box-shadow: $calendar-today-shadow;
91
- }
92
- }
93
-
94
- &--disabled {
95
- pointer-events: none;
96
- opacity: .5;
97
- }
98
- }
99
-
100
- // Footer
101
-
102
- .DayPicker-Footer {
103
- height: 50px;
104
-
105
- display: flex;
106
- flex-flow: row nowrap;
107
- align-items: center;
108
- justify-content: center;
109
- padding: 0 10px;
110
-
111
- border-top: 1px solid $calendar-secondary-color;
112
- }
113
- .DayPicker-TodayButton {
114
- border: none;
115
- background-color: transparent;
116
- background-image: none;
117
- box-shadow: none;
118
- font-size: 0.875em;
119
- cursor: pointer;
120
- color: $calendar-primary-color;
121
- font-weight: $calendar-font-weight;
122
- }
123
-
124
- // Days selection
125
-
126
- // Selected day
127
- .DayPicker-Day--selected:not(.DayPicker-Day--inRange) {
128
- color: $calendar-selected-text-color;
129
- border-radius: $calendar-day-border-radius;
130
- background-color: $calendar-primary-color;
131
- box-shadow: $calendar-selected-shadow;
132
- }
133
-
134
- // Hover
135
- .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--outside):hover {
136
- background-color: $calendar-secondary-light-color !important;
137
- box-shadow: $calendar-hover-shadow;
138
- }
139
-
140
- &__day {
15
+ $root: &;
141
16
  position: relative;
142
- z-index: 1;
143
- width: 30px;
144
- height: 30px;
145
- line-height: 30px;
146
- border-radius: $calendar-day-border-radius;
147
- }
17
+ color: $text-color;
18
+ font-weight: $font-weight-md;
19
+ user-select: none;
20
+ padding: 12px;
148
21
 
149
- &_ranged {
22
+ .DayPicker-wrapper {
23
+ padding-bottom: 0;
24
+ }
150
25
 
151
- .DayPicker-Day {
152
- &--start {
153
- color: $white;
26
+ .DayPicker-Months {
27
+ display: flex;
28
+ flex-wrap: wrap;
29
+ justify-content: center;
30
+ row-gap: 12px;
31
+ }
32
+
33
+ .DayPicker-Month {
34
+ margin: 0;
35
+ }
154
36
 
155
- #{$root}__day {
156
- background-color: $calendar-primary-color;
157
- box-shadow: $calendar-selected-shadow;
37
+ // Body
38
+ .DayPicker-Weekdays {
39
+ margin-top: 0;
40
+ }
41
+
42
+ .DayPicker-WeekdaysRow {
43
+ display: inline-flex;
44
+ column-gap: 16px;
45
+ }
46
+
47
+ .DayPicker-Weekday {
48
+ display: inline-flex;
49
+ justify-content: center;
50
+ align-items: center;
51
+ width: 34px;
52
+ height: 34px;
53
+ padding: 0;
54
+ color: inherit;
55
+ text-align: center;
56
+ vertical-align: middle;
57
+ font-size: $font-size-base;
58
+ line-height: $line-height-base;
59
+ font-weight: $font-weight-lg;
60
+ text-transform: capitalize;
61
+ }
62
+
63
+ .DayPicker-Weekday abbr[title] {
64
+ border-bottom: none;
65
+ text-decoration: none;
66
+ }
67
+
68
+ .DayPicker-Body {
69
+ display: flex;
70
+ flex-flow: column nowrap;
71
+ row-gap: 12px;
72
+ }
73
+
74
+ .DayPicker-Week {
75
+ display: flex;
76
+ width: 100%;
77
+ column-gap: 16px;
78
+
79
+ &--disabled {
80
+ pointer-events: none;
81
+ opacity: 0.5;
158
82
  }
83
+ }
84
+
85
+ .DayPicker-Day {
86
+ position: relative;
87
+ padding: 0;
88
+ border-radius: $radius-large;
89
+
90
+ vertical-align: middle;
91
+ text-align: center;
92
+ cursor: pointer;
93
+
94
+ transition-property: background-color, box-shadow, color;
95
+ transition-duration: 0.1s;
159
96
 
160
97
  &::before {
161
- background-color: $calendar-primary-light-color;
162
- width: 10px;
163
- transform: translate(25px, -50%);
98
+ content: "";
99
+ height: 30px;
100
+ left: 0;
101
+ position: absolute;
102
+ right: 0;
103
+ top: 50%;
104
+ transform: translate(-5px, -50%);
105
+ width: 40px;
106
+ z-index: 1;
164
107
  }
165
- }
166
108
 
167
- &--end {
168
- color: #fff;
109
+ &--outside {
110
+ color: $placeholder-color;
111
+ }
169
112
 
170
- #{$root}__day {
171
- background-color: $calendar-primary-color;
172
- box-shadow: $calendar-selected-shadow;
113
+ &--today {
114
+ #{$root}__day {
115
+ border: 1px solid $primary;
116
+ color: $primary;
117
+ }
173
118
  }
174
119
 
175
- &::before {
176
- background-color: $calendar-primary-light-color;
177
- width: 10px;
120
+ &--disabled {
121
+ pointer-events: none;
122
+ opacity: 0.5;
178
123
  }
179
- }
124
+ }
180
125
 
126
+ // Footer
127
+ .DayPicker-Footer {
128
+ margin-top: 8px;
129
+ display: flex;
130
+ flex-flow: row nowrap;
131
+ align-items: center;
132
+ justify-content: flex-start;
133
+ }
181
134
 
182
- &--inRange {
183
- &::before {
184
- background-color: $calendar-primary-light-color;
185
- }
186
- }
135
+ .DayPicker-TodayButton {
136
+ padding: 5px 12.5px;
137
+ border-radius: $radius-small;
138
+ border: 1px solid $gray;
139
+ background-color: transparent;
140
+ background-image: none;
141
+ box-shadow: none;
142
+ cursor: pointer;
143
+ color: $text-color;
144
+ font-size: $font-size-sm;
145
+ line-height: $line-height-lg;
146
+ }
187
147
 
188
- &--outRange {
189
- pointer-events: none;
190
- &::before {
191
- background-color: $calendar-primary-light-color;
148
+ // Days selection
149
+ // Selected day
150
+ .DayPicker-Day--selected:not(.DayPicker-Day--inRange) {
151
+ color: $white;
152
+ background-color: $primary;
153
+ }
154
+
155
+ .DayPicker-Day--selected.DayPicker-Day--today .CalendarView__day {
156
+ color: $white;
157
+ }
158
+
159
+ // Hover
160
+ .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--outside):not(
161
+ .DayPicker-Day--today
162
+ ):hover {
163
+ background-color: $day-background-color-hover;
164
+ }
165
+
166
+ .DayPicker-Day--today:hover {
167
+ background-color: transparent;
168
+
169
+ .CalendarView__day {
170
+ color: $text-color;
192
171
  }
193
- }
172
+ }
194
173
 
174
+ &__day {
175
+ position: relative;
176
+ z-index: 1;
177
+ width: 34px;
178
+ height: 34px;
179
+ line-height: 30px;
180
+ border-radius: $radius-large;
181
+ display: flex;
182
+ justify-content: center;
183
+ align-items: center;
195
184
  }
196
185
 
197
- }
186
+ &_ranged {
187
+ .DayPicker-Day {
188
+ &--start {
189
+ color: $white;
190
+
191
+ #{$root}__day {
192
+ background-color: $calendar-primary-color;
193
+ box-shadow: $calendar-selected-shadow;
194
+ }
195
+
196
+ &::before {
197
+ background-color: $calendar-primary-light-color;
198
+ width: 10px;
199
+ transform: translate(25px, -50%);
200
+ }
201
+ }
202
+
203
+ &--end {
204
+ color: #fff;
205
+
206
+ #{$root}__day {
207
+ background-color: $calendar-primary-color;
208
+ box-shadow: $calendar-selected-shadow;
209
+ }
210
+
211
+ &::before {
212
+ background-color: $calendar-primary-light-color;
213
+ width: 10px;
214
+ }
215
+ }
216
+
217
+ &--inRange {
218
+ &::before {
219
+ background-color: $calendar-primary-light-color;
220
+ }
221
+ }
222
+
223
+ &--outRange {
224
+ pointer-events: none;
225
+ &::before {
226
+ background-color: $calendar-primary-light-color;
227
+ }
228
+ }
229
+ }
230
+ }
198
231
  }
@@ -57,16 +57,28 @@ function CaptionElement(props) {
57
57
  }
58
58
  return result;
59
59
  }, [fromYear, toYear]);
60
+ var icons = (0, react_1.useMemo)(function () { return [
61
+ {
62
+ name: 'double_arrow_left',
63
+ onClick: function () { return handleYearChange(currentYear - 1); }
64
+ },
65
+ {
66
+ name: 'arrow_left_24x24',
67
+ externalClass: 'one-arrow',
68
+ onClick: function () { return handleMonthChange(currentMonth - 1); }
69
+ },
70
+ {
71
+ name: 'arrow_right_24x24',
72
+ externalClass: 'one-arrow',
73
+ onClick: function () { return handleMonthChange(currentMonth + 1); }
74
+ },
75
+ {
76
+ name: 'double_arrow_right',
77
+ onClick: function () { return handleYearChange(currentYear + 1); }
78
+ },
79
+ ]; }, [currentYear, handleYearChange, currentMonth, handleMonthChange]);
60
80
  return (React.createElement("div", { className: bem(bem.block()) },
61
81
  React.createElement("div", { className: bem.element('container') },
62
- React.createElement(Icon_1["default"], { className: bem.element('button'), onClick: function (e) {
63
- e.preventDefault();
64
- handleYearChange(currentYear - 1);
65
- }, name: 'angle-double-left' }),
66
- React.createElement(Icon_1["default"], { className: bem.element('button', 'one-arrow'), onClick: function (e) {
67
- e.preventDefault();
68
- handleMonthChange(currentMonth - 1);
69
- }, name: 'angle-left' }),
70
82
  React.createElement("div", { className: bem.element('content-container'), onKeyPress: function (e) {
71
83
  e.preventDefault();
72
84
  toggleCaptionPanel();
@@ -76,14 +88,10 @@ function CaptionElement(props) {
76
88
  }, role: 'button', tabIndex: 0 },
77
89
  React.createElement("span", { className: bem.element('selected-month') }, months.find(function (month) { return month.id === currentMonth; }).label),
78
90
  React.createElement("span", { className: bem.element('selected-year') }, years.find(function (year) { return year === currentYear; }))),
79
- React.createElement(Icon_1["default"], { className: bem.element('button', 'one-arrow'), onClick: function (e) {
80
- e.preventDefault();
81
- handleMonthChange(currentMonth + 1);
82
- }, name: 'angle-right' }),
83
- React.createElement(Icon_1["default"], { className: bem.element('button'), onClick: function (e) {
91
+ React.createElement("div", { className: bem.element('container-icons') }, icons.map(function (icon, iconIndex) { return (React.createElement(Icon_1["default"], { key: iconIndex, name: icon.name, onClick: function (e) {
84
92
  e.preventDefault();
85
- handleYearChange(currentYear + 1);
86
- }, name: 'angle-double-right' })),
93
+ icon.onClick();
94
+ }, className: bem.element('button', icon.externalClass) })); }))),
87
95
  isCaptionPanelVisible && (React.createElement("div", { className: bem.element('panel', { 'full-height': !props.showCalendarFooter }) },
88
96
  React.createElement("div", { className: bem.element('panel-header', 'months') }, __('Месяц')),
89
97
  React.createElement("div", { className: bem.element('panel-header', 'years') }, __('Год')),
@@ -1,134 +1,154 @@
1
+ :root {
2
+ --caption-arrow-background-color: #f1f5f7;
3
+ --caption-arrow-color: #323232;
4
+ }
1
5
 
2
- .CaptionElement {
3
- height: 45px;
4
- display: table-caption;
5
- padding: 0 10px;
6
- border-bottom: 1px solid gray;
6
+ html[data-theme="dark"] {
7
+ --caption-arrow-background-color: #323232;
8
+ --caption-arrow-color: #ffffff;
9
+ }
7
10
 
8
- & > div {
9
- font-size: 14px;
10
- }
11
+ $caption-arrow-background-color: var(--caption-arrow-background-color);
12
+ $caption-arrow-color: var(--caption-arrow-color);
11
13
 
12
- &__container {
13
- height: 100%;
14
+ .CaptionElement {
15
+ height: 24px;
16
+ width: 100%;
14
17
  display: flex;
15
- }
18
+ justify-content: space-between;
19
+ margin-bottom: 16px;
16
20
 
17
- &__content-container {
18
- margin: 0 auto;
19
- display: flex;
20
- align-items: center;
21
- justify-content: center;
21
+ &__container {
22
+ width: 100%;
23
+ height: 100%;
24
+ display: flex;
25
+ align-items: center;
22
26
 
23
- cursor: pointer;
24
- transition: color .1s ease-in;
25
27
 
26
- &:hover, &:active, &:focus {
27
- color: $calendar-primary-color;
28
+ &-icons {
29
+ display: flex;
30
+ flex-flow: row nowrap;
31
+ column-gap: 8px;
32
+ }
28
33
  }
29
- }
30
34
 
31
- &__button {
32
- width: 30px;
33
- display: flex;
34
- align-items: center;
35
- justify-content: center;
35
+ &__content-container {
36
+ margin-right: auto;
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
36
40
 
37
- &.IconView svg {
38
- width: 12px;
39
- fill: rgba(0, 0, 0, 0.25);
40
- transition: fill .1s ease-in;
41
- }
41
+ cursor: pointer;
42
+ transition: color 0.1s ease-in;
42
43
 
43
- &_one-arrow.IconView svg {
44
- width: 8px;
45
- }
44
+ font-weight: $font-weight-lg;
45
+ font-size: $font-size-lg;
46
+ line-height: $line-height-lg;
46
47
 
47
- &:hover svg {
48
- fill: rgba(0, 0, 0, .7);
48
+ &:hover,
49
+ &:active,
50
+ &:focus {
51
+ color: $calendar-primary-color;
52
+ }
49
53
  }
50
- }
51
-
52
- &__selected-month, &__selected-year {
53
- font-size: 16px;
54
- }
55
-
56
- &__selected-month {
57
- margin-right: 5px;
58
- }
59
-
60
- // Panel changing Month/Year
61
-
62
-
63
- &__panel {
64
- z-index: 10;
65
- position: absolute;
66
- top: 45px;
67
- left: 0;
68
- right: 0;
69
- bottom: 50px;
70
- background-color: $white;
71
-
72
- display: grid;
73
- grid-template-columns: 1fr 1fr 1fr;
74
- grid-template-rows: 0fr 1fr;
75
- gap: 0 0;
76
- grid-template-areas:
77
- "HeaderMonths HeaderMonths HeaderYears"
78
- "Months1stCol Months2ndCol YearsCol";
79
-
80
- &_full-height {
81
- bottom: 0;
82
- }
83
- }
84
54
 
85
- &__panel-header {
86
- padding: 5px;
55
+ &__button {
56
+ cursor: pointer;
57
+ width: 24px;
58
+ height: 24px;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+
63
+ rect {
64
+ fill: $caption-arrow-background-color;
65
+ }
66
+ path {
67
+ stroke: $caption-arrow-color;
68
+ }
69
+ }
87
70
 
88
- text-align: center;
89
- border-bottom: 1px solid gray;
90
- background-color: $calendar-primary-light-color;
71
+ &__selected-month,
72
+ &__selected-year {
73
+ font-size: inherit;
74
+ }
91
75
 
92
- &_months {
93
- grid-area: HeaderMonths;
94
- border-right: 1px solid gray;
76
+ &__selected-month {
77
+ margin-right: 5px;
95
78
  }
96
79
 
97
- &_years {
98
- grid-area: HeaderYears;
80
+ // Panel changing Month/Year
81
+ &__panel {
82
+ border-radius: $radius-large;
83
+ overflow: hidden;
84
+ z-index: 10;
85
+ position: absolute;
86
+ top: 45px;
87
+ left: 0;
88
+ right: 0;
89
+ bottom: 50px;
90
+ background-color: $element-background-color;
91
+ margin-bottom: 12px;
92
+
93
+ display: grid;
94
+ grid-template-columns: 1fr 1fr 1fr;
95
+ grid-template-rows: 0fr 1fr;
96
+ gap: 0 0;
97
+ grid-template-areas:
98
+ "HeaderMonths HeaderMonths HeaderYears"
99
+ "Months1stCol Months2ndCol YearsCol";
100
+
101
+ &_full-height {
102
+ bottom: 0;
103
+ }
99
104
  }
100
- }
101
105
 
102
- &__panel-column-months {
103
- border-right: 1px solid gray;
106
+ &__panel-header {
107
+ padding: 5px;
104
108
 
105
- &_first {
106
- grid-area: Months1stCol;
107
- }
109
+ text-align: center;
110
+ border-bottom: 1px solid gray;
111
+ background-color: $primary-light;
108
112
 
109
- &_second {
110
- grid-area: Months2ndCol;
113
+ &_months {
114
+ grid-area: HeaderMonths;
115
+ border-right: 1px solid gray;
116
+ }
117
+
118
+ &_years {
119
+ grid-area: HeaderYears;
120
+ }
111
121
  }
112
- }
113
122
 
114
- &__panel-column-years {
115
- height: 100%;
116
- grid-area: YearsCol;
117
- overflow: auto;
118
- }
123
+ &__panel-column-months {
124
+ border-right: 1px solid gray;
125
+
126
+ &_first {
127
+ grid-area: Months1stCol;
128
+ }
119
129
 
120
- &__panel-cell {
121
- padding: 5px 15px;
122
- cursor: pointer;
130
+ &_second {
131
+ grid-area: Months2ndCol;
132
+ }
133
+ }
123
134
 
124
- &_selected {
125
- background-color: $calendar-primary-light-color;
135
+ &__panel-column-years {
136
+ grid-area: YearsCol;
137
+ @include scrollWrapper(278px, 0, $scroll-thumb-color, $scroll-track-color);
126
138
  }
127
139
 
128
- transition: background-color .1s ease-in;
140
+ &__panel-cell {
141
+ background-color: $element-background-color;
142
+ padding: 5px 15px;
143
+ cursor: pointer;
144
+ transition: background-color 0.1s ease-in;
145
+
146
+ &_selected {
147
+ background-color: $primary-light;
148
+ }
129
149
 
130
- &:hover {
131
- background-color: $calendar-secondary-light-color;
150
+ &:hover {
151
+ background-color: $primary-light;
152
+ }
132
153
  }
133
- }
134
154
  }
@@ -46,7 +46,7 @@ var Calendar_1 = __importDefault(require("@steroidsjs/core/ui/content/Calendar")
46
46
  function DateFieldView(props) {
47
47
  var bem = (0, hooks_1.useBem)('DateFieldView');
48
48
  var renderCalendar = (0, react_1.useCallback)(function () { return (React.createElement(Calendar_1["default"], __assign({}, props.calendarProps))); }, [props.calendarProps]);
49
- return (React.createElement(DropDown_1["default"], { content: renderCalendar, position: 'bottomLeft', visible: props.isOpened, onClose: props.onClose },
49
+ return (React.createElement(DropDown_1["default"], { content: renderCalendar, position: 'bottomLeft', visible: props.isOpened, onClose: props.onClose, className: bem.element('dropdown') },
50
50
  React.createElement("div", { className: bem(bem.block({
51
51
  size: props.size,
52
52
  disabled: props.disabled,
@@ -54,12 +54,12 @@ function DateFieldView(props) {
54
54
  'is-invalid': !!props.errors
55
55
  }), props.className), style: props.style },
56
56
  React.createElement("div", { className: bem.element('body') },
57
- React.createElement("input", __assign({}, props.inputProps, { onChange: function (e) { return props.inputProps.onChange(e.target.value); }, className: bem(bem.element('input', { size: props.size }), props.isInvalid && 'is-invalid', props.inputProps.className) })),
57
+ React.createElement("input", __assign({}, props.inputProps, { onChange: function (e) { return props.inputProps.onChange(e.target.value); }, className: bem(bem.element('input'), props.inputProps.className) })),
58
58
  React.createElement("div", { className: bem.element('icon-container') },
59
- props.icon && (React.createElement(Icon_1["default"], { className: bem.element('icon'), name: typeof props.icon === 'string' ? props.icon : 'calendar-alt' })),
60
- props.showRemove && props.inputProps.value && (React.createElement(Icon_1["default"], { className: bem.element('icon', 'close'), onClick: function (e) {
59
+ !props.inputProps.value && props.icon && (React.createElement(Icon_1["default"], { className: bem.element('date-icon'), name: typeof props.icon === 'string' ? props.icon : 'calendar_range', tabIndex: -1 })),
60
+ props.showRemove && props.inputProps.value && (React.createElement(Icon_1["default"], { className: bem.element('close-icon'), onClick: function (e) {
61
61
  e.preventDefault();
62
62
  props.onClear();
63
- }, name: 'times-circle' })))))));
63
+ }, name: 'cross_8x8' })))))));
64
64
  }
65
65
  exports["default"] = DateFieldView;
@@ -1,81 +1,165 @@
1
+ :root {
2
+ --date-icon-default-color: #cbd5db;
3
+ --date-icon-close-default-color: #323232;
4
+ --date-icon-disabled-color: rgba(0, 0, 0, 0.1);
5
+ }
6
+
7
+ html[data-theme="dark"] {
8
+ --date-icon-default-color: #5b5c6b;
9
+ --date-icon-close-default-color: #ffffff;
10
+ --date-icon-disabled-color: rgba(255, 255, 255, 0.1);
11
+ }
12
+
13
+ $date-icon-default-color: var(--date-icon-default-color);
14
+ $date-icon-close-default-color: var(--date-icon-close-default-color);
15
+ $date-icon-disabled-color: var(--date-icon-disabled-color);
16
+
1
17
  .DateFieldView {
2
- $root: &;
3
-
4
- padding-right: 8px;
5
- position: relative;
6
-
7
- background-color: $white;
8
- border: 1px solid $border-default;
9
- border-radius: 4px;
10
-
11
- &:focus-within{
12
- outline: 0;
13
- border-color: $border-action;
14
- box-shadow: 0 0 0 1px $border-typing;
15
- }
16
- *:focus {
17
- outline: none;
18
- }
19
-
20
- &_disabled {
21
- color: rgba(0, 0, 0, .25);
22
- background-color: $grey-disabled;
23
- cursor: not-allowed;
24
- input {
25
- cursor: inherit;
18
+ $root: &;
19
+ position: relative;
20
+
21
+ &__input {
22
+ position: relative;
23
+ width: 100%;
24
+ border: 1px solid $border-color;
25
+ color: $text-color;
26
+ font-size: inherit;
27
+ line-height: $line-height-lg;
28
+ background-color: $element-background-color;
29
+
30
+ &:active {
31
+ border-color: $primary;
32
+ }
33
+
34
+ &::placeholder {
35
+ color: $placeholder-color;
36
+ }
37
+
38
+ &:disabled {
39
+ border: none;
40
+ background-color: $background-disabled-color;
41
+ }
26
42
  }
27
- }
28
- &_no-border {
29
- border: unset;
30
- }
31
-
32
- &__body {
33
- height: 100%;
34
- display: flex;
35
- flex-flow: row nowrap;
36
- align-items: center;
37
-
38
- &:hover #{$root}__icon_close {
39
- opacity: 1;
43
+
44
+ &__body {
45
+ position: relative;
46
+
47
+ &::before {
48
+ position: absolute;
49
+ display: block;
50
+ width: 100%;
51
+ height: 100%;
52
+ content: "";
53
+ top: 0;
54
+ left: 0;
55
+ border: 4px solid $primary-light;
56
+ transform: translate(-4px, -4px);
57
+ opacity: 0;
58
+ transition: opacity 150ms ease-in-out;
59
+ }
40
60
  }
41
- }
42
-
43
- &__input {
44
- width: 100%;
45
- flex-grow: 1;
46
- border: none;
47
- outline: none;
48
- background-color: transparent;
49
- padding: $input-padding-y $input-padding-x;
50
- }
51
-
52
- &__icon-container {
53
- position: relative;
54
- display: flex;
55
- align-items: center;
56
- justify-content: center;
57
- }
58
- &__icon {
59
- display: flex;
60
- height: 16px;
61
-
62
- path {
63
- fill: $grey-light;
64
- transition: fill .1s ease-in;
61
+
62
+ &:focus-within:not(:active) {
63
+ #{$root}__body {
64
+ &::before {
65
+ opacity: 1;
66
+ }
67
+ }
68
+
69
+ #{$root}__input {
70
+ border-color: transparent;
71
+ }
65
72
  }
66
73
 
67
- &_close{
68
- position: absolute;
69
- background-color: $white;
74
+ &__icon-container {
75
+ position: absolute;
76
+ top: 50%;
77
+ right: 8px;
78
+ transform: translateY(-50%);
79
+ width: 24px;
80
+ height: 24px;
70
81
 
71
- opacity: 0;
72
- transition: opacity .2s ease-in;
82
+ > * {
83
+ display: inline-flex;
84
+ flex-flow: row nowrap;
85
+ width: 100%;
86
+ height: 100%;
87
+ justify-content: center;
88
+ align-items: center;
89
+ }
90
+
91
+ #{$root}__date-icon {
92
+ path,
93
+ circle {
94
+ stroke: $date-icon-default-color;
95
+ }
96
+ }
97
+
98
+ #{$root}__close-icon {
99
+ cursor: pointer;
100
+ path,
101
+ circle {
102
+ stroke: $date-icon-close-default-color;
103
+ }
104
+ }
105
+ }
106
+
107
+ &_size {
108
+ &_lg {
109
+ #{$root}__input {
110
+ border-radius: $radius-large;
111
+ padding: 16px 8px;
112
+ padding-right: 40px;
113
+ }
114
+
115
+ #{$root}__body::before {
116
+ border-radius: calc($radius-large + 4px);
117
+ }
118
+
119
+ font-size: $line-height-sm;
120
+ }
121
+
122
+ &_md {
123
+ #{$root}__input {
124
+ border-radius: $radius-large;
125
+ padding: 11px 8px;
126
+ padding-right: 40px;
127
+ }
128
+
129
+ #{$root}__body::before {
130
+ border-radius: calc($radius-large + 4px);
131
+ }
132
+
133
+ font-size: $font-size-base;
134
+ }
135
+
136
+ &_sm {
137
+ #{$root}__input {
138
+ border-radius: $radius-small;
139
+ padding: 5px 8px;
140
+ padding-right: 40px;
141
+ }
142
+
143
+ font-size: $font-size-sm;
144
+
145
+ #{$root}__body::before {
146
+ border-radius: calc($radius-small + 4px);
147
+ }
148
+ }
149
+ }
150
+
151
+ &_disabled {
152
+ #{$root}__date-icon {
153
+ path,
154
+ circle {
155
+ stroke: $date-icon-disabled-color;
156
+ }
157
+ }
158
+ }
73
159
 
74
- &:hover {
75
- path {
76
- fill: $grey-dark;
160
+ &_is-invalid {
161
+ #{$root}__input {
162
+ border-color: $danger;
77
163
  }
78
- }
79
164
  }
80
- }
81
165
  }
@@ -33,18 +33,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
33
  __setModuleDefault(result, mod);
34
34
  return result;
35
35
  };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
36
  exports.__esModule = true;
40
37
  var React = __importStar(require("react"));
41
- var get_1 = __importDefault(require("lodash-es/get"));
42
- var Button_1 = __importDefault(require("@steroidsjs/core/ui/form/Button"));
43
38
  var hooks_1 = require("@steroidsjs/core/hooks");
44
39
  function SwitcherFieldView(props) {
45
40
  var bem = (0, hooks_1.useBem)('SwitcherFieldView');
46
- return (React.createElement("div", { className: bem(bem.block({
41
+ var prefix = (0, hooks_1.useUniqueId)('switcher');
42
+ var renderLabel = React.useCallback(function (item) {
43
+ if (typeof item.label === 'object') {
44
+ return props.selectedIds.includes(item.id) ? item.label.checked : item.label.unchecked;
45
+ }
46
+ return item.label;
47
+ }, [props.selectedIds]);
48
+ return (React.createElement("div", { className: bem(bem.block(), props.className), style: props.style }, props.items.map(function (switcher, switcherIndex) { return (React.createElement("label", { key: switcherIndex, className: bem.element('switcher', {
47
49
  size: props.size
48
- }), props.className, 'btn-group') }, props.items.map(function (item) { return (React.createElement(Button_1["default"], __assign({ key: String(item[props.primaryKey]) }, props.buttonProps, { className: bem((0, get_1["default"])(props, 'buttonProps.className'), props.hoveredId === item[props.primaryKey] && 'hover', props.selectedIds.includes(item[props.primaryKey]) && 'active'), disabled: props.disabled, onClick: function () { return props.onItemSelect(item[props.primaryKey]); }, onMouseOver: function () { return props.onItemHover(item[props.primaryKey]); } }), item.label)); })));
50
+ }), htmlFor: "".concat(prefix, "_").concat(switcher.id) },
51
+ React.createElement("input", __assign({}, props.inputProps, { id: "".concat(prefix, "_").concat(switcher.id), onChange: function () { return props.onItemSelect(switcher.id); }, checked: props.selectedIds.includes(switcher.id), className: bem.element('input') })),
52
+ React.createElement("span", { className: bem.element('slider') }),
53
+ React.createElement("span", { className: bem.element('label') }, renderLabel(switcher)))); })));
49
54
  }
50
55
  exports["default"] = SwitcherFieldView;
@@ -1,2 +1,189 @@
1
+ :root {
2
+ --switcher-dot-disabled-color: #dbe2e6;
3
+ --switcher-slider-disabled-color: #f1f5f7;
4
+ }
5
+
6
+ html[data-theme="dark"] {
7
+ --switcher-dot-disabled-color: #4e4f57;
8
+ --switcher-slider-disabled-color: #5b5c6b;
9
+ }
10
+
11
+ $switcher-dot-disabled-color: var(--switcher-dot-disabled-color);
12
+ $switcher-slider-disabled-color: var(--switcher-slider-disabled-color);
13
+
14
+ $background-color-transition-timing: 150ms;
15
+
1
16
  .SwitcherFieldView {
2
- }
17
+ $root: &;
18
+ display: flex;
19
+ flex-flow: column nowrap;
20
+ align-items: flex-start;
21
+ row-gap: 10px;
22
+
23
+ &__switcher {
24
+ display: inline-flex;
25
+ column-gap: 12px;
26
+ align-items: center;
27
+ position: relative;
28
+ cursor: pointer;
29
+
30
+ $sizes: () !default;
31
+ $sizes: map-merge(
32
+ (
33
+ "lg": (
34
+ "width": 40px,
35
+ "height": 24px,
36
+ "dotSize": 18px,
37
+ "dotTranslateDefault": translateY(-50%) translateX(4px),
38
+ "dotTranslateActive": translateY(-50%) translateX(16px),
39
+ "font-size": $font-size-lg,
40
+ "line-height": $line-height-lg,
41
+ ),
42
+ "md": (
43
+ "width": 34px,
44
+ "height": 20px,
45
+ "dotSize": 14px,
46
+ "dotTranslateDefault": translateY(-50%) translateX(3px),
47
+ "dotTranslateActive": translateY(-50%) translateX(15px),
48
+ "font-size": $font-size-base,
49
+ "line-height": $line-height-base,
50
+ ),
51
+ "sm": (
52
+ "width": 28px,
53
+ "height": 16px,
54
+ "dotSize": 12px,
55
+ "dotTranslateDefault": translateY(-50%) translateX(2px),
56
+ "dotTranslateActive": translateY(-50%) translateX(12px),
57
+ "font-size": $font-size-sm,
58
+ "line-height": $line-height-sm,
59
+ ),
60
+ ),
61
+ $sizes
62
+ );
63
+
64
+ &_size {
65
+ @each $size, $sizeMap in $sizes {
66
+ &_#{$size} {
67
+ #{$root}__slider {
68
+ width: map-get($sizeMap, width);
69
+ height: map-get($sizeMap, height);
70
+
71
+ &::before {
72
+ width: map-get($sizeMap, dotSize);
73
+ height: map-get($sizeMap, dotSize);
74
+ transform: map-get($sizeMap, dotTranslateDefault);
75
+ }
76
+ }
77
+
78
+ #{$root}__input:checked + #{$root}__slider {
79
+ &::before {
80
+ transform: map-get($sizeMap, dotTranslateActive);
81
+ }
82
+ }
83
+
84
+ #{$root}__label {
85
+ font-size: map-get($sizeMap, font-size);
86
+ line-height: map-get($sizeMap, line-height);
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ &__input {
94
+ position: absolute;
95
+ cursor: pointer;
96
+ z-index: 3;
97
+ opacity: 0;
98
+ top: 0;
99
+ left: 0;
100
+ right: 0;
101
+ bottom: 0;
102
+
103
+ &:checked + #{$root}__slider {
104
+ background-color: $primary;
105
+ border-color: transparent;
106
+
107
+ &::before {
108
+ background-color: $white;
109
+ }
110
+
111
+ &::after {
112
+ border-color: $primary-light;
113
+ }
114
+ }
115
+
116
+ &:hover:not(:checked):not(:disabled) + #{$root}__slider {
117
+ &::before {
118
+ background-color: $gray-dark;
119
+ }
120
+ }
121
+
122
+ &:checked:hover + #{$root}__slider {
123
+ background-color: $primary-dark;
124
+ }
125
+
126
+ &:focus:not(:active) + #{$root}__slider {
127
+ &:after {
128
+ opacity: 1;
129
+ }
130
+ }
131
+
132
+ &:disabled {
133
+ cursor: not-allowed;
134
+ }
135
+
136
+ &:disabled ~ #{$root}__label {
137
+ color: $gray;
138
+ }
139
+
140
+ &:disabled + #{$root}__slider {
141
+ background-color: $switcher-slider-disabled-color;
142
+
143
+ &::before {
144
+ background-color: $switcher-dot-disabled-color;
145
+ }
146
+ }
147
+ }
148
+
149
+ &__slider {
150
+ width: 100%;
151
+ height: 100%;
152
+ position: relative;
153
+ display: inline-block;
154
+ border: 1px solid $gray;
155
+ border-radius: 200px;
156
+ transition: background-color $background-color-transition-timing ease-in-out;
157
+
158
+ &::after {
159
+ position: absolute;
160
+ content: "";
161
+ top: 0;
162
+ left: 0;
163
+ right: 0;
164
+ bottom: 0;
165
+ display: inline-block;
166
+ height: calc(100% + 2px);
167
+ width: calc(100% + 2px);
168
+ border-radius: inherit;
169
+ border: 4px solid $gray;
170
+ transform: translateX(-5px) translateY(-5px);
171
+ opacity: 0;
172
+ pointer-events: none;
173
+ }
174
+
175
+ &::before {
176
+ position: absolute;
177
+ content: "";
178
+ display: inline-block;
179
+ top: 50%;
180
+ border-radius: $radius-circle;
181
+ background-color: $gray;
182
+ transition: transform 100ms ease-in-out, background-color $background-color-transition-timing ease-in-out;
183
+ }
184
+ }
185
+
186
+ &__label {
187
+ color: $text-color;
188
+ }
189
+ }
package/icons/index.js CHANGED
@@ -65,7 +65,8 @@ exports["default"] = (function (customIcons) {
65
65
  'import',
66
66
  'info_16x16',
67
67
  'info_24x24',
68
- 'loading_icon',
68
+ 'loading_purple',
69
+ 'loading_default',
69
70
  'loading_icon_thick',
70
71
  'map',
71
72
  'menu_dots',
@@ -0,0 +1,8 @@
1
+ <svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M19.5 9.94916V9.14916C19.5 8.02905 19.5 7.469 19.282 7.04118C19.0903 6.66485 18.7843 6.35889 18.408 6.16714C17.9802 5.94916 17.4201 5.94916 16.3 5.94916H7.7C6.5799 5.94916 6.01984 5.94916 5.59202 6.16714C5.21569 6.35889 4.90973 6.66485 4.71799 7.04118C4.5 7.469 4.5 8.02905 4.5 9.14916V9.94916M19.5 9.94916V16.7492C19.5 17.8693 19.5 18.4293 19.282 18.8571C19.0903 19.2335 18.7843 19.5394 18.408 19.7312C17.9802 19.9492 17.4201 19.9492 16.3 19.9492H7.7C6.57989 19.9492 6.01984 19.9492 5.59202 19.7312C5.21569 19.5394 4.90973 19.2335 4.71799 18.8571C4.5 18.4293 4.5 17.8693 4.5 16.7492V9.94916M19.5 9.94916H4.5" stroke="white"/>
3
+ <path d="M8.5 3.94916L8.5 7.94916M15.5 3.94916L15.5 7.94916" stroke="white" stroke-linecap="round"/>
4
+ <path d="M8 12.9492H10" stroke="white" stroke-linecap="round"/>
5
+ <path d="M14 12.9492H16" stroke="white" stroke-linecap="round"/>
6
+ <path d="M8 16.9492H10" stroke="white" stroke-linecap="round"/>
7
+ <path d="M14 16.9492H16" stroke="white" stroke-linecap="round"/>
8
+ </svg>
@@ -32,6 +32,6 @@ function LoaderView(props) {
32
32
  color: props.color,
33
33
  size: props.size
34
34
  }) },
35
- React.createElement(content_1.Icon, { className: bem.element('icon'), name: 'loading' })));
35
+ React.createElement(content_1.Icon, { className: bem.element('icon'), name: 'loading_purple' })));
36
36
  }
37
37
  exports["default"] = LoaderView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/bootstrap",
3
- "version": "3.0.0-beta.49",
3
+ "version": "3.0.0-beta.50",
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 || >=3.0.0-beta.31",
38
+ "@steroidsjs/core": "^3.0 || >=3.0.0-beta.33",
39
39
  "@steroidsjs/eslint-config": "^2.1.4",
40
40
  "@types/enzyme": "^3.10.8",
41
41
  "@types/googlemaps": "^3.43.3",
@@ -53,6 +53,6 @@
53
53
  "typescript": "^4.9.5"
54
54
  },
55
55
  "peerDependencies": {
56
- "@steroidsjs/core": "^3.0 || >=3.0.0-beta.31"
56
+ "@steroidsjs/core": "^3.0 || >=3.0.0-beta.33"
57
57
  }
58
58
  }
File without changes