@plurid/plurid-ui-components-react 0.0.0-27 → 0.0.0-29

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 (126) hide show
  1. package/distribution/index.d.mts +852 -0
  2. package/distribution/index.d.ts +819 -80
  3. package/distribution/index.js +4989 -2984
  4. package/distribution/index.js.map +1 -1
  5. package/distribution/index.mjs +6557 -0
  6. package/distribution/index.mjs.map +1 -0
  7. package/package.json +87 -90
  8. package/distribution/components/pluridal/containers/DashboardsRenderer/components/RenderArea/index.d.ts +0 -15
  9. package/distribution/components/pluridal/containers/DashboardsRenderer/components/RenderArea/styled.d.ts +0 -6
  10. package/distribution/components/pluridal/containers/DashboardsRenderer/components/Sidebar/components/Selector/index.d.ts +0 -13
  11. package/distribution/components/pluridal/containers/DashboardsRenderer/components/Sidebar/components/Selector/styled.d.ts +0 -12
  12. package/distribution/components/pluridal/containers/DashboardsRenderer/components/Sidebar/index.d.ts +0 -21
  13. package/distribution/components/pluridal/containers/DashboardsRenderer/components/Sidebar/styled.d.ts +0 -21
  14. package/distribution/components/pluridal/containers/DashboardsRenderer/data.d.ts +0 -18
  15. package/distribution/components/pluridal/containers/DashboardsRenderer/index.d.ts +0 -24
  16. package/distribution/components/pluridal/containers/DashboardsRenderer/styled.d.ts +0 -9
  17. package/distribution/components/pluridal/containers/EntityView/index.d.ts +0 -28
  18. package/distribution/components/pluridal/containers/EntityView/logic.d.ts +0 -4
  19. package/distribution/components/pluridal/containers/EntityView/styled.d.ts +0 -26
  20. package/distribution/components/pluridal/containers/index.d.ts +0 -6
  21. package/distribution/components/pluridal/head/Head/index.d.ts +0 -48
  22. package/distribution/components/pluridal/head/index.d.ts +0 -16
  23. package/distribution/components/pluridal/index.d.ts +0 -55
  24. package/distribution/components/pluridal/notifications/Notification/index.d.ts +0 -14
  25. package/distribution/components/pluridal/notifications/Notification/styled.d.ts +0 -11
  26. package/distribution/components/pluridal/notifications/Notifications/index.d.ts +0 -35
  27. package/distribution/components/pluridal/notifications/Notifications/styled.d.ts +0 -2
  28. package/distribution/components/pluridal/notifications/index.d.ts +0 -19
  29. package/distribution/components/pluridal/sitting/SittingTray/components/Sittings/index.d.ts +0 -16
  30. package/distribution/components/pluridal/sitting/SittingTray/components/Sittings/styled.d.ts +0 -1
  31. package/distribution/components/pluridal/sitting/SittingTray/components/StateImage/index.d.ts +0 -16
  32. package/distribution/components/pluridal/sitting/SittingTray/components/StateImage/styled.d.ts +0 -6
  33. package/distribution/components/pluridal/sitting/SittingTray/components/StateLine/index.d.ts +0 -9
  34. package/distribution/components/pluridal/sitting/SittingTray/components/StateLine/styled.d.ts +0 -8
  35. package/distribution/components/pluridal/sitting/SittingTray/components/StateLink/index.d.ts +0 -10
  36. package/distribution/components/pluridal/sitting/SittingTray/components/StateLink/styled.d.ts +0 -5
  37. package/distribution/components/pluridal/sitting/SittingTray/components/StateShareImage/index.d.ts +0 -5
  38. package/distribution/components/pluridal/sitting/SittingTray/components/StateShareImage/styled.d.ts +0 -5
  39. package/distribution/components/pluridal/sitting/SittingTray/index.d.ts +0 -16
  40. package/distribution/components/pluridal/sitting/SittingTray/styled.d.ts +0 -8
  41. package/distribution/components/pluridal/sitting/index.d.ts +0 -7
  42. package/distribution/components/pluridal/toolbars/HorizontalToolbarButton/index.d.ts +0 -14
  43. package/distribution/components/pluridal/toolbars/HorizontalToolbarButton/styled.d.ts +0 -12
  44. package/distribution/components/pluridal/toolbars/ToolbarControls/index.d.ts +0 -13
  45. package/distribution/components/pluridal/toolbars/ToolbarControls/styled.d.ts +0 -13
  46. package/distribution/components/pluridal/toolbars/ToolbarGeneral/index.d.ts +0 -26
  47. package/distribution/components/pluridal/toolbars/ToolbarGeneral/styled.d.ts +0 -3
  48. package/distribution/components/pluridal/toolbars/ToolbarSpecific/index.d.ts +0 -24
  49. package/distribution/components/pluridal/toolbars/ToolbarSpecific/styled.d.ts +0 -11
  50. package/distribution/components/pluridal/toolbars/VerticalToolbarButton/index.d.ts +0 -16
  51. package/distribution/components/pluridal/toolbars/VerticalToolbarButton/styled.d.ts +0 -13
  52. package/distribution/components/pluridal/toolbars/index.d.ts +0 -13
  53. package/distribution/components/universal/buttons/LinkButton/index.d.ts +0 -16
  54. package/distribution/components/universal/buttons/LinkButton/styled.d.ts +0 -11
  55. package/distribution/components/universal/buttons/PureButton/index.d.ts +0 -16
  56. package/distribution/components/universal/buttons/PureButton/styled.d.ts +0 -15
  57. package/distribution/components/universal/buttons/RefreshButton/index.d.ts +0 -12
  58. package/distribution/components/universal/buttons/RefreshButton/styled.d.ts +0 -7
  59. package/distribution/components/universal/buttons/index.d.ts +0 -7
  60. package/distribution/components/universal/form/FormLeftRight/index.d.ts +0 -15
  61. package/distribution/components/universal/form/FormLeftRight/styled.d.ts +0 -6
  62. package/distribution/components/universal/form/FormObliterate/index.d.ts +0 -18
  63. package/distribution/components/universal/form/FormObliterate/styled.d.ts +0 -9
  64. package/distribution/components/universal/form/Formbutton/index.d.ts +0 -28
  65. package/distribution/components/universal/form/Formbutton/styled.d.ts +0 -16
  66. package/distribution/components/universal/form/Formitem/index.d.ts +0 -16
  67. package/distribution/components/universal/form/Formitem/styled.d.ts +0 -7
  68. package/distribution/components/universal/form/Formline/index.d.ts +0 -21
  69. package/distribution/components/universal/form/Formline/styled.d.ts +0 -13
  70. package/distribution/components/universal/form/index.d.ts +0 -9
  71. package/distribution/components/universal/general/GlobalStyles/index.d.ts +0 -7
  72. package/distribution/components/universal/general/index.d.ts +0 -5
  73. package/distribution/components/universal/index.d.ts +0 -49
  74. package/distribution/components/universal/inputs/Dropdown/index.d.ts +0 -47
  75. package/distribution/components/universal/inputs/Dropdown/styled.d.ts +0 -8
  76. package/distribution/components/universal/inputs/EntityPill/index.d.ts +0 -11
  77. package/distribution/components/universal/inputs/EntityPill/styled.d.ts +0 -6
  78. package/distribution/components/universal/inputs/EntityPillGroup/index.d.ts +0 -13
  79. package/distribution/components/universal/inputs/EntityPillGroup/styled.d.ts +0 -6
  80. package/distribution/components/universal/inputs/InputBox/index.d.ts +0 -13
  81. package/distribution/components/universal/inputs/InputBox/styled.d.ts +0 -10
  82. package/distribution/components/universal/inputs/InputDescriptor/index.d.ts +0 -11
  83. package/distribution/components/universal/inputs/InputDescriptor/styled.d.ts +0 -6
  84. package/distribution/components/universal/inputs/InputLine/index.d.ts +0 -17
  85. package/distribution/components/universal/inputs/InputLine/styled.d.ts +0 -6
  86. package/distribution/components/universal/inputs/InputSwitch/index.d.ts +0 -15
  87. package/distribution/components/universal/inputs/InputSwitch/styled.d.ts +0 -5
  88. package/distribution/components/universal/inputs/Itemsline/index.d.ts +0 -18
  89. package/distribution/components/universal/inputs/Itemsline/styled.d.ts +0 -8
  90. package/distribution/components/universal/inputs/Select/index.d.ts +0 -23
  91. package/distribution/components/universal/inputs/Select/styled.d.ts +0 -1
  92. package/distribution/components/universal/inputs/Slider/index.d.ts +0 -19
  93. package/distribution/components/universal/inputs/Slider/styled.d.ts +0 -5
  94. package/distribution/components/universal/inputs/Switch/index.d.ts +0 -14
  95. package/distribution/components/universal/inputs/Switch/styled.d.ts +0 -3
  96. package/distribution/components/universal/inputs/Textline/index.d.ts +0 -62
  97. package/distribution/components/universal/inputs/Textline/styled.d.ts +0 -3
  98. package/distribution/components/universal/inputs/index.d.ts +0 -16
  99. package/distribution/components/universal/markers/HR/index.d.ts +0 -9
  100. package/distribution/components/universal/markers/HR/styled.d.ts +0 -6
  101. package/distribution/components/universal/markers/ProgressCircle/index.d.ts +0 -14
  102. package/distribution/components/universal/markers/ProgressCircle/styled.d.ts +0 -6
  103. package/distribution/components/universal/markers/Spinner/index.d.ts +0 -11
  104. package/distribution/components/universal/markers/Spinner/styled.d.ts +0 -9
  105. package/distribution/components/universal/markers/Tooltip/index.d.ts +0 -16
  106. package/distribution/components/universal/markers/Tooltip/styled.d.ts +0 -16
  107. package/distribution/components/universal/markers/index.d.ts +0 -8
  108. package/distribution/components/universal/typography/Heading/index.d.ts +0 -10
  109. package/distribution/components/universal/typography/Heading/styled.d.ts +0 -6
  110. package/distribution/components/universal/typography/Paragraph/index.d.ts +0 -11
  111. package/distribution/components/universal/typography/Paragraph/styled.d.ts +0 -8
  112. package/distribution/components/universal/typography/index.d.ts +0 -6
  113. package/distribution/components/universal/varia/CopyableLine/index.d.ts +0 -19
  114. package/distribution/components/universal/varia/CopyableLine/styled.d.ts +0 -3
  115. package/distribution/components/universal/varia/NewPageLink/index.d.ts +0 -14
  116. package/distribution/components/universal/varia/NewPageLink/styled.d.ts +0 -4
  117. package/distribution/components/universal/varia/ScrollableLine/index.d.ts +0 -14
  118. package/distribution/components/universal/varia/ScrollableLine/styled.d.ts +0 -4
  119. package/distribution/components/universal/varia/TextItem/index.d.ts +0 -9
  120. package/distribution/components/universal/varia/TextItem/styled.d.ts +0 -2
  121. package/distribution/components/universal/varia/index.d.ts +0 -8
  122. package/distribution/data/enumerations/index.d.ts +0 -13
  123. package/distribution/data/interfaces/index.d.ts +0 -29
  124. package/distribution/index.es.js +0 -4361
  125. package/distribution/index.es.js.map +0 -1
  126. package/distribution/utilities/input/index.d.ts +0 -4
@@ -1,4361 +0,0 @@
1
- import React, { useRef, useState, useEffect, forwardRef, useImperativeHandle } from "react";
2
-
3
- import themes, { plurid } from "@plurid/plurid-themes";
4
-
5
- import styled, { createGlobalStyle, css, keyframes } from "styled-components";
6
-
7
- import { PluridIconReset, PluridIconObliterate, PluridIconDelete, PluridIconCopy, PluridIconInfo, PluridIconSpace, PluridIconArrowRight, PluridIconDocuments, PluridIconExternalLink, PluridIconExit, PluridIconPlay, PluridIconBranch, PluridIconNewStateline, PluridIconStateShareImage, PluridIconCopyCurrentState, PluridIconCopyStateHistory, PluridIconSittings, PluridIconSpeak } from "@plurid/plurid-icons-react";
8
-
9
- import { mergeReferences, useMounted, useFalseAfterTimedTrue, useThrottledCallback, 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$1 = 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: {
157
- ...style
158
- },
159
- className: className
160
- }, React.createElement(StyledLoader, {
161
- theme: themeValue,
162
- size: sizeValue
163
- }, React.createElement("div", null), React.createElement("div", null), React.createElement("div", null), React.createElement("div", null)));
164
- };
165
-
166
- const StyledPureButton = styled.button`
167
- color: ${({theme: theme}) => theme.colorPrimary};
168
- background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
169
- if (isDisabled) {
170
- return theme.backgroundColorPrimaryAlpha;
171
- }
172
- switch (level) {
173
- case 0:
174
- return theme.backgroundColorPrimary;
175
-
176
- case 1:
177
- return theme.backgroundColorSecondary;
178
-
179
- case 2:
180
- return theme.backgroundColorTertiary;
181
-
182
- case 3:
183
- return theme.backgroundColorQuaternary;
184
-
185
- default:
186
- return theme.backgroundColorPrimary;
187
- }
188
- }};
189
- box-shadow: 0px 8px 8px 0px ${({theme: theme}) => theme.boxShadowUmbraColor};
190
-
191
- box-sizing: border-box;
192
- display: block;
193
- width: 100%;
194
- min-width: ${({size: size}) => {
195
- switch (size) {
196
- case "small":
197
- return "8rem";
198
-
199
- case "normal":
200
- return "10rem";
201
-
202
- case "large":
203
- return "12rem";
204
-
205
- default:
206
- return "10rem";
207
- }
208
- }};
209
- border-radius: ${({size: size}) => {
210
- switch (size) {
211
- case "small":
212
- return "1rem";
213
-
214
- case "normal":
215
- return "1.2rem";
216
-
217
- case "large":
218
- return "1.4rem";
219
-
220
- default:
221
- return "1.2rem";
222
- }
223
- }};
224
- padding: ${({size: size}) => {
225
- switch (size) {
226
- case "small":
227
- return "0 1.2rem";
228
-
229
- case "normal":
230
- return "0 1.4rem";
231
-
232
- case "large":
233
- return "0 1.6rem";
234
-
235
- default:
236
- return "0 1.4rem";
237
- }
238
- }};
239
-
240
- font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
241
- font-size: ${({size: size}) => {
242
- switch (size) {
243
- case "small":
244
- return "0.8rem";
245
-
246
- case "normal":
247
- return "0.9rem";
248
-
249
- case "large":
250
- return "1rem";
251
-
252
- default:
253
- return "0.9rem";
254
- }
255
- }};
256
- height: ${({size: size}) => {
257
- switch (size) {
258
- case "small":
259
- return "2rem";
260
-
261
- case "normal":
262
- return "2.4rem";
263
-
264
- case "large":
265
- return "2.8rem";
266
-
267
- default:
268
- return "2.4rem";
269
- }
270
- }};
271
- cursor: ${({isDisabled: isDisabled}) => {
272
- if (isDisabled) {
273
- return "default";
274
- }
275
- return "pointer";
276
- }};
277
-
278
-
279
- border: none;
280
- outline: none;
281
- user-select: none;
282
- display: grid;
283
- place-content: center;
284
- line-height: 1.2;
285
- font-weight: bold;
286
- transition: box-shadow 200ms linear, background-color 200ms linear;
287
- position: relative;
288
- min-height: 40px;
289
- min-width: 160px;
290
-
291
- @media (hover: hover) {
292
- :hover {
293
- background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
294
- if (isDisabled) {
295
- return theme.backgroundColorPrimaryAlpha;
296
- }
297
- switch (level) {
298
- case 0:
299
- return theme.backgroundColorSecondary;
300
-
301
- case 1:
302
- return theme.backgroundColorTertiary;
303
-
304
- case 2:
305
- return theme.backgroundColorQuaternary;
306
-
307
- case 3:
308
- return theme.backgroundColorPrimary;
309
-
310
- default:
311
- return theme.backgroundColorSecondary;
312
- }
313
- }};
314
- }
315
- }
316
-
317
- :active {
318
- box-shadow: ${({theme: theme, isDisabled: isDisabled}) => {
319
- if (isDisabled) {
320
- return "0px 8px 8px 0px " + theme.boxShadowUmbraColor;
321
- }
322
- return "0px 3px 3px 0px " + theme.boxShadowUmbraColor;
323
- }};
324
- }
325
- `;
326
-
327
- const StyledPureButtonDiv = styled(StyledPureButton).attrs({
328
- as: "div"
329
- })`
330
- background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
331
- if (isDisabled) {
332
- return "";
333
- }
334
- switch (level) {
335
- case 0:
336
- return theme.backgroundColorSecondary;
337
-
338
- case 1:
339
- return theme.backgroundColorTertiary;
340
-
341
- case 2:
342
- return theme.backgroundColorQuaternary;
343
-
344
- case 3:
345
- return theme.backgroundColorPrimary;
346
-
347
- default:
348
- return theme.backgroundColorSecondary;
349
- }
350
- }};
351
- box-shadow: 0px 3px 3px 0px ${({theme: theme}) => theme.boxShadowUmbraColor};
352
- `;
353
-
354
- const PureButton$1 = properties => {
355
- const {text: text, atClick: atClick, theme: themeProperty, level: levelProperty, size: sizeProperty, disabled: disabled, loading: loading, style: style, className: className} = properties;
356
- const theme = themeProperty || plurid;
357
- const level = levelProperty ?? 0;
358
- const size = sizeProperty || "normal";
359
- if (loading) {
360
- return React.createElement(StyledPureButtonDiv, {
361
- style: {
362
- ...style
363
- },
364
- className: className,
365
- theme: theme,
366
- level: level,
367
- size: size,
368
- isDisabled: disabled
369
- }, React.createElement(Spinner$1, {
370
- theme: theme,
371
- size: "small"
372
- }));
373
- }
374
- return React.createElement(StyledPureButton, {
375
- onClick: event => disabled ? null : atClick(event),
376
- style: {
377
- ...style
378
- },
379
- className: className,
380
- theme: theme,
381
- level: level,
382
- size: size,
383
- isDisabled: disabled
384
- }, text);
385
- };
386
-
387
- const StyledLinkButton = styled.button`
388
- font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
389
-
390
- color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
391
- if (isDisabled) {
392
- return theme.backgroundColorPrimaryAlpha;
393
- }
394
- switch (level) {
395
- case 0:
396
- return theme.colorPrimary;
397
-
398
- case 1:
399
- return theme.colorSecondary;
400
-
401
- case 2:
402
- return theme.colorTertiary;
403
-
404
- default:
405
- return theme.colorPrimary;
406
- }
407
- }};
408
- margin: ${({inline: inline}) => {
409
- if (inline) {
410
- return "0";
411
- }
412
- return "0 1rem";
413
- }};
414
- padding: ${({inline: inline}) => {
415
- if (inline) {
416
- return "0";
417
- }
418
- return "initial";
419
- }};
420
- font-size: ${({inline: inline}) => {
421
- if (inline) {
422
- return "inherit";
423
- }
424
- return "0.9rem";
425
- }};
426
- display: ${({inline: inline}) => {
427
- if (inline) {
428
- return "inline";
429
- }
430
- return "grid";
431
- }};
432
- cursor: ${({isDisabled: isDisabled}) => {
433
- if (isDisabled) {
434
- return "inherit";
435
- }
436
- return "pointer";
437
- }};
438
- border: none;
439
- border-bottom: 1px solid ${({isActive: isActive, theme: theme}) => {
440
- if (isActive) {
441
- return theme.colorPrimary;
442
- }
443
- return "transparent";
444
- }};
445
-
446
- font-weight: bold;
447
- background: transparent;
448
- place-content: center;
449
- user-select: none;
450
- outline: none;
451
- `;
452
-
453
- const StyledLinkButtonLoading = styled.div`
454
- position: relative;
455
- min-height: 1rem;
456
- height: 100%;
457
- width: 100%;
458
- `;
459
-
460
- const DEFAULT_LEVEL$1 = 0;
461
-
462
- const LinkButton$1 = properties => {
463
- const {text: text, atClick: atClick, theme: themeProperty, level: levelProperty, inline: inline, disabled: disabled, loading: loading, active: active, style: style, className: className} = properties;
464
- const theme = themeProperty || plurid;
465
- const level = levelProperty ?? DEFAULT_LEVEL$1;
466
- if (loading) {
467
- return React.createElement(StyledLinkButtonLoading, null, React.createElement(Spinner$1, {
468
- size: "small",
469
- theme: theme
470
- }));
471
- }
472
- return React.createElement(StyledLinkButton, {
473
- onClick: event => disabled ? null : atClick(event),
474
- style: {
475
- ...style
476
- },
477
- className: className,
478
- theme: theme,
479
- level: level,
480
- inline: inline,
481
- isDisabled: disabled,
482
- isActive: active
483
- }, text);
484
- };
485
-
486
- const StyledRefreshButton = styled.div`
487
- `;
488
-
489
- const RefreshButton$1 = properties => {
490
- const {atClick: atClick, theme: themeProperty, text: textProperty, disabled: disabled, hideAtClick: hideAtClickProperty, hideTime: hideTimeProperty} = properties;
491
- const theme = themeProperty || plurid;
492
- const text = textProperty || "";
493
- const hideAtClick = hideAtClickProperty ?? true;
494
- const hideTime = hideTimeProperty || 1300;
495
- const isMounted = useRef(true);
496
- const [showIconReset, setShowIconReset] = useState(true);
497
- const atClickHandler = event => {
498
- if (disabled) {
499
- return;
500
- }
501
- if (hideAtClick) {
502
- setShowIconReset(false);
503
- }
504
- atClick(event);
505
- if (hideAtClick) {
506
- setTimeout((() => {
507
- if (!isMounted.current) {
508
- return;
509
- }
510
- setShowIconReset(true);
511
- }), hideTime);
512
- }
513
- };
514
- useEffect((() => () => {
515
- isMounted.current = false;
516
- }), []);
517
- return React.createElement(StyledRefreshButton, {
518
- theme: theme
519
- }, showIconReset && React.createElement(PluridIconReset, {
520
- theme: theme,
521
- title: text,
522
- inactive: disabled,
523
- opacity: disabled ? .5 : 1,
524
- atClick: atClickHandler
525
- }));
526
- };
527
-
528
- const buttons = {
529
- PureButton: PureButton$1,
530
- LinkButton: LinkButton$1,
531
- RefreshButton: RefreshButton$1
532
- };
533
-
534
- const StyledFormbutton = styled.div`
535
- display: grid;
536
- grid-template-columns: 20px 1fr;
537
- grid-gap: 0.5rem;
538
- align-items: center;
539
- min-height: 2rem;
540
- user-select: none;
541
- text-decoration: none;
542
- padding: 0.3rem 0.7rem;
543
-
544
- margin: ${props => {
545
- if (props.devisible) {
546
- return "0";
547
- }
548
- return "initial";
549
- }};
550
- cursor: ${props => {
551
- if (props.inactive) {
552
- return "default";
553
- }
554
- return "pointer";
555
- }};
556
- color: ${props => props.theme.colorPrimary};
557
-
558
- :hover {
559
- background-color: ${props => {
560
- if (!props.hoverEffect) {
561
- return "initial";
562
- }
563
- if (props.inactive || props.devisible) {
564
- return "initial";
565
- }
566
- return props.theme.backgroundColorSecondary;
567
- }};
568
- }
569
- `;
570
-
571
- const StyledFormbuttonIcon = styled.div`
572
- justify-self: ${props => props.position};
573
- display: grid;
574
- place-content: center;
575
- `;
576
-
577
- const StyledFormbuttonText = styled.div`
578
- `;
579
-
580
- const Formbutton$1 = properties => {
581
- 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;
582
- const _theme = theme || plurid;
583
- const _level = level ?? 0;
584
- const _devisible = devisible ?? false;
585
- const _iconPosition = iconPosition || "left";
586
- const _inactive = inactive ?? false;
587
- const hoverEffect = hoverEffectProperty ?? true;
588
- const render = () => React.createElement(React.Fragment, null, React.createElement(StyledFormbuttonIcon, {
589
- position: _iconPosition
590
- }, React.createElement(Icon, {
591
- theme: _theme
592
- })), React.createElement(StyledFormbuttonText, null, text));
593
- const renderProperties = {
594
- style: {
595
- ...style
596
- },
597
- className: className,
598
- theme: _theme,
599
- level: _level,
600
- inactive: _inactive,
601
- devisible: _devisible,
602
- hoverEffect: hoverEffect
603
- };
604
- if (link) {
605
- return React.createElement(StyledFormbutton, {
606
- onClick: event => !_inactive ? atClick(event) : null,
607
- as: "a",
608
- href: link,
609
- target: target,
610
- ...renderProperties
611
- }, render());
612
- }
613
- return React.createElement(StyledFormbutton, {
614
- onClick: event => !_inactive ? atClick(event) : null,
615
- ...renderProperties
616
- }, render());
617
- };
618
-
619
- const StyledFormitem = styled.div`
620
- display: grid;
621
- align-items: center;
622
- min-height: 2rem;
623
- padding: 0.3rem 0.7rem;
624
- user-select: none;
625
- `;
626
-
627
- const Formitem$1 = properties => {
628
- const {theme: theme, level: level, style: style, className: className, children: children} = properties;
629
- const _theme = theme || plurid;
630
- const _level = level ?? 0;
631
- return React.createElement(StyledFormitem, {
632
- style: {
633
- ...style
634
- },
635
- className: className,
636
- theme: _theme,
637
- level: _level
638
- }, children);
639
- };
640
-
641
- const StyledFormLeftRight = styled.div`
642
- display: flex;
643
- align-items: center;
644
- justify-content: space-between;
645
- `;
646
-
647
- const FormLeftRight$1 = properties => {
648
- const {theme: theme, style: style, className: className, children: children} = properties;
649
- const _theme = theme || plurid;
650
- return React.createElement(StyledFormLeftRight, {
651
- style: {
652
- ...style
653
- },
654
- className: className,
655
- theme: _theme
656
- }, children);
657
- };
658
-
659
- const StyledFormline = styled.div`
660
- display: grid;
661
- grid-template-columns: 1fr 1fr;
662
- align-items: center;
663
- min-height: 2rem;
664
- padding: 0.3rem 0.7rem;
665
-
666
- color: ${props => props.theme.colorPrimary};
667
-
668
- @media (max-width: 800px) {
669
- grid-template-columns: ${props => {
670
- if (props.responsive) {
671
- return "1fr";
672
- }
673
- return "1fr 1fr";
674
- }};
675
- min-height: ${props => {
676
- if (props.responsive) {
677
- return "2.4rem";
678
- }
679
- return "2rem";
680
- }};
681
- justify-items: ${props => {
682
- if (props.responsive) {
683
- return "center";
684
- }
685
- return "auto";
686
- }};
687
- justify-content: ${props => {
688
- if (props.responsive) {
689
- return "center";
690
- }
691
- return "auto";
692
- }};
693
- }
694
- `;
695
-
696
- const StyledFormlineText = styled.div`
697
- user-select: none;
698
- `;
699
-
700
- const StyledFormlineElement = styled.div`
701
- justify-self: right;
702
-
703
- @media (max-width: 800px) {
704
- justify-self: ${props => {
705
- if (props.responsive) {
706
- return "center";
707
- }
708
- return "right";
709
- }};
710
- }
711
- `;
712
-
713
- const Formline$1 = properties => {
714
- const {text: text, Element: Element, theme: theme, level: level, responsive: responsive, style: style, className: className, children: children} = properties;
715
- const _theme = theme || plurid;
716
- const _level = level === undefined ? 0 : level;
717
- const _responsive = responsive === undefined ? false : responsive;
718
- return React.createElement(StyledFormline, {
719
- style: {
720
- ...style
721
- },
722
- className: className,
723
- theme: _theme,
724
- level: _level,
725
- responsive: _responsive
726
- }, React.createElement(StyledFormlineText, null, text), React.createElement(StyledFormlineElement, {
727
- responsive: _responsive
728
- }, Element ? React.createElement(Element, null) : React.createElement(React.Fragment, null, children)));
729
- };
730
-
731
- const StyledFormObliterate = styled.div`
732
- color: ${properties => properties.theme.colorPrimary};
733
- font-family: ${properties => properties.theme.fontFamilySansSerif};
734
- font-size: 0.8rem;
735
- user-select: none;
736
- `;
737
-
738
- const StyledObliterateContainer = styled.div`
739
- text-align: center;
740
- display: grid;
741
- grid-template-columns: 1fr;
742
- grid-template-rows: 30px 45px 60px;
743
- align-items: center;
744
- max-width: 200px;
745
- margin: 1rem auto;
746
- `;
747
-
748
- const FormObliterate$1 = properties => {
749
- const {atObliterate: atObliterate, item: item, theme: theme, devisible: devisible, level: level, style: style, className: className} = properties;
750
- const _theme = theme || plurid;
751
- const _level = level ?? 0;
752
- const _devisible = devisible ?? false;
753
- const [showObliterate, setShowObliterate] = useState(false);
754
- const handleObliterate = event => {
755
- setShowObliterate(false);
756
- atObliterate(event);
757
- };
758
- return React.createElement(StyledFormObliterate, {
759
- theme: _theme,
760
- level: _level,
761
- devisible: _devisible,
762
- style: {
763
- ...style
764
- },
765
- className: className
766
- }, !showObliterate && React.createElement(Formbutton$1, {
767
- theme: _theme,
768
- text: item ? `obliterate ${item}` : "obliterate",
769
- Icon: PluridIconObliterate,
770
- atClick: () => setShowObliterate(true),
771
- devisible: true
772
- }), showObliterate && React.createElement(StyledObliterateContainer, null, React.createElement("div", null, "remove forever?"), React.createElement(LinkButton$1, {
773
- theme: _theme,
774
- text: "cancel",
775
- atClick: () => setShowObliterate(false)
776
- }), React.createElement(PureButton$1, {
777
- theme: _theme,
778
- text: "Obliterate",
779
- atClick: event => handleObliterate(event)
780
- })));
781
- };
782
-
783
- const form = {
784
- Formbutton: Formbutton$1,
785
- Formitem: Formitem$1,
786
- FormLeftRight: FormLeftRight$1,
787
- Formline: Formline$1,
788
- FormObliterate: FormObliterate$1
789
- };
790
-
791
- const GlobalStyles$1 = createGlobalStyle`
792
- *, *::after, *::before {
793
- box-sizing: border-box;
794
- }
795
-
796
- html {
797
- height: 100%;
798
- min-height: 100vh;
799
- }
800
-
801
- body {
802
- font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
803
-
804
- height: 100%;
805
- margin: 0;
806
- padding: 0;
807
- -webkit-font-smoothing: antialiased;
808
- -moz-osx-font-smoothing: grayscale;
809
-
810
- color: ${({theme: theme}) => {
811
- if (theme.type === "dark") {
812
- return theme.backgroundColorBright;
813
- }
814
- return theme.colorPrimary;
815
- }};
816
- background: ${({theme: theme}) => {
817
- if (theme.type === "dark") {
818
- return theme.backgroundColorDark;
819
- }
820
- return theme.backgroundColorPrimary;
821
- }};
822
- }
823
- `;
824
-
825
- const general = {
826
- GlobalStyles: GlobalStyles$1
827
- };
828
-
829
- const setNativeValue = (element, value) => {
830
- const valueSetter = Object.getOwnPropertyDescriptor(element, "value").set;
831
- const prototype = Object.getPrototypeOf(element);
832
- const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, "value").set;
833
- if (valueSetter && valueSetter !== prototypeValueSetter) {
834
- prototypeValueSetter.call(element, value);
835
- } else {
836
- valueSetter.call(element, value);
837
- }
838
- };
839
-
840
- const StyledTextline = styled.div`
841
- position: relative;
842
- display: inline-block;
843
- width: 100%;
844
-
845
- input {
846
- box-sizing: border-box;
847
- border: none;
848
- outline: none;
849
- font-size: 0.8rem;
850
-
851
- padding: ${props => {
852
- if (props.devisible) {
853
- return "0";
854
- }
855
- return "0.6rem 1rem";
856
- }};
857
- padding-top: ${props => {
858
- if (props.devisible) {
859
- return "0";
860
- }
861
- return "0.7rem";
862
- }};
863
- min-height: ${props => {
864
- if (props.devisible) {
865
- return "initial";
866
- }
867
- return "36px";
868
- }};
869
- background-color: ${props => {
870
- if (props.devisible) {
871
- return "transparent";
872
- }
873
- switch (props.level) {
874
- case 0:
875
- return props.theme.backgroundColorPrimary;
876
-
877
- case 1:
878
- return props.theme.backgroundColorSecondary;
879
-
880
- case 2:
881
- return props.theme.backgroundColorTertiary;
882
-
883
- case 3:
884
- return props.theme.backgroundColorQuaternary;
885
-
886
- default:
887
- return props.theme.backgroundColorPrimary;
888
- }
889
- }};
890
- color: ${props => props.theme.colorPrimary};
891
- box-shadow: inset 0px 4px 4px ${props => {
892
- if (props.devisible) {
893
- return "transparent";
894
- }
895
- return props.theme.boxShadowUmbraColor;
896
- }};
897
- border-radius: ${props => {
898
- if (props.devisible) {
899
- return "0";
900
- }
901
- if (props.round) {
902
- return "1000px";
903
- }
904
- return "0px";
905
- }};
906
- width: ${props => {
907
- if (!props.width) {
908
- return "100%";
909
- }
910
- if (typeof props.width === "number") {
911
- return props.width + "px";
912
- }
913
- return props.width;
914
- }};
915
- text-align: ${props => {
916
- if (props.center) {
917
- return "center";
918
- }
919
- return "left";
920
- }};
921
-
922
- ::placeholder {
923
- color: ${props => props.theme.colorSecondary};
924
- }
925
- }
926
- `;
927
-
928
- const StyledEnterIcon = styled.div`
929
- position: absolute;
930
- top: 50%;
931
- transform: translateY(-50%);
932
- height: 20px;
933
- width: 20px;
934
- border-radius: 100px;
935
- display: flex;
936
- align-items: center;
937
- justify-content: center;
938
- font-size: 0.9rem;
939
- user-select: none;
940
- cursor: pointer;
941
- border: 1px solid transparent;
942
-
943
- right: ${props => {
944
- if (props.left) {
945
- return "auto";
946
- }
947
- return "0.6rem";
948
- }};
949
- left: ${props => {
950
- if (props.left) {
951
- return "0.6rem";
952
- }
953
- return "auto";
954
- }};
955
- color: ${props => props.theme.colorPrimary};
956
-
957
- :hover {
958
- border: 1px solid ${props => props.theme.colorPrimary};
959
- }
960
- `;
961
-
962
- const StyledErrorLine = styled.div`
963
- position: absolute;
964
- background-color: #FF0000;
965
- bottom: -2px;
966
-
967
- height: ${props => {
968
- if (props.devisible) {
969
- return "2px";
970
- }
971
- return "4px";
972
- }};
973
- left: ${props => {
974
- if (props.devisible) {
975
- return "0";
976
- }
977
- if (!props.round) {
978
- return "0";
979
- }
980
- return "14px";
981
- }};
982
- right: ${props => {
983
- if (props.devisible) {
984
- return "0";
985
- }
986
- if (!props.round) {
987
- return "0";
988
- }
989
- return "14px";
990
- }};
991
- border-radius: ${props => {
992
- if (props.devisible) {
993
- return "0";
994
- }
995
- if (props.round) {
996
- return "10px";
997
- }
998
- return "0px";
999
- }};
1000
- box-shadow: 0px 1px 3px 0px ${props => {
1001
- if (props.devisible) {
1002
- return "initial";
1003
- }
1004
- return props.theme.boxShadowUmbraColor;
1005
- }};
1006
- `;
1007
-
1008
- const Textline$1 = forwardRef(((properties, reference) => {
1009
- 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, enterEmpty: enterEmpty, enterAtClick: enterAtClick, escapeClear: escapeClear, ariaLabel: ariaLabel} = properties;
1010
- const _type = type || "text";
1011
- const _theme = theme || plurid;
1012
- const _level = level ?? 0;
1013
- const _round = round ?? true;
1014
- const inputElement = useRef();
1015
- const handleKeyDown = event => {
1016
- if (!inputElement.current) {
1017
- return;
1018
- }
1019
- if (atKeyDown) {
1020
- atKeyDown(event);
1021
- }
1022
- if (enterAtClick && event.key === "Enter") {
1023
- enterAtClick();
1024
- }
1025
- if (escapeClear && event.key === "Escape" && inputElement.current) {
1026
- setNativeValue(inputElement.current, "");
1027
- const _event = new Event("input", {
1028
- bubbles: true
1029
- });
1030
- inputElement.current.dispatchEvent(_event);
1031
- }
1032
- };
1033
- const showEnterIcon = enterAtClick && (text.length > 0 || enterEmpty);
1034
- return React.createElement(StyledTextline, {
1035
- theme: _theme,
1036
- level: _level,
1037
- devisible: devisible,
1038
- center: center,
1039
- round: _round,
1040
- width: width,
1041
- className: className
1042
- }, React.createElement("input", {
1043
- type: _type,
1044
- value: text,
1045
- onChange: event => {
1046
- atChange(event, event.target.value);
1047
- },
1048
- onKeyDown: handleKeyDown,
1049
- onFocus: atFocus,
1050
- onBlur: atBlur,
1051
- placeholder: placeholder,
1052
- autoCapitalize: autoCapitalize,
1053
- autoComplete: autoComplete,
1054
- autoCorrect: autoCorrect,
1055
- spellCheck: spellCheck,
1056
- "aria-label": ariaLabel,
1057
- style: {
1058
- ...style,
1059
- paddingRight: showEnterIcon ? "35px" : undefined
1060
- },
1061
- ref: mergeReferences(inputElement, reference)
1062
- }), error && React.createElement(StyledErrorLine, {
1063
- theme: _theme,
1064
- devisible: devisible,
1065
- round: _round
1066
- }), showEnterIcon && React.createElement(StyledEnterIcon, {
1067
- theme: _theme,
1068
- onClick: () => enterAtClick(),
1069
- left: enterIconLeft
1070
- }, "➔"));
1071
- }));
1072
-
1073
- const StyledDropdown = styled.div`
1074
- color: ${props => props.theme.colorPrimary};
1075
- text-align: ${props => {
1076
- if (props.left) {
1077
- return "left";
1078
- }
1079
- return "right";
1080
- }};
1081
- font-size: 1rem;
1082
-
1083
- position: relative;
1084
- `;
1085
-
1086
- const StyledDropdownSelected = styled.div`
1087
- cursor: pointer;
1088
- user-select: none;
1089
- color: ${props => {
1090
- if (props.selectedColor) {
1091
- return props.selectedColor;
1092
- }
1093
- return props.theme.colorPrimary;
1094
- }};
1095
- `;
1096
-
1097
- const StyledDropdownList = styled.div`
1098
- font-size: 0.85rem;
1099
-
1100
- background: ${props => {
1101
- switch (props.level) {
1102
- case 0:
1103
- return props.theme.backgroundColorPrimary;
1104
-
1105
- case 1:
1106
- return props.theme.backgroundColorSecondary;
1107
-
1108
- case 2:
1109
- return props.theme.backgroundColorTertiary;
1110
-
1111
- case 3:
1112
- return props.theme.backgroundColorQuaternary;
1113
-
1114
- default:
1115
- return props.theme.backgroundColorPrimary;
1116
- }
1117
- }};
1118
- color: ${props => props.theme.colorPrimary};
1119
- position: absolute;
1120
- left: ${props => {
1121
- if (props.left) {
1122
- return "0px";
1123
- }
1124
- return "auto";
1125
- }};
1126
- right: ${props => {
1127
- if (props.left) {
1128
- return "auto";
1129
- }
1130
- return "0px";
1131
- }};
1132
- top: ${props => {
1133
- if (props.listTop) {
1134
- return props.listTop;
1135
- }
1136
- return "25px";
1137
- }};
1138
- height: ${props => {
1139
- if (props.heightItems) {
1140
- const value = props.heightItems * 2 + "rem";
1141
- if (props.heightBeyond) {
1142
- return `calc(${value} + 1rem)`;
1143
- }
1144
- return value;
1145
- }
1146
- return "initial";
1147
- }};
1148
- overflow: ${props => {
1149
- if (props.heightItems) {
1150
- return "scroll";
1151
- }
1152
- return "initial";
1153
- }};
1154
-
1155
- /* Hide Scrollbar */
1156
- scrollbar-width: none; /* Firefox 64 */
1157
- -ms-overflow-style: none; /* Internet Explorer 11 */
1158
- ::-webkit-scrollbar { /** WebKit */
1159
- display: none;
1160
- }
1161
- width: ${props => {
1162
- if (props.width) {
1163
- if (typeof props.width === "number") {
1164
- return props.width + "px";
1165
- }
1166
- if (typeof props.width === "string") {
1167
- return props.width;
1168
- }
1169
- }
1170
- return "initial";
1171
- }};
1172
-
1173
- border-radius: 10px;
1174
- min-width: 60px;
1175
-
1176
- z-index: 9998;
1177
- box-shadow: 0px 3px 5px 1px hsla(327, 94%, 10%, 0.7);
1178
-
1179
- ul {
1180
- margin: 0;
1181
- padding: 0;
1182
- list-style: none;
1183
- }
1184
-
1185
- ul li {
1186
- box-sizing: border-box;
1187
- padding: 0.3rem 0.6rem;
1188
- user-select: none;
1189
- cursor: pointer;
1190
- min-height: 2rem;
1191
- display: grid;
1192
- align-items: center;
1193
- word-break: break-all;
1194
- justify-content: ${props => {
1195
- if (props.left) {
1196
- return "left";
1197
- }
1198
- return "right";
1199
- }};
1200
- }
1201
-
1202
- ul li:hover {
1203
- background: ${props => {
1204
- if (props.level === 2) {
1205
- return props.theme.backgroundColorSecondary;
1206
- }
1207
- return props.theme.backgroundColorTertiary;
1208
- }};
1209
- }
1210
-
1211
- ul li:first-child {
1212
- border-top-right-radius: 10px;
1213
- border-top-left-radius: 10px;
1214
- }
1215
-
1216
- ul li:last-child {
1217
- border-bottom-right-radius: 10px;
1218
- border-bottom-left-radius: 10px;
1219
- }
1220
- `;
1221
-
1222
- const StyledFilterable = styled.div`
1223
- position: relative;
1224
-
1225
- input {
1226
- text-align: ${props => {
1227
- if (props.left) {
1228
- return "left !important";
1229
- }
1230
- return "right !important";
1231
- }};
1232
- }
1233
- `;
1234
-
1235
- const StyledFilterUpdate = styled.div`
1236
- position: absolute;
1237
- z-index: 9999;
1238
- top: 0;
1239
- left: ${props => {
1240
- if (props.left) {
1241
- return "auto";
1242
- }
1243
- return "0";
1244
- }};
1245
- right: ${props => {
1246
- if (props.left) {
1247
- return "0";
1248
- }
1249
- return "auto";
1250
- }};
1251
- `;
1252
-
1253
- const Dropdown$1 = properties => {
1254
- const {selected: selected, selectables: selectables, atSelect: atSelect, left: left, kind: kind, listTop: listTop, dropdownToggled: dropdownToggled, dropdownSign: dropdownSign, 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;
1255
- const _generalTheme = generalThemeProperty === undefined ? themeProperty === undefined ? plurid : themeProperty : generalThemeProperty;
1256
- const _interactionTheme = interactionThemeProperty === undefined ? themeProperty === undefined ? plurid : themeProperty : interactionThemeProperty;
1257
- const _level = level ?? 0;
1258
- const _hideAtSelect = hideAtSelect ?? true;
1259
- const _selectAtHover = selectAtHover ?? false;
1260
- const _dropdownSign = typeof dropdownSign === "string" ? dropdownSign : !dropdownSign ? "" : "▼";
1261
- const isMounted = useRef(true);
1262
- const filterInput = useRef(null);
1263
- const [generalTheme, setGeneralTheme] = useState(_generalTheme);
1264
- const [interactionTheme, setInteractionTheme] = useState(_interactionTheme);
1265
- const [showList, setShowList] = useState(false);
1266
- const [selectedBackgroundColor, setSelectedBackgroundColor] = useState(interactionTheme.backgroundColorTertiary);
1267
- const [filterValue, setFilterValue] = useState("");
1268
- const [filteredSelectables, setFilteredSelectables] = useState([ ...selectables ]);
1269
- const [showFilterUpdate, setShowFilterUpdate] = useState(!!filterUpdate);
1270
- const [arrowIndex, setArrowIndex] = useState(-1);
1271
- const select = selected => {
1272
- kind ? atSelect(selected, kind) : atSelect(selected);
1273
- };
1274
- const handleSelect = selected => {
1275
- select(selected);
1276
- if (_hideAtSelect) {
1277
- setShowList(false);
1278
- }
1279
- };
1280
- const handleHover = selected => {
1281
- if (_selectAtHover) {
1282
- select(selected);
1283
- }
1284
- };
1285
- const handleFiltering = event => {
1286
- const {value: value} = event.target;
1287
- const filterValue = value.toLowerCase();
1288
- const filteredSelectables = selectables.filter((selectable => {
1289
- if (typeof selectable === "string") {
1290
- const filterSelectable = selectable.toLowerCase();
1291
- if (selectable.toLowerCase().startsWith(filterValue)) {
1292
- return true;
1293
- }
1294
- const split = filterSelectable.split(" ");
1295
- for (const element of split) {
1296
- if (element.startsWith(filterValue)) {
1297
- return true;
1298
- }
1299
- }
1300
- return false;
1301
- }
1302
- const filterSelectable = selectable.value.toLowerCase();
1303
- if (filterSelectable.startsWith(filterValue)) {
1304
- return true;
1305
- }
1306
- const split = filterSelectable.split(" ");
1307
- for (const element of split) {
1308
- if (element.startsWith(filterValue)) {
1309
- return true;
1310
- }
1311
- }
1312
- return false;
1313
- }));
1314
- setFilterValue(value);
1315
- setFilteredSelectables(filteredSelectables);
1316
- itemsReferences.current = filteredSelectables.reduce(((accumulator, _, index) => {
1317
- accumulator[index] = React.createRef();
1318
- return accumulator;
1319
- }), {});
1320
- };
1321
- const focusFilterInput = () => {
1322
- setTimeout((() => {
1323
- if (filterInput.current) {
1324
- filterInput.current.focus();
1325
- }
1326
- }), 100);
1327
- };
1328
- const itemsReferences = useRef(filteredSelectables.reduce(((accumulator, _, index) => {
1329
- accumulator[index] = React.createRef();
1330
- return accumulator;
1331
- }), {}));
1332
- useEffect((() => {
1333
- if (!dropdownToggled) {
1334
- setShowList(false);
1335
- }
1336
- }), [ dropdownToggled ]);
1337
- useEffect((() => {
1338
- if (_level === 2) {
1339
- setSelectedBackgroundColor(interactionTheme.backgroundColorSecondary);
1340
- } else {
1341
- setSelectedBackgroundColor(interactionTheme.backgroundColorTertiary);
1342
- }
1343
- }), [ _level, interactionTheme ]);
1344
- useEffect((() => {
1345
- const generalTheme = generalThemeProperty === undefined ? themeProperty === undefined ? plurid : themeProperty : generalThemeProperty;
1346
- const interactionTheme = interactionThemeProperty === undefined ? themeProperty === undefined ? plurid : themeProperty : interactionThemeProperty;
1347
- setGeneralTheme(generalTheme);
1348
- setInteractionTheme(interactionTheme);
1349
- }), [ themeProperty, generalThemeProperty, interactionThemeProperty ]);
1350
- useEffect((() => {
1351
- const scrollTo = index => {
1352
- if (itemsReferences.current[index].current) {
1353
- itemsReferences.current[index].current.scrollIntoView({
1354
- behavior: "smooth",
1355
- block: "start"
1356
- });
1357
- }
1358
- };
1359
- const handleArrows = event => {
1360
- if (event.key === "ArrowUp") {
1361
- const newIndex = arrowIndex - 1;
1362
- if (newIndex >= 0) {
1363
- setArrowIndex(newIndex);
1364
- scrollTo(newIndex);
1365
- }
1366
- }
1367
- if (event.key === "ArrowDown") {
1368
- const newIndex = arrowIndex + 1;
1369
- if (newIndex < filteredSelectables.length) {
1370
- setArrowIndex(newIndex);
1371
- scrollTo(newIndex);
1372
- }
1373
- }
1374
- if (event.key === "Enter") {
1375
- const selected = filteredSelectables[arrowIndex];
1376
- if (selected) {
1377
- atSelect(selected);
1378
- setArrowIndex(-1);
1379
- if (_hideAtSelect) {
1380
- setShowList(false);
1381
- }
1382
- }
1383
- }
1384
- };
1385
- const handleScroll = () => {
1386
- setArrowIndex(-1);
1387
- };
1388
- if (showList) {
1389
- window.addEventListener("keydown", handleArrows);
1390
- window.addEventListener("wheel", handleScroll);
1391
- } else {
1392
- setArrowIndex(-1);
1393
- }
1394
- return () => {
1395
- if (showList) {
1396
- window.removeEventListener("keydown", handleArrows);
1397
- window.removeEventListener("wheel", handleScroll);
1398
- }
1399
- };
1400
- }), [ arrowIndex, showList ]);
1401
- useEffect((() => () => {
1402
- isMounted.current = false;
1403
- }), []);
1404
- useEffect((() => {
1405
- setFilteredSelectables([ ...selectables ]);
1406
- }), [ selectables.length ]);
1407
- return React.createElement(StyledDropdown, {
1408
- theme: interactionTheme,
1409
- left: left,
1410
- style: {
1411
- ...style
1412
- },
1413
- className: className
1414
- }, React.createElement(StyledDropdownSelected, {
1415
- onClick: () => {
1416
- setShowList(!showList);
1417
- if (setDropdownToggled) {
1418
- setDropdownToggled(kind);
1419
- }
1420
- if (!showList && filterable) {
1421
- focusFilterInput();
1422
- }
1423
- },
1424
- theme: generalTheme,
1425
- selectedColor: selectedColor
1426
- }, typeof selected === "string" ? selected : selected.value, _dropdownSign && React.createElement(React.Fragment, null, " ", _dropdownSign)), showList && React.createElement(StyledDropdownList, {
1427
- theme: interactionTheme,
1428
- left: left,
1429
- listTop: listTop,
1430
- level: _level,
1431
- heightItems: heightItems && filterable && filteredSelectables.length < heightItems ? filteredSelectables.length + 1 : heightItems,
1432
- heightBeyond: filteredSelectables.length > (heightItems || 0),
1433
- width: width
1434
- }, React.createElement("ul", null, filterable && React.createElement("li", {
1435
- style: {
1436
- backgroundColor: interactionTheme.backgroundColorTertiary,
1437
- boxShadow: interactionTheme.boxShadowPenumbraInset
1438
- }
1439
- }, React.createElement(StyledFilterable, {
1440
- left: left
1441
- }, filterUpdate && showFilterUpdate && React.createElement(StyledFilterUpdate, {
1442
- left: left
1443
- }, React.createElement(PluridIconReset, {
1444
- theme: interactionTheme,
1445
- atClick: () => {
1446
- setShowFilterUpdate(false);
1447
- filterUpdate();
1448
- setTimeout((() => {
1449
- if (!isMounted.current) {
1450
- return;
1451
- }
1452
- setShowFilterUpdate(true);
1453
- }), 5300);
1454
- }
1455
- })), React.createElement(Textline$1, {
1456
- ref: filterInput,
1457
- theme: interactionTheme,
1458
- text: filterValue,
1459
- atChange: handleFiltering,
1460
- devisible: true,
1461
- spellCheck: false,
1462
- autoCapitalize: "false",
1463
- autoComplete: "false",
1464
- autoCorrect: "false",
1465
- style: {
1466
- padding: !!filterUpdate ? left ? "0 1.3rem 0 0" : "0 0 0 1.3rem" : "0"
1467
- }
1468
- }))), filteredSelectables.map(((selectable, index) => {
1469
- let selectableID = typeof selectable === "string" ? selectable : selectable.id;
1470
- let selectableValue = typeof selectable === "string" ? selectable : selectable.value;
1471
- let isSelected = false;
1472
- if (typeof selected === "string") {
1473
- if (selected === selectableID) {
1474
- isSelected = true;
1475
- }
1476
- } else {
1477
- if (selected.id === selectableID) {
1478
- isSelected = true;
1479
- }
1480
- }
1481
- if (arrowIndex === index) {
1482
- isSelected = true;
1483
- }
1484
- return React.createElement("li", {
1485
- ref: itemsReferences.current[index],
1486
- key: selectableID,
1487
- onClick: () => handleSelect(selectable),
1488
- onMouseEnter: () => handleHover(selectable),
1489
- style: {
1490
- backgroundColor: isSelected ? selectedBackgroundColor : ""
1491
- }
1492
- }, selectableValue);
1493
- })))));
1494
- };
1495
-
1496
- const StyledEntityPill = styled.div`
1497
- background-color: ${({theme: theme}) => theme.backgroundColorTertiary};
1498
- box-shadow: ${({theme: theme}) => theme.boxShadowUmbra};
1499
-
1500
- padding: 0.5rem 1rem;
1501
- margin: 0.5rem;
1502
- border-radius: 20px;
1503
-
1504
- display: flex;
1505
- align-items: center;
1506
- `;
1507
-
1508
- const EntityPill$1 = properties => {
1509
- const {id: id, remove: remove, text: text, theme: theme, style: style} = properties;
1510
- const textValue = text || id;
1511
- return React.createElement(StyledEntityPill, {
1512
- theme: theme || plurid,
1513
- style: {
1514
- ...style
1515
- }
1516
- }, React.createElement("div", {
1517
- style: {
1518
- marginRight: "0.5rem"
1519
- }
1520
- }, textValue), React.createElement(PluridIconDelete, {
1521
- theme: theme,
1522
- atClick: () => remove(id)
1523
- }));
1524
- };
1525
-
1526
- const StyledEntityPillGroup = styled.div`
1527
- display: flex;
1528
- flex-flow: wrap;
1529
- margin: 0 auto;
1530
- justify-content: center;
1531
- `;
1532
-
1533
- const EntityPillGroup$1 = properties => {
1534
- const {entities: entities, remove: remove, keyFix: keyFix, theme: theme, style: style, pillStyle: pillStyle} = properties;
1535
- return React.createElement(StyledEntityPillGroup, {
1536
- theme: theme,
1537
- style: {
1538
- ...style
1539
- }
1540
- }, entities.map((entity => {
1541
- const stringEntity = typeof entity === "string";
1542
- const id = stringEntity ? entity : entity.id;
1543
- const text = stringEntity ? undefined : entity.text;
1544
- return React.createElement(EntityPill$1, {
1545
- key: `entity-pill-${id}${keyFix || ""}`,
1546
- id: id,
1547
- text: text,
1548
- remove: remove,
1549
- theme: theme || plurid,
1550
- style: pillStyle
1551
- });
1552
- })));
1553
- };
1554
-
1555
- const StyledInputDescriptor = styled.div`
1556
- text-align: left;
1557
- font-size: 0.9rem;
1558
- line-height: 1;
1559
- min-height: 1.1rem;
1560
- margin-top: 1.3rem;
1561
- margin-bottom: 0.4rem;
1562
- margin-left: 0.9rem;
1563
-
1564
- font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
1565
- color: ${({theme: theme}) => theme.colorPrimary};
1566
- `;
1567
-
1568
- const InputDescriptor$1 = properties => {
1569
- const {name: name, show: show, theme: themeProperty, style: style, className: className} = properties;
1570
- const theme = themeProperty || plurid;
1571
- return React.createElement(StyledInputDescriptor, {
1572
- theme: theme,
1573
- className: className,
1574
- style: {
1575
- ...style
1576
- }
1577
- }, show && React.createElement(React.Fragment, null, name));
1578
- };
1579
-
1580
- const StyledInputBox = styled.div`
1581
- textarea {
1582
- box-sizing: border-box;
1583
- width: 100%;
1584
- min-height: 5rem;
1585
- resize: vertical;
1586
- outline: none;
1587
- border: none;
1588
- padding: 0.9rem;
1589
- font-size: 0.8rem;
1590
- border-radius: 0.9rem;
1591
- line-height: 1.5;
1592
-
1593
- font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
1594
- color: ${({theme: theme}) => theme.colorPrimary};
1595
- background-color: ${({theme: theme}) => theme.backgroundColorTertiary};
1596
- box-shadow: inset 0px 4px 4px ${({theme: theme}) => theme.boxShadowUmbraColor};
1597
-
1598
-
1599
- ::placeholder {
1600
- color: ${({theme: theme}) => theme.colorSecondary};
1601
- }
1602
- }
1603
- `;
1604
-
1605
- const StyledTextBox = styled.div`
1606
- `;
1607
-
1608
- const InputBox$1 = properties => {
1609
- const {text: text, name: name, atChange: atChange, theme: themeProperty, style: style, className: className, atKeyDown: atKeyDown} = properties;
1610
- const theme = themeProperty || plurid;
1611
- return React.createElement(StyledInputBox, {
1612
- theme: theme,
1613
- className: className,
1614
- style: {
1615
- ...style
1616
- }
1617
- }, React.createElement(InputDescriptor$1, {
1618
- name: name,
1619
- show: text !== "",
1620
- theme: theme
1621
- }), React.createElement(StyledTextBox, {
1622
- theme: theme
1623
- }, React.createElement("textarea", {
1624
- value: text,
1625
- placeholder: name,
1626
- onChange: event => atChange(event),
1627
- onKeyDown: event => atKeyDown ? atKeyDown(event) : null,
1628
- spellCheck: false,
1629
- autoCapitalize: "false",
1630
- autoComplete: "false",
1631
- autoCorrect: "false"
1632
- })));
1633
- };
1634
-
1635
- const StyledInputLine = styled.div`
1636
- width: 350px;
1637
- `;
1638
-
1639
- const InputLine$1 = properties => {
1640
- const {name: name, text: text, atChange: atChange, theme: themeProperty, type: type, error: error, textline: textline, style: style, className: className, atKeyDown: atKeyDown} = properties;
1641
- const theme = themeProperty || plurid;
1642
- return React.createElement(StyledInputLine, {
1643
- theme: theme,
1644
- style: {
1645
- ...style
1646
- },
1647
- className: className
1648
- }, React.createElement(InputDescriptor$1, {
1649
- name: name,
1650
- show: text !== "",
1651
- theme: theme
1652
- }), React.createElement(Textline$1, {
1653
- text: text,
1654
- type: type,
1655
- placeholder: name,
1656
- theme: theme,
1657
- level: 2,
1658
- error: error,
1659
- spellCheck: false,
1660
- autoCapitalize: "false",
1661
- autoComplete: "false",
1662
- autoCorrect: "false",
1663
- atChange: atChange,
1664
- atKeyDown: atKeyDown,
1665
- ...textline
1666
- }));
1667
- };
1668
-
1669
- const StyledSwitch = styled.label`
1670
- position: relative;
1671
- display: inline-block;
1672
- width: 60px;
1673
- height: 34px;
1674
-
1675
- input {
1676
- opacity: 0;
1677
- width: 0;
1678
- height: 0;
1679
- }
1680
- `;
1681
-
1682
- const levelBackgroundColor = props => {
1683
- switch (props.level) {
1684
- case 0:
1685
- return props.theme.backgroundColorPrimary;
1686
-
1687
- case 1:
1688
- return props.theme.backgroundColorSecondary;
1689
-
1690
- case 2:
1691
- return props.theme.backgroundColorTertiary;
1692
-
1693
- case 3:
1694
- return props.theme.backgroundColorQuaternary;
1695
-
1696
- default:
1697
- return props.theme.backgroundColorPrimary;
1698
- }
1699
- };
1700
-
1701
- const backgroundColor = props => {
1702
- if (props.accent) {
1703
- return props.accent;
1704
- }
1705
- if (props.exclusive && !props.checked) {
1706
- switch (props.level) {
1707
- case 0:
1708
- return props.theme.backgroundColorPrimaryAlpha;
1709
-
1710
- case 1:
1711
- return props.theme.backgroundColorSecondaryAlpha;
1712
-
1713
- case 2:
1714
- return props.theme.backgroundColorTertiaryAlpha;
1715
-
1716
- case 3:
1717
- return props.theme.backgroundColorQuaternaryAlpha;
1718
-
1719
- default:
1720
- return props.theme.backgroundColorPrimaryAlpha;
1721
- }
1722
- }
1723
- return levelBackgroundColor(props);
1724
- };
1725
-
1726
- const StyledSwitchSlider = styled.span`
1727
- position: absolute;
1728
- cursor: pointer;
1729
- top: 0;
1730
- left: 0;
1731
- right: 0;
1732
- bottom: 0;
1733
- transition: .4s ease-in-out;
1734
- box-shadow: inset 0 2px 3px black;
1735
-
1736
- background-color: ${props => backgroundColor(props)};
1737
- border-radius: ${props => {
1738
- if (props.round) {
1739
- return "34px";
1740
- }
1741
- return "0";
1742
- }};
1743
-
1744
- :before {
1745
- position: absolute;
1746
- content: "";
1747
- height: 26px;
1748
- width: 26px;
1749
- left: 4px;
1750
- bottom: 4px;
1751
- transition: .4s;
1752
-
1753
- background-color: ${props => props.theme.colorPrimary};
1754
- border-radius: ${props => {
1755
- if (props.round) {
1756
- return "50%";
1757
- }
1758
- return "0";
1759
- }};
1760
- transform: ${props => {
1761
- if (props.checked) {
1762
- return "translateX(26px)";
1763
- }
1764
- return "translateX(0px)";
1765
- }};
1766
- }
1767
- `;
1768
-
1769
- const StyledSwitchIcon = styled.div`
1770
- height: 100%;
1771
- position: absolute;
1772
- top: 0;
1773
- display: flex;
1774
- align-items: center;
1775
- transition: .4s;
1776
-
1777
- svg {
1778
- fill: ${props => levelBackgroundColor(props)};
1779
- }
1780
- `;
1781
-
1782
- const Switch$1 = properties => {
1783
- const {checked: checked, theme: theme, level: level, round: round, exclusive: exclusive, accent: accent, Icon: Icon, atChange: atChange} = properties;
1784
- const _theme = theme || plurid;
1785
- const _level = level === undefined ? 0 : level;
1786
- const _round = round === undefined ? true : round;
1787
- const commonProperties = {
1788
- theme: _theme,
1789
- level: _level,
1790
- exclusive: exclusive,
1791
- checked: checked,
1792
- accent: accent
1793
- };
1794
- return React.createElement(StyledSwitch, {
1795
- theme: _theme
1796
- }, React.createElement("input", {
1797
- type: "checkbox",
1798
- checked: checked,
1799
- onChange: () => atChange()
1800
- }), React.createElement(StyledSwitchSlider, {
1801
- round: _round,
1802
- ...commonProperties
1803
- }), Icon && React.createElement(StyledSwitchIcon, {
1804
- ...commonProperties,
1805
- style: {
1806
- left: checked ? "35px" : "9px"
1807
- }
1808
- }, React.createElement(Icon, null)));
1809
- };
1810
-
1811
- const StyledInputSwitch = styled.div`
1812
- font-size: 0.9rem;
1813
-
1814
- margin-top: ${({compact: compact}) => {
1815
- if (compact) {
1816
- return "1rem";
1817
- }
1818
- return "2.2rem";
1819
- }};
1820
- `;
1821
-
1822
- const InputSwitch$1 = properties => {
1823
- const {name: name, checked: checked, atChange: atChange, theme: themeProperty, compact: compact, switch: switchProperties, style: style, className: className} = properties;
1824
- const theme = themeProperty || plurid;
1825
- return React.createElement(StyledInputSwitch, {
1826
- compact: compact,
1827
- style: {
1828
- ...style
1829
- },
1830
- className: className
1831
- }, React.createElement(FormLeftRight$1, null, React.createElement("div", {
1832
- style: {
1833
- marginLeft: "0.9rem"
1834
- }
1835
- }, name), React.createElement(Switch$1, {
1836
- checked: checked,
1837
- level: 2,
1838
- exclusive: true,
1839
- theme: theme,
1840
- atChange: () => atChange(),
1841
- ...switchProperties
1842
- })));
1843
- };
1844
-
1845
- const StyledItemsline = styled.div`
1846
- padding: 0 0.7rem;
1847
- font-size: 0.9rem;
1848
-
1849
- ul {
1850
- list-style: none;
1851
- padding: 0;
1852
- margin-top: 0.4rem;
1853
- margin-bottom: 0.8rem;
1854
- display: flex;
1855
- flex-wrap: wrap;
1856
- justify-content: flex-start;
1857
- flex-direction: ${props => {
1858
- if (props.left) {
1859
- return "row";
1860
- }
1861
- return "row-reverse";
1862
- }};
1863
- }
1864
-
1865
- li {
1866
- margin: 0 0.3rem;
1867
- cursor: pointer;
1868
- user-select: none;
1869
- line-height: 1.2rem;
1870
-
1871
- :hover {
1872
- text-decoration: line-through;
1873
- }
1874
- }
1875
- `;
1876
-
1877
- const Itemsline$1 = properties => {
1878
- const {items: items, removeItem: removeItem, theme: theme, level: level, left: left, style: style, className: className} = properties;
1879
- const _theme = theme === undefined ? themes.plurid : theme;
1880
- const _level = level === undefined ? 0 : level;
1881
- const _left = left === undefined ? false : left;
1882
- return React.createElement(StyledItemsline, {
1883
- style: {
1884
- ...style
1885
- },
1886
- className: className,
1887
- theme: _theme,
1888
- level: _level,
1889
- left: _left
1890
- }, items.length > 0 && React.createElement("ul", null, items.map((item => React.createElement("li", {
1891
- key: item + Math.random(),
1892
- onClick: () => removeItem(item)
1893
- }, item)))));
1894
- };
1895
-
1896
- const StyledSelect = styled.div`
1897
- `;
1898
-
1899
- const PluridSelect = properties => {
1900
- const {selectables: selectables, atChange: atChange, theme: theme, level: level, devisible: devisible, round: round, width: width} = properties;
1901
- const _theme = theme || plurid;
1902
- const _level = level ?? 0;
1903
- const _round = round ?? true;
1904
- return React.createElement(StyledSelect, {
1905
- theme: _theme,
1906
- level: _level,
1907
- devisible: devisible,
1908
- round: _round,
1909
- width: width
1910
- }, React.createElement("select", null, selectables.map((selectable => React.createElement("option", {
1911
- key: selectable,
1912
- value: selectable
1913
- }, selectable)))));
1914
- };
1915
-
1916
- const StyledSlider = styled.div`
1917
- display: grid;
1918
- align-items: center;
1919
- font-family: ${props => props.theme.fontFamilySansSerif};
1920
- grid-template-columns: 1fr;
1921
- grid-template-rows: auto;
1922
-
1923
- width: ${props => {
1924
- if (props.width) {
1925
- if (typeof props.width === "string") {
1926
- return props.width;
1927
- }
1928
- return props.width + "px";
1929
- }
1930
- return "100px";
1931
- }};
1932
- `;
1933
-
1934
- const StyledNamedValue = styled.div`
1935
- display: flex;
1936
- align-items: center;
1937
- justify-content: space-between;
1938
- font-size: 0.8rem;
1939
- line-height: 16px;
1940
- user-select: none;
1941
- `;
1942
-
1943
- const StyledSliderValue = styled.div`
1944
- user-select: none;
1945
- font-size: 0.8rem;
1946
- min-width: 1.6rem;
1947
- text-align: right;
1948
- `;
1949
-
1950
- const StyledSliderInputContainer = styled.div`
1951
- width: ${props => {
1952
- if (props.width) {
1953
- if (typeof props.width === "string") {
1954
- return props.width;
1955
- }
1956
- return props.width + "px";
1957
- }
1958
- return "100px";
1959
- }};
1960
-
1961
- /*
1962
- article: https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
1963
- tool: http://danielstern.ca/range.css/
1964
- */
1965
- input[type=range] {
1966
- -webkit-appearance: none;
1967
- width: 100%;
1968
- margin: 2px 0;
1969
- padding: 10px 0;
1970
- background: transparent;
1971
- cursor: pointer;
1972
- }
1973
-
1974
- input[type=range]:focus {
1975
- outline: none;
1976
- }
1977
-
1978
- input[type=range]::-webkit-slider-runnable-track {
1979
- width: 100%;
1980
- height: 2px;
1981
- cursor: pointer;
1982
- background: ${props => props.theme.colorPrimary};
1983
- border-radius: 0px;
1984
- }
1985
-
1986
- input[type=range]::-webkit-slider-thumb {
1987
- border: 2px solid ${props => props.theme.colorPrimary};
1988
- height: ${props => {
1989
- switch (props.thumbSize) {
1990
- case "small":
1991
- return "14px";
1992
-
1993
- case "normal":
1994
- return "20px";
1995
-
1996
- case "large":
1997
- return "26px";
1998
-
1999
- default:
2000
- return "26px";
2001
- }
2002
- }};
2003
- width: ${props => {
2004
- switch (props.thumbSize) {
2005
- case "small":
2006
- return "14px";
2007
-
2008
- case "normal":
2009
- return "20px";
2010
-
2011
- case "large":
2012
- return "26px";
2013
-
2014
- default:
2015
- return "26px";
2016
- }
2017
- }};
2018
- background: ${props => {
2019
- if (props.hovered) {
2020
- return props.theme.colorPrimary;
2021
- }
2022
- switch (props.level) {
2023
- case 0:
2024
- return props.theme.backgroundColorPrimary;
2025
-
2026
- case 1:
2027
- return props.theme.backgroundColorSecondary;
2028
-
2029
- case 2:
2030
- return props.theme.backgroundColorTertiary;
2031
-
2032
- case 3:
2033
- return props.theme.backgroundColorQuaternary;
2034
-
2035
- default:
2036
- return props.theme.backgroundColorPrimary;
2037
- }
2038
- }};
2039
- margin-top: ${props => {
2040
- switch (props.thumbSize) {
2041
- case "small":
2042
- return "-6px";
2043
-
2044
- case "normal":
2045
- return "-9px";
2046
-
2047
- case "large":
2048
- return "-12px";
2049
-
2050
- default:
2051
- return "-12px";
2052
- }
2053
- }};
2054
- border-radius: 50px;
2055
- cursor: pointer;
2056
- -webkit-appearance: none;
2057
- }
2058
-
2059
- input[type=range]:focus::-webkit-slider-runnable-track {
2060
- background: ${props => props.theme.colorPrimary};
2061
- }
2062
-
2063
- input[type=range]::-moz-range-track {
2064
- width: 100%;
2065
- height: 2px;
2066
- cursor: pointer;
2067
- background: ${props => props.theme.colorPrimary};
2068
- border-radius: 0px;
2069
- }
2070
-
2071
- input[type=range]::-moz-range-thumb {
2072
- border: 2px solid ${props => props.theme.colorPrimary};
2073
- height: 15px;
2074
- width: 15px;
2075
- border-radius: 50px;
2076
- background: ${props => {
2077
- if (props.hovered) {
2078
- return props.theme.colorPrimary;
2079
- }
2080
- return props.theme.backgroundColorTertiary;
2081
- }};
2082
- cursor: pointer;
2083
- }
2084
-
2085
- input[type=range]::-ms-track {
2086
- width: 100%;
2087
- height: 2px;
2088
- cursor: pointer;
2089
- background: transparent;
2090
- border-color: transparent;
2091
- color: transparent;
2092
- }
2093
-
2094
- input[type=range]::-ms-fill-lower {
2095
- background: ${props => props.theme.colorPrimary};
2096
- border-radius: 0px;
2097
- }
2098
-
2099
- input[type=range]::-ms-fill-upper {
2100
- background: ${props => props.theme.colorPrimary};
2101
- border-radius: 0px;
2102
- }
2103
-
2104
- input[type=range]::-ms-thumb {
2105
- border: 2px solid ${props => props.theme.colorPrimary};
2106
- height: 15px;
2107
- width: 15px;
2108
- border-radius: 50px;
2109
- background: ${props => {
2110
- if (props.hovered) {
2111
- return props.theme.colorPrimary;
2112
- }
2113
- return props.theme.backgroundColorTertiary;
2114
- }};
2115
- cursor: pointer;
2116
- height: 2px;
2117
- }
2118
-
2119
- input[type=range]:focus::-ms-fill-lower {
2120
- background: ${props => props.theme.colorPrimary};
2121
- }
2122
-
2123
- input[type=range]:focus::-ms-fill-upper {
2124
- background: ${props => props.theme.colorPrimary};
2125
- }
2126
- `;
2127
-
2128
- const DEFAULT_VALUE = 0;
2129
-
2130
- const DEFAULT_MIN = 0;
2131
-
2132
- const DEFAULT_MAX = 100;
2133
-
2134
- const DEFAULT_STEP = 1;
2135
-
2136
- const DEFAULT_LEVEL = 0;
2137
-
2138
- const DEFAULT_THUMB_SIZE = "large";
2139
-
2140
- const Slider$1 = properties => {
2141
- 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;
2142
- const [mouseOver, setMouseOver] = useState(false);
2143
- const _theme = theme || plurid;
2144
- const _level = level === undefined ? DEFAULT_LEVEL : level;
2145
- const _thumbSize = thumbSize === undefined ? DEFAULT_THUMB_SIZE : thumbSize;
2146
- const _step = step === undefined ? DEFAULT_STEP : step;
2147
- const handleDoubleClick = () => {
2148
- atChange(defaultValue || DEFAULT_VALUE);
2149
- };
2150
- const handleSliderInput = event => {
2151
- atChange(parseFloat(event.target.value));
2152
- };
2153
- return React.createElement(StyledSlider, {
2154
- theme: _theme,
2155
- width: width
2156
- }, namedValueAbove && React.createElement(StyledNamedValue, null, React.createElement("div", null, name), React.createElement(StyledSliderValue, {
2157
- theme: _theme
2158
- }, value, valueSign)), React.createElement(StyledSliderInputContainer, {
2159
- theme: _theme,
2160
- hovered: mouseOver,
2161
- thumbSize: _thumbSize,
2162
- level: _level,
2163
- width: width
2164
- }, React.createElement("input", {
2165
- type: "range",
2166
- min: min || DEFAULT_MIN,
2167
- max: max || DEFAULT_MAX,
2168
- name: name || "",
2169
- value: value,
2170
- step: _step,
2171
- onMouseEnter: () => setMouseOver(true),
2172
- onMouseLeave: () => setMouseOver(false),
2173
- onMouseMove: () => mouseOver ? setMouseOver(true) : null,
2174
- onChange: handleSliderInput,
2175
- onDoubleClick: handleDoubleClick
2176
- })));
2177
- };
2178
-
2179
- const inputs = {
2180
- Dropdown: Dropdown$1,
2181
- EntityPill: EntityPill$1,
2182
- EntityPillGroup: EntityPillGroup$1,
2183
- InputBox: InputBox$1,
2184
- InputDescriptor: InputDescriptor$1,
2185
- InputLine: InputLine$1,
2186
- InputSwitch: InputSwitch$1,
2187
- Itemsline: Itemsline$1,
2188
- Select: PluridSelect,
2189
- Slider: Slider$1,
2190
- Switch: Switch$1,
2191
- Textline: Textline$1
2192
- };
2193
-
2194
- const StyledHR = styled.hr`
2195
- outline: 0;
2196
- border: 0;
2197
- margin: 0.8rem auto;
2198
- height: 1px;
2199
-
2200
- background-color: ${({theme: theme}) => theme.colorPrimary};
2201
- `;
2202
-
2203
- const HR$1 = properties => {
2204
- const {theme: theme, style: style, className: className} = properties;
2205
- const themeValue = theme || plurid;
2206
- return React.createElement(StyledHR, {
2207
- theme: themeValue,
2208
- style: {
2209
- ...style
2210
- },
2211
- className: className
2212
- });
2213
- };
2214
-
2215
- const StyledProgressCircle = styled.div`
2216
- height: 0;
2217
- width: 0;
2218
- transform: rotate(-90deg);
2219
- transform-origin: 50% 50%;
2220
- margin: 10px;
2221
-
2222
- svg {
2223
- transform: translateX(-50%) translateY(-50%);
2224
- }
2225
- `;
2226
-
2227
- const ProgressCircle$1 = properties => {
2228
- const {progress: progress, size: size, radius: radius, stroke: stroke, theme: theme, style: style, className: className} = properties;
2229
- const progressValue = mathematics.numbers.normalizeBetween(progress, 0, 100);
2230
- const radiusValue = radius || 20;
2231
- const diameter = radiusValue * 2;
2232
- const strokeValue = stroke || 3;
2233
- const normalizedRadius = radiusValue - strokeValue * 2;
2234
- const circumference = normalizedRadius * 2 * Math.PI;
2235
- const strokeDashoffset = circumference - progressValue / 100 * circumference;
2236
- const themeValue = theme || plurid;
2237
- const sizeValue = size || "normal";
2238
- return React.createElement(StyledProgressCircle, {
2239
- size: sizeValue,
2240
- style: {
2241
- ...style
2242
- },
2243
- className: className
2244
- }, React.createElement("svg", {
2245
- height: diameter,
2246
- width: diameter
2247
- }, React.createElement("circle", {
2248
- stroke: themeValue.backgroundColorPrimaryAlpha,
2249
- fill: "transparent",
2250
- strokeWidth: strokeValue,
2251
- r: normalizedRadius,
2252
- cx: radiusValue,
2253
- cy: radiusValue
2254
- }), React.createElement("circle", {
2255
- stroke: themeValue.colorPrimary,
2256
- fill: "transparent",
2257
- strokeWidth: strokeValue,
2258
- strokeDasharray: circumference + " " + circumference,
2259
- style: {
2260
- strokeDashoffset: strokeDashoffset
2261
- },
2262
- r: normalizedRadius,
2263
- cx: radiusValue,
2264
- cy: radiusValue
2265
- })));
2266
- };
2267
-
2268
- const StyledTooltip = styled.span`
2269
- position: relative;
2270
- `;
2271
-
2272
- const StyledTooltipString = styled.span`
2273
- `;
2274
-
2275
- const StyledTooltipIcon = styled.span`
2276
- user-select: none;
2277
- cursor: pointer;
2278
-
2279
- display: inline-grid;
2280
- margin: 0 5px;
2281
- place-content: center;
2282
- height: 20px;
2283
- width: 20px;
2284
- border-radius: 20px;
2285
- font-size: 12px;
2286
- line-height: 1.4;
2287
- text-align: left;
2288
-
2289
- font-family: ${props => props.theme.fontFamilySansSerif};
2290
- color: ${props => props.theme.colorPrimary};
2291
- background-color: ${props => props.theme.backgroundColorSecondary};
2292
- `;
2293
-
2294
- const StyledTooltipText = styled.div`
2295
- position: absolute;
2296
- top: 30px;
2297
- left: 50%;
2298
- transform: translateX(-50%);
2299
- border-radius: 2px;
2300
- z-index: 999;
2301
- padding: 20px;
2302
- min-width: 150px;
2303
- font-size: 12px;
2304
- line-height: 1.3;
2305
- text-align: left;
2306
-
2307
- color: ${props => props.theme.colorPrimary};
2308
- background-color: ${props => props.theme.backgroundColorSecondary};
2309
- box-shadow: ${props => props.theme.boxShadowUmbra};
2310
-
2311
- :before {
2312
- content: '';
2313
- position: absolute;
2314
- top: -10px;
2315
- left: 50%;
2316
- transform: translateX(-50%);
2317
- border-left: ${props => {
2318
- if (props.indicator) {
2319
- return "10px";
2320
- }
2321
- return "0";
2322
- }} solid transparent;
2323
- border-right: ${props => {
2324
- if (props.indicator) {
2325
- return "10px";
2326
- }
2327
- return "0";
2328
- }} solid transparent;
2329
- border-bottom: ${props => {
2330
- if (props.indicator) {
2331
- return "10px";
2332
- }
2333
- return "0";
2334
- }} solid ${props => props.theme.backgroundColorSecondary};
2335
- }
2336
- `;
2337
-
2338
- const Tooltip$1 = properties => {
2339
- const {tool: Tool, tip: Tip, indicator: indicatorProperty, icon: iconProperty, theme: themeProperty, style: style, className: className} = properties;
2340
- const theme = themeProperty || plurid;
2341
- const indicator = indicatorProperty ?? true;
2342
- const icon = iconProperty ?? true;
2343
- const mounted = useMounted();
2344
- const hoverOutTimeout = useRef(null);
2345
- const [mouseOver, setMouseOver] = useState(false);
2346
- const [showTooltipText, setShowTooltipText] = useState(false);
2347
- useEffect((() => {
2348
- if (!mounted) {
2349
- return;
2350
- }
2351
- if (mouseOver) {
2352
- setShowTooltipText(true);
2353
- }
2354
- if (!mouseOver) {
2355
- hoverOutTimeout.current = setTimeout((() => {
2356
- if (!mounted) {
2357
- return;
2358
- }
2359
- setShowTooltipText(false);
2360
- }), 500);
2361
- }
2362
- return () => {
2363
- if (hoverOutTimeout.current) {
2364
- clearTimeout(hoverOutTimeout.current);
2365
- }
2366
- };
2367
- }), [ mouseOver ]);
2368
- const renderTool = React.createElement(React.Fragment, null, typeof Tool === "string" ? React.createElement(React.Fragment, null, Tool) : React.createElement(Tool, null));
2369
- return React.createElement(StyledTooltip, {
2370
- onMouseEnter: () => setMouseOver(true),
2371
- onMouseLeave: () => setMouseOver(false),
2372
- onMouseMove: () => !showTooltipText ? setMouseOver(true) : null,
2373
- theme: theme,
2374
- style: {
2375
- ...style
2376
- },
2377
- className: className
2378
- }, icon && React.createElement(StyledTooltipIcon, {
2379
- theme: theme
2380
- }, renderTool), !icon && React.createElement(StyledTooltipString, null, renderTool), showTooltipText && React.createElement(StyledTooltipText, {
2381
- theme: theme,
2382
- indicator: indicator
2383
- }, typeof Tip === "string" ? React.createElement(React.Fragment, null, Tip) : React.createElement(Tip, null)));
2384
- };
2385
-
2386
- const markers = {
2387
- HR: HR$1,
2388
- ProgressCircle: ProgressCircle$1,
2389
- Spinner: Spinner$1,
2390
- Tooltip: Tooltip$1
2391
- };
2392
-
2393
- const StyledHeading1 = styled.h1`
2394
- color: ${props => props.theme.colorPrimary};
2395
- font-family: ${props => props.theme.fontFamilySansSerif};
2396
- font-size: 2.2rem;
2397
- margin: 1.4rem 0;
2398
- `;
2399
-
2400
- const StyledHeading2 = styled.h2`
2401
- color: ${props => props.theme.colorPrimary};
2402
- font-family: ${props => props.theme.fontFamilySansSerif};
2403
- font-size: 2rem;
2404
- margin: 1.2rem 0;
2405
- `;
2406
-
2407
- const StyledHeading3 = styled.h3`
2408
- color: ${props => props.theme.colorPrimary};
2409
- font-family: ${props => props.theme.fontFamilySansSerif};
2410
- font-size: 1.8rem;
2411
- margin: 1rem 0;
2412
- `;
2413
-
2414
- const StyledHeading4 = styled.h4`
2415
- color: ${props => props.theme.colorPrimary};
2416
- font-family: ${props => props.theme.fontFamilySansSerif};
2417
- font-size: 1.6rem;
2418
- margin: 1rem 0;
2419
- `;
2420
-
2421
- const StyledHeading5 = styled.h5`
2422
- color: ${props => props.theme.colorPrimary};
2423
- font-family: ${props => props.theme.fontFamilySansSerif};
2424
- font-size: 1.4rem;
2425
- margin: 1rem 0;
2426
- `;
2427
-
2428
- const StyledHeading6 = styled.h5`
2429
- color: ${props => props.theme.colorPrimary};
2430
- font-family: ${props => props.theme.fontFamilySansSerif};
2431
- font-size: 1.2rem;
2432
- margin: 1rem 0;
2433
- `;
2434
-
2435
- const Heading$1 = properties => {
2436
- const {children: children, theme: themeProperty, type: typeProperty, style: style, className: className} = properties;
2437
- const theme = themeProperty || plurid;
2438
- const type = typeProperty || "h1";
2439
- const renderProperties = {
2440
- theme: theme,
2441
- style: style,
2442
- className: className
2443
- };
2444
- switch (type) {
2445
- case "h1":
2446
- return React.createElement(StyledHeading1, {
2447
- ...renderProperties
2448
- }, children);
2449
-
2450
- case "h2":
2451
- return React.createElement(StyledHeading2, {
2452
- ...renderProperties
2453
- }, children);
2454
-
2455
- case "h3":
2456
- return React.createElement(StyledHeading3, {
2457
- ...renderProperties
2458
- }, children);
2459
-
2460
- case "h4":
2461
- return React.createElement(StyledHeading4, {
2462
- ...renderProperties
2463
- }, children);
2464
-
2465
- case "h5":
2466
- return React.createElement(StyledHeading5, {
2467
- ...renderProperties
2468
- }, children);
2469
-
2470
- case "h6":
2471
- return React.createElement(StyledHeading6, {
2472
- ...renderProperties
2473
- }, children);
2474
-
2475
- default:
2476
- return React.createElement(StyledHeading1, {
2477
- ...renderProperties
2478
- }, children);
2479
- }
2480
- };
2481
-
2482
- const StyledParagraph = styled.p`
2483
- color: ${props => props.theme.colorPrimary};
2484
- font-family: ${props => {
2485
- switch (props.fontFamily) {
2486
- case "sans-serif":
2487
- return props.theme.fontFamilySansSerif;
2488
-
2489
- case "serif":
2490
- return props.theme.fontFamilySerif;
2491
-
2492
- default:
2493
- return props.fontFamily;
2494
- }
2495
- }};
2496
- font-size: ${props => {
2497
- switch (props.size) {
2498
- case "small":
2499
- return "0.8rem";
2500
-
2501
- case "normal":
2502
- return "1rem";
2503
-
2504
- case "large":
2505
- return "1.2rem";
2506
-
2507
- default:
2508
- return "1rem";
2509
- }
2510
- }};
2511
-
2512
- margin: 1.2rem 0;
2513
- line-height: 1.4;
2514
- `;
2515
-
2516
- const Paragraph$1 = properties => {
2517
- const {children: children, theme: themeProperty, size: sizeProperty, fontFamily: fontFamilyProperty, style: style, className: className} = properties;
2518
- const theme = themeProperty || plurid;
2519
- const size = sizeProperty || "normal";
2520
- const fontFamily = fontFamilyProperty || "sans-serif";
2521
- return React.createElement(StyledParagraph, {
2522
- theme: theme,
2523
- size: size,
2524
- fontFamily: fontFamily,
2525
- style: {
2526
- ...style
2527
- },
2528
- className: className
2529
- }, children);
2530
- };
2531
-
2532
- const typography = {
2533
- Heading: Heading$1,
2534
- Paragraph: Paragraph$1
2535
- };
2536
-
2537
- const StyledCopyableLine = styled.div`
2538
- display: grid;
2539
- align-items: center;
2540
- grid-template-columns: 16px 1fr;
2541
- grid-gap: 0.7rem;
2542
- `;
2543
-
2544
- const StyledData = styled.div`
2545
- user-select: all;
2546
- `;
2547
-
2548
- const CopyableLine$1 = properties => {
2549
- const {data: data, theme: theme, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
2550
- const viewDataText = viewData || data;
2551
- const copyMessageText = copyMessage ?? "copied";
2552
- const copyMessageTimeValue = copyMessageTime || 2e3;
2553
- const [showCopyMessage, setShowCopyMessage] = useFalseAfterTimedTrue(copyMessageTimeValue);
2554
- return React.createElement(StyledCopyableLine, {
2555
- style: {
2556
- ...style
2557
- },
2558
- className: className
2559
- }, React.createElement(PluridIconCopy, {
2560
- atClick: () => {
2561
- clipboard.copy(data);
2562
- setShowCopyMessage(true);
2563
- },
2564
- theme: theme
2565
- }), React.createElement(StyledData, null, showCopyMessage ? React.createElement(React.Fragment, null, copyMessageText) : React.createElement(React.Fragment, null, viewDataText)));
2566
- };
2567
-
2568
- const StyledNewPageLink = styled.a`
2569
- `;
2570
-
2571
- const NewPageLink$1 = properties => {
2572
- const {link: link, text: text, style: style, className: className} = properties;
2573
- return React.createElement(StyledNewPageLink, {
2574
- href: link,
2575
- target: "_blank",
2576
- rel: "noopener noreferrer",
2577
- style: {
2578
- ...style
2579
- },
2580
- className: className
2581
- }, text);
2582
- };
2583
-
2584
- const StyledScrollableLine = styled.div`
2585
- text-align: left;
2586
- overflow: scroll;
2587
- outline: none;
2588
- white-space: nowrap;
2589
-
2590
- -ms-overflow-style: none; /* Internet Explorer 10+ */
2591
- scrollbar-width: none; /* Firefox */
2592
- ::-webkit-scrollbar {
2593
- display: none; /* Safari and Chrome */
2594
- }
2595
- `;
2596
-
2597
- const ScrollableLine$1 = properties => {
2598
- const {text: text, style: style, className: className} = properties;
2599
- return React.createElement(StyledScrollableLine, {
2600
- style: {
2601
- ...style
2602
- },
2603
- className: className
2604
- }, text);
2605
- };
2606
-
2607
- const StyledTextItem = styled.div`
2608
- display: flex;
2609
- align-items: center;
2610
- margin-right: 2rem;
2611
- `;
2612
-
2613
- const TextItem$1 = properties => {
2614
- const {name: name, render: render, icon: IconProperty} = properties;
2615
- const Icon = IconProperty || PluridIconInfo;
2616
- return React.createElement(StyledTextItem, null, React.createElement(Icon, {
2617
- title: name,
2618
- inactive: true,
2619
- style: {
2620
- marginRight: "0.5rem"
2621
- }
2622
- }), render);
2623
- };
2624
-
2625
- const varia = {
2626
- CopyableLine: CopyableLine$1,
2627
- NewPageLink: NewPageLink$1,
2628
- ScrollableLine: ScrollableLine$1,
2629
- TextItem: TextItem$1
2630
- };
2631
-
2632
- const universal = {
2633
- buttons: buttons,
2634
- form: form,
2635
- general: general,
2636
- inputs: inputs,
2637
- markers: markers,
2638
- typography: typography,
2639
- varia: varia
2640
- };
2641
-
2642
- const StyledDashboardsRenderer = styled.div`
2643
- display: grid;
2644
- grid-template-columns: ${({fullRenderArea: fullRenderArea, compactSelectors: compactSelectors}) => {
2645
- if (fullRenderArea) {
2646
- return "1fr";
2647
- }
2648
- return compactSelectors ? "60px auto" : "1fr 4fr";
2649
- }};
2650
- min-height: 700px;
2651
- `;
2652
-
2653
- const StyledNoDashboardRender = styled.div`
2654
- display: grid;
2655
- place-content: center;
2656
- `;
2657
-
2658
- const StyledSidebar = styled.div`
2659
- `;
2660
-
2661
- const StyledSelectors = styled.div`
2662
- height: 100%;
2663
- display: grid;
2664
- justify-content: space-between;
2665
- grid-template-columns: 1fr;
2666
- grid-template-rows: ${({helpItemsCount: helpItemsCount}) => `120px auto ${45 * helpItemsCount}px`};
2667
-
2668
- background-color: ${({theme: theme}) => theme.backgroundColorTertiary};
2669
- box-shadow: inset -3px 0px 3px 0px ${({theme: theme}) => theme.boxShadowUmbraColor};
2670
-
2671
- ul {
2672
- list-style: none;
2673
- padding: 0;
2674
- margin: 0;
2675
- }
2676
-
2677
- li {
2678
- cursor: pointer;
2679
- padding: 0.7rem 1.4rem;
2680
- user-select: none;
2681
- }
2682
- `;
2683
-
2684
- const StyledBranding = styled.div`
2685
- display: grid;
2686
- place-content: center;
2687
- grid-gap: 0.5rem;
2688
- height: 100%;
2689
- font-size: 0.9rem;
2690
- text-align: center;
2691
- user-select: none;
2692
-
2693
- img {
2694
- cursor: pointer;
2695
- }
2696
- `;
2697
-
2698
- const StyledHelp = styled.div`
2699
- li {
2700
- font-size: 0.9rem;
2701
- }
2702
- `;
2703
-
2704
- const StyledHelpItem = styled.li`
2705
- display: grid;
2706
- align-items: center;
2707
- grid-gap: 0.5rem;
2708
- grid-template-columns: ${({compactSelectors: compactSelectors}) => compactSelectors ? "16px" : "16px auto 16px"};
2709
- min-height: 45px;
2710
- `;
2711
-
2712
- const StyledSelector = styled.li`
2713
- background-color: ${({theme: theme, selected: selected}) => selected ? theme.backgroundColorPrimary : "initial"};
2714
-
2715
- :hover {
2716
- background-color: ${({theme: theme}) => theme.backgroundColorPrimary};
2717
- }
2718
-
2719
- display: grid;
2720
- grid-template-columns: ${({compactSelectors: compactSelectors}) => compactSelectors ? "16px" : "16px auto"};
2721
- grid-gap: 0.7rem;
2722
- min-height: 45px;
2723
- align-items: center;
2724
- position: relative;
2725
- `;
2726
-
2727
- const StyledSelectorRelativeLabel = styled.div`
2728
- position: absolute;
2729
- left: 50px;
2730
- z-index: 9999;
2731
- min-height: 45px;
2732
- display: grid;
2733
- align-items: center;
2734
- padding-right: 0.5rem;
2735
- background-color: ${({theme: theme}) => theme.backgroundColorPrimaryAlpha};
2736
- `;
2737
-
2738
- const Selector = properties => {
2739
- const {data: data, selectedDashboard: selectedDashboard, compactSelectors: compactSelectors, theme: theme, setSelectedDashboard: setSelectedDashboard, rendererID: rendererID} = properties;
2740
- const {id: id, icon: icon, label: label} = data;
2741
- const Icon = icon;
2742
- const selected = id === selectedDashboard;
2743
- const [mouseOver, setMouseOver] = useState(false);
2744
- useEffect((() => {
2745
- let mounted = true;
2746
- if (mouseOver) {
2747
- setTimeout((() => {
2748
- if (!mounted) {
2749
- return;
2750
- }
2751
- setMouseOver(false);
2752
- }), 2e3);
2753
- }
2754
- return () => {
2755
- mounted = false;
2756
- };
2757
- }), [ mouseOver ]);
2758
- const selectorIcon = !icon ? React.createElement(PluridIconSpace, {
2759
- theme: theme
2760
- }) : typeof icon === "function" ? React.createElement(Icon, {
2761
- theme: theme
2762
- }) : React.createElement(React.Fragment, null, icon);
2763
- return React.createElement(StyledSelector, {
2764
- key: (rendererID || "") + id,
2765
- onClick: () => setSelectedDashboard(id),
2766
- onMouseEnter: () => setMouseOver(true),
2767
- onMouseLeave: () => setMouseOver(false),
2768
- theme: theme,
2769
- selected: selected,
2770
- compactSelectors: compactSelectors
2771
- }, selectorIcon, !compactSelectors && React.createElement("div", null, label), compactSelectors && mouseOver && React.createElement(StyledSelectorRelativeLabel, {
2772
- theme: theme
2773
- }, label));
2774
- };
2775
-
2776
- const Sidebar = properties => {
2777
- const {dashboards: dashboards, theme: theme, compactSelectors: compactSelectors, setCompactSelectors: setCompactSelectors, selectedDashboard: selectedDashboard, setSelectedDashboard: setSelectedDashboard, identonym: identonym, usageType: usageType, openManual: openManual, logout: logout, rendererID: rendererID, brandingName: brandingName, brandingNameStyle: brandingNameStyle, brandingLogo: brandingLogo} = properties;
2778
- const openManualCount = openManual ? 1 : 0;
2779
- const usageTypeCount = usageType === "PRIVATE_USAGE" && logout ? 1 : 0;
2780
- const helpItemsCount = openManualCount + usageTypeCount;
2781
- const [mouseOverSelectors, setMouseOverSelectors] = useState(false);
2782
- const branding = React.createElement(StyledBranding, {
2783
- compactSelectors: compactSelectors
2784
- }, !compactSelectors && React.createElement(React.Fragment, null, React.createElement("div", null, brandingLogo && React.createElement("img", {
2785
- src: brandingLogo,
2786
- alt: "icon",
2787
- height: 40,
2788
- onClick: () => {
2789
- setCompactSelectors(true);
2790
- setMouseOverSelectors(false);
2791
- }
2792
- })), brandingName && React.createElement("div", {
2793
- style: brandingNameStyle
2794
- }, brandingName)), compactSelectors && mouseOverSelectors && React.createElement(React.Fragment, null, React.createElement(PluridIconArrowRight, {
2795
- atClick: () => setCompactSelectors(false)
2796
- }), React.createElement("div", null, "ㅤ")));
2797
- const selectors = React.createElement("ul", null, dashboards.map((dashboard => React.createElement(Selector, {
2798
- key: dashboard.id,
2799
- data: dashboard,
2800
- compactSelectors: compactSelectors,
2801
- theme: theme,
2802
- selectedDashboard: selectedDashboard,
2803
- setSelectedDashboard: setSelectedDashboard,
2804
- rendererID: rendererID
2805
- }))));
2806
- const help = React.createElement(StyledHelp, null, mouseOverSelectors && React.createElement("ul", null, openManual && React.createElement(StyledHelpItem, {
2807
- onClick: () => openManual(),
2808
- compactSelectors: compactSelectors
2809
- }, React.createElement(PluridIconDocuments, null), !compactSelectors && React.createElement(React.Fragment, null, React.createElement("div", null, "manual"), React.createElement(PluridIconExternalLink, null))), usageType === "PRIVATE_USAGE" && logout && React.createElement(StyledHelpItem, {
2810
- onClick: () => logout(),
2811
- compactSelectors: compactSelectors
2812
- }, React.createElement(PluridIconExit, null), !compactSelectors && React.createElement(React.Fragment, null, React.createElement("div", null, "logout (", identonym, ")"), React.createElement("div", null)))));
2813
- return React.createElement(StyledSidebar, {
2814
- theme: theme
2815
- }, React.createElement(StyledSelectors, {
2816
- onMouseEnter: () => setMouseOverSelectors(true),
2817
- onMouseLeave: () => setMouseOverSelectors(false),
2818
- theme: theme,
2819
- compactSelectors: compactSelectors,
2820
- helpItemsCount: helpItemsCount
2821
- }, branding, selectors, help));
2822
- };
2823
-
2824
- const StyledRenderArea = styled.div`
2825
- `;
2826
-
2827
- const RenderArea = properties => {
2828
- const {dashboards: dashboards, selectedDashboard: selectedDashboard, renderView: renderView, fullRenderArea: fullRenderArea, theme: theme, setSelectedDashboard: setSelectedDashboard, setRenderView: setRenderView, setFullRenderArea: setFullRenderArea} = properties;
2829
- const dashboard = dashboards.find((dashboard => dashboard.id === selectedDashboard));
2830
- if (!dashboard) {
2831
- return React.createElement(React.Fragment, null);
2832
- }
2833
- const resolveView = () => {
2834
- const dashboard = dashboards.find((dashboard => dashboard.id === selectedDashboard));
2835
- if (!dashboard) {
2836
- return;
2837
- }
2838
- const renderViewInDashboard = dashboard.renderers[renderView];
2839
- if (renderViewInDashboard) {
2840
- return renderView;
2841
- }
2842
- if (dashboard.defaultRender) {
2843
- return dashboard.defaultRender;
2844
- }
2845
- return Object.keys(dashboard.renderers)[0];
2846
- };
2847
- const renderID = resolveView();
2848
- useEffect((() => {
2849
- if (renderID && renderID !== renderView) {
2850
- setRenderView(renderID);
2851
- }
2852
- }), [ renderID ]);
2853
- if (!renderID) {
2854
- return React.createElement(React.Fragment, null);
2855
- }
2856
- const DashboardRender = dashboard.renderers[renderID];
2857
- if (!DashboardRender) {
2858
- return React.createElement(React.Fragment, null);
2859
- }
2860
- return React.createElement(StyledRenderArea, {
2861
- theme: theme
2862
- }, React.createElement(DashboardRender, {
2863
- theme: theme,
2864
- selectedDashboard: selectedDashboard,
2865
- setSelectedDashboard: setSelectedDashboard,
2866
- renderView: renderView,
2867
- setRenderView: setRenderView,
2868
- fullRenderArea: fullRenderArea,
2869
- setFullRenderArea: setFullRenderArea
2870
- }));
2871
- };
2872
-
2873
- const DashboardsRenderer$1 = properties => {
2874
- const {dashboards: dashboards, theme: theme, rendererID: rendererID, identonym: identonym, usageType: usageType, brandingName: brandingName, brandingNameStyle: brandingNameStyle, brandingLogo: brandingLogo, activeDashboard: activeDashboard, activeRender: activeRender, compactSelectors: compactSelectorsProperty, fullRenderArea: fullRenderAreaProperty, noDashboardRender: noDashboardRender, atDashboardChange: atDashboardChange, atUIChange: atUIChange, openManual: openManual, logout: logout} = properties;
2875
- const [compactSelectors, setCompactSelectors] = useState(compactSelectorsProperty ?? false);
2876
- const [fullRenderArea, setFullRenderArea] = useState(fullRenderAreaProperty ?? false);
2877
- const [selectedDashboard, setSelectedDashboard] = useState(activeDashboard || "");
2878
- const [renderView, setRenderView] = useState(activeRender || "");
2879
- useEffect((() => {
2880
- if (!activeDashboard) {
2881
- return;
2882
- }
2883
- if (selectedDashboard === activeDashboard) {
2884
- return;
2885
- }
2886
- setSelectedDashboard(activeDashboard);
2887
- }), [ activeDashboard ]);
2888
- useEffect((() => {
2889
- if (atDashboardChange) {
2890
- atDashboardChange(renderView);
2891
- }
2892
- }), [ renderView ]);
2893
- useEffect((() => {
2894
- if (typeof compactSelectorsProperty === "boolean") {
2895
- setCompactSelectors(compactSelectorsProperty);
2896
- }
2897
- if (typeof fullRenderAreaProperty === "boolean") {
2898
- setFullRenderArea(fullRenderAreaProperty);
2899
- }
2900
- }), [ compactSelectorsProperty, fullRenderAreaProperty ]);
2901
- useEffect((() => {
2902
- if (atUIChange) {
2903
- atUIChange("compactSelectors", compactSelectors);
2904
- }
2905
- }), [ compactSelectors ]);
2906
- useEffect((() => {
2907
- if (atUIChange) {
2908
- atUIChange("fullRenderArea", fullRenderArea);
2909
- }
2910
- }), [ fullRenderArea ]);
2911
- return React.createElement(StyledDashboardsRenderer, {
2912
- theme: theme,
2913
- compactSelectors: compactSelectors,
2914
- fullRenderArea: fullRenderArea
2915
- }, !fullRenderArea && React.createElement(Sidebar, {
2916
- dashboards: dashboards,
2917
- theme: theme,
2918
- compactSelectors: compactSelectors,
2919
- setCompactSelectors: setCompactSelectors,
2920
- selectedDashboard: selectedDashboard,
2921
- setSelectedDashboard: setSelectedDashboard,
2922
- identonym: identonym,
2923
- usageType: usageType,
2924
- openManual: openManual,
2925
- logout: logout,
2926
- rendererID: rendererID,
2927
- brandingName: brandingName,
2928
- brandingNameStyle: brandingNameStyle,
2929
- brandingLogo: brandingLogo
2930
- }), selectedDashboard && React.createElement(RenderArea, {
2931
- dashboards: dashboards,
2932
- selectedDashboard: selectedDashboard,
2933
- setSelectedDashboard: setSelectedDashboard,
2934
- renderView: renderView,
2935
- setRenderView: setRenderView,
2936
- fullRenderArea: fullRenderArea,
2937
- setFullRenderArea: setFullRenderArea,
2938
- theme: theme
2939
- }), !selectedDashboard && noDashboardRender && React.createElement(StyledNoDashboardRender, null, noDashboardRender));
2940
- };
2941
-
2942
- const StyledEntityView = styled.div`
2943
- position: relative;
2944
- height: 100%;
2945
-
2946
- button {
2947
- font-family: ${({theme: theme}) => theme.fontFamilySansSerif};
2948
- }
2949
- `;
2950
-
2951
- const StyledEntityViewTop = styled.div`
2952
- display: grid;
2953
- grid-template-columns: 3fr 1fr;
2954
- align-items: center;
2955
- margin-bottom: 30px;
2956
- `;
2957
-
2958
- const StyledEntityFilterLine = styled.div`
2959
- position: relative;
2960
- `;
2961
-
2962
- const StyledEntityFilterCancel = styled.div`
2963
- position: absolute;
2964
- top: 10px;
2965
-
2966
- left: ${({filterLength: filterLength}) => filterLength === "SMALL" ? "275px" : "575px"};
2967
- `;
2968
-
2969
- const StyledTopButtons = styled.div`
2970
- text-align: right;
2971
- `;
2972
-
2973
- const StyledEntityListContainer = styled.div`
2974
- `;
2975
-
2976
- const StyledEntityList = styled.ul`
2977
- padding: 0;
2978
- margin: 0;
2979
- list-style: none;
2980
- max-height: 500px;
2981
- overflow: auto;
2982
-
2983
- background-color: ${({theme: theme}) => theme.backgroundColorSecondaryAlpha};
2984
- box-shadow: ${({theme: theme}) => theme.boxShadowUmbraInset};
2985
- opacity: ${({loading: loading}) => {
2986
- if (loading) {
2987
- return "0.5";
2988
- }
2989
- return "1";
2990
- }};
2991
-
2992
- li:first-child {
2993
- background-color: ${({theme: theme, header: header}) => {
2994
- if (header) {
2995
- return theme.backgroundColorTertiary;
2996
- }
2997
- return "initial";
2998
- }};
2999
- }
3000
-
3001
- ${({header: header}) => {
3002
- if (header) {
3003
- return;
3004
- }
3005
- return css`
3006
- li:hover {
3007
- background-color: ${({theme: theme}) => theme.backgroundColorPrimary};
3008
- }
3009
- `;
3010
- }}
3011
- `;
3012
-
3013
- const StyledEntityListItem = styled.li`
3014
- display: grid;
3015
- grid-template-columns: ${({rowTemplate: rowTemplate}) => rowTemplate};
3016
- grid-gap: 0.5rem;
3017
- padding: 0.7rem;
3018
- align-items: center;
3019
- min-height: 45px;
3020
- word-break: break-all;
3021
- `;
3022
-
3023
- const StyledActionButton = styled.div`
3024
- width: 200px;
3025
- position: absolute;
3026
- bottom: 0;
3027
- right: 0;
3028
- `;
3029
-
3030
- const StyledNoRows = styled.div`
3031
- margin: 20px 0;
3032
- text-align: center;
3033
- `;
3034
-
3035
- const createSearchTerms = (rows, fields) => rows.map((entity => {
3036
- const {id: id} = entity;
3037
- const data = [];
3038
- for (const field of fields) {
3039
- const term = entity[field];
3040
- if (term && typeof term === "string") {
3041
- data.push(term.toLowerCase().trim());
3042
- }
3043
- }
3044
- return {
3045
- id: id,
3046
- data: data
3047
- };
3048
- }));
3049
-
3050
- const {buttons: {PureButton: PluridPureButton}, inputs: {Textline: PluridTextline}, markers: {Spinner: PluridSpinner}} = universal;
3051
-
3052
- const EntityView$1 = forwardRef(((properties, reference) => {
3053
- const {entities: entities, searchFields: searchFields, generalTheme: generalTheme, interactionTheme: interactionTheme, rowsHeader: rowsHeader, rowTemplate: rowTemplate, noRows: noRows, abstractRowRenderer: abstractRowRenderer, actionButtonText: actionButtonText, placeholderText: placeholderText, scrollThrottleTime: scrollThrottleTimeProperty, loading: loading, rowRenderFields: rowRenderFields, rowRenderMethods: rowRenderMethods, actionButtonClick: actionButtonClick, filterUpdate: filterUpdate, refresh: refresh, actionScrollBottom: actionScrollBottom} = properties;
3054
- const placeholder = placeholderText || "search";
3055
- const scrollThrottleTime = scrollThrottleTimeProperty ?? 1e3;
3056
- const bottomTimeout = useRef();
3057
- const entityList = useRef(null);
3058
- const [searchTerms, setSearchTerms] = useState(createSearchTerms(entities, searchFields));
3059
- const [filteredRows, setFilteredRows] = useState(entities.map((entity => abstractRowRenderer(rowRenderFields || [], entity, rowRenderMethods || {}))));
3060
- const [searchValue, setSearchValue] = useState("");
3061
- const [filterLength, setFilterLength] = useState("SMALL");
3062
- const [refreshClicked, setRefreshClicked] = useState(false);
3063
- const handleScroll = useThrottledCallback((() => {
3064
- const element = entityList.current;
3065
- if (!element) {
3066
- return;
3067
- }
3068
- const scrolledAmount = element.scrollTop + element.getBoundingClientRect().height;
3069
- const bottomReached = scrolledAmount >= element.scrollHeight;
3070
- if (bottomReached && actionScrollBottom && entities) {
3071
- actionScrollBottom(entities);
3072
- }
3073
- }), scrollThrottleTime);
3074
- const clearFilterValue = () => {
3075
- setSearchValue("");
3076
- if (filterUpdate) {
3077
- filterUpdate("");
3078
- }
3079
- };
3080
- useEffect((() => {
3081
- setFilteredRows(entities.map((entity => abstractRowRenderer(rowRenderFields || [], entity, rowRenderMethods || {}))));
3082
- setSearchTerms(createSearchTerms(entities, searchFields));
3083
- }), [ entities.length, JSON.stringify(entities) ]);
3084
- useEffect((() => {
3085
- if (refreshClicked) {
3086
- setTimeout((() => {
3087
- setRefreshClicked(false);
3088
- }), 1500);
3089
- }
3090
- }), [ refreshClicked ]);
3091
- useEffect((() => {
3092
- bottomTimeout.current = setTimeout((() => {
3093
- if (entityList.current && actionScrollBottom) {
3094
- entityList.current.addEventListener("scroll", handleScroll);
3095
- }
3096
- }), 100);
3097
- return () => {
3098
- if (bottomTimeout.current) {
3099
- clearTimeout(bottomTimeout.current);
3100
- }
3101
- if (entityList.current && actionScrollBottom) {
3102
- entityList.current.removeEventListener("scroll", handleScroll);
3103
- }
3104
- };
3105
- }), [ entities ]);
3106
- useEffect((() => {
3107
- if (searchValue.length <= 30) {
3108
- if (filterLength !== "SMALL") {
3109
- setFilterLength("SMALL");
3110
- }
3111
- } else {
3112
- if (filterLength !== "LARGE") {
3113
- setFilterLength("LARGE");
3114
- }
3115
- }
3116
- }), [ searchValue ]);
3117
- useImperativeHandle(reference, (() => ({
3118
- resetFilterValue() {
3119
- clearFilterValue();
3120
- },
3121
- getSearchTerms() {
3122
- return searchTerms;
3123
- }
3124
- })), [ JSON.stringify(searchTerms) ]);
3125
- return React.createElement(StyledEntityView, {
3126
- theme: generalTheme
3127
- }, !!loading && React.createElement(PluridSpinner, {
3128
- theme: generalTheme
3129
- }), React.createElement(StyledEntityViewTop, null, React.createElement(StyledEntityFilterLine, null, React.createElement(PluridTextline, {
3130
- text: searchValue,
3131
- placeholder: placeholder,
3132
- atChange: event => {
3133
- const {value: value} = event.target;
3134
- setSearchValue(value);
3135
- if (filterUpdate) {
3136
- filterUpdate(value);
3137
- }
3138
- },
3139
- atKeyDown: event => {
3140
- if (event.key === "Escape") {
3141
- clearFilterValue();
3142
- }
3143
- },
3144
- theme: interactionTheme,
3145
- spellCheck: false,
3146
- autoCapitalize: "false",
3147
- autoComplete: "false",
3148
- autoCorrect: "false",
3149
- level: 2,
3150
- style: {
3151
- width: filterLength === "SMALL" ? "300px" : "600px",
3152
- paddingRight: "2rem"
3153
- }
3154
- }), searchValue && React.createElement(StyledEntityFilterCancel, {
3155
- filterLength: filterLength
3156
- }, React.createElement(PluridIconDelete, {
3157
- atClick: () => {
3158
- clearFilterValue();
3159
- }
3160
- }))), React.createElement(StyledTopButtons, null, refresh && !refreshClicked && React.createElement(PluridIconReset, {
3161
- atClick: () => {
3162
- setRefreshClicked(true);
3163
- refresh();
3164
- },
3165
- theme: generalTheme
3166
- }))), filteredRows.length === 0 && React.createElement(StyledNoRows, null, noRows), filteredRows.length !== 0 && React.createElement(StyledEntityListContainer, {
3167
- theme: generalTheme
3168
- }, React.createElement(StyledEntityList, {
3169
- theme: generalTheme,
3170
- header: true
3171
- }, React.createElement(StyledEntityListItem, {
3172
- rowTemplate: rowTemplate
3173
- }, rowsHeader)), React.createElement(StyledEntityList, {
3174
- theme: generalTheme,
3175
- ref: entityList,
3176
- loading: loading
3177
- }, filteredRows.map((row => React.createElement(StyledEntityListItem, {
3178
- key: Math.random() + "",
3179
- rowTemplate: rowTemplate
3180
- }, row))))), actionButtonText && React.createElement(StyledActionButton, null, React.createElement(PluridPureButton, {
3181
- text: actionButtonText,
3182
- atClick: () => actionButtonClick ? actionButtonClick() : undefined,
3183
- theme: interactionTheme,
3184
- level: 2
3185
- })));
3186
- }));
3187
-
3188
- const containers = {
3189
- DashboardsRenderer: DashboardsRenderer$1,
3190
- EntityView: EntityView$1
3191
- };
3192
-
3193
- const Head$1 = properties => {
3194
- const {Helmet: Helmet, defaults: defaults, children: children, stateHead: stateHead} = properties;
3195
- const robots = defaults?.robots || "index,follow";
3196
- const viewport = defaults?.viewport || "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, shrink-to-fit=no";
3197
- const faviconIcon = defaults?.faviconIcon ?? "/favicon.ico";
3198
- const favicon16 = defaults?.favicon16 ?? "/favicon-16x16.png";
3199
- const favicon32 = defaults?.favicon32 ?? "/favicon-32x32.png";
3200
- const manifest = defaults?.manifest ?? "/site.webmanifest";
3201
- const themeColor = defaults?.themeColor || "";
3202
- const titleValue = stateHead.title || defaults?.title || "";
3203
- const descriptionValue = stateHead.description || defaults?.description || "";
3204
- const canonicalURL = stateHead.canonicalURL || defaults?.canonicalURL || "";
3205
- const ogTitleValue = stateHead.ogTitle || titleValue;
3206
- const ogDescriptionValue = stateHead.ogDescription || titleValue;
3207
- const ogImageValue = stateHead.ogImage || defaults?.ogImage || "";
3208
- const ogURLValue = stateHead.ogURL || defaults?.ogURL || "";
3209
- const apiDomain = defaults?.apiDomain || "";
3210
- const ogImageWidth = defaults?.ogImageWidth || "1200";
3211
- const ogImageHeight = defaults?.ogImageHeight || "630";
3212
- const ogSiteName = defaults?.ogSiteName || "";
3213
- const appleTouchIcon = defaults?.appleTouchIcon || "";
3214
- const {styles: styles, scripts: scripts} = stateHead;
3215
- return React.createElement(Helmet, null, React.createElement("meta", {
3216
- charSet: "utf-8"
3217
- }), React.createElement("meta", {
3218
- name: "robots",
3219
- content: robots
3220
- }), React.createElement("meta", {
3221
- name: "viewport",
3222
- content: viewport
3223
- }), React.createElement("title", null, titleValue), React.createElement("meta", {
3224
- name: "title",
3225
- content: titleValue
3226
- }), React.createElement("meta", {
3227
- name: "description",
3228
- content: descriptionValue
3229
- }), apiDomain && React.createElement(React.Fragment, null, React.createElement("link", {
3230
- rel: "preconnect",
3231
- href: apiDomain
3232
- }), React.createElement("link", {
3233
- rel: "dns-prefetch",
3234
- href: apiDomain
3235
- })), faviconIcon && React.createElement("link", {
3236
- rel: "icon",
3237
- sizes: "64x64",
3238
- href: faviconIcon
3239
- }), favicon32 && React.createElement("link", {
3240
- rel: "icon",
3241
- type: "image/png",
3242
- sizes: "32x32",
3243
- href: favicon32
3244
- }), favicon16 && React.createElement("link", {
3245
- rel: "icon",
3246
- type: "image/png",
3247
- sizes: "16x16",
3248
- href: favicon16
3249
- }), manifest && React.createElement("link", {
3250
- rel: "manifest",
3251
- href: manifest
3252
- }), themeColor && React.createElement("meta", {
3253
- name: "theme-color",
3254
- content: themeColor
3255
- }), canonicalURL && React.createElement("link", {
3256
- rel: "canonical",
3257
- href: canonicalURL
3258
- }), React.createElement("meta", {
3259
- property: "og:type",
3260
- content: "website"
3261
- }), React.createElement("meta", {
3262
- property: "og:title",
3263
- content: ogTitleValue
3264
- }), React.createElement("meta", {
3265
- property: "og:image",
3266
- content: ogImageValue
3267
- }), React.createElement("meta", {
3268
- property: "og:image:width",
3269
- content: ogImageWidth
3270
- }), React.createElement("meta", {
3271
- property: "og:image:height",
3272
- content: ogImageHeight
3273
- }), ogSiteName && React.createElement("meta", {
3274
- property: "og:site_name",
3275
- content: ogSiteName
3276
- }), React.createElement("meta", {
3277
- property: "og:url",
3278
- content: ogURLValue
3279
- }), React.createElement("meta", {
3280
- property: "og:description",
3281
- content: ogDescriptionValue
3282
- }), React.createElement("meta", {
3283
- property: "twitter:card",
3284
- content: "summary_large_image"
3285
- }), React.createElement("meta", {
3286
- property: "twitter:url",
3287
- content: ogURLValue
3288
- }), React.createElement("meta", {
3289
- property: "twitter:title",
3290
- content: ogTitleValue
3291
- }), React.createElement("meta", {
3292
- property: "twitter:description",
3293
- content: ogDescriptionValue
3294
- }), React.createElement("meta", {
3295
- property: "twitter:image",
3296
- content: ogImageValue
3297
- }), React.createElement("meta", {
3298
- name: "apple-mobile-web-app-capable",
3299
- content: "yes"
3300
- }), React.createElement("meta", {
3301
- name: "apple-mobile-web-app-status-bar-style",
3302
- content: "default"
3303
- }), React.createElement("meta", {
3304
- name: "apple-mobile-web-app-title",
3305
- content: titleValue
3306
- }), appleTouchIcon && React.createElement("link", {
3307
- rel: "apple-touch-icon",
3308
- sizes: "180x180",
3309
- href: appleTouchIcon
3310
- }), children, styles?.map((style => React.createElement("link", {
3311
- rel: "stylesheet",
3312
- key: "head-style" + style,
3313
- href: style
3314
- }))), scripts?.map((script => React.createElement("script", {
3315
- key: "head-script" + script,
3316
- src: script
3317
- }))));
3318
- };
3319
-
3320
- const mapStateToProperties$7 = (state, ownProperties) => ({
3321
- stateHead: ownProperties.selectors.head.getHead(state)
3322
- });
3323
-
3324
- const mapDispatchToProperties$7 = dispatch => ({});
3325
-
3326
- const ConnectedHead = connect(mapStateToProperties$7, mapDispatchToProperties$7)(Head$1);
3327
-
3328
- const head = {
3329
- Head: ConnectedHead
3330
- };
3331
-
3332
- const translateUp = keyframes`
3333
- from {
3334
- transform: translateY(2000px);
3335
- }
3336
- to {
3337
- transform: translateY(0);
3338
- }
3339
- `;
3340
-
3341
- const StyledNotification = styled.div`
3342
- display: grid;
3343
- align-items: center;
3344
- position: relative;
3345
- min-height: 60px;
3346
- width: 260px;
3347
- margin: 10px 20px;
3348
- border-radius: 10px;
3349
- pointer-events: all;
3350
- background-color: ${props => props.theme.backgroundColorSecondary};
3351
- color: ${props => props.theme.colorPrimary};
3352
- box-shadow: ${props => props.theme.boxShadowUmbra};
3353
- animation: ${translateUp} 750ms ease-in-out forwards;
3354
- transition: opacity 400ms;
3355
-
3356
- a {
3357
- text-decoration: none;
3358
- color: ${props => props.theme.colorSecondary};
3359
- }
3360
- `;
3361
-
3362
- const StyledNotificationContent = styled.div`
3363
- font-size: 0.9rem;
3364
- padding: 32px 16px;
3365
- word-break: ${({wordBreak: wordBreak}) => wordBreak};
3366
- `;
3367
-
3368
- const StyledNotificationClose = styled.div`
3369
- position: absolute;
3370
- top: 8px;
3371
- right: 8px;
3372
- user-select: none;
3373
- cursor: pointer;
3374
- width: 20px;
3375
- height: 20px;
3376
- display: grid;
3377
- place-content: center;
3378
- `;
3379
-
3380
- const Notification$1 = properties => {
3381
- const {data: data, theme: theme, remove: remove, elements: elements, style: style, className: className} = properties;
3382
- const {id: id, text: text, html: html, react: react, timeout: timeout, wordBreak: wordBreak} = data;
3383
- const resolvedWordBreak = wordBreak === true ? "break-all" : "normal";
3384
- const [prepareForRemoval, setPrepareForRemoval] = useState(false);
3385
- const notificationTimeout = useRef(null);
3386
- useEffect((() => {
3387
- const timeoutValue = timeout === undefined ? react ? 4e3 : 2e3 + text.length * 40 : timeout === 0 ? undefined : timeout;
3388
- if (timeoutValue) {
3389
- notificationTimeout.current = setTimeout((() => {
3390
- setPrepareForRemoval(true);
3391
- setTimeout((() => {
3392
- remove(id);
3393
- }), 400);
3394
- }), timeoutValue);
3395
- }
3396
- return () => {
3397
- if (notificationTimeout.current) {
3398
- clearTimeout(notificationTimeout.current);
3399
- }
3400
- };
3401
- }), [ id, timeout, remove ]);
3402
- const resolveRender = () => {
3403
- const contentProperties = {
3404
- wordBreak: resolvedWordBreak
3405
- };
3406
- if (html) {
3407
- return React.createElement(StyledNotificationContent, {
3408
- dangerouslySetInnerHTML: createMarkup(text),
3409
- ...contentProperties
3410
- });
3411
- }
3412
- if (react && elements && elements[text]) {
3413
- return React.createElement(StyledNotificationContent, {
3414
- ...contentProperties
3415
- }, elements[text]);
3416
- }
3417
- return React.createElement(StyledNotificationContent, {
3418
- ...contentProperties
3419
- }, text);
3420
- };
3421
- const content = resolveRender();
3422
- return React.createElement(StyledNotification, {
3423
- theme: theme,
3424
- style: {
3425
- ...style,
3426
- opacity: prepareForRemoval ? 0 : undefined
3427
- },
3428
- className: className
3429
- }, content, React.createElement(StyledNotificationClose, null, React.createElement(PluridIconDelete, {
3430
- atClick: () => remove(id)
3431
- })));
3432
- };
3433
-
3434
- const StyledNotifications = styled.div`
3435
- position: absolute;
3436
- bottom: 0;
3437
- top: 0;
3438
- right: 0;
3439
- width: 300px;
3440
- display: flex;
3441
- flex-direction: column-reverse;
3442
- z-index: 9999;
3443
- pointer-events: none;
3444
- `;
3445
-
3446
- const Notifications$1 = properties => {
3447
- const {elements: elements, stateGeneralTheme: stateGeneralTheme, stateNotifications: stateNotifications, dispatchRemoveNotification: dispatchRemoveNotification} = properties;
3448
- return React.createElement(StyledNotifications, null, stateNotifications.map((notification => React.createElement(Notification$1, {
3449
- key: notification.id,
3450
- data: notification,
3451
- theme: stateGeneralTheme,
3452
- remove: dispatchRemoveNotification,
3453
- elements: elements
3454
- }))));
3455
- };
3456
-
3457
- const mapStateToProperties$6 = (state, ownProperties) => ({
3458
- stateGeneralTheme: ownProperties.selectors.themes.getGeneralTheme(state),
3459
- stateNotifications: ownProperties.selectors.notifications.getAll(state)
3460
- });
3461
-
3462
- const mapDispatchToProperties$6 = dispatch => ({
3463
- dispatchRemoveNotification: payload => dispatch(notifications$1.actions.remove(payload))
3464
- });
3465
-
3466
- const ConnectedNotifications = connect(mapStateToProperties$6, mapDispatchToProperties$6)(Notifications$1);
3467
-
3468
- const notifications = {
3469
- Notification: Notification$1,
3470
- Notifications: ConnectedNotifications
3471
- };
3472
-
3473
- const StyledSittingTray = styled.div`
3474
- background-color: ${props => props.theme.backgroundColorSecondary};
3475
- box-shadow: ${props => props.theme.boxShadowUmbra};
3476
-
3477
- border-radius: 10px;
3478
- position: absolute;
3479
- left: 35px;
3480
- width: 160px;
3481
- /*
3482
- -1 * (height - 40px <button>)
3483
- */
3484
- /* height: 95px; */
3485
- bottom: -163px;
3486
- /* bottom: 0; */
3487
- overflow: hidden;
3488
- `;
3489
-
3490
- const StyledSittingTrayContainer = styled.div`
3491
- overflow: auto;
3492
- height: 100%;
3493
-
3494
- scrollbar-width: none; /* Firefox */
3495
- -ms-overflow-style: none; /* IE 10+ */
3496
- ::-webkit-scrollbar {
3497
- width: 0px;
3498
- background: transparent;
3499
- }
3500
-
3501
- ul {
3502
- list-style: none;
3503
- padding: 0;
3504
- margin: 0;
3505
- text-align: left;
3506
- }
3507
-
3508
- li {
3509
- min-height: 26px;
3510
- /* padding: 0 7px;
3511
- margin: 7px 0; */
3512
- display: grid;
3513
- grid-template-columns: 1fr;
3514
- align-items: center;
3515
- }
3516
-
3517
- h4 {
3518
- margin: 0;
3519
- }
3520
- `;
3521
-
3522
- const StyledSittingTrayItem = styled.div`
3523
- display: grid;
3524
- grid-template-columns: 1fr;
3525
- grid-template-rows: 1fr 1fr;
3526
- align-items: center;
3527
- `;
3528
-
3529
- const StyledSittingTrayItemHeader = styled.div`
3530
- display: grid;
3531
- grid-template-columns: 1fr 1fr;
3532
- align-items: center;
3533
- `;
3534
-
3535
- const StyledSittingTrayItemBody = styled.div`
3536
- display: grid;
3537
- grid-template-columns: 1fr;
3538
- align-items: center;
3539
- `;
3540
-
3541
- const StyledSittingTrayButton = styled.div`
3542
- display: grid;
3543
- grid-template-columns: 25px 1fr;
3544
- cursor: pointer;
3545
- `;
3546
-
3547
- const StyledSittingTrayButtonIcon = styled.div`
3548
- `;
3549
-
3550
- const StyledSittingTrayButtonText = styled.div`
3551
- display: flex;
3552
- align-items: center;
3553
- `;
3554
-
3555
- const StyledStateLink = styled.div`
3556
- padding: 7px;
3557
- padding-bottom: 0px;
3558
- margin-bottom: 4px;
3559
- `;
3560
-
3561
- const StyledStateLinkContainer = styled.div`
3562
- display: grid;
3563
- grid-template-columns: 1fr;
3564
- height: 25px;
3565
- align-items: center;
3566
- `;
3567
-
3568
- const StyledStateLinkText = styled.div`
3569
- width: 100%;
3570
- overflow-x: scroll;
3571
- overflow-y: hidden;
3572
- white-space: nowrap;
3573
- user-select: all;
3574
- text-align: left;
3575
-
3576
- scrollbar-width: none;
3577
- ::-webkit-scrollbar {
3578
- display: none;
3579
- }
3580
- `;
3581
-
3582
- const StyledStateLinkCopy = styled.div`
3583
- width: 100%;
3584
- cursor: pointer;
3585
- justify-self: center;
3586
- `;
3587
-
3588
- const StateLink = properties => {
3589
- const {currentLink: currentLink} = properties;
3590
- const copyStateLink = () => {
3591
- clipboard.copy(currentLink);
3592
- setCurrentStateLink("copied link");
3593
- setTimeout((() => {
3594
- setCurrentStateLink(currentLink);
3595
- }), 650);
3596
- };
3597
- const [currentStateLink, setCurrentStateLink] = useState(currentLink);
3598
- useEffect((() => {
3599
- setCurrentStateLink(currentLink);
3600
- }), [ currentLink ]);
3601
- 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", {
3602
- style: {
3603
- justifySelf: "right"
3604
- }
3605
- }, React.createElement(StyledStateLinkCopy, {
3606
- onClick: copyStateLink
3607
- }, React.createElement(PluridIconCopy, null)))), React.createElement(StyledSittingTrayItemBody, null, React.createElement(StyledStateLinkContainer, null, React.createElement(StyledStateLinkText, null, currentStateLink)))));
3608
- };
3609
-
3610
- const mapStateToProperties$5 = (state, ownProperties) => ({
3611
- theme: ownProperties.selectors.themes.getInteractionTheme(state),
3612
- currentLink: ownProperties.selectors.sitting.getCurrentLink(state)
3613
- });
3614
-
3615
- const mapDispatchToProperties$5 = dispatch => ({});
3616
-
3617
- const ConnectedStateLink = connect(mapStateToProperties$5, mapDispatchToProperties$5)(StateLink);
3618
-
3619
- const StyledStateLine = styled.div`
3620
- padding: 0 7px;
3621
- margin-bottom: 4px;
3622
-
3623
- display: grid;
3624
- align-items: center;
3625
- justify-items: center;
3626
-
3627
- svg {
3628
- height: 18px;
3629
- width: 18px;
3630
- color: white;
3631
- fill: white;
3632
- user-select: none;
3633
- cursor: pointer;
3634
- }
3635
- `;
3636
-
3637
- const StyledSliderStateButton = styled.div`
3638
- user-select: none;
3639
- cursor: pointer;
3640
- display: grid;
3641
- place-content: center;
3642
- `;
3643
-
3644
- const StyledSliderStateSliderContainer = styled.div`
3645
- `;
3646
-
3647
- styled.div`
3648
- justify-self: center;
3649
- `;
3650
-
3651
- const StyledStateLineButtons = styled.div`
3652
- display: grid;
3653
- grid-template-columns: repeat(3, 20px);
3654
- grid-gap: 3px;
3655
- align-items: center;
3656
- justify-content: right;
3657
- `;
3658
-
3659
- const StyledStateLineButton = styled.div`
3660
- display: grid;
3661
- place-content: center;
3662
- `;
3663
-
3664
- const StyledStateLineContainer = styled.div`
3665
- display: grid;
3666
- grid-template-columns: 1fr 1fr 1fr;
3667
- align-items: center;
3668
- justify-content: space-between;
3669
- `;
3670
-
3671
- const StateLine = properties => {
3672
- const [stateIndex, setStateIndex] = useState(0);
3673
- const maxStateSlider = 5;
3674
- const handleStateIndex = type => {
3675
- switch (type) {
3676
- case "DECREASE":
3677
- if (stateIndex - 1 >= 0) {
3678
- setStateIndex(stateIndex - 1);
3679
- } else {
3680
- setStateIndex(0);
3681
- }
3682
- break;
3683
-
3684
- case "INCREASE":
3685
- if (stateIndex + 1 <= maxStateSlider) {
3686
- setStateIndex(stateIndex + 1);
3687
- } else {
3688
- setStateIndex(maxStateSlider);
3689
- }
3690
- break;
3691
- }
3692
- };
3693
- 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", {
3694
- style: {
3695
- display: "grid",
3696
- justifyContent: "left"
3697
- }
3698
- }, stateIndex !== 0 && React.createElement(StyledSliderStateButton, {
3699
- onClick: () => handleStateIndex("DECREASE")
3700
- }, "◀")), React.createElement(StyledSliderStateSliderContainer, null), React.createElement("div", {
3701
- style: {
3702
- display: "grid",
3703
- justifyContent: "right"
3704
- }
3705
- }, stateIndex !== maxStateSlider && React.createElement(StyledSliderStateButton, {
3706
- onClick: () => handleStateIndex("INCREASE")
3707
- }, "▶"))))));
3708
- };
3709
-
3710
- const mapStateToProperties$4 = (state, ownProperties) => ({
3711
- theme: ownProperties.selectors.themes.getInteractionTheme(state)
3712
- });
3713
-
3714
- const mapDispatchToProperties$4 = dispatch => ({});
3715
-
3716
- const ConnectedStateLine = connect(mapStateToProperties$4, mapDispatchToProperties$4)(StateLine);
3717
-
3718
- const StyledStateImage = styled.div`
3719
- padding: 0 7px;
3720
- margin-bottom: 4px;
3721
-
3722
- svg {
3723
- height: 18px;
3724
- width: 18px;
3725
- color: white;
3726
- fill: white;
3727
- user-select: none;
3728
- cursor: pointer;
3729
- }
3730
- `;
3731
-
3732
- const StyledStateShareImage = styled.div`
3733
- display: grid;
3734
- grid-template-columns: 1fr;
3735
- grid-template-rows: 25px;
3736
- align-items: center;
3737
- `;
3738
-
3739
- const StyledStateShareImageButtons = styled.div`
3740
- display: grid;
3741
- grid-template-columns: 110px auto;
3742
- align-items: center;
3743
- justify-items: center;
3744
- height: 25px;
3745
- `;
3746
-
3747
- const StyledStateShareImageButtonsCopy = styled.div`
3748
- display: grid;
3749
- grid-template-columns: 1fr 1fr;
3750
- grid-gap: 10px;
3751
- justify-self: left;
3752
-
3753
- svg {
3754
- height: 18px;
3755
- width: 18px;
3756
- fill: white;
3757
- }
3758
- `;
3759
-
3760
- const StyledStateShareImagePasteContainer = styled.div`
3761
- display: grid;
3762
- grid-template-columns: 100px 40px;
3763
- align-items: center;
3764
- justify-items: center;
3765
-
3766
- input {
3767
- width: 100%;
3768
- outline: none;
3769
- border: none;
3770
- background: hsla(0, 0%, 10%, 0.5);
3771
- color: white;
3772
- padding: 6px;
3773
- }
3774
- `;
3775
-
3776
- const StateImage = properties => {
3777
- const [message, setMessage] = useState("");
3778
- const [showPaste, setShowPaste] = useState(false);
3779
- const copyCurrentState = () => {
3780
- setMessage("copied state image");
3781
- setTimeout((() => {
3782
- setMessage("");
3783
- }), 2e3);
3784
- };
3785
- const copyStateHistory = () => {
3786
- setMessage("copied state history");
3787
- setTimeout((() => {
3788
- setMessage("");
3789
- }), 2e3);
3790
- };
3791
- const paste = () => {
3792
- setShowPaste(false);
3793
- };
3794
- 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", {
3795
- style: {
3796
- display: "grid",
3797
- alignItems: "center",
3798
- justifyContent: "right"
3799
- }
3800
- }, 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", {
3801
- onClick: copyCurrentState
3802
- }, React.createElement(PluridIconCopyCurrentState, null)), React.createElement("div", {
3803
- onClick: copyStateHistory
3804
- }, React.createElement(PluridIconCopyStateHistory, null))), React.createElement("div", {
3805
- onClick: () => setShowPaste(true)
3806
- }, "paste")), message && !showPaste && React.createElement("div", null, message), showPaste && React.createElement(StyledStateShareImagePasteContainer, null, React.createElement("input", {
3807
- type: "text"
3808
- }), React.createElement("div", {
3809
- onClick: paste
3810
- }, "paste"))))));
3811
- };
3812
-
3813
- const mapStateToProperties$3 = (state, ownProperties) => ({
3814
- theme: ownProperties.selectors.themes.getInteractionTheme(state)
3815
- });
3816
-
3817
- const mapDispatchToProperties$3 = dispatch => ({});
3818
-
3819
- const ConnectedStateImage = connect(mapStateToProperties$3, mapDispatchToProperties$3)(StateImage);
3820
-
3821
- const StyledSittings = styled.div`
3822
- padding: 7px;
3823
-
3824
- display: grid;
3825
- align-items: center;
3826
-
3827
- svg {
3828
- height: 18px;
3829
- width: 18px;
3830
- color: white;
3831
- fill: white;
3832
- user-select: none;
3833
- cursor: pointer;
3834
- }
3835
-
3836
- :hover {
3837
- background-color: ${props => props.theme.backgroundColorTertiary};
3838
- }
3839
- `;
3840
-
3841
- const Sittings = properties => {
3842
- const {stateInteractionTheme: stateInteractionTheme} = properties;
3843
- return React.createElement(StyledSittings, {
3844
- theme: stateInteractionTheme
3845
- }, React.createElement(StyledSittingTrayButton, null, React.createElement(StyledSittingTrayButtonIcon, null, React.createElement(PluridIconSittings, {
3846
- theme: stateInteractionTheme
3847
- })), React.createElement(StyledSittingTrayButtonText, null, "sittings")));
3848
- };
3849
-
3850
- const mapStateToProperties$2 = (state, ownProperties) => ({
3851
- stateInteractionTheme: ownProperties.selectors.themes.getInteractionTheme(state)
3852
- });
3853
-
3854
- const mapDispatchToProperties$2 = dispatch => ({});
3855
-
3856
- const ConnectedSittings = connect(mapStateToProperties$2, mapDispatchToProperties$2)(Sittings);
3857
-
3858
- const SittingTray$1 = properties => {
3859
- const {selectors: selectors, context: context, stateInteractionTheme: stateInteractionTheme} = properties;
3860
- return React.createElement(StyledSittingTray, {
3861
- theme: stateInteractionTheme
3862
- }, React.createElement(StyledSittingTrayContainer, null, React.createElement("ul", null, React.createElement("li", null, React.createElement(ConnectedStateLink, {
3863
- selectors: selectors,
3864
- context: context
3865
- })), React.createElement("li", null, React.createElement(ConnectedStateLine, {
3866
- selectors: selectors,
3867
- context: context
3868
- })), React.createElement("li", null, React.createElement(ConnectedStateImage, {
3869
- selectors: selectors,
3870
- context: context
3871
- })), React.createElement("li", null, React.createElement(ConnectedSittings, {
3872
- selectors: selectors,
3873
- context: context
3874
- })))));
3875
- };
3876
-
3877
- const mapStatedToProperties = (state, ownProperties) => ({
3878
- stateInteractionTheme: ownProperties.selectors.themes.getInteractionTheme(state)
3879
- });
3880
-
3881
- const mapDispatchdToProperties = dispatch => ({});
3882
-
3883
- const ConnectedSittingTray = connect(mapStatedToProperties, mapDispatchdToProperties)(SittingTray$1);
3884
-
3885
- const sitting = {
3886
- SittingTray: ConnectedSittingTray
3887
- };
3888
-
3889
- const StyledHorizontalToolbarButton = styled.div`
3890
- position: relative;
3891
- cursor: pointer;
3892
- user-select: none;
3893
- font-weight: normal;
3894
- transition: transform 50ms ease-in-out;
3895
- height: 45px;
3896
- min-width: 2rem;
3897
- padding: 0 1rem;
3898
- display: flex;
3899
- align-items: center;
3900
- justify-content: center;
3901
-
3902
- background-color: ${props => {
3903
- if (props.active) {
3904
- return props.theme.backgroundColorTertiary;
3905
- }
3906
- return "transparent";
3907
- }};
3908
- color: ${props => props.theme.colorPrimary};
3909
- font-family: ${props => props.theme.fontFamilySansSerif};
3910
-
3911
- @media (hover: hover) {
3912
- :hover {
3913
- background: ${props => props.theme.backgroundColorTertiary};
3914
- }
3915
-
3916
- :hover svg {
3917
- transform: ${props => {
3918
- if (props.scaleIcon) {
3919
- return "scale(1.2)";
3920
- }
3921
- return "";
3922
- }};
3923
- }
3924
- }
3925
-
3926
- svg {
3927
- transition: transform 100ms linear;
3928
- transform: ${props => {
3929
- if (props.active && props.scaleIcon) {
3930
- return "scale(1.2)";
3931
- }
3932
- return "";
3933
- }};
3934
- }
3935
- `;
3936
-
3937
- const StyledHorizontalToolbarButtonIcon = styled.div`
3938
- display: flex;
3939
- align-items: center;
3940
- margin-right: ${({text: text}) => {
3941
- if (text === "") {
3942
- return "0";
3943
- }
3944
- return "0.5rem";
3945
- }};
3946
- `;
3947
-
3948
- const HorizontalToolbarButton$1 = properties => {
3949
- const {text: text, atClick: atClick, active: active, scaleIcon: scaleIcon, icon: Icon, theme: themeProperty, style: style, className: className} = properties;
3950
- const theme = themeProperty || themes.plurid;
3951
- return React.createElement(StyledHorizontalToolbarButton, {
3952
- active: active,
3953
- scaleIcon: scaleIcon,
3954
- onClick: atClick,
3955
- theme: theme,
3956
- style: {
3957
- ...style
3958
- },
3959
- className: className
3960
- }, Icon && React.createElement(StyledHorizontalToolbarButtonIcon, {
3961
- text: text
3962
- }, React.createElement(Icon, null)), text);
3963
- };
3964
-
3965
- var SizeTypes;
3966
-
3967
- (function(SizeTypes) {
3968
- SizeTypes["small"] = "small";
3969
- SizeTypes["normal"] = "normal";
3970
- SizeTypes["large"] = "large";
3971
- })(SizeTypes || (SizeTypes = {}));
3972
-
3973
- var HorizontalPositions;
3974
-
3975
- (function(HorizontalPositions) {
3976
- HorizontalPositions["left"] = "left";
3977
- HorizontalPositions["right"] = "right";
3978
- })(HorizontalPositions || (HorizontalPositions = {}));
3979
-
3980
- var VerticalPositions;
3981
-
3982
- (function(VerticalPositions) {
3983
- VerticalPositions["top"] = "top";
3984
- VerticalPositions["bottom"] = "bottom";
3985
- })(VerticalPositions || (VerticalPositions = {}));
3986
-
3987
- const StyledToolbarControls = styled.div`
3988
- top: ${({position: position}) => {
3989
- if (position === VerticalPositions.top) {
3990
- return "15px";
3991
- }
3992
- return "initial";
3993
- }};
3994
- bottom: ${({position: position}) => {
3995
- if (position === VerticalPositions.bottom) {
3996
- return "15px";
3997
- }
3998
- return "initial";
3999
- }};
4000
-
4001
- position: absolute;
4002
- left: 50%;
4003
- transform: translateX(-50%);
4004
- z-index: 99999;
4005
- `;
4006
-
4007
- const StyledToolbarControlsButtons = styled.div`
4008
- background-color: ${({theme: theme}) => theme.backgroundColorSecondary};
4009
- box-shadow: ${({theme: theme}) => theme.boxShadowUmbra};
4010
-
4011
- display: flex;
4012
- align-items: center;
4013
- border-radius: 22.5px;
4014
- min-height: 45px;
4015
- height: 45px;
4016
- padding: 0 22.5px;
4017
- margin: 0 auto;
4018
- font-size: 0.9rem;
4019
- opacity: 1;
4020
- height: 100%;
4021
- `;
4022
-
4023
- const ToolbarControls$1 = properties => {
4024
- const {position: positionProperty, theme: themeProperty, style: style, className: className, children: children} = properties;
4025
- const position = positionProperty || VerticalPositions.top;
4026
- const theme = themeProperty || plurid;
4027
- return React.createElement(StyledToolbarControls, {
4028
- position: position,
4029
- theme: theme,
4030
- style: {
4031
- ...style
4032
- },
4033
- className: className
4034
- }, React.createElement(StyledToolbarControlsButtons, {
4035
- theme: theme
4036
- }, children));
4037
- };
4038
-
4039
- const StyledVerticalToolbarButton = styled.div`
4040
- position: relative;
4041
- cursor: pointer;
4042
- height: 40px;
4043
- display: grid;
4044
- place-content: center;
4045
- transition: transform 50ms ease-in-out;
4046
-
4047
- border-top-left-radius: ${props => {
4048
- if (props.first) {
4049
- return "15px";
4050
- }
4051
- return "0";
4052
- }};
4053
- border-top-right-radius: ${props => {
4054
- if (props.first) {
4055
- return "15px";
4056
- }
4057
- return "0";
4058
- }};
4059
-
4060
- border-bottom-left-radius: ${props => {
4061
- if (props.last) {
4062
- return "15px";
4063
- }
4064
- return "0";
4065
- }};
4066
- border-bottom-right-radius: ${props => {
4067
- if (props.last) {
4068
- return "15px";
4069
- }
4070
- return "0";
4071
- }};
4072
-
4073
- background-color: ${props => {
4074
- if (props.active) {
4075
- return props.theme.backgroundColorTertiary;
4076
- }
4077
- return "transparent";
4078
- }};
4079
-
4080
- @media (hover: hover) {
4081
- :hover {
4082
- background: ${props => props.theme.backgroundColorTertiary};
4083
- }
4084
-
4085
- :hover svg {
4086
- transform: ${props => {
4087
- if (props.scaleIcon) {
4088
- return "scale(1.2)";
4089
- }
4090
- return "";
4091
- }};
4092
- }
4093
- }
4094
-
4095
- svg {
4096
- transition: transform 100ms linear;
4097
- width: 15px;
4098
- height: 15px;
4099
- fill: ${props => props.theme.colorPrimary};
4100
- transform: ${props => {
4101
- if (props.active && props.scaleIcon) {
4102
- return "scale(1.2)";
4103
- }
4104
- return "";
4105
- }};
4106
- }
4107
- `;
4108
-
4109
- const StyledVerticalToolbarButtonText = styled.div`
4110
- left: ${props => {
4111
- if (props.textLeft) {
4112
- return "-108px";
4113
- }
4114
- return "30px";
4115
- }};
4116
- justify-content: ${props => {
4117
- if (props.textLeft) {
4118
- return "flex-end";
4119
- }
4120
- return "left";
4121
- }};
4122
- text-align: ${props => {
4123
- if (props.textLeft) {
4124
- return "right";
4125
- }
4126
- return "left";
4127
- }};
4128
- padding-left: ${props => {
4129
- if (props.textLeft) {
4130
- return "0";
4131
- }
4132
- return "8px";
4133
- }};
4134
-
4135
- pointer-events: none;
4136
- position: absolute;
4137
- height: 40px;
4138
- width: 100px;
4139
- display: flex;
4140
- align-items: center;
4141
- `;
4142
-
4143
- const VerticalToolbarButton$1 = properties => {
4144
- const {atClick: atClick, icon: Icon, active: active, text: text, textLeft: textLeft, showText: showText, scaleIcon: scaleIcon, first: first, last: last, theme: theme} = properties;
4145
- const [mouseOver, setMouseOver] = useState(false);
4146
- return React.createElement(StyledVerticalToolbarButton, {
4147
- onMouseEnter: () => setMouseOver(true),
4148
- onMouseLeave: () => setMouseOver(false),
4149
- onClick: atClick,
4150
- active: active,
4151
- scaleIcon: scaleIcon,
4152
- first: first,
4153
- last: last,
4154
- theme: theme
4155
- }, React.createElement(Icon, null), mouseOver && showText && React.createElement(StyledVerticalToolbarButtonText, {
4156
- textLeft: textLeft
4157
- }, text));
4158
- };
4159
-
4160
- const StyledToolbar = styled.div`
4161
- left: ${props => {
4162
- if (props.position === HorizontalPositions.left) {
4163
- return "0";
4164
- }
4165
- return "initial";
4166
- }};
4167
- right: ${props => {
4168
- if (props.position === HorizontalPositions.right) {
4169
- return "0";
4170
- }
4171
- return "initial";
4172
- }};
4173
-
4174
- pointer-events: none;
4175
- position: absolute;
4176
- top: 0;
4177
- bottom: 0;
4178
- width: 60px;
4179
- `;
4180
-
4181
- const StyledToolbarButtons = styled.div`
4182
- background-color: ${props => props.theme.backgroundColorSecondary};
4183
- box-shadow: ${props => props.theme.boxShadowUmbra};
4184
-
4185
- pointer-events: all;
4186
- display: grid;
4187
- place-content: center;
4188
- grid-template-columns: 1fr;
4189
- grid-template-rows: 1fr;
4190
- border-radius: 15px;
4191
- margin: 0 15px;
4192
- font-size: 12px;
4193
- opacity: 1;
4194
- width: 30px;
4195
- height: auto;
4196
- position: absolute;
4197
- top: 50%;
4198
- transform: translateY(-50%);
4199
- transition: opacity 300ms ease-in-out;
4200
- z-index: 9999;
4201
- user-select: none;
4202
- `;
4203
-
4204
- const ToolbarSpecific$1 = properties => {
4205
- const {buttons: buttons, handleClick: handleClick, activeType: activeType, position: position, children: children, stateToolbars: stateToolbars, stateIdentonym: stateIdentonym, stateInteractionTheme: stateInteractionTheme} = properties;
4206
- const {alwaysShow: alwaysShow, location: location, scaleIcons: scaleIcons, showNames: showNames} = stateToolbars;
4207
- const toolbarPosition = position ? position : HorizontalPositions.right;
4208
- const [showToolbar, setShowToolbar] = useState(alwaysShow);
4209
- const [mouseIn, setMouseIn] = useState(false);
4210
- const handleMouseMove = event => {
4211
- if (!showToolbar) {
4212
- setShowToolbar(true);
4213
- }
4214
- };
4215
- useEffect((() => {
4216
- if (alwaysShow) {
4217
- setShowToolbar(true);
4218
- }
4219
- if (mouseIn) {
4220
- setShowToolbar(true);
4221
- } else {
4222
- if (!alwaysShow) {
4223
- setShowToolbar(false);
4224
- }
4225
- }
4226
- }), [ mouseIn, alwaysShow ]);
4227
- return React.createElement(StyledToolbar, {
4228
- onMouseMove: () => handleMouseMove,
4229
- onMouseEnter: () => setMouseIn(true),
4230
- onMouseLeave: () => setMouseIn(false),
4231
- position: toolbarPosition
4232
- }, React.createElement(StyledToolbarButtons, {
4233
- theme: stateInteractionTheme,
4234
- style: {
4235
- top: location ? location + "%" : "",
4236
- opacity: showToolbar ? 1 : 0
4237
- }
4238
- }, buttons.filter((button => {
4239
- const {loggedIn: loggedIn} = button;
4240
- if (loggedIn === "ONLY" && !stateIdentonym) {
4241
- return false;
4242
- }
4243
- if (loggedIn === "NONE" && stateIdentonym) {
4244
- return false;
4245
- }
4246
- return true;
4247
- })).map(((button, index) => {
4248
- const {type: type, text: text, icon: Icon, first: first, last: last} = button;
4249
- return React.createElement(VerticalToolbarButton$1, {
4250
- key: type,
4251
- atClick: () => handleClick(type, index),
4252
- icon: Icon,
4253
- active: activeType === type,
4254
- text: text,
4255
- textLeft: toolbarPosition === "right",
4256
- showText: showNames,
4257
- scaleIcon: scaleIcons,
4258
- theme: stateInteractionTheme,
4259
- first: first,
4260
- last: last
4261
- });
4262
- })), children));
4263
- };
4264
-
4265
- const mapStateToProperties$1 = (state, ownProperties) => ({
4266
- stateToolbars: ownProperties.selectors.product.getProductUI(state).toolbars,
4267
- stateIdentonym: ownProperties.selectors.owner.getIdentonym(state),
4268
- stateInteractionTheme: ownProperties.selectors.themes.getInteractionTheme(state)
4269
- });
4270
-
4271
- const mapDispatchToProperties$1 = dispatch => ({});
4272
-
4273
- const ConnectedToolbarSpecific = connect(mapStateToProperties$1, mapDispatchToProperties$1)(ToolbarSpecific$1);
4274
-
4275
- const ToolbarGeneral$1 = properties => {
4276
- const {buttons: buttons, selectors: selectors, context: context, handleClick: handleClick, speakButton: speakButton, sittingButton: sittingButtonProperty, stateView: stateView, stateSittingTray: stateSittingTray, stateToolbars: stateToolbars, stateInteractionTheme: stateInteractionTheme, dispatchToggleSittingTray: dispatchToggleSittingTray} = properties;
4277
- const {scaleIcons: scaleIcons, showNames: showNames} = stateToolbars;
4278
- const iconTextLeft = false;
4279
- const sittingButton = sittingButtonProperty ?? true;
4280
- return React.createElement(ConnectedToolbarSpecific, {
4281
- buttons: buttons,
4282
- handleClick: handleClick,
4283
- activeType: stateView,
4284
- position: HorizontalPositions.left,
4285
- selectors: selectors,
4286
- context: context
4287
- }, speakButton && React.createElement(VerticalToolbarButton$1, {
4288
- atClick: () => {},
4289
- icon: PluridIconSpeak,
4290
- active: false,
4291
- text: "speak",
4292
- textLeft: iconTextLeft,
4293
- showText: showNames,
4294
- scaleIcon: scaleIcons,
4295
- theme: stateInteractionTheme
4296
- }), sittingButton && React.createElement(React.Fragment, null, React.createElement(VerticalToolbarButton$1, {
4297
- atClick: () => dispatchToggleSittingTray(),
4298
- icon: PluridIconStateShareImage,
4299
- active: stateSittingTray,
4300
- text: "sitting",
4301
- textLeft: iconTextLeft,
4302
- showText: showNames,
4303
- scaleIcon: scaleIcons,
4304
- theme: stateInteractionTheme,
4305
- last: true
4306
- }), stateSittingTray && React.createElement(ConnectedSittingTray, {
4307
- selectors: selectors,
4308
- context: context
4309
- })));
4310
- };
4311
-
4312
- const mapStateToProperties = (state, ownProperties) => ({
4313
- stateView: ownProperties.selectors.views?.getGeneralView(state),
4314
- stateToolbars: ownProperties.selectors.product?.getProductUI(state)?.toolbars,
4315
- stateSittingTray: ownProperties.selectors.sitting?.getTray(state),
4316
- stateInteractionTheme: ownProperties.selectors.themes?.getInteractionTheme(state)
4317
- });
4318
-
4319
- const mapDispatchToProperties = dispatch => ({
4320
- dispatchToggleSittingTray: () => dispatch(sitting$1.actions.toggleSittingTray())
4321
- });
4322
-
4323
- const ConnectedToolbarGeneral = connect(mapStateToProperties, mapDispatchToProperties)(ToolbarGeneral$1);
4324
-
4325
- const toolbars = {
4326
- HorizontalToolbarButton: HorizontalToolbarButton$1,
4327
- ToolbarControls: ToolbarControls$1,
4328
- ToolbarGeneral: ConnectedToolbarGeneral,
4329
- ToolbarSpecific: ConnectedToolbarSpecific,
4330
- VerticalToolbarButton: VerticalToolbarButton$1
4331
- };
4332
-
4333
- const pluridal = {
4334
- containers: containers,
4335
- head: head,
4336
- notifications: notifications,
4337
- sitting: sitting,
4338
- toolbars: toolbars
4339
- };
4340
-
4341
- var index = {
4342
- ...universal.buttons,
4343
- ...universal.form,
4344
- ...universal.general,
4345
- ...universal.inputs,
4346
- ...universal.markers,
4347
- ...universal.typography,
4348
- ...universal.varia,
4349
- ...pluridal.containers,
4350
- ...pluridal.head,
4351
- ...pluridal.notifications,
4352
- ...pluridal.sitting,
4353
- ...pluridal.toolbars
4354
- };
4355
-
4356
- const {buttons: {LinkButton: LinkButton, PureButton: PureButton, RefreshButton: RefreshButton}, form: {FormLeftRight: FormLeftRight, FormObliterate: FormObliterate, Formbutton: Formbutton, Formitem: Formitem, Formline: Formline}, general: {GlobalStyles: GlobalStyles}, inputs: {Dropdown: Dropdown, EntityPill: EntityPill, EntityPillGroup: EntityPillGroup, InputBox: InputBox, InputDescriptor: InputDescriptor, InputLine: InputLine, InputSwitch: InputSwitch, Itemsline: Itemsline, Select: Select, Slider: Slider, Switch: Switch, Textline: Textline}, markers: {HR: HR, ProgressCircle: ProgressCircle, Spinner: Spinner, Tooltip: Tooltip}, typography: {Heading: Heading, Paragraph: Paragraph}, varia: {CopyableLine: CopyableLine, NewPageLink: NewPageLink, ScrollableLine: ScrollableLine, TextItem: TextItem}} = universal;
4357
-
4358
- const {containers: {DashboardsRenderer: DashboardsRenderer, EntityView: EntityView}, head: {Head: Head}, notifications: {Notification: Notification, Notifications: Notifications}, sitting: {SittingTray: SittingTray}, toolbars: {HorizontalToolbarButton: HorizontalToolbarButton, ToolbarControls: ToolbarControls, ToolbarGeneral: ToolbarGeneral, ToolbarSpecific: ToolbarSpecific, VerticalToolbarButton: VerticalToolbarButton}} = pluridal;
4359
-
4360
- export { CopyableLine, DashboardsRenderer, Dropdown, EntityPill, EntityPillGroup, EntityView, FormLeftRight, FormObliterate, Formbutton, Formitem, Formline, GlobalStyles, HR, Head, Heading, HorizontalPositions, HorizontalToolbarButton, InputBox, InputDescriptor, InputLine, InputSwitch, Itemsline, LinkButton, NewPageLink, Notification, Notifications, Paragraph, ProgressCircle, PureButton, RefreshButton, ScrollableLine, Select, SittingTray, SizeTypes, Slider, Spinner, Switch, TextItem, Textline, ToolbarControls, ToolbarGeneral, ToolbarSpecific, Tooltip, VerticalPositions, VerticalToolbarButton, index as default, pluridal, universal };
4361
- //# sourceMappingURL=index.es.js.map