@aquera/nile-elements 0.1.55-beta-1 → 0.1.55-patch-1

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 (206) hide show
  1. package/README.md +3 -0
  2. package/demo/index.html +0 -1
  3. package/dist/{fixture-ba65eb22.esm.js → fixture-90b199c4.esm.js} +1 -1
  4. package/dist/{fixture-324a7ef9.cjs.js → fixture-dbd66009.cjs.js} +2 -2
  5. package/dist/{fixture-324a7ef9.cjs.js.map → fixture-dbd66009.cjs.js.map} +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/internal/resizable-table-helper.cjs.js +2 -0
  8. package/dist/internal/resizable-table-helper.cjs.js.map +1 -0
  9. package/dist/internal/resizable-table-helper.esm.js +1 -0
  10. package/dist/internal/resizable-table-styles.cjs.js +2 -0
  11. package/dist/internal/resizable-table-styles.cjs.js.map +1 -0
  12. package/dist/internal/resizable-table-styles.esm.js +120 -0
  13. package/dist/nile-accordion/nile-accordian.test.cjs.js +1 -1
  14. package/dist/nile-accordion/nile-accordian.test.esm.js +1 -1
  15. package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
  16. package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
  17. package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
  18. package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
  19. package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
  20. package/dist/nile-badge/nile-badge.test.esm.js +1 -1
  21. package/dist/nile-button/nile-button.test.cjs.js +1 -1
  22. package/dist/nile-button/nile-button.test.esm.js +1 -1
  23. package/dist/nile-button-toggle-group/nile-button-toggle-group.test.cjs.js +1 -1
  24. package/dist/nile-button-toggle-group/nile-button-toggle-group.test.esm.js +1 -1
  25. package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
  26. package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
  27. package/dist/nile-card/nile-card.test.cjs.js +1 -1
  28. package/dist/nile-card/nile-card.test.esm.js +1 -1
  29. package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
  30. package/dist/nile-checkbox/nile-checkbox.test.esm.js +1 -1
  31. package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
  32. package/dist/nile-chip/nile-chip.test.esm.js +1 -1
  33. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  34. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  35. package/dist/nile-code-editor/nile-code-editor.esm.js +2 -2
  36. package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
  37. package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
  38. package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
  39. package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
  40. package/dist/nile-dropdown/nile-dropdown.test.cjs.js +1 -1
  41. package/dist/nile-dropdown/nile-dropdown.test.esm.js +1 -1
  42. package/dist/nile-empty-state/nile-empty-state.test.cjs.js +1 -1
  43. package/dist/nile-empty-state/nile-empty-state.test.esm.js +1 -1
  44. package/dist/nile-error-message/nile-error-message.test.cjs.js +1 -1
  45. package/dist/nile-error-message/nile-error-message.test.esm.js +1 -1
  46. package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js +1 -1
  47. package/dist/nile-filter-chip/nile-filter-chip.test.esm.js +1 -1
  48. package/dist/nile-form-group/nile-form-group.test.cjs.js +1 -1
  49. package/dist/nile-form-group/nile-form-group.test.esm.js +1 -1
  50. package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
  51. package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
  52. package/dist/nile-hero/nile-hero.test.cjs.js +1 -1
  53. package/dist/nile-hero/nile-hero.test.esm.js +1 -1
  54. package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
  55. package/dist/nile-icon/nile-icon.test.esm.js +1 -1
  56. package/dist/nile-input/nile-input.test.cjs.js +1 -1
  57. package/dist/nile-input/nile-input.test.esm.js +1 -1
  58. package/dist/nile-link/nile-link.test.cjs.js +1 -1
  59. package/dist/nile-link/nile-link.test.esm.js +1 -1
  60. package/dist/nile-loader/nile-loader.test.cjs.js +1 -1
  61. package/dist/nile-loader/nile-loader.test.esm.js +1 -1
  62. package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
  63. package/dist/nile-popover/nile-popover.test.esm.js +1 -1
  64. package/dist/nile-popup/nile-popup.test.cjs.js +1 -1
  65. package/dist/nile-popup/nile-popup.test.esm.js +1 -1
  66. package/dist/nile-progress-bar/nile-progress-bar.test.cjs.js +1 -1
  67. package/dist/nile-progress-bar/nile-progress-bar.test.esm.js +1 -1
  68. package/dist/nile-radio/nile-radio.test.cjs.js +1 -1
  69. package/dist/nile-radio/nile-radio.test.esm.js +1 -1
  70. package/dist/nile-radio-group/nile-radio-group.test.cjs.js +1 -1
  71. package/dist/nile-radio-group/nile-radio-group.test.esm.js +1 -1
  72. package/dist/nile-select/nile-select.test.cjs.js +1 -1
  73. package/dist/nile-select/nile-select.test.esm.js +1 -1
  74. package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
  75. package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
  76. package/dist/nile-slider/nile-slider.css.cjs.js +1 -1
  77. package/dist/nile-slider/nile-slider.css.cjs.js.map +1 -1
  78. package/dist/nile-slider/nile-slider.css.esm.js +1 -1
  79. package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
  80. package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
  81. package/dist/nile-textarea/nile-textarea.test.cjs.js +1 -1
  82. package/dist/nile-textarea/nile-textarea.test.esm.js +1 -1
  83. package/dist/src/internal/resizable-helper.d.ts +59 -0
  84. package/dist/src/internal/resizable-helper.js +115 -0
  85. package/dist/src/internal/resizable-helper.js.map +1 -0
  86. package/dist/src/internal/resizable-styles.d.ts +16 -0
  87. package/dist/src/internal/resizable-styles.js +144 -0
  88. package/dist/src/internal/resizable-styles.js.map +1 -0
  89. package/dist/src/nile-badge/__snapshots__/nile-badge.test.snap.js +17 -0
  90. package/dist/src/nile-calendar/__snapshots__/nile-calendar.test.snap.js +310 -0
  91. package/dist/src/nile-card/__snapshots__/nile-card.test.snap.js +34 -0
  92. package/dist/src/nile-checkbox/__snapshots__/nile-checkbox.test.snap.js +31 -0
  93. package/dist/src/nile-code-editor/nile-code-editor.d.ts +4 -1
  94. package/dist/src/nile-code-editor/nile-code-editor.js +23 -10
  95. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  96. package/dist/src/nile-file-preview/nile-file-preview.css.js +167 -209
  97. package/dist/src/nile-file-preview/nile-file-preview.css.js.map +1 -1
  98. package/dist/src/nile-file-preview/nile-file-preview.d.ts +1 -1
  99. package/dist/src/nile-file-preview/nile-file-preview.js +10 -10
  100. package/dist/src/nile-file-preview/nile-file-preview.js.map +1 -1
  101. package/dist/src/nile-file-preview/nile-file-preview.template.js +43 -41
  102. package/dist/src/nile-file-preview/nile-file-preview.template.js.map +1 -1
  103. package/dist/src/nile-file-preview/types/nile-file-preview.enums.d.ts +3 -3
  104. package/dist/src/nile-file-preview/types/nile-file-preview.enums.js +2 -2
  105. package/dist/src/nile-file-preview/types/nile-file-preview.enums.js.map +1 -1
  106. package/dist/src/nile-file-preview/utils/nile-file-preview.util.d.ts +0 -5
  107. package/dist/src/nile-file-preview/utils/nile-file-preview.util.js +0 -25
  108. package/dist/src/nile-file-preview/utils/nile-file-preview.util.js.map +1 -1
  109. package/dist/src/nile-file-upload/nile-file-upload.css.js +87 -140
  110. package/dist/src/nile-file-upload/nile-file-upload.css.js.map +1 -1
  111. package/dist/src/nile-file-upload/nile-file-upload.d.ts +1 -3
  112. package/dist/src/nile-file-upload/nile-file-upload.js +20 -29
  113. package/dist/src/nile-file-upload/nile-file-upload.js.map +1 -1
  114. package/dist/src/nile-file-upload/nile-file-upload.template.d.ts +5 -4
  115. package/dist/src/nile-file-upload/nile-file-upload.template.js +98 -43
  116. package/dist/src/nile-file-upload/nile-file-upload.template.js.map +1 -1
  117. package/dist/src/nile-file-upload/types/file-upload.enums.d.ts +3 -8
  118. package/dist/src/nile-file-upload/types/file-upload.enums.js +1 -6
  119. package/dist/src/nile-file-upload/types/file-upload.enums.js.map +1 -1
  120. package/dist/src/nile-file-upload/utils/drag-drop.util.d.ts +4 -2
  121. package/dist/src/nile-file-upload/utils/drag-drop.util.js +21 -18
  122. package/dist/src/nile-file-upload/utils/drag-drop.util.js.map +1 -1
  123. package/dist/src/nile-file-upload/utils/file-validation.util.d.ts +1 -2
  124. package/dist/src/nile-file-upload/utils/file-validation.util.js +32 -72
  125. package/dist/src/nile-file-upload/utils/file-validation.util.js.map +1 -1
  126. package/dist/src/nile-hero/__snapshots__/nile-hero.test.snap.js +47 -0
  127. package/dist/src/nile-icon/__snapshots__/nile-icon.test.snap.js +16 -0
  128. package/dist/src/nile-input/__snapshots__/nile-input.test.snap.js +75 -0
  129. package/dist/src/nile-popover/__snapshots__/nile-popover.test.snap.js +22 -0
  130. package/dist/tsconfig.tsbuildinfo +1 -1
  131. package/package.json +1 -1
  132. package/src/nile-code-editor/nile-code-editor.ts +20 -7
  133. package/vscode-html-custom-data.json +3 -3
  134. package/dist/aquera-nile-elements-0.1.57-beta-2.0.tgz +0 -0
  135. package/dist/axe.min-2b379f29.cjs.js +0 -12
  136. package/dist/axe.min-2b379f29.cjs.js.map +0 -1
  137. package/dist/axe.min-c2cd8733.esm.js +0 -12
  138. package/dist/fixture-add72f26.esm.js +0 -569
  139. package/dist/fixture-c1bd203f.cjs.js +0 -395
  140. package/dist/fixture-c1bd203f.cjs.js.map +0 -1
  141. package/dist/fixture-cb376a7f.cjs.js +0 -395
  142. package/dist/fixture-cb376a7f.cjs.js.map +0 -1
  143. package/dist/fixture-f2693d97.esm.js +0 -569
  144. package/dist/lit-html-39a6718c.esm.js +0 -6
  145. package/dist/lit-html-9b3af046.cjs.js +0 -6
  146. package/dist/lit-html-9b3af046.cjs.js.map +0 -1
  147. package/dist/nile-file-preview/index.cjs.js +0 -2
  148. package/dist/nile-file-preview/index.cjs.js.map +0 -1
  149. package/dist/nile-file-preview/index.esm.js +0 -1
  150. package/dist/nile-file-preview/nile-file-preview.cjs.js +0 -2
  151. package/dist/nile-file-preview/nile-file-preview.cjs.js.map +0 -1
  152. package/dist/nile-file-preview/nile-file-preview.css.cjs.js +0 -2
  153. package/dist/nile-file-preview/nile-file-preview.css.cjs.js.map +0 -1
  154. package/dist/nile-file-preview/nile-file-preview.css.esm.js +0 -598
  155. package/dist/nile-file-preview/nile-file-preview.esm.js +0 -3
  156. package/dist/nile-file-preview/nile-file-preview.template.cjs.js +0 -2
  157. package/dist/nile-file-preview/nile-file-preview.template.cjs.js.map +0 -1
  158. package/dist/nile-file-preview/nile-file-preview.template.esm.js +0 -176
  159. package/dist/nile-file-preview/nile-file-preview.test.cjs.js +0 -2
  160. package/dist/nile-file-preview/nile-file-preview.test.cjs.js.map +0 -1
  161. package/dist/nile-file-preview/nile-file-preview.test.esm.js +0 -1
  162. package/dist/nile-file-preview/types/index.cjs.js +0 -2
  163. package/dist/nile-file-preview/types/index.cjs.js.map +0 -1
  164. package/dist/nile-file-preview/types/index.esm.js +0 -1
  165. package/dist/nile-file-preview/types/nile-file-preview.enums.cjs.js +0 -2
  166. package/dist/nile-file-preview/types/nile-file-preview.enums.cjs.js.map +0 -1
  167. package/dist/nile-file-preview/types/nile-file-preview.enums.esm.js +0 -1
  168. package/dist/nile-file-preview/types/nile-file-preview.interface.cjs.js +0 -2
  169. package/dist/nile-file-preview/types/nile-file-preview.interface.cjs.js.map +0 -1
  170. package/dist/nile-file-preview/types/nile-file-preview.interface.esm.js +0 -1
  171. package/dist/nile-file-preview/utils/index.cjs.js +0 -2
  172. package/dist/nile-file-preview/utils/index.cjs.js.map +0 -1
  173. package/dist/nile-file-preview/utils/index.esm.js +0 -1
  174. package/dist/nile-file-preview/utils/nile-file-preview.util.cjs.js +0 -2
  175. package/dist/nile-file-preview/utils/nile-file-preview.util.cjs.js.map +0 -1
  176. package/dist/nile-file-preview/utils/nile-file-preview.util.esm.js +0 -1
  177. package/dist/nile-file-upload/index.cjs.js +0 -2
  178. package/dist/nile-file-upload/index.cjs.js.map +0 -1
  179. package/dist/nile-file-upload/index.esm.js +0 -1
  180. package/dist/nile-file-upload/nile-file-upload.cjs.js +0 -2
  181. package/dist/nile-file-upload/nile-file-upload.cjs.js.map +0 -1
  182. package/dist/nile-file-upload/nile-file-upload.css.cjs.js +0 -2
  183. package/dist/nile-file-upload/nile-file-upload.css.cjs.js.map +0 -1
  184. package/dist/nile-file-upload/nile-file-upload.css.esm.js +0 -605
  185. package/dist/nile-file-upload/nile-file-upload.esm.js +0 -3
  186. package/dist/nile-file-upload/nile-file-upload.template.cjs.js +0 -10
  187. package/dist/nile-file-upload/nile-file-upload.template.cjs.js.map +0 -1
  188. package/dist/nile-file-upload/nile-file-upload.template.esm.js +0 -109
  189. package/dist/nile-file-upload/nile-file-upload.test.cjs.js +0 -2
  190. package/dist/nile-file-upload/nile-file-upload.test.cjs.js.map +0 -1
  191. package/dist/nile-file-upload/nile-file-upload.test.esm.js +0 -1
  192. package/dist/nile-file-upload/types/file-upload.enums.cjs.js +0 -2
  193. package/dist/nile-file-upload/types/file-upload.enums.cjs.js.map +0 -1
  194. package/dist/nile-file-upload/types/file-upload.enums.esm.js +0 -1
  195. package/dist/nile-file-upload/types/file-upload.type.cjs.js +0 -2
  196. package/dist/nile-file-upload/types/file-upload.type.cjs.js.map +0 -1
  197. package/dist/nile-file-upload/types/file-upload.type.esm.js +0 -1
  198. package/dist/nile-file-upload/types/index.cjs.js +0 -2
  199. package/dist/nile-file-upload/types/index.cjs.js.map +0 -1
  200. package/dist/nile-file-upload/types/index.esm.js +0 -1
  201. package/dist/nile-file-upload/utils/drag-drop.util.cjs.js +0 -2
  202. package/dist/nile-file-upload/utils/drag-drop.util.cjs.js.map +0 -1
  203. package/dist/nile-file-upload/utils/drag-drop.util.esm.js +0 -1
  204. package/dist/nile-file-upload/utils/file-validation.util.cjs.js +0 -3
  205. package/dist/nile-file-upload/utils/file-validation.util.cjs.js.map +0 -1
  206. package/dist/nile-file-upload/utils/file-validation.util.esm.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nile-file-preview.css.js","sourceRoot":"","sources":["../../../src/nile-file-preview/nile-file-preview.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqlBxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n* Copyright Aquera Inc 2023\n*\n* This source code is licensed under the BSD-3-Clause license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\nimport {css} from 'lit';\n\n/**\n * FileUpload CSS\n */\nexport const styles = css`\n :host {\n display: inline-block;\n }\n\n * {\n padding: 0px;\n margin: 0px;\n box-sizing: border-box;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 18px;\n height: auto;\n }\n\n input {\n display: none;\n }\n\n .horizontal-div {\n max-height: 62px;\n width: 648px;\n min-width: 230px;\n padding: 12px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 6px;\n border-radius: var(--nile-radius-radius-xs);\n border: 1px dashed var(--nile-colors-neutral-500);\n color: var(--nile-colors-dark-900);\n background-color: var(--nile-colors-white-base);\n }\n \n .hover-state {\n border-color: var(--nile-colors-primary-600);\n }\n\n .vertical-div {\n height: auto;\n min-height: 156px;\n min-width: 240px;\n width: 240px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: center;\n gap: 18px;\n padding: 12px;\n border-radius: var(--nile-radius-radius-xs);\n color: var(--nile-colors-dark-900);\n border: 1px dashed var(--nile-colors-neutral-500);\n background-color: var(--nile-colors-white-base);\n position: relative; \n margin-bottom: 10px;\n }\n\n .vertical-div:hover {\n border-color: var(--nile-colors-blue-500);\n }\n\n .outer-div-border {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .inner-div {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 18px;\n box-sizing: border-box;\n }\n\n .icons-container {\n display: flex;\n gap: 4px;\n }\n\n .general-icon {\n transform: rotate(-18.11deg);\n position: relative;\n bottom: 3px;\n }\n\n .image-icon {\n transform: rotate(15deg);\n }\n\n .icon:hover {\n cursor: pointer;\n }\n\n /* Uploading State */\n .uploading {\n height: 62px;\n width: 648px;\n padding: 12px;\n min-width: 230px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 18px;\n box-sizing: border-box;\n border: 1px solid var(--nile-colors-neutral-400);\n border-radius: 4px;\n background-color: var(--nile-colors-white-base);\n }\n \n .uploading:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .progress-bar-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n .progress-bar-percent {\n width: 100%;\n display: flex;\n justify-content: space-between;\n font-size: var(--nile-type-scale-2);\n font-weight: var(--nile-font-weight-regular);\n }\n\n .progress-bar-container p {\n margin: 0px;\n }\n\n .progress-bar-container > p {\n font-size: var(--nile-type-scale-1);\n color: var(--nile-colors-dark-500);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 222px;\n }\n\n .progress-bar-container .horizontal-file-name {\n font-size: var(--nile-type-scale-1);\n font-weight: var(--nile-font-weight-regular);\n color: var(--nile-colors-dark-500);\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 538px;\n }\n \n .progress-bar-container .vertical-file-name {\n font-size: var(--nile-type-scale-1);\n font-weight: var(--nile-font-weight-regular);\n color: var(--nile-colors-dark-500);\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 212px;\n }\n\n /* PREVIEW STATE */\n .preview {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .preview:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .preview-inner {\n display: flex;\n gap: 18px;\n }\n\n .preview-image-container {\n height: 42px;\n width: 42px;\n }\n\n .preview-image-container img, iframe {\n height: 42px;\n width: 42px;\n object-fit: contain;\n border-radius: var(--nile-radius-radius-xs);\n border: 1px solid var(--nile-colors-neutral-400);\n }\n \n /* .preview-file-info {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 0px;\n }\n\n .preview-file-info p {\n margin: 0px;\n font-size: var(--nile-type-scale-3);\n font-weight: var(--nile-font-weight-regular);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 500px;\n }\n\n .preview-file-info p:last-of-type{\n color: var(--nile-colors-neutral-700);\n font-size: var(--nile-type-scale-2);\n font-weight: var(--nile-font-weight-regular);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 538px;\n } */\n\n .preview nile-icon:hover {\n cursor: pointer;\n }\n\n .preview-actions {\n /* padding-right: 12px; */\n }\n\n /* NO PREVIEW STATE */\n .no-preview {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .no-preview:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .no-preview-container {\n display: flex;\n gap: 18px;\n }\n\n .document-icon {\n height: 40px;\n width: 40px;\n border-radius: var(--nile-radius-radius-xs);\n padding: 2px 3px 2px 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--nile-colors-blue-400);\n background-color: var(--nile-colors-blue-100);\n }\n\n .document-icon nile-icon {\n height: 40px;\n width: 40px;\n }\n \n .preview-file-info {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 8px;\n }\n\n .preview-file-info p {\n margin: 0px;\n font-size: var(--nile-type-scale-3);\n font-weight: var(--nile-font-weight-regular);\n }\n\n .preview-file-info p:last-of-type{\n color: var(--nile-colors-neutral-700);\n font-size: var(--nile-type-scale-2);\n font-weight: var(--nile-font-weight-regular);\n }\n\n .no-preview > nile-icon:hover {\n cursor: pointer;\n }\n\n /* ERROR STATE */\n .error {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .error:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .error-container {\n width: 95%;\n display: flex;\n gap: 18px;\n }\n\n .error-icon {\n height: 40px;\n width: 40px;\n border-radius: var(--nile-radius-radius-xs);\n padding: 2px 3px 2px 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--nile-colors-red-400);\n background-color: var(--nile-colors-red-100);\n }\n\n .error-icon nile-icon {\n height: 40px;\n width: 40px;\n }\n \n .file-info {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 4px;\n }\n\n .file-info p {\n margin: 0px;\n font-size: var(--nile-type-scale-3);\n font-weight: var(--nile-font-weight-regular);\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 538px;\n }\n \n .file-info > nile-tooltip > span {\n color: var(--nile-colors-red-700);\n font-size: var(--nile-type-scale-2);\n font-weight: var(--nile-font-weight-regular);\n max-width: 90%;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n text-align: left;\n }\n\n .error > nile-icon:hover {\n cursor: pointer;\n }\n\n .file-info .horizontal-file-name {\n font-size: var(--nile-type-scale-3);\n font-weight: var(--nile-font-weight-regular);\n color: var(--nile-colors-dark-900);\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 538px;\n }\n\n /* nile-tooltip::part(base) {\n display: inline-block;\n } */\n\n /* VARTICAL STATE START */\n /* Default State */\n .vertical-default {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 18px\n }\n\n .content-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 8px;\n text-align: center;\n }\n\n .content-container h4 {\n font-weight: var(--nile-font-weight-regular);\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 222px;\n }\n\n .content-container p:first-child {\n margin: 0px;\n font-size: var(--nile-type-scale-3);\n font-weight: var(--nile-font-weight-regular);\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 222px;\n }\n\n .content-container p:last-child {\n margin: 0px;\n font-size: var(--nile-type-scale-2);\n font-weight: var(--nile-font-weight-regular);\n color: var(--nile-colors-neutral-700);\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 222px;\n }\n\n /* Drag State */\n .vertical-drag {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap:18px;\n font-size: var(--nile-type-scale-3);\n color: var(--nile-colors-blue-700);\n background-color: var(--nile-colors-blue-100);\n border-color: var(--nile-colors-blue-500);\n }\n\n /* Uploading State */\n .vertical-uploading {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: center;\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .vertical-uploading:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .loading {\n display: flex;\n justify-content: center;\n align-items: center;\n padding-top: 40px;\n }\n\n .corner-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n }\n\n /* Preview State */\n .vertical-preview {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .vertical-preview:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .image-preview {\n border: 1px solid var(--nile-colors-neutral-400);\n object-fit: cover;\n width: 80px;\n height: 80px;\n border-radius: var(--nile-radius-radius-xs);\n }\n\n /* Vertical No Preview State */\n .vertical-no-preview {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .vertical-no-preview:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .vertical-document-icon {\n height: 80px;\n width: 80px;\n padding: 2px 3px 2px 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: var(--nile-radius-radius-xs);\n border: 1px solid var(--nile-colors-blue-400);\n background-color: var(--nile-colors-blue-100);\n }\n\n /* Veritcal Error State */\n .vertical-error {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .vertical-error:hover {\n border-color: var(--nile-colors-neutral-400);\n }\n\n .error-bg {\n background-color: var(--nile-colors-red-100);\n border: 1px solid var(--nile-colors-red-400);\n }\n\n .file-info-vertical-state {\n width: 100%;\n text-align: center;\n }\n\n .file-info-vertical-state p {\n margin: 0px;\n font-size: var(--nile-type-scale-3);\n font-weight: var(--nile-font-weight-regular);\n padding-bottom: 6px;\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n max-width: 222px;\n }\n \n .file-info-vertical-state > nile-tooltip > span {\n color: var(--nile-colors-red-700);\n font-size: var(--nile-type-scale-2);\n font-weight: var(--nile-font-weight-regular);\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n display: block;\n max-width: 212px;\n }\n\n .error-message {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 8px;\n margin: 0px;\n font-size: var(--nile-type-scale-3);\n font-weight: var(--nile-font-weight-regular);\n text-align: center\n }\n\n .error-p {\n color: var(--nile-colors-red-700);\n font-size: var(--nile-type-scale-2);\n width: 216px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: center;\n }\n\n .error-p p {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin: 0;\n }\n\n\n /* Displaing uploaded files CSS */\n .display-files {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n gap: 8px;\n width: 648px;\n min-width: 230px;\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid var(--nile-colors-neutral-700);\n border-radius: var(--nile-radius-radius-xs);\n scrollbar-width: none;\n padding: 12px;\n }\n\n ul, li {\n width: 100%;\n }\n\n li {\n list-style-type: none;\n }\n`;\n\nexport default [styles];"]}
1
+ {"version":3,"file":"nile-file-preview.css.js","sourceRoot":"","sources":["../../../src/nile-file-preview/nile-file-preview.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2iBxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n* Copyright Aquera Inc 2023\n*\n* This source code is licensed under the BSD-3-Clause license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\nimport {css} from 'lit';\n\n/**\n * FileUpload CSS\n */\nexport const styles = css`\n :host {\n display: inline-block;\n -webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));\n -moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));\n text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));\n }\n\n * {\n padding: var(--nile-spacing-none, var(--ng-spacing-none));\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n box-sizing: border-box;\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body))\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 18px;\n height: auto;\n }\n\n input {\n display: none;\n }\n\n .horizontal-div {\n height: var(--nile-height-60px, var(--ng-height-60px));\n max-width: 648px;\n width: max(648px, 100%);\n min-width: 230px;\n padding: var(--nile-spacing-spacing-lg, var(--ng-spacing-lg)) var(--nile-spacing-spacing-lg, var(--ng-spacing-lg));\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 18px;\n border-radius: var(--nile-radius-radius-xs, var(--ng-radius-xl));\n border: var(--nile-border-width-1, var(--ng-border-width-2)) var(--nile-border-style-dashed, var(--ng-border-style-solid)) var(--nile-colors-neutral-500, var(--ng-colors-border-secondary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-tertiary-600));\n background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n }\n \n .hover-state {\n border-color: var(--nile-colors-primary-600);\n }\n\n .vertical-div {\n height: auto;\n min-height: 156px;\n min-width: 240px;\n width: 240px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: center;\n gap: 18px;\n padding: 12px;\n border-radius: var(--nile-radius-radius-xs);\n color: var(--nile-colors-dark-900);\n border: 1px dashed var(--nile-colors-neutral-500);\n background-color: var(--nile-colors-white-base);\n position: relative; \n margin-bottom: 10px;\n }\n\n .vertical-div:hover {\n border-color: var(--nile-colors-blue-500);\n }\n\n .outer-div-border {\n border: 1px solid var(--nile-colors-neutral-400);\n }\n\n .inner-div {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 18px;\n box-sizing: border-box;\n }\n\n .icons-container {\n display: flex;\n gap: var(--nile-spacing-xs, var(--ng-spacing-xs));\n }\n\n .general-icon {\n transform: rotate(-18.11deg);\n position: relative;\n bottom: 3px;\n }\n\n .image-icon {\n transform: rotate(15deg);\n }\n\n .icon:hover {\n cursor: pointer;\n }\n\n /* Uploading State */\n .uploading {\n height: 62px;\n width: 648px;\n padding: var(--nile-spacing-spacing-lg, var(--ng-spacing-lg)) var(--nile-spacing-spacing-lg, var(--ng-spacing-lg));\n min-width: 230px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 18px;\n box-sizing: border-box;\n border: \n var(--nile-border-width-1, var(--ng-border-width-1)) \n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n border-radius: var(--nile-radius-sm, var(--ng-radius-xl));\n }\n \n .uploading:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n\n .progress-bar-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 0px;\n }\n\n .progress-bar-percent {\n width: 100%;\n display: flex;\n justify-content: space-between;\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-medium));\n }\n\n nile-progress-bar li span {\n background-color: var(--nile-progress-bar-progress-color-stroke, var(--ng-colors-fg-brand-primary-600));\n }\n\n .progress-bar-container p {\n margin: 0px;\n }\n\n .progress-bar-container > p {\n font-size: var(--nile-type-scale-1, var(--ng-font-size-text-xs));\n color: var(--nile-colors-dark-500, var(--ng-colors-text-secondary-700));\n }\n\n /* PREVIEW STATE */\n .preview {\n height: 62px;\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n\n .preview:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .preview-inner {\n display: flex;\n gap: 18px;\n }\n\n .preview-image-container {\n height: var(--nile-height-42px, var(--ng-height-42px));\n width: var(--nile-width-42px, 42px);\n }\n\n .preview-image-container img, iframe {\n height: var(--nile-height-42px, var(--ng-height-42px));\n width: var(--nile-width-42px, 42px); // check it once\n object-fit: contain;\n border-radius: var(--nile-radius-radius-xs, var(--ng-radius-xl));\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n \n .preview-file-info {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: var(--nile-spacing-md, var(--ng-spacing-md));\n }\n\n .preview-file-info p {\n color: var(--nile-colors-dark-900, var(--ng-colors-text-secondary-700));\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-medium));\n }\n\n .preview-file-info p:last-of-type{\n color: var(--nile-colors-neutral-700, var(--ng-colors-text-tertiary-600));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n }\n\n .preview nile-icon:hover {\n cursor: pointer;\n }\n\n /* NO PREVIEW STATE */\n .no-preview {\n height: 62px;\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .no-preview:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .no-preview-container {\n display: flex;\n gap: 18px;\n }\n\n .document-icon {\n height: var(--nile-height-40px, var(--ng-height-40px));\n width: var(--nile-width-40px, var(--ng-width-10));\n border-radius: var(--nile-radius-radius-xs, var(--ng-radius-xs));\n padding: var(--nile-spacing-2px, var(--ng-spacing-xxs)) var(--nile-spacing-3px, var(--ng-spacing-1));\n display: flex;\n justify-content: center;\n align-items: center;\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-blue-400, var(--ng-componentcolors-utility-brand-600));\n background-color: var(--nile-colors-blue-100, var(--ng-colors-bg-primary));\n }\n\n .document-icon nile-icon {\n height: var(--nile-height-40px, var(--ng-height-40px));\n width: var(--nile-width-40px, var(--ng-width-10));\n }\n \n .preview-file-info {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 8px;\n }\n\n .preview-file-info p {\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-medium));\n }\n\n .preview-file-info p:last-of-type{\n color: var(--nile-colors-neutral-700, var(--ng-colors-text-tertiary-600));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n }\n\n .no-preview > nile-icon:hover {\n cursor: pointer;\n }\n\n /* ERROR STATE */\n .error {\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-error));\n }\n\n .error:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-error));\n }\n\n .error-container {\n width: 100%;\n display: flex;\n gap: 18px;\n }\n\n .error-icon {\n height: var(--nile-height-40px, var(--ng-height-40px));\n width: var(--nile-width-40px, var(--ng-width-10));\n border-radius: var(--nile-radius-radius-xs, var(--ng-radius-xs));\n padding: var(--nile-spacing-2px, var(--ng-spacing-xxs)) var(--nile-spacing-3px, var(--ng-spacing-1));\n display: flex;\n justify-content: center;\n align-items: center;\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-red-400, var(--ng-colors-border-error));\n background-color: var(--nile-colors-red-100, var(--ng-componentcolors-utility-orange-dark-100));\n }\n\n .error-icon nile-icon {\n height: var(--nile-height-40px, var(--ng-height-40px));\n width: var(--nile-width-40px, var(--ng-width-10));\n }\n \n .file-info {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 8px;\n text-align: center;\n }\n\n .file-info p {\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n text-align: center;\n }\n \n .file-info > nile-tooltip > p {\n color: var(--nile-colors-red-700, var(--ng-colors-text-error-primary-600));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n text-align: center;\n }\n\n .error > nile-icon:hover {\n cursor: pointer;\n }\n\n /* VARTICAL STATE START */\n /* Default State */\n .vertical-default {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 18px\n }\n\n .content-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 8px;\n text-align: center;\n }\n\n .content-container h4 {\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n }\n\n .content-container p:first-child {\n margin: 0px;\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n }\n\n .content-container p:last-child {\n margin: 0px;\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n color: var(--nile-colors-neutral-700, var(--ng-colors-text-tertiary-600));\n }\n\n /* Drag State */\n .vertical-drag {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap:18px;\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));\n color: var(--nile-colors-blue-700), var(--ng-colors-fg-primary-900);\n background-color: var(--nile-colors-blue-100, var(--ng-colors-bg-primary));\n border-color: var(--nile-colors-blue-500, var(--ng-colors-border-primary));\n }\n\n /* Uploading State */\n .vertical-uploading {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: center;\n /* border: 1px solid var(--nile-colors-neutral-400); */\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .vertical-uploading:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .loading {\n display: flex;\n justify-content: center;\n align-items: center;\n padding-top: var(--nile-spacing-5xl, var(--ng-spacing-5xl));\n }\n\n .corner-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n }\n\n /* Preview State */\n .vertical-preview {\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .vertical-preview:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .image-preview {\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n object-fit: cover;\n width: var(--nile-width-80px, var(--ng-spacing-8xl));\n height: var(--nile-height-80px, var(--ng-height-80px));\n border-radius: var(--nile-radius-radius-xs, var(--ng-radius-xl));\n }\n\n /* Vertical No Preview State */\n .vertical-no-preview {\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .vertical-no-preview:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\n }\n\n .vertical-document-icon {\n height: var(--nile-height-80px, var(--ng-height-80px));\n width: var(--nile-width-80px, var(--ng-spacing-8xl));\n padding: var(--nile-spacing-2px, var(--ng-spacing-xxs)) var(--nile-spacing-3px, var(--ng-spacing-1));\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: var(--nile-radius-radius-xs);\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-blue-400, var(--ng-colors-border-brand-alt));\n background-color: var(--nile-colors-blue-100, var(--ng-colors-border-brand));\n }\n\n /* Veritcal Error State */\n .vertical-error {\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-error));\n }\n\n .vertical-error:hover {\n border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-error));\n }\n\n .error-bg {\n background-color: var(--nile-colors-red-100, var(--ng-colors-bg-error-primary));\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-red-400, var(--ng-colors-border-error));\n }\n\n .file-info-vertical-state {\n width: 100%;\n text-align: start;\n }\n\n .file-info-vertical-state p {\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n padding-bottom: 6px;\n text-align: center;\n }\n \n .file-info-vertical-state > nile-tooltip > p {\n color: var(--nile-colors-red-700);\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n text-align: center;\n }\n\n .error-message {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 8px;\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));\n text-align: center\n }\n\n .error-p {\n color: var(--nile-colors-red-700, var(--ng-colors-text-error-primary-600));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n width: 216px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: center;\n }\n\n .error-p p {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n }\n\n\n /* Displaing uploaded files CSS */\n .display-files {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n gap: 8px;\n width: 648px;\n min-width: 230px;\n max-height: 200px;\n overflow-y: auto;\n border: \n var(--nile-border-width-1, var(--ng-border-width-1))\n var(--nile-border-style-solid, var(--ng-border-style-solid)) \n var(--nile-colors-neutral-700, var(--ng-colors-border-primary));\n border-radius: var(--nile-radius-radius-xs, var(--ng-radius-xs));\n scrollbar-width: none;\n padding: var(--nile-radius-lg, var(--ng-spacing-lg));\n }\n\n ul, li {\n width: 100%;\n }\n\n li {\n list-style-type: none;\n }\n`;\n\nexport default [styles];"]}
@@ -23,6 +23,7 @@ export declare class NileFilePreview extends NileElement {
23
23
  inputFile: File;
24
24
  fileUrl: string;
25
25
  uploadStatus: number;
26
+ allowedTypes: string[];
26
27
  state: FilePreviewState;
27
28
  variant: FilePreviewVariant;
28
29
  inputFileName: string;
@@ -33,7 +34,6 @@ export declare class NileFilePreview extends NileElement {
33
34
  * @slot This is a slot test
34
35
  */
35
36
  connectedCallback(): void;
36
- protected firstUpdated(_changedProperties: PropertyValues): void;
37
37
  protected updated(changedProperties: PropertyValues): void;
38
38
  private createUploadState;
39
39
  private handleFileUrl;
@@ -8,7 +8,7 @@ import { __decorate } from "tslib";
8
8
  import { styles } from './nile-file-preview.css';
9
9
  import NileElement from '../internal/nile-element';
10
10
  import { customElement, property } from 'lit/decorators.js';
11
- import { fileUploadServerError, generatePreviewUrl } from './utils';
11
+ import { generatePreviewUrl } from './utils';
12
12
  import { FilePreviewState, FilePreviewVariant, FilePreviewErrorMessages, FilePreviewEvent } from './types';
13
13
  import { html } from 'lit';
14
14
  import { getHorizontalErrorState, getHorizontalNoPreviewState, getHorizontalPreviewState, getHorizontalUploadingState, getVerticalErrorState, getVerticalNoPreviewState, getVerticalPreviewState, getVerticalUploadingState } from './nile-file-preview.template';
@@ -24,6 +24,7 @@ let NileFilePreview = class NileFilePreview extends NileElement {
24
24
  this.errorMessage = "";
25
25
  this.fileUrl = "";
26
26
  this.uploadStatus = 0;
27
+ this.allowedTypes = [];
27
28
  this.state = FilePreviewState.DEFAULT;
28
29
  this.variant = FilePreviewVariant.HORIZONTAL;
29
30
  this.inputFileName = "";
@@ -47,14 +48,11 @@ let NileFilePreview = class NileFilePreview extends NileElement {
47
48
  super.connectedCallback();
48
49
  this.emit(FilePreviewEvent.NILE_INIT);
49
50
  }
50
- firstUpdated(_changedProperties) {
51
- super.firstUpdated(_changedProperties);
52
- fileUploadServerError(this);
53
- }
54
51
  updated(changedProperties) {
55
52
  if (changedProperties.has('uploadStatus') && this.uploadStatus) {
56
53
  if (this.uploadStatus < 100) {
57
54
  this.createUploadState(this.inputFile, this.uploadStatus);
55
+ this.emit(FilePreviewEvent.NILE_UPLOADING);
58
56
  }
59
57
  else {
60
58
  this.createState(this.inputFile);
@@ -91,7 +89,6 @@ let NileFilePreview = class NileFilePreview extends NileElement {
91
89
  catch (error) {
92
90
  const dummyFile = new File([], this.inputFileName || FilePreviewErrorMessages.UNKNOWN_FILE_NAME, { type: 'application/octet-stream' });
93
91
  this.errorMessage = FilePreviewErrorMessages.FAILED_TO_LOAD;
94
- console.error(this.errorMessage);
95
92
  this.inputFileHtml = this.variant === FilePreviewVariant.HORIZONTAL
96
93
  ? getHorizontalErrorState(dummyFile, this.errorMessage, this.originalUrl)
97
94
  : getVerticalErrorState(dummyFile, this.errorMessage, this.originalUrl);
@@ -100,7 +97,7 @@ let NileFilePreview = class NileFilePreview extends NileElement {
100
97
  }
101
98
  async createState(file) {
102
99
  const isHorizontal = this.variant === FilePreviewVariant.HORIZONTAL;
103
- if (!this.errorMessage) {
100
+ if (this.allowedTypes.includes(file.type) && !this.errorMessage) {
104
101
  if (file.type.startsWith('image/')) {
105
102
  try {
106
103
  const url = await generatePreviewUrl(file);
@@ -121,9 +118,9 @@ let NileFilePreview = class NileFilePreview extends NileElement {
121
118
  }
122
119
  }
123
120
  else {
124
- // this.errorMessage = !this.errorMessage
125
- // ? FilePreviewErrorMessages.INVALID_FORMAT
126
- // : FilePreviewErrorMessages.UPLOAD_CANCEL;
121
+ this.errorMessage = !this.errorMessage
122
+ ? FilePreviewErrorMessages.INVALID_FORMAT
123
+ : FilePreviewErrorMessages.UPLOAD_CANCEL;
127
124
  this.inputFileHtml = isHorizontal
128
125
  ? getHorizontalErrorState(file, this.errorMessage, this.originalUrl)
129
126
  : getVerticalErrorState(file, this.errorMessage, this.originalUrl);
@@ -154,6 +151,9 @@ __decorate([
154
151
  __decorate([
155
152
  property({ type: Number })
156
153
  ], NileFilePreview.prototype, "uploadStatus", void 0);
154
+ __decorate([
155
+ property({ type: Array })
156
+ ], NileFilePreview.prototype, "allowedTypes", void 0);
157
157
  __decorate([
158
158
  property({ type: String })
159
159
  ], NileFilePreview.prototype, "state", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"nile-file-preview.js","sourceRoot":"","sources":["../../../src/nile-file-preview/nile-file-preview.ts"],"names":[],"mappings":"AAAA;;;;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G,YAAY;gBAC/B,CAAC,CAAC,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC;gBACpE,CAAC,CAAC,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAIM,MAAM;QACX,OAAO,IAAI,CAAA;KACV,IAAI,CAAC,aAAa,CAAC,CAAC;YACrB,IAAI,CAAC,aAAa,CAAC,CAAC;YACpB,IAAI,CAAA,EACL;KACE,CAAC;IACJ,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC;CAGF,CAAA;AA7H6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAoD;AACnD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA6D;AAC3D;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAA4B;AAf5C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAsI3B;;AAED,eAAe,eAAe,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {styles} from './nile-file-preview.css';\nimport NileElement from '../internal/nile-element';\nimport { customElement, property } from 'lit/decorators.js';\nimport { fileUploadServerError, generatePreviewUrl } from './utils';\nimport { FilePreviewState, FilePreviewVariant, FilePreviewErrorMessages, FilePreviewEvent } from './types';\nimport { LitElement, html, CSSResultArray, TemplateResult, PropertyValues } from 'lit';\nimport {\n getHorizontalErrorState,\n getHorizontalNoPreviewState,\n getHorizontalPreviewState,\n getHorizontalUploadingState,\n getVerticalErrorState,\n getVerticalNoPreviewState,\n getVerticalPreviewState,\n getVerticalUploadingState\n} from './nile-file-preview.template';\n\n\n/**\n * Nile preview component.\n *\n * @tag nile-preview\n *\n */\n@customElement('nile-file-preview')\nexport class NileFilePreview extends NileElement {\n /**\n * The styles for nile-preview\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String }) errorMessage: string = \"\";\n\t@property({ type: Object }) inputFile: File; \n\t@property({ type: String }) fileUrl: string = \"\";\n\t@property({ type: Number }) uploadStatus: number = 0;\n\t@property({ type: String }) state: FilePreviewState = FilePreviewState.DEFAULT;\n\t@property({ type: String }) variant: FilePreviewVariant = FilePreviewVariant.HORIZONTAL;\n @property({ type: String }) inputFileName: string = \"\";\n\tprivate inputFileHtml: TemplateResult | null = null;\n private originalUrl: string = \"\";\n\n /**\n * Render method\n * @slot This is a slot test\n */\n\n connectedCallback(): void {\n super.connectedCallback();\n this.emit(FilePreviewEvent.NILE_INIT);\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n super.firstUpdated(_changedProperties);\n fileUploadServerError(this);\n }\n\n protected updated(changedProperties: PropertyValues): void {\n if(changedProperties.has('uploadStatus') && this.uploadStatus) {\n if(this.uploadStatus < 100) {\n this.createUploadState(this.inputFile, this.uploadStatus);\n } else {\n this.createState(this.inputFile);\n }\n } else if (changedProperties.has('inputFile') && this.inputFile) {\n this.createState(this.inputFile); \n this.emit(FilePreviewEvent.NILE_RECEIVE);\n\n } else if (changedProperties.has('fileUrl') && this.fileUrl) {\n this.handleFileUrl(this.fileUrl);\n this.emit(FilePreviewEvent.NILE_RECEIVE);\n\n } else if (changedProperties.has('errorMessage')) {\n this.createState(this.inputFile);\n }\n }\n\n private createUploadState( file: File, uploadStatus: number): void {\n const isHorizontal = this.variant === FilePreviewVariant.HORIZONTAL;\n\n this.inputFileHtml = isHorizontal \n ? getHorizontalUploadingState(file, uploadStatus)\n : getVerticalUploadingState(file, uploadStatus);\n\n this.requestUpdate();\n }\n\n private async handleFileUrl(url: string): Promise<void> {\n this.originalUrl = url;\n try {\n const response = await fetch(url);\n const blob = await response.blob();\n const fileName = this.inputFileName || url.split('/').pop() || FilePreviewErrorMessages.UNKNOWN_FILE_NAME;\n const file = new File([blob], fileName, { type: blob.type });\n\n this.createState(file);\n } catch (error) {\n const dummyFile = new File([], this.inputFileName || FilePreviewErrorMessages.UNKNOWN_FILE_NAME, { type: 'application/octet-stream' });\n this.errorMessage = FilePreviewErrorMessages.FAILED_TO_LOAD;\n console.error(this.errorMessage);\n\n this.inputFileHtml = this.variant === FilePreviewVariant.HORIZONTAL\n ? getHorizontalErrorState(dummyFile, this.errorMessage, this.originalUrl)\n : getVerticalErrorState(dummyFile, this.errorMessage, this.originalUrl);\n this.requestUpdate();\n }\n }\n\n\tpublic async createState(file: File): Promise<void> {\n const isHorizontal = this.variant === FilePreviewVariant.HORIZONTAL;\n\n if (!this.errorMessage) { \n if (file.type.startsWith('image/')) {\n try {\n const url = await generatePreviewUrl(file);\n this.inputFileHtml = isHorizontal\n ? getHorizontalPreviewState(url, file, this.originalUrl)\n : getVerticalPreviewState(url, file, this.originalUrl);\n } catch (error) {\n this.inputFileHtml = isHorizontal\n ? getHorizontalNoPreviewState(file, this.originalUrl)\n : getVerticalNoPreviewState(file, this.originalUrl); \n }\n } else {\n this.inputFileHtml = isHorizontal\n ? getHorizontalNoPreviewState(file, this.originalUrl)\n : getVerticalNoPreviewState(file, this.originalUrl);\n }\n } else {\n // this.errorMessage = !this.errorMessage\n // ? FilePreviewErrorMessages.INVALID_FORMAT\n // : FilePreviewErrorMessages.UPLOAD_CANCEL;\n\n this.inputFileHtml = isHorizontal\n ? getHorizontalErrorState(file, this.errorMessage, this.originalUrl)\n : getVerticalErrorState(file, this.errorMessage, this.originalUrl);\n }\n this.requestUpdate();\n }\n\n private dummyFile = new File(['sdfjbs ewhf'], \"dummy.txt\", { type: \"text/plain\" });\n\n public render(): TemplateResult {\n return html`\n\t\t\t${this.inputFileHtml ?\n\t\t\t\tthis.inputFileHtml :\n\t\t\t\thtml``\n\t\t\t}\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.emit(FilePreviewEvent.NILE_DESTROY);\n }\n\n /* #endregion */\n}\n\nexport default NileFilePreview;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-file-preview': NileFilePreview;\n }\n}"]}
1
+ {"version":3,"file":"nile-file-preview.js","sourceRoot":"","sources":["../../../src/nile-file-preview/nile-file-preview.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAC/C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3G,OAAO,EAAc,IAAI,EAAkD,MAAM,KAAK,CAAC;AACvF,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AAGtC;;;;;GAKG;AAE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,CAAC,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC;CAGF,CAAA;AA3H6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA0B;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAG,CAAC;qDAA6B;AAC7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAoD;AACnD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA6D;AAC3D;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAA4B;AAhB5C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAoI3B;;AAED,eAAe,eAAe,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {styles} from './nile-file-preview.css';\nimport NileElement from '../internal/nile-element';\nimport { customElement, property } from 'lit/decorators.js';\nimport { generatePreviewUrl } from './utils';\nimport { FilePreviewState, FilePreviewVariant, FilePreviewErrorMessages, FilePreviewEvent } from './types';\nimport { LitElement, html, CSSResultArray, TemplateResult, PropertyValues } from 'lit';\nimport {\n getHorizontalErrorState,\n getHorizontalNoPreviewState,\n getHorizontalPreviewState,\n getHorizontalUploadingState,\n getVerticalErrorState,\n getVerticalNoPreviewState,\n getVerticalPreviewState,\n getVerticalUploadingState\n} from './nile-file-preview.template';\n\n\n/**\n * Nile preview component.\n *\n * @tag nile-preview\n *\n */\n@customElement('nile-file-preview')\nexport class NileFilePreview extends NileElement {\n /**\n * The styles for nile-preview\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String }) errorMessage: string = \"\";\n\t@property({ type: Object }) inputFile: File; \n\t@property({ type: String }) fileUrl: string = \"\";\n\t@property({ type: Number }) uploadStatus: number = 0;\n @property({ type: Array }) allowedTypes: string[] = [];\n\t@property({ type: String }) state: FilePreviewState = FilePreviewState.DEFAULT;\n\t@property({ type: String }) variant: FilePreviewVariant = FilePreviewVariant.HORIZONTAL;\n @property({ type: String }) inputFileName: string = \"\";\n\tprivate inputFileHtml: TemplateResult | null = null;\n private originalUrl: string = \"\";\n\n /**\n * Render method\n * @slot This is a slot test\n */\n\n connectedCallback(): void {\n super.connectedCallback();\n this.emit(FilePreviewEvent.NILE_INIT);\n }\n\n protected updated(changedProperties: PropertyValues): void {\n if(changedProperties.has('uploadStatus') && this.uploadStatus) {\n if(this.uploadStatus < 100) {\n this.createUploadState(this.inputFile, this.uploadStatus);\n this.emit(FilePreviewEvent.NILE_UPLOADING);\n\n } else {\n this.createState(this.inputFile);\n }\n\n } else if (changedProperties.has('inputFile') && this.inputFile) {\n this.createState(this.inputFile);\n this.emit(FilePreviewEvent.NILE_RECEIVE);\n\n } else if (changedProperties.has('fileUrl') && this.fileUrl) {\n this.handleFileUrl(this.fileUrl);\n this.emit(FilePreviewEvent.NILE_RECEIVE);\n\n } else if (changedProperties.has('errorMessage')) {\n this.createState(this.inputFile);\n }\n }\n\n private createUploadState( file: File, uploadStatus: number): void {\n const isHorizontal = this.variant === FilePreviewVariant.HORIZONTAL;\n\n this.inputFileHtml = isHorizontal \n ? getHorizontalUploadingState(file, uploadStatus)\n : getVerticalUploadingState(file, uploadStatus);\n\n this.requestUpdate();\n }\n\n private async handleFileUrl(url: string): Promise<void> {\n this.originalUrl = url;\n try {\n const response = await fetch(url);\n const blob = await response.blob();\n const fileName = this.inputFileName || url.split('/').pop() || FilePreviewErrorMessages.UNKNOWN_FILE_NAME;\n const file = new File([blob], fileName, { type: blob.type });\n\n this.createState(file);\n } catch (error) {\n const dummyFile = new File([], this.inputFileName || FilePreviewErrorMessages.UNKNOWN_FILE_NAME, { type: 'application/octet-stream' });\n this.errorMessage = FilePreviewErrorMessages.FAILED_TO_LOAD;\n\n this.inputFileHtml = this.variant === FilePreviewVariant.HORIZONTAL\n ? getHorizontalErrorState(dummyFile, this.errorMessage, this.originalUrl)\n : getVerticalErrorState(dummyFile, this.errorMessage, this.originalUrl);\n this.requestUpdate();\n }\n }\n\n\tpublic async createState(file: File): Promise<void> {\n const isHorizontal = this.variant === FilePreviewVariant.HORIZONTAL;\n\n if (this.allowedTypes.includes(file.type) && !this.errorMessage) { \n if (file.type.startsWith('image/')) {\n try {\n const url = await generatePreviewUrl(file);\n this.inputFileHtml = isHorizontal\n ? getHorizontalPreviewState(url, file, this.originalUrl)\n : getVerticalPreviewState(url, file, this.originalUrl);\n } catch (error) {\n this.inputFileHtml = isHorizontal\n ? getHorizontalNoPreviewState(file, this.originalUrl)\n : getVerticalNoPreviewState(file, this.originalUrl); \n }\n } else {\n this.inputFileHtml = isHorizontal\n ? getHorizontalNoPreviewState(file, this.originalUrl)\n : getVerticalNoPreviewState(file, this.originalUrl);\n }\n } else {\n this.errorMessage = !this.errorMessage\n ? FilePreviewErrorMessages.INVALID_FORMAT\n : FilePreviewErrorMessages.UPLOAD_CANCEL;\n\n this.inputFileHtml = isHorizontal\n ? getHorizontalErrorState(file, this.errorMessage, this.originalUrl)\n : getVerticalErrorState(file, this.errorMessage, this.originalUrl);\n }\n this.requestUpdate();\n }\n\n private dummyFile = new File(['sdfjbs ewhf'], \"dummy.txt\", { type: \"text/plain\" });\n\n public render(): TemplateResult {\n return html`\n\t\t\t${this.inputFileHtml ?\n\t\t\t\tthis.inputFileHtml :\n\t\t\t\thtml``\n\t\t\t}\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.emit(FilePreviewEvent.NILE_DESTROY);\n }\n\n /* #endregion */\n}\n\nexport default NileFilePreview;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-file-preview': NileFilePreview;\n }\n}"]}
@@ -4,10 +4,9 @@
4
4
  import './nile-file-preview.css';
5
5
  import { html } from 'lit';
6
6
  import { removeFile, cancelFileUpload } from './utils';
7
- import { formatFileSize, truncateString, getFileType } from './utils/nile-file-preview.util';
8
7
  export function getHorizontalUploadingState(file, uploadStatus) {
9
8
  return html `
10
- <div class="uploading" part="horizontal-uploading-state">
9
+ <div class="uploading">
11
10
  <nile-loader width="24" height="24"></nile-loader>
12
11
  <div class="progress-bar-container">
13
12
  <div class="progress-bar-percent">
@@ -15,10 +14,9 @@ export function getHorizontalUploadingState(file, uploadStatus) {
15
14
  <p>${uploadStatus}%</p>
16
15
  </div>
17
16
  <nile-progress-bar
18
- part="horizontal-progress-bar"
19
17
  value="${uploadStatus}"
20
18
  ></nile-progress-bar>
21
- <p class="horizontal-file-name">${file.name}</p>
19
+ <p>${file.name}</p>
22
20
  </div>
23
21
  <slot @click=${(e) => cancelFileUpload(file, e)} name="cancelIcon">
24
22
  <nile-icon
@@ -32,7 +30,7 @@ export function getHorizontalUploadingState(file, uploadStatus) {
32
30
  }
33
31
  export function getHorizontalPreviewState(url, file, originalUrl) {
34
32
  return html `
35
- <div class="preview horizontal-div" part="horizontal-preview-state">
33
+ <div class="preview horizontal-div">
36
34
  <div class="preview-inner">
37
35
  <div class="preview-image-container">
38
36
  <img
@@ -43,36 +41,36 @@ export function getHorizontalPreviewState(url, file, originalUrl) {
43
41
  </div>
44
42
  <div class="preview-file-info">
45
43
  <p>${file.name}</p>
46
- <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>
44
+ <p>${(file.type.split('/')[1]).toUpperCase()} &#8226; ${(Number(file.size) / 1024).toFixed(0)}KB</p>
47
45
  </div>
48
46
  </div>
49
- <div class="preview-actions">
50
- <slot @click=${(e) => removeFile(file, e, originalUrl)} name="cancelIcon">
51
- <nile-icon
52
- name="trash"
53
- size="14"
54
- class="icon"
55
- ></nile-icon>
56
- </slot>
57
- </div>
47
+ <slot name="cancelIcon">
48
+ <nile-icon
49
+ @click=${(e) => removeFile(file, e, originalUrl)}
50
+ name="trash"
51
+ size="14"
52
+ class="icon"
53
+ ></nile-icon>
54
+ </slot>
58
55
  </div>
59
56
  `;
60
57
  }
61
58
  export function getHorizontalNoPreviewState(file, originalUrl) {
62
59
  return html `
63
- <div class="no-preview horizontal-div" part="horizontal-no-preview-state">
60
+ <div class="no-preview horizontal-div">
64
61
  <div class="no-preview-container">
65
62
  <div class="document-icon">
66
- <nile-icon name="general" size="20" color="var(--nile-colors-blue-500)"></nile-icon>
63
+ <nile-icon name="general" size="20" color="var(--nile-colors-blue-500, var(--ng-componentcolors-utility-brand-600))"></nile-icon>
67
64
  </div>
68
65
  <div class="preview-file-info">
69
- <p>${truncateString(file.name, file?.type)}</p>
70
- <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>
66
+ <p>${file.name}</p>
67
+ <p>${(file.type.split('/')[1]).toUpperCase()} &#8226; ${(Number(file.size) / 1034).toFixed(0)}KB</p>
71
68
  </div>
72
69
  </div>
73
70
  <div>
74
- <slot @click=${(e) => removeFile(file, e, originalUrl)} name="cancelIcon">
71
+ <slot name="cancelIcon">
75
72
  <nile-icon
73
+ @click=${(e) => removeFile(file, e, originalUrl)}
76
74
  name="trash"
77
75
  size="14"
78
76
  class="icon"
@@ -84,20 +82,21 @@ export function getHorizontalNoPreviewState(file, originalUrl) {
84
82
  }
85
83
  export function getHorizontalErrorState(file, errorMessage, originalUrl) {
86
84
  return html `
87
- <div class="error horizontal-div" part="horizontal-error-state">
85
+ <div class="error horizontal-div">
88
86
  <div class="error-container">
89
87
  <div class="error-icon">
90
- <nile-icon name="info-icon" size="20" color="var(--nile-colors-red-700)"></nile-icon>
88
+ <nile-icon name="info-icon" size="20" color="var(--nile-colors-red-700, var(--ng-colors-text-error-primary-600))"></nile-icon>
91
89
  </div>
92
90
  <div class="file-info">
93
- <p class="horizontal-file-name">${file.name}</p>
91
+ <p>${file.name}</p>
94
92
  <nile-tooltip content=${errorMessage}>
95
- <span>${errorMessage}</span>
93
+ <p>${errorMessage}</p>
96
94
  </nile-tooltip>
97
95
  </div>
98
96
  </div>
99
- <slot @click=${(e) => removeFile(file, e, originalUrl)} name="cancelIcon">
97
+ <slot name="cancelIcon">
100
98
  <nile-icon
99
+ @click=${(e) => removeFile(file, e, originalUrl)}
101
100
  name="close"
102
101
  size="14"
103
102
  class="icon"
@@ -109,7 +108,7 @@ export function getHorizontalErrorState(file, errorMessage, originalUrl) {
109
108
  // vertical states
110
109
  export function getVerticalUploadingState(file, uploadStatus) {
111
110
  return html `
112
- <div class="vertical-div vertical-uploading" part="vertical-uploading-state">
111
+ <div class="vertical-div vertical-uploading">
113
112
  <div class="loading">
114
113
  <nile-loader width="24" height="24"></nile-loader>
115
114
  </div>
@@ -120,11 +119,12 @@ export function getVerticalUploadingState(file, uploadStatus) {
120
119
  <p>${uploadStatus}%</p>
121
120
  </div>
122
121
  <nile-progress-bar value=${uploadStatus}></nile-progress-bar>
123
- <p class="vertical-file-name">${file.name}</p>
122
+ <p>${file.name}</p>
124
123
  </div>
125
124
 
126
- <slot @click=${(e) => cancelFileUpload(file, e)} name="cancelIcon">
125
+ <slot name="cancelIcon">
127
126
  <nile-icon
127
+ @click=${(e) => cancelFileUpload(file, e)}
128
128
  name="close"
129
129
  size="14"
130
130
  class="icon corner-icon"
@@ -135,7 +135,7 @@ export function getVerticalUploadingState(file, uploadStatus) {
135
135
  }
136
136
  export function getVerticalPreviewState(url, file, originalUrl) {
137
137
  return html `
138
- <div class="vertical-div vertical-preview" part="vertical-preview-state">
138
+ <div class="vertical-div vertical-preview">
139
139
  <div>
140
140
  <img
141
141
  class="image-preview"
@@ -146,11 +146,12 @@ export function getVerticalPreviewState(url, file, originalUrl) {
146
146
 
147
147
  <div class="content-container">
148
148
  <p>${file.name}</p>
149
- <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>
149
+ <p>${(file.type.split('/')[1]).toUpperCase()} &#8226; ${(Number(file.size) / 1024).toFixed(0)}KB</p>
150
150
  </div>
151
151
 
152
- <slot @click=${(e) => removeFile(file, e, originalUrl)} name="cancelIcon">
152
+ <slot name="cancelIcon">
153
153
  <nile-icon
154
+ @click=${(e) => removeFile(file, e, originalUrl)}
154
155
  name="trash"
155
156
  size="14"
156
157
  class="icon corner-icon"
@@ -161,18 +162,19 @@ export function getVerticalPreviewState(url, file, originalUrl) {
161
162
  }
162
163
  export function getVerticalNoPreviewState(file, originalUrl) {
163
164
  return html `
164
- <div class="vertical-div vertical-no-preview" part="vertical-no-preview-state">
165
+ <div class="vertical-div vertical-no-preview">
165
166
  <div class="vertical-document-icon">
166
- <nile-icon name="general" size="20" color="var(--nile-colors-blue-500)"></nile-icon>
167
+ <nile-icon name="general" size="20" color="var(--nile-colors-blue-500, var(--ng-componentcolors-utility-brand-600))"></nile-icon>
167
168
  </div>
168
169
 
169
170
  <div class="content-container">
170
- <p>${truncateString(file.name, file?.type)}</p>
171
- <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>
171
+ <p>${file.name}</p>
172
+ <p>${file.type} &#8226; ${(Number(file.size) / 1024).toFixed(0)}KB</p>
172
173
  </div>
173
174
 
174
- <slot @click=${(e) => removeFile(file, e, originalUrl)} name="cancelIcon">
175
+ <slot name="cancelIcon">
175
176
  <nile-icon
177
+ @click=${(e) => removeFile(file, e, originalUrl)}
176
178
  name="trash"
177
179
  size="14"
178
180
  class="icon corner-icon"
@@ -183,19 +185,19 @@ export function getVerticalNoPreviewState(file, originalUrl) {
183
185
  }
184
186
  export function getVerticalErrorState(file, errorMessage, originalUrl) {
185
187
  return html `
186
- <div class="vertical-div vertical-error" part="vertical-error-state">
188
+ <div class="vertical-div vertical-error">
187
189
  <div class="vertical-document-icon error-bg">
188
- <nile-icon name="info-icon" size="20" color="var(--nile-colors-red-700)"></nile-icon>
190
+ <nile-icon name="info-icon" size="20" color="var(--nile-colors-red-700, var(--ng-colors-text-error-primary-600))"></nile-icon>
189
191
  </div>
190
192
 
191
193
  <div class="file-info-vertical-state">
192
- <p class="vertical-file-name">${file.name}</p>
194
+ <p>${file.name}</p>
193
195
  <nile-tooltip content=${errorMessage}>
194
- <span>${errorMessage}</span>
196
+ <p>${errorMessage}</p>
195
197
  </nile-tooltip>
196
198
  </div>
197
199
 
198
- <slot @click=${(e) => removeFile(file, e, originalUrl)} name="cancelIcon">
200
+ <slot name="cancelIcon" @click=${(e) => removeFile(file, e, originalUrl)}>
199
201
  <nile-icon
200
202
  name="close"
201
203
  size="14"
@@ -1 +1 @@
1
- {"version":3,"file":"nile-file-preview.template.js","sourceRoot":"","sources":["../../../src/nile-file-preview/nile-file-preview.template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE5F,MAAM,UAAU,2BAA2B,CAC1C,IAAU,EACV,YAAoB;IAElB,OAAO,IAAI,CAAA;;;;;;iBAME,YAAY;;;;qBAIR,YAAY;;4CAEW,IAAI,CAAC,IAAI;;uBAE9B,CAAC,CAAgC,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;;;;;;;;KAQjF,CAAC;AACJ,CAAC;AAEH,MAAM,UAAU,yBAAyB,CACvC,GAAW,EACX,IAAU,EACV,WAAmB;IAEnB,OAAO,IAAI,CAAA;;;;;;oBAMO,GAAG;oBACH,IAAI,CAAC,IAAI;;;;eAId,IAAI,CAAC,I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;;;;gBAKG,GAAG;gBACH,IAAI,CAAC,IAAI;;;;;aAKZ,IAAI,CAAC,IAAI;cACR,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;qBAG5D,CAAC,CAAgC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC;;;;;;;;GAQxF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,IAAU,EACV,WAAmB;IAEnB,OAAO,IAAI,CAAA;;;;;;;aAOA,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;aACrC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;qBAG3D,CAAC,CAAgC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC;;;;;;;;GAQxF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,IAAU,EACV,YAAoB,EACpB,WAAmB;IAEnB,OAAO,IAAI,CAAA;;;;;;;wCAO2B,IAAI,CAAC,IAAI;gCACjB,YAAY;kBAC1B,YAAY;;;;qBAIT,CAAC,CAAgC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC;;;;;;;;GAQxF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Template File for nile-preview component\n */\n\nimport './nile-file-preview.css';\nimport { html, TemplateResult } from 'lit';\nimport { FilePreviewErrorMessages, RemoveFileDetail } from './types';\nimport { removeFile, cancelFileUpload } from './utils';\nimport { formatFileSize, truncateString, getFileType } from './utils/nile-file-preview.util';\n\n export function getHorizontalUploadingState(\n file: File,\n uploadStatus: number\n ): TemplateResult {\n return html`\n <div class=\"uploading\" part=\"horizontal-uploading-state\">\n <nile-loader width=\"24\" height=\"24\"></nile-loader>\n <div class=\"progress-bar-container\">\n <div class=\"progress-bar-percent\">\n <p>Uploading File...</p>\n <p>${uploadStatus}%</p>\n </div>\n <nile-progress-bar\n part=\"horizontal-progress-bar\"\n value=\"${uploadStatus}\"\n ></nile-progress-bar>\n <p class=\"horizontal-file-name\">${file.name}</p>\n </div>\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => cancelFileUpload(file, e)} name=\"cancelIcon\">\n <nile-icon\n name=\"close\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n }\n\nexport function getHorizontalPreviewState(\n url: string,\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"preview horizontal-div\" part=\"horizontal-preview-state\">\n <div class=\"preview-inner\">\n <div class=\"preview-image-container\">\n <img\n class=\"image-preview\"\n src=${url}\n alt=${file.name}\n />\n </div>\n <div class=\"preview-file-info\">\n <p>${file.name}</p>\n <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>\n </div>\n </div>\n <div class=\"preview-actions\">\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name=\"cancelIcon\">\n <nile-icon\n name=\"trash\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n </div>\n `;\n}\n\nexport function getHorizontalNoPreviewState(\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"no-preview horizontal-div\" part=\"horizontal-no-preview-state\">\n <div class=\"no-preview-container\">\n <div class=\"document-icon\">\n <nile-icon name=\"general\" size=\"20\" color=\"var(--nile-colors-blue-500)\"></nile-icon>\n </div>\n <div class=\"preview-file-info\">\n <p>${truncateString(file.name, file?.type)}</p>\n <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>\n </div>\n </div>\n <div>\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name=\"cancelIcon\">\n <nile-icon\n name=\"trash\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n </div>\n `;\n}\n\nexport function getHorizontalErrorState(\n file: File,\n errorMessage: string,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"error horizontal-div\" part=\"horizontal-error-state\">\n <div class=\"error-container\">\n <div class=\"error-icon\">\n <nile-icon name=\"info-icon\" size=\"20\" color=\"var(--nile-colors-red-700)\"></nile-icon>\n </div>\n <div class=\"file-info\">\n <p class=\"horizontal-file-name\">${file.name}</p>\n <nile-tooltip content=${errorMessage}>\n <span>${errorMessage}</span>\n </nile-tooltip>\n </div>\n </div>\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name=\"cancelIcon\">\n <nile-icon\n name=\"close\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\n// vertical states\nexport function getVerticalUploadingState(\n file: File,\n uploadStatus: number\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-uploading\" part=\"vertical-uploading-state\">\n <div class=\"loading\">\n <nile-loader width=\"24\" height=\"24\"></nile-loader>\n </div>\n\n <div class=\"progress-bar-container\">\n <div class=\"progress-bar-percent\">\n <p>Uploading...</p>\n <p>${uploadStatus}%</p>\n </div>\n <nile-progress-bar value=${uploadStatus}></nile-progress-bar>\n <p class=\"vertical-file-name\">${file.name}</p>\n </div>\n\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => cancelFileUpload(file, e)} name=\"cancelIcon\">\n <nile-icon\n name=\"close\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\n\nexport function getVerticalPreviewState(\n url: string,\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-preview\" part=\"vertical-preview-state\">\n <div>\n <img\n class=\"image-preview\"\n src=${url}\n alt=${file.name}\n />\n </div>\n\n <div class=\"content-container\">\n <p>${file.name}</p>\n <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>\n </div>\n\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name=\"cancelIcon\">\n <nile-icon\n name=\"trash\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\nexport function getVerticalNoPreviewState(\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-no-preview\" part=\"vertical-no-preview-state\">\n <div class=\"vertical-document-icon\">\n <nile-icon name=\"general\" size=\"20\" color=\"var(--nile-colors-blue-500)\"></nile-icon>\n </div>\n\n <div class=\"content-container\">\n <p>${truncateString(file.name, file?.type)}</p>\n <p>${getFileType(file.type)} &#8226; ${formatFileSize(Number(file.size))}</p>\n </div>\n\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name=\"cancelIcon\">\n <nile-icon\n name=\"trash\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\nexport function getVerticalErrorState(\n file: File,\n errorMessage: string,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-error\" part=\"vertical-error-state\">\n <div class=\"vertical-document-icon error-bg\">\n <nile-icon name=\"info-icon\" size=\"20\" color=\"var(--nile-colors-red-700)\"></nile-icon>\n </div>\n\n <div class=\"file-info-vertical-state\">\n <p class=\"vertical-file-name\">${file.name}</p>\n <nile-tooltip content=${errorMessage}>\n <span>${errorMessage}</span>\n </nile-tooltip>\n </div>\n\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name=\"cancelIcon\">\n <nile-icon\n name=\"close\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}"]}
1
+ {"version":3,"file":"nile-file-preview.template.js","sourceRoot":"","sources":["../../../src/nile-file-preview/nile-file-preview.template.ts"],"names":[],"mappings":"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,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;mBAKpD,CAAC,CAAgC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC;;;;;;;GAOtF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,IAAU,EACV,YAAoB,EACpB,WAAmB;IAEnB,OAAO,IAAI,CAAA;;;;;;;aAOA,IAAI,CAAC,IAAI;gCACU,YAAY;eAC7B,YAAY;;;;uCAIY,CAAC,CAAgC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC;;;;;;;;GAQ1G,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Template File for nile-preview component\n */\n\nimport './nile-file-preview.css';\nimport { html, TemplateResult } from 'lit';\nimport { FilePreviewErrorMessages, RemoveFileDetail } from './types';\nimport { removeFile, cancelFileUpload } from './utils';\n\n export function getHorizontalUploadingState(\n file: File,\n uploadStatus: number\n ): TemplateResult {\n return html`\n <div class=\"uploading\">\n <nile-loader width=\"24\" height=\"24\"></nile-loader>\n <div class=\"progress-bar-container\">\n <div class=\"progress-bar-percent\">\n <p>Uploading File...</p>\n <p>${uploadStatus}%</p>\n </div>\n <nile-progress-bar\n value=\"${uploadStatus}\"\n ></nile-progress-bar>\n <p>${file.name}</p>\n </div>\n <slot @click=${(e: CustomEvent<RemoveFileDetail>) => cancelFileUpload(file, e)} name=\"cancelIcon\">\n <nile-icon\n name=\"close\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n }\n\nexport function getHorizontalPreviewState(\n url: string,\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"preview horizontal-div\">\n <div class=\"preview-inner\">\n <div class=\"preview-image-container\">\n <img\n class=\"image-preview\"\n src=${url}\n alt=${file.name}\n />\n </div>\n <div class=\"preview-file-info\">\n <p>${file.name}</p>\n <p>${(file.type.split('/')[1]).toUpperCase()} &#8226; ${(Number(file.size) / 1024).toFixed(0)}KB</p>\n </div>\n </div>\n <slot name=\"cancelIcon\">\n <nile-icon\n @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)}\n name=\"trash\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\nexport function getHorizontalNoPreviewState(\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"no-preview horizontal-div\">\n <div class=\"no-preview-container\">\n <div class=\"document-icon\">\n <nile-icon name=\"general\" size=\"20\" color=\"var(--nile-colors-blue-500, var(--ng-componentcolors-utility-brand-600))\"></nile-icon>\n </div>\n <div class=\"preview-file-info\">\n <p>${file.name}</p>\n <p>${(file.type.split('/')[1]).toUpperCase()} &#8226; ${(Number(file.size) / 1034).toFixed(0)}KB</p>\n </div>\n </div>\n <div>\n <slot name=\"cancelIcon\">\n <nile-icon\n @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)}\n name=\"trash\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n </div>\n `;\n}\n\nexport function getHorizontalErrorState(\n file: File,\n errorMessage: string,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"error horizontal-div\">\n <div class=\"error-container\">\n <div class=\"error-icon\">\n <nile-icon name=\"info-icon\" size=\"20\" color=\"var(--nile-colors-red-700, var(--ng-colors-text-error-primary-600))\"></nile-icon>\n </div>\n <div class=\"file-info\">\n <p>${file.name}</p>\n <nile-tooltip content=${errorMessage}>\n <p>${errorMessage}</p>\n </nile-tooltip>\n </div>\n </div>\n <slot name=\"cancelIcon\">\n <nile-icon\n @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)}\n name=\"close\"\n size=\"14\"\n class=\"icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\n// vertical states\nexport function getVerticalUploadingState(\n file: File,\n uploadStatus: number\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-uploading\">\n <div class=\"loading\">\n <nile-loader width=\"24\" height=\"24\"></nile-loader>\n </div>\n\n <div class=\"progress-bar-container\">\n <div class=\"progress-bar-percent\">\n <p>Uploading...</p>\n <p>${uploadStatus}%</p>\n </div>\n <nile-progress-bar value=${uploadStatus}></nile-progress-bar>\n <p>${file.name}</p>\n </div>\n\n <slot name=\"cancelIcon\">\n <nile-icon\n @click=${(e: CustomEvent<RemoveFileDetail>) => cancelFileUpload(file, e)}\n name=\"close\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\n\nexport function getVerticalPreviewState(\n url: string,\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-preview\">\n <div>\n <img\n class=\"image-preview\"\n src=${url}\n alt=${file.name}\n />\n </div>\n\n <div class=\"content-container\">\n <p>${file.name}</p>\n <p>${(file.type.split('/')[1]).toUpperCase()} &#8226; ${(Number(file.size) / 1024).toFixed(0)}KB</p>\n </div>\n\n <slot name=\"cancelIcon\">\n <nile-icon\n @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)}\n name=\"trash\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\nexport function getVerticalNoPreviewState(\n file: File,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-no-preview\">\n <div class=\"vertical-document-icon\">\n <nile-icon name=\"general\" size=\"20\" color=\"var(--nile-colors-blue-500, var(--ng-componentcolors-utility-brand-600))\"></nile-icon>\n </div>\n\n <div class=\"content-container\">\n <p>${file.name}</p>\n <p>${file.type} &#8226; ${(Number(file.size) / 1024).toFixed(0)}KB</p>\n </div>\n\n <slot name=\"cancelIcon\">\n <nile-icon\n @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)}\n name=\"trash\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}\n\nexport function getVerticalErrorState(\n file: File,\n errorMessage: string,\n originalUrl: string\n): TemplateResult {\n return html`\n <div class=\"vertical-div vertical-error\">\n <div class=\"vertical-document-icon error-bg\">\n <nile-icon name=\"info-icon\" size=\"20\" color=\"var(--nile-colors-red-700, var(--ng-colors-text-error-primary-600))\"></nile-icon>\n </div>\n\n <div class=\"file-info-vertical-state\">\n <p>${file.name}</p>\n <nile-tooltip content=${errorMessage}>\n <p>${errorMessage}</p>\n </nile-tooltip>\n </div>\n\n <slot name=\"cancelIcon\" @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)}>\n <nile-icon\n name=\"close\"\n size=\"14\"\n class=\"icon corner-icon\"\n ></nile-icon>\n </slot>\n </div>\n `;\n}"]}
@@ -11,17 +11,17 @@ export declare enum FilePreviewVariant {
11
11
  }
12
12
  export declare enum FilePreviewErrorMessages {
13
13
  INVALID_FORMAT = "Invalid File Format. Please try again.",
14
- SIZE_LIMIT = "File exceeds size limit.",
14
+ SIZE_LIMIT = "Size limit exceeded",
15
15
  FAILED_TO_LOAD = "Failed to load file from URL",
16
16
  UNKNOWN_FILE_NAME = "unknown-file",
17
17
  UPLOAD_CANCEL = "File upload cancelled.",
18
18
  NO_FILE_SELECTED = "No file selected.",
19
- UNABLE_TO_GENEARTE_URL = "Unable to generate the url.",
20
- NETWORK_ERROR = "Network error! Please try again later."
19
+ UNABLE_TO_GENEARTE_URL = "Unable to generate the url."
21
20
  }
22
21
  export declare enum FilePreviewEvent {
23
22
  NILE_INIT = "nile-init",
24
23
  NILE_RECEIVE = "nile-receive",
24
+ NILE_UPLOADING = "nile-uploding",
25
25
  NILE_REMOVE = "nile-remove",
26
26
  NILE_CANCEL_UPLOAD = "nile-cancel-upload",
27
27
  NILE_DESTROY = "nile-destroy"
@@ -14,18 +14,18 @@ export var FilePreviewVariant;
14
14
  export var FilePreviewErrorMessages;
15
15
  (function (FilePreviewErrorMessages) {
16
16
  FilePreviewErrorMessages["INVALID_FORMAT"] = "Invalid File Format. Please try again.";
17
- FilePreviewErrorMessages["SIZE_LIMIT"] = "File exceeds size limit.";
17
+ FilePreviewErrorMessages["SIZE_LIMIT"] = "Size limit exceeded";
18
18
  FilePreviewErrorMessages["FAILED_TO_LOAD"] = "Failed to load file from URL";
19
19
  FilePreviewErrorMessages["UNKNOWN_FILE_NAME"] = "unknown-file";
20
20
  FilePreviewErrorMessages["UPLOAD_CANCEL"] = "File upload cancelled.";
21
21
  FilePreviewErrorMessages["NO_FILE_SELECTED"] = "No file selected.";
22
22
  FilePreviewErrorMessages["UNABLE_TO_GENEARTE_URL"] = "Unable to generate the url.";
23
- FilePreviewErrorMessages["NETWORK_ERROR"] = "Network error! Please try again later.";
24
23
  })(FilePreviewErrorMessages || (FilePreviewErrorMessages = {}));
25
24
  export var FilePreviewEvent;
26
25
  (function (FilePreviewEvent) {
27
26
  FilePreviewEvent["NILE_INIT"] = "nile-init";
28
27
  FilePreviewEvent["NILE_RECEIVE"] = "nile-receive";
28
+ FilePreviewEvent["NILE_UPLOADING"] = "nile-uploding";
29
29
  FilePreviewEvent["NILE_REMOVE"] = "nile-remove";
30
30
  FilePreviewEvent["NILE_CANCEL_UPLOAD"] = "nile-cancel-upload";
31
31
  FilePreviewEvent["NILE_DESTROY"] = "nile-destroy";
@@ -1 +1 @@
1
- {"version":3,"file":"nile-file-preview.enums.js","sourceRoot":"","sources":["../../../../src/nile-file-preview/types/nile-file-preview.enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,2CAAuB,CAAA;IACvB,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;IACzB,mCAAe,CAAA;AACjB,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,wBASX;AATD,WAAY,wBAAwB;IAClC,qFAAyD,CAAA;IACzD,mEAAuC,CAAA;IACvC,2EAA+C,CAAA;IAC/C,8DAAkC,CAAA;IAClC,oEAAwC,CAAA;IACxC,kEAAsC,CAAA;IACtC,kFAAsD,CAAA;IACtD,oFAAwD,CAAA;AAC1D,CAAC,EATW,wBAAwB,KAAxB,wBAAwB,QASnC;AAED,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,iDAA6B,CAAA;IAC7B,+CAA2B,CAAA;IAC3B,6DAAyC,CAAA;IACzC,iDAA6B,CAAA;AAC/B,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B","sourcesContent":["export enum FilePreviewState {\n DEFAULT = 'default',\n UPLOADING = 'uploading',\n PREVIEW = 'preview',\n NO_PREVIEW = 'no-preview',\n ERROR = 'error'\n}\n\nexport enum FilePreviewVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical'\n}\n\nexport enum FilePreviewErrorMessages {\n INVALID_FORMAT = \"Invalid File Format. Please try again.\",\n SIZE_LIMIT = \"File exceeds size limit.\",\n FAILED_TO_LOAD = \"Failed to load file from URL\",\n UNKNOWN_FILE_NAME = 'unknown-file',\n UPLOAD_CANCEL = \"File upload cancelled.\",\n NO_FILE_SELECTED = \"No file selected.\",\n UNABLE_TO_GENEARTE_URL = \"Unable to generate the url.\",\n NETWORK_ERROR = \"Network error! Please try again later.\"\n}\n\nexport enum FilePreviewEvent {\n NILE_INIT = \"nile-init\",\n NILE_RECEIVE = \"nile-receive\",\n NILE_REMOVE = \"nile-remove\",\n NILE_CANCEL_UPLOAD = \"nile-cancel-upload\",\n NILE_DESTROY = \"nile-destroy\"\n}"]}
1
+ {"version":3,"file":"nile-file-preview.enums.js","sourceRoot":"","sources":["../../../../src/nile-file-preview/types/nile-file-preview.enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,2CAAuB,CAAA;IACvB,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;IACzB,mCAAe,CAAA;AACjB,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,wBAQX;AARD,WAAY,wBAAwB;IAClC,qFAAyD,CAAA;IACzD,8DAAkC,CAAA;IAClC,2EAA+C,CAAA;IAC/C,8DAAkC,CAAA;IAClC,oEAAwC,CAAA;IACxC,kEAAsC,CAAA;IACtC,kFAAsD,CAAA;AACxD,CAAC,EARW,wBAAwB,KAAxB,wBAAwB,QAQnC;AAED,MAAM,CAAN,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,iDAA6B,CAAA;IAC7B,oDAAgC,CAAA;IAChC,+CAA2B,CAAA;IAC3B,6DAAyC,CAAA;IACzC,iDAA6B,CAAA;AAC/B,CAAC,EAPW,gBAAgB,KAAhB,gBAAgB,QAO3B","sourcesContent":["export enum FilePreviewState {\n DEFAULT = 'default',\n UPLOADING = 'uploading',\n PREVIEW = 'preview',\n NO_PREVIEW = 'no-preview',\n ERROR = 'error'\n}\n\nexport enum FilePreviewVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical'\n}\n\nexport enum FilePreviewErrorMessages {\n INVALID_FORMAT = \"Invalid File Format. Please try again.\",\n SIZE_LIMIT = \"Size limit exceeded\",\n FAILED_TO_LOAD = \"Failed to load file from URL\",\n UNKNOWN_FILE_NAME = 'unknown-file',\n UPLOAD_CANCEL = \"File upload cancelled.\",\n NO_FILE_SELECTED = \"No file selected.\",\n UNABLE_TO_GENEARTE_URL = \"Unable to generate the url.\"\n}\n\nexport enum FilePreviewEvent {\n NILE_INIT = \"nile-init\",\n NILE_RECEIVE = \"nile-receive\",\n NILE_UPLOADING = \"nile-uploding\",\n NILE_REMOVE = \"nile-remove\",\n NILE_CANCEL_UPLOAD = \"nile-cancel-upload\",\n NILE_DESTROY = \"nile-destroy\"\n}"]}
@@ -1,9 +1,4 @@
1
- import NileFilePreview from "../nile-file-preview";
2
1
  import { RemoveFileDetail } from "../types";
3
2
  export declare const generatePreviewUrl: (file: File) => Promise<string>;
4
3
  export declare const removeFile: (removeFile: File, e: CustomEvent<RemoveFileDetail>, originalUrl: string) => void;
5
4
  export declare const cancelFileUpload: (file: File, e: CustomEvent<RemoveFileDetail>) => void;
6
- export declare const formatFileSize: (bytes: number) => string;
7
- export declare const getFileType: (type: string) => string;
8
- export declare const truncateString: (str: string, type: string) => string;
9
- export declare const fileUploadServerError: (nileFilePreview: NileFilePreview) => void;
@@ -35,29 +35,4 @@ export const cancelFileUpload = (file, e) => {
35
35
  }));
36
36
  }
37
37
  };
38
- export const formatFileSize = (bytes) => {
39
- const kb = bytes / 1024;
40
- const mb = kb / 1024;
41
- const gb = mb / 1024;
42
- if (gb >= 1)
43
- return gb.toFixed(2) + ' GB';
44
- if (mb >= 1)
45
- return mb.toFixed(2) + ' MB';
46
- if (kb >= 1)
47
- return kb.toFixed(2) + ' KB';
48
- return bytes + ' B';
49
- };
50
- export const getFileType = (type) => {
51
- return type.split('/')[1].toUpperCase();
52
- };
53
- export const truncateString = (str, type) => {
54
- return str.length > 20 ? (str.slice(0, 10) + '...' + str.slice(str.length - 5, str.length - 1) + '.' + type.split('/')[1]) : str;
55
- };
56
- export const fileUploadServerError = (nileFilePreview) => {
57
- document.addEventListener('nile-network-error', (e) => {
58
- console.log('working file preview');
59
- nileFilePreview.errorMessage = FilePreviewErrorMessages.NETWORK_ERROR;
60
- nileFilePreview.requestUpdate();
61
- });
62
- };
63
38
  //# sourceMappingURL=nile-file-preview.util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-file-preview.util.js","sourceRoot":"","sources":["../../../../src/nile-file-preview/utils/nile-file-preview.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAExF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAU,EAAmB,EAAE;IAChE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAEhC,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAgB,CAAC;YAC3C,OAAO,CAAC,UAAU,CAAC,CAAC;QACtB,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,CAAC,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;QAC1D,CAAC,CAAA;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAgB,EAAE,CAAgC,EAAE,WAAmB,EAAQ,EAAE;IAC1G,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACb,CAAC,CAAC,MAAM,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,gBAAgB,CAAC,WAAW,EAAE;YAC5C,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE;YAC/C,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SAC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E,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,GAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACpI,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,eAAgC,EAAE,EAAE;IACxE,QAAQ,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,CAAM,EAAE,EAAE;QACzD,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QAEpC,eAAe,CAAC,YAAY,GAAG,wBAAwB,CAAC,aAAa,CAAC;QACtE,eAAe,CAAC,aAAa,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAA","sourcesContent":["import NileFilePreview from \"../nile-file-preview\";\nimport { RemoveFileDetail, FilePreviewEvent, FilePreviewErrorMessages } from \"../types\";\n\nexport const generatePreviewUrl = (file: File): Promise<string> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n if (file) {\n reader.readAsDataURL(file);\n } else {\n reject(FilePreviewErrorMessages.NO_FILE_SELECTED);\n }\n\n reader.onload = () => {\n const previewUrl = reader.result as string;\n resolve(previewUrl);\n };\n\n reader.onerror = (error) => {\n reject(FilePreviewErrorMessages.UNABLE_TO_GENEARTE_URL);\n }\n });\n}\n\nexport const removeFile = (removeFile: File, e: CustomEvent<RemoveFileDetail>, originalUrl: string): void => {\n if (e.target) {\n e.target.dispatchEvent(\n new CustomEvent(FilePreviewEvent.NILE_REMOVE, {\n detail: { value: removeFile, url: originalUrl },\n bubbles: true,\n composed: true,\n })\n );\n }\n};\n\nexport const cancelFileUpload = (file: File, e: CustomEvent<RemoveFileDetail>) => {\n if(e.target) {\n e.target.dispatchEvent(\n new CustomEvent(FilePreviewEvent.NILE_CANCEL_UPLOAD, {\n detail: { file: file },\n bubbles: true,\n composed: true,\n })\n );\n }\n}\n\nexport const formatFileSize = (bytes: number): string => {\n const kb = bytes / 1024;\n const mb = kb / 1024;\n const gb = mb / 1024;\n\n if (gb >= 1) return gb.toFixed(2) + ' GB';\n if (mb >= 1) return mb.toFixed(2) + ' MB';\n if (kb >= 1) return kb.toFixed(2) + ' KB';\n return bytes + ' B';\n}\n\nexport const getFileType = (type: string): string => {\n return type.split('/')[1].toUpperCase();\n}\n\nexport const truncateString = (str: string, type: string): string => {\n return str.length > 20 ? (str.slice(0, 10) + '...' + str.slice(str.length - 5, str.length - 1) + '.' + type.split('/')[1]) : str;\n}\n\nexport const fileUploadServerError = (nileFilePreview: NileFilePreview) => {\n document.addEventListener('nile-network-error', (e: any) => {\n console.log('working file preview');\n \n nileFilePreview.errorMessage = FilePreviewErrorMessages.NETWORK_ERROR;\n nileFilePreview.requestUpdate();\n });\n}"]}
1
+ {"version":3,"file":"nile-file-preview.util.js","sourceRoot":"","sources":["../../../../src/nile-file-preview/utils/nile-file-preview.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAExF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAU,EAAmB,EAAE;IAChE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAEhC,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAgB,CAAC;YAC3C,OAAO,CAAC,UAAU,CAAC,CAAC;QACtB,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,CAAC,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;QAC1D,CAAC,CAAA;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAgB,EAAE,CAAgC,EAAE,WAAmB,EAAQ,EAAE;IAC1G,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACb,CAAC,CAAC,MAAM,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,gBAAgB,CAAC,WAAW,EAAE;YAC5C,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE;YAC/C,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAAE,CAAgC,EAAE,EAAE;IAC/E,IAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QACZ,CAAC,CAAC,MAAM,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,gBAAgB,CAAC,kBAAkB,EAAE;YACnD,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;YACtB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAA","sourcesContent":["import NileFilePreview from \"../nile-file-preview\";\nimport { RemoveFileDetail, FilePreviewEvent, FilePreviewErrorMessages } from \"../types\";\n\nexport const generatePreviewUrl = (file: File): Promise<string> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n if (file) {\n reader.readAsDataURL(file);\n } else {\n reject(FilePreviewErrorMessages.NO_FILE_SELECTED);\n }\n\n reader.onload = () => {\n const previewUrl = reader.result as string;\n resolve(previewUrl);\n };\n\n reader.onerror = (error) => {\n reject(FilePreviewErrorMessages.UNABLE_TO_GENEARTE_URL);\n }\n });\n}\n\nexport const removeFile = (removeFile: File, e: CustomEvent<RemoveFileDetail>, originalUrl: string): void => {\n if (e.target) {\n e.target.dispatchEvent(\n new CustomEvent(FilePreviewEvent.NILE_REMOVE, {\n detail: { value: removeFile, url: originalUrl },\n bubbles: true,\n composed: true,\n })\n );\n }\n};\n\nexport const cancelFileUpload = (file: File, e: CustomEvent<RemoveFileDetail>) => {\n if(e.target) {\n e.target.dispatchEvent(\n new CustomEvent(FilePreviewEvent.NILE_CANCEL_UPLOAD, {\n detail: { file: file },\n bubbles: true,\n composed: true,\n })\n );\n }\n}"]}