@dnb/eufemia 10.70.1 → 10.71.0

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 (199) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/cjs/components/date-picker/DatePickerContext.d.ts +0 -1
  3. package/cjs/components/date-picker/DatePickerContext.js.map +1 -1
  4. package/cjs/components/date-picker/DatePickerInput.js +7 -59
  5. package/cjs/components/date-picker/DatePickerInput.js.map +1 -1
  6. package/cjs/components/date-picker/DatePickerProvider.js +0 -2
  7. package/cjs/components/date-picker/DatePickerProvider.js.map +1 -1
  8. package/cjs/components/date-picker/hooks/useDates.d.ts +0 -2
  9. package/cjs/components/date-picker/hooks/useDates.js +5 -5
  10. package/cjs/components/date-picker/hooks/useDates.js.map +1 -1
  11. package/cjs/components/input-masked/InputMaskedHooks.js +11 -7
  12. package/cjs/components/input-masked/InputMaskedHooks.js.map +1 -1
  13. package/cjs/components/input-masked/InputMaskedUtils.d.ts +1 -1
  14. package/cjs/components/input-masked/InputMaskedUtils.js +2 -1
  15. package/cjs/components/input-masked/InputMaskedUtils.js.map +1 -1
  16. package/cjs/components/modal/ModalDocs.d.ts +2 -0
  17. package/cjs/components/modal/ModalDocs.js +11 -1
  18. package/cjs/components/modal/ModalDocs.js.map +1 -1
  19. package/cjs/components/upload/Upload.js +6 -3
  20. package/cjs/components/upload/Upload.js.map +1 -1
  21. package/cjs/components/upload/UploadDocs.d.ts +1 -0
  22. package/cjs/components/upload/UploadDocs.js +43 -1
  23. package/cjs/components/upload/UploadDocs.js.map +1 -1
  24. package/cjs/components/upload/UploadFileListCell.js +32 -12
  25. package/cjs/components/upload/UploadFileListCell.js.map +1 -1
  26. package/cjs/components/upload/types.d.ts +7 -0
  27. package/cjs/components/upload/types.js.map +1 -1
  28. package/cjs/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
  29. package/cjs/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
  30. package/cjs/extensions/forms/Field/Number/Number.js +3 -6
  31. package/cjs/extensions/forms/Field/Number/Number.js.map +1 -1
  32. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +6 -4
  33. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js +33 -25
  34. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  35. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.d.ts +2 -2
  36. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +8 -3
  37. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
  38. package/cjs/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
  39. package/cjs/extensions/forms/Field/Upload/Upload.d.ts +1 -1
  40. package/cjs/extensions/forms/Field/Upload/Upload.js +3 -1
  41. package/cjs/extensions/forms/Field/Upload/Upload.js.map +1 -1
  42. package/cjs/extensions/forms/FieldBlock/FieldBlock.js +11 -4
  43. package/cjs/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  44. package/cjs/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
  45. package/cjs/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
  46. package/cjs/extensions/forms/hooks/DataValueWritePropsDocs.js +1 -1
  47. package/cjs/extensions/forms/hooks/DataValueWritePropsDocs.js.map +1 -1
  48. package/cjs/extensions/forms/hooks/useFieldProps.js +50 -17
  49. package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
  50. package/cjs/extensions/forms/types.d.ts +8 -5
  51. package/cjs/extensions/forms/types.js.map +1 -1
  52. package/cjs/extensions/forms/utils/FormError.d.ts +20 -16
  53. package/cjs/extensions/forms/utils/FormError.js.map +1 -1
  54. package/cjs/shared/Eufemia.d.ts +1 -1
  55. package/cjs/shared/Eufemia.js +2 -2
  56. package/cjs/shared/Eufemia.js.map +1 -1
  57. package/cjs/style/core/scopes.scss +1 -1
  58. package/cjs/style/dnb-ui-basis.css +1 -1
  59. package/cjs/style/dnb-ui-basis.min.css +1 -1
  60. package/cjs/style/dnb-ui-body.css +1 -1
  61. package/cjs/style/dnb-ui-body.min.css +1 -1
  62. package/cjs/style/dnb-ui-core.css +1 -1
  63. package/cjs/style/dnb-ui-core.min.css +1 -1
  64. package/components/date-picker/DatePickerContext.d.ts +0 -1
  65. package/components/date-picker/DatePickerContext.js.map +1 -1
  66. package/components/date-picker/DatePickerInput.js +7 -59
  67. package/components/date-picker/DatePickerInput.js.map +1 -1
  68. package/components/date-picker/DatePickerProvider.js +0 -2
  69. package/components/date-picker/DatePickerProvider.js.map +1 -1
  70. package/components/date-picker/hooks/useDates.d.ts +0 -2
  71. package/components/date-picker/hooks/useDates.js +3 -5
  72. package/components/date-picker/hooks/useDates.js.map +1 -1
  73. package/components/input-masked/InputMaskedHooks.js +11 -7
  74. package/components/input-masked/InputMaskedHooks.js.map +1 -1
  75. package/components/input-masked/InputMaskedUtils.d.ts +1 -1
  76. package/components/input-masked/InputMaskedUtils.js +2 -1
  77. package/components/input-masked/InputMaskedUtils.js.map +1 -1
  78. package/components/modal/ModalDocs.d.ts +2 -0
  79. package/components/modal/ModalDocs.js +10 -0
  80. package/components/modal/ModalDocs.js.map +1 -1
  81. package/components/upload/Upload.js +6 -3
  82. package/components/upload/Upload.js.map +1 -1
  83. package/components/upload/UploadDocs.d.ts +1 -0
  84. package/components/upload/UploadDocs.js +42 -0
  85. package/components/upload/UploadDocs.js.map +1 -1
  86. package/components/upload/UploadFileListCell.js +32 -12
  87. package/components/upload/UploadFileListCell.js.map +1 -1
  88. package/components/upload/types.d.ts +7 -0
  89. package/components/upload/types.js.map +1 -1
  90. package/es/components/date-picker/DatePickerContext.d.ts +0 -1
  91. package/es/components/date-picker/DatePickerContext.js.map +1 -1
  92. package/es/components/date-picker/DatePickerInput.js +2 -53
  93. package/es/components/date-picker/DatePickerInput.js.map +1 -1
  94. package/es/components/date-picker/DatePickerProvider.js +0 -2
  95. package/es/components/date-picker/DatePickerProvider.js.map +1 -1
  96. package/es/components/date-picker/hooks/useDates.d.ts +0 -2
  97. package/es/components/date-picker/hooks/useDates.js +3 -5
  98. package/es/components/date-picker/hooks/useDates.js.map +1 -1
  99. package/es/components/input-masked/InputMaskedHooks.js +11 -7
  100. package/es/components/input-masked/InputMaskedHooks.js.map +1 -1
  101. package/es/components/input-masked/InputMaskedUtils.d.ts +1 -1
  102. package/es/components/input-masked/InputMaskedUtils.js +2 -1
  103. package/es/components/input-masked/InputMaskedUtils.js.map +1 -1
  104. package/es/components/modal/ModalDocs.d.ts +2 -0
  105. package/es/components/modal/ModalDocs.js +6 -0
  106. package/es/components/modal/ModalDocs.js.map +1 -1
  107. package/es/components/upload/Upload.js +6 -3
  108. package/es/components/upload/Upload.js.map +1 -1
  109. package/es/components/upload/UploadDocs.d.ts +1 -0
  110. package/es/components/upload/UploadDocs.js +42 -0
  111. package/es/components/upload/UploadDocs.js.map +1 -1
  112. package/es/components/upload/UploadFileListCell.js +32 -12
  113. package/es/components/upload/UploadFileListCell.js.map +1 -1
  114. package/es/components/upload/types.d.ts +7 -0
  115. package/es/components/upload/types.js.map +1 -1
  116. package/es/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
  117. package/es/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
  118. package/es/extensions/forms/Field/Number/Number.js +3 -6
  119. package/es/extensions/forms/Field/Number/Number.js.map +1 -1
  120. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +6 -4
  121. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js +24 -16
  122. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  123. package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.d.ts +2 -2
  124. package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +7 -2
  125. package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
  126. package/es/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
  127. package/es/extensions/forms/Field/Upload/Upload.d.ts +1 -1
  128. package/es/extensions/forms/Field/Upload/Upload.js +3 -1
  129. package/es/extensions/forms/Field/Upload/Upload.js.map +1 -1
  130. package/es/extensions/forms/FieldBlock/FieldBlock.js +11 -4
  131. package/es/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  132. package/es/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
  133. package/es/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
  134. package/es/extensions/forms/hooks/DataValueWritePropsDocs.js +1 -1
  135. package/es/extensions/forms/hooks/DataValueWritePropsDocs.js.map +1 -1
  136. package/es/extensions/forms/hooks/useFieldProps.js +51 -18
  137. package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
  138. package/es/extensions/forms/types.d.ts +8 -5
  139. package/es/extensions/forms/types.js.map +1 -1
  140. package/es/extensions/forms/utils/FormError.d.ts +20 -16
  141. package/es/extensions/forms/utils/FormError.js +1 -0
  142. package/es/extensions/forms/utils/FormError.js.map +1 -1
  143. package/es/shared/Eufemia.d.ts +1 -1
  144. package/es/shared/Eufemia.js +2 -2
  145. package/es/shared/Eufemia.js.map +1 -1
  146. package/es/style/core/scopes.scss +1 -1
  147. package/es/style/dnb-ui-basis.css +1 -1
  148. package/es/style/dnb-ui-basis.min.css +1 -1
  149. package/es/style/dnb-ui-body.css +1 -1
  150. package/es/style/dnb-ui-body.min.css +1 -1
  151. package/es/style/dnb-ui-core.css +1 -1
  152. package/es/style/dnb-ui-core.min.css +1 -1
  153. package/esm/dnb-ui-basis.min.mjs +1 -1
  154. package/esm/dnb-ui-components.min.mjs +1 -1
  155. package/esm/dnb-ui-elements.min.mjs +1 -1
  156. package/esm/dnb-ui-extensions.min.mjs +1 -1
  157. package/esm/dnb-ui-lib.min.mjs +1 -1
  158. package/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
  159. package/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
  160. package/extensions/forms/Field/Number/Number.js +3 -6
  161. package/extensions/forms/Field/Number/Number.js.map +1 -1
  162. package/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +6 -4
  163. package/extensions/forms/Field/PhoneNumber/PhoneNumber.js +33 -25
  164. package/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  165. package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.d.ts +2 -2
  166. package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +7 -2
  167. package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
  168. package/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
  169. package/extensions/forms/Field/Upload/Upload.d.ts +1 -1
  170. package/extensions/forms/Field/Upload/Upload.js +3 -1
  171. package/extensions/forms/Field/Upload/Upload.js.map +1 -1
  172. package/extensions/forms/FieldBlock/FieldBlock.js +11 -4
  173. package/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  174. package/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
  175. package/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
  176. package/extensions/forms/hooks/DataValueWritePropsDocs.js +1 -1
  177. package/extensions/forms/hooks/DataValueWritePropsDocs.js.map +1 -1
  178. package/extensions/forms/hooks/useFieldProps.js +51 -18
  179. package/extensions/forms/hooks/useFieldProps.js.map +1 -1
  180. package/extensions/forms/types.d.ts +8 -5
  181. package/extensions/forms/types.js.map +1 -1
  182. package/extensions/forms/utils/FormError.d.ts +20 -16
  183. package/extensions/forms/utils/FormError.js.map +1 -1
  184. package/package.json +1 -1
  185. package/shared/Eufemia.d.ts +1 -1
  186. package/shared/Eufemia.js +2 -2
  187. package/shared/Eufemia.js.map +1 -1
  188. package/style/core/scopes.scss +1 -1
  189. package/style/dnb-ui-basis.css +1 -1
  190. package/style/dnb-ui-basis.min.css +1 -1
  191. package/style/dnb-ui-body.css +1 -1
  192. package/style/dnb-ui-body.min.css +1 -1
  193. package/style/dnb-ui-core.css +1 -1
  194. package/style/dnb-ui-core.min.css +1 -1
  195. package/umd/dnb-ui-basis.min.js +1 -1
  196. package/umd/dnb-ui-components.min.js +1 -1
  197. package/umd/dnb-ui-elements.min.js +1 -1
  198. package/umd/dnb-ui-extensions.min.js +1 -1
  199. package/umd/dnb-ui-lib.min.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ModalDocs.js","names":["ModalProperties","exports","id","doc","type","status","rootId","contentId","labelledBy","children","fullscreen","openState","openDelay","disabled","noAnimation","noAnimationOnMobile","animationDuration","preventClose","preventOverlayClose","openModal","closeModal","focusSelector","overlayClass","contentClass","omitTriggerButton","trigger","triggerAttributes","dialogTitle","directDomReturn","bypassInvalidationSelectors","scrollRef","contentRef","spacing","closeTitle","hideCloseButton","class","className","ModalEvents","onOpen","onClose","onClosePrevent"],"sources":["../../../../src/components/modal/ModalDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../shared/types'\n\nexport const ModalProperties: PropertiesTableProps = {\n id: {\n doc: 'The id used internal for the trigger button and Modal component.',\n type: 'string',\n status: 'optional',\n },\n rootId: {\n doc: 'The id used internal in the modal root element. Defaults to `root`, so the element id will be `dnb-modal-root`.',\n type: 'string',\n status: 'optional',\n },\n contentId: {\n doc: 'Defines an unique identifier to a modal. Use it in case you have to refer in some way to the modal content.',\n type: 'string',\n status: 'optional',\n },\n labelledBy: {\n doc: 'The ID of the trigger component, describing the modal content. Defaults to the internal `trigger`, so make sure you define the `title` in `triggerAttributes`.',\n type: 'string',\n status: 'optional',\n },\n children: {\n doc: 'the content which will appear when triggering open the modal. If a function is given, you get a close method `() => ({ close })` in the arguments.',\n type: ['React.ReactNode', 'function'],\n status: 'optional',\n },\n fullscreen: {\n doc: 'If set to `true` then the modal content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`.',\n type: 'boolean',\n status: 'optional',\n },\n openState: {\n doc: 'use this property to control the open/close state by setting either: `opened` / `closed` or `true` / `false`.',\n type: ['boolean', 'opened', 'closed'],\n status: 'optional',\n },\n openDelay: {\n doc: 'forces the modal to delay the opening. The delay is given in `ms`.',\n type: ['number', 'string'],\n status: 'optional',\n },\n disabled: {\n doc: 'Will disable the trigger button.',\n type: 'boolean',\n status: 'optional',\n },\n noAnimation: {\n doc: 'if set to `true`, no open/close animation will be shown. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n noAnimationOnMobile: {\n doc: 'same as `noAnimation`, but gets triggered only if the viewport width is less than `40em`. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n animationDuration: {\n doc: 'Duration of animation open/close in ms. Defaults to 300ms.',\n type: ['number', 'string'],\n status: 'optional',\n },\n preventClose: {\n doc: \"if set to `true` (boolean or string), then the user can't close the modal.\",\n type: 'boolean',\n status: 'optional',\n },\n preventOverlayClose: {\n doc: 'Disable clicking the background overlay to close the modal. PS! Pressing `esc` key will still close the modal.',\n type: 'boolean',\n status: 'optional',\n },\n openModal: {\n doc: 'set a function to call the callback function, once the modal should open: `openModal={(open) => open()}`.',\n type: 'function',\n status: 'optional',\n },\n closeModal: {\n doc: 'set a function to call the callback function, once the modal should close: `closeModal={(close) => close()}`.',\n type: 'function',\n status: 'optional',\n },\n focusSelector: {\n doc: 'The Modal handles the first focus – automatically. However, you can define a custom focus selector the will be used instead `focusSelector=\".css-selector\"`.',\n type: 'string',\n status: 'optional',\n },\n overlayClass: {\n doc: 'give the page overlay a custom class name (maps to `dnb-modal__overlay`).',\n type: 'string',\n status: 'optional',\n },\n contentClass: {\n doc: 'give the content wrapper a custom class name (maps to `dnb-modal__content`).',\n type: 'string',\n status: 'optional',\n },\n omitTriggerButton: {\n doc: 'omits default showing trigger button.',\n type: 'boolean',\n status: 'optional',\n },\n trigger: {\n doc: 'provide a custom trigger component. Like `trigger={<Anchor href=\"/\" />}`. It will set the focus on it when the modal gets closed.',\n type: ['React.ReactNode', 'function'],\n status: 'optional',\n },\n triggerAttributes: {\n doc: 'send along with custom HTML attributes or properties to the trigger button.',\n type: 'Various',\n status: 'optional',\n },\n dialogTitle: {\n doc: 'The aria label of the dialog when no labelledBy and no title is given. Defaults to `Vindu`.',\n type: 'string',\n status: 'optional',\n },\n directDomReturn: {\n doc: 'If true, the modal will not open in a new DOM but directly in current DOM. Defaults to `false`. Be aware of the side effects of setting this property to `true`.',\n type: 'boolean',\n status: 'optional',\n },\n bypassInvalidationSelectors: {\n doc: \"Define an array with HTML class selectors (`['.element-selector']`) which should not get invalidated when the modal opens/closes. Use this in order to let some parts of your site still be accessible by screen readers.\",\n type: 'boolean',\n status: 'optional',\n },\n scrollRef: {\n doc: 'To get the scroll Element, pass in your own React ref.',\n type: 'React.RefObject',\n status: 'optional',\n },\n contentRef: {\n doc: 'To get the inner content Element, pass in your own React ref.',\n type: 'React.RefObject',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n spacing: {\n doc: 'if set to `false` then the modal content will be shown without any spacing. Defaults to `true`.',\n type: 'boolean',\n status: 'deprecated',\n },\n closeTitle: {\n doc: 'the title of the close button. Defaults to _Lukk_.',\n type: 'string',\n status: 'deprecated',\n },\n hideCloseButton: {\n doc: 'if true, the close button will not be shown.',\n type: 'boolean',\n status: 'deprecated',\n },\n class: {\n doc: 'give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).',\n type: 'string',\n status: 'optional',\n },\n className: {\n doc: 'give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).',\n type: 'string',\n status: 'optional',\n },\n}\n\nexport const ModalEvents: PropertiesTableProps = {\n onOpen: {\n doc: 'This event gets triggered once the modal shows up. Returns the modal id: `{ id }`.',\n type: 'function',\n status: 'optional',\n },\n onClose: {\n doc: 'This event gets triggered once the modal gets closed. Returns the modal id: `{ id, event, triggeredBy }`.',\n type: 'function',\n status: 'optional',\n },\n onClosePrevent: {\n doc: 'This event gets triggered once the user tries to close the modal, but `preventClose` is set to **true**. Returns a callback `close` you can call to trigger the close mechanism. More details below. Returns the modal id: `{ id, event, close: Method, triggeredBy }`.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AAEO,MAAMA,eAAqC,GAAAC,OAAA,CAAAD,eAAA,GAAG;EACnDE,EAAE,EAAE;IACFC,GAAG,EAAE,kEAAkE;IACvEC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDC,MAAM,EAAE;IACNH,GAAG,EAAE,iHAAiH;IACtHC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDE,SAAS,EAAE;IACTJ,GAAG,EAAE,6GAA6G;IAClHC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDG,UAAU,EAAE;IACVL,GAAG,EAAE,gKAAgK;IACrKC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDI,QAAQ,EAAE;IACRN,GAAG,EAAE,oJAAoJ;IACzJC,IAAI,EAAE,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACrCC,MAAM,EAAE;EACV,CAAC;EACDK,UAAU,EAAE;IACVP,GAAG,EAAE,0LAA0L;IAC/LC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDM,SAAS,EAAE;IACTR,GAAG,EAAE,+GAA+G;IACpHC,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC;IACrCC,MAAM,EAAE;EACV,CAAC;EACDO,SAAS,EAAE;IACTT,GAAG,EAAE,oEAAoE;IACzEC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC1BC,MAAM,EAAE;EACV,CAAC;EACDQ,QAAQ,EAAE;IACRV,GAAG,EAAE,kCAAkC;IACvCC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDS,WAAW,EAAE;IACXX,GAAG,EAAE,+EAA+E;IACpFC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C,MAAM,EAAE;EACV;AACF,CAAC;AAEM,MAAMgC,WAAiC,GAAApC,OAAA,CAAAoC,WAAA,GAAG;EAC/CC,MAAM,EAAE;IACNnC,GAAG,EAAE,oFAAoF;IACzFC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDkC,OAAO,EAAE;IACPpC,GAAG,EAAE,2GAA2G;IAChHC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDmC,cAAc,EAAE;IACdrC,GAAG,EAAE,yQAAyQ;IAC9QC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ModalDocs.js","names":["_componentHelper","require","transformPropertyNamesWithSnakeCase","properties","Object","fromEntries","entries","map","_ref","key","value","toLowerCase","toSnakeCase","ModalProperties","exports","id","doc","type","status","rootId","contentId","labelledBy","children","fullscreen","openState","openDelay","disabled","noAnimation","noAnimationOnMobile","animationDuration","preventClose","preventOverlayClose","openModal","closeModal","focusSelector","overlayClass","contentClass","omitTriggerButton","trigger","triggerAttributes","dialogTitle","directDomReturn","bypassInvalidationSelectors","scrollRef","contentRef","spacing","closeTitle","hideCloseButton","class","className","ModalPropertiesWithSnakeCase","ModalEvents","onOpen","onClose","onClosePrevent","ModalEventsWithSnakeCase"],"sources":["../../../../src/components/modal/ModalDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../shared/types'\nimport { toSnakeCase } from '../../shared/component-helper'\n\nconst transformPropertyNamesWithSnakeCase = (\n properties: PropertiesTableProps\n) => {\n return Object.fromEntries(\n Object.entries(properties).map(([key, value]) => [\n key !== key.toLowerCase() ? `${key} / ${toSnakeCase(key)}` : key,\n value,\n ])\n )\n}\n\nexport const ModalProperties: PropertiesTableProps = {\n id: {\n doc: 'The id used internal for the trigger button and Modal component.',\n type: 'string',\n status: 'optional',\n },\n rootId: {\n doc: 'The id used internal in the modal root element. Defaults to `root`, so the element id will be `dnb-modal-root`.',\n type: 'string',\n status: 'optional',\n },\n contentId: {\n doc: 'Defines an unique identifier to a modal. Use it in case you have to refer in some way to the modal content.',\n type: 'string',\n status: 'optional',\n },\n labelledBy: {\n doc: 'The ID of the trigger component, describing the modal content. Defaults to the internal `trigger`, so make sure you define the `title` in `triggerAttributes`.',\n type: 'string',\n status: 'optional',\n },\n children: {\n doc: 'the content which will appear when triggering open the modal. If a function is given, you get a close method `() => ({ close })` in the arguments.',\n type: ['React.ReactNode', 'function'],\n status: 'optional',\n },\n fullscreen: {\n doc: 'If set to `true` then the modal content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`.',\n type: 'boolean',\n status: 'optional',\n },\n openState: {\n doc: 'use this property to control the open/close state by setting either: `opened` / `closed` or `true` / `false`.',\n type: ['boolean', 'opened', 'closed'],\n status: 'optional',\n },\n openDelay: {\n doc: 'forces the modal to delay the opening. The delay is given in `ms`.',\n type: ['number', 'string'],\n status: 'optional',\n },\n disabled: {\n doc: 'Will disable the trigger button.',\n type: 'boolean',\n status: 'optional',\n },\n noAnimation: {\n doc: 'if set to `true`, no open/close animation will be shown. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n noAnimationOnMobile: {\n doc: 'same as `noAnimation`, but gets triggered only if the viewport width is less than `40em`. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n animationDuration: {\n doc: 'Duration of animation open/close in ms. Defaults to 300ms.',\n type: ['number', 'string'],\n status: 'optional',\n },\n preventClose: {\n doc: \"if set to `true` (boolean or string), then the user can't close the modal.\",\n type: 'boolean',\n status: 'optional',\n },\n preventOverlayClose: {\n doc: 'Disable clicking the background overlay to close the modal. PS! Pressing `esc` key will still close the modal.',\n type: 'boolean',\n status: 'optional',\n },\n openModal: {\n doc: 'set a function to call the callback function, once the modal should open: `openModal={(open) => open()}`.',\n type: 'function',\n status: 'optional',\n },\n closeModal: {\n doc: 'set a function to call the callback function, once the modal should close: `closeModal={(close) => close()}`.',\n type: 'function',\n status: 'optional',\n },\n focusSelector: {\n doc: 'The Modal handles the first focus – automatically. However, you can define a custom focus selector the will be used instead `focusSelector=\".css-selector\"`.',\n type: 'string',\n status: 'optional',\n },\n overlayClass: {\n doc: 'give the page overlay a custom class name (maps to `dnb-modal__overlay`).',\n type: 'string',\n status: 'optional',\n },\n contentClass: {\n doc: 'give the content wrapper a custom class name (maps to `dnb-modal__content`).',\n type: 'string',\n status: 'optional',\n },\n omitTriggerButton: {\n doc: 'omits default showing trigger button.',\n type: 'boolean',\n status: 'optional',\n },\n trigger: {\n doc: 'provide a custom trigger component. Like `trigger={<Anchor href=\"/\" />}`. It will set the focus on it when the modal gets closed.',\n type: ['React.ReactNode', 'function'],\n status: 'optional',\n },\n triggerAttributes: {\n doc: 'send along with custom HTML attributes or properties to the trigger button.',\n type: 'Various',\n status: 'optional',\n },\n dialogTitle: {\n doc: 'The aria label of the dialog when no labelledBy and no title is given. Defaults to `Vindu`.',\n type: 'string',\n status: 'optional',\n },\n directDomReturn: {\n doc: 'If true, the modal will not open in a new DOM but directly in current DOM. Defaults to `false`. Be aware of the side effects of setting this property to `true`.',\n type: 'boolean',\n status: 'optional',\n },\n bypassInvalidationSelectors: {\n doc: \"Define an array with HTML class selectors (`['.element-selector']`) which should not get invalidated when the modal opens/closes. Use this in order to let some parts of your site still be accessible by screen readers.\",\n type: 'boolean',\n status: 'optional',\n },\n scrollRef: {\n doc: 'To get the scroll Element, pass in your own React ref.',\n type: 'React.RefObject',\n status: 'optional',\n },\n contentRef: {\n doc: 'To get the inner content Element, pass in your own React ref.',\n type: 'React.RefObject',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n spacing: {\n doc: 'if set to `false` then the modal content will be shown without any spacing. Defaults to `true`.',\n type: 'boolean',\n status: 'deprecated',\n },\n closeTitle: {\n doc: 'the title of the close button. Defaults to _Lukk_.',\n type: 'string',\n status: 'deprecated',\n },\n hideCloseButton: {\n doc: 'if true, the close button will not be shown.',\n type: 'boolean',\n status: 'deprecated',\n },\n class: {\n doc: 'give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).',\n type: 'string',\n status: 'optional',\n },\n className: {\n doc: 'give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).',\n type: 'string',\n status: 'optional',\n },\n}\n\nexport const ModalPropertiesWithSnakeCase: PropertiesTableProps =\n transformPropertyNamesWithSnakeCase(ModalProperties)\n\nexport const ModalEvents: PropertiesTableProps = {\n onOpen: {\n doc: 'This event gets triggered once the modal shows up. Returns the modal id: `{ id }`.',\n type: 'function',\n status: 'optional',\n },\n onClose: {\n doc: 'This event gets triggered once the modal gets closed. Returns the modal id: `{ id, event, triggeredBy }`.',\n type: 'function',\n status: 'optional',\n },\n onClosePrevent: {\n doc: 'This event gets triggered once the user tries to close the modal, but `preventClose` is set to **true**. Returns a callback `close` you can call to trigger the close mechanism. More details below. Returns the modal id: `{ id, event, close: Method, triggeredBy }`.',\n type: 'function',\n status: 'optional',\n },\n}\n\nexport const ModalEventsWithSnakeCase: PropertiesTableProps =\n transformPropertyNamesWithSnakeCase(ModalEvents)\n"],"mappings":";;;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAEA,MAAMC,mCAAmC,GACvCC,UAAgC,IAC7B;EACH,OAAOC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,UAAU,CAAC,CAACI,GAAG,CAACC,IAAA;IAAA,IAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IAAA,OAAK,CAC/CC,GAAG,KAAKA,GAAG,CAACE,WAAW,CAAC,CAAC,GAAG,GAAGF,GAAG,MAAM,IAAAG,4BAAW,EAACH,GAAG,CAAC,EAAE,GAAGA,GAAG,EAChEC,KAAK,CACN;EAAA,EACH,CAAC;AACH,CAAC;AAEM,MAAMG,eAAqC,GAAAC,OAAA,CAAAD,eAAA,GAA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,MAAM,EAAE;IACNpC,GAAG,EAAE,oFAAoF;IACzFC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDmC,OAAO,EAAE;IACPrC,GAAG,EAAE,2GAA2G;IAChHC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDoC,cAAc,EAAE;IACdtC,GAAG,EAAE,yQAAyQ;IAC9QC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC;AAEM,MAAMqC,wBAA8C,GAAAzC,OAAA,CAAAyC,wBAAA,GACzDrD,mCAAmC,CAACiD,WAAW,CAAC","ignoreList":[]}
@@ -19,6 +19,7 @@ var _Provider = _interopRequireDefault(require("../../shared/Provider"));
19
19
  var _Context = _interopRequireDefault(require("../../shared/Context"));
20
20
  var _componentHelper = require("../../shared/component-helper");
21
21
  var _useId = _interopRequireDefault(require("../../shared/helpers/useId"));
22
+ var _HeightAnimation = _interopRequireDefault(require("../height-animation/HeightAnimation"));
22
23
  var _UploadFileInput = _interopRequireDefault(require("./UploadFileInput"));
23
24
  var _useUpload = _interopRequireDefault(require("./useUpload"));
24
25
  var _UploadDropzone = _interopRequireDefault(require("./UploadDropzone"));
@@ -28,7 +29,7 @@ var _UploadFileList2 = _interopRequireDefault(require("./UploadFileList"));
28
29
  var _UploadInfo2 = _interopRequireDefault(require("./UploadInfo"));
29
30
  var _UploadInfo, _UploadFileList;
30
31
  const _excluded = ["buttonTextSingular", "textSingular"],
31
- _excluded2 = ["id", "skeleton", "className", "acceptedFileTypes", "filesAmountLimit", "fileMaxSize", "onChange", "onFileDelete", "onFileClick", "download", "allowDuplicates", "title", "text", "fileTypeTableCaption", "fileTypeDescription", "fileSizeDescription", "fileAmountDescription", "fileSizeContent", "buttonText", "loadingText", "errorLargeFile", "errorUnsupportedFile", "errorAmountLimit", "deleteButton", "fileListAriaLabel"];
32
+ _excluded2 = ["id", "skeleton", "className", "acceptedFileTypes", "filesAmountLimit", "fileMaxSize", "onChange", "onFileDelete", "onFileClick", "download", "allowDuplicates", "title", "text", "fileTypeTableCaption", "fileTypeDescription", "fileSizeDescription", "fileAmountDescription", "fileSizeContent", "buttonText", "loadingText", "errorLargeFile", "errorUnsupportedFile", "errorAmountLimit", "deleteButton", "fileListAriaLabel", "disableDragAndDrop"];
32
33
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
33
34
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
34
35
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -79,7 +80,8 @@ const Upload = localProps => {
79
80
  errorUnsupportedFile,
80
81
  errorAmountLimit,
81
82
  deleteButton,
82
- fileListAriaLabel
83
+ fileListAriaLabel,
84
+ disableDragAndDrop
83
85
  } = extendedProps,
84
86
  props = _objectWithoutProperties(extendedProps, _excluded2);
85
87
  const spacingClasses = (0, _SpacingHelper.createSpacingClasses)(props);
@@ -122,6 +124,7 @@ const Upload = localProps => {
122
124
  }
123
125
  return validFiles;
124
126
  }, [acceptedFileTypes, errorLargeFile, errorUnsupportedFile, fileMaxSize, files, filesAmountLimit, getExistingFile, onChange, setFiles, setInternalFiles]);
127
+ const UploadWrapper = disableDragAndDrop ? _HeightAnimation.default : _UploadDropzone.default;
125
128
  return _react.default.createElement(_UploadContext.UploadContext.Provider, {
126
129
  value: _objectSpread(_objectSpread({}, extendedProps), {}, {
127
130
  id,
@@ -129,7 +132,7 @@ const Upload = localProps => {
129
132
  })
130
133
  }, _react.default.createElement(_Provider.default, {
131
134
  skeleton: skeleton
132
- }, _react.default.createElement(_UploadDropzone.default, {
135
+ }, _react.default.createElement(UploadWrapper, {
133
136
  className: (0, _classnames.default)('dnb-upload', spacingClasses, className)
134
137
  }, _UploadInfo || (_UploadInfo = _react.default.createElement(_UploadInfo2.default, null)), _react.default.createElement(_UploadFileInput.default, props), _UploadFileList || (_UploadFileList = _react.default.createElement(_UploadFileList2.default, null)))));
135
138
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Upload.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_SpacingHelper","_Provider","_Context","_componentHelper","_useId","_UploadFileInput","_useUpload","_UploadDropzone","_UploadContext","_UploadVerify","_UploadFileList2","_UploadInfo2","_UploadInfo","_UploadFileList","_excluded","_excluded2","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","indexOf","propertyIsEnumerable","Upload","localProps","context","React","useContext","Context","_context$getTranslati","getTranslation","buttonTextSingular","textSingular","translations","filesAmountLimit","buttonText","text","extendedProps","extendPropsWithContext","defaultProps","skeleton","id","idProp","className","acceptedFileTypes","fileMaxSize","onChange","onFileDelete","onFileClick","download","allowDuplicates","title","fileTypeTableCaption","fileTypeDescription","fileSizeDescription","fileAmountDescription","fileSizeContent","loadingText","errorLargeFile","errorUnsupportedFile","errorAmountLimit","deleteButton","fileListAriaLabel","props","spacingClasses","createSpacingClasses","useId","files","setFiles","setInternalFiles","getExistingFile","useUpload","onInputUpload","useCallback","newFiles","mergedFiles","map","fileItem","file","existingFile","exists","Boolean","makeUniqueId","filesToVerify","_ref","verifiedFiles","verifyFiles","validFiles","slice","createElement","UploadContext","Provider","classnames","_formElement","_supportsSpacingProps","_default","exports"],"sources":["../../../../src/components/upload/Upload.tsx"],"sourcesContent":["import React, { useCallback } from 'react'\nimport classnames from 'classnames'\n\n// Shared\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport Provider from '../../shared/Provider'\nimport Context from '../../shared/Context'\nimport {\n extendPropsWithContext,\n makeUniqueId,\n} from '../../shared/component-helper'\nimport useId from '../../shared/helpers/useId'\n\n// Internal\nimport UploadFileInput from './UploadFileInput'\nimport useUpload from './useUpload'\nimport UploadDropzone from './UploadDropzone'\nimport { UploadContext, defaultProps } from './UploadContext'\nimport { verifyFiles } from './UploadVerify'\n\nimport type { UploadFile, UploadAllProps } from './types'\nimport UploadFileList from './UploadFileList'\nimport UploadInfo from './UploadInfo'\n\nexport type * from './types'\nexport { defaultProps }\n\nconst Upload = (localProps: UploadAllProps) => {\n const context = React.useContext(Context)\n\n const { buttonTextSingular, textSingular, ...translations } =\n context.getTranslation(localProps).Upload\n\n if (localProps?.filesAmountLimit === 1) {\n translations.buttonText = buttonTextSingular\n translations.text = textSingular\n }\n\n const extendedProps = extendPropsWithContext(\n localProps,\n defaultProps,\n { skeleton: context?.skeleton },\n translations,\n context.Upload\n )\n\n const {\n id: idProp,\n skeleton,\n className,\n acceptedFileTypes,\n filesAmountLimit,\n fileMaxSize,\n onChange,\n onFileDelete, // eslint-disable-line\n onFileClick, // eslint-disable-line\n download, // eslint-disable-line\n allowDuplicates, // eslint-disable-line\n title, // eslint-disable-line\n text, // eslint-disable-line\n fileTypeTableCaption, // eslint-disable-line\n fileTypeDescription, // eslint-disable-line\n fileSizeDescription, // eslint-disable-line\n fileAmountDescription, // eslint-disable-line\n fileSizeContent, // eslint-disable-line\n buttonText, // eslint-disable-line\n loadingText, // eslint-disable-line\n errorLargeFile,\n errorUnsupportedFile,\n errorAmountLimit, // eslint-disable-line\n deleteButton, // eslint-disable-line\n fileListAriaLabel, // eslint-disable-line\n ...props\n } = extendedProps\n\n const spacingClasses = createSpacingClasses(props)\n\n const id = useId(idProp)\n\n const { files, setFiles, setInternalFiles, getExistingFile } =\n useUpload(id)\n\n const onInputUpload = useCallback(\n (newFiles: Array<UploadFile>) => {\n const mergedFiles = [\n ...files,\n ...newFiles.map((fileItem) => {\n const { file } = fileItem\n\n const existingFile = getExistingFile(file, files)\n\n fileItem.exists = Boolean(existingFile)\n fileItem.id =\n fileItem.exists && !allowDuplicates\n ? existingFile.id\n : makeUniqueId()\n\n return fileItem\n }),\n ]\n\n const filesToVerify = allowDuplicates\n ? mergedFiles\n : mergedFiles.filter(({ exists }) => !exists)\n\n const verifiedFiles = verifyFiles(filesToVerify, {\n fileMaxSize,\n acceptedFileTypes,\n errorUnsupportedFile,\n errorLargeFile,\n })\n\n const validFiles = [...verifiedFiles].slice(\n 0,\n filesAmountLimit\n ) as Array<UploadFile>\n\n setFiles(validFiles)\n setInternalFiles(mergedFiles)\n\n if (typeof onChange === 'function') {\n onChange({ files: validFiles })\n }\n\n return validFiles\n },\n [\n acceptedFileTypes,\n errorLargeFile,\n errorUnsupportedFile,\n fileMaxSize,\n files,\n filesAmountLimit,\n getExistingFile,\n onChange,\n setFiles,\n setInternalFiles,\n ]\n )\n\n return (\n <UploadContext.Provider\n value={{\n ...extendedProps,\n id,\n onInputUpload,\n }}\n >\n <Provider skeleton={skeleton}>\n <UploadDropzone\n className={classnames('dnb-upload', spacingClasses, className)}\n >\n <UploadInfo />\n\n <UploadFileInput {...props} />\n\n <UploadFileList />\n </UploadDropzone>\n </Provider>\n </UploadContext.Provider>\n )\n}\n\nUpload.useUpload = useUpload\n\nUpload._formElement = true\nUpload._supportsSpacingProps = true\n\nexport default Upload\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,O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AAiH,aAAA,CAACxH,YAAA,CAAAO,OAAU,MAAE,CAAC,GAEdvB,MAAA,CAAAuB,OAAA,CAAAiH,aAAA,CAAC9H,gBAAA,CAAAa,OAAe,EAAKuF,KAAQ,CAAC,EAAA5F,eAAA,KAAAA,eAAA,GAE9BlB,MAAA,CAAAuB,OAAA,CAAAiH,aAAA,CAACzH,gBAAA,CAAAQ,OAAc,MAAE,CAAC,CACJ,CACR,CACY,CAAC;AAE7B,CAAC;AAED+C,MAAM,CAACgD,SAAS,GAAGA,kBAAS;AAE5BhD,MAAM,CAACsE,YAAY,GAAG,IAAI;AAC1BtE,MAAM,CAACuE,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAxH,OAAA,GAEpB+C,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Upload.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_SpacingHelper","_Provider","_Context","_componentHelper","_useId","_HeightAnimation","_UploadFileInput","_useUpload","_UploadDropzone","_UploadContext","_UploadVerify","_UploadFileList2","_UploadInfo2","_UploadInfo","_UploadFileList","_excluded","_excluded2","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","indexOf","propertyIsEnumerable","Upload","localProps","context","React","useContext","Context","_context$getTranslati","getTranslation","buttonTextSingular","textSingular","translations","filesAmountLimit","buttonText","text","extendedProps","extendPropsWithContext","defaultProps","skeleton","id","idProp","className","acceptedFileTypes","fileMaxSize","onChange","onFileDelete","onFileClick","download","allowDuplicates","title","fileTypeTableCaption","fileTypeDescription","fileSizeDescription","fileAmountDescription","fileSizeContent","loadingText","errorLargeFile","errorUnsupportedFile","errorAmountLimit","deleteButton","fileListAriaLabel","disableDragAndDrop","props","spacingClasses","createSpacingClasses","useId","files","setFiles","setInternalFiles","getExistingFile","useUpload","onInputUpload","useCallback","newFiles","mergedFiles","map","fileItem","file","existingFile","exists","Boolean","makeUniqueId","filesToVerify","_ref","verifiedFiles","verifyFiles","validFiles","slice","UploadWrapper","HeightAnimation","UploadDropzone","createElement","UploadContext","Provider","classnames","_formElement","_supportsSpacingProps","_default","exports"],"sources":["../../../../src/components/upload/Upload.tsx"],"sourcesContent":["import React, { useCallback } from 'react'\nimport classnames from 'classnames'\n\n// Shared\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport Provider from '../../shared/Provider'\nimport Context from '../../shared/Context'\nimport {\n extendPropsWithContext,\n makeUniqueId,\n} from '../../shared/component-helper'\nimport useId from '../../shared/helpers/useId'\nimport HeightAnimation from '../height-animation/HeightAnimation'\n\n// Internal\nimport UploadFileInput from './UploadFileInput'\nimport useUpload from './useUpload'\nimport UploadDropzone from './UploadDropzone'\nimport { UploadContext, defaultProps } from './UploadContext'\nimport { verifyFiles } from './UploadVerify'\n\nimport type { UploadFile, UploadAllProps } from './types'\nimport UploadFileList from './UploadFileList'\nimport UploadInfo from './UploadInfo'\n\nexport type * from './types'\nexport { defaultProps }\n\nconst Upload = (localProps: UploadAllProps) => {\n const context = React.useContext(Context)\n\n const { buttonTextSingular, textSingular, ...translations } =\n context.getTranslation(localProps).Upload\n\n if (localProps?.filesAmountLimit === 1) {\n translations.buttonText = buttonTextSingular\n translations.text = textSingular\n }\n\n const extendedProps = extendPropsWithContext(\n localProps,\n defaultProps,\n { skeleton: context?.skeleton },\n translations,\n context.Upload\n )\n\n const {\n id: idProp,\n skeleton,\n className,\n acceptedFileTypes,\n filesAmountLimit,\n fileMaxSize,\n onChange,\n onFileDelete, // eslint-disable-line\n onFileClick, // eslint-disable-line\n download, // eslint-disable-line\n allowDuplicates,\n title, // eslint-disable-line\n text, // eslint-disable-line\n fileTypeTableCaption, // eslint-disable-line\n fileTypeDescription, // eslint-disable-line\n fileSizeDescription, // eslint-disable-line\n fileAmountDescription, // eslint-disable-line\n fileSizeContent, // eslint-disable-line\n buttonText, // eslint-disable-line\n loadingText, // eslint-disable-line\n errorLargeFile,\n errorUnsupportedFile,\n errorAmountLimit, // eslint-disable-line\n deleteButton, // eslint-disable-line\n fileListAriaLabel, // eslint-disable-line\n disableDragAndDrop,\n ...props\n } = extendedProps\n\n const spacingClasses = createSpacingClasses(props)\n\n const id = useId(idProp)\n\n const { files, setFiles, setInternalFiles, getExistingFile } =\n useUpload(id)\n\n const onInputUpload = useCallback(\n (newFiles: Array<UploadFile>) => {\n const mergedFiles = [\n ...files,\n ...newFiles.map((fileItem) => {\n const { file } = fileItem\n\n const existingFile = getExistingFile(file, files)\n\n fileItem.exists = Boolean(existingFile)\n fileItem.id =\n fileItem.exists && !allowDuplicates\n ? existingFile.id\n : makeUniqueId()\n\n return fileItem\n }),\n ]\n\n const filesToVerify = allowDuplicates\n ? mergedFiles\n : mergedFiles.filter(({ exists }) => !exists)\n\n const verifiedFiles = verifyFiles(filesToVerify, {\n fileMaxSize,\n acceptedFileTypes,\n errorUnsupportedFile,\n errorLargeFile,\n })\n\n const validFiles = [...verifiedFiles].slice(\n 0,\n filesAmountLimit\n ) as Array<UploadFile>\n\n setFiles(validFiles)\n setInternalFiles(mergedFiles)\n\n if (typeof onChange === 'function') {\n onChange({ files: validFiles })\n }\n\n return validFiles\n },\n [\n acceptedFileTypes,\n errorLargeFile,\n errorUnsupportedFile,\n fileMaxSize,\n files,\n filesAmountLimit,\n getExistingFile,\n onChange,\n setFiles,\n setInternalFiles,\n ]\n )\n\n const UploadWrapper = disableDragAndDrop\n ? HeightAnimation\n : UploadDropzone\n\n return (\n <UploadContext.Provider\n value={{\n ...extendedProps,\n id,\n onInputUpload,\n }}\n >\n <Provider skeleton={skeleton}>\n <UploadWrapper\n className={classnames('dnb-upload', spacingClasses, className)}\n >\n <UploadInfo />\n\n <UploadFileInput {...props} />\n\n <UploadFileList />\n </UploadWrapper>\n </Provider>\n </UploadContext.Provider>\n )\n}\n\nUpload.useUpload = useUpload\n\nUpload._formElement = true\nUpload._supportsSpacingProps = true\n\nexport default Upload\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,QAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AAIA,IAAAO,MAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,gBAAA,GAAAN,sBAAA,CAAAF,OAAA;AAGA,IAAAS,gBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,UAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,eAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,cAAA,GAAAZ,OAAA;AACA,IAAAa,aAAA,GAAAb,OAAA;AAGA,IAAAc,gBAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,YAAA,GAAAb,sBAAA,CAAAF,OAAA;AAAqC,IAAAgB,WAAA,EAAAC,eAAA;AAAA,MAAAC,SAAA;EAAAC,UAAA;AAAA,SAAAjB,uBAAAkB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAArB,wBAAAqB,CAAA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I,aAAa,CAACC,QAAQ;IACrBrF,KAAK,EAAAR,aAAA,CAAAA,aAAA,KACAmC,aAAa;MAChBI,EAAE;MACFgC;IAAa;EACb,GAEFzH,MAAA,CAAAwB,OAAA,CAAAqH,aAAA,CAACvI,SAAA,CAAAkB,OAAQ;IAACgE,QAAQ,EAAEA;EAAS,GAC3BxF,MAAA,CAAAwB,OAAA,CAAAqH,aAAA,CAACH,aAAa;IACZ/C,SAAS,EAAE,IAAAqD,mBAAU,EAAC,YAAY,EAAE/B,cAAc,EAAEtB,SAAS;EAAE,GAAAzE,WAAA,KAAAA,WAAA,GAE/DlB,MAAA,CAAAwB,OAAA,CAAAqH,aAAA,CAAC5H,YAAA,CAAAO,OAAU,MAAE,CAAC,GAEdxB,MAAA,CAAAwB,OAAA,CAAAqH,aAAA,CAAClI,gBAAA,CAAAa,OAAe,EAAKwF,KAAQ,CAAC,EAAA7F,eAAA,KAAAA,eAAA,GAE9BnB,MAAA,CAAAwB,OAAA,CAAAqH,aAAA,CAAC7H,gBAAA,CAAAQ,OAAc,MAAE,CAAC,CACL,CACP,CACY,CAAC;AAE7B,CAAC;AAED+C,MAAM,CAACiD,SAAS,GAAGA,kBAAS;AAE5BjD,MAAM,CAAC0E,YAAY,GAAG,IAAI;AAC1B1E,MAAM,CAAC2E,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAA5H,OAAA,GAEpB+C,MAAM","ignoreList":[]}
@@ -2,3 +2,4 @@ import { PropertiesTableProps } from '../../shared/types';
2
2
  export declare const UploadProperties: PropertiesTableProps;
3
3
  export declare const AcceptedFileTypeProperties: PropertiesTableProps;
4
4
  export declare const UploadEvents: PropertiesTableProps;
5
+ export declare const FileItemProperties: PropertiesTableProps;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.UploadProperties = exports.UploadEvents = exports.AcceptedFileTypeProperties = void 0;
6
+ exports.UploadProperties = exports.UploadEvents = exports.FileItemProperties = exports.AcceptedFileTypeProperties = void 0;
7
7
  const UploadProperties = exports.UploadProperties = {
8
8
  id: {
9
9
  doc: 'Unique id used with the useUpload hook to manage the files. Needed when wanting to connect with the useUpload hook.',
@@ -45,6 +45,11 @@ const UploadProperties = exports.UploadProperties = {
45
45
  type: 'boolean',
46
46
  status: 'optional'
47
47
  },
48
+ disableDragAndDrop: {
49
+ doc: 'Disables file drag and drop, by removing the drop zone. Defaults to `false`.',
50
+ type: 'boolean',
51
+ status: 'optional'
52
+ },
48
53
  skeleton: {
49
54
  doc: 'Skeleton should be applied when loading content.',
50
55
  type: 'boolean',
@@ -85,4 +90,41 @@ const UploadEvents = exports.UploadEvents = {
85
90
  status: 'optional'
86
91
  }
87
92
  };
93
+ const FileItemProperties = exports.FileItemProperties = {
94
+ file: {
95
+ doc: 'The file object. This is the same object as the one returned by the `File` API.',
96
+ type: 'File',
97
+ status: 'required'
98
+ },
99
+ id: {
100
+ doc: 'Unique ID for the file item. This ID is generated by the component and is not user-defined.',
101
+ type: 'string',
102
+ status: 'required'
103
+ },
104
+ exists: {
105
+ doc: 'Indicates if the file item already exists in the list of files. This is useful for distinguishing between new and existing files.',
106
+ type: 'boolean',
107
+ status: 'optional'
108
+ },
109
+ isLoading: {
110
+ doc: 'Indicates if the file item is currently being loaded. This is useful for showing a loading state while the file is being processed.',
111
+ type: 'boolean',
112
+ status: 'optional'
113
+ },
114
+ errorMessage: {
115
+ doc: 'Provide an error message to be displayed. This is useful for indicating issues with the file upload process.',
116
+ type: 'React.ReactNode',
117
+ status: 'optional'
118
+ },
119
+ description: {
120
+ doc: 'Provide a description to be displayed. This is useful for providing additional information about the file.',
121
+ type: 'React.ReactNode',
122
+ status: 'optional'
123
+ },
124
+ removeDeleteButton: {
125
+ doc: 'Set to `true` to remove the delete button from the file item. This is useful for preventing users from deleting files.',
126
+ type: 'boolean',
127
+ status: 'optional'
128
+ }
129
+ };
88
130
  //# sourceMappingURL=UploadDocs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UploadDocs.js","names":["UploadProperties","exports","id","doc","type","status","acceptedFileTypes","filesAmountLimit","fileMaxSize","title","text","download","allowDuplicates","skeleton","AcceptedFileTypeProperties","fileType","UploadEvents","onChange","onFileDelete","onFileClick"],"sources":["../../../../src/components/upload/UploadDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../shared/types'\n\nexport const UploadProperties: PropertiesTableProps = {\n id: {\n doc: 'Unique id used with the useUpload hook to manage the files. Needed when wanting to connect with the useUpload hook.',\n type: ['string', 'Function', 'Object', 'React.Context'],\n status: 'optional',\n },\n acceptedFileTypes: {\n doc: 'List of accepted file types. Either as string or [AcceptedFileType](/uilib/components/upload/properties/#acceptedfiletype). When providing a list of [AcceptedFileType](/uilib/components/upload/properties/#acceptedfiletype), the accepted file types will be presented in a table(see [example](/uilib/components/upload/demos/#upload-with-file-max-size-based-on-file-type)).',\n type: ['Array<string>', 'Array<AcceptedFileType>'],\n status: 'required',\n },\n filesAmountLimit: {\n doc: 'Defines the amount of files the user can select and upload. Defaults to 100.',\n type: 'number',\n status: 'optional',\n },\n fileMaxSize: {\n doc: 'Defines the max file size of each file in MB. Use either `0` or `false` to disable. Defaults to 5 MB.',\n type: ['number', 'false'],\n status: 'optional',\n },\n title: {\n doc: 'Custom text property. Replaces the default title. Can be disabled using `false`.',\n type: 'string',\n status: 'optional',\n },\n text: {\n doc: 'Custom text property. Replaces the default text. Can be disabled using `false`.',\n type: 'string',\n status: 'optional',\n },\n download: {\n doc: 'Causes the browser to treat all listed files as downloadable instead of opening them in a new browser tab or window. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n allowDuplicates: {\n doc: 'Allows uploading of duplicate files. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n skeleton: {\n doc: 'Skeleton should be applied when loading content.',\n type: 'boolean',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n\nexport const AcceptedFileTypeProperties: PropertiesTableProps = {\n fileType: {\n doc: 'The name of the accepted file type.',\n type: 'string',\n status: 'required',\n },\n fileMaxSize: {\n doc: 'Defines the max file size of the given file type in MB. Use either `0` or `false` to disable. If not provided, it defaults to the value of [Uploads](/uilib/components/upload/properties/#properties) `fileMaxSize` which defaults to 5 MB.',\n type: ['number', 'false'],\n status: 'optional',\n },\n}\n\nexport const UploadEvents: PropertiesTableProps = {\n onChange: {\n doc: 'Will be called on `files` changes made by the user. Access the files with `{ files }` (containing each a `fileItem`).',\n type: 'function',\n status: 'optional',\n },\n onFileDelete: {\n doc: 'Will be called once a file gets deleted by the user. Access the deleted file with `{ fileItem }`.',\n type: 'function',\n status: 'optional',\n },\n onFileClick: {\n doc: 'Will be called once a file gets clicked on by the user. Access the clicked file with `{ fileItem }`.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AAEO,MAAMA,gBAAsC,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EACpDE,EAAE,EAAE;IACFC,GAAG,EAAE,qHAAqH;IAC1HC,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,CAAC;IACvDC,MAAM,EAAE;EACV,CAAC;EACDC,iBAAiB,EAAE;IACjBH,GAAG,EAAE,oXAAoX;IACzXC,IAAI,EAAE,CAAC,eAAe,EAAE,yBAAyB,CAAC;IAClDC,MAAM,EAAE;EACV,CAAC;EACDE,gBAAgB,EAAE;IAChBJ,GAAG,EAAE,8EAA8E;IACnFC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDG,WAAW,EAAE;IACXL,GAAG,EAAE,uGAAuG;IAC5GC,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;IACzBC,MAAM,EAAE;EACV,CAAC;EACDI,KAAK,EAAE;IACLN,GAAG,EAAE,kFAAkF;IACvFC,IAAI,EAAE,QAAQ;IAC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 {"version":3,"file":"UploadDocs.js","names":["UploadProperties","exports","id","doc","type","status","acceptedFileTypes","filesAmountLimit","fileMaxSize","title","text","download","allowDuplicates","disableDragAndDrop","skeleton","AcceptedFileTypeProperties","fileType","UploadEvents","onChange","onFileDelete","onFileClick","FileItemProperties","file","exists","isLoading","errorMessage","description","removeDeleteButton"],"sources":["../../../../src/components/upload/UploadDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../shared/types'\n\nexport const UploadProperties: PropertiesTableProps = {\n id: {\n doc: 'Unique id used with the useUpload hook to manage the files. Needed when wanting to connect with the useUpload hook.',\n type: ['string', 'Function', 'Object', 'React.Context'],\n status: 'optional',\n },\n acceptedFileTypes: {\n doc: 'List of accepted file types. Either as string or [AcceptedFileType](/uilib/components/upload/properties/#acceptedfiletype). When providing a list of [AcceptedFileType](/uilib/components/upload/properties/#acceptedfiletype), the accepted file types will be presented in a table(see [example](/uilib/components/upload/demos/#upload-with-file-max-size-based-on-file-type)).',\n type: ['Array<string>', 'Array<AcceptedFileType>'],\n status: 'required',\n },\n filesAmountLimit: {\n doc: 'Defines the amount of files the user can select and upload. Defaults to 100.',\n type: 'number',\n status: 'optional',\n },\n fileMaxSize: {\n doc: 'Defines the max file size of each file in MB. Use either `0` or `false` to disable. Defaults to 5 MB.',\n type: ['number', 'false'],\n status: 'optional',\n },\n title: {\n doc: 'Custom text property. Replaces the default title. Can be disabled using `false`.',\n type: 'string',\n status: 'optional',\n },\n text: {\n doc: 'Custom text property. Replaces the default text. Can be disabled using `false`.',\n type: 'string',\n status: 'optional',\n },\n download: {\n doc: 'Causes the browser to treat all listed files as downloadable instead of opening them in a new browser tab or window. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n allowDuplicates: {\n doc: 'Allows uploading of duplicate files. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n disableDragAndDrop: {\n doc: 'Disables file drag and drop, by removing the drop zone. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n skeleton: {\n doc: 'Skeleton should be applied when loading content.',\n type: 'boolean',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n\nexport const AcceptedFileTypeProperties: PropertiesTableProps = {\n fileType: {\n doc: 'The name of the accepted file type.',\n type: 'string',\n status: 'required',\n },\n fileMaxSize: {\n doc: 'Defines the max file size of the given file type in MB. Use either `0` or `false` to disable. If not provided, it defaults to the value of [Uploads](/uilib/components/upload/properties/#properties) `fileMaxSize` which defaults to 5 MB.',\n type: ['number', 'false'],\n status: 'optional',\n },\n}\n\nexport const UploadEvents: PropertiesTableProps = {\n onChange: {\n doc: 'Will be called on `files` changes made by the user. Access the files with `{ files }` (containing each a `fileItem`).',\n type: 'function',\n status: 'optional',\n },\n onFileDelete: {\n doc: 'Will be called once a file gets deleted by the user. Access the deleted file with `{ fileItem }`.',\n type: 'function',\n status: 'optional',\n },\n onFileClick: {\n doc: 'Will be called once a file gets clicked on by the user. Access the clicked file with `{ fileItem }`.',\n type: 'function',\n status: 'optional',\n },\n}\n\nexport const FileItemProperties: PropertiesTableProps = {\n file: {\n doc: 'The file object. This is the same object as the one returned by the `File` API.',\n type: 'File',\n status: 'required',\n },\n id: {\n doc: 'Unique ID for the file item. This ID is generated by the component and is not user-defined.',\n type: 'string',\n status: 'required',\n },\n exists: {\n doc: 'Indicates if the file item already exists in the list of files. This is useful for distinguishing between new and existing files.',\n type: 'boolean',\n status: 'optional',\n },\n isLoading: {\n doc: 'Indicates if the file item is currently being loaded. This is useful for showing a loading state while the file is being processed.',\n type: 'boolean',\n status: 'optional',\n },\n errorMessage: {\n doc: 'Provide an error message to be displayed. This is useful for indicating issues with the file upload process.',\n type: 'React.ReactNode',\n status: 'optional',\n },\n description: {\n doc: 'Provide a description to be displayed. This is useful for providing additional information about the file.',\n type: 'React.ReactNode',\n status: 'optional',\n },\n removeDeleteButton: {\n doc: 'Set to `true` to remove the delete button from the file item. This is useful for preventing users from deleting files.',\n type: 'boolean',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AAEO,MAAMA,gBAAsC,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EACpDE,EAAE,EAAE;IACFC,GAAG,EAAE,qHAAqH;IAC1HC,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,CAAC;IACvDC,MAAM,EAAE;EACV,CAAC;EACDC,iBAAiB,EAAE;IACjBH,GAAG,EAAE,oXAAoX;IACzXC,IAAI,EAAE,CAAC,eAAe,EAAE,yBAAyB,CAAC;IAClDC,MAAM,EAAE;EACV,CAAC;EACDE,gBAAgB,EAAE;IAChBJ,GAAG,EAAE,8EAA8E;IACnFC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDG,WAAW,EAAE;IACXL,GAAG,EAAE,uGAAuG;IAC5GC,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;IACzBC,MAAM,EAAE;EACV,CAAC;EACDI,KAAK,EAAE;IACLN,GAAG,EAAE,kFAAkF;IACvFC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDK,IAAI,EAAE;IACJP,GAAG,EAAE,iFAAiF;IACtFC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDM,QAAQ,EAAE;IACRR,GAAG,EAAE,2IAA2I;IAChJC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDO,eAAe,EAAE;IACfT,GAAG,EAAE,2DAA2D;IAChEC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDQ,kBAAkB,EAAE;IAClBV,GAAG,EAAE,8EAA8E;IACnFC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDS,QAAQ,EAAE;IACRX,GAAG,EAAE,kDAAkD;IACvDC,IAAI,EAAE,SAAS;IACfC,MAAM,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AAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDoB,YAAY,EAAE;IACZtB,GAAG,EAAE,8GAA8G;IACnHC,IAAI,EAAE,iBAAiB;IACvBC,MAAM,EAAE;EACV,CAAC;EACDqB,WAAW,EAAE;IACXvB,GAAG,EAAE,4GAA4G;IACjHC,IAAI,EAAE,iBAAiB;IACvBC,MAAM,EAAE;EACV,CAAC;EACDsB,kBAAkB,EAAE;IAClBxB,GAAG,EAAE,wHAAwH;IAC7HC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
@@ -16,6 +16,7 @@ var _Button = _interopRequireDefault(require("../button/Button"));
16
16
  var _Icon2 = _interopRequireDefault(require("../../components/Icon"));
17
17
  var _FormStatus2 = _interopRequireDefault(require("../../components/FormStatus"));
18
18
  var _progressIndicator = _interopRequireDefault(require("../../components/progress-indicator"));
19
+ var _P2 = _interopRequireDefault(require("../../elements/P"));
19
20
  var _icons = require("../../icons");
20
21
  var _componentHelper = require("../../shared/component-helper");
21
22
  var _useUpload = _interopRequireWildcard(require("./useUpload"));
@@ -40,7 +41,7 @@ const fileExtensionImages = exports.fileExtensionImages = {
40
41
  file: _icons.file_medium
41
42
  };
42
43
  const UploadFileListCell = _ref => {
43
- var _div, _FormStatus;
44
+ var _div, _div2, _P, _FormStatus;
44
45
  let {
45
46
  id,
46
47
  uploadFile,
@@ -54,7 +55,9 @@ const UploadFileListCell = _ref => {
54
55
  const {
55
56
  file,
56
57
  errorMessage,
57
- isLoading
58
+ isLoading,
59
+ description,
60
+ removeDeleteButton
58
61
  } = uploadFile;
59
62
  const hasWarning = errorMessage != null;
60
63
  const imageUrl = (file === null || file === void 0 ? void 0 : file.size) > 0 ? URL.createObjectURL(file) : null;
@@ -82,13 +85,7 @@ const UploadFileListCell = _ref => {
82
85
  className: "dnb-upload__file-cell__content__left"
83
86
  }, getFileIcon(file, {
84
87
  isLoading
85
- }, hasWarning), getTitle()), _react.default.createElement("div", null, _react.default.createElement(_Button.default, {
86
- icon: _icons.trash,
87
- variant: "tertiary",
88
- onClick: onDeleteHandler,
89
- icon_position: "left",
90
- disabled: isLoading
91
- }, deleteButtonText))), getWarning());
88
+ }, hasWarning), getTitle()), getDeleteButton()), getWarning());
92
89
  function getTitle() {
93
90
  return isLoading ? _div || (_div = _react.default.createElement("div", {
94
91
  className: "dnb-upload__file-cell__text-container dnb-upload__file-cell__text-container--loading"
@@ -100,14 +97,37 @@ const UploadFileListCell = _ref => {
100
97
  download: download,
101
98
  onClick: onClick,
102
99
  bottom: 0
103
- }));
100
+ }), getDescription());
101
+ }
102
+ function getDeleteButton() {
103
+ if (removeDeleteButton) {
104
+ return null;
105
+ }
106
+ return _div2 || (_div2 = _react.default.createElement("div", null, _react.default.createElement(_Button.default, {
107
+ icon: _icons.trash,
108
+ variant: "tertiary",
109
+ onClick: onDeleteHandler,
110
+ icon_position: "left",
111
+ disabled: isLoading
112
+ }, deleteButtonText)));
113
+ }
114
+ function getDescription() {
115
+ if (!description) {
116
+ return null;
117
+ }
118
+ return _P || (_P = _react.default.createElement(_P2.default, {
119
+ className: "dnb-upload__text"
120
+ }, description));
104
121
  }
105
122
  function getWarning() {
106
- return hasWarning ? _FormStatus || (_FormStatus = _react.default.createElement(_FormStatus2.default, {
123
+ if (!hasWarning) {
124
+ return null;
125
+ }
126
+ return _FormStatus || (_FormStatus = _react.default.createElement(_FormStatus2.default, {
107
127
  top: "small",
108
128
  text: errorMessage,
109
129
  stretch: true
110
- })) : null;
130
+ }));
111
131
  }
112
132
  };
113
133
  var _default = exports.default = UploadFileListCell;
@@ -1 +1 @@
1
- {"version":3,"file":"UploadFileListCell.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Button","_Icon2","_FormStatus2","_progressIndicator","_icons","_componentHelper","_useUpload","_UploadVerify","_UploadFileListLink","_Icon","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","fileExtensionImages","exports","png","jpg","pdf","doc","docx","odt","xls","ppt","csv","txt","xml","file","UploadFileListCell","_ref","_div","_FormStatus","id","uploadFile","onDelete","onClick","loadingText","deleteButtonText","download","allowDuplicates","errorMessage","isLoading","hasWarning","imageUrl","size","URL","createObjectURL","cellRef","useRef","exists","useExistsHighlight","isDuplicate","handleDisappearFocus","useCallback","_getPreviousSibling","cellElement","current","focusElement","getPreviousSibling","querySelector","focus","preventScroll","onDeleteHandler","createElement","className","classnames","ref","getFileIcon","getTitle","icon","TrashIcon","variant","icon_position","disabled","getWarning","text","name","href","bottom","top","stretch","_default","internalFiles","useUpload","updateExists","React","useState","timerRef","clearTimers","clearTimeout","useEffect","some","_ref2","f","isFileEqual","setTimeout","loading","_loading$size","ExclamationIcon","iconFileType","getFileTypeFromExtension","mimeParts","type","split","prototype"],"sources":["../../../../src/components/upload/UploadFileListCell.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react'\nimport classnames from 'classnames'\n\n// Components\nimport Button from '../button/Button'\nimport Icon from '../../components/Icon'\nimport FormStatus from '../../components/FormStatus'\nimport ProgressIndicator from '../../components/progress-indicator'\n\n// Icons\nimport {\n trash as TrashIcon,\n exclamation_medium as ExclamationIcon,\n file_png_medium as png,\n file_jpg_medium as jpg,\n file_word_medium as doc,\n file_pdf_medium as pdf,\n file_xls_medium as xls,\n file_ppt_medium as ppt,\n file_csv_medium as csv,\n file_txt_medium as txt,\n file_xml_medium as xml,\n file_medium as file,\n} from '../../icons'\nimport { UploadFile, UploadFileNative } from './types'\n\n// Shared\nimport { getPreviousSibling } from '../../shared/component-helper'\nimport useUpload, { isFileEqual } from './useUpload'\nimport { getFileTypeFromExtension } from './UploadVerify'\nimport UploadFileLink from './UploadFileListLink'\nimport { ProgressIndicatorAllProps } from '../progress-indicator/types'\n\n// Will be deprecated - and then default to only showing the file icon,\n// and not file icon per file extension type\nexport const fileExtensionImages = {\n png,\n jpg,\n pdf,\n doc,\n docx: doc,\n odt: doc,\n xls,\n ppt,\n csv,\n txt,\n xml,\n file,\n}\n\nexport type UploadFileListCellProps = {\n id: string\n\n /**\n * Uploaded file\n */\n uploadFile: UploadFile | UploadFileNative\n\n /**\n * Calls onDelete when clicking the delete button\n */\n onDelete: () => void\n\n /**\n * Calls onClick when clicking the file name\n */\n onClick?: () => void\n\n /**\n * Causes the browser to treat all listed files as downloadable instead of opening them in a new browser tab or window.\n * Default: false\n */\n download?: boolean\n\n /**\n * Allows uploading of duplicate files.\n * Default: false\n */\n allowDuplicates?: boolean\n\n /**\n * Text\n */\n loadingText: React.ReactNode\n deleteButtonText: React.ReactNode\n}\n\nconst UploadFileListCell = ({\n id,\n uploadFile,\n onDelete,\n onClick,\n loadingText,\n deleteButtonText,\n download,\n allowDuplicates,\n}: UploadFileListCellProps) => {\n const { file, errorMessage, isLoading } = uploadFile\n const hasWarning = errorMessage != null\n\n const imageUrl = file?.size > 0 ? URL.createObjectURL(file) : null\n const cellRef = useRef<HTMLLIElement>()\n const exists = useExistsHighlight(id, file)\n const isDuplicate = !allowDuplicates && exists\n\n const handleDisappearFocus = useCallback(() => {\n const cellElement = cellRef.current\n const focusElement = getPreviousSibling(\n '.dnb-upload',\n cellElement\n )?.querySelector('.dnb-upload__file-input-button') as HTMLButtonElement\n focusElement?.focus({ preventScroll: true })\n }, [cellRef])\n\n const onDeleteHandler = useCallback(() => {\n handleDisappearFocus()\n\n onDelete()\n }, [handleDisappearFocus, onDelete])\n\n return (\n <li\n className={classnames(\n 'dnb-upload__file-cell',\n hasWarning && 'dnb-upload__file-cell--warning',\n isDuplicate && 'dnb-upload__file-cell--highlight'\n )}\n ref={cellRef}\n >\n <div className=\"dnb-upload__file-cell__content\">\n <div className=\"dnb-upload__file-cell__content__left\">\n {getFileIcon(file, { isLoading }, hasWarning)}\n {getTitle()}\n </div>\n <div>\n <Button\n icon={TrashIcon}\n variant=\"tertiary\"\n onClick={onDeleteHandler}\n icon_position=\"left\"\n disabled={isLoading}\n >\n {deleteButtonText}\n </Button>\n </div>\n </div>\n\n {getWarning()}\n </li>\n )\n\n function getTitle() {\n return isLoading ? (\n <div\n className={classnames(\n 'dnb-upload__file-cell__text-container',\n 'dnb-upload__file-cell__text-container--loading'\n )}\n >\n {loadingText}\n </div>\n ) : (\n <div className=\"dnb-upload__file-cell__text-container\">\n <UploadFileLink\n text={file.name}\n href={imageUrl}\n download={download}\n onClick={onClick}\n bottom={0}\n />\n </div>\n )\n }\n\n function getWarning() {\n return hasWarning ? (\n <FormStatus top=\"small\" text={errorMessage} stretch />\n ) : null\n }\n}\n\nexport default UploadFileListCell\n\nfunction useExistsHighlight(id: string, file: File) {\n const { internalFiles } = useUpload(id)\n const [exists, updateExists] = React.useState(false)\n const timerRef = React.useRef<NodeJS.Timer>()\n\n const clearTimers = () => {\n clearTimeout(timerRef.current)\n }\n\n React.useEffect(() => {\n const exists = internalFiles.some(({ exists, file: f }) => {\n return exists && isFileEqual(file, f)\n })\n\n if (exists) {\n updateExists(true)\n clearTimers()\n timerRef.current = setTimeout(() => updateExists(false), 1500) // transition-duration in CSS\n }\n\n return clearTimers\n }, [file, internalFiles])\n\n return exists\n}\n\nexport function getFileIcon(\n file: File,\n loading?: {\n isLoading: UploadFile['isLoading']\n size?: ProgressIndicatorAllProps['size']\n },\n hasWarning?: boolean\n) {\n if (loading?.isLoading) {\n return <ProgressIndicator size={loading?.size ?? 'default'} />\n }\n\n if (hasWarning) return <Icon icon={ExclamationIcon} />\n\n let iconFileType = getFileTypeFromExtension(file)\n\n if (!iconFileType) {\n const mimeParts = file.type.split('/')\n iconFileType =\n fileExtensionImages[mimeParts[0]] ||\n fileExtensionImages[mimeParts[1]]\n }\n\n if (\n !Object.prototype.hasOwnProperty.call(\n fileExtensionImages,\n iconFileType\n )\n ) {\n iconFileType = 'file'\n }\n\n return <Icon icon={fileExtensionImages[iconFileType]} />\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CA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AAiB,OAAA,CAAAmE,aAAA,CAAC9E,MAAA,CAAAW,OAAI;IAACyE,IAAI,EAAE6B;EAAgB,CAAE,CAAC;EAEtD,IAAIC,YAAY,GAAG,IAAAC,sCAAwB,EAACzE,IAAI,CAAC;EAEjD,IAAI,CAACwE,YAAY,EAAE;IACjB,MAAME,SAAS,GAAG1E,IAAI,CAAC2E,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtCJ,YAAY,GACVrF,mBAAmB,CAACuF,SAAS,CAAC,CAAC,CAAC,CAAC,IACjCvF,mBAAmB,CAACuF,SAAS,CAAC,CAAC,CAAC,CAAC;EACrC;EAEA,IACE,CAAC/F,MAAM,CAACkG,SAAS,CAAC9F,cAAc,CAACC,IAAI,CACnCG,mBAAmB,EACnBqF,YACF,CAAC,EACD;IACAA,YAAY,GAAG,MAAM;EACvB;EAEA,OAAOxH,MAAA,CAAAiB,OAAA,CAAAmE,aAAA,CAAC9E,MAAA,CAAAW,OAAI;IAACyE,IAAI,EAAEvD,mBAAmB,CAACqF,YAAY;EAAE,CAAE,CAAC;AAC1D","ignoreList":[]}
1
+ {"version":3,"file":"UploadFileListCell.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Button","_Icon2","_FormStatus2","_progressIndicator","_P2","_icons","_componentHelper","_useUpload","_UploadVerify","_UploadFileListLink","_Icon","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","fileExtensionImages","exports","png","jpg","pdf","doc","docx","odt","xls","ppt","csv","txt","xml","file","UploadFileListCell","_ref","_div","_div2","_P","_FormStatus","id","uploadFile","onDelete","onClick","loadingText","deleteButtonText","download","allowDuplicates","errorMessage","isLoading","description","removeDeleteButton","hasWarning","imageUrl","size","URL","createObjectURL","cellRef","useRef","exists","useExistsHighlight","isDuplicate","handleDisappearFocus","useCallback","_getPreviousSibling","cellElement","current","focusElement","getPreviousSibling","querySelector","focus","preventScroll","onDeleteHandler","createElement","className","classnames","ref","getFileIcon","getTitle","getDeleteButton","getWarning","text","name","href","bottom","getDescription","icon","TrashIcon","variant","icon_position","disabled","top","stretch","_default","internalFiles","useUpload","updateExists","React","useState","timerRef","clearTimers","clearTimeout","useEffect","some","_ref2","f","isFileEqual","setTimeout","loading","_loading$size","ExclamationIcon","iconFileType","getFileTypeFromExtension","mimeParts","type","split","prototype"],"sources":["../../../../src/components/upload/UploadFileListCell.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react'\nimport classnames from 'classnames'\n\n// Components\nimport Button from '../button/Button'\nimport Icon from '../../components/Icon'\nimport FormStatus from '../../components/FormStatus'\nimport ProgressIndicator from '../../components/progress-indicator'\n\n// Elements\nimport P from '../../elements/P'\n\n// Icons\nimport {\n trash as TrashIcon,\n exclamation_medium as ExclamationIcon,\n file_png_medium as png,\n file_jpg_medium as jpg,\n file_word_medium as doc,\n file_pdf_medium as pdf,\n file_xls_medium as xls,\n file_ppt_medium as ppt,\n file_csv_medium as csv,\n file_txt_medium as txt,\n file_xml_medium as xml,\n file_medium as file,\n} from '../../icons'\nimport { UploadFile, UploadFileNative } from './types'\n\n// Shared\nimport { getPreviousSibling } from '../../shared/component-helper'\nimport useUpload, { isFileEqual } from './useUpload'\nimport { getFileTypeFromExtension } from './UploadVerify'\nimport UploadFileLink from './UploadFileListLink'\nimport { ProgressIndicatorAllProps } from '../progress-indicator/types'\n\n// Will be deprecated - and then default to only showing the file icon,\n// and not file icon per file extension type\nexport const fileExtensionImages = {\n png,\n jpg,\n pdf,\n doc,\n docx: doc,\n odt: doc,\n xls,\n ppt,\n csv,\n txt,\n xml,\n file,\n}\n\nexport type UploadFileListCellProps = {\n id: string\n\n /**\n * Uploaded file\n */\n uploadFile: UploadFile | UploadFileNative\n\n /**\n * Calls onDelete when clicking the delete button\n */\n onDelete: () => void\n\n /**\n * Calls onClick when clicking the file name\n */\n onClick?: () => void\n\n /**\n * Causes the browser to treat all listed files as downloadable instead of opening them in a new browser tab or window.\n * Default: false\n */\n download?: boolean\n\n /**\n * Allows uploading of duplicate files.\n * Default: false\n */\n allowDuplicates?: boolean\n\n /**\n * Text\n */\n loadingText: React.ReactNode\n deleteButtonText: React.ReactNode\n}\n\nconst UploadFileListCell = ({\n id,\n uploadFile,\n onDelete,\n onClick,\n loadingText,\n deleteButtonText,\n download,\n allowDuplicates,\n}: UploadFileListCellProps) => {\n const {\n file,\n errorMessage,\n isLoading,\n description,\n removeDeleteButton,\n } = uploadFile\n const hasWarning = errorMessage != null\n\n const imageUrl = file?.size > 0 ? URL.createObjectURL(file) : null\n const cellRef = useRef<HTMLLIElement>()\n const exists = useExistsHighlight(id, file)\n const isDuplicate = !allowDuplicates && exists\n\n const handleDisappearFocus = useCallback(() => {\n const cellElement = cellRef.current\n const focusElement = getPreviousSibling(\n '.dnb-upload',\n cellElement\n )?.querySelector('.dnb-upload__file-input-button') as HTMLButtonElement\n focusElement?.focus({ preventScroll: true })\n }, [cellRef])\n\n const onDeleteHandler = useCallback(() => {\n handleDisappearFocus()\n\n onDelete()\n }, [handleDisappearFocus, onDelete])\n\n return (\n <li\n className={classnames(\n 'dnb-upload__file-cell',\n hasWarning && 'dnb-upload__file-cell--warning',\n isDuplicate && 'dnb-upload__file-cell--highlight'\n )}\n ref={cellRef}\n >\n <div className=\"dnb-upload__file-cell__content\">\n <div className=\"dnb-upload__file-cell__content__left\">\n {getFileIcon(file, { isLoading }, hasWarning)}\n {getTitle()}\n </div>\n {getDeleteButton()}\n </div>\n {getWarning()}\n </li>\n )\n\n function getTitle() {\n return isLoading ? (\n <div\n className={classnames(\n 'dnb-upload__file-cell__text-container',\n 'dnb-upload__file-cell__text-container--loading'\n )}\n >\n {loadingText}\n </div>\n ) : (\n <div className=\"dnb-upload__file-cell__text-container\">\n <UploadFileLink\n text={file.name}\n href={imageUrl}\n download={download}\n onClick={onClick}\n bottom={0}\n />\n {getDescription()}\n </div>\n )\n }\n\n function getDeleteButton() {\n if (removeDeleteButton) {\n return null\n }\n return (\n <div>\n <Button\n icon={TrashIcon}\n variant=\"tertiary\"\n onClick={onDeleteHandler}\n icon_position=\"left\"\n disabled={isLoading}\n >\n {deleteButtonText}\n </Button>\n </div>\n )\n }\n\n function getDescription() {\n if (!description) {\n return null\n }\n return <P className=\"dnb-upload__text\">{description}</P>\n }\n\n function getWarning() {\n if (!hasWarning) {\n return null\n }\n return <FormStatus top=\"small\" text={errorMessage} stretch />\n }\n}\n\nexport default UploadFileListCell\n\nfunction useExistsHighlight(id: string, file: File) {\n const { internalFiles } = useUpload(id)\n const [exists, updateExists] = React.useState(false)\n const timerRef = React.useRef<NodeJS.Timer>()\n\n const clearTimers = () => {\n clearTimeout(timerRef.current)\n }\n\n React.useEffect(() => {\n const exists = internalFiles.some(({ exists, file: f }) => {\n return exists && isFileEqual(file, f)\n })\n\n if (exists) {\n updateExists(true)\n clearTimers()\n timerRef.current = setTimeout(() => updateExists(false), 1500) // transition-duration in CSS\n }\n\n return clearTimers\n }, [file, internalFiles])\n\n return exists\n}\n\nexport function getFileIcon(\n file: File,\n loading?: {\n isLoading: UploadFile['isLoading']\n size?: ProgressIndicatorAllProps['size']\n },\n hasWarning?: boolean\n) {\n if (loading?.isLoading) {\n return <ProgressIndicator size={loading?.size ?? 'default'} />\n }\n\n if (hasWarning) return <Icon icon={ExclamationIcon} />\n\n let iconFileType = getFileTypeFromExtension(file)\n\n if (!iconFileType) {\n const mimeParts = file.type.split('/')\n iconFileType =\n fileExtensionImages[mimeParts[0]] ||\n fileExtensionImages[mimeParts[1]]\n }\n\n if (\n !Object.prototype.hasOwnProperty.call(\n fileExtensionImages,\n iconFileType\n )\n ) {\n iconFileType = 'file'\n }\n\n return <Icon icon={fileExtensionImages[iconFileType]} />\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,OAAA,G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,MAAM;AACf;AAEO,SAASkB,WAAWA,CACzB5C,IAAU,EACV2E,OAGC,EACDxD,UAAoB,EACpB;EACA,IAAIwD,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAE3D,SAAS,EAAE;IAAA,IAAA4D,aAAA;IACtB,OAAO7H,MAAA,CAAAkB,OAAA,CAAAuE,aAAA,CAACjF,kBAAA,CAAAU,OAAiB;MAACoD,IAAI,GAAAuD,aAAA,GAAED,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEtD,IAAI,cAAAuD,aAAA,cAAAA,aAAA,GAAI;IAAU,CAAE,CAAC;EAChE;EAEA,IAAIzD,UAAU,EAAE,OAAArD,KAAA,KAAAA,KAAA,GAAOf,MAAA,CAAAkB,OAAA,CAAAuE,aAAA,CAACnF,MAAA,CAAAY,OAAI;IAACoF,IAAI,EAAEwB;EAAgB,CAAE,CAAC;EAEtD,IAAIC,YAAY,GAAG,IAAAC,sCAAwB,EAAC/E,IAAI,CAAC;EAEjD,IAAI,CAAC8E,YAAY,EAAE;IACjB,MAAME,SAAS,GAAGhF,IAAI,CAACiF,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtCJ,YAAY,GACV3F,mBAAmB,CAAC6F,SAAS,CAAC,CAAC,CAAC,CAAC,IACjC7F,mBAAmB,CAAC6F,SAAS,CAAC,CAAC,CAAC,CAAC;EACrC;EAEA,IACE,CAACrG,MAAM,CAACwG,SAAS,CAACpG,cAAc,CAACC,IAAI,CACnCG,mBAAmB,EACnB2F,YACF,CAAC,EACD;IACAA,YAAY,GAAG,MAAM;EACvB;EAEA,OAAO/H,MAAA,CAAAkB,OAAA,CAAAuE,aAAA,CAACnF,MAAA,CAAAY,OAAI;IAACoF,IAAI,EAAElE,mBAAmB,CAAC2F,YAAY;EAAE,CAAE,CAAC;AAC1D","ignoreList":[]}
@@ -60,6 +60,11 @@ export type UploadProps = {
60
60
  * Default: false
61
61
  */
62
62
  allowDuplicates?: boolean;
63
+ /**
64
+ * Disables file drag and drop, by removing the drop zone.
65
+ * Default: false
66
+ */
67
+ disableDragAndDrop?: boolean;
63
68
  /**
64
69
  * Custom text properties
65
70
  */
@@ -90,5 +95,7 @@ export type UploadFile = {
90
95
  exists: boolean;
91
96
  isLoading?: boolean;
92
97
  errorMessage?: React.ReactNode;
98
+ description?: React.ReactNode;
99
+ removeDeleteButton?: boolean;
93
100
  };
94
101
  export type UploadFileNative = Omit<UploadFile, 'id' | 'exists'> & Partial<Pick<UploadFile, 'id' | 'exists'>>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/upload/types.ts"],"sourcesContent":["import React from 'react'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport type { LocaleProps, SpacingProps } from '../../shared/types'\nimport type { SharedStateId } from '../../shared/helpers/useSharedState'\n\nexport type UploadAcceptedFileTypes = string[]\n\nexport type UploadAcceptedFileTypesWithFileMaxSize =\n UploadAcceptedFileTypeObject[]\n\nexport type UploadAcceptedFileTypeObject = {\n fileType: string\n fileMaxSize?: number | false\n}\n\nexport type UploadProps = {\n /**\n * unique id used with the useUpload hook to manage the files\n */\n id?: SharedStateId\n\n /**\n * list of accepted file types.\n */\n acceptedFileTypes:\n | UploadAcceptedFileTypes\n | UploadAcceptedFileTypesWithFileMaxSize\n\n /**\n * Skeleton should be applied when loading content\n * Default: null\n */\n skeleton?: SkeletonShow\n\n /**\n * Defines the amount of files the user can select and upload\n * Default: 100\n */\n filesAmountLimit?: number\n\n /**\n * Defines the max file size of each file in MB. Use either `0` or `false` to disable.\n * Default: 5 MB\n */\n fileMaxSize?: number | false\n\n /**\n * will be called on `files` changes made by the user. Access the files with `{ files }`.\n */\n onChange?: ({ files }: { files: Array<UploadFile> }) => void\n\n /**\n * will be called once a file gets deleted by the user. Access the deleted file with `{ fileItem }`.\n */\n onFileDelete?: ({\n fileItem,\n }: {\n fileItem: UploadFile\n }) => void | Promise<void>\n\n /**\n * Will be called once a file gets clicked on by the user. Access the clicked file with `{ fileItem }`.\n */\n onFileClick?: ({\n fileItem,\n }: {\n fileItem: UploadFile\n }) => void | Promise<void>\n\n /**\n * Causes the browser to treat all listed files as downloadable instead of opening them in a new browser tab or window.\n * Default: false\n */\n download?: boolean\n\n /**\n * Allows uploading of duplicate files.\n * Default: false\n */\n allowDuplicates?: boolean\n\n /**\n * Custom text properties\n */\n title?: React.ReactNode\n text?: React.ReactNode\n fileTypeTableCaption?: React.ReactNode\n fileTypeDescription?: React.ReactNode\n fileSizeDescription?: React.ReactNode\n fileAmountDescription?: React.ReactNode\n fileSizeContent?: React.ReactNode\n buttonText?: React.ReactNode\n errorLargeFile?: React.ReactNode\n errorUnsupportedFile?: React.ReactNode\n errorAmountLimit?: React.ReactNode\n loadingText?: React.ReactNode\n deleteButton?: React.ReactNode\n fileListAriaLabel?: string\n children?: React.ReactNode\n}\n\nexport type UploadAllProps = UploadProps &\n SpacingProps &\n LocaleProps &\n Omit<React.HTMLProps<HTMLElement>, 'onChange' | 'title'>\n\nexport type UploadContextProps = {\n id?: string\n onInputUpload: (files: Array<UploadFileNative>) => void\n} & Partial<UploadAllProps>\n\nexport type UploadFile = {\n file: File\n id: string\n exists: boolean\n isLoading?: boolean\n errorMessage?: React.ReactNode\n}\n\nexport type UploadFileNative = Omit<UploadFile, 'id' | 'exists'> &\n Partial<Pick<UploadFile, 'id' | 'exists'>>\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/upload/types.ts"],"sourcesContent":["import React from 'react'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport type { LocaleProps, SpacingProps } from '../../shared/types'\nimport type { SharedStateId } from '../../shared/helpers/useSharedState'\n\nexport type UploadAcceptedFileTypes = string[]\n\nexport type UploadAcceptedFileTypesWithFileMaxSize =\n UploadAcceptedFileTypeObject[]\n\nexport type UploadAcceptedFileTypeObject = {\n fileType: string\n fileMaxSize?: number | false\n}\n\nexport type UploadProps = {\n /**\n * unique id used with the useUpload hook to manage the files\n */\n id?: SharedStateId\n\n /**\n * list of accepted file types.\n */\n acceptedFileTypes:\n | UploadAcceptedFileTypes\n | UploadAcceptedFileTypesWithFileMaxSize\n\n /**\n * Skeleton should be applied when loading content\n * Default: null\n */\n skeleton?: SkeletonShow\n\n /**\n * Defines the amount of files the user can select and upload\n * Default: 100\n */\n filesAmountLimit?: number\n\n /**\n * Defines the max file size of each file in MB. Use either `0` or `false` to disable.\n * Default: 5 MB\n */\n fileMaxSize?: number | false\n\n /**\n * will be called on `files` changes made by the user. Access the files with `{ files }`.\n */\n onChange?: ({ files }: { files: Array<UploadFile> }) => void\n\n /**\n * will be called once a file gets deleted by the user. Access the deleted file with `{ fileItem }`.\n */\n onFileDelete?: ({\n fileItem,\n }: {\n fileItem: UploadFile\n }) => void | Promise<void>\n\n /**\n * Will be called once a file gets clicked on by the user. Access the clicked file with `{ fileItem }`.\n */\n onFileClick?: ({\n fileItem,\n }: {\n fileItem: UploadFile\n }) => void | Promise<void>\n\n /**\n * Causes the browser to treat all listed files as downloadable instead of opening them in a new browser tab or window.\n * Default: false\n */\n download?: boolean\n\n /**\n * Allows uploading of duplicate files.\n * Default: false\n */\n allowDuplicates?: boolean\n\n /**\n * Disables file drag and drop, by removing the drop zone.\n * Default: false\n */\n disableDragAndDrop?: boolean\n\n /**\n * Custom text properties\n */\n title?: React.ReactNode\n text?: React.ReactNode\n fileTypeTableCaption?: React.ReactNode\n fileTypeDescription?: React.ReactNode\n fileSizeDescription?: React.ReactNode\n fileAmountDescription?: React.ReactNode\n fileSizeContent?: React.ReactNode\n buttonText?: React.ReactNode\n errorLargeFile?: React.ReactNode\n errorUnsupportedFile?: React.ReactNode\n errorAmountLimit?: React.ReactNode\n loadingText?: React.ReactNode\n deleteButton?: React.ReactNode\n fileListAriaLabel?: string\n children?: React.ReactNode\n}\n\nexport type UploadAllProps = UploadProps &\n SpacingProps &\n LocaleProps &\n Omit<React.HTMLProps<HTMLElement>, 'onChange' | 'title'>\n\nexport type UploadContextProps = {\n id?: string\n onInputUpload: (files: Array<UploadFileNative>) => void\n} & Partial<UploadAllProps>\n\nexport type UploadFile = {\n file: File\n id: string\n exists: boolean\n isLoading?: boolean\n errorMessage?: React.ReactNode\n description?: React.ReactNode\n removeDeleteButton?: boolean\n}\n\nexport type UploadFileNative = Omit<UploadFile, 'id' | 'exists'> &\n Partial<Pick<UploadFile, 'id' | 'exists'>>\n"],"mappings":"","ignoreList":[]}
@@ -26,7 +26,7 @@ const ProviderProperties = exports.ProviderProperties = {
26
26
  status: 'optional'
27
27
  },
28
28
  errorMessages: {
29
- doc: 'Object containing error messages by either type of JSON Pointer path and type.',
29
+ doc: 'Object containing error messages by either type of JSON Pointer path and type. The messages can be a React.ReactNode or a string.',
30
30
  type: 'object',
31
31
  status: 'optional'
32
32
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ProviderDocs.js","names":["ProviderProperties","exports","defaultData","doc","type","status","data","id","schema","errorMessages","minimumAsyncBehaviorTime","asyncSubmitTimeout","scrollTopOnSubmit","sessionStorageId","ajvInstance","transformIn","transformOut","globalStatusId","required","disabled","locale","countryCode","children","ProviderEvents","onChange","onPathChange","onSubmit","onSubmitRequest","onSubmitComplete","onClear"],"sources":["../../../../../../src/extensions/forms/DataContext/Provider/ProviderDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const ProviderProperties: PropertiesTableProps = {\n defaultData: {\n doc: 'Default source data, only used if no other source is available, and not leading to updates if changed after mount.',\n type: 'object',\n status: 'optional',\n },\n data: {\n doc: 'Dynamic source data used as both initial data, and updates internal data if changed after mount.',\n type: 'object',\n status: 'optional',\n },\n id: {\n doc: 'Unique id for connecting Form.Handler and helper tools such as Form.useData.',\n type: ['string', 'Function', 'Object', 'React.Context'],\n status: 'optional',\n },\n schema: {\n doc: 'JSON Schema for validation of the data set.',\n type: 'object',\n status: 'optional',\n },\n errorMessages: {\n doc: 'Object containing error messages by either type of JSON Pointer path and type.',\n type: 'object',\n status: 'optional',\n },\n minimumAsyncBehaviorTime: {\n doc: 'Minimum time to display the submit indicator. Default is 1s.',\n type: 'boolean',\n status: 'optional',\n },\n asyncSubmitTimeout: {\n doc: 'The maximum time to display the submit indicator before it changes back to normal. In case something went wrong during submission. Default is 30s.',\n type: 'boolean',\n status: 'optional',\n },\n scrollTopOnSubmit: {\n doc: 'True for the UI to scroll to the top of the page when data is submitted.',\n type: 'boolean',\n status: 'optional',\n },\n sessionStorageId: {\n doc: 'Key for saving active data to session storage and loading it on mount.',\n type: 'string',\n status: 'optional',\n },\n ajvInstance: {\n doc: 'Provide your own custom Ajv instance. More info in the [Schema validation](/uilib/extensions/forms/Form/schema-validation/#custom-ajv-instance-and-keywords) section.',\n type: 'ajv',\n status: 'optional',\n },\n transformIn: {\n doc: \"Mutate the data context (internally as well) based on your criteria: `({ path, value, data, props, internal }) => 'new value'`. It will iterate on each data entry (/path).\",\n type: 'function',\n status: 'optional',\n },\n transformOut: {\n doc: \"Mutate the data before it enters onSubmit or onChange based on your criteria: `({ path, value, data, props, internal }) => 'new value'`. It will iterate on each data entry (/path).\",\n type: 'function',\n status: 'optional',\n },\n globalStatusId: {\n doc: 'If needed, you can define a custom [GlobalStatus](/uilib/components/global-status) id. Defaults to `main`.',\n type: 'string',\n status: 'optional',\n },\n required: {\n doc: 'Make all fields required.',\n type: 'boolean',\n status: 'optional',\n },\n disabled: {\n doc: 'Disable all fields.',\n type: 'boolean',\n status: 'optional',\n },\n locale: {\n doc: 'Locale (language) to use for all nested Eufemia components.',\n type: 'string',\n status: 'optional',\n },\n countryCode: {\n doc: 'Will change the country code for fields supporting `countryCode`. You can also set a path as the value, e.g. `/myCountryCodePath`.',\n type: ['ISO 3166-1 alpha-2', 'Path/JSON Pointer'],\n status: 'optional',\n },\n children: {\n doc: 'Contents.',\n type: 'React.Node',\n status: 'required',\n },\n}\n\nexport const ProviderEvents: PropertiesTableProps = {\n onChange: {\n doc: \"Will be called when a value of a field was changed by the user, with the data set (including the changed value) as argument. When an async function is provided, it will show an indicator on the current label during a field change. Related props: `minimumAsyncBehaviorTime` and `asyncSubmitTimeout`. You can return an error or an object with these keys `{ info: 'Info message', warning: 'Warning message', error: Error('My error') } as const` in addition to { success: 'saved' } indicate the field was saved. Will emit unvalidated by default and validated when an async function is provided (like `onSubmit`). The second parameter is an object containing the `filterData`, `resetForm` and `clearData` functions.\",\n type: 'function',\n status: 'optional',\n },\n onPathChange: {\n doc: 'Will be called when a value of a field was changed by the user, with the `path` (JSON Pointer) and new `value` as arguments. Can be an async function. Will emit unvalidated by default and validated when `onChange` is an async function.',\n type: 'function',\n status: 'optional',\n },\n onSubmit: {\n doc: \"Will be called (on validation success) when the user submit the form (i.e by clicking a [SubmitButton](/uilib/extensions/forms/Form/SubmitButton) component inside), with the data set as argument. When an async function is provided, it will show an indicator on the submit button during the form submission. All form elements will be disabled during the submit. The indicator will be shown for minimum 1 second. Related props: `minimumAsyncBehaviorTime` and `asyncSubmitTimeout`. You can return an error or an object with these keys `{ status: 'pending', info: 'Info message', warning: 'Warning message', error: Error('My error') } as const` to be shown in a [FormStatus](/uilib/components/form-status). Will only emit when every validation has passed. The second parameter is an object containing the `filterData`, `reduceToVisibleFields`, `transformData`, `resetForm` and `clearData` functions.\",\n type: 'function',\n status: 'optional',\n },\n onSubmitRequest: {\n doc: 'Will be called when the user tries to submit, but errors stop the data from being submitted. The first parameter is aa object containing the `getErrors` method, returning an array with field errors. Each error object contains the `path`, `error` and `props` of the field. You can use this to log the errors before the form is submitted.',\n type: 'function',\n status: 'optional',\n },\n onSubmitComplete: {\n doc: 'Will be called after onSubmit has finished and had not errors. It supports the same return values as `onSubmit` and will be merged together.',\n type: 'function',\n status: 'optional',\n },\n onClear: {\n doc: 'Will be called when the form is cleared via `Form.clearData` or via the `onSubmit` event (or `onCommit`) argument `{ clearData }`.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAwC,GAAAC,OAAA,CAAAD,kBAAA,GAAG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AChBC,MAAM,EAAE;EACV,CAAC;EACDwB,OAAO,EAAE;IACP1B,GAAG,EAAE,oIAAoI;IACzIC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ProviderDocs.js","names":["ProviderProperties","exports","defaultData","doc","type","status","data","id","schema","errorMessages","minimumAsyncBehaviorTime","asyncSubmitTimeout","scrollTopOnSubmit","sessionStorageId","ajvInstance","transformIn","transformOut","globalStatusId","required","disabled","locale","countryCode","children","ProviderEvents","onChange","onPathChange","onSubmit","onSubmitRequest","onSubmitComplete","onClear"],"sources":["../../../../../../src/extensions/forms/DataContext/Provider/ProviderDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const ProviderProperties: PropertiesTableProps = {\n defaultData: {\n doc: 'Default source data, only used if no other source is available, and not leading to updates if changed after mount.',\n type: 'object',\n status: 'optional',\n },\n data: {\n doc: 'Dynamic source data used as both initial data, and updates internal data if changed after mount.',\n type: 'object',\n status: 'optional',\n },\n id: {\n doc: 'Unique id for connecting Form.Handler and helper tools such as Form.useData.',\n type: ['string', 'Function', 'Object', 'React.Context'],\n status: 'optional',\n },\n schema: {\n doc: 'JSON Schema for validation of the data set.',\n type: 'object',\n status: 'optional',\n },\n errorMessages: {\n doc: 'Object containing error messages by either type of JSON Pointer path and type. The messages can be a React.ReactNode or a string.',\n type: 'object',\n status: 'optional',\n },\n minimumAsyncBehaviorTime: {\n doc: 'Minimum time to display the submit indicator. Default is 1s.',\n type: 'boolean',\n status: 'optional',\n },\n asyncSubmitTimeout: {\n doc: 'The maximum time to display the submit indicator before it changes back to normal. In case something went wrong during submission. Default is 30s.',\n type: 'boolean',\n status: 'optional',\n },\n scrollTopOnSubmit: {\n doc: 'True for the UI to scroll to the top of the page when data is submitted.',\n type: 'boolean',\n status: 'optional',\n },\n sessionStorageId: {\n doc: 'Key for saving active data to session storage and loading it on mount.',\n type: 'string',\n status: 'optional',\n },\n ajvInstance: {\n doc: 'Provide your own custom Ajv instance. More info in the [Schema validation](/uilib/extensions/forms/Form/schema-validation/#custom-ajv-instance-and-keywords) section.',\n type: 'ajv',\n status: 'optional',\n },\n transformIn: {\n doc: \"Mutate the data context (internally as well) based on your criteria: `({ path, value, data, props, internal }) => 'new value'`. It will iterate on each data entry (/path).\",\n type: 'function',\n status: 'optional',\n },\n transformOut: {\n doc: \"Mutate the data before it enters onSubmit or onChange based on your criteria: `({ path, value, data, props, internal }) => 'new value'`. It will iterate on each data entry (/path).\",\n type: 'function',\n status: 'optional',\n },\n globalStatusId: {\n doc: 'If needed, you can define a custom [GlobalStatus](/uilib/components/global-status) id. Defaults to `main`.',\n type: 'string',\n status: 'optional',\n },\n required: {\n doc: 'Make all fields required.',\n type: 'boolean',\n status: 'optional',\n },\n disabled: {\n doc: 'Disable all fields.',\n type: 'boolean',\n status: 'optional',\n },\n locale: {\n doc: 'Locale (language) to use for all nested Eufemia components.',\n type: 'string',\n status: 'optional',\n },\n countryCode: {\n doc: 'Will change the country code for fields supporting `countryCode`. You can also set a path as the value, e.g. `/myCountryCodePath`.',\n type: ['ISO 3166-1 alpha-2', 'Path/JSON Pointer'],\n status: 'optional',\n },\n children: {\n doc: 'Contents.',\n type: 'React.Node',\n status: 'required',\n },\n}\n\nexport const ProviderEvents: PropertiesTableProps = {\n onChange: {\n doc: \"Will be called when a value of a field was changed by the user, with the data set (including the changed value) as argument. When an async function is provided, it will show an indicator on the current label during a field change. Related props: `minimumAsyncBehaviorTime` and `asyncSubmitTimeout`. You can return an error or an object with these keys `{ info: 'Info message', warning: 'Warning message', error: Error('My error') } as const` in addition to { success: 'saved' } indicate the field was saved. Will emit unvalidated by default and validated when an async function is provided (like `onSubmit`). The second parameter is an object containing the `filterData`, `resetForm` and `clearData` functions.\",\n type: 'function',\n status: 'optional',\n },\n onPathChange: {\n doc: 'Will be called when a value of a field was changed by the user, with the `path` (JSON Pointer) and new `value` as arguments. Can be an async function. Will emit unvalidated by default and validated when `onChange` is an async function.',\n type: 'function',\n status: 'optional',\n },\n onSubmit: {\n doc: \"Will be called (on validation success) when the user submit the form (i.e by clicking a [SubmitButton](/uilib/extensions/forms/Form/SubmitButton) component inside), with the data set as argument. When an async function is provided, it will show an indicator on the submit button during the form submission. All form elements will be disabled during the submit. The indicator will be shown for minimum 1 second. Related props: `minimumAsyncBehaviorTime` and `asyncSubmitTimeout`. You can return an error or an object with these keys `{ status: 'pending', info: 'Info message', warning: 'Warning message', error: Error('My error') } as const` to be shown in a [FormStatus](/uilib/components/form-status). Will only emit when every validation has passed. The second parameter is an object containing the `filterData`, `reduceToVisibleFields`, `transformData`, `resetForm` and `clearData` functions.\",\n type: 'function',\n status: 'optional',\n },\n onSubmitRequest: {\n doc: 'Will be called when the user tries to submit, but errors stop the data from being submitted. The first parameter is aa object containing the `getErrors` method, returning an array with field errors. Each error object contains the `path`, `error` and `props` of the field. You can use this to log the errors before the form is submitted.',\n type: 'function',\n status: 'optional',\n },\n onSubmitComplete: {\n doc: 'Will be called after onSubmit has finished and had not errors. It supports the same return values as `onSubmit` and will be merged together.',\n type: 'function',\n status: 'optional',\n },\n onClear: {\n doc: 'Will be called when the form is cleared via `Form.clearData` or via the `onSubmit` event (or `onCommit`) argument `{ clearData }`.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAwC,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EACtDE,WAAW,EAAE;IACXC,GAAG,EAAE,oHAAoH;IACzHC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJH,GAAG,EAAE,kGAAkG;IACvGC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDE,EAAE,EAAE;IACFJ,GAAG,EAAE,8EAA8E;IACnFC,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,CAAC;IACvDC,MAAM,EAAE;E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e,MAAM,EAAE;IACNjB,GAAG,EAAE,6DAA6D;IAClEC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDgB,WAAW,EAAE;IACXlB,GAAG,EAAE,oIAAoI;IACzIC,IAAI,EAAE,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;IACjDC,MAAM,EAAE;EACV,CAAC;EACDiB,QAAQ,EAAE;IACRnB,GAAG,EAAE,WAAW;IAChBC,IAAI,EAAE,YAAY;IAClBC,MAAM,EAAE;EACV;AACF,CAAC;AAEM,MAAMkB,cAAoC,GAAAtB,OAAA,CAAAsB,cAAA,GAAG;EAClDC,QAAQ,EAAE;IACRrB,GAAG,EAAE,wsBAAwsB;IAC7sBC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDoB,YAAY,EAAE;IACZtB,GAAG,EAAE,6OAA6O;IAClPC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDqB,QAAQ,EAAE;IACRvB,GAAG,EAAE,i4BAAi4B;IACt4BC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDsB,eAAe,EAAE;IACfxB,GAAG,EAAE,kVAAkV;IACvVC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDuB,gBAAgB,EAAE;IAChBzB,GAAG,EAAE,8IAA8I;IACnJC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACDwB,OAAO,EAAE;IACP1B,GAAG,EAAE,oIAAoI;IACzIC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
@@ -227,18 +227,15 @@ function NumberComponent(props) {
227
227
  step: showStepControls ? step : undefined,
228
228
  placeholder,
229
229
  value,
230
- align: showStepControls ? 'center' : align
231
- }, maskProps), {}, {
230
+ align: showStepControls ? 'center' : align,
232
231
  onKeyDown: onKeyDownHandler,
233
232
  onFocus: handleFocus,
234
233
  onBlur: handleBlur,
235
234
  onChange: handleChange,
236
- disabled
237
- }, htmlAttributes), {}, {
235
+ disabled,
238
236
  status: hasError ? 'error' : undefined,
239
237
  stretch: Boolean(width)
240
- });
241
- Object.assign(inputProps, ariaParams);
238
+ }, maskProps), htmlAttributes), ariaParams);
242
239
  if (showStepControls) {
243
240
  return _react.default.createElement(_FieldBlock.default, _extends({}, fieldBlockProps, {
244
241
  asFieldset: false