@loja-integrada/admin-components 1.2.0 → 1.3.0
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/chunk-UIXQQMI7.js +10 -0
- package/dist/chunk-YNBEDPYZ.js +11 -0
- package/dist/forms/InputWithUnit/InputWithUnit.client.d.ts +19 -0
- package/dist/forms/InputWithUnit/index.js +5 -10
- package/dist/forms/TextArea/TextArea.d.ts +34 -0
- package/dist/forms/TextArea/index.d.ts +1 -0
- package/dist/forms/TextArea/index.js +4 -0
- package/dist/forms/index.d.ts +2 -0
- package/dist/forms/index.js +3 -1
- package/dist/index.js +3 -1
- package/package.json +5 -1
- /package/dist/{chunk-BQWNCDFV.js → chunk-SLXIJR46.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a } from './chunk-7Z3CCBLX.js';
|
|
2
|
+
import { a as a$1 } from './chunk-G3GCVCTU.js';
|
|
3
|
+
import { a as a$2 } from './chunk-REQIQLRI.js';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import x, { useMemo, useRef, useEffect } from 'react';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var i=24,O=cva("relative appearance-none overflow-hidden rounded border border-card-stroke bg-base-1 px-4 py-3 shadow-none outline-none transition-colors focus-within:border-inverted-1 focus:border-inverted-1",{variants:{hasErrorState:{true:"border-danger focus:border-danger [&~.adornment]:border-danger [&~.adornment]:focus:border-danger"},disabled:{true:"pointer-events-none bg-base-3 text-on-base-2"},readOnly:{true:"bg-base-2"}},defaultVariants:{hasErrorState:!1,disabled:!1,readOnly:!1}}),k=({className:g="",formGroupClassName:T="",label:v,labelComplement:H,helpText:w,hasError:y=!1,errorMessage:l,required:d=!1,id:E,name:p,disabled:c,readOnly:f,minLines:n=2,maxLines:I=5,...A},L)=>{let N=useMemo(()=>Math.random().toString(36).substring(7),[]),m=E||p||N,a$3=y||!!l,R=jsx(a,{label:v,labelComplement:H,required:d,hasError:a$3,htmlFor:m,className:"mb-1"}),P=jsx(a$1,{helpText:l||w,hasError:a$3,className:"mt-2"}),r=useRef(null),M=()=>{let e=r.current;if(e){let t=I*i,u=n*i;e.scrollHeight>t?(e.style.height="auto",e.style.height=`${t}px`):e.scrollHeight<u?(e.style.height="auto",e.style.height=`${u}px`):(e.style.height="auto",e.style.height=`${e.scrollHeight}px`);}};return useEffect(()=>{let e=r.current;if(e){let t=n*i;e.style.height=`${t}px`;}},[r,n]),jsxs("div",{className:a$2("form-group flex flex-col ",T),ref:L,children:[R,jsx("div",{className:a$2("relative appearance-none overflow-hidden rounded border border-card-stroke bg-base-1 px-4 py-3 shadow-none outline-none transition-colors focus-within:border-inverted-1 focus:border-inverted-1",O({hasErrorState:a$3,disabled:c,readOnly:f,className:g})),children:jsx("textarea",{ref:r,onInput:M,className:"peer text-f6 flex w-full min-w-0 resize-none bg-transparent text-on-base shadow-none outline-none transition-colors focus-within:border-inverted-1 focus:border-inverted-1",id:m,name:p,required:d,disabled:c,readOnly:f,...A})}),P]})},G=x.forwardRef(k),V=x.memo(G);V.displayName="TextArea";
|
|
9
|
+
|
|
10
|
+
export { V as a };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { a as a$3 } from './chunk-RB4S3T7L.js';
|
|
2
|
+
import { a as a$1 } from './chunk-NW24WOHT.js';
|
|
3
|
+
import { a } from './chunk-7Z3CCBLX.js';
|
|
4
|
+
import { a as a$4 } from './chunk-G3GCVCTU.js';
|
|
5
|
+
import { a as a$2 } from './chunk-REQIQLRI.js';
|
|
6
|
+
import { forwardRef, useState } from 'react';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var L=[{label:"mm",value:"mm"},{label:"cm",value:"cm"},{label:"m",value:"m"}],S=forwardRef(({units:o=L,maxSize:b=6,className:c="",inputClassName:v="",dropdownClassName:g="",helpText:w="",disabled:r=!1,errorMessage:t="",hasError:l=!1,required:s=!1,label:C,inputPlaceholder:I,fixedUnit:n,onChangeValue:N,onChangeUnit:p},x)=>{let[E,U]=useState(o[0]);return jsxs("div",{className:`flex flex-col ${c}`,id:"input-with-unit__container",children:[jsx(a,{label:C,required:s,hasError:l||!!t,htmlFor:"input-with-unit",className:"mb-1"}),jsxs("div",{className:"flex w-full items-start gap-x-1",children:[jsx(a$1,{id:"input-with-unit",ref:x,maxLength:b,formatValue:"onlyNumber",disabled:r,hasError:l||!!t,required:s,onChange:N,placeholder:I,formGroupClassName:a$2("w-full",v)}),jsx(a$3,{id:"input-with-unit-dropdown",formGroupClassName:a$2("w-40",g),placeholder:"mm",options:o,value:n??E,onChange:i=>{n||(U({label:i.label,value:String(i.value)}),p&&p(i));},disabled:!!n||r,hasError:l||!!t})]}),jsx(a$4,{helpText:t||w,hasError:!!t})]})});S.displayName="InputWithUnit";
|
|
10
|
+
|
|
11
|
+
export { L as a, S as b };
|
|
@@ -28,6 +28,14 @@ type InputWithUnitProps = {
|
|
|
28
28
|
* Additional class name to be applied to the outter container.
|
|
29
29
|
* */
|
|
30
30
|
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Additional class name to be applied to the input container.
|
|
33
|
+
* */
|
|
34
|
+
inputClassName?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Additional class name to be applied to the dropdown container.
|
|
37
|
+
* */
|
|
38
|
+
dropdownClassName?: string;
|
|
31
39
|
/**
|
|
32
40
|
* Controls whether the input is disabled.
|
|
33
41
|
* @default false
|
|
@@ -52,6 +60,17 @@ type InputWithUnitProps = {
|
|
|
52
60
|
* Label for the input field.
|
|
53
61
|
* */
|
|
54
62
|
label: string;
|
|
63
|
+
/**
|
|
64
|
+
* Placeholder for the input field.
|
|
65
|
+
* */
|
|
66
|
+
inputPlaceholder?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Sets a fixed (immutable) unit.
|
|
69
|
+
* */
|
|
70
|
+
fixedUnit?: {
|
|
71
|
+
label: string;
|
|
72
|
+
value: string;
|
|
73
|
+
};
|
|
55
74
|
/**
|
|
56
75
|
* Callback to be called when the value changes.
|
|
57
76
|
* */
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import
|
|
1
|
+
"use client";export { a as DEFAULT_UNITS, b as InputWithUnit } from '../../chunk-YNBEDPYZ.js';
|
|
2
|
+
import '../../chunk-RB4S3T7L.js';
|
|
3
|
+
import '../../chunk-NW24WOHT.js';
|
|
3
4
|
import '../../chunk-SJ4MATMO.js';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import '../../chunk-7Z3CCBLX.js';
|
|
6
|
+
import '../../chunk-G3GCVCTU.js';
|
|
6
7
|
import '../../chunk-LTWCICTK.js';
|
|
7
8
|
import '../../chunk-KEDPPRQK.js';
|
|
8
9
|
import '../../chunk-G2ZF74EK.js';
|
|
9
10
|
import '../../chunk-REQIQLRI.js';
|
|
10
|
-
import { forwardRef, useState } from 'react';
|
|
11
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
|
-
|
|
13
|
-
var N=[{label:"mm",value:"mm"},{label:"cm",value:"cm"},{label:"m",value:"m"}],U=forwardRef(({units:i=N,maxSize:h=6,className:f="",helpText:b="",disabled:a$4=!1,errorMessage:t="",hasError:l=!1,required:o=!1,label:v,onChangeValue:c,onChangeUnit:r},g)=>{let[x,I]=useState(i[0]);return jsxs("div",{className:`flex flex-col ${f}`,id:"input-with-unit__container",children:[jsx(a,{label:v,required:o,hasError:l||!!t,htmlFor:"input-with-unit",className:"mb-1"}),jsxs("div",{className:"flex w-full items-start gap-x-1",children:[jsx(a$1,{id:"input-with-unit",ref:g,maxLength:h,formatValue:"onlyNumber",disabled:a$4,hasError:l||!!t,required:o,onChange:c,formGroupClassName:"w-full"}),jsx(a$2,{id:"input-with-unit-dropdown",formGroupClassName:"w-28",placeholder:"mm",options:i,value:x,onChange:n=>{I({label:n.label,value:String(n.value)}),r&&r(n);},disabled:a$4,hasError:l||!!t})]}),jsx(a$3,{helpText:t||b,hasError:!!t})]})});U.displayName="InputWithUnit";
|
|
14
|
-
|
|
15
|
-
export { N as DEFAULT_UNITS, U as InputWithUnit };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputHelpTextProps } from '../InputHelpText';
|
|
3
|
+
import { InputLabelProps } from '../InputLabel';
|
|
4
|
+
declare const TextArea: React.MemoExoticComponent<React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLDivElement>>>;
|
|
5
|
+
interface TextAreaProps extends InputLabelProps, InputHelpTextProps, Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'prefix'> {
|
|
6
|
+
/**
|
|
7
|
+
* Input custom class name
|
|
8
|
+
* */
|
|
9
|
+
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Form group custom class name
|
|
12
|
+
* */
|
|
13
|
+
formGroupClassName?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Change input style to error state
|
|
16
|
+
* @default false
|
|
17
|
+
* */
|
|
18
|
+
hasError?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Error message to display
|
|
21
|
+
* */
|
|
22
|
+
errorMessage?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Sets initial number of lines for the textarea on render
|
|
25
|
+
* @default 2
|
|
26
|
+
* */
|
|
27
|
+
minLines?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Sets maximum number of lines for the textarea
|
|
30
|
+
* @default 5
|
|
31
|
+
* */
|
|
32
|
+
maxLines?: number;
|
|
33
|
+
}
|
|
34
|
+
export { TextArea, type TextAreaProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TextArea';
|
package/dist/forms/index.d.ts
CHANGED
package/dist/forms/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import '../chunk-
|
|
1
|
+
import '../chunk-SLXIJR46.js';
|
|
2
|
+
export { a as TextArea } from '../chunk-UIXQQMI7.js';
|
|
2
3
|
export { b as Select, a as SelectComponent } from '../chunk-HZACKBIW.js';
|
|
3
4
|
export { a as Calendar } from '../chunk-PHVC2M6R.js';
|
|
4
5
|
import '../chunk-KN7DOGNL.js';
|
|
@@ -8,6 +9,7 @@ import '../chunk-6W6QWPEA.js';
|
|
|
8
9
|
import '../chunk-4QFFUXWM.js';
|
|
9
10
|
import '../chunk-3BKW5XAK.js';
|
|
10
11
|
import '../chunk-L6H2NDVS.js';
|
|
12
|
+
export { a as DEFAULT_UNITS, b as InputWithUnit } from '../chunk-YNBEDPYZ.js';
|
|
11
13
|
export { a as Dropdown } from '../chunk-RB4S3T7L.js';
|
|
12
14
|
export { a as InputMask } from '../chunk-NW24WOHT.js';
|
|
13
15
|
export { a as Input } from '../chunk-SJ4MATMO.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import './chunk-
|
|
1
|
+
import './chunk-SLXIJR46.js';
|
|
2
|
+
export { a as TextArea } from './chunk-UIXQQMI7.js';
|
|
2
3
|
import './chunk-7RP4L6ZM.js';
|
|
3
4
|
import './chunk-4PUGMMDC.js';
|
|
4
5
|
export { a as Tooltip } from './chunk-TZI6YTCW.js';
|
|
@@ -15,6 +16,7 @@ export { a as ActionBar } from './chunk-6W6QWPEA.js';
|
|
|
15
16
|
export { b as Box, d as BoxContent, c as BoxHeader, a as BoxSeparator } from './chunk-4QFFUXWM.js';
|
|
16
17
|
export { a as Container, b as ContainerHeader } from './chunk-3BKW5XAK.js';
|
|
17
18
|
import './chunk-L6H2NDVS.js';
|
|
19
|
+
export { a as DEFAULT_UNITS, b as InputWithUnit } from './chunk-YNBEDPYZ.js';
|
|
18
20
|
export { a as Dropdown } from './chunk-RB4S3T7L.js';
|
|
19
21
|
export { a as InputMask } from './chunk-NW24WOHT.js';
|
|
20
22
|
export { a as Input } from './chunk-SJ4MATMO.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loja-integrada/admin-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"author": "Loja Integrada",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -141,6 +141,10 @@
|
|
|
141
141
|
"types": "./dist/forms/Select/Select.d.ts",
|
|
142
142
|
"import": "./dist/forms/Select/index.js"
|
|
143
143
|
},
|
|
144
|
+
"./TextArea": {
|
|
145
|
+
"types": "./dist/forms/TextArea/TextArea.d.ts",
|
|
146
|
+
"import": "./dist/forms/TextArea/index.js"
|
|
147
|
+
},
|
|
144
148
|
"./hooks": {
|
|
145
149
|
"types": "./dist/hooks/hooks.d.ts",
|
|
146
150
|
"import": "./dist/hooks/index.js"
|
|
File without changes
|