@loja-integrada/admin-components 1.1.2 → 1.2.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.
@@ -0,0 +1,8 @@
1
+ import { a as a$1 } from './chunk-KEDPPRQK.js';
2
+ import { a } from './chunk-REQIQLRI.js';
3
+ import w, { useState, useEffect, useMemo } from 'react';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ var n={success:{class:"bg-success-light border-success-dark",icon:"checkCircle",iconClass:"text-success-dark"},warning:{class:"bg-warning-light border-warning-dark",icon:"exclamationTriangle",iconClass:"text-warning"},danger:{class:"bg-danger-light border-danger",icon:"ban",iconClass:"text-danger"},info:{class:"bg-base-1 border-inverted-2",icon:"infoCircle",iconClass:"text-inverted-2"},primary:{class:"bg-primary-light border-primary",icon:"infoCircle",iconClass:"text-primary"}},k=({variant:s="info",isOpen:t=!0,title:f,subtitle:l,actions:i,showClose:b=!1,onClose:c,hideIcon:g=!1,customIcon:m,allBorders:d=!0,className:x})=>{let[u,p]=useState(t);useEffect(()=>{p(t);},[t]);let v=()=>{p(!1),c?.();},C=useMemo(()=>d?"":"border-r-0 border-y-0",[d]);return u?jsxs("div",{className:a("alert relative flex w-full items-start rounded border border-l-4 px-5 py-4 sm:items-center",n[s].class,C,x),children:[!g&&jsx("div",{className:a("alert-icon mr-3 hidden shrink-0 sm:block",n[s].iconClass),children:jsx(a$1,{icon:m||n[s].icon,size:6})}),jsxs("div",{className:"flex min-w-0 grow flex-col items-start justify-between sm:flex-row sm:items-center",children:[jsxs("div",{className:"flex min-w-0 flex-col justify-center break-words leading-5 tracking-4 text-on-base",children:[jsx("span",{className:"alert-title text-f5 font-semibold",children:f}),l?jsx("span",{className:"alert-subtitle text-f6 mt-1",children:l}):null]}),i?jsx("div",{className:"alert-actions mt-3 flex shrink-0 flex-row items-center space-x-3 sm:ml-5 sm:mt-0 sm:flex-row-reverse sm:space-x-reverse",children:i}):null]}),b||c?jsx("div",{className:"alert-close ml-5 flex shrink-0",children:jsx("button",{className:"-m-2 p-2 text-inverted-2 hover:text-inverted-1",onClick:v,type:"button","aria-label":"Close",children:jsx(a$1,{icon:"close",size:4,className:"mt-px sm:mt-0"})})}):null]}):null},R=w.memo(k);R.displayName="Alert";
7
+
8
+ export { R as a };
@@ -1,11 +1,11 @@
1
1
  "use client";export { a as Calendar } from '../../chunk-PHVC2M6R.js';
2
+ import '../../chunk-KN7DOGNL.js';
3
+ import '../../chunk-DTLT3DYY.js';
2
4
  import '../../chunk-DBWOW4GL.js';
3
5
  import '../../chunk-6W6QWPEA.js';
4
6
  import '../../chunk-4QFFUXWM.js';
5
7
  import '../../chunk-3BKW5XAK.js';
6
8
  import '../../chunk-L6H2NDVS.js';
7
- import '../../chunk-KN7DOGNL.js';
8
- import '../../chunk-DTLT3DYY.js';
9
9
  import '../../chunk-NW24WOHT.js';
10
10
  import '../../chunk-SJ4MATMO.js';
11
11
  import '../../chunk-7Z3CCBLX.js';
@@ -0,0 +1,64 @@
1
+ import { ChangeEvent } from 'react';
2
+ import { CustomOptionProps } from '../Dropdown';
3
+ export declare const DEFAULT_UNITS: {
4
+ label: string;
5
+ value: string;
6
+ }[];
7
+ declare const InputWithUnit: import("react").ForwardRefExoticComponent<InputWithUnitProps & import("react").RefAttributes<HTMLInputElement>>;
8
+ type InputWithUnitProps = {
9
+ /**
10
+ * Array of units to be displayed in the input.
11
+ * Each unit should have an id and a name.
12
+ * @default []
13
+ * */
14
+ units: {
15
+ label: string;
16
+ value: string;
17
+ }[];
18
+ /**
19
+ * Maximum size of numbers accepted.
20
+ * @default 6
21
+ * */
22
+ maxSize?: number;
23
+ /**
24
+ * Help text to be displayed below the input.
25
+ * */
26
+ helpText?: string;
27
+ /**
28
+ * Additional class name to be applied to the outter container.
29
+ * */
30
+ className?: string;
31
+ /**
32
+ * Controls whether the input is disabled.
33
+ * @default false
34
+ * */
35
+ disabled?: boolean;
36
+ /**
37
+ * Error message to display
38
+ * */
39
+ errorMessage?: string;
40
+ /**
41
+ * Change input style to error state
42
+ * @default false
43
+ * */
44
+ hasError?: boolean;
45
+ /**
46
+ * Indicates if the input is required.
47
+ * This will add an asterisk (*) next to the label.
48
+ * @default false
49
+ * */
50
+ required?: boolean;
51
+ /**
52
+ * Label for the input field.
53
+ * */
54
+ label: string;
55
+ /**
56
+ * Callback to be called when the value changes.
57
+ * */
58
+ onChangeValue?: (event: ChangeEvent<HTMLInputElement>) => void;
59
+ /**
60
+ * Callback to be called when the value changes.
61
+ * */
62
+ onChangeUnit?: (option: CustomOptionProps) => void;
63
+ };
64
+ export { InputWithUnit, type InputWithUnitProps };
@@ -0,0 +1 @@
1
+ export * from './InputWithUnit.client';
@@ -0,0 +1,15 @@
1
+ "use client";import { a as a$2 } from '../../chunk-RB4S3T7L.js';
2
+ import { a as a$1 } from '../../chunk-NW24WOHT.js';
3
+ import '../../chunk-SJ4MATMO.js';
4
+ import { a } from '../../chunk-7Z3CCBLX.js';
5
+ import { a as a$3 } from '../../chunk-G3GCVCTU.js';
6
+ import '../../chunk-LTWCICTK.js';
7
+ import '../../chunk-KEDPPRQK.js';
8
+ import '../../chunk-G2ZF74EK.js';
9
+ 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 };
@@ -1,14 +1,14 @@
1
1
  import '../chunk-BQWNCDFV.js';
2
- export { a as Dropdown } from '../chunk-RB4S3T7L.js';
3
2
  export { b as Select, a as SelectComponent } from '../chunk-HZACKBIW.js';
4
3
  export { a as Calendar } from '../chunk-PHVC2M6R.js';
4
+ import '../chunk-KN7DOGNL.js';
5
+ import '../chunk-DTLT3DYY.js';
5
6
  import '../chunk-DBWOW4GL.js';
6
7
  import '../chunk-6W6QWPEA.js';
7
8
  import '../chunk-4QFFUXWM.js';
8
9
  import '../chunk-3BKW5XAK.js';
9
10
  import '../chunk-L6H2NDVS.js';
10
- import '../chunk-KN7DOGNL.js';
11
- import '../chunk-DTLT3DYY.js';
11
+ export { a as Dropdown } from '../chunk-RB4S3T7L.js';
12
12
  export { a as InputMask } from '../chunk-NW24WOHT.js';
13
13
  export { a as Input } from '../chunk-SJ4MATMO.js';
14
14
  export { a as InputLabel } from '../chunk-7Z3CCBLX.js';
package/dist/index.js CHANGED
@@ -1,29 +1,29 @@
1
1
  import './chunk-BQWNCDFV.js';
2
- export { a as Dropdown } from './chunk-RB4S3T7L.js';
3
2
  import './chunk-7RP4L6ZM.js';
4
3
  import './chunk-4PUGMMDC.js';
4
+ export { a as Tooltip } from './chunk-TZI6YTCW.js';
5
5
  export { a as Breadcrumb } from './chunk-TSAI6WF3.js';
6
6
  export { a as HelpLink } from './chunk-N224DIUR.js';
7
7
  export { c as DEFAULT_OPTIONS, d as Pagination, a as PaginationInfo, b as PaginationNav } from './chunk-LYUEZJYR.js';
8
8
  export { b as Select, a as SelectComponent } from './chunk-HZACKBIW.js';
9
9
  export { a as Stepper } from './chunk-I7PCF2VW.js';
10
10
  export { a as Calendar } from './chunk-PHVC2M6R.js';
11
+ import './chunk-KN7DOGNL.js';
12
+ export { a as IconCircular } from './chunk-DTLT3DYY.js';
11
13
  import './chunk-DBWOW4GL.js';
12
14
  export { a as ActionBar } from './chunk-6W6QWPEA.js';
13
15
  export { b as Box, d as BoxContent, c as BoxHeader, a as BoxSeparator } from './chunk-4QFFUXWM.js';
14
16
  export { a as Container, b as ContainerHeader } from './chunk-3BKW5XAK.js';
15
17
  import './chunk-L6H2NDVS.js';
16
- import './chunk-KN7DOGNL.js';
17
- export { a as IconCircular } from './chunk-DTLT3DYY.js';
18
+ export { a as Dropdown } from './chunk-RB4S3T7L.js';
18
19
  export { a as InputMask } from './chunk-NW24WOHT.js';
19
20
  export { a as Input } from './chunk-SJ4MATMO.js';
20
21
  export { a as InputLabel } from './chunk-7Z3CCBLX.js';
21
- export { a as Alert } from './chunk-FH4OKVGL.js';
22
+ export { a as Alert } from './chunk-NGGA7AJU.js';
22
23
  export { a as Badge } from './chunk-7NXFX6TD.js';
23
24
  export { a as Tag } from './chunk-EUZRZJ5Q.js';
24
25
  export { a as Button } from './chunk-VVJUHPYS.js';
25
26
  export { b as ToastContainer, a as notify } from './chunk-RXFTQHN7.js';
26
- export { a as Tooltip } from './chunk-TZI6YTCW.js';
27
27
  export { a as DataTable } from './chunk-JZ6ZGBZ4.js';
28
28
  import './chunk-DVFKTOCS.js';
29
29
  export { a as Checkbox } from './chunk-DIENJUYM.js';
@@ -38,10 +38,14 @@ interface AlertProps {
38
38
  * Action for the alert, like button and hiperlinks
39
39
  * */
40
40
  actions?: React.ReactNode;
41
+ /**
42
+ * Shows all borders or just the left one
43
+ * */
44
+ allBorders?: boolean;
41
45
  /**
42
46
  * Custom className for the Alert container
43
47
  * */
44
48
  className?: string;
45
49
  }
46
- declare const Alert: React.MemoExoticComponent<({ variant, isOpen, title, subtitle, actions, showClose, onClose, hideIcon, customIcon, className }: AlertProps) => import("react/jsx-runtime").JSX.Element | null>;
50
+ declare const Alert: React.MemoExoticComponent<({ variant, isOpen, title, subtitle, actions, showClose, onClose, hideIcon, customIcon, allBorders, className }: AlertProps) => import("react/jsx-runtime").JSX.Element | null>;
47
51
  export { Alert, type AlertProps };
@@ -1,4 +1,4 @@
1
- "use client";export { a as Alert } from '../../chunk-FH4OKVGL.js';
1
+ "use client";export { a as Alert } from '../../chunk-NGGA7AJU.js';
2
2
  import '../../chunk-LTWCICTK.js';
3
3
  import '../../chunk-KEDPPRQK.js';
4
4
  import '../../chunk-G2ZF74EK.js';
@@ -1,10 +1,10 @@
1
1
  import '../chunk-7RP4L6ZM.js';
2
- export { a as Alert } from '../chunk-FH4OKVGL.js';
2
+ export { a as Tooltip } from '../chunk-TZI6YTCW.js';
3
+ export { a as Alert } from '../chunk-NGGA7AJU.js';
3
4
  export { a as Badge } from '../chunk-7NXFX6TD.js';
4
5
  export { a as Tag } from '../chunk-EUZRZJ5Q.js';
5
6
  import '../chunk-VVJUHPYS.js';
6
7
  export { b as ToastContainer, a as notify } from '../chunk-RXFTQHN7.js';
7
- export { a as Tooltip } from '../chunk-TZI6YTCW.js';
8
8
  import '../chunk-LTWCICTK.js';
9
9
  import '../chunk-KEDPPRQK.js';
10
10
  import '../chunk-G2ZF74EK.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loja-integrada/admin-components",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "author": "Loja Integrada",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -133,6 +133,10 @@
133
133
  "types": "./dist/forms/InputMask/InputMask.d.ts",
134
134
  "import": "./dist/forms/InputMask/index.js"
135
135
  },
136
+ "./InputWithUnit": {
137
+ "types": "./dist/forms/InputWithUnit/InputWithUnit.d.ts",
138
+ "import": "./dist/forms/InputWithUnit/index.js"
139
+ },
136
140
  "./Select": {
137
141
  "types": "./dist/forms/Select/Select.d.ts",
138
142
  "import": "./dist/forms/Select/index.js"
@@ -1,8 +0,0 @@
1
- import { a as a$1 } from './chunk-KEDPPRQK.js';
2
- import { a } from './chunk-REQIQLRI.js';
3
- import v, { useState, useEffect } from 'react';
4
- import { jsxs, jsx } from 'react/jsx-runtime';
5
-
6
- var n={success:{class:"bg-success-light border-success-dark",icon:"checkCircle",iconClass:"text-success-dark"},warning:{class:"bg-warning-light border-warning",icon:"exclamationTriangle",iconClass:"text-warning"},danger:{class:"bg-danger-light border-danger",icon:"ban",iconClass:"text-danger"},info:{class:"bg-base-1 border-inverted-2",icon:"infoCircle",iconClass:"text-inverted-2"},primary:{class:"bg-primary-light border-primary",icon:"infoCircle",iconClass:"text-primary"}},N=({variant:s="info",isOpen:t=!0,title:p,subtitle:l,actions:o,showClose:f=!1,onClose:c,hideIcon:g=!1,customIcon:m,className:b})=>{let[x,d]=useState(t);useEffect(()=>{d(t);},[t]);let u=()=>{d(!1),c?.();};return x?jsxs("div",{className:a("alert relative flex w-full items-start rounded border border-l-4 px-5 py-4 sm:items-center",n[s].class,b),children:[!g&&jsx("div",{className:a("alert-icon mr-3 hidden shrink-0 sm:block",n[s].iconClass),children:jsx(a$1,{icon:m||n[s].icon,size:6})}),jsxs("div",{className:"flex min-w-0 grow flex-col items-start justify-between sm:flex-row sm:items-center",children:[jsxs("div",{className:"text-f6 flex min-w-0 flex-col justify-center break-words leading-5 tracking-4 text-on-base",children:[jsx("span",{className:"alert-title font-semibold",children:p}),l?jsx("span",{className:"alert-subtitle mt-1",children:l}):null]}),o?jsx("div",{className:"alert-actions mt-3 flex shrink-0 flex-row items-center space-x-3 sm:ml-5 sm:mt-0 sm:flex-row-reverse sm:space-x-reverse",children:o}):null]}),f||c?jsx("div",{className:"alert-close ml-5 flex shrink-0",children:jsx("button",{className:"-m-2 p-2 text-inverted-2 hover:text-inverted-1",onClick:u,type:"button","aria-label":"Close",children:jsx(a$1,{icon:"close",size:4,className:"mt-px sm:mt-0"})})}):null]}):null},h=v.memo(N);h.displayName="Alert";
7
-
8
- export { h as a };