@purr-react-styled-components/components.post-adornment 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 +13 -1
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -2
- package/dist/index.js +13 -37
- package/package.json +6 -4
- package/dist/_components.d.ts +0 -4
- package/dist/_style.d.ts +0 -6
- package/dist/_types.d.ts +0 -17
package/dist/index.cjs
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';var y=require('clsx'),n=require('react'),i=require('styled-components'),utils_helpers=require('@purr-react-styled-components/utils.helpers');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var y__default=/*#__PURE__*/_interopDefault(y);var n__default=/*#__PURE__*/_interopDefault(n);var i__default=/*#__PURE__*/_interopDefault(i);var l=t=>i.css`
|
|
2
|
+
display: flex;
|
|
3
|
+
position: absolute;
|
|
4
|
+
transform: translateY(-50%);
|
|
5
|
+
color: #ffffff;
|
|
6
|
+
top: ${t.$hasLabel?"calc(50% + 6px)":"50%"};
|
|
7
|
+
right: ${t.$adornmentVariant==="standard"?"0px":"14px"};
|
|
8
|
+
`,o={Container:i__default.default.span`
|
|
9
|
+
${l};
|
|
10
|
+
`,ButtonContainer:i__default.default.button`
|
|
11
|
+
${utils_helpers.getInvisibleButton};
|
|
12
|
+
${l};
|
|
13
|
+
`};var P=n.lazy(()=>import('@purr-react-styled-components/components.icon').then(t=>({default:t.Icon}))),x=n.memo(({className:t,children:r=null,variant:e="standard",clearIcon:p=null,hasLabel:a=false,htmlAttributes:d,clear:s})=>{let m={...d,$adornmentVariant:e,$hasLabel:a,className:y__default.default("post-adornment",`post-adornment--variant-${e}`,a&&"post-adornment--hasLabel",t)};return s?n__default.default.createElement(o.ButtonContainer,{...m,onClick:s},p??n__default.default.createElement(P,{name:"x"})):r?n__default.default.createElement(o.Container,{...m},r):null});x.displayName="PostAdornment";exports.PostAdornment=x;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
type TPostAdornmentVariant = "outlined" | "filled" | "standard";
|
|
5
|
+
interface IPostAdornmentProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
variant?: TPostAdornmentVariant;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
clearIcon?: ReactNode;
|
|
10
|
+
hasLabel?: boolean;
|
|
11
|
+
htmlAttributes?: HTMLAttributes<HTMLSpanElement & HTMLButtonElement> & IExtendable;
|
|
12
|
+
clear?: () => void;
|
|
13
|
+
}
|
|
14
|
+
interface IStyledContainerProps {
|
|
15
|
+
$adornmentVariant: TPostAdornmentVariant;
|
|
16
|
+
$hasLabel: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare const PostAdornment: React.MemoExoticComponent<({ className, children, variant, clearIcon, hasLabel, htmlAttributes, clear, }: IPostAdornmentProps) => React.JSX.Element | null>;
|
|
20
|
+
|
|
21
|
+
export { type IPostAdornmentProps, type IStyledContainerProps, PostAdornment, type TPostAdornmentVariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
type TPostAdornmentVariant = "outlined" | "filled" | "standard";
|
|
5
|
+
interface IPostAdornmentProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
variant?: TPostAdornmentVariant;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
clearIcon?: ReactNode;
|
|
10
|
+
hasLabel?: boolean;
|
|
11
|
+
htmlAttributes?: HTMLAttributes<HTMLSpanElement & HTMLButtonElement> & IExtendable;
|
|
12
|
+
clear?: () => void;
|
|
13
|
+
}
|
|
14
|
+
interface IStyledContainerProps {
|
|
15
|
+
$adornmentVariant: TPostAdornmentVariant;
|
|
16
|
+
$hasLabel: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare const PostAdornment: React.MemoExoticComponent<({ className, children, variant, clearIcon, hasLabel, htmlAttributes, clear, }: IPostAdornmentProps) => React.JSX.Element | null>;
|
|
20
|
+
|
|
21
|
+
export { type IPostAdornmentProps, type IStyledContainerProps, PostAdornment, type TPostAdornmentVariant };
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})(["", ";", ";"], C, m)
|
|
15
|
-
}, x = c(() => import("@purr-react-styled-components/components.icon").then((n) => ({
|
|
16
|
-
default: n.Icon
|
|
17
|
-
}))), h = u(({
|
|
18
|
-
className: n,
|
|
19
|
-
children: o = null,
|
|
20
|
-
variant: a = "standard",
|
|
21
|
-
clearIcon: d = null,
|
|
22
|
-
hasLabel: r = !1,
|
|
23
|
-
htmlAttributes: p,
|
|
24
|
-
clear: e
|
|
25
|
-
}) => {
|
|
26
|
-
const s = {
|
|
27
|
-
...p,
|
|
28
|
-
$adornmentVariant: a,
|
|
29
|
-
$hasLabel: r,
|
|
30
|
-
className: f("post-adornment", `post-adornment--variant-${a}`, r && "post-adornment--hasLabel", n)
|
|
31
|
-
};
|
|
32
|
-
return e ? /* @__PURE__ */ t(l.ButtonContainer, { ...s, onClick: e, children: d ?? /* @__PURE__ */ t(x, { name: "x" }) }) : o ? /* @__PURE__ */ t(l.Container, { ...s, children: o }) : null;
|
|
33
|
-
});
|
|
34
|
-
h.displayName = "PostAdornment";
|
|
35
|
-
export {
|
|
36
|
-
h as PostAdornment
|
|
37
|
-
};
|
|
1
|
+
import y from'clsx';import n,{lazy,memo}from'react';import i,{css}from'styled-components';import {getInvisibleButton}from'@purr-react-styled-components/utils.helpers';var l=t=>css`
|
|
2
|
+
display: flex;
|
|
3
|
+
position: absolute;
|
|
4
|
+
transform: translateY(-50%);
|
|
5
|
+
color: #ffffff;
|
|
6
|
+
top: ${t.$hasLabel?"calc(50% + 6px)":"50%"};
|
|
7
|
+
right: ${t.$adornmentVariant==="standard"?"0px":"14px"};
|
|
8
|
+
`,o={Container:i.span`
|
|
9
|
+
${l};
|
|
10
|
+
`,ButtonContainer:i.button`
|
|
11
|
+
${getInvisibleButton};
|
|
12
|
+
${l};
|
|
13
|
+
`};var P=lazy(()=>import('@purr-react-styled-components/components.icon').then(t=>({default:t.Icon}))),x=memo(({className:t,children:r=null,variant:e="standard",clearIcon:p=null,hasLabel:a=false,htmlAttributes:d,clear:s})=>{let m={...d,$adornmentVariant:e,$hasLabel:a,className:y("post-adornment",`post-adornment--variant-${e}`,a&&"post-adornment--hasLabel",t)};return s?n.createElement(o.ButtonContainer,{...m,onClick:s},p??n.createElement(P,{name:"x"})):r?n.createElement(o.Container,{...m},r):null});x.displayName="PostAdornment";export{x as PostAdornment};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-styled-components/components.post-adornment",
|
|
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,9 +25,9 @@
|
|
|
25
25
|
"react": "*",
|
|
26
26
|
"styled-components": "*",
|
|
27
27
|
"clsx": "*",
|
|
28
|
-
"@purr-core/utils.definitions": "0.0.
|
|
29
|
-
"@purr-react-styled-components/utils.helpers": "0.0.
|
|
30
|
-
"@purr-react-styled-components/components.icon": "0.0.
|
|
28
|
+
"@purr-core/utils.definitions": "0.0.12",
|
|
29
|
+
"@purr-react-styled-components/utils.helpers": "0.0.8",
|
|
30
|
+
"@purr-react-styled-components/components.icon": "0.0.9"
|
|
31
31
|
},
|
|
32
32
|
"author": "@DinhThienPhuc",
|
|
33
33
|
"license": "ISC",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "vite build --watch",
|
|
38
38
|
"build": "tsc && vite build",
|
|
39
|
+
"build:vite": "tsc && vite build",
|
|
40
|
+
"build:tsup": "tsup",
|
|
39
41
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
40
42
|
}
|
|
41
43
|
}
|
package/dist/_components.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { IPostAdornmentProps } from './_types';
|
|
3
|
-
|
|
4
|
-
export declare const PostAdornment: React.MemoExoticComponent<({ className, children, variant, clearIcon, hasLabel, htmlAttributes, clear, }: IPostAdornmentProps) => React.JSX.Element | null>;
|
package/dist/_style.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IStyledContainerProps } from './_types';
|
|
2
|
-
|
|
3
|
-
export declare const Styled: {
|
|
4
|
-
Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, IStyledContainerProps>> & string;
|
|
5
|
-
ButtonContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, IStyledContainerProps>> & string;
|
|
6
|
-
};
|
package/dist/_types.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
-
|
|
4
|
-
export type TPostAdornmentVariant = "outlined" | "filled" | "standard";
|
|
5
|
-
export interface IPostAdornmentProps {
|
|
6
|
-
className?: string;
|
|
7
|
-
variant?: TPostAdornmentVariant;
|
|
8
|
-
children?: ReactNode;
|
|
9
|
-
clearIcon?: ReactNode;
|
|
10
|
-
hasLabel?: boolean;
|
|
11
|
-
htmlAttributes?: HTMLAttributes<HTMLSpanElement & HTMLButtonElement> & IExtendable;
|
|
12
|
-
clear?: () => void;
|
|
13
|
-
}
|
|
14
|
-
export interface IStyledContainerProps {
|
|
15
|
-
$adornmentVariant: TPostAdornmentVariant;
|
|
16
|
-
$hasLabel: boolean;
|
|
17
|
-
}
|