@gustavo-valsechi/client 1.4.357 → 1.4.359

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.
@@ -93,7 +93,10 @@ function Form(props) {
93
93
  const values = getValues();
94
94
  if (!Object.keys(defaultValues).length) {
95
95
  const modalContainer = document.getElementById("modal-context-container");
96
- import_lodash.default.forEach(props.inputs, (data) => defaultValues[data.name] = "");
96
+ import_lodash.default.forEach(props.inputs, (data) => {
97
+ if (import_lodash.default.isArray(data)) return import_lodash.default.forEach(data, (input) => defaultValues[input.name] = "");
98
+ defaultValues[data.name] = "";
99
+ });
97
100
  setTimeout(() => reset({ ...defaultValues, ...values }, { keepErrors: false }), ((_a = modalContainer == null ? void 0 : modalContainer.contains) == null ? void 0 : _a.call(modalContainer, formRef.current)) ? 300 : 0);
98
101
  return;
99
102
  }
@@ -115,7 +118,7 @@ function Form(props) {
115
118
  reset(defaultValues, { keepErrors: false });
116
119
  }, [props.defaultValues, props.inputs, props.clearWhen]);
117
120
  const component = (data) => {
118
- var _a;
121
+ var _a, _b, _c, _d;
119
122
  let inputType = "";
120
123
  inputType = import_lodash.default.upperFirst(import_lodash.default.camelCase(data.type));
121
124
  inputType = import_lodash.default.includes(inputType, "Input") ? inputType : `Input${inputType}`;
@@ -132,7 +135,8 @@ function Form(props) {
132
135
  setValue,
133
136
  getValues,
134
137
  setError,
135
- watch
138
+ watch,
139
+ optional: !!((_d = (_c = (_b = data.validation) == null ? void 0 : _b.safeParse) == null ? void 0 : _c.call(_b, void 0)) == null ? void 0 : _d.success)
136
140
  }
137
141
  );
138
142
  };
@@ -142,12 +146,24 @@ function Form(props) {
142
146
  await props.onSubmit(data);
143
147
  setSubmitting(false);
144
148
  };
149
+ const setFlexWidth = (inputs, input) => {
150
+ if (import_lodash.default.some(inputs, (data) => !data.maxLength)) return 1;
151
+ const minLength = import_lodash.default.min(import_lodash.default.map(inputs, (data) => data.maxLength));
152
+ return input.maxLength / minLength;
153
+ };
145
154
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { ref: formRef, onSubmit: handleSubmit(onSubmit), children: [
146
155
  import_lodash.default.map(
147
156
  props.inputs,
148
157
  (data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, { children: import_lodash.default.isArray(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "form-content", children: import_lodash.default.map(
149
158
  data,
150
- (input, index2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "form-input", children: component(input) }, index2)
159
+ (input, index2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
160
+ import_styles.FormInput,
161
+ {
162
+ flex: setFlexWidth(data, input),
163
+ children: component(input)
164
+ },
165
+ index2
166
+ )
151
167
  ) }) : component(data) }, index)
152
168
  ),
153
169
  import_lodash.default.isArray(props.buttons) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "form-buttons", children: import_lodash.default.map(
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import React, { useEffect, useRef, useState } from "react";
5
- import { Container } from "./styles";
5
+ import { Container, FormInput } from "./styles";
6
6
  import { z } from "zod";
7
7
  import { useForm } from "react-hook-form";
8
8
  import { zodResolver } from "@hookform/resolvers/zod";
@@ -59,7 +59,10 @@ function Form(props) {
59
59
  const values = getValues();
60
60
  if (!Object.keys(defaultValues).length) {
61
61
  const modalContainer = document.getElementById("modal-context-container");
62
- _.forEach(props.inputs, (data) => defaultValues[data.name] = "");
62
+ _.forEach(props.inputs, (data) => {
63
+ if (_.isArray(data)) return _.forEach(data, (input) => defaultValues[input.name] = "");
64
+ defaultValues[data.name] = "";
65
+ });
63
66
  setTimeout(() => reset({ ...defaultValues, ...values }, { keepErrors: false }), ((_a = modalContainer == null ? void 0 : modalContainer.contains) == null ? void 0 : _a.call(modalContainer, formRef.current)) ? 300 : 0);
64
67
  return;
65
68
  }
@@ -81,7 +84,7 @@ function Form(props) {
81
84
  reset(defaultValues, { keepErrors: false });
82
85
  }, [props.defaultValues, props.inputs, props.clearWhen]);
83
86
  const component = (data) => {
84
- var _a;
87
+ var _a, _b, _c, _d;
85
88
  let inputType = "";
86
89
  inputType = _.upperFirst(_.camelCase(data.type));
87
90
  inputType = _.includes(inputType, "Input") ? inputType : `Input${inputType}`;
@@ -98,7 +101,8 @@ function Form(props) {
98
101
  setValue,
99
102
  getValues,
100
103
  setError,
101
- watch
104
+ watch,
105
+ optional: !!((_d = (_c = (_b = data.validation) == null ? void 0 : _b.safeParse) == null ? void 0 : _c.call(_b, void 0)) == null ? void 0 : _d.success)
102
106
  }
103
107
  );
104
108
  };
@@ -108,12 +112,24 @@ function Form(props) {
108
112
  await props.onSubmit(data);
109
113
  setSubmitting(false);
110
114
  };
115
+ const setFlexWidth = (inputs, input) => {
116
+ if (_.some(inputs, (data) => !data.maxLength)) return 1;
117
+ const minLength = _.min(_.map(inputs, (data) => data.maxLength));
118
+ return input.maxLength / minLength;
119
+ };
111
120
  return /* @__PURE__ */ jsxs(Container, { ref: formRef, onSubmit: handleSubmit(onSubmit), children: [
112
121
  _.map(
113
122
  props.inputs,
114
123
  (data, index) => /* @__PURE__ */ jsx(React.Fragment, { children: _.isArray(data) ? /* @__PURE__ */ jsx("div", { className: "form-content", children: _.map(
115
124
  data,
116
- (input, index2) => /* @__PURE__ */ jsx("div", { className: "form-input", children: component(input) }, index2)
125
+ (input, index2) => /* @__PURE__ */ jsx(
126
+ FormInput,
127
+ {
128
+ flex: setFlexWidth(data, input),
129
+ children: component(input)
130
+ },
131
+ index2
132
+ )
117
133
  ) }) : component(data) }, index)
118
134
  ),
119
135
  _.isArray(props.buttons) && /* @__PURE__ */ jsx("div", { className: "form-buttons", children: _.map(
@@ -1 +1,2 @@
1
1
  export declare const Container: any;
2
+ export declare const FormInput: any;
@@ -30,7 +30,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
  var styles_exports = {};
32
32
  __export(styles_exports, {
33
- Container: () => Container
33
+ Container: () => Container,
34
+ FormInput: () => FormInput
34
35
  });
35
36
  module.exports = __toCommonJS(styles_exports);
36
37
  var import_styled_components = __toESM(require("styled-components"));
@@ -45,10 +46,6 @@ const Container = import_styled_components.default.form`
45
46
  display: flex;
46
47
  gap: .5rem;
47
48
  flex-wrap: wrap;
48
-
49
- .form-input {
50
- flex: 1 1 10rem;
51
- }
52
49
  }
53
50
 
54
51
  .form-buttons {
@@ -61,7 +58,11 @@ const Container = import_styled_components.default.form`
61
58
  }
62
59
  }
63
60
  `;
61
+ const FormInput = import_styled_components.default.div`
62
+ flex: ${({ flex }) => flex} 1 8rem;
63
+ `;
64
64
  // Annotate the CommonJS export names for ESM import in node:
65
65
  0 && (module.exports = {
66
- Container
66
+ Container,
67
+ FormInput
67
68
  });
@@ -12,10 +12,6 @@ const Container = styled.form`
12
12
  display: flex;
13
13
  gap: .5rem;
14
14
  flex-wrap: wrap;
15
-
16
- .form-input {
17
- flex: 1 1 10rem;
18
- }
19
15
  }
20
16
 
21
17
  .form-buttons {
@@ -28,6 +24,10 @@ const Container = styled.form`
28
24
  }
29
25
  }
30
26
  `;
27
+ const FormInput = styled.div`
28
+ flex: ${({ flex }) => flex} 1 8rem;
29
+ `;
31
30
  export {
32
- Container
31
+ Container,
32
+ FormInput
33
33
  };
@@ -41,6 +41,8 @@ var import_error = require("../error");
41
41
  var import_contexts = require("../../../../../contexts");
42
42
  var import_lodash = __toESM(require("lodash"));
43
43
  var import_options = __toESM(require("./options"));
44
+ var import_option = __toESM(require("./options/option"));
45
+ var import_utils = __toESM(require("@gustavo-valsechi/utils"));
44
46
  function InputSelect(props) {
45
47
  var _a, _b;
46
48
  const containerRef = (0, import_react.useRef)(null);
@@ -50,7 +52,7 @@ function InputSelect(props) {
50
52
  const [filter, setFilter] = (0, import_react.useState)("");
51
53
  const register = (props.register || ((name) => ({})))(props.name || "");
52
54
  const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
53
- const value = ((_b = props.options) == null ? void 0 : _b[inputValue]) || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-label-value-placeholder", children: "selecione" });
55
+ const inputLabel = (0, import_option.default)({ content: (_b = props.options) == null ? void 0 : _b[inputValue] }) || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-label-value-placeholder", children: "selecione" });
54
56
  (0, import_react.useEffect)(() => {
55
57
  var _a2;
56
58
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -81,13 +83,13 @@ function InputSelect(props) {
81
83
  if (register.onFocus) register.onFocus(event);
82
84
  };
83
85
  const onChange = (event) => {
84
- const value2 = event.target.value || "";
85
- setFilter(value2);
86
- if (props.onFilter) props.onFilter(value2);
86
+ const value = event.target.value || "";
87
+ setFilter(value);
88
+ if (props.onFilter) props.onFilter(value);
87
89
  if (register.onChange) register.onChange(event);
88
90
  const optionsElement = document.getElementById(`input[${props.name}-options]`);
89
91
  if (!optionsElement) return;
90
- optionsElement.setAttribute("value", value2);
92
+ optionsElement.setAttribute("value", value);
91
93
  };
92
94
  const onClick = (event) => {
93
95
  inputRef.current.focus();
@@ -115,7 +117,7 @@ function InputSelect(props) {
115
117
  type: "text",
116
118
  maxLength: props.maxLength || 255,
117
119
  value: focus ? filter : inputValue,
118
- placeholder: import_lodash.default.isString(value) ? value : (value == null ? void 0 : value.textContent) || "",
120
+ placeholder: import_lodash.default.isString(inputLabel) ? inputLabel : import_utils.default.format.textIntoElement(inputLabel) || "",
119
121
  ...register,
120
122
  ref: inputRef,
121
123
  onBlur,
@@ -128,9 +130,9 @@ function InputSelect(props) {
128
130
  "div",
129
131
  {
130
132
  className: "input-label-value",
131
- "data-string": import_lodash.default.isString(value),
133
+ "data-string": import_lodash.default.isString(inputLabel),
132
134
  onClick: () => inputRef.current.click(),
133
- children: value
135
+ children: inputLabel
134
136
  }
135
137
  ),
136
138
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -7,7 +7,9 @@ import { InputLabel } from "../label";
7
7
  import { InputError } from "../error";
8
8
  import { useTarget } from "../../../../../contexts";
9
9
  import _ from "lodash";
10
- import InputSelectOption from "./options";
10
+ import InputSelectOptions from "./options";
11
+ import InputSelectOption from "./options/option";
12
+ import Utils from "@gustavo-valsechi/utils";
11
13
  function InputSelect(props) {
12
14
  var _a, _b;
13
15
  const containerRef = useRef(null);
@@ -17,14 +19,14 @@ function InputSelect(props) {
17
19
  const [filter, setFilter] = useState("");
18
20
  const register = (props.register || ((name) => ({})))(props.name || "");
19
21
  const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
20
- const value = ((_b = props.options) == null ? void 0 : _b[inputValue]) || /* @__PURE__ */ jsx("div", { className: "input-label-value-placeholder", children: "selecione" });
22
+ const inputLabel = InputSelectOption({ content: (_b = props.options) == null ? void 0 : _b[inputValue] }) || /* @__PURE__ */ jsx("div", { className: "input-label-value-placeholder", children: "selecione" });
21
23
  useEffect(() => {
22
24
  var _a2;
23
25
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
24
26
  target.save({
25
27
  ref: inputRef,
26
28
  component: /* @__PURE__ */ jsx(
27
- InputSelectOption,
29
+ InputSelectOptions,
28
30
  {
29
31
  ...props,
30
32
  inputRef,
@@ -48,13 +50,13 @@ function InputSelect(props) {
48
50
  if (register.onFocus) register.onFocus(event);
49
51
  };
50
52
  const onChange = (event) => {
51
- const value2 = event.target.value || "";
52
- setFilter(value2);
53
- if (props.onFilter) props.onFilter(value2);
53
+ const value = event.target.value || "";
54
+ setFilter(value);
55
+ if (props.onFilter) props.onFilter(value);
54
56
  if (register.onChange) register.onChange(event);
55
57
  const optionsElement = document.getElementById(`input[${props.name}-options]`);
56
58
  if (!optionsElement) return;
57
- optionsElement.setAttribute("value", value2);
59
+ optionsElement.setAttribute("value", value);
58
60
  };
59
61
  const onClick = (event) => {
60
62
  inputRef.current.focus();
@@ -82,7 +84,7 @@ function InputSelect(props) {
82
84
  type: "text",
83
85
  maxLength: props.maxLength || 255,
84
86
  value: focus ? filter : inputValue,
85
- placeholder: _.isString(value) ? value : (value == null ? void 0 : value.textContent) || "",
87
+ placeholder: _.isString(inputLabel) ? inputLabel : Utils.format.textIntoElement(inputLabel) || "",
86
88
  ...register,
87
89
  ref: inputRef,
88
90
  onBlur,
@@ -95,9 +97,9 @@ function InputSelect(props) {
95
97
  "div",
96
98
  {
97
99
  className: "input-label-value",
98
- "data-string": _.isString(value),
100
+ "data-string": _.isString(inputLabel),
99
101
  onClick: () => inputRef.current.click(),
100
- children: value
102
+ children: inputLabel
101
103
  }
102
104
  ),
103
105
  /* @__PURE__ */ jsxs(
@@ -1,5 +1,5 @@
1
1
  import { IInputSelect } from "../../../../../../interfaces";
2
- export default function InputSelectOption(props: IInputSelect & {
2
+ export default function InputSelectOptions(props: IInputSelect & {
3
3
  inputRef: any;
4
4
  width: number;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
  var options_exports = {};
32
32
  __export(options_exports, {
33
- default: () => InputSelectOption
33
+ default: () => InputSelectOptions
34
34
  });
35
35
  module.exports = __toCommonJS(options_exports);
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -39,7 +39,8 @@ var import_styles = require("./styles");
39
39
  var import_contexts = require("../../../../../../contexts");
40
40
  var import_utils = __toESM(require("@gustavo-valsechi/utils"));
41
41
  var import_lodash = __toESM(require("lodash"));
42
- function InputSelectOption(props) {
42
+ var import_option = __toESM(require("./option"));
43
+ function InputSelectOptions(props) {
43
44
  const theme = (0, import_contexts.useTheme)();
44
45
  const target = (0, import_contexts.useTarget)();
45
46
  const [options, setOptions] = (0, import_react.useState)(props.options);
@@ -54,7 +55,8 @@ function InputSelectOption(props) {
54
55
  const filtredValues = import_lodash.default.filter(props.options, (value) => {
55
56
  const normalize = (text2) => import_lodash.default.deburr(text2 == null ? void 0 : text2.toLowerCase());
56
57
  if (import_lodash.default.isString(value)) return import_lodash.default.includes(normalize(value), normalize(filter));
57
- const text = import_utils.default.format.textIntoElement(value);
58
+ const text = import_utils.default.format.textIntoElement((0, import_option.default)({ content: value }));
59
+ console.log(text);
58
60
  return import_lodash.default.includes(normalize(text), normalize(filter));
59
61
  });
60
62
  const filtredOptions = {};
@@ -119,16 +121,16 @@ function InputSelectOption(props) {
119
121
  className: "input-option-content-mask",
120
122
  children: !Object.keys(options || {}).length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-option empty", children: "Nenhuma op\xE7\xE3o encontrada" }) : import_lodash.default.map(
121
123
  options,
122
- (value, key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
124
+ (data, value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
123
125
  "div",
124
126
  {
125
127
  className: "input-option",
126
- onClick: () => onSelect(key),
127
- "data-string": import_lodash.default.isString(value),
128
- "data-selected": key === props.value,
129
- children: value || ""
128
+ onClick: () => onSelect(value),
129
+ "data-string": import_lodash.default.isString(data),
130
+ "data-selected": value === props.value,
131
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_option.default, { content: data })
130
132
  },
131
- key
133
+ value
132
134
  )
133
135
  )
134
136
  }
@@ -6,7 +6,8 @@ import { Container } from "./styles";
6
6
  import { useTarget, useTheme } from "../../../../../../contexts";
7
7
  import Utils from "@gustavo-valsechi/utils";
8
8
  import _ from "lodash";
9
- function InputSelectOption(props) {
9
+ import InputSelectOption from "./option";
10
+ function InputSelectOptions(props) {
10
11
  const theme = useTheme();
11
12
  const target = useTarget();
12
13
  const [options, setOptions] = useState(props.options);
@@ -21,7 +22,8 @@ function InputSelectOption(props) {
21
22
  const filtredValues = _.filter(props.options, (value) => {
22
23
  const normalize = (text2) => _.deburr(text2 == null ? void 0 : text2.toLowerCase());
23
24
  if (_.isString(value)) return _.includes(normalize(value), normalize(filter));
24
- const text = Utils.format.textIntoElement(value);
25
+ const text = Utils.format.textIntoElement(InputSelectOption({ content: value }));
26
+ console.log(text);
25
27
  return _.includes(normalize(text), normalize(filter));
26
28
  });
27
29
  const filtredOptions = {};
@@ -86,16 +88,16 @@ function InputSelectOption(props) {
86
88
  className: "input-option-content-mask",
87
89
  children: !Object.keys(options || {}).length ? /* @__PURE__ */ jsx("div", { className: "input-option empty", children: "Nenhuma op\xE7\xE3o encontrada" }) : _.map(
88
90
  options,
89
- (value, key) => /* @__PURE__ */ jsx(
91
+ (data, value) => /* @__PURE__ */ jsx(
90
92
  "div",
91
93
  {
92
94
  className: "input-option",
93
- onClick: () => onSelect(key),
94
- "data-string": _.isString(value),
95
- "data-selected": key === props.value,
96
- children: value || ""
95
+ onClick: () => onSelect(value),
96
+ "data-string": _.isString(data),
97
+ "data-selected": value === props.value,
98
+ children: /* @__PURE__ */ jsx(InputSelectOption, { content: data })
97
99
  },
98
- key
100
+ value
99
101
  )
100
102
  )
101
103
  }
@@ -107,5 +109,5 @@ function InputSelectOption(props) {
107
109
  );
108
110
  }
109
111
  export {
110
- InputSelectOption as default
112
+ InputSelectOptions as default
111
113
  };
@@ -0,0 +1,3 @@
1
+ export default function InputSelectOption(props: {
2
+ content: any;
3
+ }): import("react/jsx-runtime").JSX.Element | "";
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ var option_exports = {};
32
+ __export(option_exports, {
33
+ default: () => InputSelectOption
34
+ });
35
+ module.exports = __toCommonJS(option_exports);
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_styles = require("./styles");
38
+ var import_lodash = __toESM(require("lodash"));
39
+ function InputSelectOption(props) {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h;
41
+ if (import_lodash.default.isArray(props.content)) return "";
42
+ if (!!((_a = props.content) == null ? void 0 : _a.icon) || !!((_b = props.content) == null ? void 0 : _b.flag)) {
43
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { color: (_c = props.content) == null ? void 0 : _c.color, flag: (_d = props.content) == null ? void 0 : _d.flag, children: [
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "select-option-identifier", children: [
45
+ !!((_e = props.content) == null ? void 0 : _e.icon) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: (_f = props.content) == null ? void 0 : _f.icon }),
46
+ !!((_g = props.content) == null ? void 0 : _g.flag) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "select-option-flag" })
47
+ ] }),
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (_h = props.content) == null ? void 0 : _h.label })
49
+ ] });
50
+ }
51
+ return props.content || "";
52
+ }
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ "use client";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Container } from "./styles";
5
+ import _ from "lodash";
6
+ function InputSelectOption(props) {
7
+ var _a, _b, _c, _d, _e, _f, _g, _h;
8
+ if (_.isArray(props.content)) return "";
9
+ if (!!((_a = props.content) == null ? void 0 : _a.icon) || !!((_b = props.content) == null ? void 0 : _b.flag)) {
10
+ return /* @__PURE__ */ jsxs(Container, { color: (_c = props.content) == null ? void 0 : _c.color, flag: (_d = props.content) == null ? void 0 : _d.flag, children: [
11
+ /* @__PURE__ */ jsxs("div", { className: "select-option-identifier", children: [
12
+ !!((_e = props.content) == null ? void 0 : _e.icon) && /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: (_f = props.content) == null ? void 0 : _f.icon }),
13
+ !!((_g = props.content) == null ? void 0 : _g.flag) && /* @__PURE__ */ jsx("div", { className: "select-option-flag" })
14
+ ] }),
15
+ /* @__PURE__ */ jsx("span", { children: (_h = props.content) == null ? void 0 : _h.label })
16
+ ] });
17
+ }
18
+ return props.content || "";
19
+ }
20
+ export {
21
+ InputSelectOption as default
22
+ };
@@ -0,0 +1 @@
1
+ export declare const Container: any;
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ var styles_exports = {};
32
+ __export(styles_exports, {
33
+ Container: () => Container
34
+ });
35
+ module.exports = __toCommonJS(styles_exports);
36
+ var import_styled_components = __toESM(require("styled-components"));
37
+ const Container = import_styled_components.default.div`
38
+ display: flex;
39
+ align-items: center;
40
+ gap: .5rem;
41
+ margin-left: -0.5rem;
42
+
43
+ .select-option-identifier {
44
+ width: 1.3rem;
45
+ height: 1.3rem;
46
+ border-radius: 5px;
47
+ background: ${(props) => props.theme.t05};
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+
52
+ i {
53
+ font-size: .7rem;
54
+ color: ${(props) => props.theme[props.color || ""] || props.theme.t6};
55
+ }
56
+
57
+ .select-option-flag {
58
+ width: .8rem;
59
+ height: .8rem;
60
+ background-image: url(${(props) => props.flag});
61
+ background-size: contain;
62
+ background-repeat: no-repeat;
63
+ background-position: center;
64
+ }
65
+ }
66
+
67
+ span {
68
+ font-size: .75rem;
69
+ font-weight: 500;
70
+ color: ${(props) => props.theme[props.color || ""] || props.theme.t6};
71
+ }
72
+ `;
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ Container
76
+ });
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ "use client";
3
+ import styled from "styled-components";
4
+ const Container = styled.div`
5
+ display: flex;
6
+ align-items: center;
7
+ gap: .5rem;
8
+ margin-left: -0.5rem;
9
+
10
+ .select-option-identifier {
11
+ width: 1.3rem;
12
+ height: 1.3rem;
13
+ border-radius: 5px;
14
+ background: ${(props) => props.theme.t05};
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+
19
+ i {
20
+ font-size: .7rem;
21
+ color: ${(props) => props.theme[props.color || ""] || props.theme.t6};
22
+ }
23
+
24
+ .select-option-flag {
25
+ width: .8rem;
26
+ height: .8rem;
27
+ background-image: url(${(props) => props.flag});
28
+ background-size: contain;
29
+ background-repeat: no-repeat;
30
+ background-position: center;
31
+ }
32
+ }
33
+
34
+ span {
35
+ font-size: .75rem;
36
+ font-weight: 500;
37
+ color: ${(props) => props.theme[props.color || ""] || props.theme.t6};
38
+ }
39
+ `;
40
+ export {
41
+ Container
42
+ };
@@ -17,7 +17,7 @@ export interface IForm {
17
17
  formRef?: any;
18
18
  onSubmit: (values: any, actions?: any) => void;
19
19
  clearWhen?: boolean;
20
- inputs: Array<IFormInput>;
20
+ inputs: Array<IFormInput | Array<IFormInput>>;
21
21
  buttons?: Array<IButton>;
22
22
  }
23
23
  export interface IInputBase {
@@ -29,6 +29,7 @@ export interface IInputBase {
29
29
  error?: string;
30
30
  disabled?: boolean;
31
31
  optional?: boolean;
32
+ maxLength?: number;
32
33
  register?: UseFormRegister<any>;
33
34
  validation?: z.ZodTypeAny;
34
35
  watch?: (...args: any[]) => string;
@@ -7,5 +7,4 @@ export interface IInputSelect extends IInputBase {
7
7
  } & {
8
8
  length?: never;
9
9
  };
10
- maxLength?: number;
11
10
  }
@@ -2,5 +2,4 @@ import { IInputBase } from "../index";
2
2
  export interface IInputText extends IInputBase {
3
3
  type: "text" | "password" | undefined;
4
4
  mask?: (value: string) => void;
5
- maxLength?: number;
6
5
  }
@@ -2,6 +2,5 @@ import { IInputBase } from "../index";
2
2
  export interface IInputTextarea extends IInputBase {
3
3
  type: "textarea";
4
4
  mask?: (value: string) => void;
5
- maxLength?: number;
6
5
  rows?: number;
7
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.357",
3
+ "version": "1.4.359",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@emotion/react": "11.14.0",
29
29
  "@emotion/styled": "11.14.1",
30
30
  "@gustavo-valsechi/server": "1.0.13",
31
- "@gustavo-valsechi/utils": "1.0.17",
31
+ "@gustavo-valsechi/utils": "1.0.19",
32
32
  "@hookform/resolvers": "5.2.2",
33
33
  "@mui/material": "7.3.7",
34
34
  "@mui/x-date-pickers": "8.24.0",