@purr-react-tailwindcss/components.text-field 0.0.4 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purr-react-tailwindcss/components.text-field",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
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-react-tailwindcss/components.helper-text": "0.0.5",
28
- "@purr-core/utils.definitions": "0.0.9",
29
- "@purr-react-tailwindcss/components.label": "0.0.5",
30
- "@purr-react-tailwindcss/components.pre-adornment": "0.0.5",
31
- "@purr-core/hooks.sync-state-with-props": "0.0.7",
32
- "@purr-core/hooks.focus-with-callback": "0.0.7",
33
- "@purr-react-tailwindcss/utils.helpers": "0.0.4",
34
- "@purr-react-tailwindcss/components.post-adornment": "0.0.5"
27
+ "@purr-core/utils.definitions": "0.0.11",
28
+ "@purr-react-tailwindcss/components.helper-text": "0.0.7",
29
+ "@purr-react-tailwindcss/components.post-adornment": "0.0.7",
30
+ "@purr-react-tailwindcss/components.pre-adornment": "0.0.7",
31
+ "@purr-core/hooks.focus-with-callback": "0.0.8",
32
+ "@purr-core/hooks.sync-state-with-props": "0.0.8",
33
+ "@purr-react-tailwindcss/components.label": "0.0.7",
34
+ "@purr-react-tailwindcss/utils.helpers": "0.0.5"
35
35
  },
36
36
  "devDependencies": {
37
- "@purr-react-tailwindcss/components.icon": "0.0.5"
37
+ "@purr-react-tailwindcss/components.icon": "0.0.7"
38
38
  },
39
39
  "author": "@DinhThienPhuc",
40
40
  "license": "ISC",
@@ -43,6 +43,8 @@
43
43
  "scripts": {
44
44
  "dev": "vite build --watch",
45
45
  "build": "tsc && vite build",
46
+ "build:vite": "tsc && vite build",
47
+ "build:tsup": "tsup",
46
48
  "lint": "eslint . --ext ts,tsx --max-warnings 0"
47
49
  }
48
50
  }
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ITextFieldProps } from './_types';
3
-
4
- export declare const TextField: React.ForwardRefExoticComponent<ITextFieldProps & React.RefAttributes<HTMLInputElement>>;
package/dist/_types.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import { 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
- export type TTextFieldVariant = "standard" | "outlined" | "filled";
10
- export 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
- }
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var v=Object.create;var w=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var G=(i,t,l,h)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of M(t))!D.call(i,d)&&d!==l&&w(i,d,{get:()=>t[d],enumerable:!(h=I(t,d))||h.enumerable});return i};var g=(i,t,l)=>(l=i!=null?v(_(i)):{},G(t||!i||!i.__esModule?w(l,"default",{value:i,enumerable:!0}):l,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),z=require("clsx"),a=require("react"),J=require("@purr-core/hooks.focus-with-callback"),K=require("@purr-core/hooks.sync-state-with-props"),L=require("@purr-react-tailwindcss/utils.helpers"),Q=a.lazy(()=>import("@purr-react-tailwindcss/components.helper-text").then(i=>({default:i.HelperText}))),U=a.lazy(()=>import("@purr-react-tailwindcss/components.label").then(i=>({default:i.Label}))),X=a.lazy(()=>import("@purr-react-tailwindcss/components.post-adornment").then(i=>({default:i.PostAdornment}))),Y=a.lazy(()=>import("@purr-react-tailwindcss/components.pre-adornment").then(i=>({default:i.PreAdornment}))),C=a.forwardRef(({value:i="",variant:t="standard",onChange:l,onFocus:h,onBlur:d,clear:S,htmlAttributes:N,inputHtmlAttributes:O,labelProps:e,preAdornmentProps:u,postAdornmentProps:n,helperTextProps:f,fullWidth:V=!1,disabled:s=!1,required:j=!1,error:x=null,isStandalone:B=!1},E)=>{const{currentValue:F,setCurrentValue:H}=K(i,B),{captureOnFocus:R,captureOnBlur:W,isFocused:q}=J({onFocus:h,onBlur:d}),$=!!(q||u!=null&&u.children||F),k=y=>{l==null||l(y.target.value,y),H(y.target.value)};return c.jsxs("div",{className:z("relative h-14 rounded transition-all duration-200 ease-in-out",L.getVariantClasses(t,s),"text-field",V&&"text-field--full-width",j&&"text-field--required",s&&"text-field--disabled",x&&"text-field--error",`text-field--variant-${t}`),...N,children:[c.jsx(a.Suspense,{children:!!(e!=null&&e.children)&&c.jsx(U,{...e,variant:t,disabled:s,required:j,isLabelCollapsed:$,isFocused:q,isError:!!x})}),c.jsx(a.Suspense,{children:!!(u!=null&&u.children)&&c.jsx(Y,{...u,hasLabel:!!(e!=null&&e.children),variant:t})}),c.jsx("input",{ref:E,value:F,disabled:s,required:j,onChange:k,onFocus:R,onBlur:W,className:z(L.getInputPaddingClasses(!!(u!=null&&u.children),!!S||!!(n!=null&&n.children),t),"box-border w-full rounded border-none bg-transparent text-base text-white outline-none transition-all duration-200 ease-in-out",e!=null&&e.children?"mt-3 h-11 leading-[2.75rem]":"mt-0 h-14 leading-[3.5rem]","text-field-input",`text-field-input--variant-${t}`,s&&"text-field-input--disabled",j&&"text-field-input--required"),...O}),c.jsx(a.Suspense,{children:!!(n!=null&&n.children)&&c.jsx(X,{...n,clear:S,variant:t})}),c.jsx(a.Suspense,{children:(f==null?void 0:f.children)&&c.jsx(Q,{...f,isError:!!x,variant:t,children:(x==null?void 0:x.message)??(f==null?void 0:f.children)??""})})]})});C.displayName="TextField";exports.TextField=C;
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './_components';
2
- export * from './_types';
package/dist/index.js DELETED
@@ -1,137 +0,0 @@
1
- import { jsxs as z, jsx as c } from "react/jsx-runtime";
2
- import y from "clsx";
3
- import { lazy as x, forwardRef as I, Suspense as n } from "react";
4
- import R from "@purr-core/hooks.focus-with-callback";
5
- import v from "@purr-core/hooks.sync-state-with-props";
6
- import { getVariantClasses as D, getInputPaddingClasses as G } from "@purr-react-tailwindcss/utils.helpers";
7
- const J = x(
8
- () => import("@purr-react-tailwindcss/components.helper-text").then((u) => ({
9
- default: u.HelperText
10
- }))
11
- ), K = x(
12
- () => import("@purr-react-tailwindcss/components.label").then((u) => ({
13
- default: u.Label
14
- }))
15
- ), M = x(
16
- () => import("@purr-react-tailwindcss/components.post-adornment").then(
17
- (u) => ({
18
- default: u.PostAdornment
19
- })
20
- )
21
- ), Q = x(
22
- () => import("@purr-react-tailwindcss/components.pre-adornment").then((u) => ({
23
- default: u.PreAdornment
24
- }))
25
- ), U = I(
26
- ({
27
- value: u = "",
28
- variant: l = "standard",
29
- onChange: g,
30
- onFocus: C,
31
- onBlur: N,
32
- clear: w,
33
- htmlAttributes: S,
34
- inputHtmlAttributes: V,
35
- labelProps: i,
36
- preAdornmentProps: t,
37
- postAdornmentProps: f,
38
- helperTextProps: a,
39
- fullWidth: j = !1,
40
- disabled: e = !1,
41
- required: h = !1,
42
- error: d = null,
43
- isStandalone: B = !1
44
- }, E) => {
45
- const { currentValue: L, setCurrentValue: H } = v(u, B), { captureOnFocus: O, captureOnBlur: W, isFocused: m } = R({
46
- onFocus: C,
47
- onBlur: N
48
- }), $ = !!(m || t != null && t.children || L), k = (F) => {
49
- g == null || g(F.target.value, F), H(F.target.value);
50
- };
51
- return /* @__PURE__ */ z(
52
- "div",
53
- {
54
- className: y(
55
- "relative h-14 rounded transition-all duration-200 ease-in-out",
56
- D(l, e),
57
- "text-field",
58
- j && "text-field--full-width",
59
- h && "text-field--required",
60
- e && "text-field--disabled",
61
- d && "text-field--error",
62
- `text-field--variant-${l}`
63
- ),
64
- ...S,
65
- children: [
66
- /* @__PURE__ */ c(n, { children: !!(i != null && i.children) && /* @__PURE__ */ c(
67
- K,
68
- {
69
- ...i,
70
- variant: l,
71
- disabled: e,
72
- required: h,
73
- isLabelCollapsed: $,
74
- isFocused: m,
75
- isError: !!d
76
- }
77
- ) }),
78
- /* @__PURE__ */ c(n, { children: !!(t != null && t.children) && /* @__PURE__ */ c(
79
- Q,
80
- {
81
- ...t,
82
- hasLabel: !!(i != null && i.children),
83
- variant: l
84
- }
85
- ) }),
86
- /* @__PURE__ */ c(
87
- "input",
88
- {
89
- ref: E,
90
- value: L,
91
- disabled: e,
92
- required: h,
93
- onChange: k,
94
- onFocus: O,
95
- onBlur: W,
96
- className: y(
97
- G(
98
- !!(t != null && t.children),
99
- !!w || !!(f != null && f.children),
100
- l
101
- ),
102
- "box-border w-full rounded border-none bg-transparent text-base text-white outline-none transition-all duration-200 ease-in-out",
103
- i != null && i.children ? "mt-3 h-11 leading-[2.75rem]" : "mt-0 h-14 leading-[3.5rem]",
104
- "text-field-input",
105
- `text-field-input--variant-${l}`,
106
- e && "text-field-input--disabled",
107
- h && "text-field-input--required"
108
- ),
109
- ...V
110
- }
111
- ),
112
- /* @__PURE__ */ c(n, { children: !!(f != null && f.children) && /* @__PURE__ */ c(
113
- M,
114
- {
115
- ...f,
116
- clear: w,
117
- variant: l
118
- }
119
- ) }),
120
- /* @__PURE__ */ c(n, { children: (a == null ? void 0 : a.children) && /* @__PURE__ */ c(
121
- J,
122
- {
123
- ...a,
124
- isError: !!d,
125
- variant: l,
126
- children: (d == null ? void 0 : d.message) ?? (a == null ? void 0 : a.children) ?? ""
127
- }
128
- ) })
129
- ]
130
- }
131
- );
132
- }
133
- );
134
- U.displayName = "TextField";
135
- export {
136
- U as TextField
137
- };