@popsure/dirty-swan 0.50.0 → 0.51.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 (98) hide show
  1. package/Readme.md +7 -0
  2. package/dist/cjs/index.js +225 -169
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/lib/components/button/index.d.ts +1 -1
  5. package/dist/cjs/lib/components/button/index.stories.d.ts +1 -1
  6. package/dist/cjs/lib/components/{card → cards/card}/index.d.ts +3 -1
  7. package/dist/{esm/lib/components → cjs/lib/components/cards}/card/index.stories.d.ts +9 -2
  8. package/dist/cjs/lib/components/cards/cardButton/index.d.ts +5 -11
  9. package/dist/cjs/lib/components/cards/cardButton/index.stories.d.ts +1 -1
  10. package/dist/cjs/lib/components/icon/icons/ArrowRightFilled.d.ts +4 -0
  11. package/dist/cjs/lib/components/icon/icons/index.d.ts +4 -1
  12. package/dist/cjs/lib/components/input/index.d.ts +1 -1
  13. package/dist/cjs/lib/components/input/input.stories.d.ts +1 -1
  14. package/dist/cjs/lib/components/modal/bottomModal/index.d.ts +2 -1
  15. package/dist/cjs/lib/components/modal/genericModal/index.d.ts +20 -0
  16. package/dist/cjs/lib/components/modal/hooks/useOnClose.d.ts +2 -0
  17. package/dist/cjs/lib/components/modal/index.d.ts +4 -3
  18. package/dist/cjs/lib/components/modal/index.stories.d.ts +2 -0
  19. package/dist/cjs/lib/components/modal/regularModal/index.d.ts +2 -1
  20. package/dist/cjs/lib/index.d.ts +1 -1
  21. package/dist/esm/components/{card → cards/card}/index.js +19 -11
  22. package/dist/esm/components/cards/card/index.js.map +1 -0
  23. package/dist/esm/components/{card → cards/card}/index.stories.js +21 -16
  24. package/dist/esm/components/cards/card/index.stories.js.map +1 -0
  25. package/dist/esm/components/cards/cardButton/index.js +12 -14
  26. package/dist/esm/components/cards/cardButton/index.js.map +1 -1
  27. package/dist/esm/components/cards/cardButton/index.stories.js +4 -4
  28. package/dist/esm/components/cards/cardButton/index.stories.js.map +1 -1
  29. package/dist/esm/components/cards/index.js +2 -1
  30. package/dist/esm/components/cards/index.js.map +1 -1
  31. package/dist/esm/components/cards/infoCard/index.js +2 -1
  32. package/dist/esm/components/cards/infoCard/index.js.map +1 -1
  33. package/dist/esm/components/cards/infoCard/index.stories.js +2 -1
  34. package/dist/esm/components/cards/infoCard/index.stories.js.map +1 -1
  35. package/dist/esm/components/icon/icons/ArrowRightFilled.js +13 -0
  36. package/dist/esm/components/icon/icons/ArrowRightFilled.js.map +1 -0
  37. package/dist/esm/components/icon/icons.stories.js +5 -2
  38. package/dist/esm/components/icon/icons.stories.js.map +1 -1
  39. package/dist/esm/components/icon/index.stories.js +5 -2
  40. package/dist/esm/components/icon/index.stories.js.map +1 -1
  41. package/dist/esm/components/modal/bottomModal/index.js +19 -24
  42. package/dist/esm/components/modal/bottomModal/index.js.map +1 -1
  43. package/dist/esm/components/modal/bottomOrRegularModal/index.js +3 -2
  44. package/dist/esm/components/modal/bottomOrRegularModal/index.js.map +1 -1
  45. package/dist/esm/components/modal/genericModal/index.js +94 -0
  46. package/dist/esm/components/modal/genericModal/index.js.map +1 -0
  47. package/dist/esm/components/modal/index.stories.js +26 -3
  48. package/dist/esm/components/modal/index.stories.js.map +1 -1
  49. package/dist/esm/components/modal/regularModal/index.js +18 -16
  50. package/dist/esm/components/modal/regularModal/index.js.map +1 -1
  51. package/dist/esm/{index-e506c4ca.js → index-73378a46.js} +9 -3
  52. package/dist/esm/{index-e506c4ca.js.map → index-73378a46.js.map} +1 -1
  53. package/dist/esm/index.js +6 -3
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/lib/components/button/index.d.ts +1 -1
  56. package/dist/esm/lib/components/button/index.stories.d.ts +1 -1
  57. package/dist/esm/lib/components/{card → cards/card}/index.d.ts +3 -1
  58. package/dist/{cjs/lib/components → esm/lib/components/cards}/card/index.stories.d.ts +9 -2
  59. package/dist/esm/lib/components/cards/cardButton/index.d.ts +5 -11
  60. package/dist/esm/lib/components/cards/cardButton/index.stories.d.ts +1 -1
  61. package/dist/esm/lib/components/icon/icons/ArrowRightFilled.d.ts +4 -0
  62. package/dist/esm/lib/components/icon/icons/index.d.ts +4 -1
  63. package/dist/esm/lib/components/input/index.d.ts +1 -1
  64. package/dist/esm/lib/components/input/input.stories.d.ts +1 -1
  65. package/dist/esm/lib/components/modal/bottomModal/index.d.ts +2 -1
  66. package/dist/esm/lib/components/modal/genericModal/index.d.ts +20 -0
  67. package/dist/esm/lib/components/modal/hooks/useOnClose.d.ts +2 -0
  68. package/dist/esm/lib/components/modal/index.d.ts +4 -3
  69. package/dist/esm/lib/components/modal/index.stories.d.ts +2 -0
  70. package/dist/esm/lib/components/modal/regularModal/index.d.ts +2 -1
  71. package/dist/esm/lib/index.d.ts +1 -1
  72. package/package.json +1 -1
  73. package/src/lib/components/{card → cards/card}/index.stories.tsx +12 -5
  74. package/src/lib/components/{card → cards/card}/index.tsx +19 -6
  75. package/src/lib/components/{card → cards/card}/style.module.scss +5 -1
  76. package/src/lib/components/cards/cardButton/index.stories.tsx +11 -15
  77. package/src/lib/components/cards/cardButton/index.tsx +33 -48
  78. package/src/lib/components/cards/cardButton/style.module.scss +4 -37
  79. package/src/lib/components/icon/assets/arrow-right-filled.svg +4 -0
  80. package/src/lib/components/icon/icons/ArrowRightFilled.tsx +23 -0
  81. package/src/lib/components/icon/icons/index.ts +4 -1
  82. package/src/lib/components/modal/bottomModal/index.tsx +18 -78
  83. package/src/lib/components/modal/bottomModal/style.module.scss +11 -71
  84. package/src/lib/components/modal/genericModal/index.tsx +133 -0
  85. package/src/lib/components/modal/genericModal/style.module.scss +71 -0
  86. package/src/lib/components/modal/hooks/useOnClose.ts +27 -5
  87. package/src/lib/components/modal/index.stories.tsx +95 -0
  88. package/src/lib/components/modal/index.ts +4 -2
  89. package/src/lib/components/modal/regularModal/index.tsx +20 -61
  90. package/src/lib/components/modal/regularModal/style.module.scss +6 -74
  91. package/src/lib/index.tsx +1 -1
  92. package/dist/esm/components/card/index.js.map +0 -1
  93. package/dist/esm/components/card/index.stories.js.map +0 -1
  94. package/dist/esm/useOnClose-d818a54f.js +0 -46
  95. package/dist/esm/useOnClose-d818a54f.js.map +0 -1
  96. package/src/lib/components/cards/a.stories.mdx +0 -44
  97. package/src/lib/components/modal/bottomModal/img/close.svg +0 -4
  98. package/src/lib/components/modal/regularModal/img/close.svg +0 -4
@@ -9,7 +9,7 @@ declare const story: {
9
9
  id?: string | undefined;
10
10
  hideLabel?: boolean | undefined;
11
11
  labelInsideInput?: boolean | undefined;
12
- }, "className" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "onClick" | "error" | "size" | "color" | "hidden" | "type" | "list" | "enterKeyHint" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "value" | "width" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "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" | "hideLabel" | "labelInsideInput"> & import("react").RefAttributes<HTMLInputElement>>;
12
+ }, "className" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "onClick" | "error" | "size" | "color" | "hidden" | "key" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "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" | "hideLabel" | "list" | "step" | "enterKeyHint" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "labelInsideInput"> & import("react").RefAttributes<HTMLInputElement>>;
13
13
  argTypes: {
14
14
  value: {
15
15
  defaultValue: string;
@@ -1,2 +1,3 @@
1
1
  import { Props } from '..';
2
- export declare const BottomModal: ({ title, isOpen, children, onClose, className, dismissible, }: Props) => JSX.Element;
2
+ declare const BottomModal: ({ className, ...rest }: Props) => JSX.Element;
3
+ export { BottomModal };
@@ -0,0 +1,20 @@
1
+ import { Props } from '..';
2
+ interface GenericModalProps extends Props {
3
+ classNames?: {
4
+ wrapper?: string | (({ isClosing }: {
5
+ isClosing: boolean;
6
+ }) => string);
7
+ container?: string | (({ isClosing }: {
8
+ isClosing: boolean;
9
+ }) => string);
10
+ overlay?: string;
11
+ header?: string;
12
+ closeButton?: string;
13
+ title?: string;
14
+ body?: string;
15
+ footer?: string;
16
+ };
17
+ titleSize?: 'small' | 'default';
18
+ }
19
+ export declare const GenericModal: ({ title, isOpen, children, onClose, classNames, dismissible, footer, titleSize, }: GenericModalProps) => JSX.Element | null;
20
+ export {};
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  interface OnCloseReturn {
3
3
  isClosing: boolean;
4
+ isVisible: boolean;
5
+ handleOnCloseAnimationEnded: () => void;
4
6
  handleContainerClick: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
7
  handleOnClose: () => void;
6
8
  handleOnOverlayClick: () => void;
@@ -1,13 +1,14 @@
1
- /// <reference types="react" />
2
1
  import { BottomModal } from './bottomModal';
3
2
  import { RegularModal } from './regularModal';
4
3
  import { BottomOrRegularModal } from './bottomOrRegularModal';
4
+ import { ReactNode } from 'react';
5
5
  export interface Props {
6
- title?: string;
6
+ title?: ReactNode;
7
7
  isOpen: boolean;
8
- children: React.ReactNode;
8
+ children: ReactNode;
9
9
  onClose: () => void;
10
10
  className?: string;
11
11
  dismissible?: boolean;
12
+ footer?: ReactNode;
12
13
  }
13
14
  export { BottomModal, RegularModal, BottomOrRegularModal };
@@ -59,4 +59,6 @@ export declare const BottomModalStory: {
59
59
  storyName: string;
60
60
  };
61
61
  export declare const NonDismissibleModal: ({ children, isOpen, onClose, title, }: Props) => JSX.Element;
62
+ export declare const ModalWithFooter: ({ children, isOpen, onClose, title, }: Props) => JSX.Element;
63
+ export declare const ModalWithFooterAndScroll: ({ children, isOpen, onClose, title, }: Props) => JSX.Element;
62
64
  export default story;
@@ -1,2 +1,3 @@
1
1
  import { Props } from '..';
2
- export declare const RegularModal: ({ title, isOpen, children, onClose, className, dismissible, }: Props) => JSX.Element;
2
+ declare const RegularModal: ({ className, ...rest }: Props) => JSX.Element;
3
+ export { RegularModal };
@@ -12,7 +12,7 @@ import { Checkbox } from './components/input/checkbox';
12
12
  import { Radio } from './components/input/radio';
13
13
  import { BottomModal, RegularModal, BottomOrRegularModal } from './components/modal';
14
14
  import { InfoCard, CardButton } from './components/cards';
15
- import { Card, CardProps } from './components/card';
15
+ import { Card, CardProps } from './components/cards/card';
16
16
  import { Button } from './components/button';
17
17
  import { AutoSuggestMultiSelect } from './components/input/autoSuggestMultiSelect';
18
18
  import Chip from './components/chip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1,11 +1,11 @@
1
1
  import { Card, CardProps } from '.';
2
- import { illustrations } from '../../util/images';
3
- import { Button } from '../button';
4
- import { Badge } from '../badge';
5
- import { CheckIcon, InfoIcon, MehIcon, PlusCircleIcon, XIcon } from '../icon';
2
+ import { illustrations } from '../../../util/images';
3
+ import { Button } from '../../button';
4
+ import { Badge } from '../../badge';
5
+ import { CheckIcon, InfoIcon, MehIcon, PlusCircleIcon, XIcon } from '../../icon';
6
6
 
7
7
  const story = {
8
- title: 'JSX/Card',
8
+ title: 'JSX/Cards/Card',
9
9
  component: Card,
10
10
  argTypes: {
11
11
  as: {
@@ -50,6 +50,10 @@ const story = {
50
50
  showActionIcon: {
51
51
  description: 'Property that always displays action icon even if no onClick is set.',
52
52
  },
53
+ verticalAlignment: {
54
+ description: 'Vertical alignment of the card content',
55
+ control: { type: 'select' },
56
+ },
53
57
  },
54
58
  args: {
55
59
  density: 'balanced',
@@ -69,6 +73,7 @@ const story = {
69
73
  icon: ''
70
74
  },
71
75
  dropShadow: true,
76
+ verticalAlignment: 'center',
72
77
  }
73
78
  };
74
79
 
@@ -87,6 +92,7 @@ export const CardStory = ({
87
92
  onClick,
88
93
  title,
89
94
  titleVariant,
95
+ verticalAlignment,
90
96
  }: CardProps) => (
91
97
  <div className='d-flex p24 bg-grey-200'>
92
98
  <Card
@@ -103,6 +109,7 @@ export const CardStory = ({
103
109
  onClick={onClick}
104
110
  actionIcon={actionIcon}
105
111
  showActionIcon={showActionIcon}
112
+ verticalAlignment={verticalAlignment}
106
113
  >
107
114
  {children}
108
115
  </Card>
@@ -1,6 +1,6 @@
1
1
  import { ComponentProps, ElementType, ReactNode } from 'react';
2
2
  import classNamesUtil from 'classnames';
3
- import { ChevronRightIcon } from '../icon';
3
+ import { ChevronRightIcon } from '../../icon';
4
4
 
5
5
  import styles from './style.module.scss';
6
6
 
@@ -8,6 +8,7 @@ const cardDefaultAs = 'section' as const
8
8
  type CardDefaultAsType = typeof cardDefaultAs;
9
9
  type DensityType = 'balanced' | 'compact' | 'spacious';
10
10
  type TitleVariantType = 'small' | 'medium' | 'large';
11
+ type VerticalAlignmentType = 'top' | 'center' | 'bottom';
11
12
 
12
13
  type CardOwnProps<E extends ElementType = CardDefaultAsType> = {
13
14
  as?: E;
@@ -33,6 +34,7 @@ type CardOwnProps<E extends ElementType = CardDefaultAsType> = {
33
34
  onClick?: () => void;
34
35
  actionIcon?: ReactNode;
35
36
  showActionIcon?: boolean;
37
+ verticalAlignment?: VerticalAlignmentType;
36
38
  }
37
39
 
38
40
  export type CardProps<E extends ElementType = CardDefaultAsType> = CardOwnProps<E> &
@@ -53,6 +55,7 @@ const Card = <E extends ElementType = CardDefaultAsType>({
53
55
  title,
54
56
  titleVariant = 'large',
55
57
  showActionIcon,
58
+ verticalAlignment = 'center',
56
59
  ...rest
57
60
  }: CardProps<E>) => {
58
61
  const hideActionIcon = typeof actionIcon !== 'undefined' && !actionIcon;
@@ -78,13 +81,18 @@ const Card = <E extends ElementType = CardDefaultAsType>({
78
81
  >
79
82
  <div
80
83
  className={classNamesUtil(
81
- 'd-flex fd-column jc-center br8 bg-white w100 ta-left',
84
+ 'd-flex fd-column br8 bg-white w100 ta-left',
82
85
  { 'bs-sm': dropShadow },
83
86
  {
84
87
  compact: 'p16',
85
88
  balanced: 'p24',
86
89
  spacious: 'p32',
87
90
  }[density as DensityType],
91
+ {
92
+ top: 'jc-start',
93
+ center: 'jc-center',
94
+ bottom: 'jc-end',
95
+ }[verticalAlignment as VerticalAlignmentType],
88
96
  classNames?.wrapper
89
97
  )}
90
98
  >
@@ -92,10 +100,15 @@ const Card = <E extends ElementType = CardDefaultAsType>({
92
100
  {icon && (
93
101
  <div
94
102
  className={classNamesUtil(
95
- `d-flex ai-center tc-primary-500`,
103
+ `d-flex tc-primary-500`,
96
104
  styles.icon,
97
105
  styles[`icon${density}`],
98
- classNames?.icon
106
+ classNames?.icon,
107
+ {
108
+ top: 'ai-start',
109
+ center: 'ai-center',
110
+ bottom: 'ai-end',
111
+ }[verticalAlignment as VerticalAlignmentType],
99
112
  )}
100
113
  >
101
114
  {icon}
@@ -128,9 +141,9 @@ const Card = <E extends ElementType = CardDefaultAsType>({
128
141
  {description && (
129
142
  <div
130
143
  className={classNamesUtil(
131
- 'tc-grey-600',
144
+ styles.description,
132
145
  classNames?.description,
133
- descriptionVariant === 'small' ? 'p-p--small' : 'p-p'
146
+ descriptionVariant === 'small' ? 'p-p--small' : 'p-p',
134
147
  )}
135
148
  >
136
149
  {description}
@@ -1,4 +1,4 @@
1
- @use '../../scss/public/colors' as *;
1
+ @use '../../../scss/public/colors' as *;
2
2
 
3
3
  .button {
4
4
  background-color: transparent;
@@ -41,3 +41,7 @@
41
41
  margin-left: 24px;
42
42
  }
43
43
  }
44
+
45
+ .description {
46
+ color: $ds-grey-600;
47
+ }
@@ -1,4 +1,3 @@
1
- import { FormEvent } from 'react';
2
1
  import { CardButton, CardButtonProps } from '.';
3
2
 
4
3
  const story = {
@@ -29,7 +28,7 @@ const story = {
29
28
  },
30
29
  },
31
30
  href: {
32
- defaultValue: '',
31
+ defaultValue: 'https://feather-insurance.com/',
33
32
  description: 'Redirect URL on click of the button',
34
33
  },
35
34
  },
@@ -42,19 +41,16 @@ export const CardButtonStory = ({
42
41
  className,
43
42
  href,
44
43
  onClick,
45
- }: CardButtonProps) => {
46
- const handleOnClick = (e: FormEvent) => onClick?.(e);
47
- return (
48
- <CardButton
49
- title={title}
50
- description={description}
51
- disabled={disabled}
52
- className={className}
53
- href={href}
54
- onClick={handleOnClick}
55
- />
56
- );
57
- }
44
+ }: CardButtonProps) => (
45
+ <CardButton
46
+ title={title}
47
+ description={description}
48
+ disabled={disabled}
49
+ className={className}
50
+ href={href}
51
+ onClick={onClick}
52
+ />
53
+ );
58
54
 
59
55
  CardButtonStory.storyName = "CardButton";
60
56
 
@@ -1,64 +1,49 @@
1
- import { FormEvent, createElement, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  import { ChevronRightIcon } from '../../icon/icons';
4
4
 
5
5
  import styles from './style.module.scss';
6
-
7
- type ActionProps =
8
- | { href: string; onClick?: (e: FormEvent) => void }
9
- | { href?: string; onClick: (e: FormEvent) => void };
6
+ import { Card, CardProps } from '../card';
7
+ import classNames from 'classnames';
10
8
 
11
9
  export type CardButtonProps = {
12
10
  title: string;
13
11
  description: string | ReactNode;
14
12
  disabled?: boolean;
15
13
  className?: string;
16
- } & ActionProps;
17
-
18
- const CardContent = ({
19
- title,
20
- description,
21
- }: {
22
- title: string;
23
- description: string | ReactNode;
24
- }) => (
25
- <>
26
- <div>
27
- <div className="p-p--small">{title}</div>
28
- {typeof description === 'string' ? (
29
- <div className="tc-primary-500 p-p">{description}</div>
30
- ) : (
31
- description
32
- )}
33
- </div>
34
- <ChevronRightIcon
35
- size={16}
36
- color={'purple-500'}
37
- className={styles.chevronRight}
38
- />
39
- </>
40
- );
14
+ href?: string;
15
+ } & CardProps;
41
16
 
42
17
  export const CardButton = ({
43
18
  title,
44
19
  description,
45
20
  disabled = false,
46
- onClick,
47
- href,
48
21
  className,
49
- }: CardButtonProps) => {
50
- const component = href ? 'a' : 'button';
51
- return (
52
- <>
53
- {createElement(component, {
54
- className: `c-pointer ta-left w100 ${styles.container} ${
55
- className ?? ''
56
- }
57
- `,
58
- children: <CardContent title={title} description={description} />,
59
- disabled,
60
- ...(component === 'a' ? { href } : { onClick }),
61
- })}
62
- </>
63
- );
64
- };
22
+ href,
23
+ }: CardButtonProps) => (
24
+ <Card
25
+ as={href ? 'a' : 'button'}
26
+ classNames={{
27
+ buttonWrapper: classNames(
28
+ 'c-pointer ta-left w100',
29
+ className,
30
+ { [styles.containerDisabled]: disabled }
31
+ ),
32
+ description: 'tc-primary-500 p-p',
33
+ }}
34
+ density='compact'
35
+ label={title}
36
+ description={typeof description === 'string' ? description : null}
37
+ actionIcon={
38
+ <ChevronRightIcon
39
+ size={20}
40
+ color={'purple-500'}
41
+ className={styles.chevronRight}
42
+ />
43
+ }
44
+ showActionIcon
45
+ {...href ? { href } : {}}
46
+ >
47
+ {typeof description !== 'string' ? description : null}
48
+ </Card>
49
+ );
@@ -1,37 +1,4 @@
1
- @use '../../../scss/public/colors' as *;
2
-
3
- .container {
4
- background-color: white;
5
-
6
- padding: 8px 16px;
7
-
8
- box-shadow: 0px 2px 20px rgba(97, 96, 162, 0.07);
9
-
10
- border-radius: 8px;
11
- border: 2px solid white;
12
-
13
- transition: border 0.2s ease-in-out;
14
-
15
- display: flex;
16
- justify-content: space-between;
17
- align-items: center;
18
-
19
- text-decoration: none;
20
-
21
- &:hover {
22
- border: 2px solid $ds-primary-300;
23
- }
24
-
25
- &[disabled] {
26
- pointer-events: none;
27
- opacity: 0.25;
28
- }
29
-
30
- &:focus {
31
- border: 2px solid $ds-primary-500;
32
- }
33
- }
34
-
35
- .chevronRight {
36
- min-width: 16px;
37
- }
1
+ .containerDisabled {
2
+ pointer-events: none;
3
+ opacity: 0.25;
4
+ }
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="12" cy="12" r="10" fill="#8E8CEE" stroke="#8E8CEE" stroke-width="2"/>
3
+ <path d="M12 8L15.8232 11.8232C15.9209 11.9209 15.9209 12.0791 15.8232 12.1768L12 16M8 12H16" stroke="white" stroke-width="2" stroke-linecap="round"/>
4
+ </svg>
@@ -0,0 +1,23 @@
1
+ /* Generated file. Do not modify. */
2
+ import { createElement } from 'react';
3
+ import { IconWrapper } from '../IconWrapper';
4
+ import type { IconWrapperProps } from '../IconWrapper';
5
+ export default (props: IconWrapperProps) =>
6
+ createElement(
7
+ IconWrapper,
8
+ props,
9
+ <circle
10
+ cx={12}
11
+ cy={12}
12
+ r={10}
13
+ fill="currentColor"
14
+ stroke="currentColor"
15
+ strokeWidth={2}
16
+ />,
17
+ <path
18
+ stroke="#fff"
19
+ strokeLinecap="round"
20
+ strokeWidth={2}
21
+ d="m12 8 3.823 3.823a.25.25 0 0 1 0 .354L12 16m-4-4h8"
22
+ />
23
+ );
@@ -6,6 +6,7 @@ export { default as Svg5Icon } from './5';
6
6
  export { default as Svg6Icon } from './6';
7
7
  export { default as Svg7Icon } from './7';
8
8
  export { default as Svg8Icon } from './8';
9
+ export { default as CancerIcon } from './Cancer';
9
10
  export { default as ActivityIcon } from './Activity';
10
11
  export { default as AdhdIcon } from './Adhd';
11
12
  export { default as AdviceRecommendationIcon } from './AdviceRecommendation';
@@ -27,6 +28,7 @@ export { default as ArrowDownIcon } from './ArrowDown';
27
28
  export { default as ArrowLeftCircleIcon } from './ArrowLeftCircle';
28
29
  export { default as ArrowLeftIcon } from './ArrowLeft';
29
30
  export { default as ArrowRightCircleIcon } from './ArrowRightCircle';
31
+ export { default as ArrowRightFilledIcon } from './ArrowRightFilled';
30
32
  export { default as ArrowRightIcon } from './ArrowRight';
31
33
  export { default as ArrowUpCircleIcon } from './ArrowUpCircle';
32
34
  export { default as ArrowUpLeftIcon } from './ArrowUpLeft';
@@ -61,7 +63,6 @@ export { default as CalculatorIcon } from './Calculator';
61
63
  export { default as CalendarIcon } from './Calendar';
62
64
  export { default as CameraOffIcon } from './CameraOff';
63
65
  export { default as CameraIcon } from './Camera';
64
- export { default as CancerIcon } from './Cancer';
65
66
  export { default as CastIcon } from './Cast';
66
67
  export { default as CheckCircleIcon } from './CheckCircle';
67
68
  export { default as CheckInCircleFilledIcon } from './CheckInCircleFilled';
@@ -238,6 +239,8 @@ export { default as PhoneOutgoingIcon } from './PhoneOutgoing';
238
239
  export { default as PhoneIcon } from './Phone';
239
240
  export { default as PieChartIcon } from './PieChart';
240
241
  export { default as PlaneFilledIcon } from './PlaneFilled';
242
+ export { default as PlaneRepatriationFilledIcon } from './PlaneRepatriationFilled';
243
+ export { default as PlaneRepatriationIcon } from './PlaneRepatriation';
241
244
  export { default as PlaneIcon } from './Plane';
242
245
  export { default as PlayCircleIcon } from './PlayCircle';
243
246
  export { default as PlayIcon } from './Play';
@@ -1,83 +1,23 @@
1
- import React, { useState, useCallback } from 'react';
2
-
3
1
  import { Props } from '..';
4
2
  import styles from './style.module.scss';
5
-
6
- import { XIcon } from '../../icon/icons';
7
- import useOnClose from '../hooks/useOnClose';
8
3
  import classNames from 'classnames';
4
+ import { GenericModal } from '../genericModal';
9
5
 
10
- export const BottomModal = ({
11
- title,
12
- isOpen,
13
- children,
14
- onClose,
15
- className = '',
16
- dismissible = true,
17
- }: Props) => {
18
- const [containerXOffset, setContainerXOffset] = useState(0);
19
- const {
20
- isClosing,
21
- handleContainerClick,
22
- handleOnClose,
23
- handleOnOverlayClick,
24
- } = useOnClose(onClose, isOpen, dismissible);
25
-
26
- const containerRef = useCallback((node: HTMLDivElement) => {
27
- if (node !== null) {
28
- setContainerXOffset(
29
- Math.max(
30
- window.innerHeight * 0.1,
31
- window.innerHeight - node.getBoundingClientRect().height
32
- )
33
- );
34
- }
35
- }, []);
36
-
37
- if (!isOpen) {
38
- return <></>;
39
- }
6
+ const BottomModal = ({ className, ...rest }: Props) => (
7
+ <GenericModal
8
+ titleSize='small'
9
+ classNames={{
10
+ wrapper: classNames('w100', styles.wrapper),
11
+ container: ({ isClosing }) => classNames(
12
+ 'bg-white d-flex fd-column w100',
13
+ className,
14
+ styles.container, {
15
+ [styles.containerClose]: isClosing,
16
+ }
17
+ ),
18
+ }}
19
+ {...rest}
20
+ />
21
+ );
40
22
 
41
- return (
42
- <div
43
- className={isClosing ? styles['overlay--close'] : styles.overlay}
44
- onClick={handleOnOverlayClick}
45
- >
46
- <div
47
- className={styles.wrapper}
48
- ref={containerRef}
49
- onClick={handleContainerClick}
50
- style={{ top: `${containerXOffset}px` }}
51
- >
52
- <div
53
- className={`${
54
- isClosing ? styles['container--close'] : styles.container
55
- } ${className}`}
56
- >
57
- <div
58
- className={classNames(styles.header, {
59
- 'jc-between': !!title,
60
- 'jc-end': !title,
61
- })}
62
- >
63
- <div className={`p-h4 ${styles.title}`}>{title}</div>
64
- {dismissible && (
65
- <button
66
- type="button"
67
- className={styles.close}
68
- onClick={handleOnClose}
69
- >
70
- <XIcon
71
- size={24}
72
- color={'grey-700'}
73
- className={`${styles.closeIcon}`}
74
- />
75
- </button>
76
- )}
77
- </div>
78
- <div className={styles.content}>{children}</div>
79
- </div>
80
- </div>
81
- </div>
82
- );
83
- };
23
+ export { BottomModal };