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