@purr-react-tailwindcss/components.label 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 +20 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +50 -0
- package/package.json +38 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ILabelProps } from './_types';
|
|
3
|
+
|
|
4
|
+
export declare const Label: React.MemoExoticComponent<({ children, required, disabled, hiddenLabel, isFocused, isError, variant, isLabelCollapsed, htmlAttributes, classes, }: ILabelProps) => React.JSX.Element | null>;
|
package/dist/_types.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
4
|
+
|
|
5
|
+
export type TLabelVariant = "outlined" | "filled" | "standard";
|
|
6
|
+
export interface ILabelClasses {
|
|
7
|
+
container?: ClassValue;
|
|
8
|
+
}
|
|
9
|
+
export interface ILabelProps {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
isFocused?: boolean;
|
|
14
|
+
hiddenLabel?: boolean;
|
|
15
|
+
variant?: TLabelVariant;
|
|
16
|
+
isLabelCollapsed?: boolean;
|
|
17
|
+
isError?: boolean;
|
|
18
|
+
htmlAttributes?: HTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
19
|
+
classes?: ILabelClasses;
|
|
20
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),m=require("clsx"),b=require("react"),x=b.memo(({children:f="",required:o=!1,disabled:t=!1,hiddenLabel:u=!1,isFocused:r=!1,isError:e=!1,variant:l="standard",isLabelCollapsed:a=!1,htmlAttributes:s,classes:n})=>u||!f?null:i.jsxs("span",{className:m("transition-all","duration-200","ease-in-out","delay-100","absolute","top-1/2","transform","-translate-y-1/2",l==="standard"&&(a?"top-3 left-0 text-xs":"left-0 text-base"),l==="filled"&&(a?"top-3 left-3.5 text-xs":"left-3.5 text-base"),l==="outlined"&&(a?"top-3 left-3.5 text-xs":"left-3.5 text-base"),t&&"text-white/50",!t&&e&&"text-red-500",!t&&!e&&r&&"text-blue-300",!t&&!e&&!r&&"text-white","label",n==null?void 0:n.container),...s,children:[f," ",o?"*":""]}));x.displayName="Label";exports.Label=x;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import u from "clsx";
|
|
3
|
+
import { memo as i } from "react";
|
|
4
|
+
const s = i(
|
|
5
|
+
({
|
|
6
|
+
children: x = "",
|
|
7
|
+
required: n = !1,
|
|
8
|
+
disabled: t = !1,
|
|
9
|
+
hiddenLabel: r = !1,
|
|
10
|
+
isFocused: o = !1,
|
|
11
|
+
isError: e = !1,
|
|
12
|
+
variant: f = "standard",
|
|
13
|
+
isLabelCollapsed: l = !1,
|
|
14
|
+
htmlAttributes: m,
|
|
15
|
+
classes: a
|
|
16
|
+
}) => r || !x ? null : /* @__PURE__ */ p(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
className: u(
|
|
20
|
+
"transition-all",
|
|
21
|
+
"duration-200",
|
|
22
|
+
"ease-in-out",
|
|
23
|
+
"delay-100",
|
|
24
|
+
"absolute",
|
|
25
|
+
"top-1/2",
|
|
26
|
+
"transform",
|
|
27
|
+
"-translate-y-1/2",
|
|
28
|
+
f === "standard" && (l ? "top-3 left-0 text-xs" : "left-0 text-base"),
|
|
29
|
+
f === "filled" && (l ? "top-3 left-3.5 text-xs" : "left-3.5 text-base"),
|
|
30
|
+
f === "outlined" && (l ? "top-3 left-3.5 text-xs" : "left-3.5 text-base"),
|
|
31
|
+
t && "text-white/50",
|
|
32
|
+
!t && e && "text-red-500",
|
|
33
|
+
!t && !e && o && "text-blue-300",
|
|
34
|
+
!t && !e && !o && "text-white",
|
|
35
|
+
"label",
|
|
36
|
+
a == null ? void 0 : a.container
|
|
37
|
+
),
|
|
38
|
+
...m,
|
|
39
|
+
children: [
|
|
40
|
+
x,
|
|
41
|
+
" ",
|
|
42
|
+
n ? "*" : ""
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
s.displayName = "Label";
|
|
48
|
+
export {
|
|
49
|
+
s as Label
|
|
50
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@purr-react-tailwindcss/components.label",
|
|
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
|
+
},
|
|
29
|
+
"author": "@DinhThienPhuc",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"description": "",
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "vite build --watch",
|
|
35
|
+
"build": "tsc && vite build",
|
|
36
|
+
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
37
|
+
}
|
|
38
|
+
}
|