@purr-react-styled-components/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/_style.d.ts +6 -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 +37 -0
- package/package.json +41 -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<({ className, children, variant, clearIcon, hasLabel, htmlAttributes, clear, }: IPostAdornmentProps) => React.JSX.Element | null>;
|
package/dist/_style.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var y=Object.create;var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var _=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!h.call(n,o)&&o!==e&&c(n,o,{get:()=>t[o],enumerable:!(r=x(t,o))||r.enumerable});return n};var g=(n,t,e)=>(e=n!=null?y(b(n)):{},_(t||!n||!n.__esModule?c(e,"default",{value:n,enumerable:!0}):e,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),j=require("clsx"),u=require("react"),a=require("styled-components"),q=require("@purr-react-styled-components/utils.helpers"),d=n=>a.css(["display:flex;position:absolute;transform:translateY(-50%);color:#ffffff;top:",";right:",";"],n.$hasLabel?"calc(50% + 6px)":"50%",n.$adornmentVariant==="standard"?"0px":"14px"),m={Container:a.span.withConfig({displayName:"_style__Container",componentId:"sc-1nzmnwy-0"})(["",";"],d),ButtonContainer:a.button.withConfig({displayName:"_style__ButtonContainer",componentId:"sc-1nzmnwy-1"})(["",";",";"],q.getInvisibleButton,d)},I=u.lazy(()=>import("@purr-react-styled-components/components.icon").then(n=>({default:n.Icon}))),p=u.memo(({className:n,children:t=null,variant:e="standard",clearIcon:r=null,hasLabel:o=!1,htmlAttributes:f,clear:i})=>{const l={...f,$adornmentVariant:e,$hasLabel:o,className:j("post-adornment",`post-adornment--variant-${e}`,o&&"post-adornment--hasLabel",n)};return i?s.jsx(m.ButtonContainer,{...l,onClick:i,children:r??s.jsx(I,{name:"x"})}):t?s.jsx(m.Container,{...l,children:t}):null});p.displayName="PostAdornment";exports.PostAdornment=p;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import f from "clsx";
|
|
3
|
+
import { lazy as c, memo as u } from "react";
|
|
4
|
+
import i, { css as y } from "styled-components";
|
|
5
|
+
import { getInvisibleButton as C } from "@purr-react-styled-components/utils.helpers";
|
|
6
|
+
const m = (n) => y(["display:flex;position:absolute;transform:translateY(-50%);color:#ffffff;top:", ";right:", ";"], n.$hasLabel ? "calc(50% + 6px)" : "50%", n.$adornmentVariant === "standard" ? "0px" : "14px"), l = {
|
|
7
|
+
Container: i.span.withConfig({
|
|
8
|
+
displayName: "_style__Container",
|
|
9
|
+
componentId: "sc-1nzmnwy-0"
|
|
10
|
+
})(["", ";"], m),
|
|
11
|
+
ButtonContainer: i.button.withConfig({
|
|
12
|
+
displayName: "_style__ButtonContainer",
|
|
13
|
+
componentId: "sc-1nzmnwy-1"
|
|
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
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@purr-react-styled-components/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
|
+
"styled-components": "*",
|
|
27
|
+
"clsx": "*",
|
|
28
|
+
"@purr-core/utils.definitions": "0.0.4",
|
|
29
|
+
"@purr-react-styled-components/utils.helpers": "0.0.1",
|
|
30
|
+
"@purr-react-styled-components/components.icon": "0.0.1"
|
|
31
|
+
},
|
|
32
|
+
"author": "@DinhThienPhuc",
|
|
33
|
+
"license": "ISC",
|
|
34
|
+
"description": "",
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"scripts": {
|
|
37
|
+
"dev": "vite build --watch",
|
|
38
|
+
"build": "tsc && vite build",
|
|
39
|
+
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
40
|
+
}
|
|
41
|
+
}
|