@eeacms/volto-tabs-block 1.2.11 → 1.3.1

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.
@@ -0,0 +1,145 @@
1
+ .inner.tabs_block {
2
+ margin-bottom: 0;
3
+
4
+ .tabs_block {
5
+ padding-right: 0.5rem;
6
+ padding-left: 0.5rem;
7
+ margin-bottom: 0;
8
+ }
9
+ }
10
+
11
+ .styled.screen-height {
12
+ .tabs-block {
13
+ display: flex;
14
+ flex: 1;
15
+ flex-direction: column;
16
+
17
+ > .default.tabs {
18
+ flex: 1;
19
+ }
20
+
21
+ > .styled {
22
+ > .default.tabs {
23
+ flex: 1;
24
+ }
25
+ }
26
+ }
27
+ }
28
+
29
+ /**
30
+ ** Edit form style
31
+ **/
32
+ .tabs-block {
33
+ [data-rbd-draggable-context-id] {
34
+ margin-bottom: 0;
35
+ }
36
+
37
+ .blocks-form {
38
+ width: 100%;
39
+ // padding-bottom: 0.1rem;
40
+ }
41
+
42
+ .block-wrapper {
43
+ &:not(:last-child) {
44
+ margin-bottom: 2rem;
45
+ }
46
+ }
47
+
48
+ .block {
49
+ .block-add-button,
50
+ .delete-button {
51
+ display: none;
52
+ }
53
+
54
+ .block.selected::before {
55
+ border-top-left-radius: 0;
56
+ }
57
+ }
58
+
59
+ .block .block:not(.inner)::before {
60
+ z-index: 0;
61
+ pointer-events: none;
62
+ }
63
+
64
+ .block.wrapper.multiSelected {
65
+ .block .block::before {
66
+ z-index: 1;
67
+ background-color: rgba(120, 192, 215, 0.375);
68
+ }
69
+ }
70
+
71
+ .block-toolbar {
72
+ position: absolute;
73
+ z-index: 3;
74
+ right: unset;
75
+ left: -9px;
76
+ display: flex;
77
+ padding: 5px;
78
+ border: 1px solid #78c0d7bf;
79
+ border-bottom: 1px solid #fff;
80
+ margin-top: -45px;
81
+ background-color: #fff;
82
+ border-top-left-radius: 1rem;
83
+ border-top-right-radius: 1rem;
84
+
85
+ .ui.basic.button {
86
+ padding: 3px;
87
+ padding-right: 0;
88
+ box-shadow: none;
89
+ }
90
+
91
+ .wrapper-column-block {
92
+ > .ui.basic.button {
93
+ &:hover {
94
+ background-color: transparent !important;
95
+ }
96
+ }
97
+ }
98
+
99
+ > .ui.basic.button {
100
+ &:hover {
101
+ background-color: transparent !important;
102
+ }
103
+
104
+ svg {
105
+ color: #134448;
106
+ }
107
+ }
108
+ }
109
+
110
+ .blocks-chooser {
111
+ left: 0;
112
+ margin-top: 50px;
113
+ }
114
+ }
115
+
116
+ .drag-drop-list-widget {
117
+ .tabs-area {
118
+ padding: 1em 0;
119
+
120
+ [data-rbd-draggable-context-id] {
121
+ margin-bottom: 0.3em;
122
+ }
123
+
124
+ .drag.handle.wrapper {
125
+ min-height: auto;
126
+ }
127
+
128
+ .tab-area {
129
+ display: flex;
130
+
131
+ .label {
132
+ flex-grow: 2;
133
+ padding-left: 1em;
134
+ }
135
+
136
+ button {
137
+ flex-grow: 0;
138
+ }
139
+ }
140
+
141
+ button {
142
+ cursor: pointer;
143
+ }
144
+ }
145
+ }
@@ -7,94 +7,58 @@
7
7
  .loadAddonVariables();
8
8
 
9
9
  .tabs-block {
10
- &.edit {
11
- > .styled > .tabs > .ui.menu {
12
- margin: @menuMarginEdit;
13
- }
14
- }
15
-
16
- .menu-item-count {
17
- display: @menuItemCountDisplay;
10
+ [hidden] {
11
+ display: none !important;
18
12
  }
19
13
 
20
- > .styled > .tabs > .ui.menu {
21
- border: @menuBorder;
22
- margin: @menuMargin;
23
- background-color: @menuBackgroundColor;
24
- border-radius: @menuBorderRadius;
25
- box-shadow: @menuBoxShadow;
26
- overflow-x: auto;
27
-
28
- &.in-full-width {
29
- padding: 0 1rem;
30
- }
31
-
32
- &.ui.container > * {
33
- margin-bottom: initial !important;
34
- }
35
-
14
+ > .styled > .tabs > .ui.menu,
15
+ > .styled > .tabs > .ui.grid > .column > .ui.menu,
16
+ > .tabs > .ui.menu,
17
+ > .tabs > .ui.grid > .column > .ui.menu {
36
18
  &.menu-hidden {
37
19
  display: none;
38
20
  }
39
21
 
40
- &:after {
41
- display: none;
22
+ &.left {
23
+ justify-content: flex-start;
42
24
  }
43
25
 
44
- .ui.fluid.input {
45
- min-width: 80px;
26
+ &.right {
27
+ justify-content: flex-end;
46
28
  }
47
29
 
48
- .item {
49
- padding: @menuItemPadding;
50
- background: @menuItemBackground;
51
- color: @menuItemColor;
52
- font-family: @menuItemFontFamily;
53
- font-weight: @menuItemFontWeight;
54
-
55
- &:not(.menu-title) {
56
- font-size: @menuItemFontSize;
57
-
58
- p {
59
- font-size: @menuItemFontSize;
60
- }
61
- }
62
-
63
- .tab-title-input {
64
- min-width: 80px;
65
- max-width: 500px;
66
- align-self: center;
67
- border: none;
68
- color: @menuActiveItemColor;
69
- }
70
-
71
- &:hover {
72
- background: @menuItemHoverBackground;
73
- color: @menuItemHoverColor;
30
+ &.center {
31
+ justify-content: center;
32
+ }
74
33
 
75
- &.menu-title {
76
- background: @menuTitleHoverBackground;
77
- color: @menuTitleHoverColor;
78
- }
34
+ &.space-between {
35
+ .item.menu-title {
36
+ margin-right: auto;
79
37
  }
38
+ }
80
39
 
81
- &.active {
82
- background: @menuActiveItemBackground;
83
- color: @menuActiveItemColor;
84
- font-family: @menuItemFontFamily;
85
- font-weight: @menuActiveItemFontWeight;
86
-
87
- &:hover {
88
- background: @menuActiveItemHoverBackground;
89
- color: @menuActiveItemHoverColor;
40
+ &.text:not(.vertical) {
41
+ .item {
42
+ &:first-child {
43
+ padding-left: 0;
90
44
  }
91
45
  }
46
+ }
92
47
 
48
+ .item {
93
49
  &.menu-title {
94
50
  display: flex;
95
51
  flex-direction: column;
96
52
  align-items: flex-start;
53
+ justify-content: center;
97
54
  background: @menuTitleBackgrounnd;
55
+ font-size: @menuTitleFontSize;
56
+ font-weight: @menuTitleFontWeight;
57
+
58
+ &:hover {
59
+ background: @menuTitleHoverBackground;
60
+ color: @menuTitleHoverColor;
61
+ }
98
62
 
99
63
  .title {
100
64
  color: @menuTitleColor;
@@ -110,9 +74,27 @@
110
74
  }
111
75
  }
112
76
 
113
- &::before {
114
- width: @menuItemDividerWidth;
115
- background: @menuItemDividerBackground;
77
+ .menu-item-count {
78
+ display: @menuItemCountDisplay;
79
+ }
80
+ }
81
+
82
+ .ui.fluid.input {
83
+ min-width: 80px;
84
+ }
85
+ }
86
+
87
+ &.horizontal-responsive {
88
+ .horizontal-responsive.tabs > .ui.menu {
89
+ overflow: visible;
90
+ justify-content: space-between;
91
+
92
+ .menu-wrapper {
93
+ display: inherit;
94
+ overflow: hidden;
95
+ background: inherit;
96
+ font-family: inherit;
97
+ font-weight: inherit;
116
98
  }
117
99
  }
118
100
  }
@@ -136,109 +118,6 @@
136
118
  }
137
119
  }
138
120
  }
139
-
140
- /* MENU POSITION */
141
-
142
- > .styled > .tabs.inline {
143
- .menu {
144
- &.left {
145
- justify-content: flex-start;
146
- }
147
-
148
- &.right {
149
- justify-content: flex-end;
150
- }
151
-
152
- &.center {
153
- justify-content: center;
154
- }
155
-
156
- &.space-between {
157
- .menu-title {
158
- margin-right: auto;
159
- }
160
- }
161
-
162
- .item {
163
- &:first-child {
164
- padding-left: 0;
165
- }
166
- }
167
- }
168
- }
169
-
170
- > .styled > .tabs.side {
171
- &.left {
172
- .menu {
173
- .item {
174
- padding-top: 0;
175
- padding-left: 0;
176
- }
177
- }
178
- }
179
-
180
- &.right {
181
- .menu {
182
- .item {
183
- padding-top: 0;
184
- padding-right: 0;
185
-
186
- &.menu-title {
187
- padding-left: @menuItemPadding;
188
- }
189
- }
190
- }
191
- }
192
-
193
- .menu {
194
- &.left {
195
- align-items: flex-start;
196
- }
197
-
198
- &.right {
199
- align-items: flex-end;
200
- }
201
-
202
- &.center {
203
- align-items: center;
204
- }
205
-
206
- &.space-between {
207
- .menu-title {
208
- margin-bottom: auto;
209
- }
210
- }
211
- }
212
- }
213
-
214
- &.flex-start {
215
- > .tabs.side > .ui.menu {
216
- justify-content: flex-start;
217
- }
218
- }
219
-
220
- &.center {
221
- > .tabs.side > .ui.menu {
222
- justify-content: center;
223
- }
224
- }
225
-
226
- &.flex-end {
227
- > .tabs.side > .ui.menu {
228
- justify-content: flex-end;
229
- }
230
- }
231
-
232
- @media only screen and (max-width: @menuLargestMobileScreen) {
233
- > .styled > .side.default.tabs {
234
- flex-direction: column;
235
-
236
- > .ui.menu {
237
- flex-basis: 100%;
238
- order: 0;
239
- }
240
- }
241
- }
242
121
  }
243
122
 
244
123
  .loadAddonOverrides();
@@ -1,10 +1,8 @@
1
- @menuMargin: 0;
2
- @menuMarginEdit: 1rem 0;
3
- @menuBoxShadow: none;
4
- @menuBackgroundColor: transparent;
5
- @menuBorder: none;
6
- @menuBorderRadius: 0.28571429rem;
1
+ /*******************************
2
+ Tabs menu
3
+ *******************************/
7
4
 
5
+ /* Menu title */
8
6
  @menuTitleFontSize: 24px;
9
7
  @menuTitleFontWeight: normal;
10
8
  @menuTitleColor: #013C60;
@@ -12,27 +10,8 @@
12
10
  @menuTitleHoverColor: #013C60;
13
11
  @menuTitleHoverBackground: none;
14
12
 
13
+ /* Menu description */
15
14
  @menuDescriptionColor: #636363;
16
15
 
16
+ /* Menu item */
17
17
  @menuItemCountDisplay: none;
18
- @menuItemDividerWidth: 0;
19
- @menuItemDividerBackground: rgba(34, 36, 38, 0.1);
20
- @menuItemFontFamily: 'Raleway', sans-serif;
21
- @menuItemPadding: 1rem;
22
-
23
- @menuFirstItemPadding: @menuItemPadding;
24
-
25
- @menuItemFontSize: 16px;
26
- @menuItemFontWeight: normal;
27
- @menuItemColor: #636363;
28
- @menuItemBackground: none;
29
- @menuItemHoverColor: #878F93;
30
- @menuItemHoverBackground: none;
31
-
32
- @menuActiveItemFontWeight: normal;
33
- @menuActiveItemColor: #04A77D;
34
- @menuActiveItemBackground: none;
35
- @menuActiveItemHoverColor: #04c290;
36
- @menuActiveItemHoverBackground: none;
37
-
38
- @menuLargestMobileScreen: 767px;
@@ -0,0 +1,65 @@
1
+ @import './globals.less';
2
+
3
+ @addon: 'volto-addons';
4
+ @addontype: 'tabsblock';
5
+ @addonelement: 'tabs';
6
+
7
+ .loadAddonVariables();
8
+
9
+ .tabs-block {
10
+ > .styled {
11
+ display: flex !important;
12
+ flex: 1;
13
+ flex-flow: column;
14
+ }
15
+
16
+ .ui.segment.tab {
17
+ padding: @tabPanePadding;
18
+ }
19
+
20
+ .ui.container.tab {
21
+ padding-top: @verticalPadding;
22
+ padding-bottom: @verticalPadding;
23
+ }
24
+
25
+ > .styled > .default.tabs,
26
+ > .default.tabs {
27
+ display: flex;
28
+ flex-direction: column;
29
+
30
+ > .ui.tab {
31
+ display: flex;
32
+ flex: 1;
33
+ flex-direction: column;
34
+ }
35
+ }
36
+
37
+ &.flex-start {
38
+ > .styled > .default.tabs,
39
+ > .default.tabs {
40
+ > .ui.tab {
41
+ justify-content: flex-start;
42
+ }
43
+ }
44
+ }
45
+
46
+ &.flex-end {
47
+ > .styled > .default.tabs,
48
+ > .default.tabs {
49
+ > .ui.tab {
50
+ justify-content: flex-end;
51
+ }
52
+ }
53
+ }
54
+
55
+ &.center {
56
+ > .styled > .default.tabs,
57
+ > .default.tabs {
58
+ > .ui.tab {
59
+ justify-content: center;
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ .loadAddonOverrides();
@@ -0,0 +1,9 @@
1
+ /*******************************
2
+ Tabs block
3
+ *******************************/
4
+
5
+ @verticalPadding: 1em;
6
+ @horizontalPadding: 0;
7
+
8
+ /* Tab pane */
9
+ @tabPanePadding: @verticalPadding @horizontalPadding;
@@ -0,0 +1,76 @@
1
+ export function positionedOffset(targetElement, container) {
2
+ let element = targetElement;
3
+ const document = element.ownerDocument;
4
+ if (!document) {
5
+ return;
6
+ }
7
+
8
+ const documentElement = document.documentElement;
9
+ if (!documentElement) {
10
+ return;
11
+ }
12
+
13
+ const HTMLElement = document.defaultView.HTMLElement;
14
+
15
+ let top = 0;
16
+ let left = 0;
17
+ const height = element.offsetHeight;
18
+ const width = element.offsetWidth;
19
+
20
+ while (!(element === document.body || element === container)) {
21
+ top += element.offsetTop || 0;
22
+ left += element.offsetLeft || 0;
23
+
24
+ if (element.offsetParent instanceof HTMLElement) {
25
+ element = element.offsetParent;
26
+ } else {
27
+ return;
28
+ }
29
+ }
30
+
31
+ let scrollHeight;
32
+ let scrollWidth;
33
+ let measuredContainer;
34
+
35
+ if (
36
+ !container ||
37
+ container === document ||
38
+ container === document.defaultView ||
39
+ container === document.documentElement ||
40
+ container === document.body
41
+ ) {
42
+ measuredContainer = documentElement;
43
+ scrollHeight = getDocumentHeight(document.body, documentElement);
44
+ scrollWidth = getDocumentWidth(document.body, documentElement);
45
+ } else if (container instanceof HTMLElement) {
46
+ measuredContainer = container;
47
+ scrollHeight = container.scrollHeight;
48
+ scrollWidth = container.scrollWidth;
49
+ } else {
50
+ return;
51
+ }
52
+
53
+ const bottom = scrollHeight - (top + height);
54
+ const right = scrollWidth - (left + width);
55
+ return { top, left, bottom, right, _container: measuredContainer };
56
+ }
57
+
58
+ export function getDocumentHeight(documentBody, documentElement) {
59
+ return Math.max(
60
+ documentBody.scrollHeight,
61
+ documentElement.scrollHeight,
62
+ documentBody.offsetHeight,
63
+ documentElement.offsetHeight,
64
+ documentElement.clientHeight,
65
+ );
66
+ }
67
+
68
+ export function getDocumentWidth(documentBody, documentElement) {
69
+ return Math.max(
70
+ documentBody.scrollWidth,
71
+ documentElement.scrollWidth,
72
+ documentBody.offsetWidth,
73
+ documentElement.offsetWidth,
74
+ documentElement.clientWidth,
75
+ );
76
+ }
@@ -1,3 +1,43 @@
1
1
  import SimpleMarkdown from './SimpleMarkdown';
2
2
 
3
- export { SimpleMarkdown };
3
+ const getMenuPosition = (data) => {
4
+ const positions = {
5
+ top: 'top',
6
+ bottom: 'bottom',
7
+ 'left side': 'left',
8
+ 'right side': 'right',
9
+ };
10
+ const position = positions[data.menuPosition];
11
+ if (['left', 'right'].includes(position)) {
12
+ return {
13
+ vertical: true,
14
+ direction: position,
15
+ };
16
+ }
17
+ if (['bottom'].includes(position)) {
18
+ return {
19
+ attached: position,
20
+ };
21
+ }
22
+ return {};
23
+ };
24
+
25
+ const toggleItem = (container, item, hidden) => {
26
+ // Set visibility to hidden, instead of .hidden attribute
27
+ // so we can still calculate distance accurately
28
+ item.style.visibility = hidden ? 'hidden' : '';
29
+ // item.style.display = hidden ? 'none' : 'flex';
30
+ // Get tab-item name, if present, so we can match it up with the dropdown menu
31
+ const itemData = item.getAttribute('item-data');
32
+ if (itemData) {
33
+ const itemToHide = container.querySelector(
34
+ `[underline-item-data="${itemData}"]`,
35
+ );
36
+ if (itemToHide instanceof HTMLElement) {
37
+ itemToHide.hidden = !hidden;
38
+ }
39
+ }
40
+ };
41
+
42
+ export { SimpleMarkdown, getMenuPosition, toggleItem };
43
+ export * from './dimensions';