@purr-react-tailwindcss/components.text-field 0.0.6 → 0.0.7
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 +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +1 -0
- package/package.json +10 -10
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var p=require('clsx'),e=require('react'),V=require('@purr-core/hooks.focus-with-callback'),B=require('@purr-core/hooks.sync-state-with-props'),utils_helpers=require('@purr-react-tailwindcss/utils.helpers');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var p__default=/*#__PURE__*/_interopDefault(p);var e__default=/*#__PURE__*/_interopDefault(e);var V__default=/*#__PURE__*/_interopDefault(V);var B__default=/*#__PURE__*/_interopDefault(B);var W=e.lazy(()=>import('@purr-react-tailwindcss/components.helper-text').then(t=>({default:t.HelperText}))),$=e.lazy(()=>import('@purr-react-tailwindcss/components.label').then(t=>({default:t.Label}))),k=e.lazy(()=>import('@purr-react-tailwindcss/components.post-adornment').then(t=>({default:t.PostAdornment}))),q=e.lazy(()=>import('@purr-react-tailwindcss/components.pre-adornment').then(t=>({default:t.PreAdornment}))),z=e.forwardRef(({value:t="",variant:n="standard",onChange:g,onFocus:C,onBlur:F,clear:h,htmlAttributes:b,inputHtmlAttributes:v,labelProps:i,preAdornmentProps:r,postAdornmentProps:o,helperTextProps:f,fullWidth:L=false,disabled:l=false,required:s=false,error:d=null,isStandalone:S=false},T)=>{let{currentValue:c,setCurrentValue:E}=B__default.default(t,S),{captureOnFocus:H,captureOnBlur:I,isFocused:x}=V__default.default({onFocus:C,onBlur:F}),w=!!(x||r?.children||c),y=m=>{g?.(m.target.value,m),E(m.target.value);};return e__default.default.createElement("div",{className:p__default.default("relative h-14 rounded transition-all duration-200 ease-in-out",utils_helpers.getVariantClasses(n,l),"text-field",L&&"text-field--full-width",s&&"text-field--required",l&&"text-field--disabled",d&&"text-field--error",`text-field--variant-${n}`),...b},e__default.default.createElement(e.Suspense,null,!!i?.children&&e__default.default.createElement($,{...i,variant:n,disabled:l,required:s,isLabelCollapsed:w,isFocused:x,isError:!!d})),e__default.default.createElement(e.Suspense,null,!!r?.children&&e__default.default.createElement(q,{...r,hasLabel:!!i?.children,variant:n})),e__default.default.createElement("input",{ref:T,value:c,disabled:l,required:s,onChange:y,onFocus:H,onBlur:I,className:p__default.default(utils_helpers.getInputPaddingClasses(!!r?.children,!!h||!!o?.children,n),"box-border w-full rounded border-none bg-transparent text-base text-white outline-none transition-all duration-200 ease-in-out",i?.children?"mt-3 h-11 leading-[2.75rem]":"mt-0 h-14 leading-[3.5rem]","text-field-input",`text-field-input--variant-${n}`,l&&"text-field-input--disabled",s&&"text-field-input--required"),...v}),e__default.default.createElement(e.Suspense,null,!!o?.children&&e__default.default.createElement(k,{...o,clear:h,variant:n})),e__default.default.createElement(e.Suspense,null,f?.children&&e__default.default.createElement(W,{...f,isError:!!d,variant:n},d?.message??f?.children??"")))});z.displayName="TextField";exports.TextField=z;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { ChangeEvent, FocusEventHandler, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { FieldError } from 'react-hook-form';
|
|
3
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
4
|
+
import { IHelperTextProps } from '@purr-react-tailwindcss/components.helper-text';
|
|
5
|
+
import { ILabelProps } from '@purr-react-tailwindcss/components.label';
|
|
6
|
+
import { IPostAdornmentProps } from '@purr-react-tailwindcss/components.post-adornment';
|
|
7
|
+
import { IPreAdornmentProps } from '@purr-react-tailwindcss/components.pre-adornment';
|
|
8
|
+
|
|
9
|
+
type TTextFieldVariant = "standard" | "outlined" | "filled";
|
|
10
|
+
interface ITextFieldProps {
|
|
11
|
+
value?: string;
|
|
12
|
+
variant?: TTextFieldVariant;
|
|
13
|
+
onChange?: (value: string, e: ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
15
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
16
|
+
clear?: () => void;
|
|
17
|
+
htmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
18
|
+
inputHtmlAttributes?: InputHTMLAttributes<HTMLInputElement> & IExtendable;
|
|
19
|
+
labelProps?: ILabelProps;
|
|
20
|
+
preAdornmentProps?: IPreAdornmentProps;
|
|
21
|
+
postAdornmentProps?: IPostAdornmentProps;
|
|
22
|
+
helperTextProps?: IHelperTextProps;
|
|
23
|
+
fullWidth?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
error?: FieldError;
|
|
27
|
+
isStandalone?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare const TextField: React.ForwardRefExoticComponent<ITextFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
31
|
+
|
|
32
|
+
export { type ITextFieldProps, type TTextFieldVariant, TextField };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { ChangeEvent, FocusEventHandler, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { FieldError } from 'react-hook-form';
|
|
3
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
4
|
+
import { IHelperTextProps } from '@purr-react-tailwindcss/components.helper-text';
|
|
5
|
+
import { ILabelProps } from '@purr-react-tailwindcss/components.label';
|
|
6
|
+
import { IPostAdornmentProps } from '@purr-react-tailwindcss/components.post-adornment';
|
|
7
|
+
import { IPreAdornmentProps } from '@purr-react-tailwindcss/components.pre-adornment';
|
|
8
|
+
|
|
9
|
+
type TTextFieldVariant = "standard" | "outlined" | "filled";
|
|
10
|
+
interface ITextFieldProps {
|
|
11
|
+
value?: string;
|
|
12
|
+
variant?: TTextFieldVariant;
|
|
13
|
+
onChange?: (value: string, e: ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
15
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
16
|
+
clear?: () => void;
|
|
17
|
+
htmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
18
|
+
inputHtmlAttributes?: InputHTMLAttributes<HTMLInputElement> & IExtendable;
|
|
19
|
+
labelProps?: ILabelProps;
|
|
20
|
+
preAdornmentProps?: IPreAdornmentProps;
|
|
21
|
+
postAdornmentProps?: IPostAdornmentProps;
|
|
22
|
+
helperTextProps?: IHelperTextProps;
|
|
23
|
+
fullWidth?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
error?: FieldError;
|
|
27
|
+
isStandalone?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare const TextField: React.ForwardRefExoticComponent<ITextFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
31
|
+
|
|
32
|
+
export { type ITextFieldProps, type TTextFieldVariant, TextField };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from'clsx';import e,{lazy,forwardRef,Suspense}from'react';import V from'@purr-core/hooks.focus-with-callback';import B from'@purr-core/hooks.sync-state-with-props';import {getVariantClasses,getInputPaddingClasses}from'@purr-react-tailwindcss/utils.helpers';var W=lazy(()=>import('@purr-react-tailwindcss/components.helper-text').then(t=>({default:t.HelperText}))),$=lazy(()=>import('@purr-react-tailwindcss/components.label').then(t=>({default:t.Label}))),k=lazy(()=>import('@purr-react-tailwindcss/components.post-adornment').then(t=>({default:t.PostAdornment}))),q=lazy(()=>import('@purr-react-tailwindcss/components.pre-adornment').then(t=>({default:t.PreAdornment}))),z=forwardRef(({value:t="",variant:n="standard",onChange:g,onFocus:C,onBlur:F,clear:h,htmlAttributes:b,inputHtmlAttributes:v,labelProps:i,preAdornmentProps:r,postAdornmentProps:o,helperTextProps:f,fullWidth:L=false,disabled:l=false,required:s=false,error:d=null,isStandalone:S=false},T)=>{let{currentValue:c,setCurrentValue:E}=B(t,S),{captureOnFocus:H,captureOnBlur:I,isFocused:x}=V({onFocus:C,onBlur:F}),w=!!(x||r?.children||c),y=m=>{g?.(m.target.value,m),E(m.target.value);};return e.createElement("div",{className:p("relative h-14 rounded transition-all duration-200 ease-in-out",getVariantClasses(n,l),"text-field",L&&"text-field--full-width",s&&"text-field--required",l&&"text-field--disabled",d&&"text-field--error",`text-field--variant-${n}`),...b},e.createElement(Suspense,null,!!i?.children&&e.createElement($,{...i,variant:n,disabled:l,required:s,isLabelCollapsed:w,isFocused:x,isError:!!d})),e.createElement(Suspense,null,!!r?.children&&e.createElement(q,{...r,hasLabel:!!i?.children,variant:n})),e.createElement("input",{ref:T,value:c,disabled:l,required:s,onChange:y,onFocus:H,onBlur:I,className:p(getInputPaddingClasses(!!r?.children,!!h||!!o?.children,n),"box-border w-full rounded border-none bg-transparent text-base text-white outline-none transition-all duration-200 ease-in-out",i?.children?"mt-3 h-11 leading-[2.75rem]":"mt-0 h-14 leading-[3.5rem]","text-field-input",`text-field-input--variant-${n}`,l&&"text-field-input--disabled",s&&"text-field-input--required"),...v}),e.createElement(Suspense,null,!!o?.children&&e.createElement(k,{...o,clear:h,variant:n})),e.createElement(Suspense,null,f?.children&&e.createElement(W,{...f,isError:!!d,variant:n},d?.message??f?.children??"")))});z.displayName="TextField";export{z as TextField};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-tailwindcss/components.text-field",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"typescript": "*",
|
|
25
25
|
"react": "*",
|
|
26
26
|
"clsx": "*",
|
|
27
|
-
"@purr-core/utils.definitions": "0.0.
|
|
28
|
-
"@purr-react-tailwindcss/components.helper-text": "0.0.
|
|
29
|
-
"@purr-react-tailwindcss/components.
|
|
30
|
-
"@purr-react-tailwindcss/components.
|
|
31
|
-
"@purr-
|
|
32
|
-
"@purr-core/hooks.
|
|
33
|
-
"@purr-
|
|
34
|
-
"@purr-react-tailwindcss/utils.helpers": "0.0.
|
|
27
|
+
"@purr-core/utils.definitions": "0.0.12",
|
|
28
|
+
"@purr-react-tailwindcss/components.helper-text": "0.0.8",
|
|
29
|
+
"@purr-react-tailwindcss/components.label": "0.0.8",
|
|
30
|
+
"@purr-react-tailwindcss/components.post-adornment": "0.0.8",
|
|
31
|
+
"@purr-react-tailwindcss/components.pre-adornment": "0.0.8",
|
|
32
|
+
"@purr-core/hooks.focus-with-callback": "0.0.9",
|
|
33
|
+
"@purr-core/hooks.sync-state-with-props": "0.0.9",
|
|
34
|
+
"@purr-react-tailwindcss/utils.helpers": "0.0.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@purr-react-tailwindcss/components.icon": "0.0.
|
|
37
|
+
"@purr-react-tailwindcss/components.icon": "0.0.8"
|
|
38
38
|
},
|
|
39
39
|
"author": "@DinhThienPhuc",
|
|
40
40
|
"license": "ISC",
|