@purr-react-styled-components/components.button 0.0.7 → 0.0.9
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/index.cjs +24 -1
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -2
- package/dist/index.js +24 -24
- package/package.json +5 -3
- package/dist/_components.d.ts +0 -4
- package/dist/_style.d.ts +0 -3
- package/dist/_types.d.ts +0 -15
package/dist/index.cjs
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';var u=require('clsx'),n=require('react'),components_loadingRipple=require('@purr-react-styled-components/components.loading-ripple'),l=require('styled-components');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var u__default=/*#__PURE__*/_interopDefault(u);var n__default=/*#__PURE__*/_interopDefault(n);var l__default=/*#__PURE__*/_interopDefault(l);var e={Container:l__default.default.button`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
transition: all 0.2s ease;
|
|
6
|
+
background-color: transparent;
|
|
7
|
+
box-shadow: none;
|
|
8
|
+
outline: none;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
border-radius: 6px;
|
|
11
|
+
min-width: 64px;
|
|
12
|
+
min-height: 32px;
|
|
13
|
+
padding: 0px 15px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
border: 1px solid #d9d9d9;
|
|
16
|
+
background-color: #ffffff;
|
|
17
|
+
|
|
18
|
+
&:hover,
|
|
19
|
+
&:focus {
|
|
20
|
+
outline: 0;
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
background-color: #0000000a;
|
|
23
|
+
}
|
|
24
|
+
`};var h=({loading:o=false,loadingComponent:t,className:i,htmlAttributes:s,children:r,onClick:p})=>{let f=n.useMemo(()=>o?t??n__default.default.createElement(components_loadingRipple.LoadingRipple,{size:16,fullScreen:false}):r,[r,o,t]);return n__default.default.createElement(e.Container,{...s,onClick:p,className:u__default.default("button",o&&"button--loading",i)},f)};exports.Button=h;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { MouseEventHandler, ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
type TButtonSize = "small" | "medium" | "large";
|
|
5
|
+
type TButtonVariant = "outlined" | "contained" | "text";
|
|
6
|
+
interface IButtonProps {
|
|
7
|
+
size?: TButtonSize;
|
|
8
|
+
variant?: TButtonVariant;
|
|
9
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
loadingComponent?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
htmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const Button: ({ loading, loadingComponent, className, htmlAttributes, children, onClick, }: IButtonProps) => React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { Button, type IButtonProps, type TButtonSize, type TButtonVariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React, { MouseEventHandler, ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
type TButtonSize = "small" | "medium" | "large";
|
|
5
|
+
type TButtonVariant = "outlined" | "contained" | "text";
|
|
6
|
+
interface IButtonProps {
|
|
7
|
+
size?: TButtonSize;
|
|
8
|
+
variant?: TButtonVariant;
|
|
9
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
loadingComponent?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
htmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const Button: ({ loading, loadingComponent, className, htmlAttributes, children, onClick, }: IButtonProps) => React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { Button, type IButtonProps, type TButtonSize, type TButtonVariant };
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
1
|
+
import u from'clsx';import n,{useMemo}from'react';import {LoadingRipple}from'@purr-react-styled-components/components.loading-ripple';import l from'styled-components';var e={Container:l.button`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
transition: all 0.2s ease;
|
|
6
|
+
background-color: transparent;
|
|
7
|
+
box-shadow: none;
|
|
8
|
+
outline: none;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
border-radius: 6px;
|
|
11
|
+
min-width: 64px;
|
|
12
|
+
min-height: 32px;
|
|
13
|
+
padding: 0px 15px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
border: 1px solid #d9d9d9;
|
|
16
|
+
background-color: #ffffff;
|
|
17
|
+
|
|
18
|
+
&:hover,
|
|
19
|
+
&:focus {
|
|
20
|
+
outline: 0;
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
background-color: #0000000a;
|
|
23
|
+
}
|
|
24
|
+
`};var h=({loading:o=false,loadingComponent:t,className:i,htmlAttributes:s,children:r,onClick:p})=>{let f=useMemo(()=>o?t??n.createElement(LoadingRipple,{size:16,fullScreen:false}):r,[r,o,t]);return n.createElement(e.Container,{...s,onClick:p,className:u("button",o&&"button--loading",i)},f)};export{h as Button};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-styled-components/components.button",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"react": "*",
|
|
26
26
|
"clsx": "*",
|
|
27
27
|
"styled-components": "*",
|
|
28
|
-
"@purr-core/utils.definitions": "0.0.
|
|
29
|
-
"@purr-react-styled-components/components.loading-ripple": "0.0.
|
|
28
|
+
"@purr-core/utils.definitions": "0.0.12",
|
|
29
|
+
"@purr-react-styled-components/components.loading-ripple": "0.0.9"
|
|
30
30
|
},
|
|
31
31
|
"author": "@DinhThienPhuc",
|
|
32
32
|
"license": "ISC",
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
"scripts": {
|
|
36
36
|
"dev": "vite build --watch",
|
|
37
37
|
"build": "tsc && vite build",
|
|
38
|
+
"build:vite": "tsc && vite build",
|
|
39
|
+
"build:tsup": "tsup",
|
|
38
40
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
39
41
|
}
|
|
40
42
|
}
|
package/dist/_components.d.ts
DELETED
package/dist/_style.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const Styled: {
|
|
2
|
-
Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
3
|
-
};
|
package/dist/_types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
-
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
-
|
|
4
|
-
export type TButtonSize = "small" | "medium" | "large";
|
|
5
|
-
export type TButtonVariant = "outlined" | "contained" | "text";
|
|
6
|
-
export interface IButtonProps {
|
|
7
|
-
size?: TButtonSize;
|
|
8
|
-
variant?: TButtonVariant;
|
|
9
|
-
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
loadingComponent?: ReactNode;
|
|
12
|
-
className?: string;
|
|
13
|
-
children?: ReactNode;
|
|
14
|
-
htmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
15
|
-
}
|