@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.
- package/Readme.md +7 -0
- package/dist/cjs/index.js +225 -169
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/button/index.d.ts +1 -1
- package/dist/cjs/lib/components/button/index.stories.d.ts +1 -1
- package/dist/cjs/lib/components/{card → cards/card}/index.d.ts +3 -1
- package/dist/{esm/lib/components → cjs/lib/components/cards}/card/index.stories.d.ts +9 -2
- package/dist/cjs/lib/components/cards/cardButton/index.d.ts +5 -11
- package/dist/cjs/lib/components/cards/cardButton/index.stories.d.ts +1 -1
- package/dist/cjs/lib/components/icon/icons/ArrowRightFilled.d.ts +4 -0
- package/dist/cjs/lib/components/icon/icons/index.d.ts +4 -1
- package/dist/cjs/lib/components/input/index.d.ts +1 -1
- package/dist/cjs/lib/components/input/input.stories.d.ts +1 -1
- package/dist/cjs/lib/components/modal/bottomModal/index.d.ts +2 -1
- package/dist/cjs/lib/components/modal/genericModal/index.d.ts +20 -0
- package/dist/cjs/lib/components/modal/hooks/useOnClose.d.ts +2 -0
- package/dist/cjs/lib/components/modal/index.d.ts +4 -3
- package/dist/cjs/lib/components/modal/index.stories.d.ts +2 -0
- package/dist/cjs/lib/components/modal/regularModal/index.d.ts +2 -1
- package/dist/cjs/lib/index.d.ts +1 -1
- package/dist/esm/components/{card → cards/card}/index.js +19 -11
- package/dist/esm/components/cards/card/index.js.map +1 -0
- package/dist/esm/components/{card → cards/card}/index.stories.js +21 -16
- package/dist/esm/components/cards/card/index.stories.js.map +1 -0
- package/dist/esm/components/cards/cardButton/index.js +12 -14
- package/dist/esm/components/cards/cardButton/index.js.map +1 -1
- package/dist/esm/components/cards/cardButton/index.stories.js +4 -4
- package/dist/esm/components/cards/cardButton/index.stories.js.map +1 -1
- package/dist/esm/components/cards/index.js +2 -1
- package/dist/esm/components/cards/index.js.map +1 -1
- package/dist/esm/components/cards/infoCard/index.js +2 -1
- package/dist/esm/components/cards/infoCard/index.js.map +1 -1
- package/dist/esm/components/cards/infoCard/index.stories.js +2 -1
- package/dist/esm/components/cards/infoCard/index.stories.js.map +1 -1
- package/dist/esm/components/icon/icons/ArrowRightFilled.js +13 -0
- package/dist/esm/components/icon/icons/ArrowRightFilled.js.map +1 -0
- package/dist/esm/components/icon/icons.stories.js +5 -2
- package/dist/esm/components/icon/icons.stories.js.map +1 -1
- package/dist/esm/components/icon/index.stories.js +5 -2
- package/dist/esm/components/icon/index.stories.js.map +1 -1
- package/dist/esm/components/modal/bottomModal/index.js +19 -24
- package/dist/esm/components/modal/bottomModal/index.js.map +1 -1
- package/dist/esm/components/modal/bottomOrRegularModal/index.js +3 -2
- package/dist/esm/components/modal/bottomOrRegularModal/index.js.map +1 -1
- package/dist/esm/components/modal/genericModal/index.js +94 -0
- package/dist/esm/components/modal/genericModal/index.js.map +1 -0
- package/dist/esm/components/modal/index.stories.js +26 -3
- package/dist/esm/components/modal/index.stories.js.map +1 -1
- package/dist/esm/components/modal/regularModal/index.js +18 -16
- package/dist/esm/components/modal/regularModal/index.js.map +1 -1
- package/dist/esm/{index-e506c4ca.js → index-73378a46.js} +9 -3
- package/dist/esm/{index-e506c4ca.js.map → index-73378a46.js.map} +1 -1
- package/dist/esm/index.js +6 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/components/button/index.d.ts +1 -1
- package/dist/esm/lib/components/button/index.stories.d.ts +1 -1
- package/dist/esm/lib/components/{card → cards/card}/index.d.ts +3 -1
- package/dist/{cjs/lib/components → esm/lib/components/cards}/card/index.stories.d.ts +9 -2
- package/dist/esm/lib/components/cards/cardButton/index.d.ts +5 -11
- package/dist/esm/lib/components/cards/cardButton/index.stories.d.ts +1 -1
- package/dist/esm/lib/components/icon/icons/ArrowRightFilled.d.ts +4 -0
- package/dist/esm/lib/components/icon/icons/index.d.ts +4 -1
- package/dist/esm/lib/components/input/index.d.ts +1 -1
- package/dist/esm/lib/components/input/input.stories.d.ts +1 -1
- package/dist/esm/lib/components/modal/bottomModal/index.d.ts +2 -1
- package/dist/esm/lib/components/modal/genericModal/index.d.ts +20 -0
- package/dist/esm/lib/components/modal/hooks/useOnClose.d.ts +2 -0
- package/dist/esm/lib/components/modal/index.d.ts +4 -3
- package/dist/esm/lib/components/modal/index.stories.d.ts +2 -0
- package/dist/esm/lib/components/modal/regularModal/index.d.ts +2 -1
- package/dist/esm/lib/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/lib/components/{card → cards/card}/index.stories.tsx +12 -5
- package/src/lib/components/{card → cards/card}/index.tsx +19 -6
- package/src/lib/components/{card → cards/card}/style.module.scss +5 -1
- package/src/lib/components/cards/cardButton/index.stories.tsx +11 -15
- package/src/lib/components/cards/cardButton/index.tsx +33 -48
- package/src/lib/components/cards/cardButton/style.module.scss +4 -37
- package/src/lib/components/icon/assets/arrow-right-filled.svg +4 -0
- package/src/lib/components/icon/icons/ArrowRightFilled.tsx +23 -0
- package/src/lib/components/icon/icons/index.ts +4 -1
- package/src/lib/components/modal/bottomModal/index.tsx +18 -78
- package/src/lib/components/modal/bottomModal/style.module.scss +11 -71
- package/src/lib/components/modal/genericModal/index.tsx +133 -0
- package/src/lib/components/modal/genericModal/style.module.scss +71 -0
- package/src/lib/components/modal/hooks/useOnClose.ts +27 -5
- package/src/lib/components/modal/index.stories.tsx +95 -0
- package/src/lib/components/modal/index.ts +4 -2
- package/src/lib/components/modal/regularModal/index.tsx +20 -61
- package/src/lib/components/modal/regularModal/style.module.scss +6 -74
- package/src/lib/index.tsx +1 -1
- package/dist/esm/components/card/index.js.map +0 -1
- package/dist/esm/components/card/index.stories.js.map +0 -1
- package/dist/esm/useOnClose-d818a54f.js +0 -46
- package/dist/esm/useOnClose-d818a54f.js.map +0 -1
- package/src/lib/components/cards/a.stories.mdx +0 -44
- package/src/lib/components/modal/bottomModal/img/close.svg +0 -4
- package/src/lib/components/modal/regularModal/img/close.svg +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/lib/components/card/index.tsx"],"sourcesContent":["import { ComponentProps, ElementType, ReactNode } from 'react';\nimport classNamesUtil from 'classnames';\nimport { ChevronRightIcon } from '../icon';\n\nimport styles from './style.module.scss';\n\nconst cardDefaultAs = 'section' as const\ntype CardDefaultAsType = typeof cardDefaultAs;\ntype DensityType = 'balanced' | 'compact' | 'spacious';\ntype TitleVariantType = 'small' | 'medium' | 'large';\n\ntype CardOwnProps<E extends ElementType = CardDefaultAsType> = {\n as?: E;\n children?: ReactNode;\n classNames?: {\n buttonWrapper?: string;\n wrapper?: string;\n label?: string;\n title?: string;\n description?: string;\n children?: string;\n icon?: string;\n actionIcon?: string;\n };\n density?: DensityType;\n dropShadow?: boolean;\n icon?: ReactNode;\n title?: ReactNode;\n titleVariant?: TitleVariantType;\n description?: ReactNode;\n descriptionVariant?: 'small' | 'large';\n label?: ReactNode;\n onClick?: () => void;\n actionIcon?: ReactNode;\n showActionIcon?: boolean;\n} \n\nexport type CardProps<E extends ElementType = CardDefaultAsType> = CardOwnProps<E> &\n Omit<ComponentProps<E>, keyof CardOwnProps<E>>\n\nconst Card = <E extends ElementType = CardDefaultAsType>({\n as,\n children,\n classNames,\n density = 'balanced',\n description,\n descriptionVariant = 'large',\n dropShadow = true,\n icon,\n label,\n onClick,\n actionIcon,\n title,\n titleVariant = 'large',\n showActionIcon,\n ...rest\n}: CardProps<E>) => {\n const hideActionIcon = typeof actionIcon !== 'undefined' && !actionIcon;\n const propsWithActionIcon = onClick || rest?.href || rest.to; \n const cardDefaultTag = onClick ? 'button' : cardDefaultAs;\n const Tag = as || cardDefaultTag;\n \n return (\n <Tag\n className={classNamesUtil(\n classNames?.buttonWrapper,\n ' d-flex w100 br8 ai-stretch',\n {\n 'c-pointer': propsWithActionIcon,\n [styles.button]: propsWithActionIcon\n },\n )}\n {...onClick && { \n onClick, \n type: \"button\"\n }}\n {...rest}\n >\n <div\n className={classNamesUtil(\n 'd-flex fd-column jc-center br8 bg-white w100 ta-left',\n { 'bs-sm': dropShadow },\n {\n compact: 'p16',\n balanced: 'p24',\n spacious: 'p32',\n }[density as DensityType],\n classNames?.wrapper\n )}\n >\n <div className=\"d-flex w100\">\n {icon && (\n <div\n className={classNamesUtil(\n `d-flex ai-center tc-primary-500`,\n styles.icon,\n styles[`icon${density}`],\n classNames?.icon\n )}\n >\n {icon}\n </div>\n )}\n\n <div className=\"d-flex jc-between w100\">\n <div className=\"d-flex jc-center gap8 fd-column tc-grey-900 w100\">\n {label && (\n <h3 className={classNamesUtil('p-p--small', classNames?.label)}>\n {label}\n </h3>\n )}\n\n {title && (\n <h2\n className={classNamesUtil(\n classNames?.title,\n {\n large: 'p-h3',\n medium: 'p-h4',\n small: 'p-p',\n }[titleVariant as TitleVariantType]\n )}\n >\n {title}\n </h2>\n )}\n\n {description && (\n <div\n className={classNamesUtil(\n 'tc-grey-600',\n classNames?.description,\n descriptionVariant === 'small' ? 'p-p--small' : 'p-p'\n )}\n >\n {description}\n </div>\n )}\n </div>\n\n {(showActionIcon || (propsWithActionIcon && !hideActionIcon)) && (\n <div\n className={classNamesUtil(\n styles.actionIcon,\n classNames?.actionIcon,\n styles[`actionIcon${density}`],\n 'd-flex ai-center'\n )}\n >\n {actionIcon || <ChevronRightIcon size={24} />}\n </div>\n )}\n </div>\n </div>\n\n {children && <div className={classNames?.children}>{children}</div>}\n </div>\n </Tag>\n );\n};\n\nexport { Card };\n"],"names":["classNames","_jsx","classNamesUtil","_jsxs"],"mappings":";;;;;;;;;;;;AAMA,IAAM,aAAa,GAAG,SAAkB,CAAA;IAkClC,IAAI,GAAG,UAA4C,EAgB1C;;IAfb,IAAA,EAAE,QAAA,EACF,QAAQ,cAAA,EACRA,YAAU,gBAAA,EACV,eAAoB,EAApB,OAAO,mBAAG,UAAU,KAAA,EACpB,WAAW,iBAAA,EACX,0BAA4B,EAA5B,kBAAkB,mBAAG,OAAO,KAAA,EAC5B,kBA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,YAAU,CAAE,IAAI,CACjB,gBAEA,IAAI,YACD,CACP;wBAEDG,uBAAK,SAAS,EAAC,wBAAwB,iBACrCA,uBAAK,SAAS,EAAC,kDAAkD,iBAC9D,KAAK,KACJF,qBAAI,SAAS,EAAEC,UAAc,CAAC,YAAY,EAAEF,YAAU,aAAVA,YAAU,uBAAVA,YAAU,CAAE,KAAK,CAAC,gBAC3D,KAAK,YACH,CACN;wCAEA,KAAK,KACJC,qBACE,SAAS,EAAEC,UAAc,CACvBF,YAAU,aAAVA,YAAU,uBAAVA,YAAU,CAAE,KAAK,EACjB;gDACE,KAAK,EAAE,MAAM;gDACb,MAAM,EAAE,MAAM;gDACd,KAAK,EAAE,KAAK;6CACb,CAAC,YAAgC,CAAC,CACpC,gBAEA,KAAK,YACH,CACN;wCAEA,WAAW,KACVC,sBACE,SAAS,EAAEC,UAAc,CACvB,aAAa,EACbF,YAAU,aAAVA,YAAU,uBAAVA,YAAU,CAAE,WAAW,EACvB,kBAAkB,KAAK,OAAO,GAAG,YAAY,GAAG,KAAK,CACtD,gBAEA,WAAW,YACR,CACP,aACG;gCAEL,CAAC,cAAc,KAAK,mBAAmB,IAAI,CAAC,cAAc,CAAC,MAC1DC,sBACE,SAAS,EAAEC,UAAc,CACvB,MAAM,CAAC,UAAU,EACjBF,YAAU,aAAVA,YAAU,uBAAVA,YAAU,CAAE,UAAU,EACtB,MAAM,CAAC,eAAa,OAAS,CAAC,EAC9B,kBAAkB,CACnB,gBAEA,UAAU,IAAIC,IAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,WAAI,YACzC,CACP,aACG,aACF;gBAEL,QAAQ,IAAIA,sBAAK,SAAS,EAAED,YAAU,aAAVA,YAAU,uBAAVA,YAAU,CAAE,QAAQ,gBAAG,QAAQ,YAAO,aAC/D,YACF,EACN;AACJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/card/index.stories.tsx"],"sourcesContent":["import { Card, CardProps } from '.';\nimport { illustrations } from '../../util/images';\nimport { Button } from '../button';\nimport { Badge } from '../badge';\nimport { CheckIcon, InfoIcon, MehIcon, PlusCircleIcon, XIcon } from '../icon';\n\nconst story = {\n title: 'JSX/Card',\n component: Card,\n argTypes: {\n as: {\n control: { type: 'text' },\n description: 'Allow wrapper element type to be custom defined'\n },\n density: {\n description: 'Spacing around the card'\n },\n label: {\n description: 'Content to be rendered as label'\n },\n title: {\n description: 'Content to be rendered as title'\n },\n titleVariant: {\n description: 'Variant that allows changing title sizing styles.'\n },\n description: {\n description: 'Content to be rendered as description'\n },\n descriptionVariant: {\n description: 'Variant that allows changing description sizing styles.'\n },\n icon: {\n description: 'ReactNode to be rendered on the left side of the card',\n },\n children: {\n control: { type: 'text' },\n description: 'Content that is displayed inside the card under the pre-defined props',\n },\n onClick: {\n description: 'On click action to be triggered on card click.',\n },\n dropShadow: {\n description: 'Wether to display card with drop shadow styles or not.',\n },\n actionIcon: {\n control: { type: 'text' },\n description: 'ReactNode to be rendered on the right side of the card when there is an onClick action. By default it renders the ChevronRightIcon.',\n },\n showActionIcon: {\n description: 'Property that always displays action icon even if no onClick is set.',\n },\n },\n args: {\n density: 'balanced',\n description: 'Believe you’re a great fit but can’t find a position listed for your skill set? We’d love to hear from you!',\n descriptionVariant: 'large',\n label: 'Label',\n title: 'Honest, simple insurance',\n titleVariant: 'large',\n icon: 'ABC',\n children: '',\n classNames: {\n wrapper: '',\n label: '',\n title: '',\n description: '',\n children: '',\n icon: ''\n },\n dropShadow: true,\n }\n};\n\nexport const CardStory = ({ \n as,\n actionIcon,\n showActionIcon,\n children,\n classNames,\n density,\n description,\n descriptionVariant,\n dropShadow,\n icon,\n label,\n onClick,\n title,\n titleVariant,\n}: CardProps) => (\n <div className='d-flex p24 bg-grey-200'>\n <Card\n as={as}\n classNames={classNames}\n description={description}\n descriptionVariant={descriptionVariant}\n density={density}\n dropShadow={dropShadow}\n icon={icon}\n label={label}\n title={title}\n titleVariant={titleVariant}\n onClick={onClick}\n actionIcon={actionIcon}\n showActionIcon={showActionIcon}\n >\n {children}\n </Card>\n </div>\n);\n\nCardStory.storyName = \"Card\";\n\nexport const CardAsOtherComponents = () => (\n <div className='d-flex fd-column gap16 p24 bg-grey-200'>\n \n <h3 className='p-h3'>As an anchor:</h3>\n <Card\n as=\"a\"\n href=\"https://feather-insurance.com\"\n target=\"_blank\"\n title=\"Card with an a tag\"\n density='compact'\n />\n\n <h3 className='p-h3'>As a nav:</h3>\n <Card\n as=\"nav\"\n title=\"Card with a nav tag\"\n density='compact'\n />\n\n <p className='p-p p-p--small fw-bold d-flex ai-center gap8 mt32'>\n <InfoIcon />\n Inspect elements to see the different HTML tags being rendered.\n </p>\n </div>\n);\n\nexport const CardDensities = () => (\n <div className='d-flex fd-column gap16 p24 bg-grey-200'>\n <Card\n title={'Card density: Compact'}\n density='compact'\n />\n <Card\n title={'Card density: Balanced'}\n density='balanced'\n />\n <Card\n title={'Card density: Spacious'}\n density='spacious'\n />\n </div>\n);\n\nexport const CardsWithIcons = ({ title }: CardProps) => (\n <div className='d-flex gap16 p24 bg-grey-200'>\n <Card\n icon={\n <img\n alt=\"\"\n src={illustrations.aids}\n width={24}\n />\n }\n title={title}\n />\n <Card\n icon={<MehIcon size={24} noMargin />}\n title={title}\n />\n </div>\n);\n\nexport const CardWithOnClickAction = ({ \n children,\n title,\n}: CardProps) => (\n <div className='d-flex p24 bg-grey-200'>\n <Card\n icon={\n <img\n alt=\"\"\n src={illustrations.aids}\n width={24}\n />\n }\n title={title}\n titleVariant={'medium'}\n onClick={() => {}}\n >\n {children}\n </Card>\n </div>\n);\n\nexport const CardOverridesStyles = ({ \n children,\n label,\n title,\n}: CardProps) => (\n <div className='d-flex p24 bg-grey-200'>\n <Card\n label={label}\n title={title}\n titleVariant={'medium'}\n icon={<PlusCircleIcon color=\"grey-100\" size={32} />}\n classNames={{ \n wrapper: 'bg-grey-700',\n label: 'tc-white',\n title: 'tc-white'\n }}\n >\n {children}\n </Card>\n </div>\n);\n\nexport const CardsWithinCardsAndComplexLayout = () => (\n <div className='d-flex p24 bg-grey-200'>\n <Card\n label={(\n <Badge size='small' variant='success'>\n Active\n </Badge>\n )}\n title={(\n <div className='d-flex jc-between ai-center w100'>\n Coverage overview\n\n <Button\n onClick={() => {}}\n variant='filledGray'\n >\n Full coverage details\n </Button>\n </div>\n )}\n >\n <div className='d-flex gap16 mt16'>\n <Card\n description=\"Lost keys\"\n classNames={{ wrapper: 'bg-grey-300' }}\n icon={<CheckIcon color={'primary-500'} />}\n density='compact'\n />\n <Card\n description=\"Broken glass\"\n classNames={{ wrapper: 'bg-grey-300' }}\n icon={<XIcon color={'primary-500'} />}\n density='compact'\n />\n </div>\n \n <div className='d-flex gap16 mt16'>\n <Card\n description=\"Damage to property\"\n classNames={{ wrapper: 'bg-grey-300' }}\n icon={<CheckIcon color={'primary-500'} />}\n density='compact'\n />\n <Card\n description=\"Drones\"\n classNames={{ wrapper: 'bg-grey-300' }}\n icon={<XIcon color={'primary-500'} />}\n density='compact'\n />\n </div>\n </Card>\n </div>\n);\n\nexport default story;\n"],"names":["_jsx","_jsxs","InfoIcon"],"mappings":";;;;;;;;;;;;;;;;;IAMM,KAAK,GAAG;IACZ,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE;QACR,EAAE,EAAE;YACF,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACzB,WAAW,EAAE,iDAAiD;SAC/D;QACD,OAAO,EAAE;YACP,WAAW,EAAE,yBAAyB;SACvC;QACD,KAAK,EAAE;YACL,WAAW,EAAE,iCAAiC;SAC/C;QACD,KAAK,EAAE;YACL,WAAW,EAAE,iCAAiC;SAC/C;QACD,YAAY,EAAE;YACZ,WAAW,EAAE,mDAAmD;SACjE;QACD,WAAW,EAAE;YACX,WAAW,EAAE,uCAAuC;SACrD;QACD,kBAAkB,EAAE;YAClB,WAAW,EAAE,yDAAyD;SACvE;QACD,IA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,kCAAkC,sCAG/CD,IAAC,MAAM,aACL,OAAO,EAAE,eAAQ,EACjB,OAAO,EAAC,YAAY,mDAGb,aACL,CACP,iBAEDC,uBAAK,SAAS,EAAC,mBAAmB,iBAChCD,IAAC,IAAI,IACH,WAAW,EAAC,WAAW,EACvB,UAAU,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,EACtC,IAAI,EAAEA,IAAC,SAAS,IAAC,KAAK,EAAE,aAAa,WAAI,EACzC,OAAO,EAAC,SAAS,WACjB;oBACFA,IAAC,IAAI,IACH,WAAW,EAAC,cAAc,EAC1B,UAAU,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,EACtC,IAAI,EAAEA,IAAC,KAAK,IAAC,KAAK,EAAE,aAAa,WAAI,EACrC,OAAO,EAAC,SAAS,WACjB,aACE;YAENC,uBAAK,SAAS,EAAC,mBAAmB,iBAChCD,IAAC,IAAI,IACH,WAAW,EAAC,oBAAoB,EAChC,UAAU,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,EACtC,IAAI,EAAEA,IAAC,SAAS,IAAC,KAAK,EAAE,aAAa,WAAI,EACzC,OAAO,EAAC,SAAS,WACjB;oBACFA,IAAC,IAAI,IACH,WAAW,EAAC,QAAQ,EACpB,UAAU,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,EACtC,IAAI,EAAEA,IAAC,KAAK,IAAC,KAAK,EAAE,aAAa,WAAI,EACrC,OAAO,EAAC,SAAS,WACjB,aACE,aACD,YACH;;;;;"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
var useOnClose = function (onClose, isOpen, dismissable) {
|
|
4
|
-
var _a = useState(false), isClosing = _a[0], setIsClosing = _a[1];
|
|
5
|
-
var handleOnClose = useCallback(function () {
|
|
6
|
-
setIsClosing(true);
|
|
7
|
-
setTimeout(function () {
|
|
8
|
-
onClose();
|
|
9
|
-
setIsClosing(false);
|
|
10
|
-
}, 300);
|
|
11
|
-
}, [setIsClosing, onClose]);
|
|
12
|
-
var handleOnOverlayClick = useCallback(function () {
|
|
13
|
-
if (!dismissable) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
handleOnClose();
|
|
17
|
-
}, [dismissable, handleOnClose]);
|
|
18
|
-
var handleEscKey = useCallback(function (e) {
|
|
19
|
-
if (e.code !== 'Escape')
|
|
20
|
-
return;
|
|
21
|
-
if (!dismissable)
|
|
22
|
-
return null;
|
|
23
|
-
if (!isOpen)
|
|
24
|
-
return null;
|
|
25
|
-
handleOnClose();
|
|
26
|
-
}, [isOpen, dismissable, handleOnClose]);
|
|
27
|
-
useEffect(function () {
|
|
28
|
-
window.addEventListener('keydown', handleEscKey);
|
|
29
|
-
return function () {
|
|
30
|
-
window.removeEventListener('keydown', handleEscKey);
|
|
31
|
-
};
|
|
32
|
-
}, [handleEscKey]);
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
document.body.style.overflow = isOpen ? 'hidden' : 'auto';
|
|
35
|
-
return function () {
|
|
36
|
-
document.body.style.overflow = 'auto';
|
|
37
|
-
};
|
|
38
|
-
}, [isOpen]);
|
|
39
|
-
var handleContainerClick = function (e) {
|
|
40
|
-
e.stopPropagation();
|
|
41
|
-
};
|
|
42
|
-
return { isClosing: isClosing, handleContainerClick: handleContainerClick, handleOnClose: handleOnClose, handleOnOverlayClick: handleOnOverlayClick };
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export { useOnClose as u };
|
|
46
|
-
//# sourceMappingURL=useOnClose-d818a54f.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnClose-d818a54f.js","sources":["../../../src/lib/components/modal/hooks/useOnClose.ts"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\n\ninterface OnCloseReturn {\n isClosing: boolean;\n handleContainerClick: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n handleOnClose: () => void;\n handleOnOverlayClick: () => void;\n}\n\nconst useOnClose = (\n onClose: () => void,\n isOpen: boolean,\n dismissable: boolean\n): OnCloseReturn => {\n const [isClosing, setIsClosing] = useState(false);\n\n const handleOnClose = useCallback(() => {\n setIsClosing(true);\n setTimeout(() => {\n onClose();\n setIsClosing(false);\n }, 300);\n }, [setIsClosing, onClose]);\n\n const handleOnOverlayClick = useCallback(() => {\n if (!dismissable) {\n return;\n }\n\n handleOnClose();\n }, [dismissable, handleOnClose]);\n\n const handleEscKey = useCallback(\n (e: KeyboardEvent) => {\n if (e.code !== 'Escape') return;\n if (!dismissable) return null;\n if (!isOpen) return null;\n\n handleOnClose();\n },\n [isOpen, dismissable, handleOnClose]\n );\n\n useEffect(() => {\n window.addEventListener('keydown', handleEscKey);\n\n return () => {\n window.removeEventListener('keydown', handleEscKey);\n };\n }, [handleEscKey]);\n\n useEffect(() => {\n document.body.style.overflow = isOpen ? 'hidden' : 'auto';\n\n return () => {\n document.body.style.overflow = 'auto';\n };\n }, [isOpen]);\n\n const handleContainerClick = (\n e: React.MouseEvent<HTMLDivElement, MouseEvent>\n ) => {\n e.stopPropagation();\n };\n\n return { isClosing, handleContainerClick, handleOnClose, handleOnOverlayClick };\n};\n\nexport default useOnClose;\n"],"names":[],"mappings":";;IASM,UAAU,GAAG,UACjB,OAAmB,EACnB,MAAe,EACf,WAAoB;IAEd,IAAA,KAA4B,QAAQ,CAAC,KAAK,CAAC,EAA1C,SAAS,QAAA,EAAE,YAAY,QAAmB,CAAC;IAElD,IAAM,aAAa,GAAG,WAAW,CAAC;QAChC,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,UAAU,CAAC;YACT,OAAO,EAAE,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;SACrB,EAAE,GAAG,CAAC,CAAC;KACT,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IAE5B,IAAM,oBAAoB,GAAG,WAAW,CAAC;QACvC,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;SACR;QAED,aAAa,EAAE,CAAC;KACjB,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;IAEjC,IAAM,YAAY,GAAG,WAAW,CAC9B,UAAC,CAAgB;QACf,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO;QAChC,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAC9B,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzB,aAAa,EAAE,CAAC;KACjB,EACD,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,CAAC,CACrC,CAAC;IAEF,SAAS,CAAC;QACR,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAEjD,OAAO;YACL,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;SACrD,CAAC;KACH,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,SAAS,CAAC;QACR,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;QAE1D,OAAO;YACL,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;SACvC,CAAC;KACH,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,IAAM,oBAAoB,GAAG,UAC3B,CAA+C;QAE/C,CAAC,CAAC,eAAe,EAAE,CAAC;KACrB,CAAC;IAEF,OAAO,EAAE,SAAS,WAAA,EAAE,oBAAoB,sBAAA,EAAE,aAAa,eAAA,EAAE,oBAAoB,sBAAA,EAAE,CAAC;AAClF;;;;"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
<Meta title="JSX/Cards/Intro" />
|
|
4
|
-
|
|
5
|
-
# Cards
|
|
6
|
-
|
|
7
|
-
Cards are interactive elements that can be used to display an action that a user can take.
|
|
8
|
-
|
|
9
|
-
<Preview>
|
|
10
|
-
<iframe
|
|
11
|
-
width="100%"
|
|
12
|
-
height="450"
|
|
13
|
-
src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FMKs4cbojdVOBKUxv7okb93%2FDirty-Swan-Pattern-Library%3Fnode-id%3D358%253A19"
|
|
14
|
-
allowFullScreen
|
|
15
|
-
/>
|
|
16
|
-
</Preview>
|
|
17
|
-
|
|
18
|
-
# Models
|
|
19
|
-
|
|
20
|
-
## Card Size (xsmall, small, medium, big)
|
|
21
|
-
|
|
22
|
-
The card size can be set with the following properties: `xsmall`, `small`, `medium`, `big`. Depending on the type of card this setting
|
|
23
|
-
affects the font size of the title and card padding.
|
|
24
|
-
|
|
25
|
-
## Card State
|
|
26
|
-
|
|
27
|
-
The card state is an string literral type with the following properties:
|
|
28
|
-
|
|
29
|
-
| state | description |
|
|
30
|
-
| ------------ | -------------------------------------------------------- |
|
|
31
|
-
| `actionable` | User can hover on the card, the cursor is set as pointer |
|
|
32
|
-
| `static` | Card is displayed as is, no hovering. |
|
|
33
|
-
| `muted` | Card is displayed faded, no hovering. |
|
|
34
|
-
|
|
35
|
-
## Icon
|
|
36
|
-
|
|
37
|
-
The icon object is defined with the following poperties
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
export interface Icon {
|
|
41
|
-
src: string; // source of the image
|
|
42
|
-
alt: string; // alternate text if the image can't be displayed
|
|
43
|
-
}
|
|
44
|
-
```
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M18 6L6 18" stroke="#26262E" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
3
|
-
<path d="M6 6L18 18" stroke="#26262E" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M18 6L6 18" stroke="#26262E" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
3
|
-
<path d="M6 6L18 18" stroke="#26262E" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
4
|
-
</svg>
|