@mobilestock-native/form 1.0.4 → 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.
Files changed (3) hide show
  1. package/index.d.ts +109 -9
  2. package/index.js +60 -43
  3. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, RefObject } from 'react';
4
+ import { TypographyProps } from '@mobilestock-native/typography';
5
+ import { DefaultTheme } from 'styled-components';
6
+ import { IconName } from '@mobilestock-native/icons';
4
7
  import { BadgeType } from '@mobilestock-native/badge';
5
8
  import { ButtonProps } from '@mobilestock-native/button';
6
9
  import { TextInputProps } from 'react-native';
7
10
  import { FormHandles } from '@unform/core';
8
11
  import { ViewBaseProps } from '@mobilestock-native/container';
9
- import { DefaultTheme } from 'styled-components/native';
12
+ import { DefaultTheme as DefaultTheme$1 } from 'styled-components/native';
10
13
  import { FormProps } from '@unform/mobile';
11
14
  import { ZodSchema } from 'zod';
12
15
 
@@ -60,6 +63,65 @@ interface MultipleArchiveProps extends Omit<MultipleArchiveProviderProps, 'child
60
63
 
61
64
  declare function Display$1({ accept, ...props }: MultipleArchiveProps): react_jsx_runtime.JSX.Element;
62
65
 
66
+ declare function Error({ children }: {
67
+ children?: React.ReactNode;
68
+ }): react_jsx_runtime.JSX.Element | null;
69
+
70
+ declare function Label({ children, ...rest }: TypographyProps): react_jsx_runtime.JSX.Element;
71
+
72
+ declare function Toggle(): react_jsx_runtime.JSX.Element;
73
+
74
+ type SwitchEventName = 'TOGGLE' | 'EDIT';
75
+ type LabelPosition = 'TOP_START' | 'TOP_CENTER' | 'TOP_END' | 'LEFT' | 'RIGHT';
76
+
77
+ type SwitchColor = Uppercase<keyof DefaultTheme['colors']['switch'] & string>;
78
+ type SwitchSize = Uppercase<keyof DefaultTheme['sizeSwitch'] & string>;
79
+ interface SwitchRootProps {
80
+ children?: React.ReactNode;
81
+ name: string;
82
+ label?: string;
83
+ disabled?: boolean;
84
+ defaultValue?: boolean;
85
+ /**
86
+ * @default 'TOP_START'
87
+ * @description Position of the label relative to the switch.
88
+ */
89
+ labelPosition?: LabelPosition;
90
+ /**
91
+ * @default 'ON'
92
+ * @description Color of the switch when checked, based on theme.colors.switch tokens.
93
+ */
94
+ checkedColor?: Exclude<SwitchColor, 'OFF' | 'HANDLE'>;
95
+ /**
96
+ * @default 'OFF'
97
+ * @description Background color of the switch when unchecked, based on theme.colors.switch tokens.
98
+ */
99
+ backgroundColor?: Exclude<SwitchColor, 'ON' | 'HANDLE'>;
100
+ /**
101
+ * @default 'HANDLE'
102
+ * @description Color of the switch handle (circle), based on theme.colors.switch tokens.
103
+ */
104
+ handleColor?: Exclude<SwitchColor, 'ON' | 'OFF'>;
105
+ /**
106
+ * @default 'MD'
107
+ * @description Size of the switch toggle.
108
+ */
109
+ size?: SwitchSize;
110
+ /**
111
+ * @description Icons to display inside the handle, reactive to the switch state.
112
+ */
113
+ icons?: {
114
+ on?: IconName;
115
+ off?: IconName;
116
+ };
117
+ onChange?(data: {
118
+ value: boolean;
119
+ event: SwitchEventName;
120
+ }): void;
121
+ }
122
+
123
+ declare function SwitchRoot({ children, ...props }: SwitchRootProps): react_jsx_runtime.JSX.Element;
124
+
63
125
  interface BadgeProps {
64
126
  text: string;
65
127
  renderInsidePill?: boolean;
@@ -129,19 +191,26 @@ interface CounterRootProps {
129
191
  value: number;
130
192
  event: CounterEventName;
131
193
  }): void;
194
+ autoFocus?: boolean;
195
+ onFocus?(): void;
196
+ onBlur?(): void;
132
197
  }
133
198
 
134
199
  declare function CounterRoot({ children, ...props }: CounterRootProps): react_jsx_runtime.JSX.Element;
135
200
 
136
201
  type InputType = 'text' | 'password' | 'tel' | 'email' | 'number' | 'url' | 'zipcode' | 'hidden';
137
- interface InputProps extends Omit<TextInputProps, 'hitSlop'> {
202
+ interface InputProps extends Omit<TextInputProps, 'hitSlop' | 'onChangeText' | 'onChange'> {
138
203
  name: string;
139
204
  label?: string;
140
- autofocus?: boolean;
141
205
  type?: InputType;
142
206
  autoSubmit?: boolean;
143
207
  full?: boolean;
208
+ showMaxContent?: boolean;
144
209
  format?(value: string): string;
210
+ onChange?(payload: {
211
+ value: unknown;
212
+ event: 'INPUT_CHANGE' | 'AUTO_SUBMIT' | 'TOGGLE_PASSWORD';
213
+ }): void;
145
214
  }
146
215
  interface InputRef {
147
216
  focus(): void;
@@ -171,8 +240,8 @@ type PhotoListProviderProps<TypeEventOnChangeGeneric extends TypeEventOnChange =
171
240
  dragAndDrop?: boolean;
172
241
  buttonAddDirection?: 'LEFT' | 'RIGHT';
173
242
  name: string;
174
- size?: Uppercase<keyof DefaultTheme['sizeImage'] & string>;
175
- gap?: Uppercase<keyof DefaultTheme['gaps'] & string>;
243
+ size?: Uppercase<keyof DefaultTheme$1['sizeImage'] & string>;
244
+ gap?: Uppercase<keyof DefaultTheme$1['gaps'] & string>;
176
245
  };
177
246
 
178
247
  type EventOnChangeRemoveImage = {
@@ -217,6 +286,13 @@ interface FormSelectPropsBase {
217
286
  disabled: boolean;
218
287
  placeholder: string;
219
288
  defaultValue?: CustomOption;
289
+ onChange?(payload: {
290
+ value: CustomOption['value'];
291
+ event: 'SELECT_CHANGE';
292
+ }): void;
293
+ autoFocus?: boolean;
294
+ onFocus?(): void;
295
+ onBlur?(): void;
220
296
  }
221
297
  interface FormSelectProps extends Omit<FormSelectPropsBase, 'placeholder' | 'disabled'> {
222
298
  placeholder?: string;
@@ -224,22 +300,41 @@ interface FormSelectProps extends Omit<FormSelectPropsBase, 'placeholder' | 'dis
224
300
  disabled?: boolean;
225
301
  full?: boolean;
226
302
  }
227
- declare function FormSelect({ name, label, disabled, options, placeholder, full, defaultValue, ...rest }: FormSelectProps): react_jsx_runtime.JSX.Element;
303
+ declare function FormSelect({ name, label, disabled, options, placeholder, full, defaultValue, onChange, autoFocus, onFocus, onBlur }: FormSelectProps): react_jsx_runtime.JSX.Element;
228
304
 
229
305
  declare function FormVertical({ children, ...props }: ViewBaseProps): react_jsx_runtime.JSX.Element;
230
306
 
231
- interface FormPropsWithHandler<T extends object> extends FormProps {
232
- onSubmit(params: SubmitParams<T>): Promise<void> | void;
307
+ interface FormPropsWithHandler<T extends object> extends Omit<FormProps, 'onSubmit'> {
308
+ onSubmit?(params: SubmitParams<T>): Promise<void> | void;
309
+ onBeforeSubmit?(params: {
310
+ data: T;
311
+ }): Promise<boolean> | boolean;
312
+ onAfterSubmit?(params: {
313
+ data: T;
314
+ }): Promise<void> | void;
233
315
  schema?: ZodSchema<T>;
316
+ name?: string;
234
317
  }
235
318
  interface PropsContext {
236
319
  submitForm(): void;
237
320
  clearForm(): void;
238
321
  formRef: RefObject<FormHandles>;
239
322
  loading?: boolean;
323
+ notifyFieldChange?(name: string, value: unknown): void;
324
+ }
325
+ declare function FormComponent<T extends object>({ children, onSubmit, onBeforeSubmit, onAfterSubmit, schema, name: formName, ...props }: FormPropsWithHandler<T>): react_jsx_runtime.JSX.Element;
326
+
327
+ interface UseFormReturn<T extends object> {
328
+ readonly values: T;
329
+ getValue<K extends keyof T & string>(name: K): T[K] | undefined;
330
+ setValue<K extends keyof T & string>(name: K, value: T[K]): void;
331
+ submit(): void;
332
+ clear(): void;
333
+ setErrors(errors: Record<string, string>): void;
334
+ reset(data?: Partial<T>): void;
240
335
  }
241
336
  declare function useForm(): PropsContext;
242
- declare function FormComponent<T extends object>({ children, onSubmit, schema, ...props }: FormPropsWithHandler<T>): react_jsx_runtime.JSX.Element;
337
+ declare function useForm<T extends object>(name: string): UseFormReturn<T>;
243
338
 
244
339
  interface SubmitParams<T extends object> {
245
340
  data: T;
@@ -256,6 +351,11 @@ declare const Form: typeof FormComponent & {
256
351
  Minus: typeof Minus;
257
352
  Badge: typeof Badge;
258
353
  };
354
+ Switch: typeof SwitchRoot & {
355
+ Toggle: typeof Toggle;
356
+ Label: typeof Label;
357
+ Error: typeof Error;
358
+ };
259
359
  Vertical: typeof FormVertical;
260
360
  MultipleArchive: typeof Display$1 & {
261
361
  Title: typeof Title;
package/index.js CHANGED
@@ -1,49 +1,46 @@
1
- "use strict";var Fn=Object.create;var Ne=Object.defineProperty,In=Object.defineProperties,Rn=Object.getOwnPropertyDescriptor,xn=Object.getOwnPropertyDescriptors,wn=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,Nn=Object.getPrototypeOf,lo=Object.prototype.hasOwnProperty,No=Object.prototype.propertyIsEnumerable;var wo=(e,o,t)=>o in e?Ne(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,g=(e,o)=>{for(var t in o||(o={}))lo.call(o,t)&&wo(e,t,o[t]);if(ke)for(var t of ke(o))No.call(o,t)&&wo(e,t,o[t]);return e},v=(e,o)=>In(e,xn(o));var P=(e,o)=>{var t={};for(var n in e)lo.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ke)for(var n of ke(e))o.indexOf(n)<0&&No.call(e,n)&&(t[n]=e[n]);return t};var Ln=(e,o)=>{for(var t in o)Ne(e,t,{get:o[t],enumerable:!0})},Lo=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of wn(o))!lo.call(e,r)&&r!==t&&Ne(e,r,{get:()=>o[r],enumerable:!(n=Rn(o,r))||n.enumerable});return e};var R=(e,o,t)=>(t=e!=null?Fn(Nn(e)):{},Lo(o||!e||!e.__esModule?Ne(t,"default",{value:e,enumerable:!0}):t,e)),An=e=>Lo(Ne({},"__esModule",{value:!0}),e);var se=(e,o,t)=>new Promise((n,r)=>{var l=a=>{try{m(t.next(a))}catch(u){r(u)}},i=a=>{try{m(t.throw(a))}catch(u){r(u)}},m=a=>a.done?n(a.value):Promise.resolve(a.value).then(l,i);m((t=t.apply(e,o)).next())});var oi={};Ln(oi,{Form:()=>ei,useForm:()=>q});module.exports=An(oi);var zo=require("@mobilestock-native/button");var Ao=require("@unform/mobile"),te=require("react"),Vo=require("zod"),Mo=require("@mobilestock-native/container"),Oo=require("@mobilestock-native/modalalert");var Te=require("react/jsx-runtime"),Do=(0,te.createContext)({});function q(){return(0,te.useContext)(Do)}function Ho(r){var l=r,{children:e,onSubmit:o,schema:t}=l,n=P(l,["children","onSubmit","schema"]);let i=(0,te.useRef)(null),[m,a]=(0,te.useState)(!1),[u,p]=(0,te.useState)(void 0);function d(){var c;(c=i.current)==null||c.submitForm()}function h(){var c,s;(c=i.current)==null||c.setErrors({}),(s=i.current)==null||s.reset()}function f(c){let s={};for(let E of c){let F=E.path.filter(w=>typeof w=="string"||typeof w=="number").join(".");F&&(s[String(F)]=E.message)}return s}function b(c){if(c instanceof Vo.ZodError)return f(c.issues);if(typeof c=="object"&&c!==null&&"errors"in c){let s=c.errors;if(Array.isArray(s)&&s.length>0&&"message"in s[0]&&"path"in s[0])return f(s)}return null}function C(E,F){return se(this,arguments,function*(c,{reset:s}){var w,D,T,V,Q;if((w=i.current)==null||w.setErrors({}),t){let z=t.safeParse(c);if(!z.success){(D=i.current)==null||D.setErrors(f(z.error.issues));return}}try{a(!0),yield o({data:c,ref:i,reset:s})}catch(z){let be=b(z);if(be)(T=i.current)==null||T.setErrors(be);else{let N="Erro ao realizar opera\xE7\xE3o",S=500;if(typeof z=="object"&&z!==null&&"isAxiosError"in z&&z.isAxiosError){let y=z;S=((V=y.response)==null?void 0:V.status)||500;let L=(Q=y.response)==null?void 0:Q.data;L!=null&&L.message&&(N=L.message)}else z instanceof Error&&(N=z.message||N);p({message:N,status:S})}}finally{a(!1)}})}return(0,Te.jsxs)(Do.Provider,{value:{formRef:i,submitForm:d,clearForm:h,loading:m},children:[(0,Te.jsx)(Ao.Form,v(g({ref:i,onSubmit:C},n),{children:(0,Te.jsx)(Mo.Container.Vertical,{gap:"2XS",children:e})})),(0,Te.jsx)(Oo.ModalAlert,{visible:!!u,message:u==null?void 0:u.message,type:u&&u.status>=500?"FATAL_ERROR":"ERROR_NOTICE",title:"Erro ao enviar o formul\xE1rio",onClose:()=>p(void 0)})]})}var Bo=require("react/jsx-runtime");function ko(l){var i=l,{type:e="SUBMIT",disabled:o,isLoading:t,onPress:n}=i,r=P(i,["type","disabled","isLoading","onPress"]);let{submitForm:m,clearForm:a,loading:u}=q();function p(d){switch(e){case"SUBMIT":m();break;case"RESET":a();break;default:n==null||n(d)}}return(0,Bo.jsx)(zo.Button,v(g({size:"LG"},r),{onPress:p,isLoading:e==="SUBMIT"&&u||t,disabled:u||t||o}))}var so=R(require("styled-components/native")),Ko=require("@mobilestock-native/badge"),Yo=require("@mobilestock-native/container"),Zo=R(require("@mobilestock-native/tools")),Jo=require("@mobilestock-native/typography");var _o=require("@unform/core"),K=require("react"),Uo=require("react/jsx-runtime"),$o=(0,K.createContext)(void 0);function Go(e){let{fieldName:o,registerField:t,error:n,defaultValue:r}=(0,_o.useField)(e.name),[l,i]=(0,K.useState)(0),m=(0,K.useCallback)(d=>{let h=d;return e.maxCount!==void 0&&h>e.maxCount&&(h=e.maxCount),e.minCount!==void 0&&h<e.minCount&&(h=e.minCount),h},[e.maxCount,e.minCount]),a=(0,K.useCallback)(d=>{var f;let h=m(d);i(h),(f=e.onChange)==null||f.call(e,{value:h,event:"EDIT"})},[m]);(0,K.useEffect)(()=>{t({name:o,getValue:()=>l,setValue:(d,h)=>a(h),clearValue:()=>a(0)})},[o,l,t,a]),(0,K.useEffect)(()=>{a(Number(e.initialCount)||Number(r)||0)},[e.initialCount,a,r]);function u(d=1){i(h=>{var b;let f=m(h+1*d);return(b=e.onChange)==null||b.call(e,{value:f,event:"INCREMENT"}),f})}function p(d=1){i(h=>{var b;let f=m(h-1*d);return(b=e.onChange)==null||b.call(e,{value:f,event:"DECREMENT"}),f})}return(0,Uo.jsx)($o.Provider,{value:{count:l,increment:u,decrement:p,configureCount:a,multiplier:e.multiplier,maxCount:e.maxCount,minCount:e.minCount,editable:e.editable,label:e.label,labelPosition:e.labelPosition,buttonTransparent:e.buttonTransparent,groupElements:e.groupElements,error:n},children:e.children})}function Y(){let e=(0,K.useContext)($o);if(!e)throw new Error("useCounter must be used within a CounterProvider");return e}var Xo=R(require("styled-components/native")),Wo=require("@mobilestock-native/container");var qo=require("react/jsx-runtime");function fe(e){return(0,qo.jsx)(Vn,g({align:"CENTER"},e))}var Vn=(0,Xo.default)(Wo.Container.Vertical)`
1
+ "use strict";var _i=Object.create;var je=Object.defineProperty,Bi=Object.defineProperties,$i=Object.getOwnPropertyDescriptor,Gi=Object.getOwnPropertyDescriptors,Ui=Object.getOwnPropertyNames,ft=Object.getOwnPropertySymbols,Xi=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable;var go=(e,t,o)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))_t.call(t,o)&&go(e,o,t[o]);if(ft)for(var o of ft(t))ho.call(t,o)&&go(e,o,t[o]);return e},x=(e,t)=>Bi(e,Gi(t));var O=(e,t)=>{var o={};for(var r in e)_t.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&ft)for(var r of ft(e))t.indexOf(r)<0&&ho.call(e,r)&&(o[r]=e[r]);return o};var Wi=(e,t)=>{for(var o in t)je(e,o,{get:t[o],enumerable:!0})},To=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ui(t))!_t.call(e,n)&&n!==o&&je(e,n,{get:()=>t[n],enumerable:!(r=$i(t,n))||r.enumerable});return e};var N=(e,t,o)=>(o=e!=null?_i(Xi(e)):{},To(t||!e||!e.__esModule?je(o,"default",{value:e,enumerable:!0}):o,e)),Ki=e=>To(je({},"__esModule",{value:!0}),e);var Ce=(e,t,o)=>new Promise((r,n)=>{var s=i=>{try{u(o.next(i))}catch(l){n(l)}},a=i=>{try{u(o.throw(i))}catch(l){n(l)}},u=i=>i.done?r(i.value):Promise.resolve(i.value).then(s,a);u((o=o.apply(e,t)).next())});var ya={};Wi(ya,{Form:()=>Sa,useForm:()=>M});module.exports=Ki(ya);var xo=require("@mobilestock-native/button");var xe=require("react");var Eo=require("@unform/mobile"),se=require("react"),So=require("zod"),yo=require("@mobilestock-native/container"),Po=require("@mobilestock-native/modalalert");var et=new Map;function Bt(e){let t=et.get(e);return t||(t={formRef:null,values:{},watchedFields:new Set,listeners:new Set},et.set(e,t)),t}function bo(e,t){let o=Bt(e);o.formRef=t}function Co(e){let t=et.get(e);t&&(t.formRef=null,t.values={},t.watchedFields.clear(),t.listeners.clear(),et.delete(e))}function vo(e,t,o){let r=et.get(e);!r||!r.watchedFields.has(t)||r.values[t]===o||(r.values=x(v({},r.values),{[t]:o}),r.listeners.forEach(n=>n()))}var Ve=require("react/jsx-runtime"),$t=(0,se.createContext)({});function Ro(u){var i=u,{children:e,onSubmit:t,onBeforeSubmit:o,onAfterSubmit:r,schema:n,name:s}=i,a=O(i,["children","onSubmit","onBeforeSubmit","onAfterSubmit","schema","name"]);let l=(0,se.useRef)(null),[m,d]=(0,se.useState)(!1),[c,h]=(0,se.useState)(void 0);(0,se.useEffect)(()=>{if(s)return bo(s,l),()=>Co(s)},[s]);let S=(0,se.useCallback)((T,f)=>{s&&vo(s,T,f)},[s]);function R(){var T;(T=l.current)==null||T.submitForm()}function P(){var T,f;(T=l.current)==null||T.setErrors({}),(f=l.current)==null||f.reset()}function b(T){let f={};for(let E of T){let p=E.path.filter(F=>typeof F=="string"||typeof F=="number").join(".");p&&(f[String(p)]=E.message)}return f}function C(T){if(T instanceof So.ZodError)return b(T.issues);if(typeof T=="object"&&T!==null&&"errors"in T){let f=T.errors;if(Array.isArray(f)&&f.length>0&&"message"in f[0]&&"path"in f[0])return b(f)}return null}function y(E,p){return Ce(this,arguments,function*(T,{reset:f}){var F,oe,W,Z,Te;if((F=l.current)==null||F.setErrors({}),n){let X=n.safeParse(T);if(!X.success){(oe=l.current)==null||oe.setErrors(b(X.error.issues));return}}if(!(o&&(yield o({data:T}))===!1))try{d(!0),yield t==null?void 0:t({data:T,ref:l,reset:f}),yield r==null?void 0:r({data:T})}catch(X){let I=C(X);if(I)(W=l.current)==null||W.setErrors(I);else{let D="Erro ao realizar opera\xE7\xE3o",H=500;if(typeof X=="object"&&X!==null&&"isAxiosError"in X&&X.isAxiosError){let K=X;H=((Z=K.response)==null?void 0:Z.status)||500;let re=(Te=K.response)==null?void 0:Te.data;re!=null&&re.message&&(D=re.message)}else X instanceof Error&&(D=X.message||D);h({message:D,status:H})}}finally{d(!1)}})}return(0,Ve.jsxs)($t.Provider,{value:{formRef:l,submitForm:R,clearForm:P,loading:m,notifyFieldChange:S},children:[(0,Ve.jsx)(Eo.Form,x(v({ref:l,onSubmit:y},a),{children:(0,Ve.jsx)(yo.Container.Vertical,{gap:"2XS",children:e})})),(0,Ve.jsx)(Po.ModalAlert,{visible:!!c,message:c==null?void 0:c.message,type:c&&c.status>=500?"FATAL_ERROR":"ERROR_NOTICE",title:"Erro ao enviar o formul\xE1rio",onClose:()=>h(void 0)})]})}var qi={};function M(e){let t=(0,xe.useContext)($t),o=e?Bt(e):null,r=(0,xe.useCallback)(a=>o?(o.listeners.add(a),()=>{o.listeners.delete(a)}):()=>{},[o]),n=(0,xe.useCallback)(()=>o?o.values:qi,[o]),s=(0,xe.useSyncExternalStore)(r,n);return!e||!o?t:{get values(){var a,u,i;return(i=(u=(a=o.formRef)==null?void 0:a.current)==null?void 0:u.getData())!=null?i:{}},getValue(a){var u,i;return o.watchedFields.add(a),a in s?s[a]:(i=(u=o.formRef)==null?void 0:u.current)==null?void 0:i.getFieldValue(a)},setValue(a,u){var i,l;(l=(i=o.formRef)==null?void 0:i.current)==null||l.setFieldValue(a,u)},submit(){var a,u;(u=(a=o.formRef)==null?void 0:a.current)==null||u.submitForm()},clear(){var a,u,i,l;(u=(a=o.formRef)==null?void 0:a.current)==null||u.setErrors({}),(l=(i=o.formRef)==null?void 0:i.current)==null||l.reset()},setErrors(a){var u,i;(i=(u=o.formRef)==null?void 0:u.current)==null||i.setErrors(a)},reset(a){var u,i;(i=(u=o.formRef)==null?void 0:u.current)==null||i.reset(a)}}}var Fo=require("react/jsx-runtime");function wo(s){var a=s,{type:e="SUBMIT",disabled:t,isLoading:o,onPress:r}=a,n=O(a,["type","disabled","isLoading","onPress"]);let{submitForm:u,clearForm:i,loading:l}=M();function m(d){switch(e){case"SUBMIT":u();break;case"RESET":i();break;default:r==null||r(d)}}return(0,Fo.jsx)(xo.Button,x(v({size:"LG"},n),{onPress:m,isLoading:e==="SUBMIT"&&l||o,disabled:l||o||t}))}var Gt=N(require("styled-components/native")),Do=require("@mobilestock-native/badge"),Mo=require("@mobilestock-native/container"),zo=N(require("@mobilestock-native/tools")),ko=require("@mobilestock-native/typography");var Io=require("@unform/core"),ne=require("react");var Ao=require("react/jsx-runtime"),No=(0,ne.createContext)(void 0);function Oo(e){let{notifyFieldChange:t}=M(),{fieldName:o,registerField:r,error:n,defaultValue:s}=(0,Io.useField)(e.name),[a,u]=(0,ne.useState)(0),i=(0,ne.useCallback)(c=>{let h=c;return e.maxCount!==void 0&&h>e.maxCount&&(h=e.maxCount),e.minCount!==void 0&&h<e.minCount&&(h=e.minCount),h},[e.maxCount,e.minCount]),l=(0,ne.useCallback)((c,h=!0)=>{var R;let S=i(c);u(S),t==null||t(o,S),h&&((R=e.onChange)==null||R.call(e,{value:S,event:"EDIT"}))},[i,t,o]);(0,ne.useEffect)(()=>{r({name:o,getValue:()=>a,setValue:(c,h)=>l(h),clearValue:()=>l(0)})},[o,a,r,l]),(0,ne.useEffect)(()=>{l(Number(e.initialCount)||Number(s)||0,!1)},[e.initialCount,l,s]);function m(c=1){u(h=>{var R;let S=i(h+1*c);return t==null||t(o,S),(R=e.onChange)==null||R.call(e,{value:S,event:"INCREMENT"}),S})}function d(c=1){u(h=>{var R;let S=i(h-1*c);return t==null||t(o,S),(R=e.onChange)==null||R.call(e,{value:S,event:"DECREMENT"}),S})}return(0,Ao.jsx)(No.Provider,{value:{count:a,increment:m,decrement:d,configureCount:l,multiplier:e.multiplier,maxCount:e.maxCount,minCount:e.minCount,editable:e.editable,label:e.label,labelPosition:e.labelPosition,buttonTransparent:e.buttonTransparent,groupElements:e.groupElements,error:n,autoFocus:e.autoFocus,onFocus:e.onFocus,onBlur:e.onBlur},children:e.children})}function ie(){let e=(0,ne.useContext)(No);if(!e)throw new Error("useCounter must be used within a CounterProvider");return e}var Vo=N(require("styled-components/native")),Lo=require("@mobilestock-native/container");var Ho=require("react/jsx-runtime");function we(e){return(0,Ho.jsx)(Yi,v({align:"CENTER"},e))}var Yi=(0,Vo.default)(Lo.Container.Vertical)`
2
2
  min-width: 40px;
3
3
  height: 34px;
4
4
  user-select: none;
5
- `;var Le=require("react/jsx-runtime");function Ae(e){let{groupElements:o}=Y();return(0,Le.jsx)(fe,{children:o&&e.renderInsidePill?(0,Le.jsx)(Mn,{$type:e.type,full:!0,align:"CENTER",children:(0,Le.jsx)(On,{$type:e.type,children:e.text})}):(0,Le.jsx)(Ko.Badge,{text:e.text,type:e.type,size:"XS"})})}function Qo(e,o){return Object.keys(o.colors.badge).find(t=>t.toLowerCase()===(e==null?void 0:e.toLowerCase()))||"default"}var Mn=(0,so.default)(Yo.Container.Vertical)`
6
- background-color: ${({$type:e,theme:o})=>{let t=Qo(e,o);return o.colors.badge[t]}};
5
+ `;var tt=require("react/jsx-runtime");function ot(e){let{groupElements:t}=ie();return(0,tt.jsx)(we,{children:t&&e.renderInsidePill?(0,tt.jsx)(Zi,{$type:e.type,full:!0,align:"CENTER",children:(0,tt.jsx)(Ji,{$type:e.type,children:e.text})}):(0,tt.jsx)(Do.Badge,{text:e.text,type:e.type,size:"XS"})})}function _o(e,t){return Object.keys(t.colors.badge).find(o=>o.toLowerCase()===(e==null?void 0:e.toLowerCase()))||"default"}var Zi=(0,Gt.default)(Mo.Container.Vertical)`
6
+ background-color: ${({$type:e,theme:t})=>{let o=_o(e,t);return t.colors.badge[o]}};
7
7
  width: 100%;
8
- `,On=(0,so.default)(Jo.Typography)`
9
- color: ${({$type:e,theme:o})=>{let t=Qo(e,o);return Zo.default.defineTextColor(o.colors.badge[t])}};
10
- `;Ae.displayName="Form.FormCounter.Badge";var ne=require("react"),Z=require("@mobilestock-native/container"),it=R(require("@mobilestock-native/tools"));var Ve=R(require("styled-components/native")),jo=require("@mobilestock-native/container");var et=require("react/jsx-runtime");function Ee(t){var n=t,{children:e}=n,o=P(n,["children"]);let{groupElements:r,error:l}=Y();return(0,et.jsx)(Dn,v(g({align:"CENTER",$groupElements:r,$error:!!l},o),{children:e}))}var Dn=(0,Ve.default)(jo.Container.Horizontal)`
8
+ `,Ji=(0,Gt.default)(ko.Typography)`
9
+ color: ${({$type:e,theme:t})=>{let o=_o(e,t);return zo.default.defineTextColor(t.colors.badge[o])}};
10
+ `;ot.displayName="Form.FormCounter.Badge";var fe=require("react"),ae=require("@mobilestock-native/container"),Ko=N(require("@mobilestock-native/tools"));var rt=N(require("styled-components/native")),Bo=require("@mobilestock-native/container");var $o=require("react/jsx-runtime");function Le(o){var r=o,{children:e}=r,t=O(r,["children"]);let{groupElements:n,error:s}=ie();return(0,$o.jsx)(Qi,x(v({align:"CENTER",$groupElements:n,$error:!!s},t),{children:e}))}var Qi=(0,rt.default)(Bo.Container.Horizontal)`
11
11
  border-radius: ${({theme:e})=>e.borderRadius.default};
12
12
  overflow: hidden;
13
13
  background-color: transparent;
14
14
  border: none;
15
- ${({$groupElements:e,theme:o})=>e&&Ve.css`
16
- background-color: ${o.colors.input.default};
15
+ ${({$groupElements:e,theme:t})=>e&&rt.css`
16
+ background-color: ${t.colors.input.default};
17
17
 
18
- border: 1px solid ${o.colors.input.border};
18
+ border: 1px solid ${t.colors.input.border};
19
19
  `}
20
- ${({$error:e,theme:o})=>e&&Ve.css`
21
- background-color: ${o.colors.input.error};
22
- border: 1px solid ${o.colors.alert.urgent};
20
+ ${({$error:e,theme:t})=>e&&rt.css`
21
+ background-color: ${t.colors.input.error};
22
+ border: 1px solid ${t.colors.alert.urgent};
23
23
  `}
24
- `;var ot=require("@mobilestock-native/typography"),tt=require("react/jsx-runtime");function re({children:e}){return(0,tt.jsx)(ot.Typography,{color:"DANGER_600",size:"SM",weight:"MEDIUM",children:e})}var rt=require("@mobilestock-native/typography"),nt=require("react/jsx-runtime");function me({children:e}){return(0,nt.jsx)(rt.Typography,{weight:"REGULAR",children:e})}var x=require("react/jsx-runtime");function at({children:e}){let{label:o,error:t,labelPosition:n}=Y(),r=[],l=[],i=(0,ne.useCallback)(a=>(0,ne.isValidElement)(a)&&a.type===ne.Fragment?i(a.props.children):a,[]),m=i(e);return ne.Children.toArray(m).forEach(a=>{(0,ne.isValidElement)(a)&&it.default.isComponentWithDisplayName(a.type)&&a.type.displayName===Ae.displayName&&!a.props.renderInsidePill?r.push(a):l.push(a)}),(0,x.jsxs)(Z.Container.Vertical,{align:"CENTER_START",children:[n==="TOP_START"&&o&&(0,x.jsxs)(Z.Container.Horizontal,{padding:"NONE_NONE_2XS_NONE",gap:"2XS",children:[(0,x.jsx)(me,{children:o}),t&&!r.length&&(0,x.jsx)(re,{children:t})]}),n!=="LEFT"&&(0,x.jsxs)(Z.Container.Vertical,{align:"CENTER",children:[(n!=="TOP_START"&&o||n!=="TOP_START"&&t&&!r.length)&&(0,x.jsxs)(Z.Container.Vertical,{align:"CENTER",padding:"NONE_NONE_2XS_NONE",children:[o&&(0,x.jsx)(me,{children:o}),t&&!r.length&&(0,x.jsx)(re,{children:t})]}),(0,x.jsxs)(Z.Container.Horizontal,{align:"CENTER_START",children:[r.length>0&&(0,x.jsx)(Z.Container.Horizontal,{padding:"NONE_2XS_NONE_NONE",children:r}),(0,x.jsxs)(Z.Container.Vertical,{children:[(0,x.jsx)(Ee,{children:l}),t&&!!r.length&&(0,x.jsx)(re,{children:t})]})]})]}),n==="LEFT"&&(0,x.jsx)(Z.Container.Vertical,{children:(0,x.jsxs)(Z.Container.Horizontal,{align:"CENTER",children:[(0,x.jsxs)(Z.Container.Vertical,{padding:"NONE_2XS_NONE_NONE",children:[o&&(0,x.jsx)(me,{children:o}),t&&!r.length&&(0,x.jsx)(re,{children:t})]}),r.length>0&&(0,x.jsx)(Z.Container.Horizontal,{padding:"NONE_2XS_NONE_NONE",children:r}),(0,x.jsx)(Ee,{children:l})]})})]})}var ue=require("@mobilestock-native/container");var lt=require("react"),st=require("react-native"),mt=R(require("styled-components/native")),ut=require("@mobilestock-native/button");var mo=require("react/jsx-runtime");function ie(n){var r=n,{type:e,disabled:o}=r,t=P(r,["type","disabled"]);let{loading:l}=q(),i=Y(),m=(0,lt.useMemo)(()=>e==="PLUS"&&i.maxCount!==void 0?i.count>=i.maxCount:e==="MINUS"&&i.minCount!==void 0?i.count<=i.minCount:!1,[e,i.count,i.maxCount,i.minCount]);function a(){e==="PLUS"?i.increment():i.decrement()}function u(){st.Vibration.vibrate(50),e==="PLUS"?i.increment(i.multiplier):i.decrement(i.multiplier)}return(0,mo.jsx)(fe,{children:(0,mo.jsx)(Hn,v(g({backgroundColor:e==="PLUS"?"DEFAULT_DARK":"CANCEL_DARK"},t),{size:"SM",icon:e==="PLUS"?"Plus":"Minus",variant:i.buttonTransparent?"TRANSPARENT":"DEFAULT",$grouped:i.groupElements,disabled:m||o||l,onPress:a,onLongPress:u,delayLongPress:500}))})}var Hn=(0,mt.default)(ut.Button)`
25
- border-radius: ${({$grouped:e,theme:o})=>e?o.borderRadius.none:o.borderRadius.default};
26
- `;var Me=require("react"),pt=require("react-native"),ct=require("styled-components/native"),dt=require("@mobilestock-native/clickable"),uo=require("@mobilestock-native/container"),po=require("@mobilestock-native/typography");var ae=require("react/jsx-runtime");function ve(){let e=(0,ct.useTheme)(),{count:o,editable:t,configureCount:n}=Y(),[r,l]=(0,Me.useState)(!1),[i,m]=(0,Me.useState)(o.toString());(0,Me.useEffect)(()=>{m(o.toString())},[o]);function a(u){n(Number(u.nativeEvent.text)||0),l(!1)}return t?(0,ae.jsx)(dt.Clickable,{onPress:()=>l(!0),children:(0,ae.jsx)(uo.Container.Horizontal,{padding:"NONE_2XS",children:(0,ae.jsx)(fe,{children:r?(0,ae.jsx)(pt.TextInput,{testID:"counter-input",value:i,keyboardType:"numeric",style:{fontWeight:"bold",fontSize:Number(e.font.size.lg)||16,textAlign:"center",width:40,height:40},autoFocus:!0,selectTextOnFocus:!0,onBlur:a,onChangeText:m,onEndEditing:a}):(0,ae.jsx)(po.Typography,{weight:"BOLD",size:"LG",children:o})})})}):(0,ae.jsx)(uo.Container.Horizontal,{padding:"NONE_2XS",children:(0,ae.jsx)(fe,{children:(0,ae.jsx)(po.Typography,{weight:"BOLD",size:"LG",children:o})})})}ve.displayName="Form.FormCounter.Display";var I=require("react/jsx-runtime");function ft(){let{label:e,labelPosition:o,error:t}=Y();return(0,I.jsxs)(ue.Container.Vertical,{align:"CENTER_START",children:[o==="TOP_START"&&e&&(0,I.jsxs)(ue.Container.Horizontal,{padding:"NONE_NONE_2XS_NONE",gap:"2XS",children:[(0,I.jsx)(me,{children:e}),t&&(0,I.jsx)(re,{children:t})]}),o!=="LEFT"&&(0,I.jsxs)(ue.Container.Vertical,{align:"CENTER",children:[o!=="TOP_START"&&(e||t)&&(0,I.jsxs)(ue.Container.Vertical,{align:"CENTER",padding:"NONE_NONE_2XS_NONE",children:[e&&(0,I.jsx)(me,{children:e}),t&&(0,I.jsx)(re,{children:t})]}),(0,I.jsxs)(Ee,{children:[(0,I.jsx)(ie,{type:"MINUS"}),(0,I.jsx)(ve,{}),(0,I.jsx)(ie,{type:"PLUS"})]})]}),o==="LEFT"&&(0,I.jsx)(ue.Container.Vertical,{children:(0,I.jsxs)(ue.Container.Horizontal,{align:"CENTER",children:[(e||t)&&(0,I.jsxs)(ue.Container.Vertical,{padding:"NONE_2XS_NONE_NONE",children:[e&&(0,I.jsx)(me,{children:e}),t&&(0,I.jsx)(re,{children:t})]}),(0,I.jsxs)(Ee,{children:[(0,I.jsx)(ie,{type:"MINUS"}),(0,I.jsx)(ve,{}),(0,I.jsx)(ie,{type:"PLUS"})]})]})})]})}var Be=require("react/jsx-runtime");function gt(t){var n=t,{children:e}=n,o=P(n,["children"]);return(0,Be.jsx)(Go,v(g({buttonTransparent:!1,labelPosition:"TOP_START",multiplier:1},o),{children:e?(0,Be.jsx)(at,{children:e}):(0,Be.jsx)(ft,{})}))}var ht=require("react/jsx-runtime");function co(e){return(0,ht.jsx)(ie,v(g({},e),{type:"MINUS"}))}co.displayName="Form.FormCounter.Minus";var Ct=require("react/jsx-runtime");function fo(e){return(0,Ct.jsx)(ie,v(g({},e),{type:"PLUS"}))}fo.displayName="Form.FormCounter.Plus";var bt=Object.assign(gt,{Display:ve,Plus:fo,Minus:co,Badge:Ae});var Tt=require("@mobilestock-native/container");var vt=require("react/jsx-runtime");function Et(t){var n=t,{children:e}=n,o=P(n,["children"]);return(0,vt.jsx)(Tt.Container.Horizontal,v(g({gap:"SM"},o),{children:e}))}var yt=require("@unform/core"),k=require("react"),Pt=require("react-native"),ye=R(require("styled-components/native")),St=require("@mobilestock-native/button"),Co=require("@mobilestock-native/container"),go=R(require("@mobilestock-native/tools")),ho=require("@mobilestock-native/typography");var pe=require("react/jsx-runtime"),Ft=(0,k.forwardRef)(function(f,h){var b=f,{name:o,label:t,defaultValue:n,type:r="text",autoSubmit:l=!1,format:i,onChangeText:m,autoCapitalize:a,full:u,maxLength:p}=b,d=P(b,["name","label","defaultValue","type","autoSubmit","format","onChangeText","autoCapitalize","full","maxLength"]);let{loading:C,submitForm:c}=q(),s=(0,yt.useField)(o),E=(0,k.useRef)(null),[F,w]=(0,k.useState)(!0),[D,T]=(0,k.useState)(""),V=r==="password",Q=r==="tel"?15:r==="zipcode"?9:p;(0,k.useEffect)(()=>{let N=D||n||(s==null?void 0:s.defaultValue)||"";E.current.value=N,T(N),s.registerField({name:s.fieldName,ref:E.current,getValue(S){return(S==null?void 0:S.value)||""},setValue(S,y){S.value=y,T(y)},clearValue(S){S.value="",T("")}})},[s==null?void 0:s.fieldName,s==null?void 0:s.registerField]),(0,k.useImperativeHandle)(h,()=>({focus(){var N;(N=E.current)==null||N.focus()},blur(){var N;(N=E.current)==null||N.blur()}}));let z=(0,k.useCallback)(N=>{var y,L;let S=N;switch(r){case"tel":S=go.default.phoneNumberFormatter(N);break;case"email":case"url":S=N.trim();break;case"number":S=N.replace(/[^0-9.,]/g,"");break;case"zipcode":S=go.default.formatZipcode(S);break}i&&(S=i(S)),T(S),E.current.value=S,m==null||m(S),r==="tel"&&l&&S.length===15&&((y=E.current)==null||y.blur(),c()),r==="zipcode"&&l&&S.length===9&&((L=E.current)==null||L.blur(),c())},[r,i,l,m,s]),be=(0,k.useCallback)(()=>{switch(r){case"tel":return"phone-pad";case"email":return"email-address";case"url":return"url";case"number":return"numeric";default:return"default"}},[r]);return(0,pe.jsxs)(zn,{full:u,$show:r!=="hidden",children:[t&&(0,pe.jsx)(ho.Typography,{children:t}),(0,pe.jsxs)(kn,{error:!!(s!=null&&s.error),$isPassword:V,children:[(0,pe.jsx)(Bn,v(g({},d),{ref:E,value:D,autoCapitalize:r&&["email","url"].includes(r)?"none":a,keyboardType:be(),secureTextEntry:F&&V,onChangeText:z,maxLength:Q,editable:!C&&d.editable})),V&&(0,pe.jsx)(St.Button,{size:"SM",onPress:()=>w(!F),icon:F?"EyeOff":"EyeOutline",variant:"TRANSPARENT"})]}),!!(s!=null&&s.error)&&(0,pe.jsx)(ho.Typography,{color:"DANGER",size:"SM",children:s.error})]})}),zn=(0,ye.default)(Co.Container.Vertical)`
27
- ${({$show:e})=>!e&&ye.css`
24
+ `;var Go=require("@mobilestock-native/typography"),Uo=require("react/jsx-runtime");function de({children:e}){return(0,Uo.jsx)(Go.Typography,{color:"DANGER_600",size:"SM",weight:"MEDIUM",children:e})}var Xo=require("@mobilestock-native/typography"),Wo=require("react/jsx-runtime");function ve({children:e}){return(0,Wo.jsx)(Xo.Typography,{weight:"REGULAR",children:e})}var L=require("react/jsx-runtime");function qo({children:e}){let{label:t,error:o,labelPosition:r}=ie(),n=[],s=[],a=(0,fe.useCallback)(i=>(0,fe.isValidElement)(i)&&i.type===fe.Fragment?a(i.props.children):i,[]),u=a(e);return fe.Children.toArray(u).forEach(i=>{(0,fe.isValidElement)(i)&&Ko.default.isComponentWithDisplayName(i.type)&&i.type.displayName===ot.displayName&&!i.props.renderInsidePill?n.push(i):s.push(i)}),(0,L.jsxs)(ae.Container.Vertical,{align:"CENTER_START",children:[r==="TOP_START"&&t&&(0,L.jsxs)(ae.Container.Horizontal,{padding:"NONE_NONE_2XS_NONE",gap:"2XS",children:[(0,L.jsx)(ve,{children:t}),o&&!n.length&&(0,L.jsx)(de,{children:o})]}),r!=="LEFT"&&(0,L.jsxs)(ae.Container.Vertical,{align:"CENTER",children:[(r!=="TOP_START"&&t||r!=="TOP_START"&&o&&!n.length)&&(0,L.jsxs)(ae.Container.Vertical,{align:"CENTER",padding:"NONE_NONE_2XS_NONE",children:[t&&(0,L.jsx)(ve,{children:t}),o&&!n.length&&(0,L.jsx)(de,{children:o})]}),(0,L.jsxs)(ae.Container.Horizontal,{align:"CENTER_START",children:[n.length>0&&(0,L.jsx)(ae.Container.Horizontal,{padding:"NONE_2XS_NONE_NONE",children:n}),(0,L.jsxs)(ae.Container.Vertical,{children:[(0,L.jsx)(Le,{children:s}),o&&!!n.length&&(0,L.jsx)(de,{children:o})]})]})]}),r==="LEFT"&&(0,L.jsx)(ae.Container.Vertical,{children:(0,L.jsxs)(ae.Container.Horizontal,{align:"CENTER",children:[(0,L.jsxs)(ae.Container.Vertical,{padding:"NONE_2XS_NONE_NONE",children:[t&&(0,L.jsx)(ve,{children:t}),o&&!n.length&&(0,L.jsx)(de,{children:o})]}),n.length>0&&(0,L.jsx)(ae.Container.Horizontal,{padding:"NONE_2XS_NONE_NONE",children:n}),(0,L.jsx)(Le,{children:s})]})})]})}var Ee=require("@mobilestock-native/container");var Yo=require("react"),Zo=require("react-native"),Jo=N(require("styled-components/native")),Qo=require("@mobilestock-native/button");var Ut=require("react/jsx-runtime");function ge(r){var n=r,{type:e,disabled:t}=n,o=O(n,["type","disabled"]);let{loading:s}=M(),a=ie(),u=(0,Yo.useMemo)(()=>e==="PLUS"&&a.maxCount!==void 0?a.count>=a.maxCount:e==="MINUS"&&a.minCount!==void 0?a.count<=a.minCount:!1,[e,a.count,a.maxCount,a.minCount]);function i(){e==="PLUS"?a.increment():a.decrement()}function l(){Zo.Vibration.vibrate(50),e==="PLUS"?a.increment(a.multiplier):a.decrement(a.multiplier)}return(0,Ut.jsx)(we,{children:(0,Ut.jsx)(ji,x(v({backgroundColor:e==="PLUS"?"DEFAULT_DARK":"CANCEL_DARK"},o),{size:"SM",icon:e==="PLUS"?"Plus":"Minus",variant:a.buttonTransparent?"TRANSPARENT":"DEFAULT",$grouped:a.groupElements,disabled:u||t||s,onPress:i,onLongPress:l,delayLongPress:500}))})}var ji=(0,Jo.default)(Qo.Button)`
25
+ border-radius: ${({$grouped:e,theme:t})=>e?t.borderRadius.none:t.borderRadius.default};
26
+ `;var nt=require("react"),jo=require("react-native"),er=require("styled-components/native"),tr=require("@mobilestock-native/clickable"),Xt=require("@mobilestock-native/container"),Wt=require("@mobilestock-native/typography");var he=require("react/jsx-runtime");function He(){let e=(0,er.useTheme)(),{count:t,editable:o,configureCount:r,autoFocus:n,onFocus:s,onBlur:a}=ie(),[u,i]=(0,nt.useState)(n&&o),[l,m]=(0,nt.useState)(t.toString());(0,nt.useEffect)(()=>{m(t.toString())},[t]);function d(c){r(Number(c.nativeEvent.text)||0),i(!1),a==null||a()}return o?(0,he.jsx)(tr.Clickable,{onPress:()=>i(!0),children:(0,he.jsx)(Xt.Container.Horizontal,{padding:"NONE_2XS",children:(0,he.jsx)(we,{children:u?(0,he.jsx)(jo.TextInput,{testID:"counter-input",value:l,keyboardType:"numeric",style:{fontWeight:"bold",fontSize:Number(e.font.size.lg)||16,textAlign:"center",width:40,height:40},autoFocus:!0,selectTextOnFocus:!0,onFocus:()=>s==null?void 0:s(),onBlur:d,onChangeText:m,onEndEditing:d}):(0,he.jsx)(Wt.Typography,{weight:"BOLD",size:"LG",children:t})})})}):(0,he.jsx)(Xt.Container.Horizontal,{padding:"NONE_2XS",children:(0,he.jsx)(we,{children:(0,he.jsx)(Wt.Typography,{weight:"BOLD",size:"LG",children:t})})})}He.displayName="Form.FormCounter.Display";var V=require("react/jsx-runtime");function or(){let{label:e,labelPosition:t,error:o}=ie();return(0,V.jsxs)(Ee.Container.Vertical,{align:"CENTER_START",children:[t==="TOP_START"&&e&&(0,V.jsxs)(Ee.Container.Horizontal,{padding:"NONE_NONE_2XS_NONE",gap:"2XS",children:[(0,V.jsx)(ve,{children:e}),o&&(0,V.jsx)(de,{children:o})]}),t!=="LEFT"&&(0,V.jsxs)(Ee.Container.Vertical,{align:"CENTER",children:[t!=="TOP_START"&&(e||o)&&(0,V.jsxs)(Ee.Container.Vertical,{align:"CENTER",padding:"NONE_NONE_2XS_NONE",children:[e&&(0,V.jsx)(ve,{children:e}),o&&(0,V.jsx)(de,{children:o})]}),(0,V.jsxs)(Le,{children:[(0,V.jsx)(ge,{type:"MINUS"}),(0,V.jsx)(He,{}),(0,V.jsx)(ge,{type:"PLUS"})]})]}),t==="LEFT"&&(0,V.jsx)(Ee.Container.Vertical,{children:(0,V.jsxs)(Ee.Container.Horizontal,{align:"CENTER",children:[(e||o)&&(0,V.jsxs)(Ee.Container.Vertical,{padding:"NONE_2XS_NONE_NONE",children:[e&&(0,V.jsx)(ve,{children:e}),o&&(0,V.jsx)(de,{children:o})]}),(0,V.jsxs)(Le,{children:[(0,V.jsx)(ge,{type:"MINUS"}),(0,V.jsx)(He,{}),(0,V.jsx)(ge,{type:"PLUS"})]})]})})]})}var gt=require("react/jsx-runtime");function rr(o){var r=o,{children:e}=r,t=O(r,["children"]);return(0,gt.jsx)(Oo,x(v({buttonTransparent:!1,labelPosition:"TOP_START",multiplier:1},t),{children:e?(0,gt.jsx)(qo,{children:e}):(0,gt.jsx)(or,{})}))}var nr=require("react/jsx-runtime");function Kt(e){return(0,nr.jsx)(ge,x(v({},e),{type:"MINUS"}))}Kt.displayName="Form.FormCounter.Minus";var ir=require("react/jsx-runtime");function qt(e){return(0,ir.jsx)(ge,x(v({},e),{type:"PLUS"}))}qt.displayName="Form.FormCounter.Plus";var ar=Object.assign(rr,{Display:He,Plus:qt,Minus:Kt,Badge:ot});var lr=require("@mobilestock-native/container");var ur=require("react/jsx-runtime");function sr(o){var r=o,{children:e}=r,t=O(r,["children"]);return(0,ur.jsx)(lr.Container.Horizontal,x(v({gap:"SM"},t),{children:e}))}var mr=require("@unform/core"),A=require("react"),De=require("react-native"),Fe=N(require("styled-components/native")),cr=require("@mobilestock-native/button"),Zt=require("@mobilestock-native/container"),Yt=N(require("@mobilestock-native/tools")),ht=require("@mobilestock-native/typography");var ue=require("react/jsx-runtime"),pr=(0,A.forwardRef)(function(R,S){var P=R,{name:t,type:o="text",full:r,label:n,maxLength:s,autoSubmit:a=!1,defaultValue:u,numberOfLines:i=1,showMaxContent:l=!1,autoCapitalize:m,format:d,onChange:c}=P,h=O(P,["name","type","full","label","maxLength","autoSubmit","defaultValue","numberOfLines","showMaxContent","autoCapitalize","format","onChange"]);let b=(0,Fe.useTheme)(),{loading:C,submitForm:y,notifyFieldChange:T}=M(),f=(0,mr.useField)(t),E=(0,A.useRef)(null),p=(0,A.useRef)(null),[F,oe]=(0,A.useState)(!0),[W,Z]=(0,A.useState)(""),[Te,X]=(0,A.useState)(0),I=(0,A.useRef)(""),D=t+"-input"+(0,A.useId)(),H=o==="password",K=i>1,re=De.Platform.OS==="web"&&K,po=o==="tel"?15:o==="zipcode"?9:s,fo=Number(b.font.size.sm),Ni=Math.ceil(fo*(Number(b.font.lineHeight)||1.5)),Ye=10,Ze=Ni*i+Ye,Oi={width:"100%",border:"none",outline:"none",backgroundColor:"transparent",fontFamily:b.font.families[0].name,lineHeight:Number(b.font.lineHeight)||1.5,fontSize:fo,color:String(b.colors.text.default),padding:"10px 0",display:"block",resize:"none",overflow:"hidden",boxSizing:"border-box"},Ai=(0,A.useMemo)(()=>v({flex:1,outline:"none",color:b.colors.text.default,height:K?l?Ze:Math.min(Math.max(Te?Te+Ye:45,45),Ze):45},K&&{paddingTop:Ye/2,paddingBottom:Ye/2}),[K,l,Ze,Te,Ye,b]),Vi=(0,A.useMemo)(()=>{switch(o){case"tel":return"phone-pad";case"email":return"email-address";case"url":return"url";case"number":return"numeric";default:return"default"}},[o]),mt=(0,A.useCallback)(()=>{if(!re||!p.current)return;let w=p.current,g=window.getComputedStyle(w),k=parseInt(g.lineHeight,10);isNaN(k)&&(k=parseInt(g.fontSize,10)*(Number(b.font.lineHeight)||1.5));let Re=parseInt(g.paddingTop,10),be=parseInt(g.paddingBottom,10),pt=k*i+Re+be+1,Qe=parseFloat(getComputedStyle(document.documentElement).fontSize)*2.5;if(l)w.style.height=pt+"px";else{w.style.height="0";let dt=w.scrollHeight;w.style.height=Math.max(Qe,Math.min(dt,pt))+"px"}},[re,i,l,b.font.lineHeight]),Li=(0,A.useCallback)(w=>{let g=w.nativeEvent.contentSize.height;if(K&&i&&g>Ze){Z(I.current),E.current.value=I.current;return}X(g)},[K,i,Ze]),ct=(0,A.useCallback)(w=>{let g=w;switch(o){case"tel":g=Yt.default.phoneNumberFormatter(w);break;case"email":case"url":g=w.trim();break;case"number":g=w.replace(/[^0-9.,]/g,"");break;case"zipcode":g=Yt.default.formatZipcode(g);break}return d&&(g=d(g)),g},[o,d]),Hi=(0,A.useCallback)(w=>{var k,Re;let g=ct(w.target.value);if(i&&p.current){let be=p.current;be.value=g,be.style.height="auto";let pt=be.scrollHeight,Je=window.getComputedStyle(be),Qe=parseInt(Je.lineHeight,10);isNaN(Qe)&&(Qe=parseInt(Je.fontSize,10)*(Number(b.font.lineHeight)||1.5));let dt=parseInt(Je.paddingTop,10),zi=parseInt(Je.paddingBottom,10),ki=Qe*(i+1)+dt+zi+1;if(pt>ki){be.value=W,mt();return}}Z(g),w.target.value=g,p.current&&(p.current.value=g),c==null||c({value:g,event:"INPUT_CHANGE"}),T==null||T(t,g),o==="tel"&&a&&g.length===15&&(c==null||c({value:g,event:"AUTO_SUBMIT"}),(k=p.current)==null||k.blur(),y()),o==="zipcode"&&a&&g.length===9&&(c==null||c({value:g,event:"AUTO_SUBMIT"}),(Re=p.current)==null||Re.blur(),y())},[ct,i,W,mt,c,T,t,a,o,y,b.font.lineHeight]),Di=(0,A.useCallback)(w=>{var k,Re;let g=ct(w);K&&i&&g.split(`
27
+ `).length>i||(Z(g),E.current.value=g,I.current=g,c==null||c({value:g,event:"INPUT_CHANGE"}),T==null||T(t,g),o==="tel"&&a&&g.length===15&&(c==null||c({value:g,event:"AUTO_SUBMIT"}),(k=E.current)==null||k.blur(),y()),o==="zipcode"&&a&&g.length===9&&(c==null||c({value:g,event:"AUTO_SUBMIT"}),(Re=E.current)==null||Re.blur(),y()))},[ct,a,c,T,K,i,W,t,o,y]);(0,A.useEffect)(()=>{mt()},[W,mt]),(0,A.useEffect)(()=>{let w=W||u||(f==null?void 0:f.defaultValue)||"";re?p.current&&(p.current.value=w):E.current.value=w,Z(w),re?f.registerField({name:f.fieldName,ref:p,getValue:g=>{var k;return((k=g.current)==null?void 0:k.value)||""},setValue:(g,k)=>{g.current&&(g.current.value=k,Z(k))},clearValue:g=>{g.current&&(g.current.value="",Z(""))}}):f.registerField({name:f.fieldName,ref:E.current,getValue(g){return(g==null?void 0:g.value)||""},setValue(g,k){g.value=k,Z(k)},clearValue(g){g.value="",Z("")}})},[f==null?void 0:f.fieldName,f==null?void 0:f.registerField]),(0,A.useImperativeHandle)(S,()=>({focus(){var w,g;re?(w=p.current)==null||w.focus():(g=E.current)==null||g.focus()},blur(){var w,g;re?(w=p.current)==null||w.blur():(g=E.current)==null||g.blur()}}));function Mi(){oe(w=>(c==null||c({value:!w,event:"TOGGLE_PASSWORD"}),!w))}return(0,ue.jsxs)(ea,{full:r,$show:o!=="hidden",children:[n&&De.Platform.OS==="android"&&(0,ue.jsx)(ht.Typography,{children:n}),n&&De.Platform.OS==="web"&&(0,ue.jsx)("label",{htmlFor:D,children:(0,ue.jsx)(ht.Typography,{children:n})}),(0,ue.jsxs)(ta,{$error:!!(f!=null&&f.error),$isPassword:H,children:[re?(0,ue.jsx)("textarea",{ref:p,id:D,value:W,onChange:Hi,maxLength:po,disabled:C||h.editable===!1,placeholder:h.placeholder,autoFocus:h.autoFocus,style:Oi}):(0,ue.jsx)(De.TextInput,x(v({},h),{ref:E,id:D,value:W,autoCapitalize:o&&["email","url"].includes(o)?"none":m,keyboardType:Vi,secureTextEntry:F&&H,onChangeText:Di,maxLength:po,editable:!C&&h.editable,multiline:K,numberOfLines:i,textAlignVertical:K?"top":"center",onContentSizeChange:K?Li:void 0,scrollEnabled:!1,style:Ai})),H&&(0,ue.jsx)(cr.Button,{size:"SM",onPress:Mi,icon:F?"EyeOff":"EyeOutline",variant:"TRANSPARENT"})]}),!!(f!=null&&f.error)&&(0,ue.jsx)(ht.Typography,{color:"DANGER",size:"SM",children:f.error})]})}),ea=(0,Fe.default)(Zt.Container.Vertical)`
28
+ ${({$show:e})=>!e&&Fe.css`
28
29
  display: none;
29
30
  `}
30
- `,kn=(0,ye.default)(Co.Container.Horizontal)`
31
+ `,ta=(0,Fe.default)(Zt.Container.Horizontal)`
31
32
  overflow: hidden;
32
- background-color: ${({error:e,theme:o})=>e?o.colors.input.error:o.colors.input.default};
33
- border: 1px solid ${({error:e,theme:o})=>e?o.colors.alert.urgent:o.colors.input.border};
33
+ background-color: ${({$error:e,theme:t})=>e?t.colors.input.error:t.colors.input.default};
34
+ border: 1px solid ${({$error:e,theme:t})=>e?t.colors.alert.urgent:t.colors.input.border};
34
35
  border-radius: ${({theme:e})=>e.borderRadius.default};
35
36
  padding: ${({$isPassword:e})=>e?"0 0 0 10px":"0 10px"};
36
- `,Bn=(0,ye.default)(Pt.TextInput)`
37
- flex: 1;
38
- height: 45px;
39
- color: ${({theme:e})=>e.colors.text.default};
40
- `;var rr=require("@unform/core"),nr=require("react"),ir=require("react-native"),ar=R(require("styled-components/native")),Ye=require("@mobilestock-native/container");var It=require("@unform/core"),Rt=R(require("expo-document-picker")),xt=require("expo-media-library"),$=require("react"),wt=require("react-native");var B={getHashFile(e){return`${e.name}-${e.size}`}};var bo=(l=>(l.json="application/json",l.png="image/png",l.jpg="image/jpg",l.jpeg="image/jpeg",l.all="*/*",l))(bo||{});var At=require("react/jsx-runtime"),Nt=(0,$.createContext)(null);function Lt({children:e,accept:o,onChange:t,name:n}){let{fieldName:r,registerField:l,defaultValue:i}=(0,It.useField)(n),[m,a]=(0,xt.usePermissions)({granularPermissions:["photo"]}),[u,p]=(0,$.useState)(null),d=(0,$.useCallback)(C=>{let c=C.map(T=>({file:T,hash:B.getHashFile(T)})),s=(u||[]).map(T=>({file:T,hash:B.getHashFile(T)})),E=[...c,...s],F=Array.from(new Set(E.map(T=>T.hash))).map(T=>E.find(V=>V.hash===T)),w=F.filter(T=>c.some(V=>V.hash===T.hash));if(!w.length)return;let D=F.map(T=>T.file);p(D),t==null||t({value:w.map(T=>T.file),event:"ADD_FILES"})},[u,t]),h=(0,$.useCallback)(C=>{if(!C){p(null);return}let c=C.filter(s=>!!s);d(c)},[d,p]);(0,$.useEffect)(()=>{l({name:r,getValue:()=>u,setValue:(C,c)=>h(c||i),clearValue:()=>p(null)})},[r,l,u,h,i]),(0,$.useEffect)(()=>{m!=null&&m.granted||a()},[m,a]),(0,$.useEffect)(()=>{p(null)},[o]);function f(C){if(!u)return;let c=u.filter(s=>B.getHashFile(s)!==C);p(c),t==null||t({value:u.find(s=>B.getHashFile(s)===C),event:"REMOVE_FILE"})}function b(){return se(this,null,function*(){let C=yield Rt.getDocumentAsync({multiple:!0,type:o==null?void 0:o.map(s=>bo[s])});if(!C.assets)return;if(wt.Platform.OS==="android"){d(C.assets.map(s=>({uri:s.uri,name:s.name,type:s.mimeType})));return}let c=C.assets.map(s=>s.file).filter(s=>!!s);c.length&&d(c)})}return(0,At.jsx)(Nt.Provider,{value:{handleSelectFile:b,handleSaveFiles:d,handleRemoveFile:f,accept:o,files:u,name:n},children:e})}function J(){let e=(0,$.useContext)(Nt);if(e===null)throw new Error("useMultipleArchive must be used within a MultipleArchiveProvider");return e}var _e={convertBytesToReadableFormat(e){return e>=1073741824?(e/1073741824).toFixed(2)+" GB":e>=1048576?(e/1048576).toFixed(2)+" MB":e>=1024?(e/1024).toFixed(2)+" KB":e+" B"},parseAcceptString(e){if(!e)return["all"];let o=["|",",",";"," ",`
41
- `," ","\r"];return typeof e=="string"?e.split(new RegExp(o.map(t=>`\\${t}`).join("|"))).map(t=>t.trim().replace(".","")).filter(t=>t.length>0):e}};var Bt=require("react-native"),_t=require("@mobilestock-native/container"),$t=require("@mobilestock-native/spacer");var Vt=require("@unform/core"),Mt=require("@mobilestock-native/typography");var Ot=require("react/jsx-runtime");function $e(){let e=J(),{error:o}=(0,Vt.useField)(e.name);return(0,Ot.jsx)(Mt.Typography,{color:"DANGER",size:"XS",children:o})}var Dt=require("@mobilestock-native/button");var Ht=require("react/jsx-runtime");function Ge(){let e=J();return(0,Ht.jsx)(Dt.Button,{text:"Selecionar arquivo",size:"XS",onPress:e.handleSelectFile})}var Ue=require("@mobilestock-native/typography");var ce=require("react/jsx-runtime");function Xe(){var o,t;let e=J();return(o=e.accept)!=null&&o.includes("all")?(0,ce.jsx)(Ue.Typography,{size:"XS",children:"Todos os tipos de arquivos s\xE3o suportados"}):(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsx)(Ue.Typography,{size:"XS",children:"Arquivos suportados"}),(0,ce.jsxs)(Ue.Typography,{size:"XS",children:["( ",(t=e.accept)==null?void 0:t.join(", ")," )"]})]})}var zt=require("@mobilestock-native/typography"),kt=require("react/jsx-runtime");function We({children:e}){return(0,kt.jsx)(zt.Typography,{size:"LG",weight:"REGULAR",children:e||"Arraste o arquivo para c\xE1"})}var de=require("react/jsx-runtime");function Gt(){var o;let e=J();return(0,de.jsxs)(_t.Container.Vertical,{align:"CENTER",children:[Bt.Platform.OS==="web"?(0,de.jsx)(We,{}):null,(0,de.jsx)($t.Spacer,{size:"2XS"}),(0,de.jsx)(Ge,{}),(0,de.jsx)($e,{}),(o=e.accept)!=null&&o.includes("all")?null:(0,de.jsx)(Xe,{})]})}var Ut=R(require("chroma-js")),Xt=require("react"),Wt=require("react-native"),qt=require("styled-components/native");var Yt=require("react/jsx-runtime");function Kt(e){let o=J(),t=(0,qt.useTheme)(),[n,r]=(0,Xt.useState)(!1);function l(i){var u;i.preventDefault(),r(!1);let m=i.dataTransfer;if(!m)return;let a=[];if(m.items&&m.items.length>0)for(let p=0;p<m.items.length;p++){let d=m.items[p];if(d.kind!=="file")continue;let h=d.webkitGetAsEntry();if(h&&h.isDirectory)continue;let f=d.getAsFile();f&&a.push(f)}else if(m.files&&m.files.length>0)for(let p=0;p<m.files.length;p++){let d=m.files.item(p);d&&a.push(d)}a.length!==0&&((u=o.accept)!=null&&u.some(p=>p!=="all")&&(a=a.filter(p=>{var h;let d=p.name.split(".").pop();return(h=o.accept)==null?void 0:h.includes(d==null?void 0:d.toLowerCase())}),!a.length)||o.handleSaveFiles(a))}return Wt.Platform.OS!=="web"?e.children:(0,Yt.jsx)("div",g({onDragOver:i=>{i.preventDefault(),r(!0)},onDrop:l,onDragLeave:i=>{i.preventDefault(),r(!1)},style:g({},n?{backgroundColor:(0,Ut.default)(t.colors.formMultipleArchive.droppableArea).alpha(.5).css()}:void 0),onClick:o.handleSelectFile},e))}var Ke=require("react"),G=R(require("react-native-reanimated")),Zt=require("@mobilestock-native/button"),Jt=require("@mobilestock-native/clickable"),Oe=require("@mobilestock-native/container"),Qt=require("@mobilestock-native/icons"),qe=require("@mobilestock-native/typography");var M=require("react/jsx-runtime");function _n(e){"worklet";switch(e){case 0:return 0;case 1:return 20;case 2:return 50;case 3:return 75;default:return 100}}function jt(){var i,m,a;let e=J(),o=(0,G.useSharedValue)(!1),t=(0,G.useSharedValue)(0),n=(0,Ke.useRef)(null);(0,Ke.useEffect)(()=>{var u;t.value=((u=e.files)==null?void 0:u.length)||0},[e.files,t]);let r=(0,G.useAnimatedStyle)(()=>({transform:[{rotate:(0,G.withSpring)(o.value?"180deg":"0deg")}]})),l=(0,G.useAnimatedStyle)(()=>{let u=_n(t.value);return{height:(0,G.withSpring)(o.value?u:0),opacity:(0,G.withSpring)(o.value?1:0)}},[n.current,t]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Oe.Container.Horizontal,{align:"END",children:!!((i=e.files)!=null&&i.length)&&(0,M.jsx)(Jt.Clickable,{onPress:()=>o.value=!o.value,children:(0,M.jsxs)(Oe.Container.Horizontal,{align:"CENTER",children:[(0,M.jsxs)(qe.Typography,{size:"XS",children:[(m=e.files)==null?void 0:m.length," arquivos"]}),(0,M.jsx)(G.default.View,{style:r,children:(0,M.jsx)(Qt.Icon,{name:"ChevronDown",size:"XS"})})]})})}),(0,M.jsx)(G.default.ScrollView,{style:l,children:(a=e.files)==null?void 0:a.map((u,p)=>(0,M.jsxs)(Oe.Container.Horizontal,{align:"START_CENTER",children:[(0,M.jsxs)(Oe.Container.Horizontal,{gap:"SM",full:!0,children:[(0,M.jsx)(qe.Typography,{size:"XS",weight:"MEDIUM",children:u.name.slice(0,20)}),u.size&&(0,M.jsx)(qe.Typography,{size:"XS",children:_e.convertBytesToReadableFormat(u.size)})]}),(0,M.jsx)(Zt.Button,{variant:"TRANSPARENT",icon:"Trash",backgroundColor:"CANCEL_DARK",size:"XS",testID:"remove-file-button",onPress:()=>e.handleRemoveFile(B.getHashFile(u))})]},p))})]})}var er=require("@mobilestock-native/typography"),tr=require("react/jsx-runtime");function or({children:e}){return(0,tr.jsx)(er.Typography,{children:e})}var oe=require("react/jsx-runtime");function lr(t){var n=t,{accept:e}=n,o=P(n,["accept"]);let{error:r}=(0,rr.useField)(o.name),l=(0,nr.useMemo)(()=>_e.parseAcceptString(e),[e]);return(0,oe.jsx)(Lt,v(g({},o),{accept:l,children:(0,oe.jsxs)(Ye.Container.Vertical,{gap:"2XS",children:[(0,oe.jsx)(Ye.Container.Horizontal,{align:o.alignLabel||"START",children:(0,oe.jsx)(or,{children:o.label})}),(0,oe.jsxs)($n,{$error:!!r,$minWidth:ir.Platform.OS==="web"?"400px":"100%",padding:"MD",children:[(0,oe.jsx)(Kt,{children:o.children||(0,oe.jsx)(Gt,{})}),(0,oe.jsx)(jt,{})]})]})}))}var $n=(0,ar.default)(Ye.Container.Vertical)`
42
- border: 1px solid ${({theme:e,$error:o})=>o?e.colors.input.error:e.colors.input.border};
37
+ `;var Xr=require("@unform/core"),Wr=require("react"),Kr=require("react-native"),qr=N(require("styled-components/native")),Rt=require("@mobilestock-native/container");var fr=require("@unform/core"),gr=N(require("expo-document-picker")),hr=require("expo-media-library"),J=require("react"),Tr=require("react-native");var oa=1.775,ra=.125,na=.54,ia=16,dr=300,z={getHashFile(e){return`${e.name}-${e.size}`},resolveColor(e,t,o){var r;return e&&(r=t.colors.switch[e.toLowerCase()])!=null?r:t.colors.switch[o]},toNum(e){return Math.round(e*1e4)/1e4},buildDimensions(e){let t=parseFloat(e),o=this.toNum(t*ia),r=this.toNum(o*ra),n=this.toNum(o-2*r),s=this.toNum(o*oa),a=this.toNum(s-n-2*r),u=this.toNum(n*na);return{width:s,height:o,handle:n,translate:a,offset:r,iconSize:u}},resolveSliderColor(e,t,o,r,n){return n?r?n.colors.alert.error_notice:e?this.resolveColor(t,n,"on"):this.resolveColor(o,n,"off"):n.colors.container.default}};var Jt=(s=>(s.json="application/json",s.png="image/png",s.jpg="image/jpg",s.jpeg="image/jpeg",s.all="*/*",s))(Jt||{});var vr=require("react/jsx-runtime"),br=(0,J.createContext)(null);function Cr({children:e,accept:t,onChange:o,name:r}){let{notifyFieldChange:n}=M(),{fieldName:s,registerField:a,defaultValue:u}=(0,fr.useField)(r),[i,l]=(0,hr.usePermissions)({granularPermissions:["photo"]}),[m,d]=(0,J.useState)(null),c=(0,J.useCallback)(P=>{let b=P.map(p=>({file:p,hash:z.getHashFile(p)})),C=(m||[]).map(p=>({file:p,hash:z.getHashFile(p)})),y=[...b,...C],T=Array.from(new Set(y.map(p=>p.hash))).map(p=>y.find(F=>F.hash===p)),f=T.filter(p=>b.some(F=>F.hash===p.hash));if(!f.length)return;let E=T.map(p=>p.file);d(E),n==null||n(s,E),o==null||o({value:f.map(p=>p.file),event:"ADD_FILES"})},[m,o,n,s]),h=(0,J.useCallback)(P=>{if(!P){d(null);return}let b=P.filter(C=>!!C);c(b)},[c,d]);(0,J.useEffect)(()=>{a({name:s,getValue:()=>m,setValue:(P,b)=>h(b||u),clearValue:()=>d(null)})},[s,a,m,h,u]),(0,J.useEffect)(()=>{i!=null&&i.granted||l()},[i,l]),(0,J.useEffect)(()=>{d(null)},[t]);function S(P){if(!m)return;let b=m.filter(C=>z.getHashFile(C)!==P);d(b),n==null||n(s,b),o==null||o({value:m.find(C=>z.getHashFile(C)===P),event:"REMOVE_FILE"})}function R(){return Ce(this,null,function*(){let P=yield gr.getDocumentAsync({multiple:!0,type:t==null?void 0:t.map(C=>Jt[C])});if(!P.assets)return;if(Tr.Platform.OS==="android"){c(P.assets.map(C=>({uri:C.uri,name:C.name,type:C.mimeType})));return}let b=P.assets.map(C=>C.file).filter(C=>!!C);b.length&&c(b)})}return(0,vr.jsx)(br.Provider,{value:{handleSelectFile:R,handleSaveFiles:c,handleRemoveFile:S,accept:t,files:m,name:r},children:e})}function le(){let e=(0,J.useContext)(br);if(e===null)throw new Error("useMultipleArchive must be used within a MultipleArchiveProvider");return e}var Tt={convertBytesToReadableFormat(e){return e>=1073741824?(e/1073741824).toFixed(2)+" GB":e>=1048576?(e/1048576).toFixed(2)+" MB":e>=1024?(e/1024).toFixed(2)+" KB":e+" B"},parseAcceptString(e){if(!e)return["all"];let t=["|",",",";"," ",`
38
+ `," ","\r"];return typeof e=="string"?e.split(new RegExp(t.map(o=>`\\${o}`).join("|"))).map(o=>o.trim().replace(".","")).filter(o=>o.length>0):e}};var Fr=require("react-native"),Ir=require("@mobilestock-native/container"),Nr=require("@mobilestock-native/spacer");var Er=require("@unform/core"),Sr=require("@mobilestock-native/typography");var yr=require("react/jsx-runtime");function bt(){let e=le(),{error:t}=(0,Er.useField)(e.name);return(0,yr.jsx)(Sr.Typography,{color:"DANGER",size:"XS",children:t})}var Pr=require("@mobilestock-native/button");var Rr=require("react/jsx-runtime");function Ct(){let e=le();return(0,Rr.jsx)(Pr.Button,{text:"Selecionar arquivo",size:"XS",onPress:e.handleSelectFile})}var vt=require("@mobilestock-native/typography");var Se=require("react/jsx-runtime");function Et(){var t,o;let e=le();return(t=e.accept)!=null&&t.includes("all")?(0,Se.jsx)(vt.Typography,{size:"XS",children:"Todos os tipos de arquivos s\xE3o suportados"}):(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(vt.Typography,{size:"XS",children:"Arquivos suportados"}),(0,Se.jsxs)(vt.Typography,{size:"XS",children:["( ",(o=e.accept)==null?void 0:o.join(", ")," )"]})]})}var xr=require("@mobilestock-native/typography"),wr=require("react/jsx-runtime");function St({children:e}){return(0,wr.jsx)(xr.Typography,{size:"LG",weight:"REGULAR",children:e||"Arraste o arquivo para c\xE1"})}var ye=require("react/jsx-runtime");function Or(){var t;let e=le();return(0,ye.jsxs)(Ir.Container.Vertical,{align:"CENTER",children:[Fr.Platform.OS==="web"?(0,ye.jsx)(St,{}):null,(0,ye.jsx)(Nr.Spacer,{size:"2XS"}),(0,ye.jsx)(Ct,{}),(0,ye.jsx)(bt,{}),(t=e.accept)!=null&&t.includes("all")?null:(0,ye.jsx)(Et,{})]})}var Ar=N(require("chroma-js")),Vr=require("react"),Lr=require("react-native"),Hr=require("styled-components/native");var Mr=require("react/jsx-runtime");function Dr(e){let t=le(),o=(0,Hr.useTheme)(),[r,n]=(0,Vr.useState)(!1);function s(a){var l;a.preventDefault(),n(!1);let u=a.dataTransfer;if(!u)return;let i=[];if(u.items&&u.items.length>0)for(let m=0;m<u.items.length;m++){let d=u.items[m];if(d.kind!=="file")continue;let c=d.webkitGetAsEntry();if(c&&c.isDirectory)continue;let h=d.getAsFile();h&&i.push(h)}else if(u.files&&u.files.length>0)for(let m=0;m<u.files.length;m++){let d=u.files.item(m);d&&i.push(d)}i.length!==0&&((l=t.accept)!=null&&l.some(m=>m!=="all")&&(i=i.filter(m=>{var c;let d=m.name.split(".").pop();return(c=t.accept)==null?void 0:c.includes(d==null?void 0:d.toLowerCase())}),!i.length)||t.handleSaveFiles(i))}return Lr.Platform.OS!=="web"?e.children:(0,Mr.jsx)("div",v({onDragOver:a=>{a.preventDefault(),n(!0)},onDrop:s,onDragLeave:a=>{a.preventDefault(),n(!1)},style:v({},r?{backgroundColor:(0,Ar.default)(o.colors.formMultipleArchive.droppableArea).alpha(.5).css()}:void 0),onClick:t.handleSelectFile},e))}var Pt=require("react"),Q=N(require("react-native-reanimated")),zr=require("@mobilestock-native/button"),kr=require("@mobilestock-native/clickable"),it=require("@mobilestock-native/container"),_r=require("@mobilestock-native/icons"),yt=require("@mobilestock-native/typography");var B=require("react/jsx-runtime");function aa(e){"worklet";switch(e){case 0:return 0;case 1:return 20;case 2:return 50;case 3:return 75;default:return 100}}function Br(){var a,u,i;let e=le(),t=(0,Q.useSharedValue)(!1),o=(0,Q.useSharedValue)(0),r=(0,Pt.useRef)(null);(0,Pt.useEffect)(()=>{var l;o.value=((l=e.files)==null?void 0:l.length)||0},[e.files,o]);let n=(0,Q.useAnimatedStyle)(()=>({transform:[{rotate:(0,Q.withSpring)(t.value?"180deg":"0deg")}]})),s=(0,Q.useAnimatedStyle)(()=>{let l=aa(o.value);return{height:(0,Q.withSpring)(t.value?l:0),opacity:(0,Q.withSpring)(t.value?1:0)}},[r.current,o]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(it.Container.Horizontal,{align:"END",children:!!((a=e.files)!=null&&a.length)&&(0,B.jsx)(kr.Clickable,{onPress:()=>t.value=!t.value,children:(0,B.jsxs)(it.Container.Horizontal,{align:"CENTER",children:[(0,B.jsxs)(yt.Typography,{size:"XS",children:[(u=e.files)==null?void 0:u.length," arquivos"]}),(0,B.jsx)(Q.default.View,{style:n,children:(0,B.jsx)(_r.Icon,{name:"ChevronDown",size:"XS"})})]})})}),(0,B.jsx)(Q.default.ScrollView,{style:s,children:(i=e.files)==null?void 0:i.map((l,m)=>(0,B.jsxs)(it.Container.Horizontal,{align:"START_CENTER",children:[(0,B.jsxs)(it.Container.Horizontal,{gap:"SM",full:!0,children:[(0,B.jsx)(yt.Typography,{size:"XS",weight:"MEDIUM",children:l.name.slice(0,20)}),l.size&&(0,B.jsx)(yt.Typography,{size:"XS",children:Tt.convertBytesToReadableFormat(l.size)})]}),(0,B.jsx)(zr.Button,{variant:"TRANSPARENT",icon:"Trash",backgroundColor:"CANCEL_DARK",size:"XS",testID:"remove-file-button",onPress:()=>e.handleRemoveFile(z.getHashFile(l))})]},m))})]})}var $r=require("@mobilestock-native/typography"),Ur=require("react/jsx-runtime");function Gr({children:e}){return(0,Ur.jsx)($r.Typography,{children:e})}var pe=require("react/jsx-runtime");function Yr(o){var r=o,{accept:e}=r,t=O(r,["accept"]);let{error:n}=(0,Xr.useField)(t.name),s=(0,Wr.useMemo)(()=>Tt.parseAcceptString(e),[e]);return(0,pe.jsx)(Cr,x(v({},t),{accept:s,children:(0,pe.jsxs)(Rt.Container.Vertical,{gap:"2XS",children:[(0,pe.jsx)(Rt.Container.Horizontal,{align:t.alignLabel||"START",children:(0,pe.jsx)(Gr,{children:t.label})}),(0,pe.jsxs)(la,{$error:!!n,$minWidth:Kr.Platform.OS==="web"?"400px":"100%",padding:"MD",children:[(0,pe.jsx)(Dr,{children:t.children||(0,pe.jsx)(Or,{})}),(0,pe.jsx)(Br,{})]})]})}))}var la=(0,qr.default)(Rt.Container.Vertical)`
39
+ border: 1px solid ${({theme:e,$error:t})=>t?e.colors.input.error:e.colors.input.border};
43
40
  border-radius: ${({theme:e})=>e.borderRadius.default};
44
- background-color: ${({theme:e,$error:o})=>o?e.colors.input.error:e.colors.input.default};
41
+ background-color: ${({theme:e,$error:t})=>t?e.colors.input.error:e.colors.input.default};
45
42
  min-width: ${({$minWidth:e})=>e};
46
- `;var sr=Object.assign(lr,{Title:We,HelpButton:Ge,HelpText:Xe,ErrorLabel:$e});var oo=require("react"),Ie=require("react-native"),Xr=R(require("react-native-draggable-flatlist")),Wr=require("styled-components/native"),eo=require("@mobilestock-native/container");var mr=require("@unform/core"),ur=require("expo-image-picker"),pr=require("expo-media-library"),O=require("react"),To=require("react-native"),cr=require("styled-components/native");var gr=require("react/jsx-runtime"),dr=(0,O.createContext)(null);function fr({gap:e="2XS",size:o="SM",name:t,children:n,onChange:r,multiple:l,dragAndDrop:i,buttonAddDirection:m}){let a=(0,cr.useTheme)(),{fieldName:u,registerField:p,defaultValue:d}=(0,mr.useField)(t),[h,f]=(0,pr.usePermissions)({granularPermissions:["photo"]}),[b,C]=(0,O.useState)(null),[c,s]=(0,O.useState)(!1),[E,F]=(0,O.useState)(null),w=(0,O.useMemo)(()=>parseInt(a.sizeImage[o.toLowerCase()]),[a,o]),D=(0,O.useMemo)(()=>parseInt(a.gaps[e.toLowerCase()]),[a,e]),T=(0,O.useCallback)(y=>{C(m==="RIGHT"?L=>[...L||[],...y].reverse():L=>[...L||[],...y])},[C,m]),V=(0,O.useCallback)(y=>{if(!y){C(null);return}T(y)},[T]);(0,O.useEffect)(()=>{p({name:u,getValue:()=>b,setValue:(y,L)=>V(L||d),clearValue:()=>C(null)})},[u,p,b,V,d]),(0,O.useEffect)(()=>{h!=null&&h.granted||f()},[h,f]);function Q(){return se(this,null,function*(){var L;let y=yield(0,ur.launchImageLibraryAsync)({mediaTypes:["images"],allowsEditing:l?void 0:!0,quality:1,allowsMultipleSelection:l});if(To.Platform.OS==="web"&&y.assets&&!l){s(!0),F(y.assets[0].file);return}T(((L=y.assets)==null?void 0:L.map(le=>To.Platform.OS==="web"?le.file:{uri:le.uri,name:le.fileName,type:le.mimeType}))||[])})}function z(y){if(!b)return;let L=b.filter(le=>B.getHashFile(le)!==y);C(L),r==null||r({value:b.find(le=>B.getHashFile(le)===y),event:"REMOVE_IMAGE"})}function be(y){C(y),r==null||r({value:y,event:"REORDER_IMAGES"})}function N(y){T([y]),s(!1),F(null),r==null||r({value:y,event:"CROP_SAVE"})}function S(){s(!1),F(null)}return(0,gr.jsx)(dr.Provider,{value:{showDeviceImage:Q,images:b,removeImage:z,reorderImages:be,openImageCropModal:c,imageToCrop:E,handleImageCropCancel:S,handleImageCropSave:N,sizeComponent:w,gapComponent:D,dragAndDrop:i,name:t,gap:e},children:n})}function _(){let e=(0,O.useContext)(dr);if(!e)throw new Error("usePhotoList must be used within a PhotoListProvider");return e}var hr=require("@mobilestock-native/button");var Cr=require("react/jsx-runtime");function Eo(){let e=_();return(0,Cr.jsx)(hr.Button,{icon:"Plus",variant:"OUTLINE",onPress:e.showDeviceImage,style:{height:e.sizeComponent,width:e.sizeComponent}})}var br=require("@unform/core"),Tr=require("@mobilestock-native/typography");var vr=require("react/jsx-runtime");function Er(){let e=_(),{error:o}=(0,br.useField)(e.name);return(0,vr.jsx)(Tr.Typography,{color:"DANGER",size:"XS",children:o})}var Je=require("react"),Vr=require("react-native"),Qe=R(require("styled-components/native")),Mr=require("@mobilestock-native/container"),Or=require("@mobilestock-native/image");var Ir=R(require("styled-components/native")),Rr=require("@mobilestock-native/clickable");var yr=require("styled-components/native"),Pr=require("@mobilestock-native/container");var Fr=require("react/jsx-runtime");function Sr({isActive:e}){let o=(0,yr.useTheme)(),t=_();return(0,Fr.jsx)(Pr.Container.Horizontal,{style:[{height:2,width:t.sizeComponent*.7,backgroundColor:o.colors.formPhotoList.defaultBar},e&&{backgroundColor:o.colors.formPhotoList.highlightBar}]})}var vo=require("react/jsx-runtime");function xr({drag:e,isActive:o}){return(0,vo.jsx)(Gn,{onLongPress:e,onTouchMove:e,onTouchStart:e,onPressIn:e,children:(0,vo.jsx)(Sr,{isActive:o})})}var Gn=(0,Ir.default)(Rr.Clickable)`
43
+ `;var Zr=Object.assign(Yr,{Title:St,HelpButton:Ct,HelpText:Et,ErrorLabel:bt});var Ot=require("react"),_e=require("react-native"),Ln=N(require("react-native-draggable-flatlist")),Hn=require("styled-components/native"),Nt=require("@mobilestock-native/container");var Jr=require("@unform/core"),Qr=require("expo-image-picker"),jr=require("expo-media-library"),$=require("react"),Qt=require("react-native"),en=require("styled-components/native");var rn=require("react/jsx-runtime"),tn=(0,$.createContext)(null);function on({gap:e="2XS",size:t="SM",name:o,children:r,onChange:n,multiple:s,dragAndDrop:a,buttonAddDirection:u}){let i=(0,en.useTheme)(),{notifyFieldChange:l}=M(),{fieldName:m,registerField:d,defaultValue:c}=(0,Jr.useField)(o),[h,S]=(0,jr.usePermissions)({granularPermissions:["photo"]}),[R,P]=(0,$.useState)(null),[b,C]=(0,$.useState)(!1),[y,T]=(0,$.useState)(null),f=(0,$.useMemo)(()=>parseInt(i.sizeImage[t.toLowerCase()]),[i,t]),E=(0,$.useMemo)(()=>parseInt(i.gaps[e.toLowerCase()]),[i,e]),p=(0,$.useCallback)(I=>{P(u==="RIGHT"?D=>{let H=[...D||[],...I].reverse();return l==null||l(m,H),H}:D=>{let H=[...D||[],...I];return l==null||l(m,H),H})},[P,u,l,m]),F=(0,$.useCallback)(I=>{if(!I){P(null);return}p(I)},[p]);(0,$.useEffect)(()=>{d({name:m,getValue:()=>R,setValue:(I,D)=>F(D||c),clearValue:()=>P(null)})},[m,d,R,F,c]),(0,$.useEffect)(()=>{h!=null&&h.granted||S()},[h,S]);function oe(){return Ce(this,null,function*(){var D;let I=yield(0,Qr.launchImageLibraryAsync)({mediaTypes:["images"],allowsEditing:s?void 0:!0,quality:1,allowsMultipleSelection:s});if(Qt.Platform.OS==="web"&&I.assets&&!s){C(!0),T(I.assets[0].file);return}p(((D=I.assets)==null?void 0:D.map(H=>Qt.Platform.OS==="web"?H.file:{uri:H.uri,name:H.fileName,type:H.mimeType}))||[])})}function W(I){if(!R)return;let D=R.filter(H=>z.getHashFile(H)!==I);P(D),l==null||l(m,D),n==null||n({value:R.find(H=>z.getHashFile(H)===I),event:"REMOVE_IMAGE"})}function Z(I){P(I),l==null||l(m,I),n==null||n({value:I,event:"REORDER_IMAGES"})}function Te(I){p([I]),C(!1),T(null),n==null||n({value:I,event:"CROP_SAVE"})}function X(){C(!1),T(null)}return(0,rn.jsx)(tn.Provider,{value:{showDeviceImage:oe,images:R,removeImage:W,reorderImages:Z,openImageCropModal:b,imageToCrop:y,handleImageCropCancel:X,handleImageCropSave:Te,sizeComponent:f,gapComponent:E,dragAndDrop:a,name:o,gap:e},children:r})}function q(){let e=(0,$.useContext)(tn);if(!e)throw new Error("usePhotoList must be used within a PhotoListProvider");return e}var nn=require("@mobilestock-native/button");var an=require("react/jsx-runtime");function jt(){let e=q();return(0,an.jsx)(nn.Button,{icon:"Plus",variant:"OUTLINE",onPress:e.showDeviceImage,style:{height:e.sizeComponent,width:e.sizeComponent}})}var ln=require("@unform/core"),sn=require("@mobilestock-native/typography");var mn=require("react/jsx-runtime");function un(){let e=q(),{error:t}=(0,ln.useField)(e.name);return(0,mn.jsx)(sn.Typography,{color:"DANGER",size:"XS",children:t})}var wt=require("react"),Sn=require("react-native"),Ft=N(require("styled-components/native")),yn=require("@mobilestock-native/container"),Pn=require("@mobilestock-native/image");var gn=N(require("styled-components/native")),hn=require("@mobilestock-native/clickable");var cn=require("styled-components/native"),pn=require("@mobilestock-native/container");var fn=require("react/jsx-runtime");function dn({isActive:e}){let t=(0,cn.useTheme)(),o=q();return(0,fn.jsx)(pn.Container.Horizontal,{style:[{height:2,width:o.sizeComponent*.7,backgroundColor:t.colors.formPhotoList.defaultBar},e&&{backgroundColor:t.colors.formPhotoList.highlightBar}]})}var eo=require("react/jsx-runtime");function Tn({drag:e,isActive:t}){return(0,eo.jsx)(sa,{onLongPress:e,onTouchMove:e,onTouchStart:e,onPressIn:e,children:(0,eo.jsx)(dn,{isActive:t})})}var sa=(0,gn.default)(hn.Clickable)`
47
44
  flex-direction: row;
48
45
  justify-content: space-between;
49
46
  align-items: center;
@@ -51,14 +48,14 @@
51
48
  position: absolute;
52
49
  bottom: 0;
53
50
  background-color: ${({theme:e})=>e.colors.formPhotoList.controlBar};
54
- `;var Ze=R(require("styled-components/native")),wr=require("@mobilestock-native/clickable"),Nr=require("@mobilestock-native/icons"),Lr=R(require("@mobilestock-native/tools"));var yo=require("react/jsx-runtime");function Ar({photo:e}){let o=_(),t=(0,Ze.useTheme)();function n(){o.removeImage(B.getHashFile(e))}return(0,yo.jsx)(Un,{onPress:n,children:(0,yo.jsx)(Nr.Icon,{name:"X",size:"XS",color:Lr.default.defineTextColor(t.colors.formPhotoList.trashButton)})})}var Un=(0,Ze.default)(wr.Clickable)`
51
+ `;var xt=N(require("styled-components/native")),bn=require("@mobilestock-native/clickable"),Cn=require("@mobilestock-native/icons"),vn=N(require("@mobilestock-native/tools"));var to=require("react/jsx-runtime");function En({photo:e}){let t=q(),o=(0,xt.useTheme)();function r(){t.removeImage(z.getHashFile(e))}return(0,to.jsx)(ua,{onPress:r,children:(0,to.jsx)(Cn.Icon,{name:"X",size:"XS",color:vn.default.defineTextColor(o.colors.formPhotoList.trashButton)})})}var ua=(0,xt.default)(bn.Clickable)`
55
52
  position: absolute;
56
53
  top: 0;
57
54
  right: 0;
58
55
  z-index: 1;
59
56
  border-bottom-left-radius: 4px;
60
57
  background-color: ${({theme:e})=>e.colors.formPhotoList.trashButton};
61
- `;var Pe=require("react/jsx-runtime");function Xn({item:e,drag:o,isActive:t}){let n=_(),r=(0,Je.useMemo)(()=>Vr.Platform.OS==="web"?URL.createObjectURL(e):e.uri,[e]);return(0,Pe.jsxs)(Wn,{align:"CENTER",sizeComponent:n.sizeComponent,isActive:t,children:[(0,Pe.jsx)(Ar,{photo:e}),(0,Pe.jsx)(Or.Img,{src:{uri:r},alt:"image",size:"SM"}),n.dragAndDrop&&(0,Pe.jsx)(xr,{drag:o,isActive:t})]})}var Dr=(0,Je.memo)(Xn),Wn=(0,Qe.default)(Mr.Container.Vertical)`
58
+ `;var Me=require("react/jsx-runtime");function ma({item:e,drag:t,isActive:o}){let r=q(),n=(0,wt.useMemo)(()=>Sn.Platform.OS==="web"?URL.createObjectURL(e):e.uri,[e]);return(0,Me.jsxs)(ca,{align:"CENTER",sizeComponent:r.sizeComponent,isActive:o,children:[(0,Me.jsx)(En,{photo:e}),(0,Me.jsx)(Pn.Img,{src:{uri:n},alt:"image",size:"SM"}),r.dragAndDrop&&(0,Me.jsx)(Tn,{drag:t,isActive:o})]})}var Rn=(0,wt.memo)(ma),ca=(0,Ft.default)(yn.Container.Vertical)`
62
59
  background-color: ${({theme:e})=>e.colors.formPhotoList.defaultBar};
63
60
  border-radius: ${({theme:e})=>e.borderRadius.default};
64
61
  overflow: hidden;
@@ -68,10 +65,10 @@
68
65
  position: relative;
69
66
  border-color: ${({theme:e})=>e.colors.formPhotoList.controlBar};
70
67
 
71
- ${({theme:e,isActive:o})=>o&&Qe.css`
68
+ ${({theme:e,isActive:t})=>t&&Ft.css`
72
69
  border-color: ${e.colors.formPhotoList.highlightBar};
73
70
  `}
74
- `;var Hr=require("@mobilestock-native/typography"),kr=require("react/jsx-runtime");function zr({children:e}){return(0,kr.jsx)(Hr.Typography,{children:e})}var j=require("react"),Gr=require("react-image-crop"),Xl=require("react-image-crop/dist/ReactCrop.css"),Fe=R(require("styled-components/native")),So=require("@mobilestock-native/button"),he=require("@mobilestock-native/container");var ge=require("react"),Po=require("react-native"),Br=R(require("styled-components/native")),_r=require("ua-parser-js"),je=require("@mobilestock-native/container");var Se=require("react/jsx-runtime");function $r(t){var n=t,{children:e}=n,o=P(n,["children"]);let[r,l]=(0,ge.useState)(!1),i=(0,ge.useCallback)(()=>(0,_r.UAParser)(window.navigator.userAgent).device.type==="mobile"||window.innerWidth<=768,[]),m=(0,ge.useCallback)(()=>{l(i())},[i]);return(0,ge.useEffect)(()=>(window.addEventListener("resize",m),l(i()),()=>{window.removeEventListener("resize",m)}),[i,m]),r?(0,Se.jsx)(Po.Modal,v(g({transparent:!0,statusBarTranslucent:!0},o),{children:(0,Se.jsx)(je.Container.Main,{children:e})})):(0,Se.jsx)(Po.Modal,v(g({transparent:!0,statusBarTranslucent:!0,animationType:"slide"},o),{children:(0,Se.jsx)(je.Container.Vertical,{align:"CENTER",full:!0,children:(0,Se.jsx)(qn,{padding:"SM",children:e})})}))}var qn=(0,Br.default)(je.Container.Vertical)`
71
+ `;var xn=require("@mobilestock-native/typography"),Fn=require("react/jsx-runtime");function wn({children:e}){return(0,Fn.jsx)(xn.Typography,{children:e})}var me=require("react"),An=require("react-image-crop"),Nu=require("react-image-crop/dist/ReactCrop.css"),ke=N(require("styled-components/native")),ro=require("@mobilestock-native/button"),Ne=require("@mobilestock-native/container");var Ie=require("react"),oo=require("react-native"),In=N(require("styled-components/native")),Nn=require("ua-parser-js"),It=require("@mobilestock-native/container");var ze=require("react/jsx-runtime");function On(o){var r=o,{children:e}=r,t=O(r,["children"]);let[n,s]=(0,Ie.useState)(!1),a=(0,Ie.useCallback)(()=>(0,Nn.UAParser)(window.navigator.userAgent).device.type==="mobile"||window.innerWidth<=768,[]),u=(0,Ie.useCallback)(()=>{s(a())},[a]);return(0,Ie.useEffect)(()=>(window.addEventListener("resize",u),s(a()),()=>{window.removeEventListener("resize",u)}),[a,u]),n?(0,ze.jsx)(oo.Modal,x(v({transparent:!0,statusBarTranslucent:!0},t),{children:(0,ze.jsx)(It.Container.Main,{children:e})})):(0,ze.jsx)(oo.Modal,x(v({transparent:!0,statusBarTranslucent:!0,animationType:"slide"},t),{children:(0,ze.jsx)(It.Container.Vertical,{align:"CENTER",full:!0,children:(0,ze.jsx)(pa,{padding:"SM",children:e})})}))}var pa=(0,In.default)(It.Container.Vertical)`
75
72
  background-color: ${({theme:e})=>e.colors.container.default};
76
73
  border-radius: ${({theme:e})=>e.borderRadius.default};
77
74
  border: 1px solid ${({theme:e})=>e.colors.input.border};
@@ -80,27 +77,47 @@
80
77
  width: 100%;
81
78
  height: 100%;
82
79
  overflow: hidden;
83
- `;var U=require("react/jsx-runtime");function Ur(){let e=_(),[o,t]=(0,j.useState)(),[n,r]=(0,j.useState)(),[l,i]=(0,j.useState)(),m=(0,j.useRef)(null),a=(0,j.useRef)(null),u=(0,j.useMemo)(()=>e.imageToCrop?URL.createObjectURL(e.imageToCrop):void 0,[e.imageToCrop]);(0,j.useEffect)(()=>{e.imageToCrop||(t(void 0),r(void 0),i(void 0))},[e.imageToCrop,e.openImageCropModal]);function p({displayWidth:f,displayHeight:b,naturalWidth:C,naturalHeight:c}){r({displayWidth:f,displayHeight:b,naturalWidth:C,naturalHeight:c});let s=Math.min(f,b);t({unit:"px",width:s,height:s,x:f>b?(f-s)/2:0,y:b>f?(b-s)/2:0})}function d(){return se(this,null,function*(){if(!e.imageToCrop||!o||!n)return;let f=n.naturalWidth/n.displayWidth,b=n.naturalHeight/n.displayHeight,C=o.x*f,c=o.y*b,s=o.width*f,E=o.height*b,F=new OffscreenCanvas(s,E),w=F.getContext("2d"),D=new Image;D.src=URL.createObjectURL(e.imageToCrop),yield new Promise(Q=>{D.onload=()=>Q()}),w.drawImage(D,C,c,s,E,0,0,s,E);let T=yield F.convertToBlob({type:"image/png",quality:1}),V="";if(!e.imageToCrop.name)V="image-cropped.png";else{let Q=e.imageToCrop.name.split(".");Q.pop(),V=Q.join(".")+"-cropped.png"}e.handleImageCropSave(new File([T],V,{type:"image/png",lastModified:Date.now()}))})}function h(f){let b=f.currentTarget,C=a.current,c=C.clientWidth,s=C.clientHeight,E=b.naturalWidth,F=b.naturalHeight,w=Math.min(c/E,s/F),D=E*w,T=F*w;i({width:D,height:T}),p({displayWidth:D,displayHeight:T,naturalWidth:E,naturalHeight:F})}return(0,U.jsx)($r,{visible:e.openImageCropModal,children:(0,U.jsxs)(he.Container.Vertical,{full:!0,padding:"NONE_XS_XS_XS",gap:"MD",children:[(0,U.jsx)(Kn,{full:!0,align:"CENTER",children:(0,U.jsx)(Yn,{ref:a,testID:"container-crop-vertical",align:"CENTER",children:(0,U.jsx)(Zn,{crop:o,width:l==null?void 0:l.width,height:l==null?void 0:l.height,onChange:f=>t(f),children:(0,U.jsx)("img",{src:u,ref:m,testID:"image-to-crop",onLoad:h})})})}),(0,U.jsxs)(he.Container.Horizontal,{gap:"MD",children:[(0,U.jsx)(he.Container.Vertical,{full:!0,children:(0,U.jsx)(So.Button,{onPress:e.handleImageCropCancel,text:"Cancelar",testID:"button-cancel",backgroundColor:"CANCEL_DARK"})}),(0,U.jsx)(he.Container.Vertical,{full:!0,children:(0,U.jsx)(So.Button,{onPress:d,testID:"button-save",text:"Salvar"})})]})]})})}var Kn=(0,Fe.default)(he.Container.Vertical)`
80
+ `;var j=require("react/jsx-runtime");function Vn(){let e=q(),[t,o]=(0,me.useState)(),[r,n]=(0,me.useState)(),[s,a]=(0,me.useState)(),u=(0,me.useRef)(null),i=(0,me.useRef)(null),l=(0,me.useMemo)(()=>e.imageToCrop?URL.createObjectURL(e.imageToCrop):void 0,[e.imageToCrop]);(0,me.useEffect)(()=>{e.imageToCrop||(o(void 0),n(void 0),a(void 0))},[e.imageToCrop,e.openImageCropModal]);function m({displayWidth:h,displayHeight:S,naturalWidth:R,naturalHeight:P}){n({displayWidth:h,displayHeight:S,naturalWidth:R,naturalHeight:P});let b=Math.min(h,S);o({unit:"px",width:b,height:b,x:h>S?(h-b)/2:0,y:S>h?(S-b)/2:0})}function d(){return Ce(this,null,function*(){if(!e.imageToCrop||!t||!r)return;let h=r.naturalWidth/r.displayWidth,S=r.naturalHeight/r.displayHeight,R=t.x*h,P=t.y*S,b=t.width*h,C=t.height*S,y=new OffscreenCanvas(b,C),T=y.getContext("2d"),f=new Image;f.src=URL.createObjectURL(e.imageToCrop),yield new Promise(F=>{f.onload=()=>F()}),T.drawImage(f,R,P,b,C,0,0,b,C);let E=yield y.convertToBlob({type:"image/png",quality:1}),p="";if(!e.imageToCrop.name)p="image-cropped.png";else{let F=e.imageToCrop.name.split(".");F.pop(),p=F.join(".")+"-cropped.png"}e.handleImageCropSave(new File([E],p,{type:"image/png",lastModified:Date.now()}))})}function c(h){let S=h.currentTarget,R=i.current,P=R.clientWidth,b=R.clientHeight,C=S.naturalWidth,y=S.naturalHeight,T=Math.min(P/C,b/y),f=C*T,E=y*T;a({width:f,height:E}),m({displayWidth:f,displayHeight:E,naturalWidth:C,naturalHeight:y})}return(0,j.jsx)(On,{visible:e.openImageCropModal,children:(0,j.jsxs)(Ne.Container.Vertical,{full:!0,padding:"NONE_XS_XS_XS",gap:"MD",children:[(0,j.jsx)(da,{full:!0,align:"CENTER",children:(0,j.jsx)(fa,{ref:i,testID:"container-crop-vertical",align:"CENTER",children:(0,j.jsx)(ga,{crop:t,width:s==null?void 0:s.width,height:s==null?void 0:s.height,onChange:h=>o(h),children:(0,j.jsx)("img",{src:l,ref:u,testID:"image-to-crop",onLoad:c})})})}),(0,j.jsxs)(Ne.Container.Horizontal,{gap:"MD",children:[(0,j.jsx)(Ne.Container.Vertical,{full:!0,children:(0,j.jsx)(ro.Button,{onPress:e.handleImageCropCancel,text:"Cancelar",testID:"button-cancel",backgroundColor:"CANCEL_DARK"})}),(0,j.jsx)(Ne.Container.Vertical,{full:!0,children:(0,j.jsx)(ro.Button,{onPress:d,testID:"button-save",text:"Salvar"})})]})]})})}var da=(0,ke.default)(Ne.Container.Vertical)`
84
81
  width: 100%;
85
- `,Yn=(0,Fe.default)(he.Container.Vertical)`
82
+ `,fa=(0,ke.default)(Ne.Container.Vertical)`
86
83
  width: 100%;
87
84
  height: 100%;
88
85
  padding-left: 16px;
89
86
  padding-right: 16px;
90
- `,Zn=(0,Fe.default)(Gr.ReactCrop)`
91
- ${({width:e,height:o})=>e&&o&&Fe.css`
87
+ `,ga=(0,ke.default)(An.ReactCrop)`
88
+ ${({width:e,height:t})=>e&&t&&ke.css`
92
89
  width: ${e}px;
93
- height: ${o}px;
90
+ height: ${t}px;
94
91
  display: inline-flex;
95
92
  `}
96
- `;var H=require("react/jsx-runtime");function qr({numberOfImagesVisible:e,buttonAddDirection:o,label:t,alignLabel:n}){let r=(0,Ie.useWindowDimensions)(),l=_(),i=(0,Wr.useTheme)(),m=(0,oo.useCallback)(u=>{l.reorderImages(u.data)},[l]),a=(0,oo.useMemo)(()=>e?l.sizeComponent*e+l.gapComponent*(e-1):r.width-l.sizeComponent-l.gapComponent*4,[e,r.width,l.sizeComponent,l.gapComponent]);return(0,H.jsxs)(H.Fragment,{children:[!!t&&(0,H.jsx)(eo.Container.Horizontal,{align:n||"START",testID:"label-container",children:(0,H.jsx)(zr,{children:t})}),(0,H.jsxs)(eo.Container.Horizontal,{gap:l.gap,children:[o==="LEFT"&&(0,H.jsx)(Eo,{}),l.images&&(0,H.jsx)(eo.Container.Horizontal,{children:(0,H.jsx)(Xr.default,{data:l.images,keyExtractor:B.getHashFile,horizontal:!0,onDragEnd:m,activationDistance:10,style:{maxWidth:a,paddingBottom:parseInt(i.spacing["2xs"])},ItemSeparatorComponent:()=>(0,H.jsx)(Ie.View,{style:{width:l.gapComponent}}),renderItem:u=>(0,H.jsx)(Dr,g({},u))})}),o==="RIGHT"&&(0,H.jsx)(Eo,{})]}),(0,H.jsx)(Er,{}),Ie.Platform.OS==="web"&&(0,H.jsx)(Ur,{})]})}var Fo=require("react/jsx-runtime");function Kr(l){var i=l,{label:e,alignLabel:o,buttonAddDirection:t="LEFT",numberOfImagesVisible:n=0}=i,r=P(i,["label","alignLabel","buttonAddDirection","numberOfImagesVisible"]);return(0,Fo.jsx)(fr,v(g({multiple:!0,dragAndDrop:!0,buttonAddDirection:t},r),{children:(0,Fo.jsx)(qr,{label:e,alignLabel:o,buttonAddDirection:t,numberOfImagesVisible:n})}))}var bn=require("@unform/core"),Tn=require("react-native"),En=require("@mobilestock-native/container"),xo=require("@mobilestock-native/typography");var ln=require("@unform/core"),De=require("react"),ze=R(require("styled-components/native")),sn=require("@mobilestock-native/clickable"),He=require("@mobilestock-native/container"),mn=require("@mobilestock-native/icons"),un=require("@mobilestock-native/typography");var rn=require("react"),xe=require("react-native"),ao=require("react-native-gesture-handler"),A=R(require("react-native-reanimated")),nn=require("styled-components/native"),no=require("@mobilestock-native/container"),io=require("@mobilestock-native/list");var on=require("react-native-gesture-handler"),Re=require("@mobilestock-native/container");var Yr=require("styled-components/native"),Zr=require("@mobilestock-native/container");var Qr=require("react/jsx-runtime");function Jr(e){let o=(0,Yr.useTheme)();return(0,Qr.jsx)(Zr.Container.Horizontal,g({style:{width:100,height:4,borderRadius:5,backgroundColor:o.colors.container.shadow}},e))}var jr=require("@mobilestock-native/typography");var en=require("react/jsx-runtime");function Io(e){return(0,en.jsx)(jr.Typography,g({size:"MD",align:"RIGHT",color:"DEFAULT_100"},e))}var ee=require("react/jsx-runtime");function tn({placeholder:e,panGesture:o}){return o?(0,ee.jsx)(on.GestureDetector,{gesture:o,children:(0,ee.jsxs)(Re.Container.Vertical,{padding:"XS",testID:"form-sheet-header-with-gesture",children:[(0,ee.jsx)(Re.Container.Horizontal,{align:"CENTER",children:(0,ee.jsx)(Jr,{})}),(0,ee.jsx)(Re.Container.Horizontal,{children:(0,ee.jsx)(Io,{children:e})})]})}):(0,ee.jsx)(Re.Container.Vertical,{padding:"XS",testID:"form-sheet-header-without-gesture",children:(0,ee.jsx)(Re.Container.Horizontal,{children:(0,ee.jsx)(Io,{children:e})})})}var X=require("react/jsx-runtime"),{height:Jn}=xe.Dimensions.get("window"),Ro=Jn*.8,to=200,ro=45;function an(e){let o=(0,nn.useTheme)(),t=(0,rn.useMemo)(()=>Math.min(Ro,e.options.length*ro+ro),[e.options]),n=Math.min(to,t),r=(0,A.useSharedValue)(n),l=(0,A.useSharedValue)(n),i=ao.Gesture.Pan().onStart(()=>{l.value=r.value}).onUpdate(p=>{let d=l.value-p.translationY;r.value=Math.max(to,Math.min(d,t))}).onEnd(p=>{p.velocityY<-1e3?r.value=(0,A.withTiming)(t):r.value>Ro/2?r.value=(0,A.withTiming)(Ro):r.value=(0,A.withTiming)(to)}),m=(0,A.useAnimatedStyle)(()=>({height:r.value,bottom:0}));(0,A.useAnimatedReaction)(()=>e.visible,p=>{p&&(r.value=(0,A.withSpring)(n,{damping:20,stiffness:90,mass:.3}))},[e.visible]);function a(){"worklet";r.value=(0,A.withTiming)(0,{},()=>{(0,A.runOnJS)(e.onClose)()})}function u(p){var d;e.onSelect(p.value===((d=e.selectValue)==null?void 0:d.value)?null:p),a()}return(0,X.jsx)(xe.Modal,{visible:e.visible,transparent:!0,animationType:"none",testID:"modal",children:(0,X.jsxs)(ao.GestureHandlerRootView,{children:[(0,X.jsx)(xe.TouchableWithoutFeedback,{onPress:a,testID:"backdrop",children:(0,X.jsx)(no.Container.Vertical,{full:!0})}),(0,X.jsxs)(A.default.View,{style:[m,{position:"absolute",width:"100%",backgroundColor:o.colors.container.default,borderTopLeftRadius:20,borderTopRightRadius:20,borderWidth:1,borderColor:o.colors.container.shadow}],children:[(0,X.jsx)(tn,{placeholder:e.placeholder,panGesture:e.options.length*ro+ro>to?i:void 0}),(0,X.jsx)(no.Container.Main,{children:(0,X.jsx)(io.List,{data:e.options,itemKey:"value",ItemSeparatorComponent:()=>(0,X.jsx)(no.Container.Horizontal,{testID:"separator",style:{backgroundColor:o.colors.container.shadow,height:1,width:"100%"}}),renderItem:p=>{var d;return(0,X.jsx)(io.List.Item.Horizontal,{isSelected:((d=e.selectValue)==null?void 0:d.value)===p.value,padding:"SM",onPress:()=>u(p),children:(0,X.jsx)(io.List.Item.Title,{children:p.label})})}})})]})]})})}var W=require("react/jsx-runtime");function pn({options:e,placeholder:o,disabled:t,defaultValue:n,name:r}){let l=(0,ze.useTheme)(),{loading:i}=q(),{fieldName:m,registerField:a,error:u,defaultValue:p}=(0,ln.useField)(r),[d,h]=(0,De.useState)(!1),[f,b]=(0,De.useState)(p||n||null);return(0,De.useEffect)(()=>{a({name:m,getValue:()=>(f==null?void 0:f.value)||"",setValue:(C,c)=>{let s=e.find(E=>E.value===c);s&&b(s)},clearValue:()=>{b(null)}})},[m,a,f,e]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(sn.Clickable,{disabled:t||i,onPress:()=>h(!0),testID:"select-android",children:(0,W.jsxs)(Qn,{padding:"NONE_XS_NONE_MD",error:!!u,testID:"select-android-container",align:"BETWEEN_CENTER",children:[(0,W.jsx)(He.Container.Horizontal,{children:(0,W.jsx)(un.Typography,{color:f?"DEFAULT":"DEFAULT_200",children:(f==null?void 0:f.label)||o})}),(0,W.jsxs)(He.Container.Horizontal,{style:{opacity:.3},gap:"XS",align:"CENTER",children:[(0,W.jsx)(jn,{error:!!u}),(0,W.jsx)(mn.Icon,{name:"ChevronDown",size:"XS",color:u?l.colors.alert.urgent:l.colors.text.default})]})]})}),!t&&!i&&(0,W.jsx)(an,{options:e,onClose:()=>h(!1),visible:d,placeholder:o,selectValue:f,onSelect:C=>{b(C)}})]})}var Qn=(0,ze.default)(He.Container.Horizontal)`
93
+ `;var G=require("react/jsx-runtime");function Dn({numberOfImagesVisible:e,buttonAddDirection:t,label:o,alignLabel:r}){let n=(0,_e.useWindowDimensions)(),s=q(),a=(0,Hn.useTheme)(),u=(0,Ot.useCallback)(l=>{s.reorderImages(l.data)},[s]),i=(0,Ot.useMemo)(()=>e?s.sizeComponent*e+s.gapComponent*(e-1):n.width-s.sizeComponent-s.gapComponent*4,[e,n.width,s.sizeComponent,s.gapComponent]);return(0,G.jsxs)(G.Fragment,{children:[!!o&&(0,G.jsx)(Nt.Container.Horizontal,{align:r||"START",testID:"label-container",children:(0,G.jsx)(wn,{children:o})}),(0,G.jsxs)(Nt.Container.Horizontal,{gap:s.gap,children:[t==="LEFT"&&(0,G.jsx)(jt,{}),s.images&&(0,G.jsx)(Nt.Container.Horizontal,{children:(0,G.jsx)(Ln.default,{data:s.images,keyExtractor:z.getHashFile,horizontal:!0,onDragEnd:u,activationDistance:10,style:{maxWidth:i,paddingBottom:parseInt(a.spacing["2xs"])},ItemSeparatorComponent:()=>(0,G.jsx)(_e.View,{style:{width:s.gapComponent}}),renderItem:l=>(0,G.jsx)(Rn,v({},l))})}),t==="RIGHT"&&(0,G.jsx)(jt,{})]}),(0,G.jsx)(un,{}),_e.Platform.OS==="web"&&(0,G.jsx)(Vn,{})]})}var no=require("react/jsx-runtime");function Mn(s){var a=s,{label:e,alignLabel:t,buttonAddDirection:o="LEFT",numberOfImagesVisible:r=0}=a,n=O(a,["label","alignLabel","buttonAddDirection","numberOfImagesVisible"]);return(0,no.jsx)(on,x(v({multiple:!0,dragAndDrop:!0,buttonAddDirection:o},n),{children:(0,no.jsx)(Dn,{label:e,alignLabel:t,buttonAddDirection:o,numberOfImagesVisible:r})}))}var ii=require("@unform/core"),ai=require("react-native"),li=require("@mobilestock-native/container"),so=require("@mobilestock-native/typography");var Yn=require("@unform/core"),Ge=require("react"),lt=N(require("styled-components/native")),Zn=require("@mobilestock-native/clickable"),at=require("@mobilestock-native/container"),Jn=require("@mobilestock-native/icons"),Qn=require("@mobilestock-native/typography");var Wn=require("react"),$e=require("react-native"),Dt=require("react-native-gesture-handler"),_=N(require("react-native-reanimated")),Kn=require("styled-components/native"),Lt=require("@mobilestock-native/container"),Ht=require("@mobilestock-native/list");var Un=require("react-native-gesture-handler"),Be=require("@mobilestock-native/container");var zn=require("styled-components/native"),kn=require("@mobilestock-native/container");var Bn=require("react/jsx-runtime");function _n(e){let t=(0,zn.useTheme)();return(0,Bn.jsx)(kn.Container.Horizontal,v({style:{width:100,height:4,borderRadius:5,backgroundColor:t.colors.container.shadow}},e))}var $n=require("@mobilestock-native/typography");var Gn=require("react/jsx-runtime");function io(e){return(0,Gn.jsx)($n.Typography,v({size:"MD",align:"RIGHT",color:"DEFAULT_100"},e))}var ce=require("react/jsx-runtime");function Xn({placeholder:e,panGesture:t}){return t?(0,ce.jsx)(Un.GestureDetector,{gesture:t,children:(0,ce.jsxs)(Be.Container.Vertical,{padding:"XS",testID:"form-sheet-header-with-gesture",children:[(0,ce.jsx)(Be.Container.Horizontal,{align:"CENTER",children:(0,ce.jsx)(_n,{})}),(0,ce.jsx)(Be.Container.Horizontal,{children:(0,ce.jsx)(io,{children:e})})]})}):(0,ce.jsx)(Be.Container.Vertical,{padding:"XS",testID:"form-sheet-header-without-gesture",children:(0,ce.jsx)(Be.Container.Horizontal,{children:(0,ce.jsx)(io,{children:e})})})}var ee=require("react/jsx-runtime"),{height:ha}=$e.Dimensions.get("window"),ao=ha*.8,At=200,Vt=45;function qn(e){let t=(0,Kn.useTheme)(),o=(0,Wn.useMemo)(()=>Math.min(ao,e.options.length*Vt+Vt),[e.options]),r=Math.min(At,o),n=(0,_.useSharedValue)(r),s=(0,_.useSharedValue)(r),a=Dt.Gesture.Pan().onStart(()=>{s.value=n.value}).onUpdate(m=>{let d=s.value-m.translationY;n.value=Math.max(At,Math.min(d,o))}).onEnd(m=>{m.velocityY<-1e3?n.value=(0,_.withTiming)(o):n.value>ao/2?n.value=(0,_.withTiming)(ao):n.value=(0,_.withTiming)(At)}),u=(0,_.useAnimatedStyle)(()=>({height:n.value,bottom:0}));(0,_.useAnimatedReaction)(()=>e.visible,m=>{m&&(n.value=(0,_.withSpring)(r,{damping:20,stiffness:90,mass:.3}))},[e.visible]);function i(){"worklet";n.value=(0,_.withTiming)(0,{},()=>{(0,_.runOnJS)(e.onClose)()})}function l(m){var d;e.onSelect(m.value===((d=e.selectValue)==null?void 0:d.value)?null:m),i()}return(0,ee.jsx)($e.Modal,{visible:e.visible,transparent:!0,animationType:"none",testID:"modal",children:(0,ee.jsxs)(Dt.GestureHandlerRootView,{children:[(0,ee.jsx)($e.TouchableWithoutFeedback,{onPress:i,testID:"backdrop",children:(0,ee.jsx)(Lt.Container.Vertical,{full:!0})}),(0,ee.jsxs)(_.default.View,{style:[u,{position:"absolute",width:"100%",backgroundColor:t.colors.container.default,borderTopLeftRadius:20,borderTopRightRadius:20,borderWidth:1,borderColor:t.colors.container.shadow}],children:[(0,ee.jsx)(Xn,{placeholder:e.placeholder,panGesture:e.options.length*Vt+Vt>At?a:void 0}),(0,ee.jsx)(Lt.Container.Main,{children:(0,ee.jsx)(Ht.List,{data:e.options,itemKey:"value",ItemSeparatorComponent:()=>(0,ee.jsx)(Lt.Container.Horizontal,{testID:"separator",style:{backgroundColor:t.colors.container.shadow,height:1,width:"100%"}}),renderItem:m=>{var d;return(0,ee.jsx)(Ht.List.Item.Horizontal,{isSelected:((d=e.selectValue)==null?void 0:d.value)===m.value,padding:"SM",onPress:()=>l(m),children:(0,ee.jsx)(Ht.List.Item.Title,{children:m.label})})}})})]})]})})}var te=require("react/jsx-runtime");function jn({options:e,placeholder:t,disabled:o,defaultValue:r,name:n,onChange:s,autoFocus:a,onFocus:u,onBlur:i}){let l=(0,lt.useTheme)(),{loading:m,notifyFieldChange:d}=M(),{fieldName:c,registerField:h,error:S,defaultValue:R}=(0,Yn.useField)(n),[P,b]=(0,Ge.useState)(!1),[C,y]=(0,Ge.useState)(R||r||null);(0,Ge.useEffect)(()=>{a&&!o&&!m&&(b(!0),u==null||u())},[]),(0,Ge.useEffect)(()=>{h({name:c,getValue:()=>(C==null?void 0:C.value)||"",setValue:(p,F)=>{let oe=e.find(W=>W.value===F);oe&&y(oe)},clearValue:()=>{y(null)}})},[c,h,C,e]);function T(){b(!0),u==null||u()}function f(){b(!1),i==null||i()}function E(p){var F,oe;y(p),d==null||d(c,(F=p==null?void 0:p.value)!=null?F:""),s==null||s({value:(oe=p==null?void 0:p.value)!=null?oe:"",event:"SELECT_CHANGE"})}return(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(Zn.Clickable,{disabled:o||m,onPress:T,testID:"select-android",children:(0,te.jsxs)(Ta,{padding:"NONE_XS_NONE_MD",error:!!S,testID:"select-android-container",align:"BETWEEN_CENTER",children:[(0,te.jsx)(at.Container.Horizontal,{children:(0,te.jsx)(Qn.Typography,{color:C?"DEFAULT":"DEFAULT_200",children:(C==null?void 0:C.label)||t})}),(0,te.jsxs)(at.Container.Horizontal,{style:{opacity:.3},gap:"XS",align:"CENTER",children:[(0,te.jsx)(ba,{error:!!S}),(0,te.jsx)(Jn.Icon,{name:"ChevronDown",size:"XS",color:S?l.colors.alert.urgent:l.colors.text.default})]})]})}),!o&&!m&&(0,te.jsx)(qn,{options:e,onClose:f,visible:P,placeholder:t,selectValue:C,onSelect:E})]})}var Ta=(0,lt.default)(at.Container.Horizontal)`
97
94
  overflow: hidden;
98
95
  height: 47px;
99
- background-color: ${({error:e,theme:o})=>e?o.colors.input.error:o.colors.input.default};
100
- border: 1px solid ${({error:e,theme:o})=>e?o.colors.alert.urgent:o.colors.input.border};
96
+ background-color: ${({error:e,theme:t})=>e?t.colors.input.error:t.colors.input.default};
97
+ border: 1px solid ${({error:e,theme:t})=>e?t.colors.alert.urgent:t.colors.input.border};
101
98
  border-radius: 5px;
102
- `,jn=(0,ze.default)(He.Container.Vertical)`
99
+ `,ba=(0,lt.default)(at.Container.Vertical)`
103
100
  width: 1px;
104
101
  height: 30px;
105
- background-color: ${({theme:e,error:o})=>o?e.colors.alert.urgent:e.colors.text.default};
106
- `;var cn=require("@unform/core"),dn=require("lodash"),we=require("react"),fn=R(require("react-select")),gn=require("styled-components/native");var Cn=require("react/jsx-runtime");function hn(i){var m=i,{options:e,placeholder:o,disabled:t,name:n,defaultValue:r}=m,l=P(m,["options","placeholder","disabled","name","defaultValue"]);let a=(0,gn.useTheme)(),{loading:u}=q(),{fieldName:p,defaultValue:d,registerField:h,error:f}=(0,cn.useField)(n),b=(0,we.useRef)(null);(0,we.useEffect)(()=>{h({name:p,ref:b.current,getValue:c=>{var E,F,w;return((w=(F=(E=c==null?void 0:c.state)==null?void 0:E.selectValue)==null?void 0:F[0])==null?void 0:w.value)||""}})},[p,h]);let C=(0,we.useCallback)(c=>function(s){return(0,dn.mergeWith)(s,{fontFamily:a.font.families[0].name,lineHeight:a.font.lineHeight,color:a.colors.text.default},c)},[]);return(0,Cn.jsx)(fn.default,g({options:[{label:o,options:e}],placeholder:o,menuPortalTarget:typeof document!="undefined"?document.body:void 0,menuPosition:"fixed",styles:{container:C({width:"100%",display:"flex",height:"3rem"}),control:C({width:"100%",backgroundColor:f?a.colors.input.error:void 0,borderColor:f?a.colors.alert.urgent:void 0}),indicatorSeparator:C({backgroundColor:f?a.colors.alert.urgent:void 0}),dropdownIndicator:C({color:f?a.colors.alert.urgent:void 0}),option:(c,s)=>v(g({},c),{fontFamily:a.font.families[0].name,lineHeight:a.font.lineHeight,color:a.colors.text.default,backgroundColor:s.isSelected?a.colors.listItem.selected:a.colors.listItem.default}),menuPortal:C({zIndex:99999})},defaultValue:r||d,ref:b,isDisabled:t||u},l))}var Ce=require("react/jsx-runtime");function vn(a){var u=a,{name:e,label:o,disabled:t=!1,options:n,placeholder:r="Selecione um item",full:l=!1,defaultValue:i}=u,m=P(u,["name","label","disabled","options","placeholder","full","defaultValue"]);let{error:p}=(0,bn.useField)(e);return(0,Ce.jsxs)(En.Container.Vertical,{full:l,children:[o&&(0,Ce.jsx)(xo.Typography,{testID:"label",children:o}),Tn.Platform.OS==="web"?(0,Ce.jsx)(hn,g({disabled:t,options:n,name:e,placeholder:r,defaultValue:i},m)):(0,Ce.jsx)(pn,{name:e,disabled:t,options:n,defaultValue:i,placeholder:r}),p&&(0,Ce.jsx)(xo.Typography,{color:"DANGER",size:"SM",testID:"error",children:p})]})}var yn=require("@mobilestock-native/container");var Sn=require("react/jsx-runtime");function Pn(t){var n=t,{children:e}=n,o=P(n,["children"]);return(0,Sn.jsx)(yn.Container.Vertical,v(g({gap:"SM"},o),{children:e}))}var ei=Object.assign(Ho,{Input:Ft,Button:ko,Select:vn,Counter:bt,Vertical:Pn,MultipleArchive:sr,PhotoList:Kr,Horizontal:Et});0&&(module.exports={Form,useForm});
102
+ background-color: ${({theme:e,error:t})=>t?e.colors.alert.urgent:e.colors.text.default};
103
+ `;var ei=require("@unform/core"),Mt=N(require("chroma-js")),lo=require("lodash"),Oe=require("react"),ti=N(require("react-select")),oi=require("styled-components/native");var ni=require("react/jsx-runtime");function ri({options:e,placeholder:t,disabled:o,name:r,defaultValue:n,onChange:s,autoFocus:a,onFocus:u,onBlur:i}){let l=(0,oi.useTheme)(),{loading:m,notifyFieldChange:d}=M(),{fieldName:c,defaultValue:h,registerField:S,error:R}=(0,ei.useField)(r),P=(0,Oe.useRef)(null);(0,Oe.useEffect)(()=>{S({name:c,ref:P.current,getValue:y=>{var f,E,p;let T=((p=(E=(f=y==null?void 0:y.state)==null?void 0:f.selectValue)==null?void 0:E[0])==null?void 0:p.value)||"";return d==null||d(c,T),s==null||s({value:T,event:"SELECT_CHANGE"}),T}})},[c,S,d,s]);let b=(0,Oe.useCallback)(y=>function(T){return(0,lo.mergeWith)(T,{fontFamily:l.font.families[0].name,lineHeight:l.font.lineHeight,color:l.colors.text.default},y)},[]),C=(0,Oe.useCallback)((y,T)=>{let f="transparent",E=l.colors.text.default;switch(!0){case T.isFocused:{let p=(0,Mt.default)(l.colors.listItem.hover);p.luminance()>.5?f=p.brighten(1).hex("rgb"):f=p.hex("rgb");let F=(0,Mt.default)(f);E=F.luminance(F.luminance()>.5?-2:2).hex("rgb");break}case T.isSelected:{f=l.colors.listItem.selected;let p=(0,Mt.default)(f);E=p.luminance(p.luminance()>.5?-2:2).hex("rgb");break}}return(0,lo.mergeWith)(y,{fontFamily:l.font.families[0].name,lineHeight:l.font.lineHeight,color:E,backgroundColor:f})},[]);return(0,ni.jsx)(ti.default,{options:[{label:t,options:e}],placeholder:t,menuPortalTarget:typeof document!="undefined"?document.body:void 0,menuPosition:"fixed",styles:{container:b({width:"100%",display:"flex",height:"3rem"}),control:b({width:"100%",backgroundColor:R?l.colors.input.error:void 0,borderColor:R?l.colors.alert.urgent:void 0}),indicatorSeparator:b({backgroundColor:R?l.colors.alert.urgent:void 0}),dropdownIndicator:b({color:R?l.colors.alert.urgent:void 0}),option:C,menuPortal:b({zIndex:99999})},openMenuOnFocus:!0,defaultValue:n||h,ref:P,isDisabled:o||m,autoFocus:a,onFocus:u,onBlur:i})}var Ae=require("react/jsx-runtime");function si({name:e,label:t,disabled:o=!1,options:r,placeholder:n="Selecione um item",full:s=!1,defaultValue:a,onChange:u,autoFocus:i,onFocus:l,onBlur:m}){let{error:d}=(0,ii.useField)(e);return(0,Ae.jsxs)(li.Container.Vertical,{full:s,children:[t&&(0,Ae.jsx)(so.Typography,{testID:"label",children:t}),ai.Platform.OS==="web"?(0,Ae.jsx)(ri,{disabled:o,options:r,name:e,placeholder:n,onChange:u,autoFocus:i,onFocus:l,onBlur:m}):(0,Ae.jsx)(jn,{name:e,disabled:o,options:r,defaultValue:a,placeholder:n,onChange:u,autoFocus:i,onFocus:l,onBlur:m}),d&&(0,Ae.jsx)(so.Typography,{color:"DANGER",size:"SM",testID:"error",children:d})]})}var di=require("@mobilestock-native/typography");var ui=require("@unform/core"),Y=require("react");var pi=require("react/jsx-runtime"),mi=(0,Y.createContext)(void 0);function ci(e){let{notifyFieldChange:t,loading:o}=M(),{fieldName:r,registerField:n,error:s,defaultValue:a}=(0,ui.useField)(e.name),[u,i]=(0,Y.useState)(()=>{var E;return(E=e.defaultValue)!=null?E:!!a}),{onChange:l,defaultValue:m,label:d,labelPosition:c,checkedColor:h,backgroundColor:S,handleColor:R,size:P,icons:b}=e,C=e.disabled||o,y=(0,Y.useCallback)((E,p=!0)=>{i(E),t==null||t(r,E),p&&(l==null||l({value:E,event:"EDIT"}))},[t,r,l]);(0,Y.useEffect)(()=>{n({name:r,getValue:()=>u,setValue:(E,p)=>y(!!p),clearValue:()=>y(!1)})},[r,u,n,y]),(0,Y.useEffect)(()=>{let E=m!=null?m:!!a;y(E,!1)},[m,y,a]);let T=(0,Y.useCallback)(()=>{C||i(E=>{let p=!E;return t==null||t(r,p),l==null||l({value:p,event:"TOGGLE"}),p})},[C,r,t,l]),f=(0,Y.useMemo)(()=>({checked:u,toggle:T,configureChecked:y,error:s,label:d,labelPosition:c,disabled:C,checkedColor:h,backgroundColor:S,handleColor:R,size:P,icons:b}),[u,T,y,s,d,c,C,h,S,R,P,b]);return(0,pi.jsx)(mi.Provider,{value:f,children:e.children})}function Ue(){let e=(0,Y.useContext)(mi);if(!e)throw new Error("useSwitch must be used within a SwitchProvider");return e}var fi=require("react/jsx-runtime");function zt({children:e}){let{error:t}=Ue(),o=e!=null?e:t;return o?(0,fi.jsx)(di.Typography,{color:"DANGER_600",size:"SM",weight:"MEDIUM",children:o}):null}var gi=require("@mobilestock-native/typography");var hi=require("react/jsx-runtime");function Xe(o){var r=o,{children:e}=r,t=O(r,["children"]);return(0,hi.jsx)(gi.Typography,x(v({weight:"REGULAR"},t),{children:e}))}var mo=require("@mobilestock-native/container");var Ke=require("@mobilestock-native/container");var Ei=require("react-native"),ut=N(require("styled-components/native"));var Ti=require("react"),Pe=N(require("react-native-reanimated")),kt=N(require("styled-components/native")),bi=require("@mobilestock-native/icons"),Ci=N(require("@mobilestock-native/tools"));var uo=require("react/jsx-runtime");function vi({checked:e,translate:t,handle:o,offset:r,iconSize:n,handleColor:s,currentIcon:a}){let u=(0,kt.useTheme)(),i=z.resolveColor(s,u,"handle"),l=(0,Pe.useSharedValue)(e?t:0);(0,Ti.useEffect)(()=>{l.value=(0,Pe.withTiming)(e?t:0,{duration:dr})},[e,t,l]);let m=(0,Pe.useAnimatedStyle)(()=>({transform:[{translateX:l.value}]}));return(0,uo.jsx)(Ca,{style:v({cursor:"pointer"},m),$handle:o,$offset:r,$handleColor:i,children:a&&(0,uo.jsx)(bi.Icon,{name:a,color:Ci.default.defineTextColor(i),size:"XS",style:{width:n,height:n}})})}var Ca=(0,kt.default)(Pe.default.View)`
104
+ position: absolute;
105
+ left: ${({$offset:e})=>e}px;
106
+ width: ${({$handle:e})=>e}px;
107
+ height: ${({$handle:e})=>e}px;
108
+ border-radius: ${({$handle:e})=>e/2}px;
109
+ background-color: ${({$handleColor:e})=>e};
110
+ align-items: center;
111
+ justify-content: center;
112
+ `;var st=require("react/jsx-runtime");function We(){let e=(0,ut.useTheme)(),{checked:t,toggle:o,disabled:r,checkedColor:n,backgroundColor:s,handleColor:a,size:u,icons:i,error:l}=Ue(),m=(u!=null?u:"MD").toLowerCase(),d=z.buildDimensions(e.sizeSwitch[m]),c=t?i==null?void 0:i.on:i==null?void 0:i.off,h=z.resolveSliderColor(t,n,s,!!l,e);return(0,st.jsx)(Ei.Pressable,{onPress:o,accessibilityRole:"switch",accessibilityState:{checked:t,disabled:r},children:(0,st.jsx)(va,{$disabled:r,$width:d.width,$height:d.height,children:(0,st.jsx)(Ea,{$height:d.height,$color:h,children:(0,st.jsx)(vi,{checked:t,translate:d.translate,handle:d.handle,offset:d.offset,iconSize:d.iconSize,handleColor:a,currentIcon:c})})})})}var va=ut.default.View`
113
+ opacity: ${({$disabled:e})=>e?.5:1};
114
+ width: ${({$width:e})=>e}px;
115
+ height: ${({$height:e})=>e}px;
116
+ border: 1px solid ${({theme:e})=>e.colors.input.border};
117
+ border-radius: ${({$height:e})=>e}px;
118
+ `,Ea=ut.default.View`
119
+ flex: 1;
120
+ border-radius: ${({$height:e})=>e}px;
121
+ background-color: ${({$color:e})=>e};
122
+ justify-content: center;
123
+ `;var U=require("react/jsx-runtime");function Si({position:e,label:t,align:o}){return e==="LEFT"?(0,U.jsxs)(Ke.Container.Horizontal,{align:"CENTER",gap:"SM",children:[t&&(0,U.jsx)(Ke.Container.Vertical,{padding:"NONE_2XS_NONE_NONE",children:(0,U.jsx)(Xe,{children:t})}),(0,U.jsx)(We,{})]}):e==="RIGHT"?(0,U.jsxs)(Ke.Container.Horizontal,{align:"CENTER",gap:"SM",children:[(0,U.jsx)(We,{}),t&&(0,U.jsx)(Ke.Container.Vertical,{padding:"NONE_NONE_NONE_2XS",children:(0,U.jsx)(Xe,{children:t})})]}):(0,U.jsxs)(U.Fragment,{children:[t&&(0,U.jsx)(Ke.Container.Vertical,{align:o||"CENTER_START",padding:"NONE_NONE_2XS_NONE",children:(0,U.jsx)(Xe,{children:t})}),(0,U.jsx)(We,{})]})}var qe=require("react/jsx-runtime"),yi=(r=>(r.TOP_START="CENTER_START",r.TOP_CENTER="CENTER",r.TOP_END="CENTER_END",r))(yi||{});function Pi(){let{label:e,labelPosition:t,error:o}=Ue(),r=t!=null?t:"TOP_START",s=r.startsWith("TOP")?yi[r]:void 0;return(0,qe.jsxs)(mo.Container.Vertical,{align:s,children:[(0,qe.jsx)(Si,{position:r,label:e,align:s}),o&&(0,qe.jsx)(mo.Container.Vertical,{align:s,padding:"2XS_NONE_NONE_NONE",children:(0,qe.jsx)(zt,{children:o})})]})}var co=require("react/jsx-runtime");function Ri(o){var r=o,{children:e}=r,t=O(r,["children"]);return(0,co.jsx)(ci,x(v({labelPosition:"TOP_START",size:"MD"},t),{children:e!=null?e:(0,co.jsx)(Pi,{})}))}var xi=Object.assign(Ri,{Toggle:We,Label:Xe,Error:zt});var wi=require("@mobilestock-native/container");var Ii=require("react/jsx-runtime");function Fi(o){var r=o,{children:e}=r,t=O(r,["children"]);return(0,Ii.jsx)(wi.Container.Vertical,x(v({gap:"SM"},t),{children:e}))}var Sa=Object.assign(Ro,{Input:pr,Button:wo,Select:si,Counter:ar,Switch:xi,Vertical:Fi,MultipleArchive:Zr,PhotoList:Mn,Horizontal:sr});0&&(module.exports={Form,useForm});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilestock-native/form",
3
- "version": "1.0.4",
3
+ "version": "1.2.0",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "lodash": "^4.17.14",
@@ -13,15 +13,15 @@
13
13
  "expo-media-library": "~18.2.0",
14
14
  "expo-document-picker": "~14.0.7",
15
15
  "expo-image-picker": "~17.0.8",
16
- "@mobilestock-native/button": "^1.0.15",
17
- "@mobilestock-native/badge": "^0.0.7",
16
+ "@mobilestock-native/button": "^1.0.16",
18
17
  "@mobilestock-native/container": "^1.0.0",
19
- "@mobilestock-native/icons": "^0.1.0",
20
- "@mobilestock-native/modalalert": "^0.0.17",
18
+ "@mobilestock-native/badge": "^0.0.7",
19
+ "@mobilestock-native/icons": "^0.2.0",
20
+ "@mobilestock-native/modalalert": "^0.0.18",
21
21
  "@mobilestock-native/tools": "^0.0.10",
22
22
  "@mobilestock-native/typography": "^0.0.9",
23
- "@mobilestock-native/list": "^0.0.12",
24
- "@mobilestock-native/clickable": "^1.0.9",
23
+ "@mobilestock-native/clickable": "^1.0.10",
24
+ "@mobilestock-native/list": "^0.0.13",
25
25
  "@mobilestock-native/spacer": "^0.0.6"
26
26
  },
27
27
  "devDependencies": {