tycho-components 0.14.3 → 0.14.5

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.
@@ -1,4 +1,4 @@
1
- import "./style.scss";
1
+ import './style.scss';
2
2
  type Props = {
3
3
  children: React.ReactNode;
4
4
  title: string;
@@ -11,6 +11,7 @@ type Props = {
11
11
  hideFooter?: boolean;
12
12
  disableCancel?: boolean;
13
13
  disableClose?: boolean;
14
+ disableEscapeClose?: boolean;
14
15
  confirmLabel?: string;
15
16
  closeLabel?: string;
16
17
  onEntered?: () => void;
@@ -22,5 +23,5 @@ type Props = {
22
23
  hideBackdrop?: boolean;
23
24
  disableBackdropClose?: boolean;
24
25
  };
25
- export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }: Props): import("react/jsx-runtime").JSX.Element;
26
+ export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableEscapeClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }: Props): import("react/jsx-runtime").JSX.Element;
26
27
  export {};
@@ -1,41 +1,42 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Fade, Modal } from "@mui/material";
3
- import cx from "classnames";
4
- import { useTranslation } from "react-i18next";
5
- import { Button, Icon } from "tycho-storybook";
6
- import "./style.scss";
7
- import { useEffect } from "react";
8
- import { attachCloseToEscape, stopEventPropagation } from "./AppModalUtils";
9
- export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }) {
10
- const { t } = useTranslation("common");
11
- const getClassNames = cx("modal-container", className);
2
+ import { Box, Fade, Modal } from '@mui/material';
3
+ import cx from 'classnames';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Button, Icon } from 'tycho-storybook';
6
+ import './style.scss';
7
+ import { useEffect } from 'react';
8
+ import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
9
+ export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableEscapeClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }) {
10
+ const { t } = useTranslation('common');
11
+ const getClassNames = cx('modal-container', className);
12
12
  useEffect(() => {
13
- if (disableClose)
13
+ if (disableEscapeClose)
14
14
  return;
15
15
  return attachCloseToEscape(close);
16
- }, [close, disableClose]);
17
- return (_jsx(Modal, { open: true, disableEnforceFocus: true, disableAutoFocus: true, disableRestoreFocus: true, hideBackdrop: hideBackdrop, disableEscapeKeyDown: !!disableClose, onClose: (event, reason) => {
16
+ }, [close, disableEscapeClose]);
17
+ return (_jsx(Modal, { open: true, disableEnforceFocus: true, disableAutoFocus: true, disableRestoreFocus: true, hideBackdrop: hideBackdrop, disableEscapeKeyDown: !!disableEscapeClose, onClose: (event, reason) => {
18
18
  stopEventPropagation(event);
19
- if (disableBackdropClose && reason === "backdropClick")
19
+ if (disableBackdropClose && reason === 'backdropClick')
20
20
  return;
21
- if (!disableClose)
22
- close();
21
+ if (disableClose)
22
+ return;
23
+ close();
23
24
  }, children: _jsx(Fade, { in: true, onEntered: () => onEntered && onEntered(), children: _jsxs(Box, { className: getClassNames, sx: style, children: [_jsxs("div", { className: "header", children: [_jsxs("div", { className: "titles", children: [_jsx("span", { className: "title", children: title }), subtitle && _jsx("span", { className: "subtitle", children: subtitle })] }), !disableClose && (_jsx(Icon, { name: "close", onClick: (e) => {
24
25
  stopEventPropagation(e);
25
26
  close();
26
27
  }, className: "pointer" }))] }), _jsx("div", { className: "body", children: children }), !hideFooter ? (_jsxs("div", { className: "footer", children: [alternativeOptions && alternativeOptions, alternativeButton && (_jsx(Button, { className: "alternative", color: "white", onClick: alternativeButton.action, text: alternativeButton.title })), !disableCancel && (_jsx(Button, { onClick: (e) => {
27
28
  stopEventPropagation(e);
28
29
  (cancel || close)();
29
- }, text: closeLabel || t("button.cancel"), color: "danger" })), confirm && (_jsx(Button, { onClick: confirm, disabled: disableConfirm, text: confirmLabel || t("button.confirm") }))] })) : null] }) }) }));
30
+ }, text: closeLabel || t('button.cancel'), color: "danger" })), confirm && (_jsx(Button, { onClick: confirm, disabled: disableConfirm, text: confirmLabel || t('button.confirm') }))] })) : null] }) }) }));
30
31
  }
31
32
  const style = {
32
- position: "absolute",
33
- top: "40%",
34
- left: "50%",
35
- transform: "translate(-50%, -50%)",
36
- width: "50%",
37
- maxWidth: "1080px",
38
- borderRadius: "var(--radius-200)",
33
+ position: 'absolute',
34
+ top: '40%',
35
+ left: '50%',
36
+ transform: 'translate(-50%, -50%)',
37
+ width: '50%',
38
+ maxWidth: '1080px',
39
+ borderRadius: 'var(--radius-200)',
39
40
  boxShadow: 24,
40
- bgcolor: "var(--background-default)",
41
+ bgcolor: 'var(--background-default)',
41
42
  };
@@ -1,4 +1,4 @@
1
- import './style.scss';
1
+ import "./style.scss";
2
2
  type Props = {
3
3
  title: string;
4
4
  subtitle: string | React.ReactNode;
@@ -7,6 +7,8 @@ type Props = {
7
7
  closeLabel?: string;
8
8
  confirmLabel?: string;
9
9
  disableClose?: boolean;
10
+ disableEscapeClose?: boolean;
11
+ confirmDisabled?: boolean;
10
12
  };
11
- export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, disableClose, }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, confirmDisabled, disableClose, disableEscapeClose, }: Props): import("react/jsx-runtime").JSX.Element;
12
14
  export {};
@@ -1,34 +1,35 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Modal } from '@mui/material';
3
- import { useEffect } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
- import { Button, Icon } from 'tycho-storybook';
6
- import './style.scss';
7
- import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
8
- export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, disableClose, }) {
9
- const { t } = useTranslation('common');
2
+ import { Box, Modal } from "@mui/material";
3
+ import { useEffect } from "react";
4
+ import { useTranslation } from "react-i18next";
5
+ import { Button, Icon } from "tycho-storybook";
6
+ import "./style.scss";
7
+ import { attachCloseToEscape, stopEventPropagation } from "./AppModalUtils";
8
+ export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, confirmDisabled, disableClose, disableEscapeClose, }) {
9
+ const { t } = useTranslation("common");
10
10
  useEffect(() => {
11
- if (disableClose)
11
+ if (disableEscapeClose)
12
12
  return;
13
13
  return attachCloseToEscape(onClose);
14
- }, [onClose, disableClose]);
15
- return (_jsx(Modal, { open: true, disableEscapeKeyDown: !!disableClose, onClose: (event) => {
14
+ }, [onClose, disableEscapeClose]);
15
+ return (_jsx(Modal, { open: true, disableEscapeKeyDown: !!disableEscapeClose, onClose: (event) => {
16
16
  stopEventPropagation(event);
17
- if (!disableClose)
18
- onClose();
17
+ if (disableClose)
18
+ return;
19
+ onClose();
19
20
  }, children: _jsxs(Box, { className: "modal-container modal-confirm", sx: style, children: [_jsxs("div", { className: "body", children: [_jsx(Icon, { name: "warning", size: "large", filled: true }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { className: "subtitle", children: subtitle })] })] }), _jsxs("div", { className: "footer", children: [_jsx(Button, { onClick: (e) => {
20
21
  stopEventPropagation(e);
21
22
  onClose();
22
- }, text: closeLabel || t('button.cancel'), mode: "tonal" }), _jsx(Button, { onClick: onConfirm, text: confirmLabel || t('button.confirm') })] })] }) }));
23
+ }, text: closeLabel || t("button.cancel"), mode: "tonal" }), _jsx(Button, { onClick: onConfirm, text: confirmLabel || t("button.confirm"), disabled: confirmDisabled })] })] }) }));
23
24
  }
24
25
  const style = {
25
- position: 'absolute',
26
- top: '40%',
27
- left: '50%',
28
- transform: 'translate(-50%, -50%)',
29
- width: '30%',
30
- maxWidth: '580px',
31
- borderRadius: 'var(--radius-200)',
26
+ position: "absolute",
27
+ top: "40%",
28
+ left: "50%",
29
+ transform: "translate(-50%, -50%)",
30
+ width: "30%",
31
+ maxWidth: "580px",
32
+ borderRadius: "var(--radius-200)",
32
33
  boxShadow: 24,
33
- bgcolor: 'var(--background-default)',
34
+ bgcolor: "var(--background-default)",
34
35
  };
@@ -5,8 +5,9 @@ type Props = {
5
5
  onClose: () => void;
6
6
  onConfirm: () => void;
7
7
  disableClose?: boolean;
8
+ disableEscapeClose?: boolean;
8
9
  };
9
- export default function AppModalRemove({ title, subtitle, onClose, onConfirm, disableClose, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export default function AppModalRemove({ title, subtitle, onClose, onConfirm, disableClose, disableEscapeClose, }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  export declare const modalRemoveStyle: {
11
12
  position: string;
12
13
  top: string;
@@ -5,17 +5,18 @@ import { useTranslation } from 'react-i18next';
5
5
  import { Button, Icon } from 'tycho-storybook';
6
6
  import './style.scss';
7
7
  import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
8
- export default function AppModalRemove({ title, subtitle, onClose, onConfirm, disableClose, }) {
8
+ export default function AppModalRemove({ title, subtitle, onClose, onConfirm, disableClose, disableEscapeClose, }) {
9
9
  const { t } = useTranslation('common');
10
10
  useEffect(() => {
11
- if (disableClose)
11
+ if (disableEscapeClose)
12
12
  return;
13
13
  return attachCloseToEscape(onClose);
14
- }, [onClose, disableClose]);
15
- return (_jsx(Modal, { open: true, disableEscapeKeyDown: !!disableClose, onClose: (event) => {
14
+ }, [onClose, disableEscapeClose]);
15
+ return (_jsx(Modal, { open: true, disableEscapeKeyDown: !!disableEscapeClose, onClose: (event) => {
16
16
  stopEventPropagation(event);
17
- if (!disableClose)
18
- onClose();
17
+ if (disableClose)
18
+ return;
19
+ onClose();
19
20
  }, children: _jsxs(Box, { className: "modal-container modal-remove", sx: modalRemoveStyle, children: [_jsxs("div", { className: "body", children: [_jsx(Icon, { name: "warning", size: "large", filled: true }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { className: "subtitle", children: subtitle })] })] }), _jsxs("div", { className: "footer", children: [_jsx(Button, { onClick: (e) => {
20
21
  stopEventPropagation(e);
21
22
  onClose();
@@ -1,10 +1,11 @@
1
- import './style.scss';
1
+ import "./style.scss";
2
2
  type Props = {
3
3
  icon?: string;
4
4
  text?: string;
5
5
  desc?: string;
6
6
  children?: React.ReactNode;
7
+ useMarginTop?: boolean;
7
8
  onClick?: () => void;
8
9
  };
9
- export default function AppPlaceholder({ text, desc, children, icon, onClick, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export default function AppPlaceholder({ text, desc, children, icon, useMarginTop, onClick, }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Icon } from 'tycho-storybook';
3
- import './style.scss';
4
- export default function AppPlaceholder({ text, desc, children, icon = 'contract_delete', onClick, }) {
5
- return (_jsxs("div", { className: "ds-placeholder", onClick: () => onClick && onClick(), onKeyDown: () => onClick && onClick(), children: [_jsx(Icon, { name: icon, weight: "heavy", size: "x-large", filled: true }), text && _jsx("span", { className: "title", children: text }), desc && _jsx("span", { className: "desc", children: desc }), children && children] }));
2
+ import { Icon } from "tycho-storybook";
3
+ import "./style.scss";
4
+ export default function AppPlaceholder({ text, desc, children, icon = "contract_delete", useMarginTop = false, onClick, }) {
5
+ return (_jsxs("div", { className: `ds-placeholder ${useMarginTop ? "with-margin-top" : ""}`, onClick: () => onClick && onClick(), onKeyDown: () => onClick && onClick(), children: [_jsx(Icon, { name: icon, weight: "heavy", size: "x-large", filled: true }), text && _jsx("span", { className: "title", children: text }), desc && _jsx("span", { className: "desc", children: desc }), children && children] }));
6
6
  }
@@ -3,6 +3,10 @@
3
3
  flex-direction: column;
4
4
  text-align: center;
5
5
 
6
+ &.use-margin-top {
7
+ margin-top: 5%;
8
+ }
9
+
6
10
  > .ds-icon {
7
11
  color: var(--icon-on-disabled);
8
12
  margin-bottom: 8px;
@@ -8,6 +8,7 @@ export type AppPage<Type> = {
8
8
  executionTime?: number;
9
9
  totalHits?: number;
10
10
  uid?: string;
11
+ empty?: boolean;
11
12
  };
12
13
  export declare const EMPTY_PAGE: {
13
14
  content: never[];
@@ -1,4 +1,4 @@
1
- import { EMPTY_GRID_PAGEABLE, EMPTY_PAGEABLE } from './AppPageable';
1
+ import { EMPTY_GRID_PAGEABLE, EMPTY_PAGEABLE } from "./AppPageable";
2
2
  export const EMPTY_PAGE = {
3
3
  content: [],
4
4
  totalElements: 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.14.3",
4
+ "version": "0.14.5",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {