@plurid/plurid-ui-components-react 0.0.0-3

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 (107) hide show
  1. package/LICENSE +6 -0
  2. package/LICENSE.deon +8 -0
  3. package/README.md +49 -0
  4. package/distribution/components/pluridal/index.d.ts +18 -0
  5. package/distribution/components/pluridal/notifications/Notification/index.d.ts +14 -0
  6. package/distribution/components/pluridal/notifications/Notification/styled.d.ts +7 -0
  7. package/distribution/components/pluridal/notifications/Notifications/index.d.ts +26 -0
  8. package/distribution/components/pluridal/notifications/Notifications/styled.d.ts +1 -0
  9. package/distribution/components/pluridal/notifications/index.d.ts +6 -0
  10. package/distribution/components/pluridal/sitting/SittingTray/components/Sittings/index.d.ts +13 -0
  11. package/distribution/components/pluridal/sitting/SittingTray/components/Sittings/styled.d.ts +1 -0
  12. package/distribution/components/pluridal/sitting/SittingTray/components/StateImage/index.d.ts +13 -0
  13. package/distribution/components/pluridal/sitting/SittingTray/components/StateImage/styled.d.ts +5 -0
  14. package/distribution/components/pluridal/sitting/SittingTray/components/StateLine/index.d.ts +6 -0
  15. package/distribution/components/pluridal/sitting/SittingTray/components/StateLine/styled.d.ts +7 -0
  16. package/distribution/components/pluridal/sitting/SittingTray/components/StateLink/index.d.ts +7 -0
  17. package/distribution/components/pluridal/sitting/SittingTray/components/StateLink/styled.d.ts +4 -0
  18. package/distribution/components/pluridal/sitting/SittingTray/components/StateShareImage/index.d.ts +5 -0
  19. package/distribution/components/pluridal/sitting/SittingTray/components/StateShareImage/styled.d.ts +4 -0
  20. package/distribution/components/pluridal/sitting/SittingTray/index.d.ts +14 -0
  21. package/distribution/components/pluridal/sitting/SittingTray/styled.d.ts +8 -0
  22. package/distribution/components/pluridal/sitting/index.d.ts +5 -0
  23. package/distribution/components/pluridal/toolbars/HorizontalToolbarButton/index.d.ts +14 -0
  24. package/distribution/components/pluridal/toolbars/HorizontalToolbarButton/styled.d.ts +11 -0
  25. package/distribution/components/pluridal/toolbars/ToolbarControls/index.d.ts +12 -0
  26. package/distribution/components/pluridal/toolbars/ToolbarControls/styled.d.ts +12 -0
  27. package/distribution/components/pluridal/toolbars/ToolbarGeneral/index.d.ts +24 -0
  28. package/distribution/components/pluridal/toolbars/ToolbarGeneral/styled.d.ts +2 -0
  29. package/distribution/components/pluridal/toolbars/ToolbarSpecific/index.d.ts +21 -0
  30. package/distribution/components/pluridal/toolbars/ToolbarSpecific/styled.d.ts +10 -0
  31. package/distribution/components/pluridal/toolbars/VerticalToolbarButton/index.d.ts +16 -0
  32. package/distribution/components/pluridal/toolbars/VerticalToolbarButton/styled.d.ts +13 -0
  33. package/distribution/components/pluridal/toolbars/index.d.ts +9 -0
  34. package/distribution/components/universal/buttons/LinkButton/index.d.ts +16 -0
  35. package/distribution/components/universal/buttons/LinkButton/styled.d.ts +10 -0
  36. package/distribution/components/universal/buttons/PureButton/index.d.ts +16 -0
  37. package/distribution/components/universal/buttons/PureButton/styled.d.ts +15 -0
  38. package/distribution/components/universal/buttons/RefreshButton/index.d.ts +12 -0
  39. package/distribution/components/universal/buttons/RefreshButton/styled.d.ts +6 -0
  40. package/distribution/components/universal/buttons/index.d.ts +7 -0
  41. package/distribution/components/universal/form/FormLeftRight/index.d.ts +14 -0
  42. package/distribution/components/universal/form/FormLeftRight/styled.d.ts +5 -0
  43. package/distribution/components/universal/form/FormObliterate/index.d.ts +18 -0
  44. package/distribution/components/universal/form/FormObliterate/styled.d.ts +8 -0
  45. package/distribution/components/universal/form/Formbutton/index.d.ts +28 -0
  46. package/distribution/components/universal/form/Formbutton/styled.d.ts +15 -0
  47. package/distribution/components/universal/form/Formitem/index.d.ts +15 -0
  48. package/distribution/components/universal/form/Formitem/styled.d.ts +6 -0
  49. package/distribution/components/universal/form/Formline/index.d.ts +20 -0
  50. package/distribution/components/universal/form/Formline/styled.d.ts +12 -0
  51. package/distribution/components/universal/form/index.d.ts +9 -0
  52. package/distribution/components/universal/general/GlobalStyles/index.d.ts +6 -0
  53. package/distribution/components/universal/general/index.d.ts +4 -0
  54. package/distribution/components/universal/index.d.ts +47 -0
  55. package/distribution/components/universal/inputs/Dropdown/index.d.ts +45 -0
  56. package/distribution/components/universal/inputs/Dropdown/styled.d.ts +8 -0
  57. package/distribution/components/universal/inputs/InputBox/index.d.ts +13 -0
  58. package/distribution/components/universal/inputs/InputBox/styled.d.ts +9 -0
  59. package/distribution/components/universal/inputs/InputDescriptor/index.d.ts +9 -0
  60. package/distribution/components/universal/inputs/InputDescriptor/styled.d.ts +5 -0
  61. package/distribution/components/universal/inputs/InputLine/index.d.ts +17 -0
  62. package/distribution/components/universal/inputs/InputLine/styled.d.ts +5 -0
  63. package/distribution/components/universal/inputs/InputSwitch/index.d.ts +10 -0
  64. package/distribution/components/universal/inputs/InputSwitch/styled.d.ts +4 -0
  65. package/distribution/components/universal/inputs/Itemsline/index.d.ts +18 -0
  66. package/distribution/components/universal/inputs/Itemsline/styled.d.ts +7 -0
  67. package/distribution/components/universal/inputs/Select/index.d.ts +23 -0
  68. package/distribution/components/universal/inputs/Select/styled.d.ts +1 -0
  69. package/distribution/components/universal/inputs/Slider/index.d.ts +19 -0
  70. package/distribution/components/universal/inputs/Slider/styled.d.ts +4 -0
  71. package/distribution/components/universal/inputs/Switch/index.d.ts +13 -0
  72. package/distribution/components/universal/inputs/Switch/styled.d.ts +2 -0
  73. package/distribution/components/universal/inputs/Textline/index.d.ts +60 -0
  74. package/distribution/components/universal/inputs/Textline/styled.d.ts +3 -0
  75. package/distribution/components/universal/inputs/index.d.ts +14 -0
  76. package/distribution/components/universal/markers/HR/index.d.ts +9 -0
  77. package/distribution/components/universal/markers/HR/styled.d.ts +5 -0
  78. package/distribution/components/universal/markers/ProgressCircle/index.d.ts +14 -0
  79. package/distribution/components/universal/markers/ProgressCircle/styled.d.ts +5 -0
  80. package/distribution/components/universal/markers/Spinner/index.d.ts +11 -0
  81. package/distribution/components/universal/markers/Spinner/styled.d.ts +8 -0
  82. package/distribution/components/universal/markers/Tooltip/index.d.ts +16 -0
  83. package/distribution/components/universal/markers/Tooltip/styled.d.ts +12 -0
  84. package/distribution/components/universal/markers/index.d.ts +8 -0
  85. package/distribution/components/universal/typography/Heading/index.d.ts +10 -0
  86. package/distribution/components/universal/typography/Heading/styled.d.ts +6 -0
  87. package/distribution/components/universal/typography/Paragraph/index.d.ts +11 -0
  88. package/distribution/components/universal/typography/Paragraph/styled.d.ts +8 -0
  89. package/distribution/components/universal/typography/index.d.ts +6 -0
  90. package/distribution/components/universal/varia/CopyableLine/index.d.ts +17 -0
  91. package/distribution/components/universal/varia/CopyableLine/styled.d.ts +2 -0
  92. package/distribution/components/universal/varia/NewPageLink/index.d.ts +14 -0
  93. package/distribution/components/universal/varia/NewPageLink/styled.d.ts +3 -0
  94. package/distribution/components/universal/varia/ScrollableLine/index.d.ts +14 -0
  95. package/distribution/components/universal/varia/ScrollableLine/styled.d.ts +3 -0
  96. package/distribution/components/universal/varia/TextItem/index.d.ts +9 -0
  97. package/distribution/components/universal/varia/TextItem/styled.d.ts +1 -0
  98. package/distribution/components/universal/varia/index.d.ts +8 -0
  99. package/distribution/data/enumerations/index.d.ts +13 -0
  100. package/distribution/data/interfaces/index.d.ts +17 -0
  101. package/distribution/index.d.ts +4 -0
  102. package/distribution/index.es.js +3440 -0
  103. package/distribution/index.es.js.map +1 -0
  104. package/distribution/index.js +3460 -0
  105. package/distribution/index.js.map +1 -0
  106. package/distribution/utilities/input/index.d.ts +4 -0
  107. package/package.json +108 -0
@@ -0,0 +1,3460 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var React = require("react");
8
+
9
+ var themes = require("@plurid/plurid-themes");
10
+
11
+ var styled = require("styled-components");
12
+
13
+ var pluridIconsReact = require("@plurid/plurid-icons-react");
14
+
15
+ var pluridFunctionsReact = require("@plurid/plurid-functions-react");
16
+
17
+ var pluridFunctions = require("@plurid/plurid-functions");
18
+
19
+ var reactRedux = require("react-redux");
20
+
21
+ var pluridUiStateReact = require("@plurid/plurid-ui-state-react");
22
+
23
+ function _interopDefaultLegacy(e) {
24
+ return e && typeof e === "object" && "default" in e ? e : {
25
+ default: e
26
+ };
27
+ }
28
+
29
+ var React__default = _interopDefaultLegacy(React);
30
+
31
+ var themes__default = _interopDefaultLegacy(themes);
32
+
33
+ var styled__default = _interopDefaultLegacy(styled);
34
+
35
+ const StyledSpinner = styled__default["default"].div`
36
+ position: absolute;
37
+ top: 50%;
38
+ left: 50%;
39
+ transform: translateX(-50%) translateY(-50%);
40
+ `;
41
+
42
+ const StyledLoader = styled__default["default"].div`
43
+ display: inline-block;
44
+ position: relative;
45
+
46
+ width: ${props => {
47
+ switch (props.size) {
48
+ case "small":
49
+ return "1rem";
50
+
51
+ case "normal":
52
+ return "1.8rem";
53
+
54
+ case "large":
55
+ return "2.4rem";
56
+
57
+ default:
58
+ return "1.8rem";
59
+ }
60
+ }};
61
+ height: ${props => {
62
+ switch (props.size) {
63
+ case "small":
64
+ return "1rem";
65
+
66
+ case "normal":
67
+ return "1.8rem";
68
+
69
+ case "large":
70
+ return "2.4rem";
71
+
72
+ default:
73
+ return "1.8rem";
74
+ }
75
+ }};
76
+
77
+ div {
78
+ width: ${props => {
79
+ switch (props.size) {
80
+ case "small":
81
+ return "1rem";
82
+
83
+ case "normal":
84
+ return "1.8rem";
85
+
86
+ case "large":
87
+ return "2.4rem";
88
+
89
+ default:
90
+ return "1.8rem";
91
+ }
92
+ }};
93
+ height: ${props => {
94
+ switch (props.size) {
95
+ case "small":
96
+ return "1rem";
97
+
98
+ case "normal":
99
+ return "1.8rem";
100
+
101
+ case "large":
102
+ return "2.4rem";
103
+
104
+ default:
105
+ return "1.8rem";
106
+ }
107
+ }};
108
+ margin: ${props => {
109
+ switch (props.size) {
110
+ case "small":
111
+ return "0.1rem";
112
+
113
+ case "normal":
114
+ return "0.2rem";
115
+
116
+ case "large":
117
+ return "0.3rem";
118
+
119
+ default:
120
+ return "0.2rem";
121
+ }
122
+ }};
123
+ border: ${props => {
124
+ switch (props.size) {
125
+ case "small":
126
+ return "0.1rem solid " + props.theme.colorPrimary;
127
+
128
+ case "normal":
129
+ return "0.2rem solid " + props.theme.colorPrimary;
130
+
131
+ case "large":
132
+ return "0.3rem solid " + props.theme.colorPrimary;
133
+
134
+ default:
135
+ return "0.2rem solid " + props.theme.colorPrimary;
136
+ }
137
+ }};
138
+ border-color: ${props => props.theme.colorPrimary} transparent transparent transparent;
139
+
140
+ box-sizing: border-box;
141
+ display: block;
142
+ position: absolute;
143
+ border-radius: 50%;
144
+ animation: spinner-rotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
145
+ }
146
+
147
+ div:nth-child(1) {
148
+ animation-delay: -0.45s;
149
+ }
150
+
151
+ div:nth-child(2) {
152
+ animation-delay: -0.3s;
153
+ }
154
+
155
+ div:nth-child(3) {
156
+ animation-delay: -0.15s;
157
+ }
158
+
159
+ @keyframes spinner-rotate {
160
+ 0% {
161
+ transform: rotate(0deg);
162
+ }
163
+ 100% {
164
+ transform: rotate(360deg);
165
+ }
166
+ }
167
+ `;
168
+
169
+ const Spinner = properties => {
170
+ const {theme: theme, size: size, style: style, className: className} = properties;
171
+ const themeValue = theme || themes.plurid;
172
+ const sizeValue = size || "normal";
173
+ return React__default["default"].createElement(StyledSpinner, {
174
+ style: Object.assign({}, style),
175
+ className: className
176
+ }, React__default["default"].createElement(StyledLoader, {
177
+ theme: themeValue,
178
+ size: sizeValue
179
+ }, React__default["default"].createElement("div", null), React__default["default"].createElement("div", null), React__default["default"].createElement("div", null), React__default["default"].createElement("div", null)));
180
+ };
181
+
182
+ const StyledPureButton = styled__default["default"].button`
183
+ color: ${({theme: theme}) => theme.colorPrimary};
184
+ background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
185
+ if (isDisabled) {
186
+ return theme.backgroundColorPrimaryAlpha;
187
+ }
188
+ switch (level) {
189
+ case 0:
190
+ return theme.backgroundColorPrimary;
191
+
192
+ case 1:
193
+ return theme.backgroundColorSecondary;
194
+
195
+ case 2:
196
+ return theme.backgroundColorTertiary;
197
+
198
+ case 3:
199
+ return theme.backgroundColorQuaternary;
200
+
201
+ default:
202
+ return theme.backgroundColorPrimary;
203
+ }
204
+ }};
205
+ box-shadow: 0px 8px 8px 0px ${({theme: theme}) => theme.boxShadowUmbraColor};
206
+
207
+ box-sizing: border-box;
208
+ display: block;
209
+ width: 100%;
210
+ min-width: ${({size: size}) => {
211
+ switch (size) {
212
+ case "small":
213
+ return "8rem";
214
+
215
+ case "normal":
216
+ return "10rem";
217
+
218
+ case "large":
219
+ return "12rem";
220
+
221
+ default:
222
+ return "10rem";
223
+ }
224
+ }};
225
+ border-radius: ${({size: size}) => {
226
+ switch (size) {
227
+ case "small":
228
+ return "1rem";
229
+
230
+ case "normal":
231
+ return "1.2rem";
232
+
233
+ case "large":
234
+ return "1.4rem";
235
+
236
+ default:
237
+ return "1.2rem";
238
+ }
239
+ }};
240
+ padding: ${({size: size}) => {
241
+ switch (size) {
242
+ case "small":
243
+ return "0 1.2rem";
244
+
245
+ case "normal":
246
+ return "0 1.4rem";
247
+
248
+ case "large":
249
+ return "0 1.6rem";
250
+
251
+ default:
252
+ return "0 1.4rem";
253
+ }
254
+ }};
255
+
256
+ font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
257
+ font-size: ${({size: size}) => {
258
+ switch (size) {
259
+ case "small":
260
+ return "0.8rem";
261
+
262
+ case "normal":
263
+ return "0.9rem";
264
+
265
+ case "large":
266
+ return "1rem";
267
+
268
+ default:
269
+ return "0.9rem";
270
+ }
271
+ }};
272
+ height: ${({size: size}) => {
273
+ switch (size) {
274
+ case "small":
275
+ return "2rem";
276
+
277
+ case "normal":
278
+ return "2.4rem";
279
+
280
+ case "large":
281
+ return "2.8rem";
282
+
283
+ default:
284
+ return "2.4rem";
285
+ }
286
+ }};
287
+ cursor: ${({isDisabled: isDisabled}) => {
288
+ if (isDisabled) {
289
+ return "default";
290
+ }
291
+ return "pointer";
292
+ }};
293
+
294
+
295
+ border: none;
296
+ outline: none;
297
+ user-select: none;
298
+ display: grid;
299
+ place-content: center;
300
+ line-height: 1.2;
301
+ font-weight: bold;
302
+ transition: box-shadow 200ms linear, background-color 200ms linear;
303
+ position: relative;
304
+ min-height: 40px;
305
+ min-width: 160px;
306
+
307
+ :hover {
308
+ background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
309
+ if (isDisabled) {
310
+ return theme.backgroundColorPrimaryAlpha;
311
+ }
312
+ switch (level) {
313
+ case 0:
314
+ return theme.backgroundColorSecondary;
315
+
316
+ case 1:
317
+ return theme.backgroundColorTertiary;
318
+
319
+ case 2:
320
+ return theme.backgroundColorQuaternary;
321
+
322
+ case 3:
323
+ return theme.backgroundColorPrimary;
324
+
325
+ default:
326
+ return theme.backgroundColorSecondary;
327
+ }
328
+ }};
329
+ }
330
+
331
+ :active {
332
+ box-shadow: ${({theme: theme, isDisabled: isDisabled}) => {
333
+ if (isDisabled) {
334
+ return "0px 8px 8px 0px " + theme.boxShadowUmbraColor;
335
+ }
336
+ return "0px 3px 3px 0px " + theme.boxShadowUmbraColor;
337
+ }};
338
+ }
339
+ `;
340
+
341
+ const StyledPureButtonDiv = styled__default["default"](StyledPureButton).attrs({
342
+ as: "div"
343
+ })`
344
+ background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
345
+ if (isDisabled) {
346
+ return "";
347
+ }
348
+ switch (level) {
349
+ case 0:
350
+ return theme.backgroundColorSecondary;
351
+
352
+ case 1:
353
+ return theme.backgroundColorTertiary;
354
+
355
+ case 2:
356
+ return theme.backgroundColorQuaternary;
357
+
358
+ case 3:
359
+ return theme.backgroundColorPrimary;
360
+
361
+ default:
362
+ return theme.backgroundColorSecondary;
363
+ }
364
+ }};
365
+ box-shadow: 0px 3px 3px 0px ${({theme: theme}) => theme.boxShadowUmbraColor};
366
+ `;
367
+
368
+ const PureButton = properties => {
369
+ const {text: text, atClick: atClick, theme: themeProperty, level: levelProperty, size: sizeProperty, disabled: disabled, loading: loading, style: style, className: className} = properties;
370
+ const theme = themeProperty || themes.plurid;
371
+ const level = levelProperty !== null && levelProperty !== void 0 ? levelProperty : 0;
372
+ const size = sizeProperty || "normal";
373
+ if (loading) {
374
+ return React__default["default"].createElement(StyledPureButtonDiv, {
375
+ style: Object.assign({}, style),
376
+ className: className,
377
+ theme: theme,
378
+ level: level,
379
+ size: size,
380
+ isDisabled: disabled
381
+ }, React__default["default"].createElement(Spinner, {
382
+ theme: theme,
383
+ size: "small"
384
+ }));
385
+ }
386
+ return React__default["default"].createElement(StyledPureButton, {
387
+ onClick: event => disabled ? null : atClick(event),
388
+ style: Object.assign({}, style),
389
+ className: className,
390
+ theme: theme,
391
+ level: level,
392
+ size: size,
393
+ isDisabled: disabled
394
+ }, text);
395
+ };
396
+
397
+ const StyledLinkButton = styled__default["default"].button`
398
+ font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
399
+
400
+ color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
401
+ if (isDisabled) {
402
+ return theme.backgroundColorPrimaryAlpha;
403
+ }
404
+ switch (level) {
405
+ case 0:
406
+ return theme.colorPrimary;
407
+
408
+ case 1:
409
+ return theme.colorSecondary;
410
+
411
+ case 2:
412
+ return theme.colorTertiary;
413
+
414
+ default:
415
+ return theme.colorPrimary;
416
+ }
417
+ }};
418
+ margin: ${({inline: inline}) => {
419
+ if (inline) {
420
+ return "0";
421
+ }
422
+ return "0 1rem";
423
+ }};
424
+ padding: ${({inline: inline}) => {
425
+ if (inline) {
426
+ return "0";
427
+ }
428
+ return "initial";
429
+ }};
430
+ font-size: ${({inline: inline}) => {
431
+ if (inline) {
432
+ return "inherit";
433
+ }
434
+ return "0.9rem";
435
+ }};
436
+ display: ${({inline: inline}) => {
437
+ if (inline) {
438
+ return "inline";
439
+ }
440
+ return "grid";
441
+ }};
442
+ cursor: ${({isDisabled: isDisabled}) => {
443
+ if (isDisabled) {
444
+ return "inherit";
445
+ }
446
+ return "pointer";
447
+ }};
448
+ border: none;
449
+ border-bottom: 1px solid ${({isActive: isActive, theme: theme}) => {
450
+ if (isActive) {
451
+ return theme.colorPrimary;
452
+ }
453
+ return "transparent";
454
+ }};
455
+
456
+ font-weight: bold;
457
+ background: transparent;
458
+ place-content: center;
459
+ user-select: none;
460
+ outline: none;
461
+ `;
462
+
463
+ const StyledLinkButtonLoading = styled__default["default"].div`
464
+ position: relative;
465
+ min-height: 1rem;
466
+ height: 100%;
467
+ width: 100%;
468
+ `;
469
+
470
+ const DEFAULT_LEVEL$1 = 0;
471
+
472
+ const LinkButton = properties => {
473
+ const {text: text, atClick: atClick, theme: themeProperty, level: levelProperty, inline: inline, disabled: disabled, loading: loading, active: active, style: style, className: className} = properties;
474
+ const theme = themeProperty || themes.plurid;
475
+ const level = levelProperty !== null && levelProperty !== void 0 ? levelProperty : DEFAULT_LEVEL$1;
476
+ if (loading) {
477
+ return React__default["default"].createElement(StyledLinkButtonLoading, null, React__default["default"].createElement(Spinner, {
478
+ size: "small",
479
+ theme: theme
480
+ }));
481
+ }
482
+ return React__default["default"].createElement(StyledLinkButton, {
483
+ onClick: event => disabled ? null : atClick(event),
484
+ style: Object.assign({}, style),
485
+ className: className,
486
+ theme: theme,
487
+ level: level,
488
+ inline: inline,
489
+ isDisabled: disabled,
490
+ isActive: active
491
+ }, text);
492
+ };
493
+
494
+ const StyledRefreshButton = styled__default["default"].div`
495
+ `;
496
+
497
+ const RefreshButton = properties => {
498
+ const {atClick: atClick, theme: themeProperty, text: textProperty, disabled: disabled, hideAtClick: hideAtClickProperty, hideTime: hideTimeProperty} = properties;
499
+ const theme = themeProperty || themes.plurid;
500
+ const text = textProperty || "";
501
+ const hideAtClick = hideAtClickProperty !== null && hideAtClickProperty !== void 0 ? hideAtClickProperty : true;
502
+ const hideTime = hideTimeProperty || 1300;
503
+ const isMounted = React.useRef(true);
504
+ const [showIconReset, setShowIconReset] = React.useState(true);
505
+ const atClickHandler = event => {
506
+ if (disabled) {
507
+ return;
508
+ }
509
+ if (hideAtClick) {
510
+ setShowIconReset(false);
511
+ }
512
+ atClick(event);
513
+ if (hideAtClick) {
514
+ setTimeout((() => {
515
+ if (!isMounted.current) {
516
+ return;
517
+ }
518
+ setShowIconReset(true);
519
+ }), hideTime);
520
+ }
521
+ };
522
+ React.useEffect((() => () => {
523
+ isMounted.current = false;
524
+ }), []);
525
+ return React__default["default"].createElement(StyledRefreshButton, {
526
+ theme: theme
527
+ }, showIconReset && React__default["default"].createElement(pluridIconsReact.PluridIconReset, {
528
+ theme: theme,
529
+ title: text,
530
+ inactive: disabled,
531
+ opacity: disabled ? .5 : 1,
532
+ atClick: atClickHandler
533
+ }));
534
+ };
535
+
536
+ const buttons = {
537
+ PureButton: PureButton,
538
+ LinkButton: LinkButton,
539
+ RefreshButton: RefreshButton
540
+ };
541
+
542
+ const StyledFormbutton = styled__default["default"].div`
543
+ display: grid;
544
+ grid-template-columns: 20px 1fr;
545
+ grid-gap: 0.5rem;
546
+ align-items: center;
547
+ min-height: 2rem;
548
+ user-select: none;
549
+ text-decoration: none;
550
+ padding: 0.3rem 0.7rem;
551
+
552
+ margin: ${props => {
553
+ if (props.devisible) {
554
+ return "0";
555
+ }
556
+ return "initial";
557
+ }};
558
+ cursor: ${props => {
559
+ if (props.inactive) {
560
+ return "default";
561
+ }
562
+ return "pointer";
563
+ }};
564
+ color: ${props => props.theme.colorPrimary};
565
+
566
+ :hover {
567
+ background-color: ${props => {
568
+ if (!props.hoverEffect) {
569
+ return "initial";
570
+ }
571
+ if (props.inactive || props.devisible) {
572
+ return "initial";
573
+ }
574
+ return props.theme.backgroundColorSecondary;
575
+ }};
576
+ }
577
+ `;
578
+
579
+ const StyledFormbuttonIcon = styled__default["default"].div`
580
+ justify-self: ${props => props.position};
581
+ display: grid;
582
+ place-content: center;
583
+ `;
584
+
585
+ const StyledFormbuttonText = styled__default["default"].div`
586
+ `;
587
+
588
+ const Formbutton = properties => {
589
+ const {text: text, Icon: Icon, atClick: atClick, link: link, target: target, theme: theme, devisible: devisible, level: level, iconPosition: iconPosition, inactive: inactive, hoverEffect: hoverEffectProperty, style: style, className: className} = properties;
590
+ const _theme = theme || themes.plurid;
591
+ const _level = level !== null && level !== void 0 ? level : 0;
592
+ const _devisible = devisible !== null && devisible !== void 0 ? devisible : false;
593
+ const _iconPosition = iconPosition || "left";
594
+ const _inactive = inactive !== null && inactive !== void 0 ? inactive : false;
595
+ const hoverEffect = hoverEffectProperty !== null && hoverEffectProperty !== void 0 ? hoverEffectProperty : true;
596
+ const render = () => React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(StyledFormbuttonIcon, {
597
+ position: _iconPosition
598
+ }, React__default["default"].createElement(Icon, {
599
+ theme: _theme
600
+ })), React__default["default"].createElement(StyledFormbuttonText, null, text));
601
+ const renderProperties = {
602
+ style: Object.assign({}, style),
603
+ className: className,
604
+ theme: _theme,
605
+ level: _level,
606
+ inactive: _inactive,
607
+ devisible: _devisible,
608
+ hoverEffect: hoverEffect
609
+ };
610
+ if (link) {
611
+ return React__default["default"].createElement(StyledFormbutton, Object.assign({
612
+ onClick: event => !_inactive ? atClick(event) : null,
613
+ as: "a",
614
+ href: link,
615
+ target: target
616
+ }, renderProperties), render());
617
+ }
618
+ return React__default["default"].createElement(StyledFormbutton, Object.assign({
619
+ onClick: event => !_inactive ? atClick(event) : null
620
+ }, renderProperties), render());
621
+ };
622
+
623
+ const StyledFormitem = styled__default["default"].div`
624
+ display: grid;
625
+ align-items: center;
626
+ min-height: 2rem;
627
+ padding: 0.3rem 0.7rem;
628
+ user-select: none;
629
+ `;
630
+
631
+ const Formitem = properties => {
632
+ const {theme: theme, level: level, style: style, className: className, children: children} = properties;
633
+ const _theme = theme || themes.plurid;
634
+ const _level = level !== null && level !== void 0 ? level : 0;
635
+ return React__default["default"].createElement(StyledFormitem, {
636
+ style: Object.assign({}, style),
637
+ className: className,
638
+ theme: _theme,
639
+ level: _level
640
+ }, children);
641
+ };
642
+
643
+ const StyledFormLeftRight = styled__default["default"].div`
644
+ display: flex;
645
+ align-items: center;
646
+ justify-content: space-between;
647
+ `;
648
+
649
+ const FormLeftRight = properties => {
650
+ const {theme: theme, style: style, className: className, children: children} = properties;
651
+ const _theme = theme || themes.plurid;
652
+ return React__default["default"].createElement(StyledFormLeftRight, {
653
+ style: Object.assign({}, style),
654
+ className: className,
655
+ theme: _theme
656
+ }, children);
657
+ };
658
+
659
+ const StyledFormline = styled__default["default"].div`
660
+ display: grid;
661
+ grid-template-columns: 1fr 1fr;
662
+ align-items: center;
663
+ min-height: 2rem;
664
+ padding: 0.3rem 0.7rem;
665
+
666
+ color: ${props => props.theme.colorPrimary};
667
+
668
+ @media (max-width: 800px) {
669
+ grid-template-columns: ${props => {
670
+ if (props.responsive) {
671
+ return "1fr";
672
+ }
673
+ return "1fr 1fr";
674
+ }};
675
+ min-height: ${props => {
676
+ if (props.responsive) {
677
+ return "2.4rem";
678
+ }
679
+ return "2rem";
680
+ }};
681
+ justify-items: ${props => {
682
+ if (props.responsive) {
683
+ return "center";
684
+ }
685
+ return "auto";
686
+ }};
687
+ justify-content: ${props => {
688
+ if (props.responsive) {
689
+ return "center";
690
+ }
691
+ return "auto";
692
+ }};
693
+ }
694
+ `;
695
+
696
+ const StyledFormlineText = styled__default["default"].div`
697
+ user-select: none;
698
+ `;
699
+
700
+ const StyledFormlineElement = styled__default["default"].div`
701
+ justify-self: right;
702
+
703
+ @media (max-width: 800px) {
704
+ justify-self: ${props => {
705
+ if (props.responsive) {
706
+ return "center";
707
+ }
708
+ return "right";
709
+ }};
710
+ }
711
+ `;
712
+
713
+ const Formline = properties => {
714
+ const {text: text, Element: Element, theme: theme, level: level, responsive: responsive, style: style, className: className, children: children} = properties;
715
+ const _theme = theme || themes.plurid;
716
+ const _level = level === undefined ? 0 : level;
717
+ const _responsive = responsive === undefined ? false : responsive;
718
+ return React__default["default"].createElement(StyledFormline, {
719
+ style: Object.assign({}, style),
720
+ className: className,
721
+ theme: _theme,
722
+ level: _level,
723
+ responsive: _responsive
724
+ }, React__default["default"].createElement(StyledFormlineText, null, text), React__default["default"].createElement(StyledFormlineElement, {
725
+ responsive: _responsive
726
+ }, Element ? React__default["default"].createElement(Element, null) : React__default["default"].createElement(React__default["default"].Fragment, null, children)));
727
+ };
728
+
729
+ const StyledFormObliterate = styled__default["default"].div`
730
+ color: ${properties => properties.theme.colorPrimary};
731
+ font-family: ${properties => properties.theme.fontFamilySansSerif};
732
+ font-size: 0.8rem;
733
+ user-select: none;
734
+ `;
735
+
736
+ const StyledObliterateContainer = styled__default["default"].div`
737
+ text-align: center;
738
+ display: grid;
739
+ grid-template-columns: 1fr;
740
+ grid-template-rows: 30px 45px 60px;
741
+ align-items: center;
742
+ max-width: 200px;
743
+ margin: 1rem auto;
744
+ `;
745
+
746
+ const FormObliterate = properties => {
747
+ const {atObliterate: atObliterate, item: item, theme: theme, devisible: devisible, level: level, style: style, className: className} = properties;
748
+ const _theme = theme || themes.plurid;
749
+ const _level = level !== null && level !== void 0 ? level : 0;
750
+ const _devisible = devisible !== null && devisible !== void 0 ? devisible : false;
751
+ const [showObliterate, setShowObliterate] = React.useState(false);
752
+ const handleObliterate = event => {
753
+ setShowObliterate(false);
754
+ atObliterate(event);
755
+ };
756
+ return React__default["default"].createElement(StyledFormObliterate, {
757
+ theme: _theme,
758
+ level: _level,
759
+ devisible: _devisible,
760
+ style: Object.assign({}, style),
761
+ className: className
762
+ }, !showObliterate && React__default["default"].createElement(Formbutton, {
763
+ theme: _theme,
764
+ text: item ? `obliterate ${item}` : "obliterate",
765
+ Icon: pluridIconsReact.PluridIconObliterate,
766
+ atClick: () => setShowObliterate(true),
767
+ devisible: true
768
+ }), showObliterate && React__default["default"].createElement(StyledObliterateContainer, null, React__default["default"].createElement("div", null, "remove forever?"), React__default["default"].createElement(LinkButton, {
769
+ theme: _theme,
770
+ text: "cancel",
771
+ atClick: () => setShowObliterate(false)
772
+ }), React__default["default"].createElement(PureButton, {
773
+ theme: _theme,
774
+ text: "Obliterate",
775
+ atClick: event => handleObliterate(event)
776
+ })));
777
+ };
778
+
779
+ const form = {
780
+ Formbutton: Formbutton,
781
+ Formitem: Formitem,
782
+ FormLeftRight: FormLeftRight,
783
+ Formline: Formline,
784
+ FormObliterate: FormObliterate
785
+ };
786
+
787
+ const GlobalStyles = styled.createGlobalStyle`
788
+ *, *::after, *::before {
789
+ box-sizing: border-box;
790
+ }
791
+
792
+ html {
793
+ height: 100%;
794
+ min-height: 100vh;
795
+ }
796
+
797
+ body {
798
+ font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
799
+
800
+ height: 100%;
801
+ margin: 0;
802
+ padding: 0;
803
+ -webkit-font-smoothing: antialiased;
804
+ -moz-osx-font-smoothing: grayscale;
805
+
806
+ color: ${({theme: theme}) => {
807
+ if (theme.type === "dark") {
808
+ return theme.backgroundColorBright;
809
+ }
810
+ return theme.colorPrimary;
811
+ }};
812
+ background: ${({theme: theme}) => {
813
+ if (theme.type === "dark") {
814
+ return theme.backgroundColorDark;
815
+ }
816
+ return theme.backgroundColorPrimary;
817
+ }};
818
+ }
819
+ `;
820
+
821
+ const general = {
822
+ GlobalStyles: GlobalStyles
823
+ };
824
+
825
+ const setNativeValue = (element, value) => {
826
+ const valueSetter = Object.getOwnPropertyDescriptor(element, "value").set;
827
+ const prototype = Object.getPrototypeOf(element);
828
+ const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, "value").set;
829
+ if (valueSetter && valueSetter !== prototypeValueSetter) {
830
+ prototypeValueSetter.call(element, value);
831
+ } else {
832
+ valueSetter.call(element, value);
833
+ }
834
+ };
835
+
836
+ const StyledTextline = styled__default["default"].div`
837
+ position: relative;
838
+ display: inline-block;
839
+ width: 100%;
840
+
841
+ input {
842
+ box-sizing: border-box;
843
+ border: none;
844
+ outline: none;
845
+ font-size: 0.8rem;
846
+
847
+ padding: ${props => {
848
+ if (props.devisible) {
849
+ return "0";
850
+ }
851
+ return "0.6rem 1rem";
852
+ }};
853
+ padding-top: ${props => {
854
+ if (props.devisible) {
855
+ return "0";
856
+ }
857
+ return "0.7rem";
858
+ }};
859
+ min-height: ${props => {
860
+ if (props.devisible) {
861
+ return "initial";
862
+ }
863
+ return "36px";
864
+ }};
865
+ background-color: ${props => {
866
+ if (props.devisible) {
867
+ return "transparent";
868
+ }
869
+ switch (props.level) {
870
+ case 0:
871
+ return props.theme.backgroundColorPrimary;
872
+
873
+ case 1:
874
+ return props.theme.backgroundColorSecondary;
875
+
876
+ case 2:
877
+ return props.theme.backgroundColorTertiary;
878
+
879
+ case 3:
880
+ return props.theme.backgroundColorQuaternary;
881
+
882
+ default:
883
+ return props.theme.backgroundColorPrimary;
884
+ }
885
+ }};
886
+ color: ${props => props.theme.colorPrimary};
887
+ box-shadow: inset 0px 4px 4px ${props => {
888
+ if (props.devisible) {
889
+ return "transparent";
890
+ }
891
+ return props.theme.boxShadowUmbraColor;
892
+ }};
893
+ border-radius: ${props => {
894
+ if (props.devisible) {
895
+ return "0";
896
+ }
897
+ if (props.round) {
898
+ return "1000px";
899
+ }
900
+ return "0px";
901
+ }};
902
+ width: ${props => {
903
+ if (!props.width) {
904
+ return "100%";
905
+ }
906
+ if (typeof props.width === "number") {
907
+ return props.width + "px";
908
+ }
909
+ return props.width;
910
+ }};
911
+ text-align: ${props => {
912
+ if (props.center) {
913
+ return "center";
914
+ }
915
+ return "left";
916
+ }};
917
+
918
+ ::placeholder {
919
+ color: ${props => props.theme.colorSecondary};
920
+ }
921
+ }
922
+ `;
923
+
924
+ const StyledEnterIcon = styled__default["default"].div`
925
+ position: absolute;
926
+ top: 50%;
927
+ transform: translateY(-50%);
928
+ height: 20px;
929
+ width: 20px;
930
+ border-radius: 100px;
931
+ display: flex;
932
+ align-items: center;
933
+ justify-content: center;
934
+ font-size: 0.9rem;
935
+ user-select: none;
936
+ cursor: pointer;
937
+ border: 1px solid transparent;
938
+
939
+ right: ${props => {
940
+ if (props.left) {
941
+ return "auto";
942
+ }
943
+ return "0.6rem";
944
+ }};
945
+ left: ${props => {
946
+ if (props.left) {
947
+ return "0.6rem";
948
+ }
949
+ return "auto";
950
+ }};
951
+ color: ${props => props.theme.colorPrimary};
952
+
953
+ :hover {
954
+ border: 1px solid ${props => props.theme.colorPrimary};
955
+ }
956
+ `;
957
+
958
+ const StyledErrorLine = styled__default["default"].div`
959
+ position: absolute;
960
+ background-color: #FF0000;
961
+ bottom: -2px;
962
+
963
+ height: ${props => {
964
+ if (props.devisible) {
965
+ return "2px";
966
+ }
967
+ return "4px";
968
+ }};
969
+ left: ${props => {
970
+ if (props.devisible) {
971
+ return "0";
972
+ }
973
+ if (!props.round) {
974
+ return "0";
975
+ }
976
+ return "14px";
977
+ }};
978
+ right: ${props => {
979
+ if (props.devisible) {
980
+ return "0";
981
+ }
982
+ if (!props.round) {
983
+ return "0";
984
+ }
985
+ return "14px";
986
+ }};
987
+ border-radius: ${props => {
988
+ if (props.devisible) {
989
+ return "0";
990
+ }
991
+ if (props.round) {
992
+ return "10px";
993
+ }
994
+ return "0px";
995
+ }};
996
+ box-shadow: 0px 1px 3px 0px ${props => {
997
+ if (props.devisible) {
998
+ return "initial";
999
+ }
1000
+ return props.theme.boxShadowUmbraColor;
1001
+ }};
1002
+ `;
1003
+
1004
+ const Textline = React.forwardRef(((properties, reference) => {
1005
+ const {text: text, atChange: atChange, atKeyDown: atKeyDown, atFocus: atFocus, atBlur: atBlur, type: type, placeholder: placeholder, autoCapitalize: autoCapitalize, autoComplete: autoComplete, autoCorrect: autoCorrect, spellCheck: spellCheck, style: style, className: className, theme: theme, level: level, devisible: devisible, center: center, round: round, width: width, error: error, enterIconLeft: enterIconLeft, enterAtClick: enterAtClick, escapeClear: escapeClear, ariaLabel: ariaLabel} = properties;
1006
+ const _type = type || "text";
1007
+ const _theme = theme || themes.plurid;
1008
+ const _level = level !== null && level !== void 0 ? level : 0;
1009
+ const _round = round !== null && round !== void 0 ? round : true;
1010
+ const inputElement = React.useRef();
1011
+ const handleKeyDown = event => {
1012
+ if (!inputElement.current) {
1013
+ return;
1014
+ }
1015
+ if (atKeyDown) {
1016
+ atKeyDown(event);
1017
+ }
1018
+ if (enterAtClick && event.key === "Enter") {
1019
+ enterAtClick();
1020
+ }
1021
+ if (escapeClear && event.key === "Escape" && inputElement.current) {
1022
+ setNativeValue(inputElement.current, "");
1023
+ const _event = new Event("input", {
1024
+ bubbles: true
1025
+ });
1026
+ inputElement.current.dispatchEvent(_event);
1027
+ }
1028
+ };
1029
+ return React__default["default"].createElement(StyledTextline, {
1030
+ theme: _theme,
1031
+ level: _level,
1032
+ devisible: devisible,
1033
+ center: center,
1034
+ round: _round,
1035
+ width: width,
1036
+ className: className
1037
+ }, React__default["default"].createElement("input", {
1038
+ type: _type,
1039
+ value: text,
1040
+ onChange: atChange,
1041
+ onKeyDown: handleKeyDown,
1042
+ onFocus: atFocus,
1043
+ onBlur: atBlur,
1044
+ placeholder: placeholder,
1045
+ autoCapitalize: autoCapitalize,
1046
+ autoComplete: autoComplete,
1047
+ autoCorrect: autoCorrect,
1048
+ spellCheck: spellCheck,
1049
+ "aria-label": ariaLabel,
1050
+ style: Object.assign({}, style),
1051
+ ref: pluridFunctionsReact.mergeReferences(inputElement, reference)
1052
+ }), error && React__default["default"].createElement(StyledErrorLine, {
1053
+ theme: _theme,
1054
+ devisible: devisible,
1055
+ round: _round
1056
+ }), enterAtClick && text.length > 0 && React__default["default"].createElement(StyledEnterIcon, {
1057
+ theme: _theme,
1058
+ onClick: () => enterAtClick(),
1059
+ left: enterIconLeft
1060
+ }, "➔"));
1061
+ }));
1062
+
1063
+ const StyledDropdown = styled__default["default"].div`
1064
+ color: ${props => props.theme.colorPrimary};
1065
+ text-align: ${props => {
1066
+ if (props.left) {
1067
+ return "left";
1068
+ }
1069
+ return "right";
1070
+ }};
1071
+ font-size: 1rem;
1072
+
1073
+ position: relative;
1074
+ `;
1075
+
1076
+ const StyledDropdownSelected = styled__default["default"].div`
1077
+ cursor: pointer;
1078
+ user-select: none;
1079
+ color: ${props => {
1080
+ if (props.selectedColor) {
1081
+ return props.selectedColor;
1082
+ }
1083
+ return props.theme.colorPrimary;
1084
+ }};
1085
+ `;
1086
+
1087
+ const StyledDropdownList = styled__default["default"].div`
1088
+ font-size: 0.85rem;
1089
+
1090
+ background: ${props => {
1091
+ switch (props.level) {
1092
+ case 0:
1093
+ return props.theme.backgroundColorPrimary;
1094
+
1095
+ case 1:
1096
+ return props.theme.backgroundColorSecondary;
1097
+
1098
+ case 2:
1099
+ return props.theme.backgroundColorTertiary;
1100
+
1101
+ case 3:
1102
+ return props.theme.backgroundColorQuaternary;
1103
+
1104
+ default:
1105
+ return props.theme.backgroundColorPrimary;
1106
+ }
1107
+ }};
1108
+ color: ${props => props.theme.colorPrimary};
1109
+ left: ${props => {
1110
+ if (props.left) {
1111
+ return "0px";
1112
+ }
1113
+ return "auto";
1114
+ }};
1115
+ right: ${props => {
1116
+ if (props.left) {
1117
+ return "auto";
1118
+ }
1119
+ return "0px";
1120
+ }};
1121
+ height: ${props => {
1122
+ if (props.heightItems) {
1123
+ return props.heightItems * 2 + "rem";
1124
+ }
1125
+ return "initial";
1126
+ }};
1127
+ overflow: ${props => {
1128
+ if (props.heightItems) {
1129
+ return "scroll";
1130
+ }
1131
+ return "initial";
1132
+ }};
1133
+
1134
+ /* Hide Scrollbar */
1135
+ scrollbar-width: none; /* Firefox 64 */
1136
+ -ms-overflow-style: none; /* Internet Explorer 11 */
1137
+ ::-webkit-scrollbar { /** WebKit */
1138
+ display: none;
1139
+ }
1140
+ width: ${props => {
1141
+ if (props.width) {
1142
+ if (typeof props.width === "number") {
1143
+ return props.width + "px";
1144
+ }
1145
+ if (typeof props.width === "string") {
1146
+ return props.width;
1147
+ }
1148
+ }
1149
+ return "initial";
1150
+ }};
1151
+
1152
+ position: absolute;
1153
+ top: 25px;
1154
+ border-radius: 10px;
1155
+ min-width: 60px;
1156
+
1157
+ z-index: 9998;
1158
+ box-shadow: 0px 3px 5px 1px hsla(327, 94%, 10%, 0.7);
1159
+
1160
+ ul {
1161
+ margin: 0;
1162
+ padding: 0;
1163
+ list-style: none;
1164
+ }
1165
+
1166
+ ul li {
1167
+ box-sizing: border-box;
1168
+ padding: 0.3rem 0.6rem;
1169
+ user-select: none;
1170
+ cursor: pointer;
1171
+ min-height: 2rem;
1172
+ display: grid;
1173
+ align-items: center;
1174
+ word-break: break-all;
1175
+ justify-content: ${props => {
1176
+ if (props.left) {
1177
+ return "left";
1178
+ }
1179
+ return "right";
1180
+ }};
1181
+ }
1182
+
1183
+ ul li:hover {
1184
+ background: ${props => {
1185
+ if (props.level === 2) {
1186
+ return props.theme.backgroundColorSecondary;
1187
+ }
1188
+ return props.theme.backgroundColorTertiary;
1189
+ }};
1190
+ }
1191
+
1192
+ ul li:first-child {
1193
+ border-top-right-radius: 10px;
1194
+ border-top-left-radius: 10px;
1195
+ }
1196
+
1197
+ ul li:last-child {
1198
+ border-bottom-right-radius: 10px;
1199
+ border-bottom-left-radius: 10px;
1200
+ }
1201
+ `;
1202
+
1203
+ const StyledFilterable = styled__default["default"].div`
1204
+ position: relative;
1205
+
1206
+ input {
1207
+ text-align: ${props => {
1208
+ if (props.left) {
1209
+ return "left !important";
1210
+ }
1211
+ return "right !important";
1212
+ }};
1213
+ }
1214
+ `;
1215
+
1216
+ const StyledFilterUpdate = styled__default["default"].div`
1217
+ position: absolute;
1218
+ z-index: 9999;
1219
+ top: 0;
1220
+ left: ${props => {
1221
+ if (props.left) {
1222
+ return "auto";
1223
+ }
1224
+ return "0";
1225
+ }};
1226
+ right: ${props => {
1227
+ if (props.left) {
1228
+ return "0";
1229
+ }
1230
+ return "auto";
1231
+ }};
1232
+ `;
1233
+
1234
+ const Dropdown = properties => {
1235
+ const {selected: selected, selectables: selectables, atSelect: atSelect, left: left, kind: kind, dropdownToggled: dropdownToggled, hideAtSelect: hideAtSelect, selectAtHover: selectAtHover, selectedColor: selectedColor, filterable: filterable, style: style, className: className, theme: themeProperty, generalTheme: generalThemeProperty, interactionTheme: interactionThemeProperty, level: level, heightItems: heightItems, width: width, setDropdownToggled: setDropdownToggled, filterUpdate: filterUpdate} = properties;
1236
+ const _generalTheme = generalThemeProperty === undefined ? themeProperty === undefined ? themes.plurid : themeProperty : generalThemeProperty;
1237
+ const _interactionTheme = interactionThemeProperty === undefined ? themeProperty === undefined ? themes.plurid : themeProperty : interactionThemeProperty;
1238
+ const _level = level !== null && level !== void 0 ? level : 0;
1239
+ const _hideAtSelect = hideAtSelect !== null && hideAtSelect !== void 0 ? hideAtSelect : true;
1240
+ const _selectAtHover = selectAtHover !== null && selectAtHover !== void 0 ? selectAtHover : false;
1241
+ const isMounted = React.useRef(true);
1242
+ const filterInput = React.useRef(null);
1243
+ const [generalTheme, setGeneralTheme] = React.useState(_generalTheme);
1244
+ const [interactionTheme, setInteractionTheme] = React.useState(_interactionTheme);
1245
+ const [showList, setShowList] = React.useState(false);
1246
+ const [selectedBackgroundColor, setSelectedBackgroundColor] = React.useState(interactionTheme.backgroundColorTertiary);
1247
+ const [filterValue, setFilterValue] = React.useState("");
1248
+ const [filteredSelectables, setFilteredSelectables] = React.useState([ ...selectables ]);
1249
+ const [showFilterUpdate, setShowFilterUpdate] = React.useState(!!filterUpdate);
1250
+ const [arrowIndex, setArrowIndex] = React.useState(-1);
1251
+ const select = selected => {
1252
+ kind ? atSelect(selected, kind) : atSelect(selected);
1253
+ };
1254
+ const handleSelect = selected => {
1255
+ select(selected);
1256
+ if (_hideAtSelect) {
1257
+ setShowList(false);
1258
+ }
1259
+ };
1260
+ const handleHover = selected => {
1261
+ if (_selectAtHover) {
1262
+ select(selected);
1263
+ }
1264
+ };
1265
+ const handleFiltering = event => {
1266
+ const {value: value} = event.target;
1267
+ const filterValue = value.toLowerCase();
1268
+ const filteredSelectables = selectables.filter((selectable => {
1269
+ if (typeof selectable === "string") {
1270
+ const filterSelectable = selectable.toLowerCase();
1271
+ if (selectable.toLowerCase().startsWith(filterValue)) {
1272
+ return true;
1273
+ }
1274
+ const split = filterSelectable.split(" ");
1275
+ for (const element of split) {
1276
+ if (element.startsWith(filterValue)) {
1277
+ return true;
1278
+ }
1279
+ }
1280
+ return false;
1281
+ }
1282
+ const filterSelectable = selectable.value.toLowerCase();
1283
+ if (filterSelectable.startsWith(filterValue)) {
1284
+ return true;
1285
+ }
1286
+ const split = filterSelectable.split(" ");
1287
+ for (const element of split) {
1288
+ if (element.startsWith(filterValue)) {
1289
+ return true;
1290
+ }
1291
+ }
1292
+ return false;
1293
+ }));
1294
+ setFilterValue(value);
1295
+ setFilteredSelectables(filteredSelectables);
1296
+ itemsReferences.current = filteredSelectables.reduce(((accumulator, _, index) => {
1297
+ accumulator[index] = React__default["default"].createRef();
1298
+ return accumulator;
1299
+ }), {});
1300
+ };
1301
+ const focusFilterInput = () => {
1302
+ setTimeout((() => {
1303
+ if (filterInput.current) {
1304
+ filterInput.current.focus();
1305
+ }
1306
+ }), 100);
1307
+ };
1308
+ const itemsReferences = React.useRef(filteredSelectables.reduce(((accumulator, _, index) => {
1309
+ accumulator[index] = React__default["default"].createRef();
1310
+ return accumulator;
1311
+ }), {}));
1312
+ React.useEffect((() => {
1313
+ if (!dropdownToggled) {
1314
+ setShowList(false);
1315
+ }
1316
+ }), [ dropdownToggled ]);
1317
+ React.useEffect((() => {
1318
+ if (_level === 2) {
1319
+ setSelectedBackgroundColor(interactionTheme.backgroundColorSecondary);
1320
+ } else {
1321
+ setSelectedBackgroundColor(interactionTheme.backgroundColorTertiary);
1322
+ }
1323
+ }), [ _level, interactionTheme ]);
1324
+ React.useEffect((() => {
1325
+ const generalTheme = generalThemeProperty === undefined ? themeProperty === undefined ? themes.plurid : themeProperty : generalThemeProperty;
1326
+ const interactionTheme = interactionThemeProperty === undefined ? themeProperty === undefined ? themes.plurid : themeProperty : interactionThemeProperty;
1327
+ setGeneralTheme(generalTheme);
1328
+ setInteractionTheme(interactionTheme);
1329
+ }), [ themeProperty, generalThemeProperty, interactionThemeProperty ]);
1330
+ React.useEffect((() => {
1331
+ const scrollTo = index => {
1332
+ console.log(itemsReferences.current[index].current);
1333
+ if (itemsReferences.current[index].current) {
1334
+ itemsReferences.current[index].current.scrollIntoView({
1335
+ behavior: "smooth",
1336
+ block: "start"
1337
+ });
1338
+ }
1339
+ };
1340
+ const handleArrows = event => {
1341
+ if (event.key === "ArrowUp") {
1342
+ const newIndex = arrowIndex - 1;
1343
+ if (newIndex >= 0) {
1344
+ setArrowIndex(newIndex);
1345
+ scrollTo(newIndex);
1346
+ }
1347
+ }
1348
+ if (event.key === "ArrowDown") {
1349
+ const newIndex = arrowIndex + 1;
1350
+ if (newIndex < filteredSelectables.length) {
1351
+ setArrowIndex(newIndex);
1352
+ scrollTo(newIndex);
1353
+ }
1354
+ }
1355
+ if (event.key === "Enter") {
1356
+ const selected = filteredSelectables[arrowIndex];
1357
+ if (selected) {
1358
+ atSelect(selected);
1359
+ setArrowIndex(-1);
1360
+ if (_hideAtSelect) {
1361
+ setShowList(false);
1362
+ }
1363
+ }
1364
+ }
1365
+ };
1366
+ const handleScroll = () => {
1367
+ setArrowIndex(-1);
1368
+ };
1369
+ if (showList) {
1370
+ window.addEventListener("keydown", handleArrows);
1371
+ window.addEventListener("wheel", handleScroll);
1372
+ } else {
1373
+ setArrowIndex(-1);
1374
+ }
1375
+ return () => {
1376
+ if (showList) {
1377
+ window.removeEventListener("keydown", handleArrows);
1378
+ window.removeEventListener("wheel", handleScroll);
1379
+ }
1380
+ };
1381
+ }), [ arrowIndex, showList ]);
1382
+ React.useEffect((() => () => {
1383
+ isMounted.current = false;
1384
+ }), []);
1385
+ React.useEffect((() => {
1386
+ setFilteredSelectables([ ...selectables ]);
1387
+ }), [ selectables.length ]);
1388
+ return React__default["default"].createElement(StyledDropdown, {
1389
+ theme: interactionTheme,
1390
+ left: left,
1391
+ style: Object.assign({}, style),
1392
+ className: className
1393
+ }, React__default["default"].createElement(StyledDropdownSelected, {
1394
+ onClick: () => {
1395
+ setShowList(!showList);
1396
+ if (setDropdownToggled) {
1397
+ setDropdownToggled(kind);
1398
+ }
1399
+ if (!showList && filterable) {
1400
+ focusFilterInput();
1401
+ }
1402
+ },
1403
+ theme: generalTheme,
1404
+ selectedColor: selectedColor
1405
+ }, typeof selected === "string" ? selected : selected.value), showList && React__default["default"].createElement(StyledDropdownList, {
1406
+ theme: interactionTheme,
1407
+ left: left,
1408
+ level: _level,
1409
+ heightItems: heightItems && filterable && filteredSelectables.length < heightItems ? filteredSelectables.length + 1 : heightItems,
1410
+ width: width
1411
+ }, React__default["default"].createElement("ul", null, filterable && React__default["default"].createElement("li", {
1412
+ style: {
1413
+ backgroundColor: interactionTheme.backgroundColorTertiary,
1414
+ boxShadow: interactionTheme.boxShadowPenumbraInset
1415
+ }
1416
+ }, React__default["default"].createElement(StyledFilterable, {
1417
+ left: left
1418
+ }, filterUpdate && showFilterUpdate && React__default["default"].createElement(StyledFilterUpdate, {
1419
+ left: left
1420
+ }, React__default["default"].createElement(pluridIconsReact.PluridIconReset, {
1421
+ theme: interactionTheme,
1422
+ atClick: () => {
1423
+ setShowFilterUpdate(false);
1424
+ filterUpdate();
1425
+ setTimeout((() => {
1426
+ if (!isMounted.current) {
1427
+ return;
1428
+ }
1429
+ setShowFilterUpdate(true);
1430
+ }), 5300);
1431
+ }
1432
+ })), React__default["default"].createElement(Textline, {
1433
+ ref: filterInput,
1434
+ theme: interactionTheme,
1435
+ text: filterValue,
1436
+ atChange: handleFiltering,
1437
+ devisible: true,
1438
+ spellCheck: false,
1439
+ autoCapitalize: "false",
1440
+ autoComplete: "false",
1441
+ autoCorrect: "false",
1442
+ style: {
1443
+ padding: !!filterUpdate ? left ? "0 1.3rem 0 0" : "0 0 0 1.3rem" : "0"
1444
+ }
1445
+ }))), filteredSelectables.map(((selectable, index) => {
1446
+ let selectableID = typeof selectable === "string" ? selectable : selectable.id;
1447
+ let selectableValue = typeof selectable === "string" ? selectable : selectable.value;
1448
+ let isSelected = false;
1449
+ if (typeof selected === "string") {
1450
+ if (selected === selectableID) {
1451
+ isSelected = true;
1452
+ }
1453
+ } else {
1454
+ if (selected.id === selectableID) {
1455
+ isSelected = true;
1456
+ }
1457
+ }
1458
+ if (arrowIndex === index) {
1459
+ isSelected = true;
1460
+ }
1461
+ return React__default["default"].createElement("li", {
1462
+ ref: itemsReferences.current[index],
1463
+ key: selectableID,
1464
+ onClick: () => handleSelect(selectable),
1465
+ onMouseEnter: () => handleHover(selectable),
1466
+ style: {
1467
+ backgroundColor: isSelected ? selectedBackgroundColor : ""
1468
+ }
1469
+ }, selectableValue);
1470
+ })))));
1471
+ };
1472
+
1473
+ const StyledInputDescriptor = styled__default["default"].div`
1474
+ text-align: left;
1475
+ font-size: 0.9rem;
1476
+ min-height: 1.1rem;
1477
+ margin-top: 1.3rem;
1478
+ margin-bottom: 0.4rem;
1479
+ margin-left: 0.9rem;
1480
+
1481
+ font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
1482
+ color: ${({theme: theme}) => theme.colorPrimary};
1483
+ `;
1484
+
1485
+ const InputDescriptor = properties => {
1486
+ const {name: name, show: show, theme: theme} = properties;
1487
+ return React__default["default"].createElement(StyledInputDescriptor, {
1488
+ theme: theme
1489
+ }, show && React__default["default"].createElement(React__default["default"].Fragment, null, name));
1490
+ };
1491
+
1492
+ const StyledInputBox = styled__default["default"].div`
1493
+ textarea {
1494
+ box-sizing: border-box;
1495
+ width: 100%;
1496
+ min-height: 5rem;
1497
+ resize: vertical;
1498
+ outline: none;
1499
+ border: none;
1500
+ padding: 0.9rem;
1501
+ font-size: 0.8rem;
1502
+ border-radius: 0.9rem;
1503
+ line-height: 1.5;
1504
+
1505
+ font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
1506
+ color: ${({theme: theme}) => theme.colorPrimary};
1507
+ background-color: ${({theme: theme}) => theme.backgroundColorTertiary};
1508
+ box-shadow: inset 0px 4px 4px ${({theme: theme}) => theme.boxShadowUmbraColor};
1509
+ }
1510
+ `;
1511
+
1512
+ const StyledTextBox = styled__default["default"].div`
1513
+ `;
1514
+
1515
+ const InputBox = properties => {
1516
+ const {text: text, name: name, atChange: atChange, theme: themeProperty, style: style, className: className, atKeyDown: atKeyDown} = properties;
1517
+ const theme = themeProperty || themes.plurid;
1518
+ return React__default["default"].createElement(StyledInputBox, {
1519
+ theme: theme,
1520
+ className: className,
1521
+ style: Object.assign({}, style)
1522
+ }, React__default["default"].createElement(InputDescriptor, {
1523
+ name: name,
1524
+ show: text !== "",
1525
+ theme: theme
1526
+ }), React__default["default"].createElement(StyledTextBox, {
1527
+ theme: theme
1528
+ }, React__default["default"].createElement("textarea", {
1529
+ value: text,
1530
+ placeholder: name,
1531
+ onChange: event => atChange(event),
1532
+ onKeyDown: event => atKeyDown ? atKeyDown(event) : null,
1533
+ spellCheck: false,
1534
+ autoCapitalize: "false",
1535
+ autoComplete: "false",
1536
+ autoCorrect: "false"
1537
+ })));
1538
+ };
1539
+
1540
+ const StyledInputLine = styled__default["default"].div`
1541
+ width: 350px;
1542
+ `;
1543
+
1544
+ const InputLine = properties => {
1545
+ const {name: name, text: text, atChange: atChange, theme: themeProperty, type: type, error: error, textline: textline, style: style, className: className, atKeyDown: atKeyDown} = properties;
1546
+ const theme = themeProperty || themes.plurid;
1547
+ return React__default["default"].createElement(StyledInputLine, {
1548
+ theme: theme,
1549
+ style: Object.assign({}, style),
1550
+ className: className
1551
+ }, React__default["default"].createElement(InputDescriptor, {
1552
+ name: name,
1553
+ show: text !== "",
1554
+ theme: theme
1555
+ }), React__default["default"].createElement(Textline, Object.assign({
1556
+ text: text,
1557
+ type: type,
1558
+ placeholder: name,
1559
+ theme: theme,
1560
+ level: 2,
1561
+ error: error,
1562
+ spellCheck: false,
1563
+ autoCapitalize: "false",
1564
+ autoComplete: "false",
1565
+ autoCorrect: "false",
1566
+ atChange: atChange,
1567
+ atKeyDown: atKeyDown
1568
+ }, textline)));
1569
+ };
1570
+
1571
+ const StyledSwitch = styled__default["default"].label`
1572
+ position: relative;
1573
+ display: inline-block;
1574
+ width: 60px;
1575
+ height: 34px;
1576
+
1577
+ input {
1578
+ opacity: 0;
1579
+ width: 0;
1580
+ height: 0;
1581
+ }
1582
+ `;
1583
+
1584
+ const StyledSwitchSlider = styled__default["default"].span`
1585
+ position: absolute;
1586
+ cursor: pointer;
1587
+ top: 0;
1588
+ left: 0;
1589
+ right: 0;
1590
+ bottom: 0;
1591
+ transition: .4s ease-in-out;
1592
+ box-shadow: inset 0 2px 3px black;
1593
+
1594
+ background-color: ${props => {
1595
+ if (props.accent) {
1596
+ return props.accent;
1597
+ }
1598
+ if (props.exclusive && !props.checked) {
1599
+ switch (props.level) {
1600
+ case 0:
1601
+ return props.theme.backgroundColorPrimaryAlpha;
1602
+
1603
+ case 1:
1604
+ return props.theme.backgroundColorSecondaryAlpha;
1605
+
1606
+ case 2:
1607
+ return props.theme.backgroundColorTertiaryAlpha;
1608
+
1609
+ case 3:
1610
+ return props.theme.backgroundColorQuaternaryAlpha;
1611
+
1612
+ default:
1613
+ return props.theme.backgroundColorPrimaryAlpha;
1614
+ }
1615
+ }
1616
+ switch (props.level) {
1617
+ case 0:
1618
+ return props.theme.backgroundColorPrimary;
1619
+
1620
+ case 1:
1621
+ return props.theme.backgroundColorSecondary;
1622
+
1623
+ case 2:
1624
+ return props.theme.backgroundColorTertiary;
1625
+
1626
+ case 3:
1627
+ return props.theme.backgroundColorQuaternary;
1628
+
1629
+ default:
1630
+ return props.theme.backgroundColorPrimary;
1631
+ }
1632
+ }};
1633
+ border-radius: ${props => {
1634
+ if (props.round) {
1635
+ return "34px";
1636
+ }
1637
+ return "0";
1638
+ }};
1639
+
1640
+ :before {
1641
+ position: absolute;
1642
+ content: "";
1643
+ height: 26px;
1644
+ width: 26px;
1645
+ left: 4px;
1646
+ bottom: 4px;
1647
+ transition: .4s;
1648
+
1649
+ background-color: ${props => props.theme.colorPrimary};
1650
+ border-radius: ${props => {
1651
+ if (props.round) {
1652
+ return "50%";
1653
+ }
1654
+ return "0";
1655
+ }};
1656
+ transform: ${props => {
1657
+ if (props.checked) {
1658
+ return "translateX(26px)";
1659
+ }
1660
+ return "translateX(0px)";
1661
+ }};
1662
+ }
1663
+ `;
1664
+
1665
+ const Switch = properties => {
1666
+ const {checked: checked, theme: theme, level: level, round: round, exclusive: exclusive, accent: accent, atChange: atChange} = properties;
1667
+ const _theme = theme || themes.plurid;
1668
+ const _level = level === undefined ? 0 : level;
1669
+ const _round = round === undefined ? true : round;
1670
+ return React__default["default"].createElement(StyledSwitch, {
1671
+ theme: _theme
1672
+ }, React__default["default"].createElement("input", {
1673
+ type: "checkbox",
1674
+ checked: checked,
1675
+ onChange: () => atChange()
1676
+ }), React__default["default"].createElement(StyledSwitchSlider, {
1677
+ theme: _theme,
1678
+ level: _level,
1679
+ round: _round,
1680
+ exclusive: exclusive,
1681
+ checked: checked,
1682
+ accent: accent
1683
+ }));
1684
+ };
1685
+
1686
+ const StyledInputSwitch = styled__default["default"].div`
1687
+ font-size: 0.9rem;
1688
+
1689
+ margin-top: ${({compact: compact}) => {
1690
+ if (compact) {
1691
+ return "1rem";
1692
+ }
1693
+ return "2.2rem";
1694
+ }};
1695
+ `;
1696
+
1697
+ const InputSwitch = properties => {
1698
+ const {name: name, checked: checked, atChange: atChange, theme: theme, compact: compact} = properties;
1699
+ return React__default["default"].createElement(StyledInputSwitch, {
1700
+ compact: compact
1701
+ }, React__default["default"].createElement(FormLeftRight, null, React__default["default"].createElement("div", {
1702
+ style: {
1703
+ marginLeft: "0.9rem"
1704
+ }
1705
+ }, name), React__default["default"].createElement(Switch, {
1706
+ checked: checked,
1707
+ level: 2,
1708
+ exclusive: true,
1709
+ theme: theme,
1710
+ atChange: () => atChange()
1711
+ })));
1712
+ };
1713
+
1714
+ const StyledItemsline = styled__default["default"].div`
1715
+ padding: 0 0.7rem;
1716
+ font-size: 0.9rem;
1717
+
1718
+ ul {
1719
+ list-style: none;
1720
+ padding: 0;
1721
+ margin-top: 0.4rem;
1722
+ margin-bottom: 0.8rem;
1723
+ display: flex;
1724
+ flex-wrap: wrap;
1725
+ justify-content: flex-start;
1726
+ flex-direction: ${props => {
1727
+ if (props.left) {
1728
+ return "row";
1729
+ }
1730
+ return "row-reverse";
1731
+ }};
1732
+ }
1733
+
1734
+ li {
1735
+ margin: 0 0.3rem;
1736
+ cursor: pointer;
1737
+ user-select: none;
1738
+ line-height: 1.2rem;
1739
+
1740
+ :hover {
1741
+ text-decoration: line-through;
1742
+ }
1743
+ }
1744
+ `;
1745
+
1746
+ const Itemsline = properties => {
1747
+ const {items: items, removeItem: removeItem, theme: theme, level: level, left: left, style: style, className: className} = properties;
1748
+ const _theme = theme === undefined ? themes__default["default"].plurid : theme;
1749
+ const _level = level === undefined ? 0 : level;
1750
+ const _left = left === undefined ? false : left;
1751
+ return React__default["default"].createElement(StyledItemsline, {
1752
+ style: Object.assign({}, style),
1753
+ className: className,
1754
+ theme: _theme,
1755
+ level: _level,
1756
+ left: _left
1757
+ }, items.length > 0 && React__default["default"].createElement("ul", null, items.map((item => React__default["default"].createElement("li", {
1758
+ key: item + Math.random(),
1759
+ onClick: () => removeItem(item)
1760
+ }, item)))));
1761
+ };
1762
+
1763
+ const StyledSelect = styled__default["default"].div`
1764
+ `;
1765
+
1766
+ const PluridSelect = properties => {
1767
+ const {selectables: selectables, atChange: atChange, theme: theme, level: level, devisible: devisible, round: round, width: width} = properties;
1768
+ const _theme = theme || themes.plurid;
1769
+ const _level = level !== null && level !== void 0 ? level : 0;
1770
+ const _round = round !== null && round !== void 0 ? round : true;
1771
+ return React__default["default"].createElement(StyledSelect, {
1772
+ theme: _theme,
1773
+ level: _level,
1774
+ devisible: devisible,
1775
+ round: _round,
1776
+ width: width
1777
+ }, React__default["default"].createElement("select", null, selectables.map((selectable => React__default["default"].createElement("option", {
1778
+ key: selectable,
1779
+ value: selectable
1780
+ }, selectable)))));
1781
+ };
1782
+
1783
+ const StyledSlider = styled__default["default"].div`
1784
+ display: grid;
1785
+ align-items: center;
1786
+ font-family: ${props => props.theme.fontFamilySansSerif};
1787
+ grid-template-columns: 1fr;
1788
+ grid-template-rows: auto;
1789
+
1790
+ width: ${props => {
1791
+ if (props.width) {
1792
+ if (typeof props.width === "string") {
1793
+ return props.width;
1794
+ }
1795
+ return props.width + "px";
1796
+ }
1797
+ return "100px";
1798
+ }};
1799
+ `;
1800
+
1801
+ const StyledNamedValue = styled__default["default"].div`
1802
+ display: flex;
1803
+ align-items: center;
1804
+ justify-content: space-between;
1805
+ font-size: 0.8rem;
1806
+ line-height: 16px;
1807
+ user-select: none;
1808
+ `;
1809
+
1810
+ const StyledSliderValue = styled__default["default"].div`
1811
+ user-select: none;
1812
+ font-size: 0.8rem;
1813
+ min-width: 1.6rem;
1814
+ text-align: right;
1815
+ `;
1816
+
1817
+ const StyledSliderInputContainer = styled__default["default"].div`
1818
+ width: ${props => {
1819
+ if (props.width) {
1820
+ if (typeof props.width === "string") {
1821
+ return props.width;
1822
+ }
1823
+ return props.width + "px";
1824
+ }
1825
+ return "100px";
1826
+ }};
1827
+
1828
+ /*
1829
+ article: https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
1830
+ tool: http://danielstern.ca/range.css/
1831
+ */
1832
+ input[type=range] {
1833
+ -webkit-appearance: none;
1834
+ width: 100%;
1835
+ margin: 2px 0;
1836
+ padding: 10px 0;
1837
+ background: transparent;
1838
+ cursor: pointer;
1839
+ }
1840
+
1841
+ input[type=range]:focus {
1842
+ outline: none;
1843
+ }
1844
+
1845
+ input[type=range]::-webkit-slider-runnable-track {
1846
+ width: 100%;
1847
+ height: 2px;
1848
+ cursor: pointer;
1849
+ background: ${props => props.theme.colorPrimary};
1850
+ border-radius: 0px;
1851
+ }
1852
+
1853
+ input[type=range]::-webkit-slider-thumb {
1854
+ border: 2px solid ${props => props.theme.colorPrimary};
1855
+ height: ${props => {
1856
+ switch (props.thumbSize) {
1857
+ case "small":
1858
+ return "14px";
1859
+
1860
+ case "normal":
1861
+ return "20px";
1862
+
1863
+ case "large":
1864
+ return "26px";
1865
+
1866
+ default:
1867
+ return "26px";
1868
+ }
1869
+ }};
1870
+ width: ${props => {
1871
+ switch (props.thumbSize) {
1872
+ case "small":
1873
+ return "14px";
1874
+
1875
+ case "normal":
1876
+ return "20px";
1877
+
1878
+ case "large":
1879
+ return "26px";
1880
+
1881
+ default:
1882
+ return "26px";
1883
+ }
1884
+ }};
1885
+ background: ${props => {
1886
+ if (props.hovered) {
1887
+ return props.theme.colorPrimary;
1888
+ }
1889
+ switch (props.level) {
1890
+ case 0:
1891
+ return props.theme.backgroundColorPrimary;
1892
+
1893
+ case 1:
1894
+ return props.theme.backgroundColorSecondary;
1895
+
1896
+ case 2:
1897
+ return props.theme.backgroundColorTertiary;
1898
+
1899
+ case 3:
1900
+ return props.theme.backgroundColorQuaternary;
1901
+
1902
+ default:
1903
+ return props.theme.backgroundColorPrimary;
1904
+ }
1905
+ }};
1906
+ margin-top: ${props => {
1907
+ switch (props.thumbSize) {
1908
+ case "small":
1909
+ return "-6px";
1910
+
1911
+ case "normal":
1912
+ return "-9px";
1913
+
1914
+ case "large":
1915
+ return "-12px";
1916
+
1917
+ default:
1918
+ return "-12px";
1919
+ }
1920
+ }};
1921
+ border-radius: 50px;
1922
+ cursor: pointer;
1923
+ -webkit-appearance: none;
1924
+ }
1925
+
1926
+ input[type=range]:focus::-webkit-slider-runnable-track {
1927
+ background: ${props => props.theme.colorPrimary};
1928
+ }
1929
+
1930
+ input[type=range]::-moz-range-track {
1931
+ width: 100%;
1932
+ height: 2px;
1933
+ cursor: pointer;
1934
+ background: ${props => props.theme.colorPrimary};
1935
+ border-radius: 0px;
1936
+ }
1937
+
1938
+ input[type=range]::-moz-range-thumb {
1939
+ border: 2px solid ${props => props.theme.colorPrimary};
1940
+ height: 15px;
1941
+ width: 15px;
1942
+ border-radius: 50px;
1943
+ background: ${props => {
1944
+ if (props.hovered) {
1945
+ return props.theme.colorPrimary;
1946
+ }
1947
+ return props.theme.backgroundColorTertiary;
1948
+ }};
1949
+ cursor: pointer;
1950
+ }
1951
+
1952
+ input[type=range]::-ms-track {
1953
+ width: 100%;
1954
+ height: 2px;
1955
+ cursor: pointer;
1956
+ background: transparent;
1957
+ border-color: transparent;
1958
+ color: transparent;
1959
+ }
1960
+
1961
+ input[type=range]::-ms-fill-lower {
1962
+ background: ${props => props.theme.colorPrimary};
1963
+ border-radius: 0px;
1964
+ }
1965
+
1966
+ input[type=range]::-ms-fill-upper {
1967
+ background: ${props => props.theme.colorPrimary};
1968
+ border-radius: 0px;
1969
+ }
1970
+
1971
+ input[type=range]::-ms-thumb {
1972
+ border: 2px solid ${props => props.theme.colorPrimary};
1973
+ height: 15px;
1974
+ width: 15px;
1975
+ border-radius: 50px;
1976
+ background: ${props => {
1977
+ if (props.hovered) {
1978
+ return props.theme.colorPrimary;
1979
+ }
1980
+ return props.theme.backgroundColorTertiary;
1981
+ }};
1982
+ cursor: pointer;
1983
+ height: 2px;
1984
+ }
1985
+
1986
+ input[type=range]:focus::-ms-fill-lower {
1987
+ background: ${props => props.theme.colorPrimary};
1988
+ }
1989
+
1990
+ input[type=range]:focus::-ms-fill-upper {
1991
+ background: ${props => props.theme.colorPrimary};
1992
+ }
1993
+ `;
1994
+
1995
+ const DEFAULT_VALUE = 0;
1996
+
1997
+ const DEFAULT_MIN = 0;
1998
+
1999
+ const DEFAULT_MAX = 100;
2000
+
2001
+ const DEFAULT_STEP = 1;
2002
+
2003
+ const DEFAULT_LEVEL = 0;
2004
+
2005
+ const DEFAULT_THUMB_SIZE = "large";
2006
+
2007
+ const Slider = properties => {
2008
+ const {value: value, atChange: atChange, defaultValue: defaultValue, min: min, max: max, step: step, name: name, theme: theme, level: level, thumbSize: thumbSize, width: width, valueSign: valueSign, namedValueAbove: namedValueAbove} = properties;
2009
+ const [mouseOver, setMouseOver] = React.useState(false);
2010
+ const _theme = theme || themes.plurid;
2011
+ const _level = level === undefined ? DEFAULT_LEVEL : level;
2012
+ const _thumbSize = thumbSize === undefined ? DEFAULT_THUMB_SIZE : thumbSize;
2013
+ const _step = step === undefined ? DEFAULT_STEP : step;
2014
+ const handleDoubleClick = () => {
2015
+ atChange(defaultValue || DEFAULT_VALUE);
2016
+ };
2017
+ const handleSliderInput = event => {
2018
+ atChange(parseFloat(event.target.value));
2019
+ };
2020
+ return React__default["default"].createElement(StyledSlider, {
2021
+ theme: _theme,
2022
+ width: width
2023
+ }, namedValueAbove && React__default["default"].createElement(StyledNamedValue, null, React__default["default"].createElement("div", null, name), React__default["default"].createElement(StyledSliderValue, {
2024
+ theme: _theme
2025
+ }, value, valueSign)), React__default["default"].createElement(StyledSliderInputContainer, {
2026
+ theme: _theme,
2027
+ hovered: mouseOver,
2028
+ thumbSize: _thumbSize,
2029
+ level: _level,
2030
+ width: width
2031
+ }, React__default["default"].createElement("input", {
2032
+ type: "range",
2033
+ min: min || DEFAULT_MIN,
2034
+ max: max || DEFAULT_MAX,
2035
+ name: name || "",
2036
+ value: value,
2037
+ step: _step,
2038
+ onMouseEnter: () => setMouseOver(true),
2039
+ onMouseLeave: () => setMouseOver(false),
2040
+ onMouseMove: () => mouseOver ? setMouseOver(true) : null,
2041
+ onChange: handleSliderInput,
2042
+ onDoubleClick: handleDoubleClick
2043
+ })));
2044
+ };
2045
+
2046
+ const inputs = {
2047
+ Dropdown: Dropdown,
2048
+ InputBox: InputBox,
2049
+ InputDescriptor: InputDescriptor,
2050
+ InputLine: InputLine,
2051
+ InputSwitch: InputSwitch,
2052
+ Itemsline: Itemsline,
2053
+ Select: PluridSelect,
2054
+ Slider: Slider,
2055
+ Switch: Switch,
2056
+ Textline: Textline
2057
+ };
2058
+
2059
+ const StyledHR = styled__default["default"].hr`
2060
+ outline: 0;
2061
+ border: 0;
2062
+ margin: 0.8rem auto;
2063
+ height: 1px;
2064
+
2065
+ background-color: ${({theme: theme}) => theme.colorPrimary};
2066
+ `;
2067
+
2068
+ const HR = properties => {
2069
+ const {theme: theme, style: style, className: className} = properties;
2070
+ const themeValue = theme || themes.plurid;
2071
+ return React__default["default"].createElement(StyledHR, {
2072
+ theme: themeValue,
2073
+ style: Object.assign({}, style),
2074
+ className: className
2075
+ });
2076
+ };
2077
+
2078
+ const StyledProgressCircle = styled__default["default"].div`
2079
+ height: 0;
2080
+ width: 0;
2081
+ transform: rotate(-90deg);
2082
+ transform-origin: 50% 50%;
2083
+ margin: 10px;
2084
+
2085
+ svg {
2086
+ transform: translateX(-50%) translateY(-50%);
2087
+ }
2088
+ `;
2089
+
2090
+ const ProgressCircle = properties => {
2091
+ const {progress: progress, size: size, radius: radius, stroke: stroke, theme: theme, style: style, className: className} = properties;
2092
+ const progressValue = pluridFunctions.mathematics.numbers.normalizeBetween(progress, 0, 100);
2093
+ const radiusValue = radius || 20;
2094
+ const diameter = radiusValue * 2;
2095
+ const strokeValue = stroke || 3;
2096
+ const normalizedRadius = radiusValue - strokeValue * 2;
2097
+ const circumference = normalizedRadius * 2 * Math.PI;
2098
+ const strokeDashoffset = circumference - progressValue / 100 * circumference;
2099
+ const themeValue = theme || themes.plurid;
2100
+ const sizeValue = size || "normal";
2101
+ return React__default["default"].createElement(StyledProgressCircle, {
2102
+ size: sizeValue,
2103
+ style: Object.assign({}, style),
2104
+ className: className
2105
+ }, React__default["default"].createElement("svg", {
2106
+ height: diameter,
2107
+ width: diameter
2108
+ }, React__default["default"].createElement("circle", {
2109
+ stroke: themeValue.backgroundColorPrimaryAlpha,
2110
+ fill: "transparent",
2111
+ strokeWidth: strokeValue,
2112
+ r: normalizedRadius,
2113
+ cx: radiusValue,
2114
+ cy: radiusValue
2115
+ }), React__default["default"].createElement("circle", {
2116
+ stroke: themeValue.colorPrimary,
2117
+ fill: "transparent",
2118
+ strokeWidth: strokeValue,
2119
+ strokeDasharray: circumference + " " + circumference,
2120
+ style: {
2121
+ strokeDashoffset: strokeDashoffset
2122
+ },
2123
+ r: normalizedRadius,
2124
+ cx: radiusValue,
2125
+ cy: radiusValue
2126
+ })));
2127
+ };
2128
+
2129
+ const StyledTooltip = styled__default["default"].span`
2130
+ position: relative;
2131
+ `;
2132
+
2133
+ const StyledTooltipString = styled__default["default"].span`
2134
+ `;
2135
+
2136
+ const StyledTooltipIcon = styled__default["default"].span`
2137
+ user-select: none;
2138
+ cursor: pointer;
2139
+
2140
+ display: inline-grid;
2141
+ margin: 0 5px;
2142
+ place-content: center;
2143
+ height: 20px;
2144
+ width: 20px;
2145
+ border-radius: 20px;
2146
+ font-size: 12px;
2147
+ line-height: 1.4;
2148
+ text-align: left;
2149
+
2150
+ font-family: ${props => props.theme.fontFamilySansSerif};
2151
+ color: ${props => props.theme.colorPrimary};
2152
+ background-color: ${props => props.theme.backgroundColorSecondary};
2153
+ `;
2154
+
2155
+ const StyledTooltipText = styled__default["default"].div`
2156
+ position: absolute;
2157
+ top: 30px;
2158
+ left: 50%;
2159
+ transform: translateX(-50%);
2160
+ border-radius: 2px;
2161
+ z-index: 999;
2162
+ padding: 20px;
2163
+ min-width: 150px;
2164
+ font-size: 12px;
2165
+ line-height: 1.3;
2166
+ text-align: left;
2167
+
2168
+ color: ${props => props.theme.colorPrimary};
2169
+ background-color: ${props => props.theme.backgroundColorSecondary};
2170
+ box-shadow: ${props => props.theme.boxShadowUmbra};
2171
+
2172
+ :before {
2173
+ content: '';
2174
+ position: absolute;
2175
+ top: -10px;
2176
+ left: 50%;
2177
+ transform: translateX(-50%);
2178
+ border-left: ${props => {
2179
+ if (props.indicator) {
2180
+ return "10px";
2181
+ }
2182
+ return "0";
2183
+ }} solid transparent;
2184
+ border-right: ${props => {
2185
+ if (props.indicator) {
2186
+ return "10px";
2187
+ }
2188
+ return "0";
2189
+ }} solid transparent;
2190
+ border-bottom: ${props => {
2191
+ if (props.indicator) {
2192
+ return "10px";
2193
+ }
2194
+ return "0";
2195
+ }} solid ${props => props.theme.backgroundColorSecondary};
2196
+ }
2197
+ `;
2198
+
2199
+ const Tooltip = properties => {
2200
+ const {tool: Tool, tip: Tip, indicator: indicatorProperty, icon: iconProperty, theme: themeProperty, style: style, className: className} = properties;
2201
+ const theme = themeProperty || themes.plurid;
2202
+ const indicator = indicatorProperty !== null && indicatorProperty !== void 0 ? indicatorProperty : true;
2203
+ const icon = iconProperty !== null && iconProperty !== void 0 ? iconProperty : true;
2204
+ const mounted = pluridFunctionsReact.useMounted();
2205
+ const hoverOutTimeout = React.useRef(null);
2206
+ const [mouseOver, setMouseOver] = React.useState(false);
2207
+ const [showTooltipText, setShowTooltipText] = React.useState(false);
2208
+ React.useEffect((() => {
2209
+ if (!mounted) {
2210
+ return;
2211
+ }
2212
+ if (mouseOver) {
2213
+ setShowTooltipText(true);
2214
+ }
2215
+ if (!mouseOver) {
2216
+ hoverOutTimeout.current = setTimeout((() => {
2217
+ if (!mounted) {
2218
+ return;
2219
+ }
2220
+ setShowTooltipText(false);
2221
+ }), 500);
2222
+ }
2223
+ return () => {
2224
+ if (hoverOutTimeout.current) {
2225
+ clearTimeout(hoverOutTimeout.current);
2226
+ }
2227
+ };
2228
+ }), [ mouseOver ]);
2229
+ const renderTool = React__default["default"].createElement(React__default["default"].Fragment, null, typeof Tool === "string" ? React__default["default"].createElement(React__default["default"].Fragment, null, Tool) : React__default["default"].createElement(Tool, null));
2230
+ return React__default["default"].createElement(StyledTooltip, {
2231
+ onMouseEnter: () => setMouseOver(true),
2232
+ onMouseLeave: () => setMouseOver(false),
2233
+ onMouseMove: () => !showTooltipText ? setMouseOver(true) : null,
2234
+ theme: theme,
2235
+ style: Object.assign({}, style),
2236
+ className: className
2237
+ }, icon && React__default["default"].createElement(StyledTooltipIcon, {
2238
+ theme: theme
2239
+ }, renderTool), !icon && React__default["default"].createElement(StyledTooltipString, null, renderTool), showTooltipText && React__default["default"].createElement(StyledTooltipText, {
2240
+ theme: theme,
2241
+ indicator: indicator
2242
+ }, typeof Tip === "string" ? React__default["default"].createElement(React__default["default"].Fragment, null, Tip) : React__default["default"].createElement(Tip, null)));
2243
+ };
2244
+
2245
+ const markers = {
2246
+ HR: HR,
2247
+ ProgressCircle: ProgressCircle,
2248
+ Spinner: Spinner,
2249
+ Tooltip: Tooltip
2250
+ };
2251
+
2252
+ const StyledHeading1 = styled__default["default"].h1`
2253
+ color: ${props => props.theme.colorPrimary};
2254
+ font-family: ${props => props.theme.fontFamilySansSerif};
2255
+ font-size: 2.2rem;
2256
+ margin: 1.4rem 0;
2257
+ `;
2258
+
2259
+ const StyledHeading2 = styled__default["default"].h2`
2260
+ color: ${props => props.theme.colorPrimary};
2261
+ font-family: ${props => props.theme.fontFamilySansSerif};
2262
+ font-size: 2rem;
2263
+ margin: 1.2rem 0;
2264
+ `;
2265
+
2266
+ const StyledHeading3 = styled__default["default"].h3`
2267
+ color: ${props => props.theme.colorPrimary};
2268
+ font-family: ${props => props.theme.fontFamilySansSerif};
2269
+ font-size: 1.8rem;
2270
+ margin: 1rem 0;
2271
+ `;
2272
+
2273
+ const StyledHeading4 = styled__default["default"].h4`
2274
+ color: ${props => props.theme.colorPrimary};
2275
+ font-family: ${props => props.theme.fontFamilySansSerif};
2276
+ font-size: 1.6rem;
2277
+ margin: 1rem 0;
2278
+ `;
2279
+
2280
+ const StyledHeading5 = styled__default["default"].h5`
2281
+ color: ${props => props.theme.colorPrimary};
2282
+ font-family: ${props => props.theme.fontFamilySansSerif};
2283
+ font-size: 1.4rem;
2284
+ margin: 1rem 0;
2285
+ `;
2286
+
2287
+ const StyledHeading6 = styled__default["default"].h5`
2288
+ color: ${props => props.theme.colorPrimary};
2289
+ font-family: ${props => props.theme.fontFamilySansSerif};
2290
+ font-size: 1.2rem;
2291
+ margin: 1rem 0;
2292
+ `;
2293
+
2294
+ const Heading = properties => {
2295
+ const {children: children, theme: themeProperty, type: typeProperty, style: style, className: className} = properties;
2296
+ const theme = themeProperty || themes.plurid;
2297
+ const type = typeProperty || "h1";
2298
+ const renderProperties = {
2299
+ theme: theme,
2300
+ style: style,
2301
+ className: className
2302
+ };
2303
+ switch (type) {
2304
+ case "h1":
2305
+ return React__default["default"].createElement(StyledHeading1, Object.assign({}, renderProperties), children);
2306
+
2307
+ case "h2":
2308
+ return React__default["default"].createElement(StyledHeading2, Object.assign({}, renderProperties), children);
2309
+
2310
+ case "h3":
2311
+ return React__default["default"].createElement(StyledHeading3, Object.assign({}, renderProperties), children);
2312
+
2313
+ case "h4":
2314
+ return React__default["default"].createElement(StyledHeading4, Object.assign({}, renderProperties), children);
2315
+
2316
+ case "h5":
2317
+ return React__default["default"].createElement(StyledHeading5, Object.assign({}, renderProperties), children);
2318
+
2319
+ case "h6":
2320
+ return React__default["default"].createElement(StyledHeading6, Object.assign({}, renderProperties), children);
2321
+
2322
+ default:
2323
+ return React__default["default"].createElement(StyledHeading1, Object.assign({}, renderProperties), children);
2324
+ }
2325
+ };
2326
+
2327
+ const StyledParagraph = styled__default["default"].p`
2328
+ color: ${props => props.theme.colorPrimary};
2329
+ font-family: ${props => {
2330
+ switch (props.fontFamily) {
2331
+ case "sans-serif":
2332
+ return props.theme.fontFamilySansSerif;
2333
+
2334
+ case "serif":
2335
+ return props.theme.fontFamilySerif;
2336
+
2337
+ default:
2338
+ return props.fontFamily;
2339
+ }
2340
+ }};
2341
+ font-size: ${props => {
2342
+ switch (props.size) {
2343
+ case "small":
2344
+ return "0.8rem";
2345
+
2346
+ case "normal":
2347
+ return "1rem";
2348
+
2349
+ case "large":
2350
+ return "1.2rem";
2351
+
2352
+ default:
2353
+ return "1rem";
2354
+ }
2355
+ }};
2356
+
2357
+ margin: 1.2rem 0;
2358
+ line-height: 1.4;
2359
+ `;
2360
+
2361
+ const Paragraph = properties => {
2362
+ const {children: children, theme: themeProperty, size: sizeProperty, fontFamily: fontFamilyProperty, style: style, className: className} = properties;
2363
+ const theme = themeProperty || themes.plurid;
2364
+ const size = sizeProperty || "normal";
2365
+ const fontFamily = fontFamilyProperty || "sans-serif";
2366
+ return React__default["default"].createElement(StyledParagraph, {
2367
+ theme: theme,
2368
+ size: size,
2369
+ fontFamily: fontFamily,
2370
+ style: Object.assign({}, style),
2371
+ className: className
2372
+ }, children);
2373
+ };
2374
+
2375
+ const typography = {
2376
+ Heading: Heading,
2377
+ Paragraph: Paragraph
2378
+ };
2379
+
2380
+ const StyledCopyableLine = styled__default["default"].div`
2381
+ display: grid;
2382
+ align-items: center;
2383
+ grid-template-columns: 16px 1fr;
2384
+ grid-gap: 0.7rem;
2385
+ `;
2386
+
2387
+ const StyledData = styled__default["default"].div`
2388
+ user-select: all;
2389
+ `;
2390
+
2391
+ const CopyableLine = properties => {
2392
+ const {data: data, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
2393
+ const viewDataText = viewData || data;
2394
+ const copyMessageText = copyMessage !== null && copyMessage !== void 0 ? copyMessage : "copied";
2395
+ const copyMessageTimeValue = copyMessageTime || 2e3;
2396
+ const [showCopyMessage, setShowCopyMessage] = pluridFunctionsReact.useFalseAfterTimedTrue(copyMessageTimeValue);
2397
+ return React__default["default"].createElement(StyledCopyableLine, {
2398
+ style: Object.assign({}, style),
2399
+ className: className
2400
+ }, React__default["default"].createElement(pluridIconsReact.PluridIconCopy, {
2401
+ atClick: () => {
2402
+ pluridFunctions.clipboard.copy(data);
2403
+ setShowCopyMessage(true);
2404
+ }
2405
+ }), React__default["default"].createElement(StyledData, null, showCopyMessage ? React__default["default"].createElement(React__default["default"].Fragment, null, copyMessageText) : React__default["default"].createElement(React__default["default"].Fragment, null, viewDataText)));
2406
+ };
2407
+
2408
+ const StyledNewPageLink = styled__default["default"].a`
2409
+ `;
2410
+
2411
+ const NewPageLink = properties => {
2412
+ const {link: link, text: text, style: style, className: className} = properties;
2413
+ return React__default["default"].createElement(StyledNewPageLink, {
2414
+ href: link,
2415
+ target: "_blank",
2416
+ rel: "noopener noreferrer",
2417
+ style: Object.assign({}, style),
2418
+ className: className
2419
+ }, text);
2420
+ };
2421
+
2422
+ const StyledScrollableLine = styled__default["default"].div`
2423
+ text-align: left;
2424
+ overflow: scroll;
2425
+ outline: none;
2426
+ white-space: nowrap;
2427
+
2428
+ -ms-overflow-style: none; /* Internet Explorer 10+ */
2429
+ scrollbar-width: none; /* Firefox */
2430
+ ::-webkit-scrollbar {
2431
+ display: none; /* Safari and Chrome */
2432
+ }
2433
+ `;
2434
+
2435
+ const ScrollableLine = properties => {
2436
+ const {text: text, style: style, className: className} = properties;
2437
+ return React__default["default"].createElement(StyledScrollableLine, {
2438
+ style: Object.assign({}, style),
2439
+ className: className
2440
+ }, text);
2441
+ };
2442
+
2443
+ const StyledTextItem = styled__default["default"].div`
2444
+ display: flex;
2445
+ align-items: center;
2446
+ margin-right: 2rem;
2447
+ `;
2448
+
2449
+ const TextItem = properties => {
2450
+ const {name: name, render: render, icon: IconProperty} = properties;
2451
+ const Icon = IconProperty || pluridIconsReact.PluridIconInfo;
2452
+ return React__default["default"].createElement(StyledTextItem, null, React__default["default"].createElement(Icon, {
2453
+ title: name,
2454
+ inactive: true,
2455
+ style: {
2456
+ marginRight: "0.5rem"
2457
+ }
2458
+ }), render);
2459
+ };
2460
+
2461
+ const varia = {
2462
+ CopyableLine: CopyableLine,
2463
+ NewPageLink: NewPageLink,
2464
+ ScrollableLine: ScrollableLine,
2465
+ TextItem: TextItem
2466
+ };
2467
+
2468
+ const universal = {
2469
+ buttons: buttons,
2470
+ form: form,
2471
+ general: general,
2472
+ inputs: inputs,
2473
+ markers: markers,
2474
+ typography: typography,
2475
+ varia: varia
2476
+ };
2477
+
2478
+ const translateUp = styled.keyframes`
2479
+ from {
2480
+ transform: translateY(2000px);
2481
+ }
2482
+ to {
2483
+ transform: translateY(0);
2484
+ }
2485
+ `;
2486
+
2487
+ const StyledNotification = styled__default["default"].div`
2488
+ display: grid;
2489
+ align-items: center;
2490
+ position: relative;
2491
+ min-height: 60px;
2492
+ width: 260px;
2493
+ margin: 10px 20px;
2494
+ border-radius: 10px;
2495
+ pointer-events: all;
2496
+ background-color: ${props => props.theme.backgroundColorSecondary};
2497
+ color: ${props => props.theme.colorPrimary};
2498
+ box-shadow: ${props => props.theme.boxShadowUmbra};
2499
+ animation: ${translateUp} 750ms ease-in-out forwards;
2500
+
2501
+ a {
2502
+ text-decoration: none;
2503
+ color: ${props => props.theme.colorSecondary};
2504
+ }
2505
+ `;
2506
+
2507
+ const StyledNotificationContent = styled__default["default"].div`
2508
+ font-size: 0.9rem;
2509
+ padding: 32px 16px;
2510
+ word-break: break-all;
2511
+ `;
2512
+
2513
+ const StyledNotificationClose = styled__default["default"].div`
2514
+ position: absolute;
2515
+ top: 8px;
2516
+ right: 8px;
2517
+ user-select: none;
2518
+ cursor: pointer;
2519
+ width: 20px;
2520
+ height: 20px;
2521
+ display: grid;
2522
+ place-content: center;
2523
+ `;
2524
+
2525
+ const Notification = properties => {
2526
+ const {data: data, theme: theme, remove: remove, elements: elements, style: style, className: className} = properties;
2527
+ const {id: id, text: text, html: html, react: react, timeout: timeout} = data;
2528
+ const notificationTimeout = React.useRef(null);
2529
+ React.useEffect((() => {
2530
+ if (timeout) {
2531
+ notificationTimeout.current = setTimeout((() => {
2532
+ remove({
2533
+ id: id
2534
+ });
2535
+ }), timeout);
2536
+ }
2537
+ return () => {
2538
+ if (notificationTimeout.current) {
2539
+ clearTimeout(notificationTimeout.current);
2540
+ }
2541
+ };
2542
+ }), [ id, timeout, remove ]);
2543
+ const content = html ? React__default["default"].createElement(StyledNotificationContent, {
2544
+ dangerouslySetInnerHTML: pluridFunctionsReact.createMarkup(text)
2545
+ }) : react && elements && elements[text] ? React__default["default"].createElement(StyledNotificationContent, null, elements[text]) : React__default["default"].createElement(StyledNotificationContent, null, text);
2546
+ return React__default["default"].createElement(StyledNotification, {
2547
+ theme: theme,
2548
+ style: Object.assign({}, style),
2549
+ className: className
2550
+ }, content, React__default["default"].createElement(StyledNotificationClose, null, React__default["default"].createElement(pluridIconsReact.PluridIconDelete, {
2551
+ atClick: () => remove({
2552
+ id: id
2553
+ })
2554
+ })));
2555
+ };
2556
+
2557
+ const StyledNotifications = styled__default["default"].div`
2558
+ position: absolute;
2559
+ bottom: 0;
2560
+ top: 0;
2561
+ right: 0;
2562
+ width: 300px;
2563
+ display: flex;
2564
+ flex-direction: column-reverse;
2565
+ z-index: 9999;
2566
+ pointer-events: none;
2567
+ `;
2568
+
2569
+ const Notifications = properties => {
2570
+ const {elements: elements, stateGeneralTheme: stateGeneralTheme, stateNotifications: stateNotifications, dispatchRemoveNotification: dispatchRemoveNotification} = properties;
2571
+ return React__default["default"].createElement(StyledNotifications, null, stateNotifications.map((notification => React__default["default"].createElement(Notification, {
2572
+ key: notification.id,
2573
+ data: notification,
2574
+ theme: stateGeneralTheme,
2575
+ remove: dispatchRemoveNotification,
2576
+ elements: elements
2577
+ }))));
2578
+ };
2579
+
2580
+ const mapStateToProperties$6 = (state, ownProperties) => ({
2581
+ stateGeneralTheme: ownProperties.selectors.themes.getGeneralTheme(state),
2582
+ stateNotifications: ownProperties.selectors.notifications.getAll(state)
2583
+ });
2584
+
2585
+ const mapDispatchToProperties$6 = dispatch => ({
2586
+ dispatchRemoveNotification: payload => dispatch(pluridUiStateReact.notifications.actions.removeNotification(payload))
2587
+ });
2588
+
2589
+ const ConnectedNotifications = reactRedux.connect(mapStateToProperties$6, mapDispatchToProperties$6)(Notifications);
2590
+
2591
+ const notifications = {
2592
+ Notification: Notification,
2593
+ Notifications: ConnectedNotifications
2594
+ };
2595
+
2596
+ const StyledSittingTray = styled__default["default"].div`
2597
+ background-color: ${props => props.theme.backgroundColorSecondary};
2598
+ box-shadow: ${props => props.theme.boxShadowUmbra};
2599
+
2600
+ border-radius: 10px;
2601
+ position: absolute;
2602
+ left: 35px;
2603
+ width: 160px;
2604
+ /*
2605
+ -1 * (height - 40px <button>)
2606
+ */
2607
+ /* height: 95px; */
2608
+ bottom: -163px;
2609
+ /* bottom: 0; */
2610
+ overflow: hidden;
2611
+ `;
2612
+
2613
+ const StyledSittingTrayContainer = styled__default["default"].div`
2614
+ overflow: auto;
2615
+ height: 100%;
2616
+
2617
+ scrollbar-width: none; /* Firefox */
2618
+ -ms-overflow-style: none; /* IE 10+ */
2619
+ ::-webkit-scrollbar {
2620
+ width: 0px;
2621
+ background: transparent;
2622
+ }
2623
+
2624
+ ul {
2625
+ list-style: none;
2626
+ padding: 0;
2627
+ margin: 0;
2628
+ text-align: left;
2629
+ }
2630
+
2631
+ li {
2632
+ min-height: 26px;
2633
+ /* padding: 0 7px;
2634
+ margin: 7px 0; */
2635
+ display: grid;
2636
+ grid-template-columns: 1fr;
2637
+ align-items: center;
2638
+ }
2639
+
2640
+ h4 {
2641
+ margin: 0;
2642
+ }
2643
+ `;
2644
+
2645
+ const StyledSittingTrayItem = styled__default["default"].div`
2646
+ display: grid;
2647
+ grid-template-columns: 1fr;
2648
+ grid-template-rows: 1fr 1fr;
2649
+ align-items: center;
2650
+ `;
2651
+
2652
+ const StyledSittingTrayItemHeader = styled__default["default"].div`
2653
+ display: grid;
2654
+ grid-template-columns: 1fr 1fr;
2655
+ align-items: center;
2656
+ `;
2657
+
2658
+ const StyledSittingTrayItemBody = styled__default["default"].div`
2659
+ display: grid;
2660
+ grid-template-columns: 1fr;
2661
+ align-items: center;
2662
+ `;
2663
+
2664
+ const StyledSittingTrayButton = styled__default["default"].div`
2665
+ display: grid;
2666
+ grid-template-columns: 25px 1fr;
2667
+ cursor: pointer;
2668
+ `;
2669
+
2670
+ const StyledSittingTrayButtonIcon = styled__default["default"].div`
2671
+ `;
2672
+
2673
+ const StyledSittingTrayButtonText = styled__default["default"].div`
2674
+ display: flex;
2675
+ align-items: center;
2676
+ `;
2677
+
2678
+ const StyledStateLink = styled__default["default"].div`
2679
+ padding: 7px;
2680
+ padding-bottom: 0px;
2681
+ margin-bottom: 4px;
2682
+ `;
2683
+
2684
+ const StyledStateLinkContainer = styled__default["default"].div`
2685
+ display: grid;
2686
+ grid-template-columns: 1fr;
2687
+ height: 25px;
2688
+ align-items: center;
2689
+ `;
2690
+
2691
+ const StyledStateLinkText = styled__default["default"].div`
2692
+ width: 100%;
2693
+ overflow-x: scroll;
2694
+ overflow-y: hidden;
2695
+ white-space: nowrap;
2696
+ user-select: all;
2697
+ text-align: left;
2698
+
2699
+ scrollbar-width: none;
2700
+ ::-webkit-scrollbar {
2701
+ display: none;
2702
+ }
2703
+ `;
2704
+
2705
+ const StyledStateLinkCopy = styled__default["default"].div`
2706
+ width: 100%;
2707
+ cursor: pointer;
2708
+ justify-self: center;
2709
+ `;
2710
+
2711
+ const StateLink = properties => {
2712
+ const {currentLink: currentLink} = properties;
2713
+ const copyStateLink = () => {
2714
+ pluridFunctions.clipboard.copy(currentLink);
2715
+ setCurrentStateLink("copied link");
2716
+ setTimeout((() => {
2717
+ setCurrentStateLink(currentLink);
2718
+ }), 650);
2719
+ };
2720
+ const [currentStateLink, setCurrentStateLink] = React.useState(currentLink);
2721
+ React.useEffect((() => {
2722
+ setCurrentStateLink(currentLink);
2723
+ }), [ currentLink ]);
2724
+ return React__default["default"].createElement(StyledStateLink, null, React__default["default"].createElement(StyledSittingTrayItem, null, React__default["default"].createElement(StyledSittingTrayItemHeader, null, React__default["default"].createElement("div", null, React__default["default"].createElement("h4", null, "state link")), React__default["default"].createElement("div", {
2725
+ style: {
2726
+ justifySelf: "right"
2727
+ }
2728
+ }, React__default["default"].createElement(StyledStateLinkCopy, {
2729
+ onClick: copyStateLink
2730
+ }, React__default["default"].createElement(pluridIconsReact.PluridIconCopy, null)))), React__default["default"].createElement(StyledSittingTrayItemBody, null, React__default["default"].createElement(StyledStateLinkContainer, null, React__default["default"].createElement(StyledStateLinkText, null, currentStateLink)))));
2731
+ };
2732
+
2733
+ const mapStateToProperties$5 = (state, ownProperties) => ({
2734
+ theme: ownProperties.selectors.themes.getInteractionTheme(state),
2735
+ currentLink: ownProperties.selectors.sitting.getCurrentLink(state)
2736
+ });
2737
+
2738
+ const mapDispatchToProperties$5 = dispatch => ({});
2739
+
2740
+ const ConnectedStateLink = reactRedux.connect(mapStateToProperties$5, mapDispatchToProperties$5)(StateLink);
2741
+
2742
+ const StyledStateLine = styled__default["default"].div`
2743
+ padding: 0 7px;
2744
+ margin-bottom: 4px;
2745
+
2746
+ display: grid;
2747
+ align-items: center;
2748
+ justify-items: center;
2749
+
2750
+ svg {
2751
+ height: 18px;
2752
+ width: 18px;
2753
+ color: white;
2754
+ fill: white;
2755
+ user-select: none;
2756
+ cursor: pointer;
2757
+ }
2758
+ `;
2759
+
2760
+ const StyledSliderStateButton = styled__default["default"].div`
2761
+ user-select: none;
2762
+ cursor: pointer;
2763
+ display: grid;
2764
+ place-content: center;
2765
+ `;
2766
+
2767
+ const StyledSliderStateSliderContainer = styled__default["default"].div`
2768
+ `;
2769
+
2770
+ styled__default["default"].div`
2771
+ justify-self: center;
2772
+ `;
2773
+
2774
+ const StyledStateLineButtons = styled__default["default"].div`
2775
+ display: grid;
2776
+ grid-template-columns: repeat(3, 20px);
2777
+ grid-gap: 3px;
2778
+ align-items: center;
2779
+ justify-content: right;
2780
+ `;
2781
+
2782
+ const StyledStateLineButton = styled__default["default"].div`
2783
+ display: grid;
2784
+ place-content: center;
2785
+ `;
2786
+
2787
+ const StyledStateLineContainer = styled__default["default"].div`
2788
+ display: grid;
2789
+ grid-template-columns: 1fr 1fr 1fr;
2790
+ align-items: center;
2791
+ justify-content: space-between;
2792
+ `;
2793
+
2794
+ const StateLine = properties => {
2795
+ const [stateIndex, setStateIndex] = React.useState(0);
2796
+ const maxStateSlider = 5;
2797
+ const handleStateIndex = type => {
2798
+ switch (type) {
2799
+ case "DECREASE":
2800
+ if (stateIndex - 1 >= 0) {
2801
+ setStateIndex(stateIndex - 1);
2802
+ } else {
2803
+ setStateIndex(0);
2804
+ }
2805
+ break;
2806
+
2807
+ case "INCREASE":
2808
+ if (stateIndex + 1 <= maxStateSlider) {
2809
+ setStateIndex(stateIndex + 1);
2810
+ } else {
2811
+ setStateIndex(maxStateSlider);
2812
+ }
2813
+ break;
2814
+ }
2815
+ };
2816
+ return React__default["default"].createElement(StyledStateLine, null, React__default["default"].createElement(StyledSittingTrayItem, null, React__default["default"].createElement(StyledSittingTrayItemHeader, null, React__default["default"].createElement("div", null, React__default["default"].createElement("h4", null, "state line")), React__default["default"].createElement("div", null, React__default["default"].createElement(StyledStateLineButtons, null, React__default["default"].createElement(StyledStateLineButton, null, React__default["default"].createElement(pluridIconsReact.PluridIconPlay, null)), React__default["default"].createElement(StyledStateLineButton, null, React__default["default"].createElement(pluridIconsReact.PluridIconBranch, null)), React__default["default"].createElement(StyledStateLineButton, null, React__default["default"].createElement(pluridIconsReact.PluridIconNewStateline, null))))), React__default["default"].createElement(StyledSittingTrayItemBody, null, React__default["default"].createElement(StyledStateLineContainer, null, React__default["default"].createElement("div", {
2817
+ style: {
2818
+ display: "grid",
2819
+ justifyContent: "left"
2820
+ }
2821
+ }, stateIndex !== 0 && React__default["default"].createElement(StyledSliderStateButton, {
2822
+ onClick: () => handleStateIndex("DECREASE")
2823
+ }, "◀")), React__default["default"].createElement(StyledSliderStateSliderContainer, null), React__default["default"].createElement("div", {
2824
+ style: {
2825
+ display: "grid",
2826
+ justifyContent: "right"
2827
+ }
2828
+ }, stateIndex !== maxStateSlider && React__default["default"].createElement(StyledSliderStateButton, {
2829
+ onClick: () => handleStateIndex("INCREASE")
2830
+ }, "▶"))))));
2831
+ };
2832
+
2833
+ const mapStateToProperties$4 = (state, ownProperties) => ({
2834
+ theme: ownProperties.selectors.themes.getInteractionTheme(state)
2835
+ });
2836
+
2837
+ const mapDispatchToProperties$4 = dispatch => ({});
2838
+
2839
+ const ConnectedStateLine = reactRedux.connect(mapStateToProperties$4, mapDispatchToProperties$4)(StateLine);
2840
+
2841
+ const StyledStateImage = styled__default["default"].div`
2842
+ padding: 0 7px;
2843
+ margin-bottom: 4px;
2844
+
2845
+ svg {
2846
+ height: 18px;
2847
+ width: 18px;
2848
+ color: white;
2849
+ fill: white;
2850
+ user-select: none;
2851
+ cursor: pointer;
2852
+ }
2853
+ `;
2854
+
2855
+ const StyledStateShareImage = styled__default["default"].div`
2856
+ display: grid;
2857
+ grid-template-columns: 1fr;
2858
+ grid-template-rows: 25px;
2859
+ align-items: center;
2860
+ `;
2861
+
2862
+ const StyledStateShareImageButtons = styled__default["default"].div`
2863
+ display: grid;
2864
+ grid-template-columns: 110px auto;
2865
+ align-items: center;
2866
+ justify-items: center;
2867
+ height: 25px;
2868
+ `;
2869
+
2870
+ const StyledStateShareImageButtonsCopy = styled__default["default"].div`
2871
+ display: grid;
2872
+ grid-template-columns: 1fr 1fr;
2873
+ grid-gap: 10px;
2874
+ justify-self: left;
2875
+
2876
+ svg {
2877
+ height: 18px;
2878
+ width: 18px;
2879
+ fill: white;
2880
+ }
2881
+ `;
2882
+
2883
+ const StyledStateShareImagePasteContainer = styled__default["default"].div`
2884
+ display: grid;
2885
+ grid-template-columns: 100px 40px;
2886
+ align-items: center;
2887
+ justify-items: center;
2888
+
2889
+ input {
2890
+ width: 100%;
2891
+ outline: none;
2892
+ border: none;
2893
+ background: hsla(0, 0%, 10%, 0.5);
2894
+ color: white;
2895
+ padding: 6px;
2896
+ }
2897
+ `;
2898
+
2899
+ const StateImage = properties => {
2900
+ const [message, setMessage] = React.useState("");
2901
+ const [showPaste, setShowPaste] = React.useState(false);
2902
+ const copyCurrentState = () => {
2903
+ setMessage("copied state image");
2904
+ setTimeout((() => {
2905
+ setMessage("");
2906
+ }), 2e3);
2907
+ };
2908
+ const copyStateHistory = () => {
2909
+ setMessage("copied state history");
2910
+ setTimeout((() => {
2911
+ setMessage("");
2912
+ }), 2e3);
2913
+ };
2914
+ const paste = () => {
2915
+ setShowPaste(false);
2916
+ };
2917
+ return React__default["default"].createElement(StyledStateImage, null, React__default["default"].createElement(StyledSittingTrayItem, null, React__default["default"].createElement(StyledSittingTrayItemHeader, null, React__default["default"].createElement("div", null, React__default["default"].createElement("h4", null, "state image")), React__default["default"].createElement("div", null, React__default["default"].createElement("div", {
2918
+ style: {
2919
+ display: "grid",
2920
+ alignItems: "center",
2921
+ justifyContent: "right"
2922
+ }
2923
+ }, React__default["default"].createElement(pluridIconsReact.PluridIconStateShareImage, null)))), React__default["default"].createElement(StyledSittingTrayItemBody, null, React__default["default"].createElement(StyledStateShareImage, null, !message && !showPaste && React__default["default"].createElement(StyledStateShareImageButtons, null, React__default["default"].createElement(StyledStateShareImageButtonsCopy, null, React__default["default"].createElement("div", {
2924
+ onClick: copyCurrentState
2925
+ }, React__default["default"].createElement(pluridIconsReact.PluridIconCopyCurrentState, null)), React__default["default"].createElement("div", {
2926
+ onClick: copyStateHistory
2927
+ }, React__default["default"].createElement(pluridIconsReact.PluridIconCopyStateHistory, null))), React__default["default"].createElement("div", {
2928
+ onClick: () => setShowPaste(true)
2929
+ }, "paste")), message && !showPaste && React__default["default"].createElement("div", null, message), showPaste && React__default["default"].createElement(StyledStateShareImagePasteContainer, null, React__default["default"].createElement("input", {
2930
+ type: "text"
2931
+ }), React__default["default"].createElement("div", {
2932
+ onClick: paste
2933
+ }, "paste"))))));
2934
+ };
2935
+
2936
+ const mapStateToProperties$3 = (state, ownProperties) => ({
2937
+ theme: ownProperties.selectors.themes.getInteractionTheme(state)
2938
+ });
2939
+
2940
+ const mapDispatchToProperties$3 = dispatch => ({});
2941
+
2942
+ const ConnectedStateImage = reactRedux.connect(mapStateToProperties$3, mapDispatchToProperties$3)(StateImage);
2943
+
2944
+ const StyledSittings = styled__default["default"].div`
2945
+ padding: 7px;
2946
+
2947
+ display: grid;
2948
+ align-items: center;
2949
+
2950
+ svg {
2951
+ height: 18px;
2952
+ width: 18px;
2953
+ color: white;
2954
+ fill: white;
2955
+ user-select: none;
2956
+ cursor: pointer;
2957
+ }
2958
+
2959
+ :hover {
2960
+ background-color: ${props => props.theme.backgroundColorTertiary};
2961
+ }
2962
+ `;
2963
+
2964
+ const Sittings = properties => {
2965
+ const {stateInteractionTheme: stateInteractionTheme} = properties;
2966
+ return React__default["default"].createElement(StyledSittings, {
2967
+ theme: stateInteractionTheme
2968
+ }, React__default["default"].createElement(StyledSittingTrayButton, null, React__default["default"].createElement(StyledSittingTrayButtonIcon, null, React__default["default"].createElement(pluridIconsReact.PluridIconSittings, {
2969
+ theme: stateInteractionTheme
2970
+ })), React__default["default"].createElement(StyledSittingTrayButtonText, null, "sittings")));
2971
+ };
2972
+
2973
+ const mapStateToProperties$2 = (state, ownProperties) => ({
2974
+ stateInteractionTheme: ownProperties.selectors.themes.getInteractionTheme(state)
2975
+ });
2976
+
2977
+ const mapDispatchToProperties$2 = dispatch => ({});
2978
+
2979
+ const ConnectedSittings = reactRedux.connect(mapStateToProperties$2, mapDispatchToProperties$2)(Sittings);
2980
+
2981
+ const SittingTray = properties => {
2982
+ const {selectors: selectors, context: context, stateInteractionTheme: stateInteractionTheme} = properties;
2983
+ return React__default["default"].createElement(StyledSittingTray, {
2984
+ theme: stateInteractionTheme
2985
+ }, React__default["default"].createElement(StyledSittingTrayContainer, null, React__default["default"].createElement("ul", null, React__default["default"].createElement("li", null, React__default["default"].createElement(ConnectedStateLink, {
2986
+ selectors: selectors,
2987
+ context: context
2988
+ })), React__default["default"].createElement("li", null, React__default["default"].createElement(ConnectedStateLine, {
2989
+ selectors: selectors,
2990
+ context: context
2991
+ })), React__default["default"].createElement("li", null, React__default["default"].createElement(ConnectedStateImage, {
2992
+ selectors: selectors,
2993
+ context: context
2994
+ })), React__default["default"].createElement("li", null, React__default["default"].createElement(ConnectedSittings, {
2995
+ selectors: selectors,
2996
+ context: context
2997
+ })))));
2998
+ };
2999
+
3000
+ const mapStatedToProperties = (state, ownProperties) => ({
3001
+ stateInteractionTheme: ownProperties.selectors.themes.getInteractionTheme(state)
3002
+ });
3003
+
3004
+ const mapDispatchdToProperties = dispatch => ({});
3005
+
3006
+ const ConnectedSittingTray = reactRedux.connect(mapStatedToProperties, mapDispatchdToProperties)(SittingTray);
3007
+
3008
+ const sitting = {
3009
+ SittingTray: ConnectedSittingTray
3010
+ };
3011
+
3012
+ const StyledHorizontalToolbarButton = styled__default["default"].div`
3013
+ position: relative;
3014
+ cursor: pointer;
3015
+ user-select: none;
3016
+ font-weight: normal;
3017
+ transition: transform 50ms ease-in-out;
3018
+ height: 45px;
3019
+ min-width: 2rem;
3020
+ padding: 0 1rem;
3021
+ display: flex;
3022
+ align-items: center;
3023
+ justify-content: center;
3024
+
3025
+ background-color: ${props => {
3026
+ if (props.active) {
3027
+ return props.theme.backgroundColorTertiary;
3028
+ }
3029
+ return "transparent";
3030
+ }};
3031
+ color: ${props => props.theme.colorPrimary};
3032
+ font-family: ${props => props.theme.fontFamilySansSerif};
3033
+
3034
+ :hover {
3035
+ background: ${props => props.theme.backgroundColorTertiary};
3036
+ }
3037
+
3038
+ :hover svg {
3039
+ transform: ${props => {
3040
+ if (props.scaleIcon) {
3041
+ return "scale(1.2)";
3042
+ }
3043
+ return "";
3044
+ }};
3045
+ }
3046
+
3047
+ svg {
3048
+ transition: transform 100ms linear;
3049
+ transform: ${props => {
3050
+ if (props.active && props.scaleIcon) {
3051
+ return "scale(1.2)";
3052
+ }
3053
+ return "";
3054
+ }};
3055
+ }
3056
+ `;
3057
+
3058
+ const StyledHorizontalToolbarButtonIcon = styled__default["default"].div`
3059
+ display: flex;
3060
+ align-items: center;
3061
+ margin-right: ${({text: text}) => {
3062
+ if (text === "") {
3063
+ return "0";
3064
+ }
3065
+ return "0.5rem";
3066
+ }};
3067
+ `;
3068
+
3069
+ const HorizontalToolbarButton = properties => {
3070
+ const {text: text, atClick: atClick, active: active, scaleIcon: scaleIcon, icon: Icon, theme: themeProperty, style: style, className: className} = properties;
3071
+ const theme = themeProperty || themes__default["default"].plurid;
3072
+ return React__default["default"].createElement(StyledHorizontalToolbarButton, {
3073
+ active: active,
3074
+ scaleIcon: scaleIcon,
3075
+ onClick: atClick,
3076
+ theme: theme,
3077
+ style: Object.assign({}, style),
3078
+ className: className
3079
+ }, Icon && React__default["default"].createElement(StyledHorizontalToolbarButtonIcon, {
3080
+ text: text
3081
+ }, React__default["default"].createElement(Icon, null)), text);
3082
+ };
3083
+
3084
+ var SizeTypes;
3085
+
3086
+ (function(SizeTypes) {
3087
+ SizeTypes["small"] = "small";
3088
+ SizeTypes["normal"] = "normal";
3089
+ SizeTypes["large"] = "large";
3090
+ })(SizeTypes || (SizeTypes = {}));
3091
+
3092
+ var HorizontalPositions;
3093
+
3094
+ (function(HorizontalPositions) {
3095
+ HorizontalPositions["left"] = "left";
3096
+ HorizontalPositions["right"] = "right";
3097
+ })(HorizontalPositions || (HorizontalPositions = {}));
3098
+
3099
+ var VerticalPositions;
3100
+
3101
+ (function(VerticalPositions) {
3102
+ VerticalPositions["top"] = "top";
3103
+ VerticalPositions["bottom"] = "bottom";
3104
+ })(VerticalPositions || (VerticalPositions = {}));
3105
+
3106
+ const StyledToolbarControls = styled__default["default"].div`
3107
+ top: ${({position: position}) => {
3108
+ if (position === VerticalPositions.top) {
3109
+ return "15px";
3110
+ }
3111
+ return "initial";
3112
+ }};
3113
+ bottom: ${({position: position}) => {
3114
+ if (position === VerticalPositions.bottom) {
3115
+ return "15px";
3116
+ }
3117
+ return "initial";
3118
+ }};
3119
+
3120
+ position: absolute;
3121
+ left: 50%;
3122
+ transform: translateX(-50%);
3123
+ z-index: 99999;
3124
+ `;
3125
+
3126
+ const StyledToolbarControlsButtons = styled__default["default"].div`
3127
+ background-color: ${({theme: theme}) => theme.backgroundColorSecondary};
3128
+ box-shadow: ${({theme: theme}) => theme.boxShadowUmbra};
3129
+
3130
+ display: flex;
3131
+ align-items: center;
3132
+ border-radius: 22.5px;
3133
+ min-height: 45px;
3134
+ height: 45px;
3135
+ padding: 0 22.5px;
3136
+ margin: 0 auto;
3137
+ font-size: 0.9rem;
3138
+ opacity: 1;
3139
+ height: 100%;
3140
+ `;
3141
+
3142
+ const ToolbarControls = properties => {
3143
+ const {position: positionProperty, theme: themeProperty, style: style, className: className, children: children} = properties;
3144
+ const position = positionProperty || VerticalPositions.top;
3145
+ const theme = themeProperty || themes.plurid;
3146
+ return React__default["default"].createElement(StyledToolbarControls, {
3147
+ position: position,
3148
+ theme: theme,
3149
+ style: Object.assign({}, style),
3150
+ className: className
3151
+ }, React__default["default"].createElement(StyledToolbarControlsButtons, {
3152
+ theme: theme
3153
+ }, children));
3154
+ };
3155
+
3156
+ const StyledVerticalToolbarButton = styled__default["default"].div`
3157
+ position: relative;
3158
+ cursor: pointer;
3159
+ height: 40px;
3160
+ display: grid;
3161
+ place-content: center;
3162
+ transition: transform 50ms ease-in-out;
3163
+
3164
+ border-top-left-radius: ${props => {
3165
+ if (props.first) {
3166
+ return "15px";
3167
+ }
3168
+ return "0";
3169
+ }};
3170
+ border-top-right-radius: ${props => {
3171
+ if (props.first) {
3172
+ return "15px";
3173
+ }
3174
+ return "0";
3175
+ }};
3176
+
3177
+ border-bottom-left-radius: ${props => {
3178
+ if (props.last) {
3179
+ return "15px";
3180
+ }
3181
+ return "0";
3182
+ }};
3183
+ border-bottom-right-radius: ${props => {
3184
+ if (props.last) {
3185
+ return "15px";
3186
+ }
3187
+ return "0";
3188
+ }};
3189
+
3190
+ background-color: ${props => {
3191
+ if (props.active) {
3192
+ return props.theme.backgroundColorTertiary;
3193
+ }
3194
+ return "transparent";
3195
+ }};
3196
+
3197
+ :hover {
3198
+ background: ${props => props.theme.backgroundColorTertiary};
3199
+ }
3200
+
3201
+ :hover svg {
3202
+ transform: ${props => {
3203
+ if (props.scaleIcon) {
3204
+ return "scale(1.2)";
3205
+ }
3206
+ return "";
3207
+ }};
3208
+ }
3209
+
3210
+ svg {
3211
+ transition: transform 100ms linear;
3212
+ width: 15px;
3213
+ height: 15px;
3214
+ fill: ${props => props.theme.colorPrimary};
3215
+ transform: ${props => {
3216
+ if (props.active && props.scaleIcon) {
3217
+ return "scale(1.2)";
3218
+ }
3219
+ return "";
3220
+ }};
3221
+ }
3222
+ `;
3223
+
3224
+ const StyledVerticalToolbarButtonText = styled__default["default"].div`
3225
+ left: ${props => {
3226
+ if (props.textLeft) {
3227
+ return "-108px";
3228
+ }
3229
+ return "30px";
3230
+ }};
3231
+ justify-content: ${props => {
3232
+ if (props.textLeft) {
3233
+ return "flex-end";
3234
+ }
3235
+ return "left";
3236
+ }};
3237
+ text-align: ${props => {
3238
+ if (props.textLeft) {
3239
+ return "right";
3240
+ }
3241
+ return "left";
3242
+ }};
3243
+ padding-left: ${props => {
3244
+ if (props.textLeft) {
3245
+ return "0";
3246
+ }
3247
+ return "8px";
3248
+ }};
3249
+
3250
+ pointer-events: none;
3251
+ position: absolute;
3252
+ height: 40px;
3253
+ width: 100px;
3254
+ display: flex;
3255
+ align-items: center;
3256
+ `;
3257
+
3258
+ const VerticalToolbarButton = properties => {
3259
+ const {atClick: atClick, icon: Icon, active: active, text: text, textLeft: textLeft, showText: showText, scaleIcon: scaleIcon, first: first, last: last, theme: theme} = properties;
3260
+ const [mouseOver, setMouseOver] = React.useState(false);
3261
+ return React__default["default"].createElement(StyledVerticalToolbarButton, {
3262
+ onMouseEnter: () => setMouseOver(true),
3263
+ onMouseLeave: () => setMouseOver(false),
3264
+ onClick: atClick,
3265
+ active: active,
3266
+ scaleIcon: scaleIcon,
3267
+ first: first,
3268
+ last: last,
3269
+ theme: theme
3270
+ }, React__default["default"].createElement(Icon, null), mouseOver && showText && React__default["default"].createElement(StyledVerticalToolbarButtonText, {
3271
+ textLeft: textLeft
3272
+ }, text));
3273
+ };
3274
+
3275
+ const StyledToolbar = styled__default["default"].div`
3276
+ left: ${props => {
3277
+ if (props.position === HorizontalPositions.left) {
3278
+ return "0";
3279
+ }
3280
+ return "initial";
3281
+ }};
3282
+ right: ${props => {
3283
+ if (props.position === HorizontalPositions.right) {
3284
+ return "0";
3285
+ }
3286
+ return "initial";
3287
+ }};
3288
+
3289
+ pointer-events: none;
3290
+ position: absolute;
3291
+ top: 0;
3292
+ bottom: 0;
3293
+ width: 60px;
3294
+ `;
3295
+
3296
+ const StyledToolbarButtons = styled__default["default"].div`
3297
+ background-color: ${props => props.theme.backgroundColorSecondary};
3298
+ box-shadow: ${props => props.theme.boxShadowUmbra};
3299
+
3300
+ pointer-events: all;
3301
+ display: grid;
3302
+ place-content: center;
3303
+ grid-template-columns: 1fr;
3304
+ grid-template-rows: 1fr;
3305
+ border-radius: 15px;
3306
+ margin: 0 15px;
3307
+ font-size: 12px;
3308
+ opacity: 1;
3309
+ width: 30px;
3310
+ height: auto;
3311
+ position: absolute;
3312
+ top: 50%;
3313
+ transform: translateY(-50%);
3314
+ transition: opacity 300ms ease-in-out;
3315
+ z-index: 9999;
3316
+ user-select: none;
3317
+ `;
3318
+
3319
+ const ToolbarSpecific = properties => {
3320
+ const {buttons: buttons, handleClick: handleClick, activeType: activeType, position: position, children: children, stateToolbars: stateToolbars, stateIdentonym: stateIdentonym, stateInteractionTheme: stateInteractionTheme} = properties;
3321
+ const {alwaysShow: alwaysShow, location: location, scaleIcons: scaleIcons, showNames: showNames} = stateToolbars;
3322
+ const toolbarPosition = position ? position : HorizontalPositions.right;
3323
+ const [showToolbar, setShowToolbar] = React.useState(alwaysShow);
3324
+ const [mouseIn, setMouseIn] = React.useState(false);
3325
+ const handleMouseMove = event => {
3326
+ if (!showToolbar) {
3327
+ setShowToolbar(true);
3328
+ }
3329
+ };
3330
+ React.useEffect((() => {
3331
+ if (alwaysShow) {
3332
+ setShowToolbar(true);
3333
+ }
3334
+ if (mouseIn) {
3335
+ setShowToolbar(true);
3336
+ } else {
3337
+ if (!alwaysShow) {
3338
+ setShowToolbar(false);
3339
+ }
3340
+ }
3341
+ }), [ mouseIn, alwaysShow ]);
3342
+ return React__default["default"].createElement(StyledToolbar, {
3343
+ onMouseMove: () => handleMouseMove,
3344
+ onMouseEnter: () => setMouseIn(true),
3345
+ onMouseLeave: () => setMouseIn(false),
3346
+ position: toolbarPosition
3347
+ }, React__default["default"].createElement(StyledToolbarButtons, {
3348
+ theme: stateInteractionTheme,
3349
+ style: {
3350
+ top: location ? location + "%" : "",
3351
+ opacity: showToolbar ? 1 : 0
3352
+ }
3353
+ }, buttons.filter((button => {
3354
+ const {loggedIn: loggedIn} = button;
3355
+ if (loggedIn === "ONLY" && !stateIdentonym) {
3356
+ return false;
3357
+ }
3358
+ if (loggedIn === "NONE" && stateIdentonym) {
3359
+ return false;
3360
+ }
3361
+ return true;
3362
+ })).map(((button, index) => {
3363
+ const {type: type, text: text, icon: Icon, first: first, last: last} = button;
3364
+ return React__default["default"].createElement(VerticalToolbarButton, {
3365
+ key: type,
3366
+ atClick: () => handleClick(type, index),
3367
+ icon: Icon,
3368
+ active: activeType === type,
3369
+ text: text,
3370
+ textLeft: toolbarPosition === "right",
3371
+ showText: showNames,
3372
+ scaleIcon: scaleIcons,
3373
+ theme: stateInteractionTheme,
3374
+ first: first,
3375
+ last: last
3376
+ });
3377
+ })), children));
3378
+ };
3379
+
3380
+ const mapStateToProperties$1 = (state, ownProperties) => ({
3381
+ stateToolbars: ownProperties.selectors.product.getProductUI(state).toolbars,
3382
+ stateIdentonym: ownProperties.selectors.owner.getIdentonym(state),
3383
+ stateInteractionTheme: ownProperties.selectors.themes.getInteractionTheme(state)
3384
+ });
3385
+
3386
+ const mapDispatchToProperties$1 = dispatch => ({});
3387
+
3388
+ const ConnectedToolbarSpecific = reactRedux.connect(mapStateToProperties$1, mapDispatchToProperties$1)(ToolbarSpecific);
3389
+
3390
+ const ToolbarGeneral = properties => {
3391
+ const {buttons: buttons, selectors: selectors, context: context, handleClick: handleClick, speakButton: speakButton, sittingButton: sittingButtonProperty, stateView: stateView, stateSittingTray: stateSittingTray, stateToolbars: stateToolbars, stateInteractionTheme: stateInteractionTheme, dispatchToggleSittingTray: dispatchToggleSittingTray} = properties;
3392
+ const {scaleIcons: scaleIcons, showNames: showNames} = stateToolbars;
3393
+ const iconTextLeft = false;
3394
+ const sittingButton = sittingButtonProperty !== null && sittingButtonProperty !== void 0 ? sittingButtonProperty : true;
3395
+ return React__default["default"].createElement(ConnectedToolbarSpecific, {
3396
+ buttons: buttons,
3397
+ handleClick: handleClick,
3398
+ activeType: stateView,
3399
+ position: HorizontalPositions.left,
3400
+ selectors: selectors,
3401
+ context: context
3402
+ }, speakButton && React__default["default"].createElement(VerticalToolbarButton, {
3403
+ atClick: () => {},
3404
+ icon: pluridIconsReact.PluridIconSpeak,
3405
+ active: false,
3406
+ text: "speak",
3407
+ textLeft: iconTextLeft,
3408
+ showText: showNames,
3409
+ scaleIcon: scaleIcons,
3410
+ theme: stateInteractionTheme
3411
+ }), sittingButton && React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(VerticalToolbarButton, {
3412
+ atClick: () => dispatchToggleSittingTray(),
3413
+ icon: pluridIconsReact.PluridIconStateShareImage,
3414
+ active: stateSittingTray,
3415
+ text: "sitting",
3416
+ textLeft: iconTextLeft,
3417
+ showText: showNames,
3418
+ scaleIcon: scaleIcons,
3419
+ theme: stateInteractionTheme,
3420
+ last: true
3421
+ }), stateSittingTray && React__default["default"].createElement(ConnectedSittingTray, {
3422
+ selectors: selectors,
3423
+ context: context
3424
+ })));
3425
+ };
3426
+
3427
+ const mapStateToProperties = (state, ownProperties) => {
3428
+ var _a, _b, _c, _d, _e;
3429
+ return {
3430
+ stateView: (_a = ownProperties.selectors.views) === null || _a === void 0 ? void 0 : _a.getGeneralView(state),
3431
+ stateToolbars: (_c = (_b = ownProperties.selectors.product) === null || _b === void 0 ? void 0 : _b.getProductUI(state)) === null || _c === void 0 ? void 0 : _c.toolbars,
3432
+ stateSittingTray: (_d = ownProperties.selectors.sitting) === null || _d === void 0 ? void 0 : _d.getTray(state),
3433
+ stateInteractionTheme: (_e = ownProperties.selectors.themes) === null || _e === void 0 ? void 0 : _e.getInteractionTheme(state)
3434
+ };
3435
+ };
3436
+
3437
+ const mapDispatchToProperties = dispatch => ({
3438
+ dispatchToggleSittingTray: () => dispatch(pluridUiStateReact.sitting.actions.toggleSittingTray())
3439
+ });
3440
+
3441
+ const ConnectedToolbarGeneral = reactRedux.connect(mapStateToProperties, mapDispatchToProperties)(ToolbarGeneral);
3442
+
3443
+ const toolbars = {
3444
+ HorizontalToolbarButton: HorizontalToolbarButton,
3445
+ ToolbarControls: ToolbarControls,
3446
+ ToolbarGeneral: ConnectedToolbarGeneral,
3447
+ ToolbarSpecific: ConnectedToolbarSpecific,
3448
+ VerticalToolbarButton: VerticalToolbarButton
3449
+ };
3450
+
3451
+ const pluridal = {
3452
+ notifications: notifications,
3453
+ sitting: sitting,
3454
+ toolbars: toolbars
3455
+ };
3456
+
3457
+ exports.pluridal = pluridal;
3458
+
3459
+ exports.universal = universal;
3460
+ //# sourceMappingURL=index.js.map