@popsure/dirty-swan 0.27.29 → 0.27.31

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 (86) hide show
  1. package/dist/App.d.ts +0 -1
  2. package/dist/index.js +213 -148
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/components/autocompleteAddress/demo.d.ts +0 -1
  5. package/dist/lib/components/autocompleteAddress/index.d.ts +0 -1
  6. package/dist/lib/components/button/index.d.ts +1 -1
  7. package/dist/lib/components/chip/index.d.ts +0 -1
  8. package/dist/lib/components/comparisonTable/components/AccordionItem/AccordionItem.d.ts +0 -1
  9. package/dist/lib/components/comparisonTable/components/Chevron.d.ts +0 -1
  10. package/dist/lib/components/comparisonTable/components/Row/index.d.ts +0 -1
  11. package/dist/lib/components/comparisonTable/components/TableArrows/Arrow.d.ts +0 -1
  12. package/dist/lib/components/comparisonTable/components/TableArrows/index.d.ts +0 -1
  13. package/dist/lib/components/comparisonTable/components/TableInfoButton/index.d.ts +0 -1
  14. package/dist/lib/components/comparisonTable/components/TableRating/StarIcon.d.ts +0 -1
  15. package/dist/lib/components/comparisonTable/components/TableRating/ZapIcon.d.ts +0 -1
  16. package/dist/lib/components/comparisonTable/components/TableRating/index.d.ts +0 -1
  17. package/dist/lib/components/comparisonTable/components/TableRowHeader/index.d.ts +0 -1
  18. package/dist/lib/components/comparisonTable/components/TableTrueFalse.d.ts +0 -1
  19. package/dist/lib/components/dateSelector/index.d.ts +0 -1
  20. package/dist/lib/components/input/autoSuggestInput/index.d.ts +0 -1
  21. package/dist/lib/components/input/autoSuggestMultiSelect/index.d.ts +0 -1
  22. package/dist/lib/components/input/currency/index.d.ts +0 -1
  23. package/dist/lib/components/input/iban/index.d.ts +0 -1
  24. package/dist/lib/components/input/index.d.ts +1 -1
  25. package/dist/lib/components/modal/bottomModal/index.d.ts +0 -1
  26. package/dist/lib/components/modal/bottomOrRegularModal/index.d.ts +0 -1
  27. package/dist/lib/components/modal/regularModal/index.d.ts +0 -1
  28. package/dist/lib/components/multiDropzone/UploadFileCell/index.d.ts +6 -5
  29. package/dist/lib/components/multiDropzone/icons/index.d.ts +6 -20
  30. package/dist/lib/components/multiDropzone/index.d.ts +8 -19
  31. package/dist/lib/components/multiDropzone/index.test.d.ts +1 -0
  32. package/dist/lib/components/multiDropzone/types.d.ts +31 -0
  33. package/dist/lib/components/multiDropzone/utils/index.d.ts +11 -0
  34. package/dist/lib/components/segmentedControl/index.d.ts +0 -1
  35. package/dist/lib/scss/private/base/demo.d.ts +0 -1
  36. package/dist/lib/scss/public/demo.d.ts +0 -1
  37. package/dist/lib/util/formatBytes/index.d.ts +1 -0
  38. package/dist/lib/util/testUtils/customRender.d.ts +7 -0
  39. package/dist/lib/util/testUtils/index.d.ts +2 -0
  40. package/package.json +7 -4
  41. package/src/lib/components/autocompleteAddress/index.test.tsx +22 -21
  42. package/src/lib/components/input/currency/index.test.tsx +22 -22
  43. package/src/lib/components/input/index.tsx +3 -6
  44. package/src/lib/components/modal/regularModal/index.tsx +14 -12
  45. package/src/lib/components/modal/regularModal/style.module.scss +16 -15
  46. package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +44 -64
  47. package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +3 -9
  48. package/src/lib/components/multiDropzone/icons/eye.svg +10 -3
  49. package/src/lib/components/multiDropzone/icons/file-error.svg +4 -0
  50. package/src/lib/components/multiDropzone/icons/file-upload.svg +4 -0
  51. package/src/lib/components/multiDropzone/icons/file.svg +4 -0
  52. package/src/lib/components/multiDropzone/icons/index.ts +12 -44
  53. package/src/lib/components/multiDropzone/icons/trash-error.svg +6 -0
  54. package/src/lib/components/multiDropzone/icons/trash.svg +5 -5
  55. package/src/lib/components/multiDropzone/icons/upload-small.svg +12 -0
  56. package/src/lib/components/multiDropzone/index.stories.mdx +60 -2
  57. package/src/lib/components/multiDropzone/index.test.tsx +230 -0
  58. package/src/lib/components/multiDropzone/index.tsx +98 -69
  59. package/src/lib/components/multiDropzone/types.ts +36 -0
  60. package/src/lib/components/multiDropzone/utils/index.test.ts +112 -0
  61. package/src/lib/components/multiDropzone/utils/index.ts +69 -0
  62. package/src/lib/components/segmentedControl/index.test.tsx +15 -21
  63. package/src/lib/util/formatBytes/index.test.ts +19 -0
  64. package/src/lib/util/formatBytes/index.ts +13 -0
  65. package/src/lib/util/testUtils/customRender.tsx +15 -0
  66. package/src/lib/util/testUtils/index.ts +5 -0
  67. package/src/setupTests.js +2 -0
  68. package/src/lib/components/multiDropzone/icons/bmp-complete.svg +0 -10
  69. package/src/lib/components/multiDropzone/icons/bmp.svg +0 -10
  70. package/src/lib/components/multiDropzone/icons/doc-complete.svg +0 -11
  71. package/src/lib/components/multiDropzone/icons/doc.svg +0 -11
  72. package/src/lib/components/multiDropzone/icons/docx-complete.svg +0 -12
  73. package/src/lib/components/multiDropzone/icons/docx.svg +0 -12
  74. package/src/lib/components/multiDropzone/icons/generic-complete.svg +0 -4
  75. package/src/lib/components/multiDropzone/icons/generic-error.svg +0 -7
  76. package/src/lib/components/multiDropzone/icons/generic.svg +0 -4
  77. package/src/lib/components/multiDropzone/icons/heic-complete.svg +0 -11
  78. package/src/lib/components/multiDropzone/icons/heic.svg +0 -11
  79. package/src/lib/components/multiDropzone/icons/jpeg-complete.svg +0 -11
  80. package/src/lib/components/multiDropzone/icons/jpeg.svg +0 -11
  81. package/src/lib/components/multiDropzone/icons/jpg-complete.svg +0 -10
  82. package/src/lib/components/multiDropzone/icons/jpg.svg +0 -10
  83. package/src/lib/components/multiDropzone/icons/pdf-complete.svg +0 -8
  84. package/src/lib/components/multiDropzone/icons/pdf.svg +0 -8
  85. package/src/lib/components/multiDropzone/icons/png-complete.svg +0 -10
  86. package/src/lib/components/multiDropzone/icons/png.svg +0 -10
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const WithoutAddress: () => JSX.Element;
3
2
  export declare const WithAddress: () => JSX.Element;
4
3
  export declare const WithoutAddressLocalized: () => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Address } from '@popsure/public-models';
3
2
  declare const AutoCompleteAddress: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, }: {
4
3
  apiKey: string;
@@ -9,5 +9,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<{
9
9
  buttonType?: ButtonType | undefined;
10
10
  leftIcon?: Icon | undefined;
11
11
  loading?: boolean | undefined;
12
- } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children">, "className" | "form" | "slot" | "style" | "title" | "onClick" | "hidden" | "value" | "onChange" | "dir" | "onBlur" | "onFocus" | "onKeyDown" | "tabIndex" | "leftIcon" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "loading" | "buttonTitle" | "buttonType"> & React.RefAttributes<HTMLButtonElement>>;
12
+ } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children">, "className" | "form" | "slot" | "style" | "title" | "onClick" | "hidden" | "type" | "value" | "onChange" | "dir" | "onBlur" | "onFocus" | "onKeyDown" | "tabIndex" | "leftIcon" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "loading" | "buttonTitle" | "buttonType"> & React.RefAttributes<HTMLButtonElement>>;
13
13
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Option } from '../../models/autoSuggestInput';
3
2
  declare const _default: ({ value, onRemove, }: {
4
3
  value: Option;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const AccordionItem: ({ children, className, headerClassName, isOpen, onOpen, onClose, label, }: {
3
2
  children: React.ReactNode | string;
4
3
  className?: string | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const Chevron: ({ className }: {
3
2
  className?: string | undefined;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Cell } from '../../index';
3
2
  interface RowProps<T> {
4
3
  cell: Cell<T>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const ArrowIcon: ({ className }: {
3
2
  className?: string | undefined;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare type ArrowValues = 'prev' | 'next';
3
2
  interface TableArrowsProps {
4
3
  onClick: (value: ArrowValues) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const TableInfoButton: ({ onClick, className, }: {
3
2
  onClick: () => void;
4
3
  className?: string | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const StarIcon: ({ className }: {
3
2
  className: string;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const ZapIcon: ({ className }: {
3
2
  className: string;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare type RatingTypes = 'star' | 'zap';
3
2
  interface TableRatingProps {
4
3
  type: RatingTypes;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const TableRowHeader: (props: {
3
2
  label: string;
4
3
  icon?: string | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const TableTrueFalse: ({ value, className, }: {
3
2
  value: boolean;
4
3
  className?: string | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './datepicker.scss';
3
2
  export declare const fillArray: (from: number, to: number) => number[];
4
3
  export declare const daysInMonthOfYear: ({ month, year, }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Option } from '../../../models/autoSuggestInput';
3
2
  declare const _default: ({ currentOption, suggestions, handleSuggestionSelected, onChange, handleSuggestionFetchRequest, handleSuggestionClearRequest, placeholder, className, wrapText, }: {
4
3
  currentOption: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Option } from '../../../models/autoSuggestInput';
3
2
  declare const _default: ({ options, selectedValues, setValues, placeholder, chipsListClassName, multiSelectClassName, wrapText, }: {
4
3
  options: Option[];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { InputProps } from '..';
3
2
  declare const CurrencyInput: ({ value, onChange, type, ...props }: {
4
3
  value?: number | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { InputProps } from '..';
3
2
  declare const IbanInput: ({ value, onChange, ...props }: {
4
3
  value?: string | undefined;
@@ -12,5 +12,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<{
12
12
  label?: string | undefined;
13
13
  id?: string | undefined;
14
14
  hideLabel?: boolean | undefined;
15
- } & Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "enterKeyHint"> & Partial<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "enterKeyHint">>, "className" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "onClick" | "error" | "hidden" | "value" | "onChange" | "dir" | "onBlur" | "onFocus" | "onKeyDown" | "tabIndex" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "disabled" | "enterKeyHint" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "readOnly" | "required" | "size" | "src" | "type" | "width" | "hideLabel"> & React.RefAttributes<HTMLInputElement>>;
15
+ } & Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "enterKeyHint"> & Partial<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "enterKeyHint">>, "className" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "onClick" | "error" | "hidden" | "type" | "list" | "value" | "onChange" | "dir" | "onBlur" | "onFocus" | "onKeyDown" | "tabIndex" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "disabled" | "enterKeyHint" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "readOnly" | "required" | "size" | "src" | "width" | "hideLabel"> & React.RefAttributes<HTMLInputElement>>;
16
16
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Props } from '..';
3
2
  declare const _default: ({ title, isOpen, children, onClose, className, dismissible, }: Props) => JSX.Element;
4
3
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Props } from '..';
3
2
  declare const _default: ({ isOpen, ...props }: Props) => JSX.Element;
4
3
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Props } from '..';
3
2
  declare const _default: ({ title, isOpen, children, onClose, className, dismissible, }: Props) => JSX.Element;
4
3
  export default _default;
@@ -1,9 +1,10 @@
1
- /// <reference types="react" />
2
- import { UploadStatus, UploadedFile } from '..';
3
- declare const _default: ({ uploadStatus, file, onRemoveFile, uploading, }: {
1
+ import React from 'react';
2
+ import { UploadStatus, UploadedFile } from '../types';
3
+ interface Props {
4
4
  uploadStatus: UploadStatus;
5
5
  file: UploadedFile;
6
6
  onRemoveFile: (id: string) => void;
7
7
  uploading: boolean;
8
- }) => JSX.Element;
9
- export default _default;
8
+ }
9
+ declare const UploadFileCell: React.FC<Props>;
10
+ export default UploadFileCell;
@@ -1,25 +1,11 @@
1
1
  declare const _default: {
2
- uploadIcon: string;
3
- genericIcon: string;
4
- bmpIcon: string;
5
- docIcon: string;
6
- docxIcon: string;
7
- heicIcon: string;
8
- jpegIcon: string;
9
- jpgIcon: string;
10
- pdfIcon: string;
11
- pngIcon: string;
12
- genericCompleteIcon: string;
13
- bmpCompleteIcon: string;
14
- docCompleteIcon: string;
15
- docxCompleteIcon: string;
16
- heicCompleteIcon: string;
17
- jpegCompleteIcon: string;
18
- jpgCompleteIcon: string;
19
- pdfCompleteIcon: string;
20
- pngCompleteIcon: string;
21
- errorIcon: string;
22
2
  eyeIcon: string;
3
+ fileErrorIcon: string;
4
+ fileIcon: string;
5
+ fileUploadIcon: string;
23
6
  trashIcon: string;
7
+ trashErrorIcon: string;
8
+ uploadIcon: string;
9
+ uploadSmallIcon: string;
24
10
  };
25
11
  export default _default;
@@ -1,26 +1,15 @@
1
- /// <reference types="react" />
2
- export declare type UploadStatus = 'UPLOADING' | 'COMPLETE' | 'ERROR';
3
- export declare type FileType = 'heic' | 'bmp' | 'jpeg' | 'jpg' | 'png' | 'doc' | 'docx' | 'pdf';
4
- export interface UploadedFile {
5
- id: string;
6
- name: string;
7
- type: FileType | string;
8
- previewUrl?: string;
9
- progress: number;
10
- error?: string;
11
- }
12
- interface Props {
1
+ import { AcceptType, FileType, TextOverrides, UploadedFile, UploadStatus } from './types';
2
+ interface MultiDropzoneProps {
3
+ accept?: AcceptType;
13
4
  onFileSelect: (files: File[]) => void;
14
5
  uploadedFiles: UploadedFile[];
15
6
  uploading: boolean;
16
7
  onRemoveFile: (id: string) => void;
17
8
  isCondensed?: boolean;
18
9
  maxFiles?: number;
19
- textOverrides?: {
20
- instructionsText?: string;
21
- currentlyUploadingText?: string;
22
- supportsText?: string;
23
- };
10
+ maxSize?: number;
11
+ textOverrides?: TextOverrides;
24
12
  }
25
- declare const _default: ({ uploadedFiles, onFileSelect, uploading, onRemoveFile, isCondensed, maxFiles, textOverrides, }: Props) => JSX.Element;
26
- export default _default;
13
+ declare const MultiDropZone: ({ accept, uploadedFiles, onFileSelect, uploading, onRemoveFile, isCondensed, maxFiles, maxSize, textOverrides, }: MultiDropzoneProps) => JSX.Element;
14
+ export type { FileType, MultiDropzoneProps, UploadedFile, UploadStatus };
15
+ export default MultiDropZone;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,31 @@
1
+ import { Accept } from "react-dropzone";
2
+ export declare type UploadStatus = 'UPLOADING' | 'COMPLETE' | 'ERROR';
3
+ export declare const DOCUMENT_FILES: string[];
4
+ export declare const IMAGE_FILES: string[];
5
+ export declare const FILE_TYPES: string[];
6
+ export declare type FileType = typeof FILE_TYPES[number];
7
+ export interface UploadedFile {
8
+ id: string;
9
+ name: string;
10
+ type: FileType | string;
11
+ previewUrl?: string;
12
+ progress: number;
13
+ error?: string;
14
+ showProgressBar?: boolean;
15
+ showLoadingSpinner?: boolean;
16
+ }
17
+ export declare type AcceptType = "document" | "image" | Accept;
18
+ export interface TextOverrides {
19
+ currentlyUploadingText?: string;
20
+ fileTypeError?: string;
21
+ fileTooLargeError?: string;
22
+ instructionsText?: string;
23
+ sizeUpToText?: string;
24
+ supportsText?: string;
25
+ supportsTextShort?: string;
26
+ tooManyFilesError?: string;
27
+ }
28
+ export interface ErrorMessage {
29
+ id: string;
30
+ message: string;
31
+ }
@@ -0,0 +1,11 @@
1
+ import { Accept, FileError } from "react-dropzone";
2
+ import { AcceptType, TextOverrides, UploadStatus } from "../types";
3
+ export declare const getUploadStatus: (progress: number, error?: string | undefined) => UploadStatus;
4
+ export declare const DOCUMENT_FILES_ACCEPT: Accept;
5
+ export declare const IMAGE_FILES_ACCEPT: Accept;
6
+ export declare const getFormattedAcceptObject: (accept?: AcceptType) => Accept;
7
+ export declare const formatAcceptFileList: (accept: Accept) => string;
8
+ export declare const getErrorMessage: ({ code, message }: FileError, { fileList, maxSize }: {
9
+ fileList?: string | undefined;
10
+ maxSize?: number | undefined;
11
+ }, textOverrides?: TextOverrides | undefined) => string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface TitleWithSubtitle {
3
2
  title: string;
4
3
  subtitle: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Typography: () => JSX.Element;
3
2
  export declare const StaticWidthClasses: () => JSX.Element;
4
3
  export declare const MinWidthClasses: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const Colors: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function formatBytes(bytes: number, decimals?: number): string;
@@ -0,0 +1,7 @@
1
+ import { RenderOptions, RenderResult } from '@testing-library/react';
2
+ import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
3
+ interface CustomRenderResult extends RenderResult {
4
+ user: UserEvent;
5
+ }
6
+ export declare const customRender: (ui: JSX.Element, options?: RenderOptions) => CustomRenderResult;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from '@testing-library/react';
2
+ export { customRender as render } from './customRender';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.27.29",
3
+ "version": "0.27.31",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -34,7 +34,8 @@
34
34
  "react-scroll-sync": "^0.9.0",
35
35
  "remark-directive": "^2.0.1",
36
36
  "sass": "^1.35.1",
37
- "signature_pad": "^3.0.0-beta.3"
37
+ "signature_pad": "^3.0.0-beta.3",
38
+ "uuid": "^8.3.2"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "react": "^16.12.0",
@@ -78,8 +79,10 @@
78
79
  "@storybook/preset-create-react-app": "^3.1.7",
79
80
  "@storybook/react": "^6.2.9",
80
81
  "@storybook/storybook-deployer": "^2.8.10",
81
- "@testing-library/jest-dom": "^5.14.1",
82
- "@testing-library/react": "^11.2.7",
82
+ "@testing-library/jest-dom": "^5.16.4",
83
+ "@testing-library/react": "^12.1.2",
84
+ "@testing-library/react-hooks": "^8.0.1",
85
+ "@testing-library/user-event": "^14.3.0",
83
86
  "@types/google.maps": "^3.43.3",
84
87
  "@types/jest": "^26.0.23",
85
88
  "@types/lodash.debounce": "^4.0.6",
@@ -1,5 +1,5 @@
1
1
  import { Address } from '@popsure/public-models';
2
- import { fireEvent, render } from '@testing-library/react';
2
+ import { fireEvent, render } from '../../util/testUtils';
3
3
 
4
4
  import AutoCompleteAddress from '.';
5
5
 
@@ -27,7 +27,7 @@ const setup = (
27
27
  const inputTestId = 'ds-input-input';
28
28
 
29
29
  describe('AutocompleteAddress component', () => {
30
- it('Should show all address fields once a search is completed', () => {
30
+ it('Should show all address fields once a search is completed', async () => {
31
31
  // @ts-ignore
32
32
  window.google.maps.places.Autocomplete = class {
33
33
  reference: HTMLElement;
@@ -55,40 +55,41 @@ describe('AutocompleteAddress component', () => {
55
55
  }
56
56
  };
57
57
 
58
- const screen = setup();
59
- fireEvent.change(screen.getByTestId(inputTestId), {
58
+ const { getAllByTestId, getByDisplayValue, getByTestId } = setup();
59
+
60
+ fireEvent.change(getByTestId(inputTestId), {
60
61
  target: { value: 'Köpeniker' },
61
62
  });
62
63
 
63
- const inputs = screen.getAllByTestId(inputTestId);
64
- expect(inputs[0].getAttribute('value')).toBe('Köpeniker Strasse');
65
- expect(inputs.length).toEqual(5);
64
+ expect(getAllByTestId(inputTestId).length).toEqual(5);
65
+ expect(getByDisplayValue("Köpeniker Strasse")).toBeVisible();
66
66
  });
67
67
 
68
68
  it('Should enable to enter the address manually', async () => {
69
69
  const callback = jest.fn();
70
- const screen = setup(undefined, callback);
71
- const btn = await screen.findByText('Enter address manually');
72
- fireEvent.click(btn);
70
+ const { findByText, getAllByTestId, user } = setup(undefined, callback);
71
+ const btn = await findByText('Enter address manually');
72
+
73
+ await user.click(btn);
73
74
 
74
75
  // fill out all fields
75
- const inputs = screen.getAllByTestId(inputTestId);
76
+ const inputs = getAllByTestId(inputTestId);
76
77
 
77
- fireEvent.change(inputs[0], { target: { value: 'Köpeniker Strasse' } });
78
- fireEvent.change(inputs[1], { target: { value: '4000' } });
79
- fireEvent.change(inputs[3], { target: { value: '10179' } });
80
- fireEvent.change(inputs[4], { target: { value: 'Berlin' } });
78
+ await user.type(inputs[0], 'Köpeniker Strasse');
79
+ await user.type(inputs[1], '4000');
80
+ await user.type(inputs[3], '10179');
81
+ await user.type(inputs[4], 'Berlin');
81
82
 
82
83
  // callback should be called with a complete address
83
84
  expect(callback).toHaveBeenCalledWith(address);
84
85
  });
85
86
 
86
87
  it('Should prefill fields if an address is provided', async () => {
87
- const screen = setup(address);
88
- const inputs = screen.getAllByTestId(inputTestId);
89
- expect(inputs[0].getAttribute('value')).toBe('Köpeniker Strasse');
90
- expect(inputs[1].getAttribute('value')).toBe('4000');
91
- expect(inputs[3].getAttribute('value')).toBe('10179');
92
- expect(inputs[4].getAttribute('value')).toBe('Berlin');
88
+ const { getByDisplayValue } = setup(address);
89
+
90
+ expect(getByDisplayValue("Köpeniker Strasse")).toBeVisible();
91
+ expect(getByDisplayValue("4000")).toBeVisible();
92
+ expect(getByDisplayValue("10179")).toBeVisible();
93
+ expect(getByDisplayValue("Berlin")).toBeVisible();
93
94
  });
94
95
  });
@@ -1,4 +1,4 @@
1
- import { fireEvent, render } from '@testing-library/react';
1
+ import { render } from '../../../util/testUtils';
2
2
 
3
3
  import CurrencyInput from '.';
4
4
 
@@ -12,45 +12,45 @@ const setup = () => {
12
12
  };
13
13
 
14
14
  describe('Currency input component', () => {
15
- it('Should correctly space thousands separators', () => {
16
- const { input } = setup();
17
- fireEvent.change(input, { target: { value: '1234567' } });
15
+ it('Should correctly space thousands separators', async () => {
16
+ const { input, user } = setup();
17
+ await user.type(input, '1234567');
18
18
  expect(input.value).toBe('1 234 567');
19
19
  });
20
20
 
21
- it('Should remove non numerical values', () => {
22
- const { input } = setup();
23
- fireEvent.change(input, { target: { value: '123asdf4567' } });
21
+ it('Should remove non numerical values', async () => {
22
+ const { input, user } = setup();
23
+ await user.type(input, '123asdf4567');
24
24
  expect(input.value).toBe('1 234 567');
25
25
  });
26
26
 
27
- it('Should remove non numerical values', () => {
28
- const { input } = setup();
29
- fireEvent.change(input, { target: { value: '123asdf4567' } });
27
+ it('Should remove non numerical values', async () => {
28
+ const { input, user } = setup();
29
+ await user.type(input, '123asdf4567');
30
30
  expect(input.value).toBe('1 234 567');
31
31
  });
32
32
 
33
- it('Should allow decimal separator', () => {
34
- const { input } = setup();
35
- fireEvent.change(input, { target: { value: '1234567.34' } });
33
+ it('Should allow decimal separator', async () => {
34
+ const { input, user } = setup();
35
+ await user.type(input, '1234567.34');
36
36
  expect(input.value).toBe('1 234 567.34');
37
37
  });
38
38
 
39
- it('Should replace comma decimal seprator with a dot', () => {
40
- const { input } = setup();
41
- fireEvent.change(input, { target: { value: '1234567,34' } });
39
+ it('Should replace comma decimal seprator with a dot', async () => {
40
+ const { input, user } = setup();
41
+ await user.type(input, '1234567,34');
42
42
  expect(input.value).toBe('1 234 567.34');
43
43
  });
44
44
 
45
- it('Should only allow one decimal separator', () => {
46
- const { input } = setup();
47
- fireEvent.change(input, { target: { value: '1234567..34' } });
45
+ it('Should only allow one decimal separator', async () => {
46
+ const { input, user } = setup();
47
+ await user.type(input, '1234567..34');
48
48
  expect(input.value).toBe('1 234 567.34');
49
49
  });
50
50
 
51
- it('Should only allow one decimal separator after a sequence of number', () => {
52
- const { input } = setup();
53
- fireEvent.change(input, { target: { value: '1234567..34.4' } });
51
+ it('Should only allow one decimal separator after a sequence of number', async () => {
52
+ const { input, user } = setup();
53
+ await user.type(input, '1234567..34.4');
54
54
  expect(input.value).toBe('1 234 567.34');
55
55
  });
56
56
  });
@@ -1,12 +1,9 @@
1
1
  import React, { useState } from 'react';
2
2
  import classnames from 'classnames';
3
+ import { v4 as uuidv4 } from 'uuid';
3
4
 
4
5
  import styles from './style.module.scss';
5
6
 
6
- const generateUniqueId = () => {
7
- return `input-id-${Math.floor(Math.random() * 10000000)}`;
8
- };
9
-
10
7
  // Something weird is going on with enterKeyHint that makes it a required field under certain circumstances. The & Omit<…> and & Pick<…> is a hacky way to go around that.
11
8
  export type InputProps = {
12
9
  error?: string;
@@ -32,7 +29,7 @@ export default React.forwardRef(
32
29
  }: InputProps,
33
30
  ref?: React.ForwardedRef<HTMLInputElement>
34
31
  ) => {
35
- const [uniqueId] = useState(id ?? generateUniqueId());
32
+ const [uniqueId] = useState(id ?? uuidv4());
36
33
  return (
37
34
  <div className={`${styles.container} ${className ?? ''}`}>
38
35
  {label && (
@@ -40,7 +37,7 @@ export default React.forwardRef(
40
37
  htmlFor={uniqueId}
41
38
  className={classnames('p-p', styles.label, {
42
39
  [styles['label--with-error']]: error,
43
- "sr-only": hideLabel,
40
+ 'sr-only': hideLabel,
44
41
  })}
45
42
  >
46
43
  {label}