@coorpacademy/components 10.13.6 → 10.13.9

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 (163) hide show
  1. package/es/atom/button-link-icon-only/test/fixtures.js +0 -2
  2. package/es/atom/button-link-icon-only/test/fixtures.js.map +1 -1
  3. package/es/atom/drag-and-drop/index.js +75 -47
  4. package/es/atom/drag-and-drop/index.js.map +1 -1
  5. package/es/atom/drag-and-drop/style.css +173 -73
  6. package/es/atom/drag-and-drop/test/dragging.js +8 -1
  7. package/es/atom/drag-and-drop/test/dragging.js.map +1 -1
  8. package/es/atom/drag-and-drop/test/fixtures/clean-and-modified.js +12 -0
  9. package/es/atom/drag-and-drop/test/fixtures/clean-and-modified.js.map +1 -0
  10. package/es/atom/drag-and-drop/test/fixtures/default.js +3 -3
  11. package/es/atom/drag-and-drop/test/fixtures/default.js.map +1 -1
  12. package/es/atom/drag-and-drop/test/fixtures/error.js +12 -0
  13. package/es/atom/drag-and-drop/test/fixtures/error.js.map +1 -0
  14. package/es/atom/drag-and-drop/test/fixtures/modified.js +12 -0
  15. package/es/atom/drag-and-drop/test/fixtures/modified.js.map +1 -0
  16. package/es/atom/drag-and-drop/test/fixtures/with-children.js +1 -14
  17. package/es/atom/drag-and-drop/test/fixtures/with-children.js.map +1 -1
  18. package/es/atom/drag-and-drop/test/fixtures/with-image.js +1 -1
  19. package/es/atom/drag-and-drop/test/fixtures/with-image.js.map +1 -1
  20. package/es/atom/drag-and-drop/test/fixtures/with-long-description.js +12 -0
  21. package/es/atom/drag-and-drop/test/fixtures/with-long-description.js.map +1 -0
  22. package/es/atom/drag-and-drop/test/fixtures/with-video.js +2 -1
  23. package/es/atom/drag-and-drop/test/fixtures/with-video.js.map +1 -1
  24. package/es/atom/drag-and-drop/test/fixtures.js +8 -0
  25. package/es/atom/drag-and-drop/test/fixtures.js.map +1 -1
  26. package/es/atom/image-upload/index.js +6 -3
  27. package/es/atom/image-upload/index.js.map +1 -1
  28. package/es/atom/image-upload/test/fixtures/clean-modified.js +13 -0
  29. package/es/atom/image-upload/test/fixtures/clean-modified.js.map +1 -0
  30. package/es/atom/image-upload/test/fixtures/{without-image.js → default.js} +1 -1
  31. package/es/atom/image-upload/test/fixtures/default.js.map +1 -0
  32. package/es/atom/image-upload/test/fixtures.js +4 -2
  33. package/es/atom/image-upload/test/fixtures.js.map +1 -1
  34. package/es/atom/loader/style.css +7 -3
  35. package/es/atom/review-header-step-item/style.css +1 -5
  36. package/es/molecule/brand-form-group/index.js +3 -1
  37. package/es/molecule/brand-form-group/index.js.map +1 -1
  38. package/es/molecule/brand-form-group/style.css +5 -0
  39. package/es/molecule/brand-form-group/test/fixtures/images.js +6 -2
  40. package/es/molecule/brand-form-group/test/fixtures/images.js.map +1 -1
  41. package/es/molecule/course-sections/index.js +4 -1
  42. package/es/molecule/course-sections/index.js.map +1 -1
  43. package/es/molecule/course-sections/style.css +14 -1
  44. package/es/molecule/drag-and-drop-wrapper/test/fixtures.js +15 -0
  45. package/es/molecule/drag-and-drop-wrapper/test/fixtures.js.map +1 -0
  46. package/es/molecule/questions/qcm-graphic/style.css +1 -1
  47. package/es/molecule/search/test/fixtures.js +15 -0
  48. package/es/molecule/search/test/fixtures.js.map +1 -0
  49. package/es/molecule/setup-slide/index.js +3 -1
  50. package/es/molecule/setup-slide/index.js.map +1 -1
  51. package/es/molecule/setup-slide/style.css +5 -0
  52. package/es/molecule/setup-slide/test/fixtures/without-upload-image.js +41 -0
  53. package/es/molecule/setup-slide/test/fixtures/without-upload-image.js.map +1 -0
  54. package/es/molecule/setup-slide/test/fixtures.js +2 -0
  55. package/es/molecule/setup-slide/test/fixtures.js.map +1 -1
  56. package/es/molecule/setup-slider/test/fixtures/default.js +8 -4
  57. package/es/molecule/setup-slider/test/fixtures/default.js.map +1 -1
  58. package/es/organism/brand-form/test/fixtures/lms.js +14 -0
  59. package/es/organism/brand-form/test/fixtures/lms.js.map +1 -1
  60. package/es/organism/course-selection/index.js +2 -1
  61. package/es/organism/course-selection/index.js.map +1 -1
  62. package/es/organism/course-selection/style.css +12 -3
  63. package/es/organism/course-selection/test/fixtures/loading.js +9 -0
  64. package/es/organism/course-selection/test/fixtures/loading.js.map +1 -0
  65. package/es/organism/course-selection/test/fixtures.js +2 -0
  66. package/es/organism/course-selection/test/fixtures.js.map +1 -1
  67. package/es/organism/search-and-chips-results/index.js +2 -1
  68. package/es/organism/search-and-chips-results/index.js.map +1 -1
  69. package/es/organism/search-and-chips-results/style.css +10 -3
  70. package/es/organism/search-and-chips-results/test/fixtures/loading.js +9 -0
  71. package/es/organism/search-and-chips-results/test/fixtures/loading.js.map +1 -0
  72. package/es/organism/search-and-chips-results/test/fixtures.js +2 -0
  73. package/es/organism/search-and-chips-results/test/fixtures.js.map +1 -1
  74. package/es/template/back-office/brand-update/index.js +5 -2
  75. package/es/template/back-office/brand-update/index.js.map +1 -1
  76. package/es/template/back-office/brand-update/style.css +10 -1
  77. package/es/util/button-icons.js +3 -2
  78. package/es/util/button-icons.js.map +1 -1
  79. package/lib/atom/button-link-icon-only/test/fixtures.js +0 -3
  80. package/lib/atom/button-link-icon-only/test/fixtures.js.map +1 -1
  81. package/lib/atom/drag-and-drop/index.js +77 -46
  82. package/lib/atom/drag-and-drop/index.js.map +1 -1
  83. package/lib/atom/drag-and-drop/style.css +173 -73
  84. package/lib/atom/drag-and-drop/test/dragging.js +8 -1
  85. package/lib/atom/drag-and-drop/test/dragging.js.map +1 -1
  86. package/lib/atom/drag-and-drop/test/fixtures/clean-and-modified.js +21 -0
  87. package/lib/atom/drag-and-drop/test/fixtures/clean-and-modified.js.map +1 -0
  88. package/lib/atom/drag-and-drop/test/fixtures/default.js +3 -3
  89. package/lib/atom/drag-and-drop/test/fixtures/default.js.map +1 -1
  90. package/lib/atom/drag-and-drop/test/fixtures/error.js +21 -0
  91. package/lib/atom/drag-and-drop/test/fixtures/error.js.map +1 -0
  92. package/lib/atom/drag-and-drop/test/fixtures/modified.js +21 -0
  93. package/lib/atom/drag-and-drop/test/fixtures/modified.js.map +1 -0
  94. package/lib/atom/drag-and-drop/test/fixtures/with-children.js +1 -19
  95. package/lib/atom/drag-and-drop/test/fixtures/with-children.js.map +1 -1
  96. package/lib/atom/drag-and-drop/test/fixtures/with-image.js +1 -1
  97. package/lib/atom/drag-and-drop/test/fixtures/with-image.js.map +1 -1
  98. package/lib/atom/drag-and-drop/test/fixtures/with-long-description.js +21 -0
  99. package/lib/atom/drag-and-drop/test/fixtures/with-long-description.js.map +1 -0
  100. package/lib/atom/drag-and-drop/test/fixtures/with-video.js +2 -1
  101. package/lib/atom/drag-and-drop/test/fixtures/with-video.js.map +1 -1
  102. package/lib/atom/drag-and-drop/test/fixtures.js +12 -0
  103. package/lib/atom/drag-and-drop/test/fixtures.js.map +1 -1
  104. package/lib/atom/image-upload/index.js +6 -3
  105. package/lib/atom/image-upload/index.js.map +1 -1
  106. package/lib/atom/image-upload/test/fixtures/clean-modified.js +22 -0
  107. package/lib/atom/image-upload/test/fixtures/clean-modified.js.map +1 -0
  108. package/lib/atom/image-upload/test/fixtures/{without-image.js → default.js} +1 -1
  109. package/lib/atom/image-upload/test/fixtures/default.js.map +1 -0
  110. package/lib/atom/image-upload/test/fixtures.js +6 -3
  111. package/lib/atom/image-upload/test/fixtures.js.map +1 -1
  112. package/lib/atom/loader/style.css +7 -3
  113. package/lib/atom/review-header-step-item/style.css +1 -5
  114. package/lib/molecule/brand-form-group/index.js +3 -1
  115. package/lib/molecule/brand-form-group/index.js.map +1 -1
  116. package/lib/molecule/brand-form-group/style.css +5 -0
  117. package/lib/molecule/brand-form-group/test/fixtures/images.js +6 -2
  118. package/lib/molecule/brand-form-group/test/fixtures/images.js.map +1 -1
  119. package/lib/molecule/course-sections/index.js +4 -1
  120. package/lib/molecule/course-sections/index.js.map +1 -1
  121. package/lib/molecule/course-sections/style.css +14 -1
  122. package/lib/molecule/drag-and-drop-wrapper/test/fixtures.js +25 -0
  123. package/lib/molecule/drag-and-drop-wrapper/test/fixtures.js.map +1 -0
  124. package/lib/molecule/questions/qcm-graphic/style.css +1 -1
  125. package/lib/molecule/search/test/fixtures.js +25 -0
  126. package/lib/molecule/search/test/fixtures.js.map +1 -0
  127. package/lib/molecule/setup-slide/index.js +3 -1
  128. package/lib/molecule/setup-slide/index.js.map +1 -1
  129. package/lib/molecule/setup-slide/style.css +5 -0
  130. package/lib/molecule/setup-slide/test/fixtures/without-upload-image.js +46 -0
  131. package/lib/molecule/setup-slide/test/fixtures/without-upload-image.js.map +1 -0
  132. package/lib/molecule/setup-slide/test/fixtures.js +3 -0
  133. package/lib/molecule/setup-slide/test/fixtures.js.map +1 -1
  134. package/lib/molecule/setup-slider/test/fixtures/default.js +7 -2
  135. package/lib/molecule/setup-slider/test/fixtures/default.js.map +1 -1
  136. package/lib/organism/brand-form/test/fixtures/lms.js +14 -0
  137. package/lib/organism/brand-form/test/fixtures/lms.js.map +1 -1
  138. package/lib/organism/course-selection/index.js +2 -1
  139. package/lib/organism/course-selection/index.js.map +1 -1
  140. package/lib/organism/course-selection/style.css +12 -3
  141. package/lib/organism/course-selection/test/fixtures/loading.js +19 -0
  142. package/lib/organism/course-selection/test/fixtures/loading.js.map +1 -0
  143. package/lib/organism/course-selection/test/fixtures.js +3 -0
  144. package/lib/organism/course-selection/test/fixtures.js.map +1 -1
  145. package/lib/organism/search-and-chips-results/index.js +2 -1
  146. package/lib/organism/search-and-chips-results/index.js.map +1 -1
  147. package/lib/organism/search-and-chips-results/style.css +10 -3
  148. package/lib/organism/search-and-chips-results/test/fixtures/loading.js +19 -0
  149. package/lib/organism/search-and-chips-results/test/fixtures/loading.js.map +1 -0
  150. package/lib/organism/search-and-chips-results/test/fixtures.js +3 -0
  151. package/lib/organism/search-and-chips-results/test/fixtures.js.map +1 -1
  152. package/lib/template/back-office/brand-update/index.js +5 -2
  153. package/lib/template/back-office/brand-update/index.js.map +1 -1
  154. package/lib/template/back-office/brand-update/style.css +10 -1
  155. package/lib/util/button-icons.js +2 -1
  156. package/lib/util/button-icons.js.map +1 -1
  157. package/package.json +3 -3
  158. package/es/atom/image-upload/test/fixtures/without-image.js.map +0 -1
  159. package/es/organism/review-header/test/fixtures.js +0 -23
  160. package/es/organism/review-header/test/fixtures.js.map +0 -1
  161. package/lib/atom/image-upload/test/fixtures/without-image.js.map +0 -1
  162. package/lib/organism/review-header/test/fixtures.js +0 -37
  163. package/lib/organism/review-header/test/fixtures.js.map +0 -1
@@ -5,7 +5,6 @@ import AtomButtonLinkIconOnly from '..';
5
5
  import fixtureButtonIconBullet from './fixtures/button-icon-bullet';
6
6
  import fixtureDefault from './fixtures/default';
7
7
  import fixtureNoIcon from './fixtures/no-icon';
8
- import fixtureReviewHeader from './fixtures/review-header';
9
8
  import fixtureSmallButtonDisabled from './fixtures/small-button-disabled';
10
9
  import fixtureSmallLinkDownload from './fixtures/small-link-download';
11
10
  test('Atom › AtomButtonLinkIconOnly > should have valid propTypes', t => {
@@ -17,7 +16,6 @@ test('Atom › AtomButtonLinkIconOnly > should have valid propTypes', t => {
17
16
  test('Atom › AtomButtonLinkIconOnly › ButtonIconBullet › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureButtonIconBullet);
18
17
  test('Atom › AtomButtonLinkIconOnly › Default › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureDefault);
19
18
  test('Atom › AtomButtonLinkIconOnly › NoIcon › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureNoIcon);
20
- test('Atom › AtomButtonLinkIconOnly › ReviewHeader › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureReviewHeader);
21
19
  test('Atom › AtomButtonLinkIconOnly › SmallButtonDisabled › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureSmallButtonDisabled);
22
20
  test('Atom › AtomButtonLinkIconOnly › SmallLinkDownload › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureSmallLinkDownload);
23
21
  //# sourceMappingURL=fixtures.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/atom/button-link-icon-only/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","AtomButtonLinkIconOnly","fixtureButtonIconBullet","fixtureDefault","fixtureNoIcon","fixtureReviewHeader","fixtureSmallButtonDisabled","fixtureSmallLinkDownload","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,sBAAP,MAAmC,IAAnC;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,aAAP,MAA0B,oBAA1B;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AACA,OAAOC,wBAAP,MAAqC,gCAArC;AAEAT,IAAI,CAAC,6DAAD,EAAgEU,CAAC,IAAI;AACvEA,EAAAA,CAAC,CAACC,IAAF;AACAV,EAAAA,OAAO,CAACE,sBAAsB,CAACS,SAAxB,EAAmC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACxDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,uDAAsDF,GAAI,mEAAnF;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAd,IAAI,CAAC,uEAAD,EAA0EE,oBAA1E,EAAgGC,sBAAhG,EAAwHC,uBAAxH,CAAJ;AACAJ,IAAI,CAAC,8DAAD,EAAiEE,oBAAjE,EAAuFC,sBAAvF,EAA+GE,cAA/G,CAAJ;AACAL,IAAI,CAAC,6DAAD,EAAgEE,oBAAhE,EAAsFC,sBAAtF,EAA8GG,aAA9G,CAAJ;AACAN,IAAI,CAAC,mEAAD,EAAsEE,oBAAtE,EAA4FC,sBAA5F,EAAoHI,mBAApH,CAAJ;AACAP,IAAI,CAAC,0EAAD,EAA6EE,oBAA7E,EAAmGC,sBAAnG,EAA2HK,0BAA3H,CAAJ;AACAR,IAAI,CAAC,wEAAD,EAA2EE,oBAA3E,EAAiGC,sBAAjG,EAAyHM,wBAAzH,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport AtomButtonLinkIconOnly from '..';\nimport fixtureButtonIconBullet from './fixtures/button-icon-bullet';\nimport fixtureDefault from './fixtures/default';\nimport fixtureNoIcon from './fixtures/no-icon';\nimport fixtureReviewHeader from './fixtures/review-header';\nimport fixtureSmallButtonDisabled from './fixtures/small-button-disabled';\nimport fixtureSmallLinkDownload from './fixtures/small-link-download';\n\ntest('Atom › AtomButtonLinkIconOnly > should have valid propTypes', t => {\n t.pass();\n forEach(AtomButtonLinkIconOnly.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Atom.AtomButtonLinkIconOnly.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Atom › AtomButtonLinkIconOnly › ButtonIconBullet › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureButtonIconBullet);\ntest('Atom › AtomButtonLinkIconOnly › Default › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureDefault);\ntest('Atom › AtomButtonLinkIconOnly › NoIcon › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureNoIcon);\ntest('Atom › AtomButtonLinkIconOnly › ReviewHeader › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureReviewHeader);\ntest('Atom › AtomButtonLinkIconOnly › SmallButtonDisabled › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureSmallButtonDisabled);\ntest('Atom › AtomButtonLinkIconOnly › SmallLinkDownload › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureSmallLinkDownload);\n"],"file":"fixtures.js"}
1
+ {"version":3,"sources":["../../../../src/atom/button-link-icon-only/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","AtomButtonLinkIconOnly","fixtureButtonIconBullet","fixtureDefault","fixtureNoIcon","fixtureSmallButtonDisabled","fixtureSmallLinkDownload","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,sBAAP,MAAmC,IAAnC;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,aAAP,MAA0B,oBAA1B;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AACA,OAAOC,wBAAP,MAAqC,gCAArC;AAEAR,IAAI,CAAC,6DAAD,EAAgES,CAAC,IAAI;AACvEA,EAAAA,CAAC,CAACC,IAAF;AACAT,EAAAA,OAAO,CAACE,sBAAsB,CAACQ,SAAxB,EAAmC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACxDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,uDAAsDF,GAAI,mEAAnF;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAb,IAAI,CAAC,uEAAD,EAA0EE,oBAA1E,EAAgGC,sBAAhG,EAAwHC,uBAAxH,CAAJ;AACAJ,IAAI,CAAC,8DAAD,EAAiEE,oBAAjE,EAAuFC,sBAAvF,EAA+GE,cAA/G,CAAJ;AACAL,IAAI,CAAC,6DAAD,EAAgEE,oBAAhE,EAAsFC,sBAAtF,EAA8GG,aAA9G,CAAJ;AACAN,IAAI,CAAC,0EAAD,EAA6EE,oBAA7E,EAAmGC,sBAAnG,EAA2HI,0BAA3H,CAAJ;AACAP,IAAI,CAAC,wEAAD,EAA2EE,oBAA3E,EAAiGC,sBAAjG,EAAyHK,wBAAzH,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport AtomButtonLinkIconOnly from '..';\nimport fixtureButtonIconBullet from './fixtures/button-icon-bullet';\nimport fixtureDefault from './fixtures/default';\nimport fixtureNoIcon from './fixtures/no-icon';\nimport fixtureSmallButtonDisabled from './fixtures/small-button-disabled';\nimport fixtureSmallLinkDownload from './fixtures/small-link-download';\n\ntest('Atom › AtomButtonLinkIconOnly > should have valid propTypes', t => {\n t.pass();\n forEach(AtomButtonLinkIconOnly.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Atom.AtomButtonLinkIconOnly.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Atom › AtomButtonLinkIconOnly › ButtonIconBullet › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureButtonIconBullet);\ntest('Atom › AtomButtonLinkIconOnly › Default › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureDefault);\ntest('Atom › AtomButtonLinkIconOnly › NoIcon › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureNoIcon);\ntest('Atom › AtomButtonLinkIconOnly › SmallButtonDisabled › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureSmallButtonDisabled);\ntest('Atom › AtomButtonLinkIconOnly › SmallLinkDownload › should be rendered', renderComponentMacro, AtomButtonLinkIconOnly, fixtureSmallLinkDownload);\n"],"file":"fixtures.js"}
@@ -1,16 +1,15 @@
1
+ import _isEmpty from "lodash/fp/isEmpty";
1
2
  import _constant from "lodash/fp/constant";
2
- import _get from "lodash/fp/get";
3
3
  import _uniqueId from "lodash/fp/uniqueId";
4
4
 
5
5
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
 
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
7
  import React from 'react';
10
8
  import PropTypes from 'prop-types';
11
- import { NovaSolidDataTransferDataUpload1 as UploadIcon, NovaLineStatusClose as Close } from '@coorpacademy/nova-icons';
12
- import Provider from '../provider';
9
+ import { NovaLineStatusClose as Close, NovaSolidFilesBasicFileUpload2 as FileUploadIcon, NovaSolidFilesBasicFileBlock2 as FileUploadBlockedIcon } from '@coorpacademy/nova-icons';
13
10
  import Loader from '../loader';
11
+ import Button from '../button-link';
12
+ import getClassState from '../../util/get-class-state';
14
13
  import style from './style.css';
15
14
 
16
15
  const constantNull = _constant(null);
@@ -38,12 +37,6 @@ class DragAndDrop extends React.Component {
38
37
  }
39
38
 
40
39
  render() {
41
- const {
42
- skin
43
- } = this.context;
44
-
45
- const brandColor = _get('common.brand', skin);
46
-
47
40
  const idBox = _uniqueId('drop-box-');
48
41
 
49
42
  const {
@@ -55,7 +48,8 @@ class DragAndDrop extends React.Component {
55
48
  previewContent,
56
49
  loading = false,
57
50
  modified = false,
58
- onReset = null
51
+ onReset = null,
52
+ error = ''
59
53
  } = this.props;
60
54
  const {
61
55
  dragging
@@ -64,72 +58,105 @@ class DragAndDrop extends React.Component {
64
58
 
65
59
  if (previewContent && previewContent.type === 'image') {
66
60
  previewView = /*#__PURE__*/React.createElement("div", {
67
- className: style.previewView
61
+ className: style.preview
68
62
  }, /*#__PURE__*/React.createElement("img", {
69
63
  src: previewContent.src
70
64
  }));
71
65
  } else if (previewContent && previewContent.type === 'video') {
72
66
  previewView = /*#__PURE__*/React.createElement("div", {
73
- className: _extends(_extends({}, style.previewView), {}, {
74
- width: '300px'
75
- })
67
+ className: style.preview
76
68
  }, /*#__PURE__*/React.createElement("video", {
77
- width: "100%",
78
69
  controls: true,
79
70
  src: previewContent.src,
80
71
  type: "video/*"
81
72
  }));
82
73
  } else if (loading) {
83
74
  previewView = /*#__PURE__*/React.createElement("div", {
84
- className: style.loading
85
- }, /*#__PURE__*/React.createElement(Loader, null));
75
+ className: style.loaderWrapper
76
+ }, /*#__PURE__*/React.createElement("div", {
77
+ className: style.loadingCancel
78
+ }, /*#__PURE__*/React.createElement(Close, {
79
+ "data-name": "reset-content-icon",
80
+ height: 24,
81
+ width: 24,
82
+ className: style.closeIcon,
83
+ onClick: onReset
84
+ })), /*#__PURE__*/React.createElement("div", {
85
+ className: style.loader
86
+ }, /*#__PURE__*/React.createElement(Loader, {
87
+ theme: "coorpmanager"
88
+ })), /*#__PURE__*/React.createElement("span", {
89
+ className: style.loaderText
90
+ }, "Uploading"));
86
91
  } else {
87
92
  previewView = /*#__PURE__*/React.createElement("span", null, previewLabel);
88
93
  }
89
94
 
90
- const resetContent = previewContent && previewContent.src && onReset ? /*#__PURE__*/React.createElement("div", {
95
+ const resetContent = previewContent && previewContent.src ? /*#__PURE__*/React.createElement("div", {
91
96
  className: style.resetUploadWrapper
92
97
  }, /*#__PURE__*/React.createElement("div", {
93
98
  className: style.resetSrcLabel
94
- }, previewContent.src), /*#__PURE__*/React.createElement(Close, {
99
+ }, previewContent.src), onReset ? /*#__PURE__*/React.createElement(Close, {
95
100
  "data-name": "reset-content-icon",
96
- height: 16,
97
- width: 16,
101
+ height: 24,
102
+ width: 24,
98
103
  className: style.closeIcon,
99
104
  onClick: onReset
100
- })) : null;
105
+ }) : null) : null;
106
+
107
+ const buildButton = () => {
108
+ const defaultButtonProps = {
109
+ label: uploadLabel,
110
+ 'aria-label': 'aria button',
111
+ 'data-name': 'default-button',
112
+ icon: {
113
+ position: 'left',
114
+ type: 'folders'
115
+ }
116
+ };
117
+
118
+ if (dragging) {
119
+ return null;
120
+ } else if (error) {
121
+ return /*#__PURE__*/React.createElement(Button, _extends({}, defaultButtonProps, {
122
+ label: "Try again",
123
+ icon: {}
124
+ }));
125
+ } else {
126
+ return /*#__PURE__*/React.createElement(Button, defaultButtonProps);
127
+ }
128
+ };
129
+
130
+ const button = buildButton(dragging, error);
131
+ const previewContainer = getClassState(style.previewContainer, style.modifiedPreviewContainer, null, modified, error);
132
+ const inputWrapper = getClassState(style.inputWrapper, style.modifiedInputWrapper, style.errorInputWrapper, modified, error);
101
133
  return /*#__PURE__*/React.createElement("div", {
102
134
  className: style.wrapper,
103
135
  "data-name": "drag-and-drop-wrapper"
104
136
  }, /*#__PURE__*/React.createElement("div", {
105
137
  className: style.title
106
- }, title), /*#__PURE__*/React.createElement("div", {
107
- className: modified ? style.modified : style.previewWrapper
108
- }, previewView), /*#__PURE__*/React.createElement("div", {
109
- className: dragging ? style.dragging : style.inputWrapper,
138
+ }, title), !_isEmpty(previewContent) || loading ? /*#__PURE__*/React.createElement("div", {
139
+ className: previewContainer
140
+ }, previewView) : /*#__PURE__*/React.createElement("div", {
141
+ className: dragging ? style.dragging : inputWrapper,
110
142
  id: idBox
111
- }, /*#__PURE__*/React.createElement(UploadIcon, {
112
- className: style.arrow,
113
- color: brandColor
114
- }), /*#__PURE__*/React.createElement("div", {
115
- className: style.uploadLabel
116
- }, uploadLabel), children(this.handleDragStart, this.handleDragStop)), resetContent, description ?
117
- /*#__PURE__*/
118
- // eslint-disable-next-line react/no-danger
119
- React.createElement("div", {
120
- className: style.description,
121
- dangerouslySetInnerHTML: {
122
- __html: description
123
- }
124
- }) : null);
143
+ }, /*#__PURE__*/React.createElement("div", {
144
+ className: style.infosContainer
145
+ }, error ? /*#__PURE__*/React.createElement(FileUploadBlockedIcon, {
146
+ className: style.iconError
147
+ }) : /*#__PURE__*/React.createElement(FileUploadIcon, {
148
+ className: style.icon
149
+ }), description ? /*#__PURE__*/React.createElement("div", {
150
+ className: style.description
151
+ }, description) : null, error ? null : /*#__PURE__*/React.createElement("div", {
152
+ className: style.dragAndDropLabel
153
+ }, 'Drag & Drop here')), button, /*#__PURE__*/React.createElement("div", null, children(this.handleDragStart, this.handleDragStop))), error ? /*#__PURE__*/React.createElement("span", {
154
+ className: style.errorMessage
155
+ }, error) : resetContent);
125
156
  }
126
157
 
127
158
  }
128
159
 
129
- _defineProperty(DragAndDrop, "contextTypes", {
130
- skin: Provider.childContextTypes.skin
131
- });
132
-
133
160
  DragAndDrop.propTypes = process.env.NODE_ENV !== "production" ? {
134
161
  title: PropTypes.string,
135
162
  description: PropTypes.string,
@@ -142,7 +169,8 @@ DragAndDrop.propTypes = process.env.NODE_ENV !== "production" ? {
142
169
  loading: PropTypes.bool,
143
170
  modified: PropTypes.bool,
144
171
  children: PropTypes.func,
145
- onReset: PropTypes.func
172
+ onReset: PropTypes.func,
173
+ error: PropTypes.string
146
174
  } : {};
147
175
  export default DragAndDrop;
148
176
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/atom/drag-and-drop/index.js"],"names":["React","PropTypes","NovaSolidDataTransferDataUpload1","UploadIcon","NovaLineStatusClose","Close","Provider","Loader","style","constantNull","DragAndDrop","Component","constructor","props","state","dragging","handleDragStart","bind","handleDragStop","setState","render","skin","context","brandColor","idBox","children","title","description","uploadLabel","previewLabel","previewContent","loading","modified","onReset","previewView","type","src","width","resetContent","resetUploadWrapper","resetSrcLabel","closeIcon","wrapper","previewWrapper","inputWrapper","arrow","__html","childContextTypes","propTypes","string","shape","bool","func"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SACEC,gCAAgC,IAAIC,UADtC,EAEEC,mBAAmB,IAAIC,KAFzB,QAGO,0BAHP;AAIA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,YAAY,GAAG,UAAS,IAAT,CAArB;;AAEA,MAAMC,WAAN,SAA0BV,KAAK,CAACW,SAAhC,CAA0C;AAoBxCC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;AAEA,SAAKC,KAAL,GAAa;AACXC,MAAAA,QAAQ,EAAE;AADC,KAAb;AAIA,SAAKC,eAAL,GAAuB,KAAKA,eAAL,CAAqBC,IAArB,CAA0B,IAA1B,CA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KAAK,EAAEtB;AAA3C,MADF,eAEE;AAAK,MAAA,SAAS,EAAEf,KAAK,CAACoB;AAAtB,OAAoCA,WAApC,CAFF,EAGGH,QAAQ,CAAC,KAAKT,eAAN,EAAuB,KAAKE,cAA5B,CAHX,CAHF,EAQGoB,YARH,EASGX,WAAW;AAAA;AACV;AACA;AAAK,MAAA,SAAS,EAAEnB,KAAK,CAACmB,WAAtB;AAAmC,MAAA,uBAAuB,EAAE;AAACmB,QAAAA,MAAM,EAAEnB;AAAT;AAA5D,MAFU,GAGR,IAZN,CADF;AAgBD;;AAlHuC;;gBAApCjB,W,kBAgBkB;AACpBW,EAAAA,IAAI,EAAEf,QAAQ,CAACyC,iBAAT,CAA2B1B;AADb,C;;AAhBlBX,W,CACGsC,S,2CAAY;AACjBtB,EAAAA,KAAK,EAAEzB,SAAS,CAACgD,MADA;AAEjBtB,EAAAA,WAAW,EAAE1B,SAAS,CAACgD,MAFN;AAGjBrB,EAAAA,WAAW,EAAE3B,SAAS,CAACgD,MAHN;AAIjBpB,EAAAA,YAAY,EAAE5B,SAAS,CAACgD,MAJP;AAKjBnB,EAAAA,cAAc,EAAE7B,SAAS,CAACiD,KAAV,CAAgB;AAC9Bf,IAAAA,IAAI,EAAElC,SAAS,CAACgD,MADc;AAE9Bb,IAAAA,GAAG,EAAEnC,SAAS,CAACgD;AAFe,GAAhB,CALC;AASjBlB,EAAAA,OAAO,EAAE9B,SAAS,CAACkD,IATF;AAUjBnB,EAAAA,QAAQ,EAAE/B,SAAS,CAACkD,IAVH;AAWjB1B,EAAAA,QAAQ,EAAExB,SAAS,CAACmD,IAXH;AAYjBnB,EAAAA,OAAO,EAAEhC,SAAS,CAACmD;AAZF,C;AAoHrB,eAAe1C,WAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {uniqueId, get, constant} from 'lodash/fp';\nimport {\n NovaSolidDataTransferDataUpload1 as UploadIcon,\n NovaLineStatusClose as Close\n} from '@coorpacademy/nova-icons';\nimport Provider from '../provider';\nimport Loader from '../loader';\nimport style from './style.css';\n\nconst constantNull = constant(null);\n\nclass DragAndDrop extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n uploadLabel: PropTypes.string,\n previewLabel: PropTypes.string,\n previewContent: PropTypes.shape({\n type: PropTypes.string,\n src: PropTypes.string\n }),\n loading: PropTypes.bool,\n modified: PropTypes.bool,\n children: PropTypes.func,\n onReset: PropTypes.func\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragging: false\n };\n\n this.handleDragStart = this.handleDragStart.bind(this);\n this.handleDragStop = this.handleDragStop.bind(this);\n }\n\n handleDragStart() {\n this.setState({\n dragging: true\n });\n }\n\n handleDragStop() {\n this.setState({\n dragging: false\n });\n }\n\n render() {\n const {skin} = this.context;\n const brandColor = get('common.brand', skin);\n const idBox = uniqueId('drop-box-');\n const {\n children = constantNull,\n title,\n description,\n uploadLabel,\n previewLabel = '',\n previewContent,\n loading = false,\n modified = false,\n onReset = null\n } = this.props;\n const {dragging} = this.state;\n\n let previewView = null;\n\n if (previewContent && previewContent.type === 'image') {\n previewView = (\n <div className={style.previewView}>\n <img src={previewContent.src} />\n </div>\n );\n } else if (previewContent && previewContent.type === 'video') {\n previewView = (\n <div className={{...style.previewView, width: '300px'}}>\n <video width=\"100%\" controls src={previewContent.src} type=\"video/*\" />\n </div>\n );\n } else if (loading) {\n previewView = (\n <div className={style.loading}>\n <Loader />\n </div>\n );\n } else {\n previewView = <span>{previewLabel}</span>;\n }\n\n const resetContent =\n previewContent && previewContent.src && onReset ? (\n <div className={style.resetUploadWrapper}>\n <div className={style.resetSrcLabel}>{previewContent.src}</div>\n <Close\n data-name=\"reset-content-icon\"\n height={16}\n width={16}\n className={style.closeIcon}\n onClick={onReset}\n />\n </div>\n ) : null;\n\n return (\n <div className={style.wrapper} data-name=\"drag-and-drop-wrapper\">\n <div className={style.title}>{title}</div>\n <div className={modified ? style.modified : style.previewWrapper}>{previewView}</div>\n <div className={dragging ? style.dragging : style.inputWrapper} id={idBox}>\n <UploadIcon className={style.arrow} color={brandColor} />\n <div className={style.uploadLabel}>{uploadLabel}</div>\n {children(this.handleDragStart, this.handleDragStop)}\n </div>\n {resetContent}\n {description ? (\n // eslint-disable-next-line react/no-danger\n <div className={style.description} dangerouslySetInnerHTML={{__html: description}} />\n ) : null}\n </div>\n );\n }\n}\n\nexport default DragAndDrop;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/atom/drag-and-drop/index.js"],"names":["React","PropTypes","NovaLineStatusClose","Close","NovaSolidFilesBasicFileUpload2","FileUploadIcon","NovaSolidFilesBasicFileBlock2","FileUploadBlockedIcon","Loader","Button","getClassState","style","constantNull","DragAndDrop","Component","constructor","props","state","dragging","handleDragStart","bind","handleDragStop","setState","render","idBox","children","title","description","uploadLabel","previewLabel","previewContent","loading","modified","onReset","error","previewView","type","preview","src","loaderWrapper","loadingCancel","closeIcon","loader","loaderText","resetContent","resetUploadWrapper","resetSrcLabel","buildButton","defaultButtonProps","label","icon","position","button","previewContainer","modifiedPreviewContainer","inputWrapper","modifiedInputWrapper","errorInputWrapper","wrapper","infosContainer","iconError","dragAndDropLabel","errorMessage","propTypes","string","shape","bool","func"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SACEC,mBAAmB,IAAIC,KADzB,EAEEC,8BAA8B,IAAIC,cAFpC,EAGEC,6BAA6B,IAAIC,qBAHnC,QAIO,0BAJP;AAKA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,MAAP,MAAmB,gBAAnB;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,YAAY,GAAG,UAAS,IAAT,CAArB;;AAEA,MAAMC,WAAN,SAA0Bb,KAAK,CAACc,SAAhC,CAA0C;AAiBxCC,EAAAA,W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OAAO,EAAEhC,SAAS,CAACkE,IAZF;AAajBjC,EAAAA,KAAK,EAAEjC,SAAS,CAAC+D;AAbA,C;AAyKrB,eAAenD,WAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {uniqueId, constant, isEmpty} from 'lodash/fp';\nimport {\n NovaLineStatusClose as Close,\n NovaSolidFilesBasicFileUpload2 as FileUploadIcon,\n NovaSolidFilesBasicFileBlock2 as FileUploadBlockedIcon\n} from '@coorpacademy/nova-icons';\nimport Loader from '../loader';\nimport Button from '../button-link';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst constantNull = constant(null);\n\nclass DragAndDrop extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n uploadLabel: PropTypes.string,\n previewLabel: PropTypes.string,\n previewContent: PropTypes.shape({\n type: PropTypes.string,\n src: PropTypes.string\n }),\n loading: PropTypes.bool,\n modified: PropTypes.bool,\n children: PropTypes.func,\n onReset: PropTypes.func,\n error: PropTypes.string\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragging: false\n };\n\n this.handleDragStart = this.handleDragStart.bind(this);\n this.handleDragStop = this.handleDragStop.bind(this);\n }\n\n handleDragStart() {\n this.setState({\n dragging: true\n });\n }\n\n handleDragStop() {\n this.setState({\n dragging: false\n });\n }\n\n render() {\n const idBox = uniqueId('drop-box-');\n const {\n children = constantNull,\n title,\n description,\n uploadLabel,\n previewLabel = '',\n previewContent,\n loading = false,\n modified = false,\n onReset = null,\n error = ''\n } = this.props;\n const {dragging} = this.state;\n\n let previewView = null;\n\n if (previewContent && previewContent.type === 'image') {\n previewView = (\n <div className={style.preview}>\n <img src={previewContent.src} />\n </div>\n );\n } else if (previewContent && previewContent.type === 'video') {\n previewView = (\n <div className={style.preview}>\n <video controls src={previewContent.src} type=\"video/*\" />\n </div>\n );\n } else if (loading) {\n previewView = (\n <div className={style.loaderWrapper}>\n <div className={style.loadingCancel}>\n <Close\n data-name=\"reset-content-icon\"\n height={24}\n width={24}\n className={style.closeIcon}\n onClick={onReset}\n />\n </div>\n <div className={style.loader}>\n <Loader theme=\"coorpmanager\" />\n </div>\n <span className={style.loaderText}>Uploading</span>\n </div>\n );\n } else {\n previewView = <span>{previewLabel}</span>;\n }\n\n const resetContent =\n previewContent && previewContent.src ? (\n <div className={style.resetUploadWrapper}>\n <div className={style.resetSrcLabel}>{previewContent.src}</div>\n {onReset ? (\n <Close\n data-name=\"reset-content-icon\"\n height={24}\n width={24}\n className={style.closeIcon}\n onClick={onReset}\n />\n ) : null}\n </div>\n ) : null;\n\n const buildButton = () => {\n const defaultButtonProps = {\n label: uploadLabel,\n 'aria-label': 'aria button',\n 'data-name': 'default-button',\n icon: {\n position: 'left',\n type: 'folders'\n }\n };\n if (dragging) {\n return null;\n } else if (error) {\n return <Button {...defaultButtonProps} label=\"Try again\" icon={{}} />;\n } else {\n return <Button {...defaultButtonProps} />;\n }\n };\n\n const button = buildButton(dragging, error);\n\n const previewContainer = getClassState(\n style.previewContainer,\n style.modifiedPreviewContainer,\n null,\n modified,\n error\n );\n const inputWrapper = getClassState(\n style.inputWrapper,\n style.modifiedInputWrapper,\n style.errorInputWrapper,\n modified,\n error\n );\n\n return (\n <div className={style.wrapper} data-name=\"drag-and-drop-wrapper\">\n <div className={style.title}>{title}</div>\n {!isEmpty(previewContent) || loading ? (\n <div className={previewContainer}>{previewView}</div>\n ) : (\n <div className={dragging ? style.dragging : inputWrapper} id={idBox}>\n <div className={style.infosContainer}>\n {error ? (\n <FileUploadBlockedIcon className={style.iconError} />\n ) : (\n <FileUploadIcon className={style.icon} />\n )}\n {description ? <div className={style.description}>{description}</div> : null}\n {error ? null : <div className={style.dragAndDropLabel}>{'Drag & Drop here'}</div>}\n </div>\n {button}\n <div>{children(this.handleDragStart, this.handleDragStop)}</div>\n </div>\n )}\n {error ? <span className={style.errorMessage}>{error}</span> : resetContent}\n </div>\n );\n }\n}\n\nexport default DragAndDrop;\n"],"file":"index.js"}
@@ -6,145 +6,245 @@
6
6
  @value battle from colors;
7
7
  @value light from colors;
8
8
  @value xtraLightGrey from colors;
9
+ @value cm_grey_50 from colors;
10
+ @value cm_grey_100 from colors;
11
+ @value cm_grey_200 from colors;
12
+ @value cm_grey_300 from colors;
13
+ @value cm_grey_400 from colors;
14
+ @value cm_grey_700 from colors;
15
+ @value white from colors;
16
+ @value cm_negative_100 from colors;
17
+ @value cm_yellow_100 from colors;
9
18
 
10
19
  .wrapper {
11
- width: 360px;
20
+ font-family: "Gilroy";
21
+ max-height: 350px;
22
+ max-width: 460px;
23
+ height: 100%;
24
+ width: 100%;
12
25
  }
13
26
 
14
27
  .title {
15
- font-family: "Gilroy";
16
- font-size: 15px;
17
- text-transform: none;
18
- color: dark;
19
- margin-bottom: 20px;
28
+ font-size: 16px;
29
+ font-weight: 700;
30
+ color: cm_grey_700;
31
+ margin-bottom: 8px;
32
+ }
33
+
34
+ .dragAndDropLabel {
35
+ composes: title;
36
+ margin-bottom: 12px;
37
+ font-size: 14px;
20
38
  }
21
39
 
22
40
  .description {
23
- font-family: 'Gilroy';
24
- font-size: 13px;
41
+ max-height: 85px;
42
+ font-size: 12px;
25
43
  font-weight: 400;
26
- font-style: italic;
27
- color: dark;
28
- margin: 10px 0;
29
- text-align: justify;
44
+ color: cm_grey_300;
45
+ text-align: center;
46
+ padding: 8px;
30
47
  }
31
48
 
32
- .previewWrapper {
49
+ .previewContainer {
33
50
  width: 100%;
34
- box-sizing: border-box;
35
- border: 1px dashed medium;
36
- margin-bottom: 10px;
37
- display: flex;
38
- align-items: center;
39
- justify-content: center;
40
- }
41
-
42
- .modified {
43
- composes: previewWrapper;
44
- border: 2px solid battle;
51
+ height: 80%;
52
+ border: none;
53
+ border-radius: 7px;
54
+ background: cm_grey_50;
45
55
  }
46
56
 
47
- .previewWrapper span {
48
- font-family: 'Gilroy';
49
- color: dark;
50
- font-size: 15px;
51
- font-weight: 700;
52
- line-height: 100px;
57
+ .modifiedPreviewContainer {
58
+ composes: previewContainer;
59
+ border: 3px solid cm_yellow_100;
53
60
  }
54
61
 
55
- .previewView {
56
- padding: 10px;
62
+ .preview {
63
+ padding: 16px;
57
64
  width: 100%;
58
- height: 100px;
65
+ height: 100%;
59
66
  box-sizing: border-box;
60
67
  display: flex;
68
+ justify-content: center;
69
+ align-items: center;
70
+ background-clip: content-box;
71
+ border-radius: 19px;
72
+ background-color: white;
61
73
  }
62
74
 
63
- .previewView img {
75
+ .preview img, video {
64
76
  max-width: 100%;
65
77
  max-height: 100%;
66
78
  margin: auto;
67
79
  }
68
80
 
81
+ .infosContainer {
82
+ width: 100%;
83
+ height: 100%;
84
+ display: flex;
85
+ flex-direction: column;
86
+ align-items: center;
87
+ justify-content: space-evenly;
88
+ overflow: hidden;
89
+ }
90
+
69
91
  .inputWrapper {
92
+ background: cm_grey_50;
70
93
  width: 100%;
71
- height: 70px;
94
+ height: 80%;
72
95
  box-sizing: border-box;
73
- border: 1px dashed medium;
74
- border-radius: 3px;
96
+ border-radius: 7px;
75
97
  position: relative;
76
98
  display: flex;
99
+ flex-direction: column;
77
100
  align-items: center;
78
- justify-content: center;
101
+ justify-content: space-between;
102
+ padding: 14px 8px 8px 8px;
103
+ overflow: hidden;
104
+ }
105
+
106
+ .inputWrapper:before {
107
+ content: "";
108
+ position: absolute;
109
+ border: 10px dashed cm_grey_200;
110
+ top: -8px;
111
+ bottom: -8px;
112
+ left: -8px;
113
+ right: -8px;
114
+ }
115
+
116
+ .modifiedInputWrapper {
117
+ composes: inputWrapper;
118
+ }
119
+
120
+ .modifiedInputWrapper::before {
121
+ content: "";
122
+ position: absolute;
123
+ border: 10px dashed cm_yellow_100;
124
+ top: -8px;
125
+ bottom: -8px;
126
+ left: -8px;
127
+ right: -8px;
128
+ }
129
+
130
+ .errorInputWrapper {
131
+ composes: inputWrapper;
132
+ }
133
+
134
+ .errorInputWrapper .icon {
135
+ color: cm_negative_100;
79
136
  }
80
137
 
81
138
  .resetUploadWrapper {
82
139
  width: 100%;
83
- height: 30px;
140
+ height: 24px;
84
141
  box-sizing: border-box;
85
- background-color: xtraLightGrey;
86
- border: solid 1px light;
142
+ background-color: cm_grey_50;
87
143
  border-radius: 3px;
88
- position: relative;
89
144
  display: flex;
90
145
  align-items: center;
91
146
  justify-content: space-between;
92
- /* fonts */
93
- font-family: Gilroy;
94
- font-size: 13px;
147
+ margin-top: 16px;
148
+ padding: 4px 8px;
149
+ font-size: 12px;
95
150
  font-weight: 400;
96
- margin-top: 15px;
97
151
  }
98
152
 
99
153
  .resetSrcLabel {
100
- font-family: Gilroy;
101
- color: dark;
102
- max-width: 220px;
154
+ color: cm_grey_700;
103
155
  display: inline-block;
104
156
  white-space: nowrap;
105
157
  overflow: hidden;
106
158
  text-overflow: ellipsis;
107
159
  direction: rtl;
108
160
  text-align: left;
109
- margin-left: 9px;
110
161
  }
111
162
 
112
163
  .closeIcon {
113
- margin-right: 9px;
114
164
  cursor: pointer;
115
- color: dark;
116
- }
117
-
118
- .closeIcon:hover {
119
- color: black;
165
+ color: cm_grey_400;
166
+ margin-left: 6px;
120
167
  }
121
168
 
122
169
  .dragging {
123
170
  composes: inputWrapper;
124
- border: 3px dashed brand;
171
+ border: 1px solid cm_grey_200;
172
+ background: cm_grey_100;
125
173
  }
126
174
 
127
- .arrow {
128
- width: 34px;
129
- height: 34px;
130
- margin-right: 10px;
131
- transition: all 0.2s cubic-bezier(0.47, 1.04, 0.46, 2.16);
175
+ .dragging:before {
176
+ content: "";
177
+ position: absolute;
178
+ border: none;
179
+ top: 0;
180
+ bottom: 0;
181
+ left: 0;
182
+ right: 0;
132
183
  }
133
184
 
134
- .dragging .arrow {
135
- transform: scale(1.2);
185
+ .dragging .description .icon {
186
+ font-size: 8px;
136
187
  }
137
188
 
138
- .uploadLabel {
139
- font-family: 'Gilroy';
140
- font-size: 18px;
141
- text-transform: uppercase;
142
- font-weight: 700;
143
- color: dark;
189
+ .dragging .icon {
190
+ transform: scale(0.85);
144
191
  }
145
192
 
146
- .loading {
147
- min-height: 100px;
148
- border: none;
193
+ .icon {
194
+ min-width: 14px;
195
+ min-height: 14px;
196
+ max-width: 30px;
197
+ max-height: 30px;
198
+ height: 20%;
199
+ width: 20%;;
200
+ transition: all 0.2s cubic-bezier(0.47, 1.04, 0.46, 2.16);
201
+ }
202
+
203
+ .iconError {
204
+ composes: icon;
205
+ color: cm_negative_100;
206
+ }
207
+
208
+ .loaderWrapper {
149
209
  position: relative;
210
+ height: 100%;
211
+ width: 100%;
212
+ display: flex;
213
+ flex-direction: column;
214
+ justify-content: center;
215
+ align-items: center;
216
+ border-radius: 7px;
217
+ }
218
+
219
+ .loader {
220
+ margin-bottom: 8px;
221
+ height: 32px;
222
+ width: 32px;
223
+ }
224
+
225
+ .loaderText {
226
+ font-size: 12px;
227
+ font-weight: 400;
228
+ }
229
+
230
+ .loadingCancel {
231
+ display: none;
232
+ position: absolute;
233
+ top: 0;
234
+ right: 0;
235
+ padding: 6px;
236
+ }
237
+
238
+ .loaderWrapper:hover .loadingCancel {
239
+ display: block;
240
+ }
241
+
242
+ .loaderWrapper:hover {
243
+ background-color: cm_grey_100;
244
+ }
245
+
246
+ .errorMessage {
247
+ color: cm_negative_100;
248
+ font-size: 12px;
249
+ margin-top: 8px;
150
250
  }
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  import browserEnv from 'browser-env';
2
4
  import test from 'ava';
3
5
  import React from 'react';
@@ -10,8 +12,13 @@ browserEnv();
10
12
  configure({
11
13
  adapter: new Adapter()
12
14
  });
15
+ const {
16
+ props
17
+ } = withChildrenFixtures;
13
18
  test('should set state to dragging when user starts dragging', t => {
14
- const wrapper = shallow( /*#__PURE__*/React.createElement(DragAndDrop, withChildrenFixtures.props, (onDragStart, onDragStop) => /*#__PURE__*/React.createElement("input", {
19
+ const wrapper = shallow( /*#__PURE__*/React.createElement(DragAndDrop, _extends({}, props, {
20
+ previewContent: {}
21
+ }), (onDragStart, onDragStop) => /*#__PURE__*/React.createElement("input", {
15
22
  className: style.input,
16
23
  key: "1",
17
24
  type: "file",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/atom/drag-and-drop/test/dragging.js"],"names":["browserEnv","test","React","shallow","configure","Adapter","style","DragAndDrop","withChildrenFixtures","adapter","t","wrapper","props","onDragStart","onDragStop","input","instance","false","state","dragging","find","simulate","true"],"mappings":"AAAA,OAAOA,UAAP,MAAuB,aAAvB;AACA,OAAOC,IAAP,MAAiB,KAAjB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,OAAR,EAAiBC,SAAjB,QAAiC,QAAjC;AACA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,KAAP,MAAkB,8BAAlB;AACA,OAAOC,WAAP,MAAwB,IAAxB;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AAEAR,UAAU;AACVI,SAAS,CAAC;AAACK,EAAAA,OAAO,EAAE,IAAIJ,OAAJ;AAAV,CAAD,CAAT;AAEAJ,IAAI,CAAC,wDAAD,EAA2DS,CAAC,IAAI;AAClE,QAAMC,OAAO,GAAGR,OAAO,eACrB,oBAAC,WAAD,EAAiBK,oBAAoB,CAACI,KAAtC,EACG,CAACC,WAAD,EAAcC,UAAd,kBACC;AACE,IAAA,SAAS,EAAER,KAAK,CAACS,KADnB;AAEE,IAAA,GAAG,EAAC,GAFN;AAGE,IAAA,IAAI,EAAC,MAHP;AAIE,IAAA,MAAM,EAAC,SAJT;AAKE,IAAA,QAAQ,EAAE,MAAM,IALlB;AAME,IAAA,WAAW,EAAEF,WANf;AAOE,IAAA,MAAM,EAAEC,UAPV;AAQE,IAAA,WAAW,EAAEA;AARf,IAFJ,CADqB,CAAvB;AAgBA,QAAME,QAAQ,GAAGL,OAAO,CAACK,QAAR,EAAjB;AAEAN,EAAAA,CAAC,CAACO,KAAF,CAAQD,QAAQ,CAACE,KAAT,CAAeC,QAAvB;AACAR,EAAAA,OAAO,CAACS,IAAR,CAAa,OAAb,EAAsBC,QAAtB,CAA+B,WAA/B;AACAX,EAAAA,CAAC,CAACY,IAAF,CAAON,QAAQ,CAACE,KAAT,CAAeC,QAAtB;AACAR,EAAAA,OAAO,CAACS,IAAR,CAAa,OAAb,EAAsBC,QAAtB,CAA+B,WAA/B;AACAX,EAAAA,CAAC,CAACO,KAAF,CAAQD,QAAQ,CAACE,KAAT,CAAeC,QAAvB;AACD,CAxBG,CAAJ","sourcesContent":["import browserEnv from 'browser-env';\nimport test from 'ava';\nimport React from 'react';\nimport {shallow, configure} from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\nimport style from '../../image-upload/style.css';\nimport DragAndDrop from '..';\nimport withChildrenFixtures from './fixtures/with-children';\n\nbrowserEnv();\nconfigure({adapter: new Adapter()});\n\ntest('should set state to dragging when user starts dragging', t => {\n const wrapper = shallow(\n <DragAndDrop {...withChildrenFixtures.props}>\n {(onDragStart, onDragStop) => (\n <input\n className={style.input}\n key=\"1\"\n type=\"file\"\n accept=\"image*/\"\n onChange={() => true}\n onDragEnter={onDragStart}\n onDrop={onDragStop}\n onDragLeave={onDragStop}\n />\n )}\n </DragAndDrop>\n );\n const instance = wrapper.instance();\n\n t.false(instance.state.dragging);\n wrapper.find('input').simulate('dragenter');\n t.true(instance.state.dragging);\n wrapper.find('input').simulate('dragleave');\n t.false(instance.state.dragging);\n});\n"],"file":"dragging.js"}
1
+ {"version":3,"sources":["../../../../src/atom/drag-and-drop/test/dragging.js"],"names":["browserEnv","test","React","shallow","configure","Adapter","style","DragAndDrop","withChildrenFixtures","adapter","props","t","wrapper","onDragStart","onDragStop","input","instance","false","state","dragging","find","simulate","true"],"mappings":";;AAAA,OAAOA,UAAP,MAAuB,aAAvB;AACA,OAAOC,IAAP,MAAiB,KAAjB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,O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';\nimport test from 'ava';\nimport React from 'react';\nimport {shallow, configure} from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\nimport style from '../../image-upload/style.css';\nimport DragAndDrop from '..';\nimport withChildrenFixtures from './fixtures/with-children';\n\nbrowserEnv();\nconfigure({adapter: new Adapter()});\n\nconst {props} = withChildrenFixtures;\n\ntest('should set state to dragging when user starts dragging', t => {\n const wrapper = shallow(\n <DragAndDrop {...props} previewContent={{}}>\n {(onDragStart, onDragStop) => (\n <input\n className={style.input}\n key=\"1\"\n type=\"file\"\n accept=\"image*/\"\n onChange={() => true}\n onDragEnter={onDragStart}\n onDrop={onDragStop}\n onDragLeave={onDragStop}\n />\n )}\n </DragAndDrop>\n );\n const instance = wrapper.instance();\n\n t.false(instance.state.dragging);\n wrapper.find('input').simulate('dragenter');\n t.true(instance.state.dragging);\n wrapper.find('input').simulate('dragleave');\n t.false(instance.state.dragging);\n});\n"],"file":"dragging.js"}
@@ -0,0 +1,12 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import defaultProps from './default';
4
+ const {
5
+ props
6
+ } = defaultProps;
7
+ export default {
8
+ props: _extends(_extends({}, props), {}, {
9
+ modified: true
10
+ })
11
+ };
12
+ //# sourceMappingURL=clean-and-modified.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/atom/drag-and-drop/test/fixtures/clean-and-modified.js"],"names":["defaultProps","props","modified"],"mappings":";;AAAA,OAAOA,YAAP,MAAyB,WAAzB;AAEA,MAAM;AAACC,EAAAA;AAAD,IAAUD,YAAhB;AAEA,eAAe;AACbC,EAAAA,KAAK,wBACAA,KADA;AAEHC,IAAAA,QAAQ,EAAE;AAFP;AADQ,CAAf","sourcesContent":["import defaultProps from './default';\n\nconst {props} = defaultProps;\n\nexport default {\n props: {\n ...props,\n modified: true\n }\n};\n"],"file":"clean-and-modified.js"}
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  props: {
3
- title: 'Drag & Drop',
4
- description: 'Drag and drop component',
5
- uploadLabel: 'Upload',
3
+ title: 'Drag & drop here',
4
+ description: 'JPG or PNG, smaller than 5mb',
5
+ uploadLabel: 'Browse',
6
6
  previewLabel: 'File Preview'
7
7
  }
8
8
  };