listpage-next 0.0.233 → 0.0.235

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,14 +1,8 @@
1
1
  import { ModalProps } from 'antd';
2
2
  import { ReactNode } from 'react';
3
- export interface PageModalProps extends Omit<ModalProps, 'visible' | 'open' | 'onOk' | 'onCancel' | 'footer' | 'title' | 'children' | 'okText' | 'cancelText' | 'closeIcon' | 'closeable'> {
4
- visible: boolean;
5
- onOk?: () => void;
6
- onCancel?: () => void;
7
- okText?: string;
8
- cancelText?: string;
3
+ export interface PageModalProps extends Omit<ModalProps, 'footer' | 'title'> {
9
4
  icon?: ReactNode;
10
5
  title: string;
11
- children?: ReactNode;
12
6
  actionPosition?: 'top' | 'bottom' | 'none';
13
7
  extraActions?: ReactNode;
14
8
  }
@@ -3,15 +3,13 @@ import { Modal } from "antd";
3
3
  import styled_components from "styled-components";
4
4
  import { useActions } from "./useActions.js";
5
5
  const PageModal = (props)=>{
6
- const { icon, visible, children, extraActions, actionPosition = 'bottom', ...modalProps } = props;
6
+ const { icon, children, extraActions, actionPosition = 'bottom', ...modalProps } = props;
7
7
  const { footer, header } = useActions(props);
8
8
  return /*#__PURE__*/ jsx(ModalStyled, {
9
9
  ...modalProps,
10
- open: visible,
11
10
  title: header,
12
- closeIcon: null,
13
11
  footer: footer,
14
- closable: 'top' !== actionPosition,
12
+ closable: false,
15
13
  children: children
16
14
  });
17
15
  };
@@ -2,28 +2,11 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "antd";
3
3
  import { useMemo } from "react";
4
4
  import { styled } from "styled-components";
5
- import { CloseOutlined } from "@ant-design/icons";
6
5
  import { AsyncButton } from "../../../AsyncButton/index.js";
6
+ import { useCloseButton } from "./useCloseButton.js";
7
7
  function useActions(props) {
8
- const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions, closable = true } = props;
9
- const closeButton = useMemo(()=>{
10
- if (true === closable) return /*#__PURE__*/ jsx(CloseButton, {
11
- type: "text",
12
- icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
13
- onClick: onCancel
14
- });
15
- if (false === closable) return null;
16
- const { closeIcon, disabled } = closable;
17
- return /*#__PURE__*/ jsx(CloseButton, {
18
- type: "text",
19
- disabled: disabled,
20
- icon: closeIcon || /*#__PURE__*/ jsx(CloseOutlined, {}),
21
- onClick: onCancel
22
- });
23
- }, [
24
- closable,
25
- onCancel
26
- ]);
8
+ const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions } = props;
9
+ const { closeButton } = useCloseButton(props);
27
10
  const actions = 'none' === actionPosition ? null : /*#__PURE__*/ jsxs(Fragment, {
28
11
  children: [
29
12
  /*#__PURE__*/ jsx(Button, {
@@ -39,12 +22,12 @@ function useActions(props) {
39
22
  ]
40
23
  });
41
24
  const footer = useMemo(()=>{
42
- if ('bottom' === actionPosition) return /*#__PURE__*/ jsxs(ExtraContainer, {
25
+ if ('bottom' === actionPosition) return /*#__PURE__*/ jsxs(Fragment, {
43
26
  children: [
44
- /*#__PURE__*/ jsx(Fragment, {
27
+ /*#__PURE__*/ jsx(FlexContainer, {
45
28
  children: extraActions
46
29
  }),
47
- /*#__PURE__*/ jsx(Fragment, {
30
+ /*#__PURE__*/ jsx(ExtraContainer, {
48
31
  children: actions
49
32
  })
50
33
  ]
@@ -126,10 +109,4 @@ const ExtraContainer = styled.div`
126
109
  gap: 8px;
127
110
  justify-content: flex-end;
128
111
  `;
129
- const CloseButton = styled(Button)`
130
- color: rgba(0, 0, 0, 0.45);
131
- :hover {
132
- color: rgba(0, 0, 0, 0.88);
133
- }
134
- `;
135
112
  export { useActions };
@@ -0,0 +1,8 @@
1
+ import type { PageModalProps } from '.';
2
+ export declare function useCloseButton(props: PageModalProps): {
3
+ closeButton: import("react/jsx-runtime").JSX.Element | null;
4
+ closable: boolean;
5
+ } | {
6
+ closeButton: import("react/jsx-runtime").JSX.Element | null;
7
+ closable?: undefined;
8
+ };
@@ -0,0 +1,40 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { CloseOutlined } from "@ant-design/icons";
4
+ import { styled } from "styled-components";
5
+ import { Button } from "antd";
6
+ function useCloseButton(props) {
7
+ const { actionPosition, onCancel, closable = true } = props;
8
+ const closeButton = useMemo(()=>{
9
+ if (true === closable) return /*#__PURE__*/ jsx(CloseButton, {
10
+ type: "text",
11
+ icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
12
+ onClick: onCancel
13
+ });
14
+ if (false === closable) return null;
15
+ const { closeIcon, disabled } = closable;
16
+ return /*#__PURE__*/ jsx(CloseButton, {
17
+ type: "text",
18
+ disabled: disabled,
19
+ icon: closeIcon || /*#__PURE__*/ jsx(CloseOutlined, {}),
20
+ onClick: onCancel
21
+ });
22
+ }, [
23
+ closable,
24
+ onCancel
25
+ ]);
26
+ if ('top' === actionPosition) return {
27
+ closeButton,
28
+ closable: false
29
+ };
30
+ return {
31
+ closeButton
32
+ };
33
+ }
34
+ const CloseButton = styled(Button)`
35
+ color: rgba(0, 0, 0, 0.45);
36
+ :hover {
37
+ color: rgba(0, 0, 0, 0.88);
38
+ }
39
+ `;
40
+ export { useCloseButton };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.233",
3
+ "version": "0.0.235",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",