@eeacms/volto-tableau 6.0.0 → 6.0.2

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.
@@ -1,4 +1,5 @@
1
1
  @import './globals.less';
2
+ @import './tableau.variables';
2
3
 
3
4
  @addon: 'volto-tableau';
4
5
  @addontype: 'tableauBlock';
@@ -59,19 +60,19 @@
59
60
  animation: spin 1s linear infinite;
60
61
  background-image: linear-gradient(
61
62
  -45deg,
62
- @primaryColor 25%,
63
- @secondaryColor 25%,
64
- @secondaryColor 50%,
65
- @primaryColor 50%,
66
- @primaryColor 75%,
67
- @secondaryColor 75%
63
+ @grey-1 25%,
64
+ @grey-2 25%,
65
+ @grey-2 50%,
66
+ @grey-1 50%,
67
+ @grey-1 75%,
68
+ @grey-2 75%
68
69
  );
69
70
  background-size: 100px 100px;
70
71
  border-radius: 5px;
71
72
 
72
73
  span {
73
74
  margin: 6px auto;
74
- color: white;
75
+ color: @textColor;
75
76
  font-weight: bold;
76
77
  text-align: center;
77
78
  }
@@ -111,227 +112,7 @@
111
112
  }
112
113
  }
113
114
 
114
- // ========= Sources ==========
115
-
116
- .tableau-wrapper .visualization-info-container {
117
- display: flex;
118
- flex-wrap: wrap;
119
- align-items: center;
120
- justify-content: space-between;
121
- gap: 1.2rem;
122
-
123
- > *:first-child {
124
- margin-left: auto;
125
-
126
- > *:not(:last-child) {
127
- border-right: 1px solid @textColor;
128
- }
129
- }
130
-
131
- > *:last-child {
132
- justify-content: flex-end;
133
- }
134
-
135
- .visualization-info {
136
- display: flex;
137
- flex-grow: 0.5;
138
- align-items: center;
139
-
140
- > * {
141
- padding: 0 0.5rem;
142
- border-collapse: collapse;
143
- }
144
-
145
- > *:first-child {
146
- padding-left: 0;
147
- }
148
-
149
- > *:last-child {
150
- padding-right: 0;
151
- margin-right: 0;
152
-
153
- &.tableau-download-container {
154
- margin-left: auto;
155
- }
156
- }
157
- }
158
- }
159
-
160
- .embed-sources-header {
161
- cursor: pointer;
162
- }
163
-
164
- #tableau-share-popup {
165
- .ui.popup {
166
- padding-right: 15px;
167
- padding-left: 0;
168
- }
169
-
170
- .tableau-share-popup-text {
171
- margin-left: 7px;
172
- }
173
- }
174
-
175
- .tableau-share-popup-container {
176
- display: flex;
177
- justify-content: space-between;
178
- gap: 1rem;
179
-
180
- .tableau-share-link {
181
- input {
182
- padding-left: 7px !important;
183
- border-left: 0 !important;
184
-
185
- &:focus {
186
- outline: 1px solid var(--focus-visible, #0083e0);
187
- }
188
- }
189
- }
190
-
191
- .tableau-copy-button {
192
- max-width: 80px;
193
- padding: 10px 17px !important;
194
- border: 1px solid black !important;
195
- margin: 0 !important;
196
- background-color: #4472c4 !important;
197
- border-radius: 7px !important;
198
- }
199
-
200
- @media screen and (max-width: @largestMobileScreen) {
201
- flex-direction: column;
202
- }
203
- }
204
-
205
- .tableau-note-button,
206
- .tableau-more-info-button,
207
- .tableau-download-button,
208
- .tableau-sources-button,
209
- .tableau-share-button {
210
- display: inline-flex;
211
- align-items: center;
212
- padding-bottom: 3px;
213
- border: none;
214
- background-color: transparent;
215
- color: @textColor;
216
- cursor: pointer;
217
-
218
- .icon {
219
- margin-left: 0.5rem;
220
- }
221
-
222
- &:hover {
223
- color: @secondaryColor;
224
- }
225
-
226
- &.expanded {
227
- padding-bottom: 0;
228
- border-bottom: 3px solid @secondaryColor;
229
- color: @secondaryColor;
230
- }
231
- }
232
-
233
- .tableau-more-info-button,
234
- .tableau-download-button,
235
- .tableau-share-button {
236
- gap: 0.25rem;
237
-
238
- i {
239
- margin-bottom: 1px;
240
- }
241
- }
242
-
243
- #tableau-note-popup,
244
- #tableau-sources-popup,
245
- #tableau-download-popup {
246
- .ui.popup {
247
- background-color: @grey-1;
248
- box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;
249
-
250
- &::before {
251
- background-color: @grey-1;
252
- }
253
- }
254
-
255
- .sources-list {
256
- margin: 0;
257
- list-style: decimal inside;
258
- padding-inline-start: 0;
259
- }
260
-
261
- .embed-sources-param-description {
262
- margin-left: 5px;
263
- }
264
-
265
- @media screen and (min-width: @largestMobileScreen) {
266
- .ui.popup {
267
- max-width: 600px;
268
- }
269
- }
270
- }
271
-
272
- #tableau-download-popup {
273
- ul.no-bullets {
274
- padding: 0;
275
- margin: 0;
276
- list-style-type: none;
277
- }
278
-
279
- .visualization-wrapper {
280
- position: relative;
281
-
282
- .visualization-info {
283
- display: flex;
284
- align-items: center;
285
-
286
- > * {
287
- padding: 0 0.5rem;
288
- border-collapse: collapse;
289
- }
290
-
291
- > *:first-child {
292
- padding-left: 0;
293
- }
294
-
295
- > *:last-child {
296
- padding-right: 0;
297
- margin-right: 0;
298
-
299
- &.tableau-download-container {
300
- margin-left: auto;
301
- }
302
- }
303
-
304
- > *:not(:last-child) {
305
- border-right: 2px solid @textColor;
306
- }
307
- }
308
- }
309
-
310
- .tableau-download-button.tableau-format-download {
311
- padding: 0;
312
- color: #679ad6;
313
- font-weight: normal;
314
-
315
- &:hover {
316
- color: #164b7f;
317
- }
318
- }
319
- }
320
-
321
- @media print {
322
- .tableau-download-container,
323
- .tableau-note-container,
324
- .tableau-sources-container,
325
- .tableau-share-container,
326
- #tableau-note-popup,
327
- #tableau-sources-popup {
328
- display: none;
329
- }
330
- }
331
-
332
115
  #tableau-editor-modal {
333
116
  width: 90vw !important;
334
117
  height: calc(80vh - 10em) !important;
335
118
  }
336
-
337
- .loadAddonVariables();
@@ -1,4 +1,7 @@
1
- @tableauWrapperBackground : #f5f5f5;
1
+ @grey-1: #f9f9f9;
2
+ @grey-2: #E6E7E8;
3
+
4
+ @tableauWrapperBackground : @grey-1;
2
5
  @tableauWrapperPadding : 1rem;
3
6
  @tableauWrapperMargin : 0 0 1rem 0;
4
7
 
@@ -6,5 +9,3 @@
6
9
  @tableauIframeMargin : 0 auto 1rem auto;
7
10
  @tableauIframeBorder : none;
8
11
  @tableauIframeBorderRadius : 0;
9
-
10
- @grey-1 : #f9f9f9;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import Download from './Download';
6
-
7
- window.URL.createObjectURL = jest.fn(() => 'test');
8
-
9
- jest.mock('@plone/volto/components', () => ({
10
- Icon: ({ children }) => <img alt="incon">{children}</img>,
11
- }));
12
-
13
- describe('Download', () => {
14
- const viz = {};
15
-
16
- it('should render the component', () => {
17
- const { container } = render(<Download viz={viz} />);
18
- expect(
19
- container.querySelector('.tableau-download-container'),
20
- ).toBeInTheDocument();
21
- });
22
- });
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import { Popup } from 'semantic-ui-react';
4
- import {
5
- serializeNodes,
6
- serializeNodesToText,
7
- } from '@plone/volto-slate/editor/render';
8
- import { isArray } from 'lodash';
9
-
10
- export const serializeText = (note) => {
11
- if (!serializeNodesToText(note))
12
- return <p>There are no notes set for this visualization</p>;
13
- return isArray(note) ? serializeNodes(note) : note;
14
- };
15
-
16
- const FigureNote = ({ note = [] }) => {
17
- const [expanded, setExpanded] = React.useState(false);
18
-
19
- return (
20
- <div className="tableau-note-container">
21
- <Popup
22
- position="bottom left"
23
- popper={{ id: 'tableau-note-popup' }}
24
- trigger={
25
- <button className={cx('tableau-note-button', { expanded })}>
26
- Note
27
- </button>
28
- }
29
- on="click"
30
- onClose={() => {
31
- setExpanded(false);
32
- }}
33
- onOpen={() => {
34
- setExpanded(true);
35
- }}
36
- >
37
- <Popup.Content>{serializeText(note)}</Popup.Content>
38
- </Popup>
39
- </div>
40
- );
41
- };
42
-
43
- export default FigureNote;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import FigureNote from './FigureNote';
6
-
7
- window.URL.createObjectURL = jest.fn(() => 'test');
8
-
9
- const slateEditor = require('@plone/volto-slate/editor/render');
10
- slateEditor.serializeNodes = jest.fn();
11
-
12
- jest.mock('@plone/volto-slate/editor/render', () => ({
13
- serializeNodesToText: ({ note = [] }) => note,
14
- }));
15
-
16
- describe('FigureNote', () => {
17
- const note = [];
18
-
19
- it('should render the component', () => {
20
- const { container } = render(<FigureNote note={note} />);
21
- expect(
22
- container.querySelector('.tableau-note-container'),
23
- ).toBeInTheDocument();
24
- });
25
- });
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import { UniversalLink } from '@plone/volto/components';
4
-
5
- const Link = ({ children, ...props }) => {
6
- if (props.href) {
7
- return <UniversalLink {...props}>{children}</UniversalLink>;
8
- }
9
- return <span {...props}>{children}</span>;
10
- };
11
-
12
- const MoreInfoLink = ({ contentTypeLink }) => {
13
- return (
14
- <Link href={contentTypeLink}>
15
- <button className={cx('tableau-more-info-button')}>
16
- More info <i class="ri-external-link-line"></i>
17
- </button>
18
- </Link>
19
- );
20
- };
21
-
22
- export default MoreInfoLink;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import MoreInfoLink from './MoreInfoLink';
6
-
7
- window.URL.createObjectURL = jest.fn(() => 'test');
8
-
9
- jest.mock('@plone/volto/components', () => ({
10
- UniversalLink: ({ children }) => <div>{children}</div>,
11
- }));
12
-
13
- describe('MoreInfoLink', () => {
14
- const contentTypeLink = '/tableau-content-type';
15
-
16
- it('should render the component', () => {
17
- const { container } = render(
18
- <MoreInfoLink contentTypeLink={contentTypeLink} />,
19
- );
20
- expect(
21
- container.querySelector('.tableau-more-info-button'),
22
- ).toBeInTheDocument();
23
- });
24
- });
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import { Popup, Input, Button } from 'semantic-ui-react';
3
- import { useCopyToClipboard } from '../../helpers.js';
4
- import cx from 'classnames';
5
-
6
- const Share = ({ contentTypeLink = '' }) => {
7
- const [expanded, setExpanded] = React.useState(false);
8
- const popupRef = React.useRef();
9
-
10
- const CopyUrlButton = ({ className, url, buttonText }) => {
11
- const [copyUrlStatus, copyUrl] = useCopyToClipboard(url);
12
-
13
- if (copyUrlStatus === 'copied') {
14
- buttonText = 'Copied!';
15
- } else if (copyUrlStatus === 'failed') {
16
- buttonText = 'Copy failed. Please try again.';
17
- }
18
-
19
- return (
20
- <Button
21
- primary
22
- onClick={copyUrl}
23
- className={cx('copy-button', className)}
24
- >
25
- {buttonText}
26
- </Button>
27
- );
28
- };
29
-
30
- return (
31
- <Popup
32
- popper={{ id: 'tableau-share-popup' }}
33
- trigger={
34
- <div className="tableau-share-container">
35
- <button className={cx('tableau-share-button', { expanded })}>
36
- <span>Share</span>
37
- <i class="ri-share-fill"></i>
38
- </button>
39
- </div>
40
- }
41
- position="bottom left"
42
- on="click"
43
- onClose={() => {
44
- setExpanded(false);
45
- }}
46
- onOpen={() => {
47
- setExpanded(true);
48
- }}
49
- ref={popupRef}
50
- >
51
- <div>
52
- <span className="tableau-share-popup-text">Copy link</span>
53
- <div className="tableau-share-popup-container">
54
- <Input
55
- className="tableau-share-link"
56
- defaultValue={contentTypeLink}
57
- />
58
- <CopyUrlButton
59
- className="tableau-copy-button"
60
- url={contentTypeLink}
61
- buttonText="Copy"
62
- />
63
- </div>
64
- </div>
65
- </Popup>
66
- );
67
- };
68
-
69
- export default Share;
@@ -1,67 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import { Popup } from 'semantic-ui-react';
4
- import { UniversalLink } from '@plone/volto/components';
5
-
6
- const Link = ({ children, ...props }) => {
7
- if (props.href) {
8
- return <UniversalLink {...props}>{children}</UniversalLink>;
9
- }
10
- return <span {...props}>{children}</span>;
11
- };
12
-
13
- const Source = ({ source }) => {
14
- return (
15
- <>
16
- <Link className="embed-sources-param-title" href={source.link}>
17
- {source.title}
18
- </Link>
19
- ,
20
- <span className="embed-sources-param-description">
21
- {source.organisation}
22
- </span>
23
- </>
24
- );
25
- };
26
-
27
- const SourcesWidget = ({ sources }) => {
28
- const [expanded, setExpanded] = React.useState(false);
29
-
30
- return (
31
- <div className="tableau-sources-container">
32
- <Popup
33
- content={
34
- sources?.length ? (
35
- <ol className="sources-list">
36
- {sources?.map((source, index) => {
37
- return (
38
- <li key={index}>
39
- <Source source={source} />
40
- </li>
41
- );
42
- })}
43
- </ol>
44
- ) : (
45
- <p>Data provenance is not set for this visualization.</p>
46
- )
47
- }
48
- position="bottom left"
49
- popper={{ id: 'tableau-sources-popup' }}
50
- trigger={
51
- <button className={cx('tableau-sources-button', { expanded })}>
52
- Sources
53
- </button>
54
- }
55
- on="click"
56
- onClose={() => {
57
- setExpanded(false);
58
- }}
59
- onOpen={() => {
60
- setExpanded(true);
61
- }}
62
- />
63
- </div>
64
- );
65
- };
66
-
67
- export default SourcesWidget;