@popsure/dirty-swan 0.59.0-beta → 0.59.0-beta-2
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/dist/cjs/index.js +14 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/button/index.d.ts +1 -1
- package/dist/esm/{Calendar-2d7e51b5.js → Calendar-5ad3eccf.js} +2 -2
- package/dist/esm/Calendar-5ad3eccf.js.map +1 -0
- package/dist/esm/{TableSection-3a883ecb.js → TableSection-018d8e8f.js} +1 -1
- package/dist/esm/{TableSection-3a883ecb.js.map → TableSection-018d8e8f.js.map} +1 -1
- package/dist/esm/components/accordion/index.js +2 -2
- package/dist/esm/components/accordion/index.js.map +1 -1
- package/dist/esm/components/button/index.js +4 -5
- package/dist/esm/components/button/index.js.map +1 -1
- package/dist/esm/components/button/index.stories.js +3 -7
- package/dist/esm/components/button/index.stories.js.map +1 -1
- package/dist/esm/components/comparisonTable/components/TableArrows/index.js +1 -1
- package/dist/esm/components/dateSelector/components/Calendar.js +1 -1
- package/dist/esm/components/dateSelector/index.js +1 -1
- package/dist/esm/components/dateSelector/index.stories.js +1 -1
- package/dist/esm/components/dateSelector/index.test.js +1 -1
- package/dist/esm/components/input/index.js +1 -1
- package/dist/esm/components/modal/index.stories.js +7 -7
- package/dist/esm/components/modal/index.stories.js.map +1 -1
- package/dist/esm/components/segmentedControl/index.js +1 -1
- package/dist/esm/components/table/Table.js +1 -1
- package/dist/esm/components/table/Table.stories.js +1 -1
- package/dist/esm/components/table/Table.test.js +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.js +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.test.js +1 -1
- package/dist/esm/components/table/components/TableControls/TableControls.js +4 -3
- package/dist/esm/components/table/components/TableControls/TableControls.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.js +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/components/button/index.d.ts +1 -1
- package/dist/index.css +88 -55
- package/dist/index.css.map +1 -1
- package/dist/lib/scss/private/components/_buttons.scss +105 -63
- package/package.json +1 -1
- package/src/lib/components/accordion/index.tsx +1 -0
- package/src/lib/components/accordion/style.module.scss +0 -4
- package/src/lib/components/button/index.stories.tsx +22 -57
- package/src/lib/components/button/index.tsx +7 -9
- package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +1 -0
- package/src/lib/components/dateSelector/components/Calendar.tsx +1 -1
- package/src/lib/components/input/style.module.scss +1 -1
- package/src/lib/components/modal/index.stories.tsx +23 -23
- package/src/lib/components/segmentedControl/style.module.scss +1 -1
- package/src/lib/components/table/components/TableControls/TableControls.module.scss +6 -1
- package/src/lib/components/table/components/TableControls/TableControls.tsx +10 -2
- package/src/lib/scss/private/components/_buttons.scss +105 -63
- package/dist/esm/Calendar-2d7e51b5.js.map +0 -1
|
@@ -4,19 +4,18 @@ import { c as classNames } from '../../index-6ea95111.js';
|
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
|
|
6
6
|
var buttonTypeClassNameMap = {
|
|
7
|
-
|
|
7
|
+
filledBlack: 'p-btn--secondary-black',
|
|
8
8
|
filledGray: 'p-btn--secondary-grey',
|
|
9
9
|
filledWhite: 'p-btn--secondary-white',
|
|
10
|
-
|
|
11
|
-
textColor: 'p-btn--secondary',
|
|
10
|
+
textBlack: 'p-btn--text-black',
|
|
12
11
|
textWhite: 'p-btn--secondary-inverted',
|
|
13
12
|
outlineWhite: 'p-btn--outline-white',
|
|
14
|
-
|
|
13
|
+
outlineGray: 'p-btn--outline-grey',
|
|
15
14
|
filledError: 'p-btn--danger',
|
|
16
15
|
};
|
|
17
16
|
var buttonDefaultAsType = 'button';
|
|
18
17
|
var Button = React__default.forwardRef(function (_a, ref) {
|
|
19
|
-
var _b = _a.as, ButtonTag = _b === void 0 ? buttonDefaultAsType : _b, className = _a.className, _c = _a.loading, loading = _c === void 0 ? false : _c, children = _a.children, _d = _a.variant, variant = _d === void 0 ? '
|
|
18
|
+
var _b = _a.as, ButtonTag = _b === void 0 ? buttonDefaultAsType : _b, className = _a.className, _c = _a.loading, loading = _c === void 0 ? false : _c, children = _a.children, _d = _a.variant, variant = _d === void 0 ? 'filledBlack' : _d, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, hideLabel = _a.hideLabel, props = __rest(_a, ["as", "className", "loading", "children", "variant", "leftIcon", "rightIcon", "hideLabel"]);
|
|
20
19
|
return (jsx(ButtonTag, __assign({ ref: ref, className: classNames(buttonTypeClassNameMap[variant], className, {
|
|
21
20
|
'p-btn--loading': loading,
|
|
22
21
|
'tc-transparent': loading,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/lib/components/button/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React, { ReactElement, ReactNode } from 'react';\n\ntype ButtonVariant =\n | '
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/lib/components/button/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React, { ReactElement, ReactNode } from 'react';\n\ntype ButtonVariant =\n | 'filledBlack'\n | 'filledGray'\n | 'filledWhite'\n | 'textBlack'\n | 'textWhite'\n | 'outlineGray'\n | 'outlineWhite'\n | 'filledError';\n\nconst buttonTypeClassNameMap: { [K in ButtonVariant]: string } = {\n filledBlack: 'p-btn--secondary-black',\n filledGray: 'p-btn--secondary-grey',\n filledWhite: 'p-btn--secondary-white',\n textBlack: 'p-btn--text-black',\n textWhite: 'p-btn--secondary-inverted',\n outlineWhite: 'p-btn--outline-white',\n outlineGray: 'p-btn--outline-grey',\n filledError: 'p-btn--danger',\n};\n\ntype ButtonProps = {\n as?: React.ElementType\n children: ReactNode;\n variant?: ButtonVariant;\n leftIcon?: ReactElement;\n rightIcon?: ReactElement;\n loading?: boolean;\n hideLabel?: boolean;\n} & Omit<JSX.IntrinsicElements['button'], 'children'>;\n\nconst buttonDefaultAsType = 'button' as const;\ntype ButtonDefaultAsType = typeof buttonDefaultAsType;\n\ntype Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;\ntype IntrinsicElement<E> = E extends PolymorphicButton ? IntrinsicElement<E> : never;\n\ninterface PolymorphicButton {\n <As = ButtonDefaultAsType>(props:\n As extends React.ComponentType<infer P> ? Merge<P, ButtonProps & {\n as?: As;\n }> : As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], ButtonProps & {\n as?: As;\n }> : never): React.ReactElement | null;\n}\n\nconst Button = React.forwardRef((\n {\n as: ButtonTag = buttonDefaultAsType,\n className,\n loading = false,\n children,\n variant = 'filledBlack',\n leftIcon,\n rightIcon,\n hideLabel,\n ...props\n }: ButtonProps,\n ref?: React.ForwardedRef<HTMLButtonElement>\n) => (\n <ButtonTag\n ref={ref}\n className={classNames(\n buttonTypeClassNameMap[variant], \n className, {\n 'p-btn--loading': loading,\n 'tc-transparent': loading,\n 'p-btn--icon-only': hideLabel,\n })}\n data-testid=\"button\"\n {...props}\n >\n {!loading && (leftIcon || rightIcon) ? (\n <div className=\"d-flex jc-center ai-center\">\n {leftIcon && (\n <span\n className={classNames('d-inline-flex', {\n 'mr8': !hideLabel\n })}\n >\n {React.cloneElement(leftIcon, { \n size: 20, \n noMargin: true\n })}\n </span>\n )}\n \n <div className={classNames({\n 'sr-only': hideLabel\n })}\n >\n {children}\n </div>\n\n {rightIcon && (\n <span\n className={classNames('d-inline-flex', {\n 'ml8': !hideLabel\n })}\n >\n {React.cloneElement(rightIcon, { \n size: 20, \n noMargin: true\n })}\n </span>\n )}\n </div>\n ) : children}\n </ButtonTag>\n )\n) as PolymorphicButton;\n\nexport { Button };\nexport type { ButtonProps, ButtonVariant };\n"],"names":["React","_jsx","_jsxs"],"mappings":";;;;;AAaA,IAAM,sBAAsB,GAAqC;IAC/D,WAAW,EAAE,wBAAwB;IACrC,UAAU,EAAE,uBAAuB;IACnC,WAAW,EAAE,wBAAwB;IACrC,SA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AClB,CAAC,YAEDD,cAAK,CAAC,YAAY,CAAC,SAAS,EAAE;wBAC7B,IAAI,EAAE,EAAE;wBACR,QAAQ,EAAE,IAAI;qBACf,CAAC,GACG,CACR,IACG,IACJ,QAAQ,IACF,EACb;CAAA;;;;"}
|
|
@@ -44,7 +44,7 @@ var story = {
|
|
|
44
44
|
args: {
|
|
45
45
|
children: 'Click me',
|
|
46
46
|
disabled: false,
|
|
47
|
-
variant: '
|
|
47
|
+
variant: 'filledBlack',
|
|
48
48
|
loading: false,
|
|
49
49
|
hideLabel: false,
|
|
50
50
|
className: 'wmn3',
|
|
@@ -63,11 +63,7 @@ var ButtonStory = function (_a) {
|
|
|
63
63
|
ButtonStory.storyName = "Button";
|
|
64
64
|
var ButtonVariants = function (_a) {
|
|
65
65
|
var children = _a.children, onClick = _a.onClick;
|
|
66
|
-
return (jsxs("div", { children: [jsx("h3", { className: 'p-h3 mb24', children: "Filled variants" }), jsx("div", { className: 'd-flex gap16 p24 bg-neutral-
|
|
67
|
-
};
|
|
68
|
-
var ButtonOnBackgrounds = function (_a) {
|
|
69
|
-
var onClick = _a.onClick;
|
|
70
|
-
return (jsxs("div", { children: [jsxs("div", { className: 'p24 bg-white br8', children: [jsx("h3", { className: 'p-h3 mb16', children: "On white" }), jsx("div", { className: 'd-flex gap16', children: ["filledColor", "filledGray", "textColor"].map(function (variant) { return (jsx(Button, { onClick: onClick, variant: variant, children: variant }, variant)); }) })] }), jsxs("div", { className: 'p24 bg-neutral-100 br8', children: [jsx("h3", { className: 'p-h3 mb16', children: "On grey" }), jsx("div", { className: 'd-flex gap16', children: ["filledColor", "filledWhite", "textColor"].map(function (variant) { return (jsx(Button, { onClick: onClick, variant: variant, children: variant }, variant)); }) })] }), jsxs("div", { className: 'p24 bg-purple-600 br8', children: [jsx("h3", { className: 'p-h3 mb16 tc-white', children: "On primary" }), jsx("div", { className: 'd-flex gap16', children: ["filledWhite", "outlineWhite", "textWhite"].map(function (variant) { return (jsx(Button, { onClick: onClick, variant: variant, children: variant }, variant)); }) })] })] }));
|
|
66
|
+
return (jsxs("div", { children: [jsx("h3", { className: 'p-h3 mb24', children: "Filled variants" }), jsx("div", { className: 'd-flex gap16 p24 bg-neutral-100 br8', children: ["filledBlack", "filledGray", "filledWhite"].map(function (variant) { return (jsxs("div", { children: [jsx("h4", { className: 'p-h4 mb16', children: variant }), jsx(Button, { onClick: onClick, variant: variant, children: children })] }, variant)); }) }), jsx("h3", { className: 'p-h3 my24', children: "Text variants" }), jsx("div", { className: 'd-flex gap16 p24 bg-neutral-100 br8', children: ["textBlack", "textWhite"].map(function (variant, index) { return (jsxs("div", { className: variant === "textWhite" ? "bg-neutral-800 px32 pb16 br8" : "", children: [jsx("h4", { className: "p-h4 mb16 ".concat(variant === "textWhite" ? "tc-white" : ''), children: variant }), jsx(Button, { onClick: onClick, variant: variant, children: children })] }, variant)); }) }), jsx("h3", { className: 'p-h3 my24', children: "Outline variants" }), jsx("div", { className: 'd-flex gap16 p24 bg-neutral-100 br8', children: ["outlineGray", "outlineWhite"].map(function (variant, index) { return (jsx("div", { className: variant === "outlineWhite" ? "bg-neutral-800 px32 py16 br8" : "px32 py16", children: jsxs("div", { children: [jsx("h4", { className: "p-h4 mb16 ".concat(variant === "outlineWhite" ? "tc-white" : ''), children: variant }), jsx(Button, { onClick: onClick, variant: variant, children: children })] }) }, variant)); }) }), jsx("h3", { className: 'p-h3 my24', children: "State variants" }), jsx("div", { className: 'd-flex gap16 p24 bg-neutral-100 br8', children: jsxs("div", { children: [jsx("h4", { className: 'p-h4 mb16', children: "filledError" }), jsx(Button, { onClick: onClick, variant: "filledError", children: children })] }) })] }));
|
|
71
67
|
};
|
|
72
68
|
var ButtonWithIcons = function (_a) {
|
|
73
69
|
var children = _a.children, onClick = _a.onClick;
|
|
@@ -91,5 +87,5 @@ var ButtonAsOtherComponents = function (_a) {
|
|
|
91
87
|
};
|
|
92
88
|
|
|
93
89
|
export default story;
|
|
94
|
-
export { ButtonAsOtherComponents, ButtonDisabled, ButtonLoading,
|
|
90
|
+
export { ButtonAsOtherComponents, ButtonDisabled, ButtonLoading, ButtonStory, ButtonVariants, ButtonWithIconOnly, ButtonWithIcons };
|
|
95
91
|
//# sourceMappingURL=index.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/button/index.stories.tsx"],"sourcesContent":["import { ElementType } from 'react';\nimport { Button, ButtonProps, ButtonVariant } from '.';\nimport { InfoIcon, PlusIcon, SendIcon } from '../icon';\n\nconst story = {\n title: 'JSX/Button',\n component: Button,\n argTypes: {\n as: {\n control: { type: 'text' },\n description: 'Allow wrapper element type to be custom defined'\n },\n children: {\n control: 'text',\n description: 'Text that is displayed inside the button. Hidden when hideLabel is set as true',\n },\n variant: {\n description: 'Variant that defines the style of the Button',\n },\n leftIcon: {\n description: 'Icon to be displayed on the left side of the button. This makes use of [dirty swan Icon component](http://localhost:9009/?path=/docs/jsx-icon--icon-story).',\n },\n rightIcon: {\n description: 'Icon to be displayed on the right side of the button. This makes use of [dirty swan Icon component](http://localhost:9009/?path=/docs/jsx-icon--icon-story).',\n },\n loading: {\n description: 'Show button on a loading state.',\n },\n hideLabel: {\n description: 'Show button as an icon only button. This hides the label but still keeps it for accessibility purposes.',\n },\n className: {\n type: 'text',\n description: 'Class name for most top parent element',\n },\n },\n args: {\n children: 'Click me',\n disabled: false,\n variant: 'filledColor',\n loading: false,\n hideLabel: false,\n className: 'wmn3',\n },\n parameters: {\n design: {\n url: 'https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FMKs4cbojdVOBKUxv7okb93%2FDirty-Swan-Pattern-Library%3Fnode-id%3D251%253A26',\n type: 'figma'\n },\n },\n};\n\nexport const ButtonStory = ({\n className,\n loading = false,\n children,\n variant,\n hideLabel,\n leftIcon,\n rightIcon,\n disabled,\n}: ButtonProps) => (\n <div className='wmx6'>\n <Button\n className={className}\n loading={loading}\n variant={variant}\n hideLabel={hideLabel}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n disabled={disabled}\n >\n {children}\n </Button>\n </div>\n);\n\nButtonStory.storyName = \"Button\";\n\nexport const ButtonVariants = ({ children, onClick }: ButtonProps) => (\n <div>\n <h3 className='p-h3 mb24'>Filled variants</h3>\n <div className='d-flex gap16 p24 bg-neutral-300 br8'>\n {[ \"filledColor\", \"filledGray\", \"filledWhite\", \"filledBlack\"].map((variant) => (\n <div key={variant}>\n <h4 className='p-h4 mb16'>\n {variant}\n </h4>\n\n <Button onClick={onClick} variant={variant as ButtonVariant}>\n {children}\n </Button>\n </div>\n ))}\n </div>\n\n <h3 className='p-h3 my24'>Text variants</h3>\n <div className='d-flex gap16 p24 bg-neutral-300 br8'>\n {[\"textColor\", \"textWhite\"].map((variant, index) => (\n <div key={variant} className={variant === \"textWhite\" ? \"bg-purple-600 px32 br8\" : \"\"}>\n <h4 className={`p-h4 mb16 ${variant === \"textWhite\" ? \"tc-white\" : ''}`}>\n {variant}\n </h4>\n\n <Button onClick={onClick} variant={variant as ButtonVariant}>\n {children}\n </Button>\n </div>\n ))}\n </div>\n\n <h3 className='p-h3 my24'>Outline variants</h3>\n <div className='d-flex gap16 p24 bg-purple-600 br8'>\n <div>\n <h4 className='p-h4 mb16 tc-white'>\n outlineWhite\n </h4>\n\n <Button onClick={onClick} variant={'outlineWhite'}>\n {children}\n </Button>\n </div>\n </div>\n \n <h3 className='p-h3 my24'>State variants</h3>\n <div className='d-flex gap16 p24 bg-neutral-300 br8'>\n {[\"filledSuccess\", \"filledError\"].map((variant) => (\n <div key={variant}>\n <h4 className='p-h4 mb16'>\n {variant}\n </h4>\n\n <Button onClick={onClick} variant={variant as ButtonVariant}>\n {children}\n </Button>\n </div>\n ))}\n </div>\n </div>\n);\n\nexport const ButtonOnBackgrounds = ({ onClick }: ButtonProps) => (\n <div>\n <div className='p24 bg-white br8'>\n <h3 className='p-h3 mb16'>On white</h3>\n <div className='d-flex gap16'>\n {[ \"filledColor\", \"filledGray\", \"textColor\"].map((variant) => (\n <Button key={variant} onClick={onClick} variant={variant as ButtonVariant}>\n {variant}\n </Button>\n ))}\n </div>\n </div>\n\n <div className='p24 bg-neutral-100 br8'>\n <h3 className='p-h3 mb16'>On grey</h3>\n <div className='d-flex gap16'>\n {[ \"filledColor\", \"filledWhite\", \"textColor\"].map((variant) => (\n <Button key={variant} onClick={onClick} variant={variant as ButtonVariant}>\n {variant}\n </Button>\n ))}\n </div>\n </div>\n\n <div className='p24 bg-purple-600 br8'>\n <h3 className='p-h3 mb16 tc-white'>On primary</h3>\n <div className='d-flex gap16'>\n {[\"filledWhite\", \"outlineWhite\", \"textWhite\"].map((variant) => (\n <Button key={variant} onClick={onClick} variant={variant as ButtonVariant}>\n {variant}\n </Button>\n ))}\n </div>\n </div>\n </div>\n);\n\nexport const ButtonWithIcons = ({ children, onClick }: ButtonProps) => (\n <div className='d-flex gap16'>\n <Button leftIcon={<SendIcon />} onClick={onClick}>\n {children}\n </Button>\n <Button rightIcon={<SendIcon />} onClick={onClick}>\n {children}\n </Button>\n </div>\n);\n\nexport const ButtonWithIconOnly = ({ children, onClick }: ButtonProps) => (\n <Button leftIcon={<PlusIcon />} hideLabel onClick={onClick}>\n {children}\n </Button>\n);\n\nexport const ButtonLoading = ({ children, onClick }: ButtonProps) => (\n <Button loading onClick={onClick}>\n {children}\n </Button>\n);\n\nexport const ButtonDisabled = ({ children, onClick }: ButtonProps) => (\n <Button disabled onClick={onClick}>\n {children}\n </Button>\n);\n\nexport const ButtonAsOtherComponents = ({ children, as, onClick }: ButtonProps) => (\n <div className='d-flex fd-column gap16 p24 bg-neutral-100'>\n <h3 className='p-h3'>As an anchor:</h3>\n <Button as=\"a\" href=\"https://feather-insurance.com\" target=\"_blank\">\n {children}\n </Button>\n\n <h3 className='p-h3'>As a button:</h3>\n <Button as=\"button\" onClick={onClick}>\n {children}\n </Button>\n\n <h3 className='p-h3'>As a h3:</h3>\n <Button as=\"h3\">\n {children}\n </Button>\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 default story;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;IAIM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE;QACR,EAAE,EAAE;YACF,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACzB,WAAW,EAAE,iDAAiD;SAC/D;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,gFAAgF;SAC9F;QACD,OAAO,EAAE;YACP,WAAW,EAAE,8CAA8C;SAC5D;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,6JAA6J;SAC3K;QACD,SAAS,EAAE;YACT,WAAW,EAAE,8JAA8J;SAC5K;QACD,OAAO,EAAE;YACP,WAAW,EAAE,iCAAiC;SAC/C;QACD,SAAS,EAAE;YACT,WAAW,EAAE,yGAAyG;SACvH;QACD,SAAS,EAAE;YACT,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,wCAAwC;SACtD;KACF;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,aAAa;QACtB,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,MAAM;KAClB;IACD,UAAU,EAAE;QACV,MAAM,EAAE;YACN,GAAG,EAAE,kKAAkK;YACvK,IAAI,EAAE,OAAO;SACd;KACF;EACD;IAEW,WAAW,GAAG,UAAC,EASd;QARZ,SAAS,eAAA,EACT,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EACf,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,QAAQ,cAAA;IACS,QACjBA,aAAK,SAAS,EAAC,MAAM,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AA2C,aACxDD,YAAI,SAAS,EAAC,MAAM,8BAAmB,EACrCA,IAAC,MAAM,IAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAC,+BAA+B,EAAC,MAAM,EAAC,QAAQ,YAChE,QAAQ,GACF,EAEbA,YAAI,SAAS,EAAC,MAAM,6BAAkB,EACpCA,IAAC,MAAM,IAAC,EAAE,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YACjC,QAAQ,GACF,EAEXA,YAAI,SAAS,EAAC,MAAM,yBAAc,EAChCA,IAAC,MAAM,IAAC,EAAE,EAAC,IAAI,YACZ,QAAQ,GACF,EAETC,YAAG,SAAS,EAAC,mDAAmD,aAC9DD,IAAC,QAAQ,KAAG,uEAEV,IACA;AArB2E;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/button/index.stories.tsx"],"sourcesContent":["import { ElementType } from 'react';\nimport { Button, ButtonProps, ButtonVariant } from '.';\nimport { InfoIcon, PlusIcon, SendIcon } from '../icon';\n\nconst story = {\n title: 'JSX/Button',\n component: Button,\n argTypes: {\n as: {\n control: { type: 'text' },\n description: 'Allow wrapper element type to be custom defined'\n },\n children: {\n control: 'text',\n description: 'Text that is displayed inside the button. Hidden when hideLabel is set as true',\n },\n variant: {\n description: 'Variant that defines the style of the Button',\n },\n leftIcon: {\n description: 'Icon to be displayed on the left side of the button. This makes use of [dirty swan Icon component](http://localhost:9009/?path=/docs/jsx-icon--icon-story).',\n },\n rightIcon: {\n description: 'Icon to be displayed on the right side of the button. This makes use of [dirty swan Icon component](http://localhost:9009/?path=/docs/jsx-icon--icon-story).',\n },\n loading: {\n description: 'Show button on a loading state.',\n },\n hideLabel: {\n description: 'Show button as an icon only button. This hides the label but still keeps it for accessibility purposes.',\n },\n className: {\n type: 'text',\n description: 'Class name for most top parent element',\n },\n },\n args: {\n children: 'Click me',\n disabled: false,\n variant: 'filledBlack',\n loading: false,\n hideLabel: false,\n className: 'wmn3',\n },\n parameters: {\n design: {\n url: 'https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FMKs4cbojdVOBKUxv7okb93%2FDirty-Swan-Pattern-Library%3Fnode-id%3D251%253A26',\n type: 'figma'\n },\n },\n};\n\nexport const ButtonStory = ({\n className,\n loading = false,\n children,\n variant,\n hideLabel,\n leftIcon,\n rightIcon,\n disabled,\n}: ButtonProps) => (\n <div className='wmx6'>\n <Button\n className={className}\n loading={loading}\n variant={variant}\n hideLabel={hideLabel}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n disabled={disabled}\n >\n {children}\n </Button>\n </div>\n);\n\nButtonStory.storyName = \"Button\";\n\nexport const ButtonVariants = ({ children, onClick }: ButtonProps) => (\n <div>\n <h3 className='p-h3 mb24'>Filled variants</h3>\n <div className='d-flex gap16 p24 bg-neutral-100 br8'>\n {[ \"filledBlack\", \"filledGray\", \"filledWhite\"].map((variant) => (\n <div key={variant}>\n <h4 className='p-h4 mb16'>\n {variant}\n </h4>\n\n <Button onClick={onClick} variant={variant as ButtonVariant}>\n {children}\n </Button>\n </div>\n ))}\n </div>\n\n <h3 className='p-h3 my24'>Text variants</h3>\n <div className='d-flex gap16 p24 bg-neutral-100 br8'>\n {[\"textBlack\", \"textWhite\"].map((variant, index) => (\n <div key={variant} className={variant === \"textWhite\" ? \"bg-neutral-800 px32 pb16 br8\" : \"\"}>\n <h4 className={`p-h4 mb16 ${variant === \"textWhite\" ? \"tc-white\" : ''}`}>\n {variant}\n </h4>\n\n <Button onClick={onClick} variant={variant as ButtonVariant}>\n {children}\n </Button>\n </div>\n ))}\n </div>\n\n <h3 className='p-h3 my24'>Outline variants</h3>\n <div className='d-flex gap16 p24 bg-neutral-100 br8'>\n {[\"outlineGray\", \"outlineWhite\"].map((variant, index) => (\n <div key={variant} className={variant === \"outlineWhite\" ? \"bg-neutral-800 px32 py16 br8\" : \"px32 py16\"}>\n <div>\n <h4 className={`p-h4 mb16 ${variant === \"outlineWhite\" ? \"tc-white\" : ''}`}>\n {variant}\n </h4>\n\n <Button onClick={onClick} variant={variant as ButtonVariant}>\n {children}\n </Button>\n </div>\n </div>\n ))}\n </div>\n \n <h3 className='p-h3 my24'>State variants</h3>\n <div className='d-flex gap16 p24 bg-neutral-100 br8'>\n <div>\n <h4 className='p-h4 mb16'>\n filledError\n </h4>\n\n <Button onClick={onClick} variant=\"filledError\">\n {children}\n </Button>\n </div>\n </div>\n </div>\n);\n\nexport const ButtonWithIcons = ({ children, onClick }: ButtonProps) => (\n <div className='d-flex gap16'>\n <Button leftIcon={<SendIcon />} onClick={onClick}>\n {children}\n </Button>\n <Button rightIcon={<SendIcon />} onClick={onClick}>\n {children}\n </Button>\n </div>\n);\n\nexport const ButtonWithIconOnly = ({ children, onClick }: ButtonProps) => (\n <Button leftIcon={<PlusIcon />} hideLabel onClick={onClick}>\n {children}\n </Button>\n);\n\nexport const ButtonLoading = ({ children, onClick }: ButtonProps) => (\n <Button loading onClick={onClick}>\n {children}\n </Button>\n);\n\nexport const ButtonDisabled = ({ children, onClick }: ButtonProps) => (\n <Button disabled onClick={onClick}>\n {children}\n </Button>\n);\n\nexport const ButtonAsOtherComponents = ({ children, as, onClick }: ButtonProps) => (\n <div className='d-flex fd-column gap16 p24 bg-neutral-100'>\n <h3 className='p-h3'>As an anchor:</h3>\n <Button as=\"a\" href=\"https://feather-insurance.com\" target=\"_blank\">\n {children}\n </Button>\n\n <h3 className='p-h3'>As a button:</h3>\n <Button as=\"button\" onClick={onClick}>\n {children}\n </Button>\n\n <h3 className='p-h3'>As a h3:</h3>\n <Button as=\"h3\">\n {children}\n </Button>\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 default story;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;IAIM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,MAAM;IACjB,QAAQ,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BAAuB,GAAG,UAAC,EAAsC;QAApC,QAAQ,cAAA,OAAI,MAAE,OAAO;IAAoB,QACjFC,cAAK,SAAS,EAAC,2CAA2C,aACxDD,YAAI,SAAS,EAAC,MAAM,8BAAmB,EACrCA,IAAC,MAAM,IAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAC,+BAA+B,EAAC,MAAM,EAAC,QAAQ,YAChE,QAAQ,GACF,EAEbA,YAAI,SAAS,EAAC,MAAM,6BAAkB,EACpCA,IAAC,MAAM,IAAC,EAAE,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YACjC,QAAQ,GACF,EAEXA,YAAI,SAAS,EAAC,MAAM,yBAAc,EAChCA,IAAC,MAAM,IAAC,EAAE,EAAC,IAAI,YACZ,QAAQ,GACF,EAETC,YAAG,SAAS,EAAC,mDAAmD,aAC9DD,IAAC,QAAQ,KAAG,uEAEV,IACA;AArB2E;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { c as classNames } from '../../../../index-6ea95111.js';
|
|
|
3
3
|
import ArrowIcon from './Arrow.js';
|
|
4
4
|
import { s as styleInject } from '../../../../style-inject.es-1f59c1d0.js';
|
|
5
5
|
|
|
6
|
-
var css_248z = ".style-module_container__3BxOi {\n position: absolute;\n width: 100%;\n height: 100%;\n padding: 0 16px;\n justify-content: space-between;\n align-items: stretch;\n display: flex;\n}\n@media (min-width: 34rem) {\n .style-module_container__3BxOi {\n display: none;\n }\n}\n\n.style-module_next__3yJsi {\n transform: rotate(-90deg);\n}\n\n.style-module_prev__3rIR_ {\n transform: rotate(90deg);\n}\n\n.style-module_arrow__1tlbD {\n width: 32px;\n height: 56px;\n z-index: 3;\n padding: 0;\n border-radius: 8px;\n background-color: #f7f7fd;\n justify-content: center;\n align-items: center;\n stroke: #b8b8c0;\n}\n.style-module_arrow__1tlbD:hover, .style-module_arrow__1tlbD:focus {\n background-color: #f7f7fd;\n cursor: not-allowed;\n}\n\n.style-module_active__2kklB {\n stroke: #26262e;\n}\n.style-module_active__2kklB:hover, .style-module_active__2kklB:focus {\n background-color: #f7f7fd;\n cursor: pointer;\n}\n\n.style-module_noPointerEvents__21KuB {\n pointer-events: none;\n}";
|
|
6
|
+
var css_248z = ".style-module_container__3BxOi {\n position: absolute;\n width: 100%;\n height: 100%;\n padding: 0 16px;\n justify-content: space-between;\n align-items: stretch;\n display: flex;\n}\n@media (min-width: 34rem) {\n .style-module_container__3BxOi {\n display: none;\n }\n}\n\n.style-module_next__3yJsi {\n transform: rotate(-90deg);\n}\n\n.style-module_prev__3rIR_ {\n transform: rotate(90deg);\n}\n\n.style-module_arrow__1tlbD {\n width: 32px;\n height: 56px;\n z-index: 3;\n padding: 0;\n border-radius: 8px;\n background-color: #f7f7fd;\n justify-content: center;\n align-items: center;\n stroke: #b8b8c0;\n}\n.style-module_arrow__1tlbD:hover, .style-module_arrow__1tlbD:focus {\n background-color: #f7f7fd;\n cursor: not-allowed;\n}\n\n.style-module_active__2kklB {\n stroke: #26262e;\n}\n.style-module_active__2kklB:hover, .style-module_active__2kklB:focus {\n background-color: #f7f7fd;\n cursor: pointer;\n}\n\n.style-module_noPointerEvents__21KuB {\n visibility: hidden;\n pointer-events: none;\n}";
|
|
7
7
|
var styles = {"container":"style-module_container__3BxOi","next":"style-module_next__3yJsi","prev":"style-module_prev__3rIR_","arrow":"style-module_arrow__1tlbD","active":"style-module_active__2kklB","noPointerEvents":"style-module_noPointerEvents__21KuB"};
|
|
8
8
|
styleInject(css_248z);
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'react/jsx-runtime';
|
|
2
2
|
import 'react';
|
|
3
|
-
export { C as Calendar } from '../../../Calendar-
|
|
3
|
+
export { C as Calendar } from '../../../Calendar-5ad3eccf.js';
|
|
4
4
|
import '../../icon/icons/Calendar.js';
|
|
5
5
|
import '../../button/index.js';
|
|
6
6
|
import '../../../_commonjsHelpers-4730bd53.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as __assign } from '../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useRef, useState, useEffect } from 'react';
|
|
4
|
-
import { a as dayjs, C as Calendar } from '../../Calendar-
|
|
4
|
+
import { a as dayjs, C as Calendar } from '../../Calendar-5ad3eccf.js';
|
|
5
5
|
import { c as commonjsGlobal } from '../../_commonjsHelpers-4730bd53.js';
|
|
6
6
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
import { Input } from '../input/index.js';
|
|
@@ -2,7 +2,7 @@ import { jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { DateSelector } from './index.js';
|
|
4
4
|
import { c as commonjsGlobal } from '../../_commonjsHelpers-4730bd53.js';
|
|
5
|
-
import { d as dayjs_min } from '../../Calendar-
|
|
5
|
+
import { d as dayjs_min } from '../../Calendar-5ad3eccf.js';
|
|
6
6
|
import '../../tslib.es6-a39f91fc.js';
|
|
7
7
|
import '../../style-inject.es-1f59c1d0.js';
|
|
8
8
|
import '../input/index.js';
|
|
@@ -6,7 +6,7 @@ import 'react';
|
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../_commonjsHelpers-4730bd53.js';
|
|
8
8
|
import 'react-dom/test-utils';
|
|
9
|
-
import '../../Calendar-
|
|
9
|
+
import '../../Calendar-5ad3eccf.js';
|
|
10
10
|
import '../icon/icons/Calendar.js';
|
|
11
11
|
import '../icon/IconWrapper/IconWrapper.js';
|
|
12
12
|
import '../../index-6ea95111.js';
|
|
@@ -5,7 +5,7 @@ import { c as classNames } from '../../index-6ea95111.js';
|
|
|
5
5
|
import { g as generateId } from '../../index-69a46657.js';
|
|
6
6
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
|
|
8
|
-
var css_248z = ".style-module_container__2L4SP {\n position: relative;\n}\n\n.style-module_prefix__3jAFZ {\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--ds-neutral-600);\n transition: top 0.3s, color 0.3s;\n}\n.style-module_prefix--with-value__2QiEA {\n color: var(--ds-neutral-900);\n}\n.style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n.style-module_prefix--disabled__2-gcw {\n color: var(--ds-neutral-700);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_placeholder__1U2z0,\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0,\n.style-module_input--with-inside-label__253bZ ~ .style-module_placeholder__1U2z0 {\n top: 7px;\n left: 16px;\n transform: translateY(0);\n font-size: 10px;\n line-height: 12px;\n opacity: 1;\n}\n\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0 {\n color: var(--ds-
|
|
8
|
+
var css_248z = ".style-module_container__2L4SP {\n position: relative;\n}\n\n.style-module_prefix__3jAFZ {\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--ds-neutral-600);\n transition: top 0.3s, color 0.3s;\n}\n.style-module_prefix--with-value__2QiEA {\n color: var(--ds-neutral-900);\n}\n.style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n.style-module_prefix--disabled__2-gcw {\n color: var(--ds-neutral-700);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_placeholder__1U2z0,\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0,\n.style-module_input--with-inside-label__253bZ ~ .style-module_placeholder__1U2z0 {\n top: 7px;\n left: 16px;\n transform: translateY(0);\n font-size: 10px;\n line-height: 12px;\n opacity: 1;\n}\n\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0 {\n color: var(--ds-neutral-900);\n}\n.style-module_input__1eJO5:focus ~ .style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\ninput:focus ~ .style-module_prefix__3jAFZ {\n color: var(--ds-neutral-900);\n}\ninput:focus ~ .style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_prefix__3jAFZ,\n.style-module_input__1eJO5:focus ~ .style-module_prefix__3jAFZ {\n top: 28px;\n}\n\n.style-module_input--with-inside-label__253bZ ~ .style-module_prefix__3jAFZ,\n.style-module_input--with-inside-label__253bZ:focus ~ .style-module_prefix__3jAFZ,\n.style-module_input--with-inside-label__253bZ:not(:placeholder-shown) ~ .style-module_prefix__3jAFZ {\n top: 29px;\n}\n\n.style-module_input__1eJO5 {\n box-sizing: border-box;\n padding-top: 9px;\n font-family: inherit;\n}\n.style-module_input--no-placeholder__3EGwh {\n padding-top: 0px;\n}\n.style-module_input--with-prefix__38e0j {\n padding-left: 32px !important;\n}\n.style-module_input--with-inside-label__253bZ {\n padding-top: 9px;\n}\n\n.style-module_placeholder__1U2z0 {\n position: absolute;\n pointer-events: none;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n transition: 0.3s ease all;\n color: var(--ds-neutral-600);\n}\n.style-module_placeholder--with-prefix__2PquQ {\n left: 32px;\n}\n.style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\n.style-module_label__3FEZ1 {\n display: inline-block;\n margin-bottom: 8px;\n color: var(--ds-neutral-700);\n}\n.style-module_label--with-error__166bP {\n color: var(--ds-red-500);\n}\n\n.style-module_error__167Zc {\n margin-top: 4px;\n}";
|
|
9
9
|
var styles = {"container":"style-module_container__2L4SP","prefix":"style-module_prefix__3jAFZ","prefix--with-value":"style-module_prefix--with-value__2QiEA","prefix--with-error":"style-module_prefix--with-error__1yTTM","prefix--disabled":"style-module_prefix--disabled__2-gcw","input":"style-module_input__1eJO5","placeholder":"style-module_placeholder__1U2z0","input--with-inside-label":"style-module_input--with-inside-label__253bZ","placeholder--with-error":"style-module_placeholder--with-error__2ieRU","input--no-placeholder":"style-module_input--no-placeholder__3EGwh","input--with-prefix":"style-module_input--with-prefix__38e0j","placeholder--with-prefix":"style-module_placeholder--with-prefix__2PquQ","label":"style-module_label__3FEZ1","label--with-error":"style-module_label--with-error__166bP","error":"style-module_error__167Zc"};
|
|
10
10
|
styleInject(css_248z);
|
|
11
11
|
|
|
@@ -100,7 +100,7 @@ var BottomOrRegularModalStory = function (_a) {
|
|
|
100
100
|
onClose();
|
|
101
101
|
setDisplay(false);
|
|
102
102
|
};
|
|
103
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
103
|
+
return (jsxs(Fragment, { children: [jsx(Button, { className: "wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { dismissible: dismissible, className: className, classNames: classNames, title: title, isOpen: display, size: size, onModalScroll: onModalScroll, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
104
104
|
};
|
|
105
105
|
BottomOrRegularModalStory.storyName = 'BottomOrRegularModal';
|
|
106
106
|
var RegularModalStory = function (_a) {
|
|
@@ -110,7 +110,7 @@ var RegularModalStory = function (_a) {
|
|
|
110
110
|
onClose();
|
|
111
111
|
setDisplay(false);
|
|
112
112
|
};
|
|
113
|
-
return (jsxs(Fragment, { children: ["Regular modals are primary meant to be used on Desktop or Tablet environment. The modal will appear in the middle of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Mobile only, you should check BottomModal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(
|
|
113
|
+
return (jsxs(Fragment, { children: ["Regular modals are primary meant to be used on Desktop or Tablet environment. The modal will appear in the middle of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Mobile only, you should check BottomModal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(RegularModal, { title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
114
114
|
};
|
|
115
115
|
RegularModalStory.storyName = 'RegularModal';
|
|
116
116
|
var BottomModalStory = function (_a) {
|
|
@@ -120,7 +120,7 @@ var BottomModalStory = function (_a) {
|
|
|
120
120
|
onClose();
|
|
121
121
|
setDisplay(false);
|
|
122
122
|
};
|
|
123
|
-
return (jsxs(Fragment, { children: ["Bottom modals are primary meant to be used on Mobile environment. The modal will appear from the bottom of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Desktop only, you should check Regular modal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(
|
|
123
|
+
return (jsxs(Fragment, { children: ["Bottom modals are primary meant to be used on Mobile environment. The modal will appear from the bottom of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Desktop only, you should check Regular modal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomModal, { title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
124
124
|
};
|
|
125
125
|
BottomModalStory.storyName = 'BottomModal';
|
|
126
126
|
var FullScreenModalStory = function (_a) {
|
|
@@ -130,7 +130,7 @@ var FullScreenModalStory = function (_a) {
|
|
|
130
130
|
onClose();
|
|
131
131
|
setDisplay(false);
|
|
132
132
|
};
|
|
133
|
-
return (jsxs(Fragment, { children: ["Full screen modals are primary meant to be used as blocker screens. The modal will cover the entire screen and the user will be able to dismiss them using the top left \"X\" icon.", jsx(
|
|
133
|
+
return (jsxs(Fragment, { children: ["Full screen modals are primary meant to be used as blocker screens. The modal will cover the entire screen and the user will be able to dismiss them using the top left \"X\" icon.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(FullScreenModal, { title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
134
134
|
};
|
|
135
135
|
FullScreenModalStory.storyName = 'FullScreenModal';
|
|
136
136
|
var NonDismissibleModal = function (_a) {
|
|
@@ -140,7 +140,7 @@ var NonDismissibleModal = function (_a) {
|
|
|
140
140
|
onClose();
|
|
141
141
|
setDisplay(false);
|
|
142
142
|
};
|
|
143
|
-
return (jsxs(Fragment, { children: ["Setting the dismissible prop to false will hide the close button and prevent the user from closing it using the escape key or clicking outside. This prop can be useful if we want the user to explicitly interact with the modal options.", jsx("strong", { children: "Warning:" }), " a modal with the dismissible prop can only be closed by changing the isOpen prop to false.", jsx(
|
|
143
|
+
return (jsxs(Fragment, { children: ["Setting the dismissible prop to false will hide the close button and prevent the user from closing it using the escape key or clicking outside. This prop can be useful if we want the user to explicitly interact with the modal options.", jsx("strong", { children: "Warning:" }), " a modal with the dismissible prop can only be closed by changing the isOpen prop to false.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { dismissible: false, title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
144
144
|
};
|
|
145
145
|
var ModalWithFooter = function (_a) {
|
|
146
146
|
var children = _a.children, isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title;
|
|
@@ -149,7 +149,7 @@ var ModalWithFooter = function (_a) {
|
|
|
149
149
|
onClose();
|
|
150
150
|
setDisplay(false);
|
|
151
151
|
};
|
|
152
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
152
|
+
return (jsxs(Fragment, { children: [jsx(Button, { className: "wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: jsxs("div", { className: "d-flex fd-row gap8", children: [jsx(Button, { variant: "textBlack", className: "w100", onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: "w100", onClick: handleOnClose, children: "Continue" })] }), children: jsx("div", { className: "p24", children: jsx("div", { children: children }) }) })] }));
|
|
153
153
|
};
|
|
154
154
|
var ModalWithFooterAndScroll = function (_a) {
|
|
155
155
|
var children = _a.children, isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title;
|
|
@@ -158,7 +158,7 @@ var ModalWithFooterAndScroll = function (_a) {
|
|
|
158
158
|
onClose();
|
|
159
159
|
setDisplay(false);
|
|
160
160
|
};
|
|
161
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
161
|
+
return (jsxs(Fragment, { children: [jsx(Button, { className: "wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: jsxs("div", { className: "d-flex fd-row gap8", children: [jsx(Button, { variant: "textBlack", className: "w100", onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: "w100", onClick: handleOnClose, children: "Continue" })] }), children: jsx("div", { className: "p24", children: jsxs("div", { children: ["Lorem ipsum dolor sit amet, consectetur adipiscing elit.", jsx("div", { style: { height: '840px' } }), children] }) }) })] }));
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
export default story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/modal/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { BottomModal, BottomOrRegularModal, Props, RegularModal } from '.';\nimport { Button } from '../button';\nimport { FullScreenModal } from './fullScreenModal';\n\nconst story = {\n title: 'JSX/Modals',\n component: BottomOrRegularModal,\n argTypes: {\n title: {\n description: 'The title that needs to be displayed on the modal',\n },\n isOpen: {\n description:\n 'When set to `true`, the modal is displayed. When set to `false` the modal gets removed',\n },\n dismissible: {\n description: 'The content that gets displayed on the modal',\n },\n className: {\n description: 'Any additional className',\n },\n classNames: {\n description:\n 'Class names for the Modal component and its children elements',\n },\n size: {\n description: 'The size of the modal, either large or default.',\n control: 'radio',\n options: {\n default: 'default',\n large: 'large',\n },\n },\n children: {\n description: 'The content that gets displayed on the modal',\n type: 'text',\n table: {\n type: {\n summary: 'ReactNode',\n },\n },\n },\n onClose: {\n description: 'Callback when the user close the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n onModalScroll: {\n description: 'Callback when the user scroll the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n },\n args: {\n title: 'Modal title',\n isOpen: false,\n dismissible: true,\n className: '',\n classNames: {\n wrapper: '',\n container: '',\n overlay: '',\n header: '',\n closeButton: '',\n closeButtonIcon: '',\n title: '',\n body: '',\n footer: '',\n },\n children: 'Modal content to be displayed',\n size: 'default',\n },\n parameters: {\n componentSubtitle:\n 'Bottom or Regular modal will automatically choose what’s best to display based on the users screen width.',\n docs: {\n description: {\n component:\n 'Modals are dialog overlays that prevent the user from interacting with the rest of the website until an action is taken or the dialog is dismissed. Modals are purposefully disruptive and should be used thoughtfully and sparingly.',\n },\n },\n },\n};\n\nexport const BottomOrRegularModalStory = ({\n children,\n className,\n classNames,\n dismissible,\n isOpen,\n onClose,\n onModalScroll,\n size,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n dismissible={dismissible}\n className={className}\n classNames={classNames}\n title={title}\n isOpen={display}\n size={size}\n onModalScroll={onModalScroll}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nBottomOrRegularModalStory.storyName = 'BottomOrRegularModal';\n\nexport const RegularModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Regular modals are primary meant to be used on Desktop or Tablet\n environment. The modal will appear in the middle of the screen and the\n user will be able to dismiss them using the top left \"X\" icon. If you want\n to use it for Mobile only, you should check BottomModal instead. Want to\n use either Regular Modal or Bottom Modal based on the screen width? You\n can use Bottom or Regular modal.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <RegularModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </RegularModal>\n </>\n );\n};\n\nRegularModalStory.storyName = 'RegularModal';\n\nexport const BottomModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Bottom modals are primary meant to be used on Mobile environment. The\n modal will appear from the bottom of the screen and the user will be able\n to dismiss them using the top left \"X\" icon. If you want to use it for\n Desktop only, you should check Regular modal instead. Want to use either\n Regular Modal or Bottom Modal based on the screen width? You can use\n Bottom or Regular modal.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <BottomModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomModal>\n </>\n );\n};\n\nBottomModalStory.storyName = 'BottomModal';\n\nexport const FullScreenModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Full screen modals are primary meant to be used as blocker screens. The\n modal will cover the entire screen and the user will be able to dismiss\n them using the top left \"X\" icon.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <FullScreenModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </FullScreenModal>\n </>\n );\n};\n\nFullScreenModalStory.storyName = 'FullScreenModal';\n\nexport const NonDismissibleModal = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Setting the dismissible prop to false will hide the close button and\n prevent the user from closing it using the escape key or clicking outside.\n This prop can be useful if we want the user to explicitly interact with\n the modal options.\n <strong>Warning:</strong> a modal with the dismissible prop can only be\n closed by changing the isOpen prop to false.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <BottomOrRegularModal\n dismissible={false}\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooter = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textColor\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>{children}</div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooterAndScroll = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textColor\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n <div style={{ height: '840px' }} />\n {children}\n </div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,WAA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,EACN,OAAO,aAAA,EACP,KAAK,WAAA;IAEC,IAAA,KAAwB,QAAQ,CAAC,MAAM,CAAC,EAAvC,OAAO,QAAA,EAAE,UAAU,QAAoB,CAAC;IAC/C,IAAM,aAAa,GAAG;QACpB,OAAO,EAAE,CAAC;QACV,UAAU,CAAC,KAAK,CAAC,CAAC;KACnB,CAAC;IAEF,QACED,4BACEC,gBACE,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,GAAA,oCAGxB,EAETA,IAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,aAAa,EACtB,MAAM,EACJD,cAAK,SAAS,EAAC,oBAAoB,aACjCC,IAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,aAAa,qBAGf,EACTA,IAAC,MAAM,IAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,aAAa,yBAEtC,IACL,YAGRA,aAAK,SAAS,EAAC,KAAK,YAClBD,qFAEEC,aAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,EAClC,QAAQ,IACL,GACF,GACe,IACtB,EACH;AACJ;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/modal/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { BottomModal, BottomOrRegularModal, Props, RegularModal } from '.';\nimport { Button } from '../button';\nimport { FullScreenModal } from './fullScreenModal';\n\nconst story = {\n title: 'JSX/Modals',\n component: BottomOrRegularModal,\n argTypes: {\n title: {\n description: 'The title that needs to be displayed on the modal',\n },\n isOpen: {\n description:\n 'When set to `true`, the modal is displayed. When set to `false` the modal gets removed',\n },\n dismissible: {\n description: 'The content that gets displayed on the modal',\n },\n className: {\n description: 'Any additional className',\n },\n classNames: {\n description:\n 'Class names for the Modal component and its children elements',\n },\n size: {\n description: 'The size of the modal, either large or default.',\n control: 'radio',\n options: {\n default: 'default',\n large: 'large',\n },\n },\n children: {\n description: 'The content that gets displayed on the modal',\n type: 'text',\n table: {\n type: {\n summary: 'ReactNode',\n },\n },\n },\n onClose: {\n description: 'Callback when the user close the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n onModalScroll: {\n description: 'Callback when the user scroll the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n },\n args: {\n title: 'Modal title',\n isOpen: false,\n dismissible: true,\n className: '',\n classNames: {\n wrapper: '',\n container: '',\n overlay: '',\n header: '',\n closeButton: '',\n closeButtonIcon: '',\n title: '',\n body: '',\n footer: '',\n },\n children: 'Modal content to be displayed',\n size: 'default',\n },\n parameters: {\n componentSubtitle:\n 'Bottom or Regular modal will automatically choose what’s best to display based on the users screen width.',\n docs: {\n description: {\n component:\n 'Modals are dialog overlays that prevent the user from interacting with the rest of the website until an action is taken or the dialog is dismissed. Modals are purposefully disruptive and should be used thoughtfully and sparingly.',\n },\n },\n },\n};\n\nexport const BottomOrRegularModalStory = ({\n children,\n className,\n classNames,\n dismissible,\n isOpen,\n onClose,\n onModalScroll,\n size,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <Button\n className=\"wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n\n <BottomOrRegularModal\n dismissible={dismissible}\n className={className}\n classNames={classNames}\n title={title}\n isOpen={display}\n size={size}\n onModalScroll={onModalScroll}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nBottomOrRegularModalStory.storyName = 'BottomOrRegularModal';\n\nexport const RegularModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Regular modals are primary meant to be used on Desktop or Tablet\n environment. The modal will appear in the middle of the screen and the\n user will be able to dismiss them using the top left \"X\" icon. If you want\n to use it for Mobile only, you should check BottomModal instead. Want to\n use either Regular Modal or Bottom Modal based on the screen width? You\n can use Bottom or Regular modal.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <RegularModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </RegularModal>\n </>\n );\n};\n\nRegularModalStory.storyName = 'RegularModal';\n\nexport const BottomModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Bottom modals are primary meant to be used on Mobile environment. The\n modal will appear from the bottom of the screen and the user will be able\n to dismiss them using the top left \"X\" icon. If you want to use it for\n Desktop only, you should check Regular modal instead. Want to use either\n Regular Modal or Bottom Modal based on the screen width? You can use\n Bottom or Regular modal.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <BottomModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomModal>\n </>\n );\n};\n\nBottomModalStory.storyName = 'BottomModal';\n\nexport const FullScreenModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Full screen modals are primary meant to be used as blocker screens. The\n modal will cover the entire screen and the user will be able to dismiss\n them using the top left \"X\" icon.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <FullScreenModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </FullScreenModal>\n </>\n );\n};\n\nFullScreenModalStory.storyName = 'FullScreenModal';\n\nexport const NonDismissibleModal = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Setting the dismissible prop to false will hide the close button and\n prevent the user from closing it using the escape key or clicking outside.\n This prop can be useful if we want the user to explicitly interact with\n the modal options.\n <strong>Warning:</strong> a modal with the dismissible prop can only be\n closed by changing the isOpen prop to false.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <BottomOrRegularModal\n dismissible={false}\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooter = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <Button\n className=\"wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textBlack\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>{children}</div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooterAndScroll = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <Button\n className=\"wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textBlack\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n <div style={{ height: '840px' }} />\n {children}\n </div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,WAAW,EAAE,mDAAmD;SACjE;QACD,MAAM,EAAE;YACN,WAAW,EACT,wFAAwF;SAC3F;QACD,WAAW,EAAE;YACX,WAAW,EAAE,8CAA8C;SAC5D;QACD,SAAS,EAAE;YACT,WAAW,EAAE,0BAA0B;SACxC;QACD,UAAU,EAAE;YACV,WAAW,EACT,+DAA+D;SAClE;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;YAC9D,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;gBAClB,KAAK,EAAE,OAAO;aACf;SACF;QACD,QAAQ,EAAE;Y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CAGxB,EAETA,IAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,aAAa,EACtB,MAAM,EACJD,cAAK,SAAS,EAAC,oBAAoB,aACjCC,IAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,aAAa,qBAGf,EACTA,IAAC,MAAM,IAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,aAAa,yBAEtC,IACL,YAGRA,aAAK,SAAS,EAAC,KAAK,YAClBD,qFAEEC,aAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,EAClC,QAAQ,IACL,GACF,GACe,IACtB,EACH;AACJ;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
4
4
|
|
|
5
|
-
var css_248z = ".style-module_background-container__2Gjka {\n position: relative;\n display: inline-block;\n background-color: var(--ds-
|
|
5
|
+
var css_248z = ".style-module_background-container__2Gjka {\n position: relative;\n display: inline-block;\n background-color: var(--ds-purple-100);\n border-radius: 8px;\n padding: 0 8px;\n}\n\n.style-module_chip-container__7XeKn {\n display: flex;\n align-items: center;\n}\n\n.style-module_chip__3rgLT {\n cursor: pointer;\n z-index: 2;\n padding-left: 16px;\n padding-right: 16px;\n}\n.style-module_chip__3rgLT:focus {\n outline-color: var(--ds-purple-600);\n outline-offset: 2px;\n}\n\n.style-module_select-chip-background__YCAyw {\n position: absolute;\n background-color: white;\n border-radius: 8px;\n top: 8px;\n z-index: 1;\n transition: width 0.3s, left 0.3s;\n}";
|
|
6
6
|
var styles = {"background-container":"style-module_background-container__2Gjka","chip-container":"style-module_chip-container__7XeKn","chip":"style-module_chip__3rgLT","select-chip-background":"style-module_select-chip-background__YCAyw"};
|
|
7
7
|
styleInject(css_248z);
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ import { TableContents } from './components/TableContents/TableContents.js';
|
|
|
12
12
|
import { c as classNames } from '../../index-6ea95111.js';
|
|
13
13
|
import { u as useTableNavigation } from '../../useTableNavigation-f929fbc9.js';
|
|
14
14
|
import { TableControls } from './components/TableControls/TableControls.js';
|
|
15
|
-
import { i as isBaseCell, T as TableSection } from '../../TableSection-
|
|
15
|
+
import { i as isBaseCell, T as TableSection } from '../../TableSection-018d8e8f.js';
|
|
16
16
|
import { u as useScrollSync } from '../../useScrollSync-b2d28bed.js';
|
|
17
17
|
import './components/TableCell/BaseCell/BaseCell.js';
|
|
18
18
|
import '../icon/icons/CheckThick.js';
|
|
@@ -37,7 +37,7 @@ import '../icon/icons/ChevronDown.js';
|
|
|
37
37
|
import '../icon/icons/ChevronUp.js';
|
|
38
38
|
import '../../useMediaQuery-1a3a2432.js';
|
|
39
39
|
import './components/TableContents/TableContents.js';
|
|
40
|
-
import '../../TableSection-
|
|
40
|
+
import '../../TableSection-018d8e8f.js';
|
|
41
41
|
import './components/TableContents/Collapsible.js';
|
|
42
42
|
import '../../useTableNavigation-f929fbc9.js';
|
|
43
43
|
import './components/TableControls/TableControls.js';
|
|
@@ -37,7 +37,7 @@ import '../icon/icons/ChevronDown.js';
|
|
|
37
37
|
import '../icon/icons/ChevronUp.js';
|
|
38
38
|
import '../../useMediaQuery-1a3a2432.js';
|
|
39
39
|
import './components/TableContents/TableContents.js';
|
|
40
|
-
import '../../TableSection-
|
|
40
|
+
import '../../TableSection-018d8e8f.js';
|
|
41
41
|
import './components/TableContents/Collapsible.js';
|
|
42
42
|
import '../../useTableNavigation-f929fbc9.js';
|
|
43
43
|
import './components/TableControls/TableControls.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as __assign, _ as __spreadArray } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { T as TableSection } from '../../../../TableSection-
|
|
4
|
+
import { T as TableSection } from '../../../../TableSection-018d8e8f.js';
|
|
5
5
|
import ChevronDownIcon from '../../../icon/icons/ChevronDown.js';
|
|
6
6
|
import ChevronUpIcon from '../../../icon/icons/ChevronUp.js';
|
|
7
7
|
import { Card } from '../../../cards/card/index.js';
|
|
@@ -6,7 +6,7 @@ import 'react';
|
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../../../_commonjsHelpers-4730bd53.js';
|
|
8
8
|
import 'react-dom/test-utils';
|
|
9
|
-
import '../../../../TableSection-
|
|
9
|
+
import '../../../../TableSection-018d8e8f.js';
|
|
10
10
|
import '../../../../index-6ea95111.js';
|
|
11
11
|
import '../../../../style-inject.es-1f59c1d0.js';
|
|
12
12
|
import '../TableCell/TableCell.js';
|
|
@@ -8,13 +8,14 @@ import 'react';
|
|
|
8
8
|
import '../../../icon/IconWrapper/IconWrapper.js';
|
|
9
9
|
import '../../../../tslib.es6-a39f91fc.js';
|
|
10
10
|
|
|
11
|
-
var css_248z = ".TableControls-module_stickyHeader__1f6Ta {\n display: flex;\n position: sticky;\n left: 0;\n right: 0;\n min-height: 72px;\n z-index: 9;\n}\n\n.TableControls-module_controlButton__2kQiG {\n width: 32px;\n height: 100%;\n padding: 0;\n min-width: 32px;\n}";
|
|
12
|
-
var styles = {"stickyHeader":"TableControls-module_stickyHeader__1f6Ta","controlButton":"TableControls-module_controlButton__2kQiG"};
|
|
11
|
+
var css_248z = ".TableControls-module_stickyHeader__1f6Ta {\n display: flex;\n position: sticky;\n left: 0;\n right: 0;\n min-height: 72px;\n z-index: 9;\n}\n\n.TableControls-module_controlButton__2kQiG {\n width: 32px;\n height: 100%;\n padding: 0;\n min-width: 32px;\n}\n.TableControls-module_controlButtonHidden__1YsHA {\n visibility: hidden;\n pointer-events: none;\n}";
|
|
12
|
+
var styles = {"stickyHeader":"TableControls-module_stickyHeader__1f6Ta","controlButton":"TableControls-module_controlButton__2kQiG","controlButtonHidden":"TableControls-module_controlButtonHidden__1YsHA"};
|
|
13
13
|
styleInject(css_248z);
|
|
14
14
|
|
|
15
15
|
var TableControls = function (_a) {
|
|
16
|
+
var _b, _c;
|
|
16
17
|
var activeSection = _a.activeSection, children = _a.children, columnsLength = _a.columnsLength, stickyHeaderTopOffset = _a.stickyHeaderTopOffset, navigateTable = _a.navigateTable;
|
|
17
|
-
return (jsxs("div", { "aria-hidden": true, className: classNames('d-flex ai-stretch jc-between bg-white px8', styles.stickyHeader), style: { top: "".concat(stickyHeaderTopOffset, "px") }, children: [jsx("div", { className: 'py24', children: jsx(Button, { className: classNames('br8', styles.controlButton), disabled: activeSection <= 1, hideLabel: true, leftIcon: jsx(ChevronLeftIcon, {}), onClick: function () { return navigateTable(); }, type: "button", variant: "filledGray", "data-testid": "previous-section-button", style: { height: '100%' }, children: "Previous section" }) }), children, jsx("div", { className: 'py24', children: jsx(Button, { className: classNames('br8', styles.controlButton), disabled: activeSection >= columnsLength - 1, hideLabel: true, leftIcon: jsx(ChevronRightIcon, {}), onClick: function () { return navigateTable(true); }, type: "button", variant: "filledGray", "data-testid": "next-section-button", children: "Next section" }) })] }));
|
|
18
|
+
return (jsxs("div", { "aria-hidden": true, className: classNames('d-flex ai-stretch jc-between bg-white px8', styles.stickyHeader), style: { top: "".concat(stickyHeaderTopOffset, "px") }, children: [jsx("div", { className: 'py24', children: jsx(Button, { className: classNames((_b = {}, _b[styles.controlButtonHidden] = activeSection <= 1, _b), 'br8', styles.controlButton), disabled: activeSection <= 1, hideLabel: true, leftIcon: jsx(ChevronLeftIcon, {}), onClick: function () { return navigateTable(); }, type: "button", variant: "filledGray", "data-testid": "previous-section-button", style: { height: '100%' }, children: "Previous section" }) }), children, jsx("div", { className: 'py24', children: jsx(Button, { className: classNames((_c = {}, _c[styles.controlButtonHidden] = activeSection >= columnsLength - 1, _c), 'br8', styles.controlButton), disabled: activeSection >= columnsLength - 1, hideLabel: true, leftIcon: jsx(ChevronRightIcon, {}), onClick: function () { return navigateTable(true); }, type: "button", variant: "filledGray", "data-testid": "next-section-button", children: "Next section" }) })] }));
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export { TableControls };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableControls.js","sources":["../../../../../../../src/lib/components/table/components/TableControls/TableControls.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { ChevronLeftIcon, ChevronRightIcon } from '../../../icon';\nimport styles from './TableControls.module.scss';\nimport { Button } from '../../../button';\nimport classNames from 'classnames';\n\nexport interface TableControlsProps {\n activeSection: number;\n children: ReactNode;\n columnsLength: number;\n stickyHeaderTopOffset: number;\n navigateTable: (next?: boolean) => void;\n}\n\nconst TableControls = ({\n activeSection,\n children,\n columnsLength,\n stickyHeaderTopOffset,\n navigateTable,\n}: TableControlsProps) => {\n return (\n <div\n aria-hidden\n className={classNames(\n 'd-flex ai-stretch jc-between bg-white px8',\n styles.stickyHeader\n )}\n style={{ top: `${stickyHeaderTopOffset}px` }}\n >\n <div className='py24'>\n <Button\n className={classNames('br8'
|
|
1
|
+
{"version":3,"file":"TableControls.js","sources":["../../../../../../../src/lib/components/table/components/TableControls/TableControls.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { ChevronLeftIcon, ChevronRightIcon } from '../../../icon';\nimport styles from './TableControls.module.scss';\nimport { Button } from '../../../button';\nimport classNames from 'classnames';\n\nexport interface TableControlsProps {\n activeSection: number;\n children: ReactNode;\n columnsLength: number;\n stickyHeaderTopOffset: number;\n navigateTable: (next?: boolean) => void;\n}\n\nconst TableControls = ({\n activeSection,\n children,\n columnsLength,\n stickyHeaderTopOffset,\n navigateTable,\n}: TableControlsProps) => {\n return (\n <div\n aria-hidden\n className={classNames(\n 'd-flex ai-stretch jc-between bg-white px8',\n styles.stickyHeader\n )}\n style={{ top: `${stickyHeaderTopOffset}px` }}\n >\n <div className='py24'>\n <Button\n className={classNames(\n { [styles.controlButtonHidden]: activeSection <= 1 },\n 'br8',\n styles.controlButton\n )}\n disabled={activeSection <= 1}\n hideLabel\n leftIcon={<ChevronLeftIcon />}\n onClick={() => navigateTable()}\n type=\"button\"\n variant=\"filledGray\"\n data-testid=\"previous-section-button\"\n style={{ height: '100%' }}\n >\n Previous section\n </Button>\n </div>\n\n {children}\n\n <div className='py24'>\n <Button\n className={classNames(\n { [styles.controlButtonHidden]: activeSection >= columnsLength - 1 },\n 'br8',\n styles.controlButton\n )}\n disabled={activeSection >= columnsLength - 1}\n hideLabel\n leftIcon={<ChevronRightIcon />}\n onClick={() => navigateTable(true)}\n type=\"button\"\n variant=\"filledGray\"\n data-testid=\"next-section-button\"\n >\n Next section\n </Button>\n </div>\n </div>\n );\n};\n\nexport { TableControls };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;IAcM,aAAa,GAAG,UAAC,EAMF;;QALnB,aAAa,mBAAA,EACb,QAAQ,cAAA,EACR,aAAa,mBAAA,EACb,qBAAqB,2BAAA,EACrB,aAAa,mBAAA;IAEb,QACEA,mCAEE,SAAS,EAAE,UAAU,CACnB,2CAA2C,EAC3C,MAAM,CAAC,YAAY,CACpB,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,UAAG,qBAAqB,OAAI,EAAE,aAE5CC,aAAK,SAAS,EAAC,MAAM,YACnBA,IAAC,MAAM,IACL,SAAS,EAAE,UAAU,WACjB,GAAC,MAAM,CAAC,mBAAmB,IAAG,aAAa,IAAI,CAAC,OAClD,KAAK,EACL,MAAM,CAAC,aAAa,CACrB,EACD,QAAQ,EAAE,aAAa,IAAI,CAAC,EAC5B,SAAS,QACT,QAAQ,EAAEA,IAAC,eAAe,KAAG,EAC7B,OAAO,EAAE,cAAM,OAAA,aAAa,EAAE,GAAA,EAC9B,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,YAAY,iBACR,yBAAyB,EACrC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,iCAGlB,GACL,EAEL,QAAQ,EAETA,aAAK,SAAS,EAAC,MAAM,YACnBA,IAAC,MAAM,IACL,SAAS,EAAE,UAAU,WACjB,GAAC,MAAM,CAAC,mBAAmB,IAAG,aAAa,IAAI,aAAa,GAAG,CAAC,OAClE,KAAK,EACL,MAAM,CAAC,aAAa,CACrB,EACD,QAAQ,EAAE,aAAa,IAAI,aAAa,GAAG,CAAC,EAC5C,SAAS,QACT,QAAQ,EAAEA,IAAC,gBAAgB,KAAG,EAC9B,OAAO,EAAE,cAAM,OAAA,aAAa,CAAC,IAAI,CAAC,GAAA,EAClC,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,YAAY,iBACR,qBAAqB,6BAG1B,GACL,IACF,EACN;AACJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import '../../../../index-6ea95111.js';
|
|
4
|
-
export { T as TableSection } from '../../../../TableSection-
|
|
4
|
+
export { T as TableSection } from '../../../../TableSection-018d8e8f.js';
|
|
5
5
|
import '../TableCell/TableCell.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../../../useMediaQuery-1a3a2432.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as __assign } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { c as customRender, s as screen } from '../../../../customRender-be47569b.js';
|
|
4
|
-
import { T as TableSection } from '../../../../TableSection-
|
|
4
|
+
import { T as TableSection } from '../../../../TableSection-018d8e8f.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../../../_commonjsHelpers-4730bd53.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -32,7 +32,7 @@ export { Accordion } from './components/accordion/index.js';
|
|
|
32
32
|
export { Table } from './components/table/Table.js';
|
|
33
33
|
import { useCallback, useEffect } from 'react';
|
|
34
34
|
export { u as useMediaQuery } from './useMediaQuery-1a3a2432.js';
|
|
35
|
-
export { u as useOnClickOutside } from './Calendar-
|
|
35
|
+
export { u as useOnClickOutside } from './Calendar-5ad3eccf.js';
|
|
36
36
|
export { LogoColor } from './components/logo/LogoColor.js';
|
|
37
37
|
export { LogoWhite } from './components/logo/LogoWhite.js';
|
|
38
38
|
export { LogoBlack } from './components/logo/LogoBlack.js';
|
|
@@ -466,7 +466,7 @@ import './components/table/components/IconRenderer/IconRenderer.js';
|
|
|
466
466
|
import './components/table/components/TableCell/CardCell/CardCell.js';
|
|
467
467
|
import './components/table/components/TableCell/ButtonCell/ButtonCell.js';
|
|
468
468
|
import './components/table/components/TableContents/TableContents.js';
|
|
469
|
-
import './TableSection-
|
|
469
|
+
import './TableSection-018d8e8f.js';
|
|
470
470
|
import './components/table/components/TableContents/Collapsible.js';
|
|
471
471
|
import './useTableNavigation-f929fbc9.js';
|
|
472
472
|
import './components/table/components/TableControls/TableControls.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
-
type ButtonVariant = '
|
|
2
|
+
type ButtonVariant = 'filledBlack' | 'filledGray' | 'filledWhite' | 'textBlack' | 'textWhite' | 'outlineGray' | 'outlineWhite' | 'filledError';
|
|
3
3
|
type ButtonProps = {
|
|
4
4
|
as?: React.ElementType;
|
|
5
5
|
children: ReactNode;
|