@imposium-hub/components 2.5.10-8 → 2.5.10

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 (140) hide show
  1. package/dist/cjs/components/app-wrapper/AppWrapper.js +5 -2
  2. package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
  3. package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
  4. package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js +243 -0
  5. package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
  6. package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
  7. package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js +255 -0
  8. package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
  9. package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
  10. package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js +243 -0
  11. package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
  12. package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
  13. package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js +251 -0
  14. package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
  15. package/dist/cjs/components/assets/AssetsTableNameCell.js +2 -2
  16. package/dist/cjs/components/assets/AssetsTableNameCell.js.map +1 -1
  17. package/dist/cjs/components/assets/AssetsTypeIcon.js +2 -0
  18. package/dist/cjs/components/assets/AssetsTypeIcon.js.map +1 -1
  19. package/dist/cjs/components/card/Card.d.ts +0 -1
  20. package/dist/cjs/components/card/Card.js +4 -17
  21. package/dist/cjs/components/card/Card.js.map +1 -1
  22. package/dist/cjs/components/confirm-modal/ConfirmModal.d.ts +9 -9
  23. package/dist/cjs/components/confirm-modal/ConfirmModal.js +108 -12
  24. package/dist/cjs/components/confirm-modal/ConfirmModal.js.map +1 -1
  25. package/dist/cjs/components/data-table/Paginator.js +7 -51
  26. package/dist/cjs/components/data-table/Paginator.js.map +1 -1
  27. package/dist/cjs/components/error-message-preview/ErrorMessagePreview.d.ts +15 -0
  28. package/dist/cjs/components/error-message-preview/ErrorMessagePreview.js +91 -0
  29. package/dist/cjs/components/error-message-preview/ErrorMessagePreview.js.map +1 -0
  30. package/dist/cjs/components/header/Header_BACKUP_73021.d.ts +33 -0
  31. package/dist/cjs/components/header/Header_BACKUP_73021.js +393 -0
  32. package/dist/cjs/components/header/Header_BACKUP_73021.js.map +1 -0
  33. package/dist/cjs/components/header/Header_BASE_73021.d.ts +29 -0
  34. package/dist/cjs/components/header/Header_BASE_73021.js +376 -0
  35. package/dist/cjs/components/header/Header_BASE_73021.js.map +1 -0
  36. package/dist/cjs/components/header/Header_LOCAL_73021.d.ts +33 -0
  37. package/dist/cjs/components/header/Header_LOCAL_73021.js +382 -0
  38. package/dist/cjs/components/header/Header_LOCAL_73021.js.map +1 -0
  39. package/dist/cjs/components/header/Header_REMOTE_73021.d.ts +30 -0
  40. package/dist/cjs/components/header/Header_REMOTE_73021.js +386 -0
  41. package/dist/cjs/components/header/Header_REMOTE_73021.js.map +1 -0
  42. package/dist/cjs/components/story-previewer/StoryPreviewer.js +11 -1
  43. package/dist/cjs/components/story-previewer/StoryPreviewer.js.map +1 -1
  44. package/dist/cjs/constants/copy.js +2 -2
  45. package/dist/cjs/constants/copy.js.map +1 -1
  46. package/dist/cjs/constants/icons.d.ts +1 -0
  47. package/dist/cjs/constants/icons.js +3 -1
  48. package/dist/cjs/constants/icons.js.map +1 -1
  49. package/dist/cjs/constants/variables.d.ts +3 -0
  50. package/dist/cjs/constants/variables.js +27 -2
  51. package/dist/cjs/constants/variables.js.map +1 -1
  52. package/dist/cjs/index.d.ts +2 -2
  53. package/dist/cjs/index.js.map +1 -1
  54. package/dist/cjs/redux/actions/asset-list.js +0 -1
  55. package/dist/cjs/redux/actions/asset-list.js.map +1 -1
  56. package/dist/cjs/redux/actions/asset-uploads.js +33 -1
  57. package/dist/cjs/redux/actions/asset-uploads.js.map +1 -1
  58. package/dist/cjs/redux/reducers/asset-uploads.js +8 -0
  59. package/dist/cjs/redux/reducers/asset-uploads.js.map +1 -1
  60. package/dist/cjs/services/API.d.ts +3 -0
  61. package/dist/cjs/services/API.js +9 -0
  62. package/dist/cjs/services/API.js.map +1 -1
  63. package/dist/esm/components/app-wrapper/AppWrapper.js +5 -2
  64. package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
  65. package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
  66. package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js +194 -0
  67. package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
  68. package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
  69. package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js +208 -0
  70. package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
  71. package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
  72. package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js +194 -0
  73. package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
  74. package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
  75. package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js +204 -0
  76. package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
  77. package/dist/esm/components/assets/AssetsTableNameCell.js +2 -2
  78. package/dist/esm/components/assets/AssetsTableNameCell.js.map +1 -1
  79. package/dist/esm/components/assets/AssetsTypeIcon.js +3 -1
  80. package/dist/esm/components/assets/AssetsTypeIcon.js.map +1 -1
  81. package/dist/esm/components/card/Card.d.ts +0 -1
  82. package/dist/esm/components/card/Card.js +4 -16
  83. package/dist/esm/components/card/Card.js.map +1 -1
  84. package/dist/esm/components/confirm-modal/ConfirmModal.d.ts +9 -9
  85. package/dist/esm/components/confirm-modal/ConfirmModal.js +60 -11
  86. package/dist/esm/components/confirm-modal/ConfirmModal.js.map +1 -1
  87. package/dist/esm/components/data-table/Paginator.js +44 -74
  88. package/dist/esm/components/data-table/Paginator.js.map +1 -1
  89. package/dist/esm/components/error-message-preview/ErrorMessagePreview.d.ts +15 -0
  90. package/dist/esm/components/error-message-preview/ErrorMessagePreview.js +35 -0
  91. package/dist/esm/components/error-message-preview/ErrorMessagePreview.js.map +1 -0
  92. package/dist/esm/components/header/Header_BACKUP_73021.d.ts +33 -0
  93. package/dist/esm/components/header/Header_BACKUP_73021.js +336 -0
  94. package/dist/esm/components/header/Header_BACKUP_73021.js.map +1 -0
  95. package/dist/esm/components/header/Header_BASE_73021.d.ts +29 -0
  96. package/dist/esm/components/header/Header_BASE_73021.js +322 -0
  97. package/dist/esm/components/header/Header_BASE_73021.js.map +1 -0
  98. package/dist/esm/components/header/Header_LOCAL_73021.d.ts +33 -0
  99. package/dist/esm/components/header/Header_LOCAL_73021.js +328 -0
  100. package/dist/esm/components/header/Header_LOCAL_73021.js.map +1 -0
  101. package/dist/esm/components/header/Header_REMOTE_73021.d.ts +30 -0
  102. package/dist/esm/components/header/Header_REMOTE_73021.js +329 -0
  103. package/dist/esm/components/header/Header_REMOTE_73021.js.map +1 -0
  104. package/dist/esm/components/story-previewer/StoryPreviewer.js +12 -2
  105. package/dist/esm/components/story-previewer/StoryPreviewer.js.map +1 -1
  106. package/dist/esm/constants/copy.js +2 -2
  107. package/dist/esm/constants/copy.js.map +1 -1
  108. package/dist/esm/constants/icons.d.ts +1 -0
  109. package/dist/esm/constants/icons.js +2 -0
  110. package/dist/esm/constants/icons.js.map +1 -1
  111. package/dist/esm/constants/variables.d.ts +3 -0
  112. package/dist/esm/constants/variables.js +25 -1
  113. package/dist/esm/constants/variables.js.map +1 -1
  114. package/dist/esm/index.d.ts +2 -2
  115. package/dist/esm/index.js.map +1 -1
  116. package/dist/esm/redux/actions/asset-list.js +0 -1
  117. package/dist/esm/redux/actions/asset-list.js.map +1 -1
  118. package/dist/esm/redux/actions/asset-uploads.js +22 -1
  119. package/dist/esm/redux/actions/asset-uploads.js.map +1 -1
  120. package/dist/esm/redux/reducers/asset-uploads.js +11 -0
  121. package/dist/esm/redux/reducers/asset-uploads.js.map +1 -1
  122. package/dist/esm/services/API.d.ts +3 -0
  123. package/dist/esm/services/API.js +9 -0
  124. package/dist/esm/services/API.js.map +1 -1
  125. package/package.json +1 -1
  126. package/src/components/app-wrapper/AppWrapper.tsx +3 -4
  127. package/src/components/assets/AssetsTableNameCell.tsx +2 -2
  128. package/src/components/assets/AssetsTypeIcon.tsx +4 -1
  129. package/src/components/card/Card.tsx +13 -27
  130. package/src/components/confirm-modal/ConfirmModal.tsx +80 -19
  131. package/src/components/data-table/Paginator.tsx +93 -140
  132. package/src/components/story-previewer/StoryPreviewer.tsx +28 -4
  133. package/src/constants/copy.ts +2 -2
  134. package/src/constants/icons.tsx +3 -0
  135. package/src/constants/variables.ts +27 -1
  136. package/src/index.ts +3 -2
  137. package/src/redux/actions/asset-list.ts +0 -1
  138. package/src/redux/actions/asset-uploads.ts +20 -1
  139. package/src/redux/reducers/asset-uploads.ts +11 -0
  140. package/src/services/API.ts +15 -0
@@ -1,24 +1,85 @@
1
- import React from 'react';
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
- import { useHotkeys } from 'react-hotkeys-hook';
4
3
  import Modal from '../modal/Modal';
5
4
  import Button from '../button/Button';
6
5
  import { confirm as copy } from '../../constants/copy';
7
6
  import Section from '../section/Section';
8
7
 
9
- export const ConfirmModal = ({
10
- onClose,
11
- onYes,
12
- onNo,
13
- title,
14
- onYesLabel,
15
- onNoLabel,
16
- showCancel
17
- }) => {
18
- useHotkeys('enter', onYes, { enableOnFormTags: true });
19
- const { cancel } = copy;
8
+ export interface IConfirmModalProps {
9
+ onYes: () => void;
10
+ onNo?: () => void;
11
+ title: string;
12
+ yesLabel?: string;
13
+ noLabel?: string;
14
+ showCancel?: boolean;
15
+ }
20
16
 
21
- const modal = (
17
+ export const ConfirmModal = () => {
18
+ const [props, setProps] = useState<IConfirmModalProps>(null);
19
+ const [isOpen, setIsOpen] = useState<boolean>(false);
20
+
21
+ const onOpen = (event) => {
22
+ setProps({
23
+ ...event.detail
24
+ });
25
+ setIsOpen(true);
26
+ };
27
+
28
+ const onClose = () => setIsOpen(false);
29
+
30
+ const onYesHandler = () => {
31
+ props.onYes();
32
+ setIsOpen(false);
33
+ };
34
+
35
+ const onNoHandler = () => {
36
+ props.onNo();
37
+ setIsOpen(false);
38
+ };
39
+
40
+ const onYes = useCallback(() => onYesHandler(), [isOpen]);
41
+
42
+ const onNo = useCallback(() => {
43
+ if (props.onNo) {
44
+ onNoHandler();
45
+ } else {
46
+ onClose();
47
+ }
48
+ }, [isOpen]);
49
+
50
+ const onKeyDown = useCallback(
51
+ (e) => {
52
+ if (e.key === 'Enter') {
53
+ e.preventDefault();
54
+ onYesHandler();
55
+ }
56
+ },
57
+ [isOpen]
58
+ );
59
+
60
+ useEffect(() => {
61
+ window.addEventListener('openconfirmmodal', onOpen);
62
+ return () => {
63
+ window.removeEventListener('openconfirmmodal', onOpen);
64
+ };
65
+ }, []);
66
+
67
+ useEffect(() => {
68
+ if (isOpen) {
69
+ document.addEventListener('keypress', onKeyDown);
70
+ } else {
71
+ document.removeEventListener('keypress', onKeyDown);
72
+ }
73
+ return () => {
74
+ document.removeEventListener('keypress', onKeyDown);
75
+ };
76
+ }, [isOpen, onKeyDown]);
77
+
78
+ const { cancel, yes, no } = copy;
79
+ const noLabel = props?.noLabel ? props.noLabel : no;
80
+ const yesLabel = props?.yesLabel ? props.yesLabel : yes;
81
+
82
+ const modal = isOpen && (
22
83
  <Modal
23
84
  onRequestClose={onClose}
24
85
  wrapperStyle={{
@@ -27,16 +88,16 @@ export const ConfirmModal = ({
27
88
  }}
28
89
  style={{
29
90
  width: '400px',
30
- height: '12%',
91
+ height: '14%',
31
92
  top: 'calc(50% - 150px)',
32
93
  left: 'calc((100% - 400px) / 2)'
33
94
  }}
34
95
  isOpen={true}>
35
96
  <Section>
36
97
  <div className='confirm-modal'>
37
- <p>{title}</p>
98
+ <p>{props.title}</p>
38
99
  <div className='confirm-buttons'>
39
- {showCancel ? (
100
+ {props.showCancel ? (
40
101
  <Button
41
102
  onClick={onClose}
42
103
  size='large'
@@ -48,14 +109,14 @@ export const ConfirmModal = ({
48
109
  onClick={onNo}
49
110
  size='large'
50
111
  color='default'>
51
- {onNoLabel}
112
+ {noLabel}
52
113
  </Button>
53
114
  <Button
54
115
  onClick={onYes}
55
116
  size='large'
56
117
  style='bold'
57
118
  color='primary'>
58
- {onYesLabel}
119
+ {yesLabel}
59
120
  </Button>
60
121
  </div>
61
122
  </div>
@@ -26,149 +26,102 @@ const Paginator: React.FC<any> = ({
26
26
  setPageSize,
27
27
  itemsPerPage,
28
28
  onItemsPerPage
29
- }) => {
30
- const [getPageIndex, setPageIndex] = React.useState<number>(pageIndex);
31
- const [getItemsPerPage, setItemsPerPage] = React.useState<number>(itemsPerPage);
32
-
33
- React.useEffect(() => {
34
- if (pageIndex !== getPageIndex) {
35
- setPageIndex(pageIndex);
36
- }
37
- }, [pageIndex]);
38
-
39
- const onItemsPerPageBlur = () => {
40
- clearTimeout(textInputTimeout);
41
- onItemsPerPage(getItemsPerPage);
42
- };
43
-
44
- const onGoToPageBlur = () => {
45
- clearTimeout(textInputTimeout);
46
- gotoPage(getPageIndex, pageSize);
47
- };
48
-
49
- const onItemsPerPageKeyDown = (e) => {
50
- if (e.key === 'Enter') {
51
- clearTimeout(textInputTimeout);
52
- onItemsPerPage(getItemsPerPage);
53
- }
54
- };
55
-
56
- const onGoToPageKeyDown = (e) => {
57
- if (e.key === 'Enter') {
58
- clearTimeout(textInputTimeout);
59
- gotoPage(getPageIndex, pageSize);
60
- }
61
- };
62
-
63
- return (
64
- <section className='ip-table-pagination'>
29
+ }) => (
30
+ <section className='ip-table-pagination'>
31
+ <span>
32
+ <Button
33
+ style='subtle'
34
+ size='small'
35
+ tooltip='Go to first page'
36
+ disabled={!canPreviousPage}
37
+ onClick={() => gotoPage(1, pageSize)}>
38
+ {ICON_ANGLE_DOUBLE_LEFT}
39
+ </Button>
40
+ <Button
41
+ style='subtle'
42
+ size='small'
43
+ tooltip='Go to previous page'
44
+ disabled={!canPreviousPage}
45
+ onClick={() => previousPage()}>
46
+ {ICON_ANGLE_LEFT}
47
+ </Button>
48
+ <Button
49
+ style='subtle'
50
+ size='small'
51
+ tooltip='Go to next page'
52
+ disabled={!canNextPage}
53
+ onClick={() => nextPage()}>
54
+ {ICON_ANGLE_RIGHT}
55
+ </Button>
56
+ <Button
57
+ style='subtle'
58
+ size='small'
59
+ tooltip='Go to last page'
60
+ disabled={!canNextPage}
61
+ onClick={() => gotoPage(pageCount, pageSize)}>
62
+ {ICON_ANGLE_DOUBLE_RIGHT}
63
+ </Button>
64
+ &nbsp;&nbsp;
65
65
  <span>
66
- <Button
67
- style='subtle'
68
- size='small'
69
- tooltip='Go to first page'
70
- disabled={!canPreviousPage}
71
- onClick={() => gotoPage(1, pageSize)}>
72
- {ICON_ANGLE_DOUBLE_LEFT}
73
- </Button>
74
- <Button
75
- style='subtle'
76
- size='small'
77
- tooltip='Go to previous page'
78
- disabled={!canPreviousPage}
79
- onClick={() => previousPage()}>
80
- {ICON_ANGLE_LEFT}
81
- </Button>
82
- <Button
83
- style='subtle'
84
- size='small'
85
- tooltip='Go to next page'
86
- disabled={!canNextPage}
87
- onClick={() => nextPage()}>
88
- {ICON_ANGLE_RIGHT}
89
- </Button>
90
- <Button
91
- style='subtle'
92
- size='small'
93
- tooltip='Go to last page'
94
- disabled={!canNextPage}
95
- onClick={() => gotoPage(pageCount, pageSize)}>
96
- {ICON_ANGLE_DOUBLE_RIGHT}
97
- </Button>
98
- &nbsp;&nbsp;
99
- <span>
100
- {copy.table.page}&nbsp;&nbsp;
101
- <strong>
102
- {getPageIndex} of {pageCount}
103
- </strong>
104
- &nbsp;&nbsp;
105
- </span>
106
- <span>
107
- {copy.table.goToPage}&nbsp;&nbsp;
108
- <input
109
- className='paginator-input'
110
- type='number'
111
- placeholder={getPageIndex.toString()}
112
- onChange={(e) => {
113
- const input = e.target.value;
114
- const inputNum = Number(input);
115
- let next: number;
116
-
117
- clearTimeout(textInputTimeout);
118
-
119
- if (!input || inputNum < 1 || inputNum > pageCount) {
120
- return;
121
- }
122
-
123
- if (inputNum >= 1 && inputNum <= pageCount) {
124
- next = inputNum;
125
- }
126
-
127
- textInputTimeout = window.setTimeout(
128
- () => gotoPage(next, pageSize),
129
- 1000
130
- );
131
- }}
132
- onBlur={() => onGoToPageBlur()}
133
- onKeyDown={(e) => onGoToPageKeyDown(e)}
134
- />
135
- </span>
66
+ {copy.table.page}&nbsp;&nbsp;
67
+ <strong>
68
+ {pageIndex} of {pageCount}
69
+ </strong>
136
70
  &nbsp;&nbsp;
137
- <span>
138
- {copy.table.itemsPerPage}&nbsp;&nbsp;
139
- <input
140
- className='paginator-input'
141
- type='number'
142
- placeholder={getItemsPerPage.toString()}
143
- min={1}
144
- onChange={(e) => {
145
- const input = e.target.value;
146
- const inputNum = Number(input);
147
-
148
- clearTimeout(textInputTimeout);
149
-
150
- if (!input || inputNum < 1) {
151
- return;
152
- }
153
-
154
- setItemsPerPage(inputNum);
155
-
156
- textInputTimeout = window.setTimeout(
157
- () => onItemsPerPage(inputNum),
158
- 1000
159
- );
160
- }}
161
- onBlur={() => onItemsPerPageBlur()}
162
- onKeyDown={(e) => onItemsPerPageKeyDown(e)}
163
- />
164
- </span>
165
71
  </span>
166
-
167
- <span className='total-assets'>
168
- {copy.table.total}&nbsp;&nbsp;<strong>{totalItems || 0}</strong>
72
+ <span>
73
+ {copy.table.goToPage}&nbsp;&nbsp;
74
+ <input
75
+ className='paginator-input'
76
+ type='number'
77
+ placeholder={pageIndex}
78
+ onChange={(e) => {
79
+ const input = e.target.value;
80
+ const inputNum = Number(input);
81
+ let next: number;
82
+
83
+ clearTimeout(textInputTimeout);
84
+
85
+ if (!input || inputNum < 1 || inputNum > pageCount) {
86
+ return;
87
+ }
88
+
89
+ if (inputNum >= 1 && inputNum <= pageCount) {
90
+ next = inputNum;
91
+ }
92
+
93
+ textInputTimeout = window.setTimeout(() => gotoPage(next, pageSize), 300);
94
+ }}
95
+ />
169
96
  </span>
170
- </section>
171
- );
172
- };
97
+ &nbsp;&nbsp;
98
+ <span>
99
+ {copy.table.itemsPerPage}&nbsp;&nbsp;
100
+ <input
101
+ className='paginator-input'
102
+ type='number'
103
+ placeholder={itemsPerPage}
104
+ min={1}
105
+ onChange={(e) => {
106
+ const input = e.target.value;
107
+ const inputNum = Number(input);
108
+
109
+ clearTimeout(textInputTimeout);
110
+
111
+ if (!input || inputNum < 1) {
112
+ return;
113
+ }
114
+
115
+ textInputTimeout = window.setTimeout(() => onItemsPerPage(inputNum), 300);
116
+ }}
117
+ />
118
+ </span>
119
+ </span>
120
+
121
+ <span className='total-assets'>
122
+ {copy.table.total}&nbsp;&nbsp;<strong>{totalItems || 0}</strong>
123
+ </span>
124
+ </section>
125
+ );
173
126
 
174
127
  export default Paginator;
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { IImposiumAPI } from '../../services/API';
3
- import { VARIABLE_TYPES, BOOLEAN_DEFAULT_OPTIONS } from '../../constants/variables';
3
+ import {
4
+ VARIABLE_TYPES,
5
+ BOOLEAN_DEFAULT_OPTIONS,
6
+ colorPresets,
7
+ formatColor
8
+ } from '../../constants/variables';
4
9
  import { OUTPUT_TYPES } from '../../constants/previewer';
5
10
  import TextField from '../text-field/TextField';
6
11
  import Button from '../button/Button';
@@ -23,6 +28,7 @@ import LogViewer from '../log-viewer/LogViewer';
23
28
  import { connect } from 'react-redux';
24
29
  import { ICON_DOWNLOAD, ICON_CLIPBOARD } from '../../constants/icons';
25
30
  import AudioPlayer from '../players/AudioPlayer';
31
+ import ColorField from '../color-field/ColorField';
26
32
 
27
33
  interface IStoryPreviewerProps {
28
34
  api: IImposiumAPI;
@@ -137,15 +143,14 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
137
143
  const { variables } = this.props;
138
144
  const inventoryOverrides = this.props.editor?.inventoryOverrides;
139
145
  const newInv = {};
140
-
141
146
  for (const i in variables) {
142
147
  if (variables.hasOwnProperty(i)) {
143
148
  const override = inventoryOverrides ? inventoryOverrides[i] : null;
144
149
  const inv = variables[i];
145
- newInv[inv.id] = override ? override : this.getVariableValue(inv.previewItem);
150
+ newInv[inv.id] =
151
+ override !== null ? override : this.getVariableValue(inv.previewItem);
146
152
  }
147
153
  }
148
-
149
154
  return newInv;
150
155
  }
151
156
 
@@ -230,6 +235,11 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
230
235
  }
231
236
  }
232
237
 
238
+ private colorInputChanged(key, value) {
239
+ const color = formatColor(value);
240
+ this.variableInputChanged(key, color);
241
+ }
242
+
233
243
  private variableInputChanged(key, value) {
234
244
  const inventory = { ...this.state.inventory };
235
245
  inventory[key] = value;
@@ -397,6 +407,20 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
397
407
  </FieldWrapper>
398
408
  );
399
409
  break;
410
+ case VARIABLE_TYPES.COLOR:
411
+ const value = inventory[inv.id] ? inventory[inv.id] : 'rgba(0,0,0,1)';
412
+ fields.push(
413
+ <ColorField
414
+ label={inv.name}
415
+ labelPosition='top'
416
+ enableAlpha={true}
417
+ presetColors={colorPresets}
418
+ value={value}
419
+ pickerPosition='bottom'
420
+ onChange={(v) => this.colorInputChanged(inv.id, v)}
421
+ />
422
+ );
423
+ break;
400
424
  }
401
425
  }
402
426
  }
@@ -273,7 +273,7 @@ export const copying: any = {
273
273
  };
274
274
 
275
275
  export const confirm: any = {
276
- yes: 'Save',
277
- no: "Don't Save",
276
+ yes: 'Yes',
277
+ no: 'No',
278
278
  cancel: 'Cancel'
279
279
  };
@@ -74,6 +74,7 @@ import {
74
74
  import { faCircleSmall } from '@fortawesome/pro-solid-svg-icons/faCircleSmall';
75
75
  import { faClapperboardPlay } from '@fortawesome/pro-solid-svg-icons/faClapperboardPlay';
76
76
  import { faCloudArrowUp, faFilters } from '@fortawesome/pro-solid-svg-icons';
77
+ import { faCircleExclamation } from '@fortawesome/free-solid-svg-icons';
77
78
 
78
79
  export const ICON_VIDEO = <FontAwesomeIcon icon={faVideo} />;
79
80
 
@@ -220,3 +221,5 @@ export const ICON_CODE = <FontAwesomeIcon icon={faCode} />;
220
221
  export const ICON_UP_RIGHT_FROM_SQUARE = <FontAwesomeIcon icon={faUpRightFromSquare} />;
221
222
 
222
223
  export const ICON_FILE_UPLOAD = <FontAwesomeIcon icon={faCloudArrowUp} />;
224
+
225
+ export const ICON_FILE_ERROR = <FontAwesomeIcon icon={faCircleExclamation} />;
@@ -5,7 +5,8 @@ export const VARIABLE_TYPES = {
5
5
  ENUM: 'enum',
6
6
  IMAGE: 'image',
7
7
  VIDEO: 'video',
8
- AUDIO: 'audio'
8
+ AUDIO: 'audio',
9
+ COLOR: 'color'
9
10
  };
10
11
 
11
12
  export const BOOLEAN_DEFAULT_OPTIONS = [
@@ -18,3 +19,28 @@ export const BOOLEAN_DEFAULT_OPTIONS = [
18
19
  label: 'False'
19
20
  }
20
21
  ];
22
+
23
+ export const colorPresets = [
24
+ '#D0021B',
25
+ '#F5A623',
26
+ '#F8E71C',
27
+ '#8B572A',
28
+ '#7ED321',
29
+ '#417505',
30
+ '#BD10E0',
31
+ '#9013FE',
32
+ '#4A90E2',
33
+ '#50E3C2',
34
+ '#B8E986',
35
+ '#000000',
36
+ '#4A4A4A',
37
+ '#9B9B9B',
38
+ '#FFFFFF',
39
+ 'transparent'
40
+ ];
41
+
42
+ export const formatColor = (color) => {
43
+ const { r, g, b, a } = color.rgb;
44
+ const alpha = color.source === 'hsv' ? 1 : a;
45
+ return `rgba(${r},${g},${b},${alpha})`;
46
+ };
package/src/index.ts CHANGED
@@ -158,7 +158,7 @@ import ContextMenuItem from './components/context-menu/ContextMenuItem';
158
158
  import ContextMenuTrigger from './components/context-menu/ContextMenuTrigger';
159
159
  import CopyPropIdButton from './components/copy-prop-id-button/CopyPropIdButton';
160
160
  import Submenu from './components/context-menu/SubMenu';
161
- import { ConfirmModal } from './components/confirm-modal/ConfirmModal';
161
+ import { ConfirmModal, IConfirmModalProps } from './components/confirm-modal/ConfirmModal';
162
162
 
163
163
  export {
164
164
  AppWrapper,
@@ -313,5 +313,6 @@ export {
313
313
  ContextMenuTrigger,
314
314
  Submenu,
315
315
  CopyPropIdButton,
316
- ConfirmModal
316
+ ConfirmModal,
317
+ IConfirmModalProps
317
318
  };
@@ -83,7 +83,6 @@ export const deleteAssets = (api: IImposiumAPI, ids: string[], storyId: string):
83
83
  api.deleteAssets(ids)
84
84
  .then(() => {
85
85
  dispatch(getAssets(api, storyId));
86
- dispatch(toggleLoading(false));
87
86
  resolve(true);
88
87
  })
89
88
  .catch((errors: Error[]) => {
@@ -7,7 +7,8 @@ const assetUploadsActions: any = {
7
7
  UPDATE_UPLOAD: 'assetUploads/UPDATE_UPLOAD',
8
8
  UPDATE_PERCENT_UPLOADED: 'assetUploads/UPDATE_PERCENT_UPLOADED',
9
9
  ADD_UPLOAD_ASSET_ID: 'assetUploads/ADD_UPLOAD_ASSET_ID',
10
- REMOVE_UPLOAD: 'assetUploads/REMOVE_UPLOAD'
10
+ REMOVE_UPLOAD: 'assetUploads/REMOVE_UPLOAD',
11
+ ERROR: 'assetUploads/ERROR'
11
12
  };
12
13
 
13
14
  const POLL_INTERVAL: number = 5000;
@@ -241,6 +242,15 @@ const uploadAssetHandler = (api: IImposiumAPI, dispatch, getStore) => {
241
242
  if (axios.isCancel(e) && currentQueue !== queueLength - 1) {
242
243
  currentQueue = currentQueue + 1;
243
244
  createPromise(currentQueue);
245
+ } else {
246
+ const error: any = { ...e };
247
+ const errorMsg = error.response.data.error.split(':')[0];
248
+ dispatch({
249
+ type: assetUploadsActions.ERROR,
250
+ filename: uploadBlobs[activeIndex].filename,
251
+ errorMsg
252
+ });
253
+ doAssetTableHydration(api, storyId);
244
254
  }
245
255
  });
246
256
  }
@@ -354,6 +364,15 @@ export const replaceAsset = (
354
364
  if (axios.isCancel(e) && currentQueue !== queueLength - 1) {
355
365
  currentQueue = currentQueue + 1;
356
366
  createPromise(currentQueue);
367
+ } else {
368
+ const error: any = { ...e };
369
+ const errorMsg = error.response.data.error.split(':')[0];
370
+ dispatch({
371
+ type: assetUploadsActions.ERROR,
372
+ filename: replacedFileBlobs[activeIndex].filename,
373
+ errorMsg
374
+ });
375
+ doAssetTableHydration(api, storyId);
357
376
  }
358
377
  });
359
378
  };
@@ -47,6 +47,17 @@ const assetUploads = (state = initialState, action): any => {
47
47
  ...state,
48
48
  uploads: state.uploads.filter((u: any) => u.filename !== action.filename)
49
49
  };
50
+ case assetUploadsActions.ERROR:
51
+ const newError = state.uploads.map((u: any) => {
52
+ if (u.filename === action.filename) {
53
+ return { ...u, error: action.errorMsg };
54
+ }
55
+ return u;
56
+ });
57
+ return {
58
+ ...state,
59
+ uploads: newError
60
+ };
50
61
  default:
51
62
  return state;
52
63
  }
@@ -153,6 +153,9 @@ interface ITTSOptions {
153
153
  voice: string;
154
154
  service: string;
155
155
  model?: string;
156
+ speed?: string;
157
+ pause_silences?: boolean;
158
+ minimum_silence_length?: number;
156
159
  }
157
160
 
158
161
  interface ICancelTokenCache {
@@ -1607,6 +1610,18 @@ export default class API {
1607
1610
  url += `&model=${options.model}`;
1608
1611
  }
1609
1612
 
1613
+ if (options.speed) {
1614
+ url += `&speed=${options.speed}`;
1615
+ }
1616
+
1617
+ if (options.pause_silences) {
1618
+ url += `&pause_silences=${options.pause_silences}`;
1619
+ }
1620
+
1621
+ if (options.minimum_silence_length) {
1622
+ url += `&minimum_silence_length=${options.minimum_silence_length}`;
1623
+ }
1624
+
1610
1625
  return this.doRequest({
1611
1626
  url,
1612
1627
  method: 'GET',