@lotte-innovate/ui-component-test 0.0.156 → 0.0.157
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib/components/TextField/index.js +5 -1
- package/dist/lib/components/TextField/index.mjs +1 -1
- package/dist/lib/is-client-ctx.d.ts +4 -0
- package/dist/lib/is-client-ctx.js +11 -0
- package/dist/lib/is-client-ctx.mjs +2 -0
- package/dist/lib/is-client-ctx.mjs.map +1 -0
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
21
21
|
}
|
22
22
|
return t;
|
23
23
|
};
|
24
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
25
25
|
import React, { useState } from 'react';
|
26
26
|
import { cva } from 'class-variance-authority';
|
27
27
|
import { cn } from '../../../lib/utils/utils';
|
@@ -32,6 +32,7 @@ import { MAIN_COLOR } from '../../../lib/color/constants';
|
|
32
32
|
import Text from '../../../lib/Typography/Text';
|
33
33
|
import IconButton from '../IconButton';
|
34
34
|
import { EyeClosedIcon, EyeOpenIcon } from '@radix-ui/react-icons';
|
35
|
+
import { useIsClient } from '../../../lib/is-client-ctx';
|
35
36
|
var textFieldVariants = cva('', {
|
36
37
|
variants: {
|
37
38
|
radius: __assign({}, radiusVariants['base']),
|
@@ -62,6 +63,9 @@ export var Root = React.forwardRef(function (_a, forwardedRef) {
|
|
62
63
|
message = '숫자만 입력 가능합니다.';
|
63
64
|
if (validationType == 'email')
|
64
65
|
message = '이메일 형식에 어긋납니다.';
|
66
|
+
var isClient = useIsClient();
|
67
|
+
if (!isClient)
|
68
|
+
return _jsx(_Fragment, {});
|
65
69
|
return (_jsxs("div", { children: [_jsx(Theme, { scaling: contextValue.scaling, accentColor: contextValue.color, hasBackground: false, children: _jsxs(TextFieldTheme.Root, __assign({ ref: forwardedRef, variant: appearance, size: sizeTheme, type: validationType !== 'password' || isMouseDown ? 'text' : 'password', radius: contextValue.radius, color: contextValue.color, className: cn(textFieldVariants({ radius: contextValue.radius }), className), onChange: function (e) {
|
66
70
|
if (e.target.value && regex) {
|
67
71
|
setShowMessage(true);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
"use client";
|
2
|
-
import{
|
2
|
+
import{jsx as r,Fragment as e,jsxs as o}from"react/jsx-runtime";import a,{useState as t}from"react";import{cva as i}from"class-variance-authority";import{cn as n}from"../../utils/utils.mjs";import{radiusVariants as l,bgColorStyle as s}from"../../constants.mjs";import{Theme as c,TextField as u}from"@radix-ui/themes";import{useTheme as d}from"../../theme/ThemeProvider.mjs";import{MAIN_COLOR as m}from"../../color/constants.mjs";import p from"../../Typography/Text/index.mjs";import{IconButton as f}from"../IconButton/index.mjs";import{EyeOpenIcon as h,EyeClosedIcon as g}from"@radix-ui/react-icons";import{useIsClient as v}from"../../is-client-ctx.mjs";var y=function(){return y=Object.assign||function(r){for(var e,o=1,a=arguments.length;o<a;o++)for(var t in e=arguments[o])Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r},y.apply(this,arguments)},x=function(r,e){var o={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&e.indexOf(a)<0&&(o[a]=r[a]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(a=Object.getOwnPropertySymbols(r);t<a.length;t++)e.indexOf(a[t])<0&&Object.prototype.propertyIsEnumerable.call(r,a[t])&&(o[a[t]]=r[a[t]])}return o},j=i("",{variants:{radius:y({},l.base),color:s()}}),w=a.forwardRef((function(a,i){var l,s,w,b=a.className,N=a.color,T=a.size,z=a.appearance,S=a.scaling,R=a.radius,B=a.children,C=a.validationType,P=a.regex,M=a.warningMessage,F=a.onChange,I=a.onBlur,$=x(a,["className","color","size","appearance","scaling","radius","children","validationType","regex","warningMessage","onChange","onBlur"]),k=d().theme,D=t(!1),E=D[0],U=D[1],V=t(null!==(l=$.defaultValue)&&void 0!==l?l:""),_=V[0],q=V[1],A=t(!1),G=A[0],H=A[1],J="2";"small"===T&&(J="1"),"large"===T&&(J="3");var K={scaling:null!==(s=null!=S?S:k.themeScaling)&&void 0!==s?s:"100%",radius:null!=R?R:k.themeRadius,color:null!==(w=null!=N?N:k.themeColor)&&void 0!==w?w:m},L=/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/,Q=/^[0-9]+$/,W="";return"number"==C&&(W="숫자만 입력 가능합니다."),"email"==C&&(W="이메일 형식에 어긋납니다."),v()?o("div",{children:[r(c,{scaling:K.scaling,accentColor:K.color,hasBackground:!1,children:o(u.Root,y({ref:i,variant:z,size:J,type:"password"!==C||G?"text":"password",radius:K.radius,color:K.color,className:n(j({radius:K.radius}),b),onChange:function(r){r.target.value&&P?U(!0):"number"!=C||!r.target.value||P||Q.test(r.target.value)?(U(!1),q(r.target.value),F&&F(r)):U(!0)},value:_,onBlur:function(r){I&&I(r),"email"!=C||!r.target.value||L.test(r.target.value)?U(!1):U(!0)}},$,{children:[B,"password"==C&&r(O.Slot,{side:"right",children:r(f,{appearance:"ghost",color:"slate",onMouseDown:function(r){return H(!0)},onMouseUp:function(r){return H(!1)},children:r(G?h:g,{height:"14",width:"14"})})})]}))}),E&&r(p,{size:"1",color:K.color,children:M||W})]}):r(e,{})}));w.displayName="TextField.Root";var b=a.forwardRef((function(e,o){var a=e.className,t=e.color,i=e.side,l=e.radius,s=e.children,c=x(e,["className","color","side","radius","children"]);return r(u.Slot,y({ref:o,color:t,side:i,className:n(j({radius:l}),a)},c,{children:s}))}));b.displayName="TextField.Slot";var O={Root:w,Slot:b};export{w as Root,b as Slot,O as default};
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
var IsClientCtx = createContext(false);
|
3
|
+
export var IsClientCtxProvider = function (_a) {
|
4
|
+
var children = _a.children;
|
5
|
+
var _b = useState(false), isClient = _b[0], setIsClient = _b[1];
|
6
|
+
useEffect(function () { return setIsClient(true); }, []);
|
7
|
+
return _jsx(IsClientCtx.Provider, { value: isClient, children: children });
|
8
|
+
};
|
9
|
+
export function useIsClient() {
|
10
|
+
return useContext(IsClientCtx);
|
11
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"is-client-ctx.mjs","sources":["../lib/is-client-ctx.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nvar IsClientCtx = createContext(false);\nexport var IsClientCtxProvider = function (_a) {\n var children = _a.children;\n var _b = useState(false), isClient = _b[0], setIsClient = _b[1];\n useEffect(function () { return setIsClient(true); }, []);\n return _jsx(IsClientCtx.Provider, { value: isClient, children: children });\n};\nexport function useIsClient() {\n return useContext(IsClientCtx);\n}\n"],"names":["IsClientCtx","createContext","useIsClient","useContext"],"mappings":"0BACA,IAAIA,EAAcC,eAAc,GAOzB,SAASC,IACZ,OAAOC,WAAWH,EACtB"}
|