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