@purr-react-tailwindcss/components.post-adornment 0.0.1
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/_components.d.ts +4 -0
- package/dist/_types.d.ts +17 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +59 -0
- package/package.json +39 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IPostAdornmentProps } from './_types';
|
|
3
|
+
|
|
4
|
+
export declare const PostAdornment: React.MemoExoticComponent<({ classes, children, variant, clearIcon, hasLabel, htmlAttributes, clear, }: IPostAdornmentProps) => React.JSX.Element | null>;
|
package/dist/_types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
4
|
+
|
|
5
|
+
export type TPostAdornmentVariant = "outlined" | "filled" | "standard";
|
|
6
|
+
export interface IPostAdornmentClasses {
|
|
7
|
+
container?: ClassValue;
|
|
8
|
+
}
|
|
9
|
+
export interface IPostAdornmentProps {
|
|
10
|
+
classes?: IPostAdornmentClasses;
|
|
11
|
+
variant?: TPostAdornmentVariant;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
clearIcon?: ReactNode;
|
|
14
|
+
hasLabel?: boolean;
|
|
15
|
+
htmlAttributes?: HTMLAttributes<HTMLSpanElement & HTMLButtonElement> & IExtendable;
|
|
16
|
+
clear?: () => void;
|
|
17
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),d=require("clsx"),l=require("react"),p=require("@purr-react-tailwindcss/components.icon"),u=l.memo(({classes:t,children:o=null,variant:r="standard",clearIcon:m=null,hasLabel:e=!1,htmlAttributes:i,clear:a})=>a?n.jsx("button",{className:d("flex","absolute","text-white","top-1/2","transform","-translate-y-1/2","bg-transparent","outline-none","border-none",r==="standard"?"right-0":"right-3.5","post-adornment",t==null?void 0:t.container),style:e?{top:"calc(50% + 6px)"}:void 0,onClick:a,...i,children:m??n.jsx(p.Icon,{name:"x"})}):o?n.jsx("span",{className:d("flex","absolute","text-white","top-1/2","transform","-translate-y-1/2",r==="standard"?"right-0":"right-3.5","post-adornment",t==null?void 0:t.container),style:e?{top:"calc(50% + 6px)"}:void 0,...i,children:o}):null);u.displayName="PostAdornment";exports.PostAdornment=u;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import i from "clsx";
|
|
3
|
+
import { memo as d } from "react";
|
|
4
|
+
import { Icon as f } from "@purr-react-tailwindcss/components.icon";
|
|
5
|
+
const l = d(
|
|
6
|
+
({
|
|
7
|
+
classes: t,
|
|
8
|
+
children: n = null,
|
|
9
|
+
variant: r = "standard",
|
|
10
|
+
clearIcon: p = null,
|
|
11
|
+
hasLabel: e = !1,
|
|
12
|
+
htmlAttributes: m,
|
|
13
|
+
clear: a
|
|
14
|
+
}) => a ? /* @__PURE__ */ o(
|
|
15
|
+
"button",
|
|
16
|
+
{
|
|
17
|
+
className: i(
|
|
18
|
+
"flex",
|
|
19
|
+
"absolute",
|
|
20
|
+
"text-white",
|
|
21
|
+
"top-1/2",
|
|
22
|
+
"transform",
|
|
23
|
+
"-translate-y-1/2",
|
|
24
|
+
"bg-transparent",
|
|
25
|
+
"outline-none",
|
|
26
|
+
"border-none",
|
|
27
|
+
r === "standard" ? "right-0" : "right-3.5",
|
|
28
|
+
"post-adornment",
|
|
29
|
+
t == null ? void 0 : t.container
|
|
30
|
+
),
|
|
31
|
+
style: e ? { top: "calc(50% + 6px)" } : void 0,
|
|
32
|
+
onClick: a,
|
|
33
|
+
...m,
|
|
34
|
+
children: p ?? /* @__PURE__ */ o(f, { name: "x" })
|
|
35
|
+
}
|
|
36
|
+
) : n ? /* @__PURE__ */ o(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: i(
|
|
40
|
+
"flex",
|
|
41
|
+
"absolute",
|
|
42
|
+
"text-white",
|
|
43
|
+
"top-1/2",
|
|
44
|
+
"transform",
|
|
45
|
+
"-translate-y-1/2",
|
|
46
|
+
r === "standard" ? "right-0" : "right-3.5",
|
|
47
|
+
"post-adornment",
|
|
48
|
+
t == null ? void 0 : t.container
|
|
49
|
+
),
|
|
50
|
+
style: e ? { top: "calc(50% + 6px)" } : void 0,
|
|
51
|
+
...m,
|
|
52
|
+
children: n
|
|
53
|
+
}
|
|
54
|
+
) : null
|
|
55
|
+
);
|
|
56
|
+
l.displayName = "PostAdornment";
|
|
57
|
+
export {
|
|
58
|
+
l as PostAdornment
|
|
59
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@purr-react-tailwindcss/components.post-adornment",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"typescript": "*",
|
|
25
|
+
"react": "*",
|
|
26
|
+
"clsx": "*",
|
|
27
|
+
"@purr-core/utils.definitions": "0.0.5",
|
|
28
|
+
"@purr-react-tailwindcss/components.icon": "0.0.1"
|
|
29
|
+
},
|
|
30
|
+
"author": "@DinhThienPhuc",
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"description": "",
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "vite build --watch",
|
|
36
|
+
"build": "tsc && vite build",
|
|
37
|
+
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
38
|
+
}
|
|
39
|
+
}
|