@onewelcome/react-lib-components 6.2.0 → 6.3.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/dist/cjs/Notifications/Dialog/Dialog.cjs.js +1 -1
- package/dist/cjs/Notifications/Dialog/Dialog.cjs.js.map +1 -1
- package/dist/cjs/Notifications/Dialog/DialogTitle/DialogTitle.cjs.js +1 -1
- package/dist/cjs/Notifications/Dialog/DialogTitle/DialogTitle.cjs.js.map +1 -1
- package/dist/cjs/Notifications/Dialog/DialogTitle/DialogTitle.module.cjs.js +1 -1
- package/dist/cjs/src/components/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +1 -0
- package/dist/esm/Notifications/Dialog/Dialog.esm.js +1 -1
- package/dist/esm/Notifications/Dialog/Dialog.esm.js.map +1 -1
- package/dist/esm/Notifications/Dialog/DialogTitle/DialogTitle.esm.js +1 -1
- package/dist/esm/Notifications/Dialog/DialogTitle/DialogTitle.esm.js.map +1 -1
- package/dist/esm/Notifications/Dialog/DialogTitle/DialogTitle.module.esm.js +1 -1
- package/dist/esm/src/components/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +1 -0
- package/package.json +19 -19
- package/src/components/Notifications/Dialog/Dialog.tsx +7 -4
- package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss +18 -1
- package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx +33 -20
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var t=require("../BaseModal/BaseModal.cjs.js");var a=require("../BaseModal/BaseModalContent/BaseModalContent.cjs.js");var o=require("./DialogActions/DialogActions.cjs.js");var n=require("./Dialog.module.cjs.js");var l=require("./DialogTitle/DialogTitle.cjs.js");var r=require("../../Button/Button.cjs.js");var i=require("../BaseModal/BaseModalContext.cjs.js");var s=require("../../src/util/helper.cjs.js");function c(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var u=c(e);const d=({id:c,open:d,children:f,onClose:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var t=require("../BaseModal/BaseModal.cjs.js");var a=require("../BaseModal/BaseModalContent/BaseModalContent.cjs.js");var o=require("./DialogActions/DialogActions.cjs.js");var n=require("./Dialog.module.cjs.js");var l=require("./DialogTitle/DialogTitle.cjs.js");var r=require("../../Button/Button.cjs.js");var i=require("../BaseModal/BaseModalContext.cjs.js");var s=require("../../src/util/helper.cjs.js");function c(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var u=c(e);const d=({id:c,open:d,children:f,onClose:j,title:p,primaryAction:m,secondaryAction:v,cancelAction:B,zIndex:g,titleIcon:y,caption:D,...M},q)=>{const[C]=e.useState(c!==null&&c!==void 0?c:s.generateID(20));const{label:b,...A}=m;const E=u["default"].createElement(r.Button,{key:"primary",...A},b);const I=v&&function(){const{label:e,...t}=v;return u["default"].createElement(r.Button,{key:"tertiary",variant:"outline",...t},e)}();const h=e=>{if(e.key==="Enter")m.onClick()};return u["default"].createElement(t.BaseModal,{...M,ref:q,id:C,className:n["default"]["dialog"],containerProps:{className:n["default"]["container"]},open:d,onClose:j,zIndex:g},u["default"].createElement(l.DialogTitle,{titleIcon:y,caption:D,id:i.labelId(C),title:p,onClose:j}),u["default"].createElement(a.BaseModalContent,{id:i.descriptionId(C),className:n["default"]["content"],disableAutoFocus:true},f),u["default"].createElement(o.DialogActions,{onClose:j,cancelAction:B},[I,E]),u["default"].createElement("input",{autoFocus:true,"aria-hidden":true,style:{position:"absolute",width:0,height:0,opacity:0},maxLength:0,tabIndex:-1,onKeyDown:h}))};const f=u["default"].forwardRef(d);exports.Dialog=f;
|
|
2
2
|
//# sourceMappingURL=Dialog.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.cjs.js","sources":["../../../../../../src/components/Notifications/Dialog/Dialog.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef, useState } from \"react\";\nimport { BaseModal } from \"../BaseModal/BaseModal\";\nimport { BaseModalContent } from \"../BaseModal/BaseModalContent/BaseModalContent\";\nimport { DialogActions } from \"./DialogActions/DialogActions\";\nimport classes from \"./Dialog.module.scss\";\nimport { DialogTitle } from \"./DialogTitle/DialogTitle\";\nimport { Button, Props as ButtonProps } from \"../../Button/Button\";\nimport { labelId, descriptionId } from \"../BaseModal/BaseModalContext\";\nimport { generateID } from \"../../../util/helper\";\nimport { CancelAction } from \"../BaseModal/BaseModalActions/BaseModalActions\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id?: string;\n open: boolean;\n children: React.ReactNode;\n onClose: () => void;\n title: string;\n primaryAction: Action;\n secondaryAction?: Action;\n cancelAction?: CancelAction;\n zIndex?: number;\n disableEscapeKeyDown?: boolean;\n titleIcon?: React.ReactNode;\n caption?: string;\n}\n\nexport interface Action extends Omit<ButtonProps, \"variant\" | \"ref\"> {\n label: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => unknown;\n}\n\nconst DialogComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n id,\n open,\n children,\n onClose,\n title,\n primaryAction,\n secondaryAction,\n cancelAction,\n zIndex,\n
|
|
1
|
+
{"version":3,"file":"Dialog.cjs.js","sources":["../../../../../../src/components/Notifications/Dialog/Dialog.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef, useState } from \"react\";\nimport { BaseModal } from \"../BaseModal/BaseModal\";\nimport { BaseModalContent } from \"../BaseModal/BaseModalContent/BaseModalContent\";\nimport { DialogActions } from \"./DialogActions/DialogActions\";\nimport classes from \"./Dialog.module.scss\";\nimport { DialogTitle } from \"./DialogTitle/DialogTitle\";\nimport { Button, Props as ButtonProps } from \"../../Button/Button\";\nimport { labelId, descriptionId } from \"../BaseModal/BaseModalContext\";\nimport { generateID } from \"../../../util/helper\";\nimport { CancelAction } from \"../BaseModal/BaseModalActions/BaseModalActions\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id?: string;\n open: boolean;\n children: React.ReactNode;\n onClose: () => void;\n title: string;\n primaryAction: Action;\n secondaryAction?: Action;\n cancelAction?: CancelAction;\n zIndex?: number;\n disableEscapeKeyDown?: boolean;\n titleIcon?: React.ReactNode;\n caption?: string;\n}\n\nexport interface Action extends Omit<ButtonProps, \"variant\" | \"ref\"> {\n label: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => unknown;\n}\n\nconst DialogComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n id,\n open,\n children,\n onClose,\n title,\n primaryAction,\n secondaryAction,\n cancelAction,\n zIndex,\n titleIcon,\n caption,\n ...rest\n }: Props,\n ref\n) => {\n const [dialogId] = useState(id ?? generateID(20));\n const { label: primaryLabel, ...restOfPrimaryAction } = primaryAction;\n const PrimaryButton = (\n <Button key=\"primary\" {...restOfPrimaryAction}>\n {primaryLabel}\n </Button>\n );\n\n const SecondaryButton =\n secondaryAction &&\n (function () {\n const { label: secondaryLabel, ...restOfSecondaryAction } = secondaryAction;\n return (\n <Button key=\"tertiary\" variant=\"outline\" {...restOfSecondaryAction}>\n {secondaryLabel}\n </Button>\n );\n })();\n\n const onHiddenInputKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n /** It has to be here because then we will need to check if user doesn't click tab to select action button and want to do another action then primary one? */\n if (event.key === \"Enter\") {\n primaryAction.onClick();\n }\n };\n\n return (\n <BaseModal\n {...rest}\n ref={ref}\n id={dialogId}\n className={classes[\"dialog\"]}\n containerProps={{ className: classes[\"container\"] }}\n open={open}\n onClose={onClose}\n zIndex={zIndex}\n >\n <DialogTitle\n titleIcon={titleIcon}\n caption={caption}\n id={labelId(dialogId)}\n title={title}\n onClose={onClose}\n />\n <BaseModalContent\n id={descriptionId(dialogId)}\n className={classes[\"content\"]}\n disableAutoFocus\n >\n {children}\n </BaseModalContent>\n <DialogActions onClose={onClose} cancelAction={cancelAction}>\n {[SecondaryButton, PrimaryButton]}\n </DialogActions>\n <input\n autoFocus\n aria-hidden={true}\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n opacity: 0\n }}\n maxLength={0}\n tabIndex={-1}\n onKeyDown={onHiddenInputKeyPress}\n />\n </BaseModal>\n );\n};\n\nexport const Dialog = React.forwardRef(DialogComponent);\n"],"names":["DialogComponent","id","open","children","onClose","title","primaryAction","secondaryAction","cancelAction","zIndex","titleIcon","caption","rest","ref","dialogId","useState","generateID","label","primaryLabel","restOfPrimaryAction","PrimaryButton","React","createElement","Button","key","SecondaryButton","secondaryLabel","restOfSecondaryAction","variant","onHiddenInputKeyPress","event","onClick","BaseModal","className","classes","containerProps","DialogTitle","labelId","BaseModalContent","descriptionId","disableAutoFocus","DialogActions","autoFocus","style","position","width","height","opacity","maxLength","tabIndex","onKeyDown","Dialog","forwardRef"],"mappings":"ukBA+CA,MAAMA,EAAmE,EAErEC,KACAC,OACAC,WACAC,UACAC,QACAC,gBACAC,kBACAC,eACAC,SACAC,YACAC,aACGC,GAELC,KAEA,MAAOC,GAAYC,EAAQA,SAACd,IAAE,MAAFA,SAAE,EAAFA,EAAMe,aAAW,KAC7C,MAAQC,MAAOC,KAAiBC,GAAwBb,EACxD,MAAMc,EACJC,EAAAA,WAAAC,cAACC,SAAO,CAAAC,IAAI,aAAcL,GACvBD,GAIL,MAAMO,EACJlB,GACA,WACE,MAAQU,MAAOS,KAAmBC,GAA0BpB,EAC5D,OACEc,aAACC,cAAAC,EAAMA,OAAC,CAAAC,IAAI,WAAWI,QAAQ,aAAcD,GAC1CD,EAGN,CAPD,GASF,MAAMG,EAAyBC,IAE7B,GAAIA,EAAMN,MAAQ,QAChBlB,EAAcyB,SACf,EAGH,OACEV,aAACC,cAAAU,EAASA,cACJpB,EACJC,IAAKA,EACLZ,GAAIa,EACJmB,UAAWC,EAAAA,WAAQ,UACnBC,eAAgB,CAAEF,UAAWC,EAAO,WAAC,cACrChC,KAAMA,EACNE,QAASA,EACTK,OAAQA,GAERY,EAAC,WAAAC,cAAAc,EAAWA,YACV,CAAA1B,UAAWA,EACXC,QAASA,EACTV,GAAIoC,EAAOA,QAACvB,GACZT,MAAOA,EACPD,QAASA,IAEXiB,EAAAA,WAAAC,cAACgB,EAAAA,iBACC,CAAArC,GAAIsC,EAAaA,cAACzB,GAClBmB,UAAWC,EAAAA,WAAQ,WACnBM,iBAAgB,MAEfrC,GAEHkB,EAAAA,WAAAC,cAACmB,gBAAa,CAACrC,QAASA,EAASI,aAAcA,GAC5C,CAACiB,EAAiBL,IAErBC,aAAAC,cAAA,QAAA,CACEoB,UAAS,KAAA,cACI,KACbC,MAAO,CACLC,SAAU,WACVC,MAAO,EACPC,OAAQ,EACRC,QAAS,GAEXC,UAAW,EACXC,UAAW,EACXC,UAAWrB,IAGf,EAGS,MAAAsB,EAAS9B,EAAAA,WAAM+B,WAAWpD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var t=require("../../../Typography/Typography.cjs.js");var a=require("./DialogTitle.module.cjs.js");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var t=require("../../../Typography/Typography.cjs.js");var a=require("./DialogTitle.module.cjs.js");var l=require("../../../Icon/Icon.cjs.js");var c=require("../../../Button/IconButton.cjs.js");function r(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var n=r(e);const o=({id:e,title:r,titleIcon:o,caption:i,onClose:s,...u},d)=>n["default"].createElement("div",{...u,ref:d,className:a["default"]["header"]},n["default"].createElement("div",{className:`${a["default"]["headline"]} ${i?a["default"]["with-caption"]:a["default"]["no-caption"]}`},o&&n["default"].createElement("div",{className:a["default"]["title-icon"]},typeof o==="boolean"?n["default"].createElement(l.Icon,{icon:l.Icons.InfoCircle}):o),n["default"].createElement("div",{className:a["default"]["title-wrapper"]},n["default"].createElement(t.Typography,{id:e,className:a["default"]["title"],spacing:o&&{marginLeft:2},tag:"h1",variant:"h4"},r),i&&n["default"].createElement(t.Typography,{className:a["default"]["caption"],spacing:{marginLeft:2},variant:"sub-text"},i))),n["default"].createElement(c.IconButton,{onClick:s,className:a["default"]["close-button"],title:"close modal"},n["default"].createElement(l.Icon,{icon:l.Icons.Times})));const i=n["default"].forwardRef(o);exports.DialogTitle=i;
|
|
2
2
|
//# sourceMappingURL=DialogTitle.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogTitle.cjs.js","sources":["../../../../../../../src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef } from \"react\";\nimport { Typography } from \"../../../Typography/Typography\";\nimport classes from \"./DialogTitle.module.scss\";\nimport { Icon, Icons } from \"../../../Icon/Icon\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id: string;\n title: string;\n titleIcon?: React.ReactNode;\n caption?: string;\n}\n\nconst DialogTitleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { id, title, titleIcon, caption, ...rest }: Props,\n ref\n) => {\n return (\n <div {...rest} ref={ref} className={classes[\"header\"]}>\n {titleIcon && (\n
|
|
1
|
+
{"version":3,"file":"DialogTitle.cjs.js","sources":["../../../../../../../src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef } from \"react\";\nimport { Typography } from \"../../../Typography/Typography\";\nimport classes from \"./DialogTitle.module.scss\";\nimport { Icon, Icons } from \"../../../Icon/Icon\";\nimport { IconButton } from \"../../../Button/IconButton\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id: string;\n title: string;\n titleIcon?: React.ReactNode;\n caption?: string;\n onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst DialogTitleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { id, title, titleIcon, caption, onClose, ...rest }: Props,\n ref\n) => {\n return (\n <div {...rest} ref={ref} className={classes[\"header\"]}>\n <div\n className={`${classes[\"headline\"]} ${caption ? classes[\"with-caption\"] : classes[\"no-caption\"]}`}\n >\n {titleIcon && (\n <div className={classes[\"title-icon\"]}>\n {typeof titleIcon === \"boolean\" ? <Icon icon={Icons.InfoCircle} /> : titleIcon}\n </div>\n )}\n <div className={classes[\"title-wrapper\"]}>\n <Typography\n id={id}\n className={classes[\"title\"]}\n spacing={titleIcon && { marginLeft: 2 }}\n tag=\"h1\"\n variant=\"h4\"\n >\n {title}\n </Typography>\n {caption && (\n <Typography\n className={classes[\"caption\"]}\n spacing={{ marginLeft: 2 }}\n variant=\"sub-text\"\n >\n {caption}\n </Typography>\n )}\n </div>\n </div>\n <IconButton onClick={onClose} className={classes[\"close-button\"]} title=\"close modal\">\n <Icon icon={Icons.Times} />\n </IconButton>\n </div>\n );\n};\n\nexport const DialogTitle = React.forwardRef(DialogTitleComponent);\n"],"names":["DialogTitleComponent","id","title","titleIcon","caption","onClose","rest","ref","React","createElement","className","classes","Icon","icon","Icons","InfoCircle","Typography","spacing","marginLeft","tag","variant","IconButton","onClick","Times","DialogTitle","forwardRef"],"mappings":"mXA8BA,MAAMA,EAAwE,EAC1EC,KAAIC,QAAOC,YAAWC,UAASC,aAAYC,GAC7CC,IAGEC,aAAAC,cAAA,MAAA,IAASH,EAAMC,IAAKA,EAAKG,UAAWC,EAAO,WAAC,WAC1CH,EACE,WAAAC,cAAA,MAAA,CAAAC,UAAW,GAAGC,EAAAA,WAAQ,eAAeP,EAAUO,EAAAA,WAAQ,gBAAkBA,EAAAA,WAAQ,iBAEhFR,GACCK,EAAAA,WAAKC,cAAA,MAAA,CAAAC,UAAWC,EAAO,WAAC,sBACdR,IAAc,UAAYK,EAAC,WAAAC,cAAAG,EAAAA,KAAK,CAAAC,KAAMC,EAAAA,MAAMC,aAAiBZ,GAGzEK,EAAA,WAAAC,cAAA,MAAA,CAAKC,UAAWC,EAAAA,WAAQ,kBACtBH,aAAAC,cAACO,EAAAA,WAAU,CACTf,GAAIA,EACJS,UAAWC,aAAQ,SACnBM,QAASd,GAAa,CAAEe,WAAY,GACpCC,IAAI,KACJC,QAAQ,MAEPlB,GAEFE,GACCI,EAAC,WAAAC,cAAAO,EAAAA,WACC,CAAAN,UAAWC,EAAO,WAAC,WACnBM,QAAS,CAAEC,WAAY,GACvBE,QAAQ,YAEPhB,KAKTI,EAAAA,WAAAC,cAACY,aAAU,CAACC,QAASjB,EAASK,UAAWC,aAAQ,gBAAiBT,MAAM,eACtEM,aAACC,cAAAG,EAAAA,KAAK,CAAAC,KAAMC,EAAAA,MAAMS,UAMb,MAAAC,EAAchB,EAAAA,WAAMiB,WAAWzB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("../../../../lib/style-inject.js");var i='/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DialogTitle-module_header__maiky{align-items:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("../../../../lib/style-inject.js");var i='/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DialogTitle-module_header__maiky{align-items:center;display:flex;justify-content:space-between;margin:1rem 1.5rem}.DialogTitle-module_headline__TItnb{display:flex}.DialogTitle-module_headline__TItnb.DialogTitle-module_with-caption__2Bu7z{align-items:flex-start}.DialogTitle-module_headline__TItnb.DialogTitle-module_no-caption__4-QI4{align-items:center}.DialogTitle-module_title__2Date{line-height:1;margin:0}.DialogTitle-module_title-icon__RFCV->[data-icon]{font-size:1.25rem}.DialogTitle-module_caption__08LUu{color:var(--color-blue-grey500)}.DialogTitle-module_close-button__EO320{flex-shrink:0}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkRpYWxvZ1RpdGxlLm1vZHVsZS5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7OztFQWNFLENBQ0Ysa0NBR0Usa0JBQW1CLENBRG5CLFlBQWEsQ0FFYiw2QkFBOEIsQ0FIOUIsa0JBSUYsQ0FFQSxvQ0FDRSxZQUNGLENBQ0EsMkVBQ0Usc0JBQ0YsQ0FDQSx5RUFDRSxrQkFDRixDQUVBLGlDQUVFLGFBQWMsQ0FEZCxRQUVGLENBQ0Esa0RBQ0UsaUJBQ0YsQ0FFQSxtQ0FDRSwrQkFDRixDQUVBLHdDQUNFLGFBQ0YiLCJmaWxlIjoiRGlhbG9nVGl0bGUubW9kdWxlLnNjc3MiLCJzb3VyY2VzQ29udGVudCI6WyIvKiFcbiAqIENvcHlyaWdodCAyMDIyIE9uZVdlbGNvbWUgQi5WLlxuICpcbiAqICAgIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZSBcIkxpY2Vuc2VcIik7XG4gKiAgICB5b3UgbWF5IG5vdCB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuXG4gKiAgICBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXRcbiAqXG4gKiAgICAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wXG4gKlxuICogICAgVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZVxuICogICAgZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gXCJBUyBJU1wiIEJBU0lTLFxuICogICAgV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuXG4gKiAgICBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kXG4gKiAgICBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS5cbiAqL1xuLmhlYWRlciB7XG4gIG1hcmdpbjogMXJlbSAxLjVyZW07XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2Vlbjtcbn1cblxuLmhlYWRsaW5lIHtcbiAgZGlzcGxheTogZmxleDtcbn1cbi5oZWFkbGluZS53aXRoLWNhcHRpb24ge1xuICBhbGlnbi1pdGVtczogZmxleC1zdGFydDtcbn1cbi5oZWFkbGluZS5uby1jYXB0aW9uIHtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbn1cblxuLnRpdGxlIHtcbiAgbWFyZ2luOiAwO1xuICBsaW5lLWhlaWdodDogMTtcbn1cbi50aXRsZS1pY29uID4gW2RhdGEtaWNvbl0ge1xuICBmb250LXNpemU6IDEuMjVyZW07XG59XG5cbi5jYXB0aW9uIHtcbiAgY29sb3I6IHZhcigtLWNvbG9yLWJsdWUtZ3JleTUwMCk7XG59XG5cbi5jbG9zZS1idXR0b24ge1xuICBmbGV4LXNocmluazogMDtcbn0iXX0= */';var l={header:"DialogTitle-module_header__maiky",headline:"DialogTitle-module_headline__TItnb","with-caption":"DialogTitle-module_with-caption__2Bu7z","no-caption":"DialogTitle-module_no-caption__4-QI4",title:"DialogTitle-module_title__2Date","title-icon":"DialogTitle-module_title-icon__RFCV-",caption:"DialogTitle-module_caption__08LUu","close-button":"DialogTitle-module_close-button__EO320"};e["default"](i);exports["default"]=l;
|
|
2
2
|
//# sourceMappingURL=DialogTitle.module.cjs.js.map
|
|
@@ -4,5 +4,6 @@ export interface Props extends ComponentPropsWithRef<"div"> {
|
|
|
4
4
|
title: string;
|
|
5
5
|
titleIcon?: React.ReactNode;
|
|
6
6
|
caption?: string;
|
|
7
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
7
8
|
}
|
|
8
9
|
export declare const DialogTitle: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useState as t}from"react";import{BaseModal as o}from"../BaseModal/BaseModal.esm.js";import{BaseModalContent as n}from"../BaseModal/BaseModalContent/BaseModalContent.esm.js";import{DialogActions as a}from"./DialogActions/DialogActions.esm.js";import i from"./Dialog.module.esm.js";import{DialogTitle as r}from"./DialogTitle/DialogTitle.esm.js";import{Button as s}from"../../Button/Button.esm.js";import{labelId as l,descriptionId as c}from"../BaseModal/BaseModalContext.esm.js";import{generateID as m}from"../../src/util/helper.esm.js";const d=({id:d,open:p,children:u,onClose:f,title:y,primaryAction:B,secondaryAction:
|
|
1
|
+
import e,{useState as t}from"react";import{BaseModal as o}from"../BaseModal/BaseModal.esm.js";import{BaseModalContent as n}from"../BaseModal/BaseModalContent/BaseModalContent.esm.js";import{DialogActions as a}from"./DialogActions/DialogActions.esm.js";import i from"./Dialog.module.esm.js";import{DialogTitle as r}from"./DialogTitle/DialogTitle.esm.js";import{Button as s}from"../../Button/Button.esm.js";import{labelId as l,descriptionId as c}from"../BaseModal/BaseModalContext.esm.js";import{generateID as m}from"../../src/util/helper.esm.js";const d=({id:d,open:p,children:u,onClose:f,title:y,primaryAction:B,secondaryAction:g,cancelAction:j,zIndex:C,titleIcon:E,caption:h,...A},M)=>{const[x]=t(d!==null&&d!==void 0?d:m(20));const{label:D,...b}=B;const I=e.createElement(s,{key:"primary",...b},D);const k=g&&function(){const{label:t,...o}=g;return e.createElement(s,{key:"tertiary",variant:"outline",...o},t)}();const w=e=>{if(e.key==="Enter")B.onClick()};return e.createElement(o,{...A,ref:M,id:x,className:i["dialog"],containerProps:{className:i["container"]},open:p,onClose:f,zIndex:C},e.createElement(r,{titleIcon:E,caption:h,id:l(x),title:y,onClose:f}),e.createElement(n,{id:c(x),className:i["content"],disableAutoFocus:true},u),e.createElement(a,{onClose:f,cancelAction:j},[k,I]),e.createElement("input",{autoFocus:true,"aria-hidden":true,style:{position:"absolute",width:0,height:0,opacity:0},maxLength:0,tabIndex:-1,onKeyDown:w}))};const p=e.forwardRef(d);export{p as Dialog};
|
|
2
2
|
//# sourceMappingURL=Dialog.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.esm.js","sources":["../../../../../../src/components/Notifications/Dialog/Dialog.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef, useState } from \"react\";\nimport { BaseModal } from \"../BaseModal/BaseModal\";\nimport { BaseModalContent } from \"../BaseModal/BaseModalContent/BaseModalContent\";\nimport { DialogActions } from \"./DialogActions/DialogActions\";\nimport classes from \"./Dialog.module.scss\";\nimport { DialogTitle } from \"./DialogTitle/DialogTitle\";\nimport { Button, Props as ButtonProps } from \"../../Button/Button\";\nimport { labelId, descriptionId } from \"../BaseModal/BaseModalContext\";\nimport { generateID } from \"../../../util/helper\";\nimport { CancelAction } from \"../BaseModal/BaseModalActions/BaseModalActions\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id?: string;\n open: boolean;\n children: React.ReactNode;\n onClose: () => void;\n title: string;\n primaryAction: Action;\n secondaryAction?: Action;\n cancelAction?: CancelAction;\n zIndex?: number;\n disableEscapeKeyDown?: boolean;\n titleIcon?: React.ReactNode;\n caption?: string;\n}\n\nexport interface Action extends Omit<ButtonProps, \"variant\" | \"ref\"> {\n label: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => unknown;\n}\n\nconst DialogComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n id,\n open,\n children,\n onClose,\n title,\n primaryAction,\n secondaryAction,\n cancelAction,\n zIndex,\n
|
|
1
|
+
{"version":3,"file":"Dialog.esm.js","sources":["../../../../../../src/components/Notifications/Dialog/Dialog.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef, useState } from \"react\";\nimport { BaseModal } from \"../BaseModal/BaseModal\";\nimport { BaseModalContent } from \"../BaseModal/BaseModalContent/BaseModalContent\";\nimport { DialogActions } from \"./DialogActions/DialogActions\";\nimport classes from \"./Dialog.module.scss\";\nimport { DialogTitle } from \"./DialogTitle/DialogTitle\";\nimport { Button, Props as ButtonProps } from \"../../Button/Button\";\nimport { labelId, descriptionId } from \"../BaseModal/BaseModalContext\";\nimport { generateID } from \"../../../util/helper\";\nimport { CancelAction } from \"../BaseModal/BaseModalActions/BaseModalActions\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id?: string;\n open: boolean;\n children: React.ReactNode;\n onClose: () => void;\n title: string;\n primaryAction: Action;\n secondaryAction?: Action;\n cancelAction?: CancelAction;\n zIndex?: number;\n disableEscapeKeyDown?: boolean;\n titleIcon?: React.ReactNode;\n caption?: string;\n}\n\nexport interface Action extends Omit<ButtonProps, \"variant\" | \"ref\"> {\n label: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => unknown;\n}\n\nconst DialogComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n id,\n open,\n children,\n onClose,\n title,\n primaryAction,\n secondaryAction,\n cancelAction,\n zIndex,\n titleIcon,\n caption,\n ...rest\n }: Props,\n ref\n) => {\n const [dialogId] = useState(id ?? generateID(20));\n const { label: primaryLabel, ...restOfPrimaryAction } = primaryAction;\n const PrimaryButton = (\n <Button key=\"primary\" {...restOfPrimaryAction}>\n {primaryLabel}\n </Button>\n );\n\n const SecondaryButton =\n secondaryAction &&\n (function () {\n const { label: secondaryLabel, ...restOfSecondaryAction } = secondaryAction;\n return (\n <Button key=\"tertiary\" variant=\"outline\" {...restOfSecondaryAction}>\n {secondaryLabel}\n </Button>\n );\n })();\n\n const onHiddenInputKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n /** It has to be here because then we will need to check if user doesn't click tab to select action button and want to do another action then primary one? */\n if (event.key === \"Enter\") {\n primaryAction.onClick();\n }\n };\n\n return (\n <BaseModal\n {...rest}\n ref={ref}\n id={dialogId}\n className={classes[\"dialog\"]}\n containerProps={{ className: classes[\"container\"] }}\n open={open}\n onClose={onClose}\n zIndex={zIndex}\n >\n <DialogTitle\n titleIcon={titleIcon}\n caption={caption}\n id={labelId(dialogId)}\n title={title}\n onClose={onClose}\n />\n <BaseModalContent\n id={descriptionId(dialogId)}\n className={classes[\"content\"]}\n disableAutoFocus\n >\n {children}\n </BaseModalContent>\n <DialogActions onClose={onClose} cancelAction={cancelAction}>\n {[SecondaryButton, PrimaryButton]}\n </DialogActions>\n <input\n autoFocus\n aria-hidden={true}\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n opacity: 0\n }}\n maxLength={0}\n tabIndex={-1}\n onKeyDown={onHiddenInputKeyPress}\n />\n </BaseModal>\n );\n};\n\nexport const Dialog = React.forwardRef(DialogComponent);\n"],"names":["DialogComponent","id","open","children","onClose","title","primaryAction","secondaryAction","cancelAction","zIndex","titleIcon","caption","rest","ref","dialogId","useState","generateID","label","primaryLabel","restOfPrimaryAction","PrimaryButton","React","createElement","Button","key","SecondaryButton","secondaryLabel","restOfSecondaryAction","variant","onHiddenInputKeyPress","event","onClick","BaseModal","className","classes","containerProps","DialogTitle","labelId","BaseModalContent","descriptionId","disableAutoFocus","DialogActions","autoFocus","style","position","width","height","opacity","maxLength","tabIndex","onKeyDown","Dialog","forwardRef"],"mappings":"iiBA+CA,MAAMA,EAAmE,EAErEC,KACAC,OACAC,WACAC,UACAC,QACAC,gBACAC,kBACAC,eACAC,SACAC,YACAC,aACGC,GAELC,KAEA,MAAOC,GAAYC,EAASd,IAAE,MAAFA,SAAE,EAAFA,EAAMe,EAAW,KAC7C,MAAQC,MAAOC,KAAiBC,GAAwBb,EACxD,MAAMc,EACJC,EAAAC,cAACC,EAAO,CAAAC,IAAI,aAAcL,GACvBD,GAIL,MAAMO,EACJlB,GACA,WACE,MAAQU,MAAOS,KAAmBC,GAA0BpB,EAC5D,OACEc,EAACC,cAAAC,EAAO,CAAAC,IAAI,WAAWI,QAAQ,aAAcD,GAC1CD,EAGN,CAPD,GASF,MAAMG,EAAyBC,IAE7B,GAAIA,EAAMN,MAAQ,QAChBlB,EAAcyB,SACf,EAGH,OACEV,EAACC,cAAAU,MACKpB,EACJC,IAAKA,EACLZ,GAAIa,EACJmB,UAAWC,EAAQ,UACnBC,eAAgB,CAAEF,UAAWC,EAAQ,cACrChC,KAAMA,EACNE,QAASA,EACTK,OAAQA,GAERY,EAACC,cAAAc,EACC,CAAA1B,UAAWA,EACXC,QAASA,EACTV,GAAIoC,EAAQvB,GACZT,MAAOA,EACPD,QAASA,IAEXiB,EAAAC,cAACgB,EACC,CAAArC,GAAIsC,EAAczB,GAClBmB,UAAWC,EAAQ,WACnBM,iBAAgB,MAEfrC,GAEHkB,EAAAC,cAACmB,EAAa,CAACrC,QAASA,EAASI,aAAcA,GAC5C,CAACiB,EAAiBL,IAErBC,EAAAC,cAAA,QAAA,CACEoB,UAAS,KAAA,cACI,KACbC,MAAO,CACLC,SAAU,WACVC,MAAO,EACPC,OAAQ,EACRC,QAAS,GAEXC,UAAW,EACXC,UAAW,EACXC,UAAWrB,IAGf,EAGS,MAAAsB,EAAS9B,EAAM+B,WAAWpD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{Typography as t}from"../../../Typography/Typography.esm.js";import a from"./DialogTitle.module.esm.js";import{Icon as
|
|
1
|
+
import e from"react";import{Typography as t}from"../../../Typography/Typography.esm.js";import a from"./DialogTitle.module.esm.js";import{Icon as o,Icons as i}from"../../../Icon/Icon.esm.js";import{IconButton as n}from"../../../Button/IconButton.esm.js";const c=({id:c,title:m,titleIcon:r,caption:l,onClose:s,...p},f)=>e.createElement("div",{...p,ref:f,className:a["header"]},e.createElement("div",{className:`${a["headline"]} ${l?a["with-caption"]:a["no-caption"]}`},r&&e.createElement("div",{className:a["title-icon"]},typeof r==="boolean"?e.createElement(o,{icon:i.InfoCircle}):r),e.createElement("div",{className:a["title-wrapper"]},e.createElement(t,{id:c,className:a["title"],spacing:r&&{marginLeft:2},tag:"h1",variant:"h4"},m),l&&e.createElement(t,{className:a["caption"],spacing:{marginLeft:2},variant:"sub-text"},l))),e.createElement(n,{onClick:s,className:a["close-button"],title:"close modal"},e.createElement(o,{icon:i.Times})));const m=e.forwardRef(c);export{m as DialogTitle};
|
|
2
2
|
//# sourceMappingURL=DialogTitle.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogTitle.esm.js","sources":["../../../../../../../src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef } from \"react\";\nimport { Typography } from \"../../../Typography/Typography\";\nimport classes from \"./DialogTitle.module.scss\";\nimport { Icon, Icons } from \"../../../Icon/Icon\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id: string;\n title: string;\n titleIcon?: React.ReactNode;\n caption?: string;\n}\n\nconst DialogTitleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { id, title, titleIcon, caption, ...rest }: Props,\n ref\n) => {\n return (\n <div {...rest} ref={ref} className={classes[\"header\"]}>\n {titleIcon && (\n
|
|
1
|
+
{"version":3,"file":"DialogTitle.esm.js","sources":["../../../../../../../src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, ComponentPropsWithRef } from \"react\";\nimport { Typography } from \"../../../Typography/Typography\";\nimport classes from \"./DialogTitle.module.scss\";\nimport { Icon, Icons } from \"../../../Icon/Icon\";\nimport { IconButton } from \"../../../Button/IconButton\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n id: string;\n title: string;\n titleIcon?: React.ReactNode;\n caption?: string;\n onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst DialogTitleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { id, title, titleIcon, caption, onClose, ...rest }: Props,\n ref\n) => {\n return (\n <div {...rest} ref={ref} className={classes[\"header\"]}>\n <div\n className={`${classes[\"headline\"]} ${caption ? classes[\"with-caption\"] : classes[\"no-caption\"]}`}\n >\n {titleIcon && (\n <div className={classes[\"title-icon\"]}>\n {typeof titleIcon === \"boolean\" ? <Icon icon={Icons.InfoCircle} /> : titleIcon}\n </div>\n )}\n <div className={classes[\"title-wrapper\"]}>\n <Typography\n id={id}\n className={classes[\"title\"]}\n spacing={titleIcon && { marginLeft: 2 }}\n tag=\"h1\"\n variant=\"h4\"\n >\n {title}\n </Typography>\n {caption && (\n <Typography\n className={classes[\"caption\"]}\n spacing={{ marginLeft: 2 }}\n variant=\"sub-text\"\n >\n {caption}\n </Typography>\n )}\n </div>\n </div>\n <IconButton onClick={onClose} className={classes[\"close-button\"]} title=\"close modal\">\n <Icon icon={Icons.Times} />\n </IconButton>\n </div>\n );\n};\n\nexport const DialogTitle = React.forwardRef(DialogTitleComponent);\n"],"names":["DialogTitleComponent","id","title","titleIcon","caption","onClose","rest","ref","React","createElement","className","classes","Icon","icon","Icons","InfoCircle","Typography","spacing","marginLeft","tag","variant","IconButton","onClick","Times","DialogTitle","forwardRef"],"mappings":"8PA8BA,MAAMA,EAAwE,EAC1EC,KAAIC,QAAOC,YAAWC,UAASC,aAAYC,GAC7CC,IAGEC,EAAAC,cAAA,MAAA,IAASH,EAAMC,IAAKA,EAAKG,UAAWC,EAAQ,WAC1CH,EACEC,cAAA,MAAA,CAAAC,UAAW,GAAGC,EAAQ,eAAeP,EAAUO,EAAQ,gBAAkBA,EAAQ,iBAEhFR,GACCK,EAAKC,cAAA,MAAA,CAAAC,UAAWC,EAAQ,sBACdR,IAAc,UAAYK,EAACC,cAAAG,EAAK,CAAAC,KAAMC,EAAMC,aAAiBZ,GAGzEK,EAAAC,cAAA,MAAA,CAAKC,UAAWC,EAAQ,kBACtBH,EAAAC,cAACO,EAAU,CACTf,GAAIA,EACJS,UAAWC,EAAQ,SACnBM,QAASd,GAAa,CAAEe,WAAY,GACpCC,IAAI,KACJC,QAAQ,MAEPlB,GAEFE,GACCI,EAACC,cAAAO,EACC,CAAAN,UAAWC,EAAQ,WACnBM,QAAS,CAAEC,WAAY,GACvBE,QAAQ,YAEPhB,KAKTI,EAAAC,cAACY,EAAU,CAACC,QAASjB,EAASK,UAAWC,EAAQ,gBAAiBT,MAAM,eACtEM,EAACC,cAAAG,EAAK,CAAAC,KAAMC,EAAMS,UAMb,MAAAC,EAAchB,EAAMiB,WAAWzB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import i from "../../../../lib/style-inject.js";var
|
|
1
|
+
import i from "../../../../lib/style-inject.js";var e='/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DialogTitle-module_header__maiky{align-items:center;display:flex;justify-content:space-between;margin:1rem 1.5rem}.DialogTitle-module_headline__TItnb{display:flex}.DialogTitle-module_headline__TItnb.DialogTitle-module_with-caption__2Bu7z{align-items:flex-start}.DialogTitle-module_headline__TItnb.DialogTitle-module_no-caption__4-QI4{align-items:center}.DialogTitle-module_title__2Date{line-height:1;margin:0}.DialogTitle-module_title-icon__RFCV->[data-icon]{font-size:1.25rem}.DialogTitle-module_caption__08LUu{color:var(--color-blue-grey500)}.DialogTitle-module_close-button__EO320{flex-shrink:0}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkRpYWxvZ1RpdGxlLm1vZHVsZS5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7OztFQWNFLENBQ0Ysa0NBR0Usa0JBQW1CLENBRG5CLFlBQWEsQ0FFYiw2QkFBOEIsQ0FIOUIsa0JBSUYsQ0FFQSxvQ0FDRSxZQUNGLENBQ0EsMkVBQ0Usc0JBQ0YsQ0FDQSx5RUFDRSxrQkFDRixDQUVBLGlDQUVFLGFBQWMsQ0FEZCxRQUVGLENBQ0Esa0RBQ0UsaUJBQ0YsQ0FFQSxtQ0FDRSwrQkFDRixDQUVBLHdDQUNFLGFBQ0YiLCJmaWxlIjoiRGlhbG9nVGl0bGUubW9kdWxlLnNjc3MiLCJzb3VyY2VzQ29udGVudCI6WyIvKiFcbiAqIENvcHlyaWdodCAyMDIyIE9uZVdlbGNvbWUgQi5WLlxuICpcbiAqICAgIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZSBcIkxpY2Vuc2VcIik7XG4gKiAgICB5b3UgbWF5IG5vdCB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuXG4gKiAgICBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXRcbiAqXG4gKiAgICAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wXG4gKlxuICogICAgVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZVxuICogICAgZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gXCJBUyBJU1wiIEJBU0lTLFxuICogICAgV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuXG4gKiAgICBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kXG4gKiAgICBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS5cbiAqL1xuLmhlYWRlciB7XG4gIG1hcmdpbjogMXJlbSAxLjVyZW07XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2Vlbjtcbn1cblxuLmhlYWRsaW5lIHtcbiAgZGlzcGxheTogZmxleDtcbn1cbi5oZWFkbGluZS53aXRoLWNhcHRpb24ge1xuICBhbGlnbi1pdGVtczogZmxleC1zdGFydDtcbn1cbi5oZWFkbGluZS5uby1jYXB0aW9uIHtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbn1cblxuLnRpdGxlIHtcbiAgbWFyZ2luOiAwO1xuICBsaW5lLWhlaWdodDogMTtcbn1cbi50aXRsZS1pY29uID4gW2RhdGEtaWNvbl0ge1xuICBmb250LXNpemU6IDEuMjVyZW07XG59XG5cbi5jYXB0aW9uIHtcbiAgY29sb3I6IHZhcigtLWNvbG9yLWJsdWUtZ3JleTUwMCk7XG59XG5cbi5jbG9zZS1idXR0b24ge1xuICBmbGV4LXNocmluazogMDtcbn0iXX0= */';var l={header:"DialogTitle-module_header__maiky",headline:"DialogTitle-module_headline__TItnb","with-caption":"DialogTitle-module_with-caption__2Bu7z","no-caption":"DialogTitle-module_no-caption__4-QI4",title:"DialogTitle-module_title__2Date","title-icon":"DialogTitle-module_title-icon__RFCV-",caption:"DialogTitle-module_caption__08LUu","close-button":"DialogTitle-module_close-button__EO320"};i(e);export{l as default};
|
|
2
2
|
//# sourceMappingURL=DialogTitle.module.esm.js.map
|
|
@@ -4,5 +4,6 @@ export interface Props extends ComponentPropsWithRef<"div"> {
|
|
|
4
4
|
title: string;
|
|
5
5
|
titleIcon?: React.ReactNode;
|
|
6
6
|
caption?: string;
|
|
7
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
7
8
|
}
|
|
8
9
|
export declare const DialogTitle: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"homepage": "http://onewelcome.github.io/react-lib-components",
|
|
3
3
|
"name": "@onewelcome/react-lib-components",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.3.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "OneWelcome B.V.",
|
|
7
7
|
"main": "dist/cjs/src/index.cjs.js",
|
|
@@ -58,38 +58,38 @@
|
|
|
58
58
|
"@babel/preset-typescript": "^7.23.3",
|
|
59
59
|
"@mdx-js/react": "^3.0.0",
|
|
60
60
|
"@onewelcome/eslint-config-shared-codestyle": "^9.1.0",
|
|
61
|
-
"@onewelcome/storybook-addon-basestyling": "^1.0.
|
|
61
|
+
"@onewelcome/storybook-addon-basestyling": "^1.0.1",
|
|
62
62
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
63
63
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
64
64
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
65
|
-
"@storybook/addon-a11y": "^7.6.
|
|
66
|
-
"@storybook/addon-actions": "^7.6.
|
|
67
|
-
"@storybook/addon-docs": "^7.6.
|
|
68
|
-
"@storybook/addon-essentials": "^7.6.
|
|
69
|
-
"@storybook/addon-interactions": "^7.6.
|
|
70
|
-
"@storybook/addon-links": "^7.6.
|
|
71
|
-
"@storybook/blocks": "^7.6.
|
|
72
|
-
"@storybook/components": "^7.6.
|
|
65
|
+
"@storybook/addon-a11y": "^7.6.14",
|
|
66
|
+
"@storybook/addon-actions": "^7.6.14",
|
|
67
|
+
"@storybook/addon-docs": "^7.6.14",
|
|
68
|
+
"@storybook/addon-essentials": "^7.6.14",
|
|
69
|
+
"@storybook/addon-interactions": "^7.6.14",
|
|
70
|
+
"@storybook/addon-links": "^7.6.14",
|
|
71
|
+
"@storybook/blocks": "^7.6.14",
|
|
72
|
+
"@storybook/components": "^7.6.14",
|
|
73
73
|
"@storybook/jest": "^0.2.3",
|
|
74
|
-
"@storybook/manager-api": "^7.6.
|
|
75
|
-
"@storybook/react": "^7.6.
|
|
76
|
-
"@storybook/react-webpack5": "^7.6.
|
|
74
|
+
"@storybook/manager-api": "^7.6.14",
|
|
75
|
+
"@storybook/react": "^7.6.14",
|
|
76
|
+
"@storybook/react-webpack5": "^7.6.14",
|
|
77
77
|
"@storybook/testing-library": "^0.2.2",
|
|
78
|
-
"@storybook/theming": "^7.6.
|
|
78
|
+
"@storybook/theming": "^7.6.14",
|
|
79
79
|
"@testing-library/dom": "^9.3.4",
|
|
80
80
|
"@testing-library/jest-dom": "^6.4.2",
|
|
81
81
|
"@testing-library/react": "^14.2.1",
|
|
82
82
|
"@testing-library/user-event": "^14.5.2",
|
|
83
83
|
"@types/jest": "^29.5.12",
|
|
84
84
|
"@types/mdx": "^2.0.11",
|
|
85
|
-
"@types/react": "^18.2.
|
|
86
|
-
"@types/react-dom": "^18.2.
|
|
85
|
+
"@types/react": "^18.2.55",
|
|
86
|
+
"@types/react-dom": "^18.2.19",
|
|
87
87
|
"@types/react-router": "^5.1.20",
|
|
88
88
|
"@types/react-router-dom": "^5.3.3",
|
|
89
89
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
90
90
|
"@typescript-eslint/parser": "^6.21.0",
|
|
91
91
|
"babel-loader": "^9.1.3",
|
|
92
|
-
"chromatic": "^10.
|
|
92
|
+
"chromatic": "^10.9.3",
|
|
93
93
|
"css-loader": "^6.10.0",
|
|
94
94
|
"eslint": "^8.56.0",
|
|
95
95
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"lint-staged": "^15.2.2",
|
|
111
111
|
"mini-css-extract-plugin": "^2.8.0",
|
|
112
112
|
"npm-run-all": "^4.1.5",
|
|
113
|
-
"postcss": "^8.4.
|
|
113
|
+
"postcss": "^8.4.35",
|
|
114
114
|
"postcss-modules": "^6.0.0",
|
|
115
115
|
"postcss-url": "^10.1.3",
|
|
116
116
|
"prettier": "^3.2.5",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"sass": "^1.70.0",
|
|
126
126
|
"sass-loader": "^14.1.0",
|
|
127
127
|
"size-limit": "^11.0.2",
|
|
128
|
-
"storybook": "^7.6.
|
|
128
|
+
"storybook": "^7.6.14",
|
|
129
129
|
"storybook-addon-pseudo-states": "^2.1.2",
|
|
130
130
|
"style-loader": "^3.3.4",
|
|
131
131
|
"ts-jest": "^29.1.2",
|
|
@@ -56,7 +56,6 @@ const DialogComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
|
56
56
|
secondaryAction,
|
|
57
57
|
cancelAction,
|
|
58
58
|
zIndex,
|
|
59
|
-
disableEscapeKeyDown = true,
|
|
60
59
|
titleIcon,
|
|
61
60
|
caption,
|
|
62
61
|
...rest
|
|
@@ -97,12 +96,16 @@ const DialogComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
|
97
96
|
className={classes["dialog"]}
|
|
98
97
|
containerProps={{ className: classes["container"] }}
|
|
99
98
|
open={open}
|
|
100
|
-
disableBackdrop
|
|
101
99
|
onClose={onClose}
|
|
102
100
|
zIndex={zIndex}
|
|
103
|
-
disableEscapeKeyDown={disableEscapeKeyDown}
|
|
104
101
|
>
|
|
105
|
-
<DialogTitle
|
|
102
|
+
<DialogTitle
|
|
103
|
+
titleIcon={titleIcon}
|
|
104
|
+
caption={caption}
|
|
105
|
+
id={labelId(dialogId)}
|
|
106
|
+
title={title}
|
|
107
|
+
onClose={onClose}
|
|
108
|
+
/>
|
|
106
109
|
<BaseModalContent
|
|
107
110
|
id={descriptionId(dialogId)}
|
|
108
111
|
className={classes["content"]}
|
|
@@ -17,7 +17,20 @@
|
|
|
17
17
|
.header {
|
|
18
18
|
margin: 1rem 1.5rem;
|
|
19
19
|
display: flex;
|
|
20
|
-
align-items:
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.headline {
|
|
25
|
+
display: flex;
|
|
26
|
+
|
|
27
|
+
&.with-caption {
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.no-caption {
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
.title {
|
|
@@ -32,3 +45,7 @@
|
|
|
32
45
|
.caption {
|
|
33
46
|
color: var(--color-blue-grey500);
|
|
34
47
|
}
|
|
48
|
+
|
|
49
|
+
.close-button {
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
}
|
|
@@ -18,41 +18,54 @@ import React, { ForwardRefRenderFunction, ComponentPropsWithRef } from "react";
|
|
|
18
18
|
import { Typography } from "../../../Typography/Typography";
|
|
19
19
|
import classes from "./DialogTitle.module.scss";
|
|
20
20
|
import { Icon, Icons } from "../../../Icon/Icon";
|
|
21
|
+
import { IconButton } from "../../../Button/IconButton";
|
|
21
22
|
|
|
22
23
|
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
23
24
|
id: string;
|
|
24
25
|
title: string;
|
|
25
26
|
titleIcon?: React.ReactNode;
|
|
26
27
|
caption?: string;
|
|
28
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const DialogTitleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
30
|
-
{ id, title, titleIcon, caption, ...rest }: Props,
|
|
32
|
+
{ id, title, titleIcon, caption, onClose, ...rest }: Props,
|
|
31
33
|
ref
|
|
32
34
|
) => {
|
|
33
35
|
return (
|
|
34
36
|
<div {...rest} ref={ref} className={classes["header"]}>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
id={id}
|
|
43
|
-
className={classes["title"]}
|
|
44
|
-
spacing={titleIcon && { marginLeft: 2 }}
|
|
45
|
-
tag="h1"
|
|
46
|
-
variant="h4"
|
|
47
|
-
>
|
|
48
|
-
{title}
|
|
49
|
-
</Typography>
|
|
50
|
-
{caption && (
|
|
51
|
-
<Typography className={classes["caption"]} spacing={{ marginLeft: 2 }} variant="sub-text">
|
|
52
|
-
{caption}
|
|
53
|
-
</Typography>
|
|
37
|
+
<div
|
|
38
|
+
className={`${classes["headline"]} ${caption ? classes["with-caption"] : classes["no-caption"]}`}
|
|
39
|
+
>
|
|
40
|
+
{titleIcon && (
|
|
41
|
+
<div className={classes["title-icon"]}>
|
|
42
|
+
{typeof titleIcon === "boolean" ? <Icon icon={Icons.InfoCircle} /> : titleIcon}
|
|
43
|
+
</div>
|
|
54
44
|
)}
|
|
45
|
+
<div className={classes["title-wrapper"]}>
|
|
46
|
+
<Typography
|
|
47
|
+
id={id}
|
|
48
|
+
className={classes["title"]}
|
|
49
|
+
spacing={titleIcon && { marginLeft: 2 }}
|
|
50
|
+
tag="h1"
|
|
51
|
+
variant="h4"
|
|
52
|
+
>
|
|
53
|
+
{title}
|
|
54
|
+
</Typography>
|
|
55
|
+
{caption && (
|
|
56
|
+
<Typography
|
|
57
|
+
className={classes["caption"]}
|
|
58
|
+
spacing={{ marginLeft: 2 }}
|
|
59
|
+
variant="sub-text"
|
|
60
|
+
>
|
|
61
|
+
{caption}
|
|
62
|
+
</Typography>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
55
65
|
</div>
|
|
66
|
+
<IconButton onClick={onClose} className={classes["close-button"]} title="close modal">
|
|
67
|
+
<Icon icon={Icons.Times} />
|
|
68
|
+
</IconButton>
|
|
56
69
|
</div>
|
|
57
70
|
);
|
|
58
71
|
};
|