@consumidor-positivo/aurora 0.0.61 → 0.0.63

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 (41) hide show
  1. package/dist/components/Calendar/index.es.js +2 -2
  2. package/dist/components/CalendarHeader/index.es.js +2 -2
  3. package/dist/components/CheckboxField/index.es.js +1 -1
  4. package/dist/components/Datepicker/index.es.js +3 -3
  5. package/dist/components/Field/index.es.js +26 -83
  6. package/dist/components/Field/index.es.js.map +1 -1
  7. package/dist/components/Field/styles.css +1 -1
  8. package/dist/components/Group/index.es.js +58 -0
  9. package/dist/components/Group/index.es.js.map +1 -0
  10. package/dist/components/Group/styles.css +1 -0
  11. package/dist/components/InputField/index.es.js +1 -1
  12. package/dist/components/PasswordField/index.es.js +1 -1
  13. package/dist/components/PortalHolder/index.es.js +1 -1
  14. package/dist/components/Radio/index.es.js +14 -0
  15. package/dist/components/Radio/index.es.js.map +1 -0
  16. package/dist/components/Segment/index.es.js +1 -1
  17. package/dist/components/SelectField/index.es.js +123 -39
  18. package/dist/components/SelectField/index.es.js.map +1 -1
  19. package/dist/components/SelectField/styles.css +1 -1
  20. package/dist/components/TokenField/index.es.js +1 -1
  21. package/dist/components/form/Radio/Field/index.d.ts +3 -0
  22. package/dist/components/form/Radio/Group/index.d.ts +3 -0
  23. package/dist/components/form/Radio/index.d.ts +8 -0
  24. package/dist/components/form/Radio/types.d.ts +19 -0
  25. package/dist/components/form/SelectField/hook.d.ts +11 -8
  26. package/dist/components/form/SelectField/index.d.ts +2 -22
  27. package/dist/components/form/SelectField/types.d.ts +23 -0
  28. package/dist/components/index/styles3.css +1 -1
  29. package/dist/components/index/styles4.css +1 -0
  30. package/dist/{index-CLq9qZyb.js → index-BnnDZOqb.js} +2 -2
  31. package/dist/{index-CLq9qZyb.js.map → index-BnnDZOqb.js.map} +1 -1
  32. package/dist/{index-CvHQPF4S.js → index-DhUJjrgP.js} +3 -3
  33. package/dist/{index-CvHQPF4S.js.map → index-DhUJjrgP.js.map} +1 -1
  34. package/dist/{index-DYVmC1NO.js → index-lcJ0CoDo.js} +3 -3
  35. package/dist/{index-DYVmC1NO.js.map → index-lcJ0CoDo.js.map} +1 -1
  36. package/dist/index-sLk4K3iM.js +92 -0
  37. package/dist/index-sLk4K3iM.js.map +1 -0
  38. package/dist/main.d.ts +1 -0
  39. package/dist/main.es.js +2 -0
  40. package/dist/main.es.js.map +1 -1
  41. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../index-CweZ_OcN.js";
3
- import "../../index-CvHQPF4S.js";
3
+ import "../../index-DhUJjrgP.js";
4
4
  import "../Button/index.es.js";
5
5
  import "../PortalHolder/index.es.js";
6
- import { a } from "../../index-DYVmC1NO.js";
6
+ import { a } from "../../index-lcJ0CoDo.js";
7
7
  export {
8
8
  a as DatepickerCalendar
9
9
  };
@@ -3,8 +3,8 @@ import "../../index-CweZ_OcN.js";
3
3
  import "../Icon/index.es.js";
4
4
  import "../icons/IconChevronLeft/index.es.js";
5
5
  import "../icons/IconChevronRight/index.es.js";
6
- import "../../index-CLq9qZyb.js";
7
- import { C } from "../../index-CvHQPF4S.js";
6
+ import "../../index-BnnDZOqb.js";
7
+ import { C } from "../../index-DhUJjrgP.js";
8
8
  export {
9
9
  C as CalendarHeader
10
10
  };
@@ -2,8 +2,8 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { c as classNames } from "../../index-CweZ_OcN.js";
3
3
  import "../Icon/index.es.js";
4
4
  import { IconCheck } from "../icons/IconCheck/index.es.js";
5
+ import { F as Field } from "../../index-sLk4K3iM.js";
5
6
  import { k as COLOR_NEUTRAL_00 } from "../../tokens-TYOJv1j5.js";
6
- import Field from "../Field/index.es.js";
7
7
  import './styles.css';const CheckboxField = ({
8
8
  label,
9
9
  error,
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { B as BREAKPOINT_MD, g as COLOR_NEUTRAL_40 } from "../../tokens-TYOJv1j5.js";
3
2
  import "../../index-CweZ_OcN.js";
4
3
  import "../Icon/index.es.js";
5
4
  import { IconCalendar } from "../icons/IconCalendar/index.es.js";
6
5
  import { InputField } from "../InputField/index.es.js";
7
- import { g as getDefaultDate, D as DDMMYYYY, a as DatepickerCalendar, A as AUCalendarDate } from "../../index-DYVmC1NO.js";
6
+ import { g as getDefaultDate, D as DDMMYYYY, a as DatepickerCalendar, A as AUCalendarDate } from "../../index-lcJ0CoDo.js";
8
7
  import { useRef, useState, useEffect } from "react";
9
- import { u as useOutsideClick } from "../../index-CLq9qZyb.js";
8
+ import { u as useOutsideClick } from "../../index-BnnDZOqb.js";
9
+ import { B as BREAKPOINT_MD, g as COLOR_NEUTRAL_40 } from "../../tokens-TYOJv1j5.js";
10
10
  import './styles.css';function useDatepicker({
11
11
  value,
12
12
  defaultValue = "empty",
@@ -1,92 +1,35 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { c as classNames } from "../../index-CweZ_OcN.js";
3
- import "../Icon/index.es.js";
4
- import { IconAlertCircle } from "../icons/IconAlertCircle/index.es.js";
5
- import { IconCheck } from "../icons/IconCheck/index.es.js";
6
- import { IconSlash } from "../icons/IconSlash/index.es.js";
7
- import { H as COLOR_SUCCESS_50, O as COLOR_ERROR_50, g as COLOR_NEUTRAL_40 } from "../../tokens-TYOJv1j5.js";
8
- import './styles.css';const FieldErrorMessage = ({ hasError, message }) => {
9
- if (!hasError || !message) return null;
10
- return /* @__PURE__ */ jsx("p", { className: "au-field__error-message", children: message });
11
- };
12
- const FieldInput = ({
13
- inputRef,
14
- customclass,
15
- ...props
16
- }) => {
17
- const inputClasses = classNames("au-field__input", customclass);
18
- return /* @__PURE__ */ jsx("input", { className: inputClasses, ref: inputRef, ...props });
19
- };
20
- const FieldInputHolder = ({
21
- children,
22
- rightSideSlot
23
- }) => {
24
- return /* @__PURE__ */ jsxs("div", { className: "au-field__input-holder", children: [
25
- children,
26
- rightSideSlot && /* @__PURE__ */ jsx("div", { className: "au-field__right-slot", children: rightSideSlot })
27
- ] });
28
- };
29
- const FieldLabel = ({
30
- id,
31
- text,
32
- required,
33
- optional,
34
- success,
3
+ import './styles.css';const RadioField = ({
4
+ type = "radio",
5
+ direction = "left",
6
+ label,
35
7
  error,
36
- disabled
37
- }) => {
38
- if (!text) return null;
39
- const states = [
40
- { state: "optional", value: !!optional, icon: /* @__PURE__ */ jsx("span", { children: "(Opcional)" }) },
41
- {
42
- state: "success",
43
- value: !!success,
44
- icon: /* @__PURE__ */ jsx(IconCheck, { rawColor: COLOR_SUCCESS_50 })
45
- },
46
- {
47
- state: "error",
48
- value: !!error,
49
- icon: /* @__PURE__ */ jsx(IconAlertCircle, { rawColor: COLOR_ERROR_50 })
50
- },
51
- {
52
- state: "disabled",
53
- value: !!disabled,
54
- icon: /* @__PURE__ */ jsx(IconSlash, { rawColor: COLOR_NEUTRAL_40 })
55
- }
56
- ];
57
- const currentState = states.find(({ value }) => !!value);
58
- return /* @__PURE__ */ jsxs("div", { className: "au-field__header", children: [
59
- /* @__PURE__ */ jsxs("label", { htmlFor: id, className: "au-field__header-label", children: [
60
- text,
61
- " ",
62
- required && /* @__PURE__ */ jsx("strong", { className: "au-field__header-label--required", children: "*" })
63
- ] }),
64
- /* @__PURE__ */ jsx("div", { className: "au-field__header-icon", children: currentState == null ? void 0 : currentState.icon })
65
- ] });
66
- };
67
- const FieldRoot = ({
68
- children,
8
+ id,
69
9
  disabled,
70
- success,
71
- error,
72
- style,
73
- customclass
10
+ ...props
74
11
  }) => {
75
- const inputClasses = classNames("au-field", customclass, {
76
- "au-field--disabled": !!disabled,
77
- "au-field--success": !!success,
78
- "au-field--error": !!error
12
+ const radioClasses = classNames("au-radio-field", {
13
+ "au-radio-field--left-direction": direction === "left",
14
+ "au-radio-field--right-direction": direction === "right",
15
+ "au-radio-field--disabled": !!disabled,
16
+ "au-radio-field--error": !!error
79
17
  });
80
- return /* @__PURE__ */ jsx("div", { className: inputClasses, style, children });
81
- };
82
- const Field = {
83
- Root: FieldRoot,
84
- Input: FieldInput,
85
- InputHolder: FieldInputHolder,
86
- Label: FieldLabel,
87
- ErrorMessage: FieldErrorMessage
18
+ return /* @__PURE__ */ jsxs("div", { className: radioClasses, children: [
19
+ /* @__PURE__ */ jsx(
20
+ "input",
21
+ {
22
+ className: "au-radio-field__input",
23
+ type,
24
+ id,
25
+ disabled,
26
+ ...props
27
+ }
28
+ ),
29
+ /* @__PURE__ */ jsx("label", { className: "au-radio-field__label", htmlFor: id, children: label })
30
+ ] });
88
31
  };
89
32
  export {
90
- Field as default
33
+ RadioField
91
34
  };
92
35
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Field/ErrorMessage.tsx","../../../lib/components/form/Field/Input.tsx","../../../lib/components/form/Field/InputHolder.tsx","../../../lib/components/form/Field/Label.tsx","../../../lib/components/form/Field/Root.tsx","../../../lib/components/form/Field/index.tsx"],"sourcesContent":["type ErrorMessageProps = {\n hasError?: boolean\n message?: string\n}\n\nexport const FieldErrorMessage = ({ hasError, message }: ErrorMessageProps) => {\n if (!hasError || !message) return null\n\n return <p className=\"au-field__error-message\">{message}</p>\n}\n","import classNames from 'classnames'\n\ntype FieldInputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n inputRef?: React.RefObject<HTMLInputElement>\n customclass?: string\n}\n\nexport const FieldInput = ({\n inputRef,\n customclass,\n ...props\n}: FieldInputProps) => {\n const inputClasses = classNames('au-field__input', customclass)\n\n return <input className={inputClasses} ref={inputRef} {...props} />\n}\n","import React from 'react'\n\ntype FieldInputHolderProps = {\n children?: React.ReactNode\n rightSideSlot?: React.ReactNode\n}\n\nexport const FieldInputHolder = ({\n children,\n rightSideSlot,\n}: FieldInputHolderProps) => {\n return (\n <div className=\"au-field__input-holder\">\n {children}\n {rightSideSlot && (\n <div className=\"au-field__right-slot\">{rightSideSlot}</div>\n )}\n </div>\n )\n}\n","import { IconAlertCircle, IconCheck, IconSlash } from '@components/icons'\nimport {\n COLOR_ERROR_50,\n COLOR_NEUTRAL_40,\n COLOR_SUCCESS_50,\n} from '@core/tokens'\n\ntype FieldLabelProps = {\n id?: string\n text?: string\n required?: boolean\n optional?: boolean\n success?: boolean\n error?: boolean\n disabled?: boolean\n}\n\nexport const FieldLabel = ({\n id,\n text,\n required,\n optional,\n success,\n error,\n disabled,\n}: FieldLabelProps) => {\n if (!text) return null\n\n const states = [\n { state: 'optional', value: !!optional, icon: <span>(Opcional)</span> },\n {\n state: 'success',\n value: !!success,\n icon: <IconCheck rawColor={COLOR_SUCCESS_50} />,\n },\n {\n state: 'error',\n value: !!error,\n icon: <IconAlertCircle rawColor={COLOR_ERROR_50} />,\n },\n {\n state: 'disabled',\n value: !!disabled,\n icon: <IconSlash rawColor={COLOR_NEUTRAL_40} />,\n },\n ]\n\n const currentState = states.find(({ value }) => !!value)\n\n return (\n <div className=\"au-field__header\">\n <label htmlFor={id} className=\"au-field__header-label\">\n {text}{' '}\n {required && (\n <strong className=\"au-field__header-label--required\">*</strong>\n )}\n </label>\n <div className=\"au-field__header-icon\">{currentState?.icon}</div>\n </div>\n )\n}\n","import classNames from 'classnames'\n\ntype FieldRootProps = {\n children: React.ReactNode\n disabled?: boolean\n success?: boolean\n error?: boolean\n style?: React.CSSProperties\n customclass?: string\n}\n\nexport const FieldRoot = ({\n children,\n disabled,\n success,\n error,\n style,\n customclass,\n}: FieldRootProps) => {\n const inputClasses = classNames('au-field', customclass, {\n 'au-field--disabled': !!disabled,\n 'au-field--success': !!success,\n 'au-field--error': !!error,\n })\n\n return (\n <div className={inputClasses} style={style}>\n {children}\n </div>\n )\n}\n","import { FieldErrorMessage } from './ErrorMessage'\nimport { FieldInput } from './Input'\nimport { FieldInputHolder } from './InputHolder'\nimport { FieldLabel } from './Label'\nimport { FieldRoot } from './Root'\nimport './styles.scss'\n\nexport default {\n Root: FieldRoot,\n Input: FieldInput,\n InputHolder: FieldInputHolder,\n Label: FieldLabel,\n ErrorMessage: FieldErrorMessage,\n}"],"names":[],"mappings":";;;;;;;AAKO,MAAM,oBAAoB,CAAC,EAAE,UAAU,cAAiC;AAC7E,MAAI,CAAC,YAAY,CAAC,QAAgB,QAAA;AAElC,SAAQ,oBAAA,KAAA,EAAE,WAAU,2BAA2B,UAAQ,QAAA,CAAA;AACzD;ACFO,MAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAuB;AACf,QAAA,eAAe,WAAW,mBAAmB,WAAW;AAE9D,6BAAQ,SAAM,EAAA,WAAW,cAAc,KAAK,UAAW,GAAG,MAAO,CAAA;AACnE;ACRO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAA6B;AAEzB,SAAA,qBAAC,OAAI,EAAA,WAAU,0BACZ,UAAA;AAAA,IAAA;AAAA,IACA,iBACC,oBAAC,OAAI,EAAA,WAAU,wBAAwB,UAAc,eAAA;AAAA,EAEzD,EAAA,CAAA;AAEJ;ACFO,MAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAuB;AACjB,MAAA,CAAC,KAAa,QAAA;AAElB,QAAM,SAAS;AAAA,IACb,EAAE,OAAO,YAAY,OAAO,CAAC,CAAC,UAAU,MAAM,oBAAC,QAAK,EAAA,UAAA,aAAU,CAAA,EAAQ;AAAA,IACtE;AAAA,MACE,OAAO;AAAA,MACP,OAAO,CAAC,CAAC;AAAA,MACT,MAAM,oBAAC,WAAU,EAAA,UAAU,iBAAkB,CAAA;AAAA,IAC/C;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO,CAAC,CAAC;AAAA,MACT,MAAM,oBAAC,iBAAgB,EAAA,UAAU,eAAgB,CAAA;AAAA,IACnD;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO,CAAC,CAAC;AAAA,MACT,MAAM,oBAAC,WAAU,EAAA,UAAU,iBAAkB,CAAA;AAAA,IAC/C;AAAA,EAAA;AAGI,QAAA,eAAe,OAAO,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC,KAAK;AAGrD,SAAA,qBAAC,OAAI,EAAA,WAAU,oBACb,UAAA;AAAA,IAAA,qBAAC,SAAM,EAAA,SAAS,IAAI,WAAU,0BAC3B,UAAA;AAAA,MAAA;AAAA,MAAM;AAAA,MACN,YACC,oBAAC,UAAO,EAAA,WAAU,oCAAmC,UAAC,KAAA;AAAA,IAAA,GAE1D;AAAA,IACC,oBAAA,OAAA,EAAI,WAAU,yBAAyB,uDAAc,MAAK;AAAA,EAC7D,EAAA,CAAA;AAEJ;ACjDO,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACd,QAAA,eAAe,WAAW,YAAY,aAAa;AAAA,IACvD,sBAAsB,CAAC,CAAC;AAAA,IACxB,qBAAqB,CAAC,CAAC;AAAA,IACvB,mBAAmB,CAAC,CAAC;AAAA,EAAA,CACtB;AAED,SACG,oBAAA,OAAA,EAAI,WAAW,cAAc,OAC3B,SACH,CAAA;AAEJ;ACvBA,MAAe,QAAA;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AAAA,EACb,OAAO;AAAA,EACP,cAAc;AAClB;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Radio/Field/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { RadioFieldProps } from '../types'\nimport './styles.scss'\n\nexport const RadioField = ({\n type = 'radio',\n direction = 'left',\n label,\n error,\n id,\n disabled,\n ...props\n}: RadioFieldProps) => {\n const radioClasses = classNames('au-radio-field', {\n 'au-radio-field--left-direction': direction === 'left',\n 'au-radio-field--right-direction': direction === 'right',\n 'au-radio-field--disabled': !!disabled,\n 'au-radio-field--error': !!error,\n })\n \n return (\n <div className={radioClasses}>\n <input\n className=\"au-radio-field__input\"\n type={type}\n id={id}\n disabled={disabled}\n {...props}\n />\n <label className=\"au-radio-field__label\" htmlFor={id}>\n {label}\n </label>\n </div>\n )\n}\n"],"names":[],"mappings":";;AAIO,MAAM,aAAa,CAAC;AAAA,EACzB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAuB;AACf,QAAA,eAAe,WAAW,kBAAkB;AAAA,IAChD,kCAAkC,cAAc;AAAA,IAChD,mCAAmC,cAAc;AAAA,IACjD,4BAA4B,CAAC,CAAC;AAAA,IAC9B,yBAAyB,CAAC,CAAC;AAAA,EAAA,CAC5B;AAGC,SAAA,qBAAC,OAAI,EAAA,WAAW,cACd,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA,MAAA;AAAA,IACN;AAAA,wBACC,SAAM,EAAA,WAAU,yBAAwB,SAAS,IAC/C,UACH,OAAA;AAAA,EACF,EAAA,CAAA;AAEJ;"}
@@ -1 +1 @@
1
- .au-field{cursor:pointer;border-radius:8px}.au-field__input-holder{position:relative;height:56px}.au-field__input{background-color:#fff;border:1px solid #454a54;border-radius:8px;box-sizing:border-box;font-family:inherit;font-size:16px;line-height:22px;padding:16px;height:56px;width:100%}.au-field__input:hover{border:1px solid #16181d}.au-field__input:focus{border-color:#0048db;outline:1px solid #0048db}.au-field:focus-within:not(.au-field--error) .au-field__header-label{color:#0048db}.au-field__header{display:flex;justify-content:space-between;align-items:center;padding-bottom:8px}.au-field__header-label{color:#454a54;cursor:pointer;font-size:14px;font-weight:600}.au-field__header-label--required{color:#991717}.au-field__header-icon span{font-size:14px;color:#454a54}.au-field__right-slot{position:absolute;right:16px;top:50%;transform:translateY(-50%)}.au-field__error-message{color:#991717;font-size:16px;font-weight:400;line-height:24px;padding-top:8px}.au-field--disabled{cursor:not-allowed}.au-field--disabled .au-field__input{background-color:#e2e4e9;border-color:#5e6573;color:#5e6573;cursor:not-allowed}.au-field--disabled .au-field__header-label{color:#5e6573;cursor:not-allowed}.au-field--error .au-field__input{background-color:#f5eff0;border-color:#991717}.au-field--error .au-field__input:focus{border-color:#0048db}.au-field--error .au-field__header-label{color:#991717}.au-field--success .au-field__input{animation:inputSuccess 2s forwards}.au-field--success .au-field__header-label{animation:labelSuccess 2s forwards}.au-field--success .au-field__header-icon .au-icon{animation:iconSucess 2s forwards}@keyframes inputSuccess{0%,70%{background-color:#f0fcf5;border-color:#10593b}}@keyframes labelSuccess{0%,70%{color:#10593b}}@keyframes iconSucess{0%,70%{opacity:1}to{opacity:0}}
1
+ .au-radio-field{cursor:pointer;display:flex;align-items:center;gap:8px;width:max-content}.au-radio-field--left-direction{flex-direction:row}.au-radio-field--right-direction{flex-direction:row-reverse}.au-radio-field__input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:50%;cursor:pointer;position:relative;height:24px;width:24px}.au-radio-field__input:after,.au-radio-field__input:before{content:"";border-radius:50%;position:absolute}.au-radio-field__input:after{background-color:#454a54;content:"";height:10px;width:10px;left:7px;top:7px;transform:scale(0);transform-origin:center;transition:transform .2s}.au-radio-field__input:before{content:"";border:2px solid #454a54;height:24px;width:24px}.au-radio-field__input:checked:before{border-color:#0048db;background-color:#0048db;transition:all .2s ease}.au-radio-field__input:checked:after{background-color:#fff;transform:scale(1)}.au-radio-field__input:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px #0048db}.au-radio-field__input:hover:not(:focus){background-color:#f2f5fc;outline:2px solid #F2F5FC}.au-radio-field__label{color:#454a54;font-size:16px;line-height:24px}.au-radio-field--disabled,.au-radio-field--disabled .au-radio-field__input{cursor:not-allowed}.au-radio-field--disabled .au-radio-field__input:before{border-color:#c4c9d4}.au-radio-field--disabled .au-radio-field__input:checked:before{background-color:#c4c9d4}.au-radio-field--disabled .au-radio-field__label{cursor:not-allowed;color:#c4c9d4}.au-radio-field--error .au-radio-field__input:before{border:2px solid #991717}.au-radio-field--error .au-radio-field__input:checked:before{border-color:#0048db}
@@ -0,0 +1,58 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../index-CweZ_OcN.js";
3
+ import { F as Field } from "../../index-sLk4K3iM.js";
4
+ import { Conditional } from "../Conditional/index.es.js";
5
+ import { Text } from "../Text/index.es.js";
6
+ import $dbSRa$react__default, { useState } from "react";
7
+ import { RadioField } from "../Field/index.es.js";
8
+ import './styles.css';const RadioGroup = ({
9
+ name = "",
10
+ defaultValue,
11
+ orientation = "vertical",
12
+ label,
13
+ error,
14
+ errorMessage,
15
+ children,
16
+ onChange,
17
+ onFocus
18
+ }) => {
19
+ const groupClass = classNames("au-radio-group", {
20
+ "au-radio-group--horizontal": orientation === "horizontal"
21
+ });
22
+ const getSafeName = (name2) => {
23
+ return name2 ? name2 : `au-radio-group-${Math.random()}`;
24
+ };
25
+ const [safeName] = useState(getSafeName(name));
26
+ const childrenWithProps = $dbSRa$react__default.Children.map(children, (child) => {
27
+ if ($dbSRa$react__default.isValidElement(child)) {
28
+ const childProps = child.props;
29
+ return /* @__PURE__ */ jsx(
30
+ RadioField,
31
+ {
32
+ name: safeName,
33
+ error,
34
+ defaultChecked: defaultValue === childProps.value,
35
+ onChange,
36
+ onFocus,
37
+ ...child.props
38
+ }
39
+ );
40
+ }
41
+ return child;
42
+ });
43
+ return /* @__PURE__ */ jsxs("div", { className: groupClass, children: [
44
+ /* @__PURE__ */ jsx(
45
+ Conditional,
46
+ {
47
+ condition: !!label,
48
+ renderIf: /* @__PURE__ */ jsx(Text, { variant: "body-medium", weight: "semibold", children: label })
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsx("div", { className: "au-radio-group__fields", children: childrenWithProps }),
52
+ /* @__PURE__ */ jsx(Field.ErrorMessage, { hasError: !!error, message: errorMessage })
53
+ ] });
54
+ };
55
+ export {
56
+ RadioGroup
57
+ };
58
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Radio/Group/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport './styles.scss'\nimport Field from '@components/form/Field'\nimport { Conditional } from '@components/misc'\nimport { Text } from '@components/Text'\nimport React, { useState } from 'react'\nimport { RadioField } from '../Field'\nimport { RadioFieldProps, RadioGroupProps } from '../types'\n\nexport const RadioGroup = ({\n name = '',\n defaultValue,\n orientation = 'vertical',\n label,\n error,\n errorMessage,\n children,\n onChange,\n onFocus,\n}: RadioGroupProps) => {\n const groupClass = classNames('au-radio-group', {\n 'au-radio-group--horizontal': orientation === 'horizontal',\n })\n\n const getSafeName = (name: string): string => {\n return name ? name : `au-radio-group-${Math.random()}`\n }\n\n const [safeName] = useState(getSafeName(name))\n\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = child.props as RadioFieldProps\n\n return (\n <RadioField\n name={safeName}\n error={error}\n defaultChecked={defaultValue === childProps.value}\n onChange={onChange}\n onFocus={onFocus}\n {...child.props}\n />\n )\n }\n return child\n })\n\n return (\n <div className={groupClass}>\n <Conditional\n condition={!!label}\n renderIf={\n <Text variant=\"body-medium\" weight=\"semibold\">\n {label}\n </Text>\n }\n />\n <div className=\"au-radio-group__fields\">{childrenWithProps}</div>\n <Field.ErrorMessage hasError={!!error} message={errorMessage} />\n </div>\n )\n}\n"],"names":["name","React"],"mappings":";;;;;;;AASO,MAAM,aAAa,CAAC;AAAA,EACzB,OAAO;AAAA,EACP;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAuB;AACf,QAAA,aAAa,WAAW,kBAAkB;AAAA,IAC9C,8BAA8B,gBAAgB;AAAA,EAAA,CAC/C;AAEK,QAAA,cAAc,CAACA,UAAyB;AAC5C,WAAOA,QAAOA,QAAO,kBAAkB,KAAK,OAAQ,CAAA;AAAA,EAAA;AAGtD,QAAM,CAAC,QAAQ,IAAI,SAAS,YAAY,IAAI,CAAC;AAE7C,QAAM,oBAAoBC,sBAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AAC5D,QAAAA,sBAAM,eAAe,KAAK,GAAG;AAC/B,YAAM,aAAa,MAAM;AAGvB,aAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA,gBAAgB,iBAAiB,WAAW;AAAA,UAC5C;AAAA,UACA;AAAA,UACC,GAAG,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAGhB;AACO,WAAA;AAAA,EAAA,CACR;AAGC,SAAA,qBAAC,OAAI,EAAA,WAAW,YACd,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,CAAC,CAAC;AAAA,QACb,UACG,oBAAA,MAAA,EAAK,SAAQ,eAAc,QAAO,YAChC,UACH,OAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,IACC,oBAAA,OAAA,EAAI,WAAU,0BAA0B,UAAkB,mBAAA;AAAA,IAC3D,oBAAC,MAAM,cAAN,EAAmB,UAAU,CAAC,CAAC,OAAO,SAAS,cAAc;AAAA,EAChE,EAAA,CAAA;AAEJ;"}
@@ -0,0 +1 @@
1
+ .au-radio-group,.au-radio-group__fields{display:flex;flex-direction:column;gap:16px}.au-radio-group--horizontal .au-radio-group__fields{flex-direction:row}
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import Field from "../Field/index.es.js";
2
+ import { F as Field } from "../../index-sLk4K3iM.js";
3
3
  const InputField = ({
4
4
  optional,
5
5
  requiredInput,
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import Field from "../Field/index.es.js";
2
+ import { F as Field } from "../../index-sLk4K3iM.js";
3
3
  import { useState } from "react";
4
4
  import './styles.css';const usePasswordField = () => {
5
5
  const [showPassword, setShowPassword] = useState(false);
@@ -1,7 +1,7 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
2
  import { a as above } from "../../screen-DfYo7XQ_.js";
3
- import { B as BREAKPOINT_MD } from "../../tokens-TYOJv1j5.js";
4
3
  import { Portal } from "../Portal/index.es.js";
4
+ import { B as BREAKPOINT_MD } from "../../tokens-TYOJv1j5.js";
5
5
  const PortalHolder = ({ withPortal, children }) => {
6
6
  const shouldUsePortal = !above(BREAKPOINT_MD) && withPortal;
7
7
  if (shouldUsePortal) return /* @__PURE__ */ jsx(Portal, { children });
@@ -0,0 +1,14 @@
1
+ import { RadioField } from "../Field/index.es.js";
2
+ import { RadioGroup } from "../Group/index.es.js";
3
+ const components = {
4
+ Field: RadioField,
5
+ Group: RadioGroup
6
+ };
7
+ Object.keys(components).forEach((key) => {
8
+ const component = components[key];
9
+ component.displayName = `Radio.${key}`;
10
+ });
11
+ export {
12
+ components as Radio
13
+ };
14
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Radio/index.tsx"],"sourcesContent":["import { RadioField } from './Field'\nimport { RadioGroup } from './Group'\nimport { RadioFieldProps, RadioGroupProps } from './types'\n\ntype Components = {\n Field: React.FC<RadioFieldProps>\n Group: React.FC<RadioGroupProps>\n}\n\nconst components: Components = {\n Field: RadioField,\n Group: RadioGroup,\n}\n\nObject.keys(components).forEach((key) => {\n const component = components[key as keyof Components]\n component.displayName = `Radio.${key}`\n})\n\nexport { components as Radio }\n"],"names":[],"mappings":";;AASA,MAAM,aAAyB;AAAA,EAC7B,OAAO;AAAA,EACP,OAAO;AACT;AAEA,OAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACjC,QAAA,YAAY,WAAW,GAAuB;AAC1C,YAAA,cAAc,SAAS,GAAG;AACtC,CAAC;"}
@@ -4,7 +4,7 @@ import "../Icon/index.es.js";
4
4
  import "../icons/IconChevronDown/index.es.js";
5
5
  import "../icons/IconChevronLeft/index.es.js";
6
6
  import "../icons/IconX/index.es.js";
7
- import { S } from "../../index-CLq9qZyb.js";
7
+ import { S } from "../../index-BnnDZOqb.js";
8
8
  export {
9
9
  S as Segment
10
10
  };
@@ -4,47 +4,80 @@ import "../Icon/index.es.js";
4
4
  import { IconCheck } from "../icons/IconCheck/index.es.js";
5
5
  import { IconChevronDown } from "../icons/IconChevronDown/index.es.js";
6
6
  import { IconSlash } from "../icons/IconSlash/index.es.js";
7
- import Field from "../Field/index.es.js";
7
+ import { F as Field } from "../../index-sLk4K3iM.js";
8
8
  import { useState, useRef, useEffect } from "react";
9
- import './styles.css';const useSelectField = (options, initialValue, onChange, disabled, register) => {
9
+ import './styles.css';const useSelectField = (options, initialValue, onChange, disabled, register, autocomplete = false) => {
10
+ var _a;
10
11
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
11
- const [currentValue, setCurrentValue] = useState(initialValue || "");
12
+ const [selectedOption, setSelectedOption] = useState({
13
+ value: initialValue || "",
14
+ label: initialValue ? ((_a = options.find((option) => option.value === initialValue)) == null ? void 0 : _a.label) || "" : ""
15
+ });
12
16
  const [activeOptionIndex, setActiveOptionIndex] = useState(
13
17
  null
14
18
  );
19
+ const [dropdownMaxHeight, setDropdownMaxHeight] = useState(0);
15
20
  const selectRef = useRef(null);
16
21
  const selectElementRef = useRef(null);
22
+ const [searchValue, setSearchValue] = useState("");
23
+ const activeOptionRef = useRef(null);
24
+ const filteredOptions = autocomplete ? options.filter(
25
+ (option) => option.label.toLowerCase().includes(searchValue.toLowerCase())
26
+ ) : options;
17
27
  useEffect(() => {
18
28
  if (initialValue) {
19
- setCurrentValue(initialValue);
29
+ const option = options.find((option2) => option2.value === initialValue);
30
+ if (option) {
31
+ setSelectedOption({ value: option.value, label: option.label });
32
+ }
20
33
  }
21
- }, [initialValue]);
34
+ }, [initialValue, options]);
22
35
  useEffect(() => {
23
36
  if (register && selectElementRef.current) {
24
37
  register(selectElementRef.current);
25
38
  }
26
39
  }, [register]);
27
- const toggleDropdown = () => {
28
- setIsDropdownOpen((prev) => !prev);
29
- setActiveOptionIndex(null);
30
- if (selectRef.current) {
31
- selectRef.current.focus();
40
+ useEffect(() => {
41
+ if (activeOptionRef.current) {
42
+ activeOptionRef.current.scrollIntoView({
43
+ behavior: "smooth",
44
+ block: "nearest"
45
+ });
32
46
  }
33
- };
34
- const selectOption = (optionValue, optionDisabled) => {
35
- if (optionDisabled) return;
36
- setCurrentValue(optionValue);
37
- setIsDropdownOpen(false);
38
- if (onChange) {
39
- onChange(optionValue);
47
+ }, [activeOptionIndex]);
48
+ const toggleDropdown = () => {
49
+ if (!isDropdownOpen && selectRef.current) {
50
+ const { bottom } = selectRef.current.getBoundingClientRect();
51
+ let totalPadding = 0;
52
+ let parentElement = selectRef.current.parentElement;
53
+ while (parentElement) {
54
+ const parentPaddingBottom = parseFloat(
55
+ window.getComputedStyle(parentElement).paddingBottom || "0"
56
+ );
57
+ totalPadding += parentPaddingBottom;
58
+ parentElement = parentElement.parentElement;
59
+ }
60
+ const availableSpaceBelow = window.innerHeight - bottom - totalPadding;
61
+ const minDropdownHeight = 150;
62
+ const calculatedHeight = Math.max(availableSpaceBelow, minDropdownHeight);
63
+ setDropdownMaxHeight(calculatedHeight);
40
64
  }
65
+ setIsDropdownOpen((prev) => {
66
+ if (!prev) {
67
+ const selectedIndex = options.findIndex(
68
+ (option) => option.value === selectedOption.value
69
+ );
70
+ setActiveOptionIndex(selectedIndex !== -1 ? selectedIndex : null);
71
+ }
72
+ return !prev;
73
+ });
41
74
  };
42
75
  const _findNextAvailableIndex = (currentIndex, direction) => {
43
- var _a;
76
+ var _a2;
44
77
  const step = direction === "down" ? 1 : -1;
45
- let nextIndex = (currentIndex + step + options.length) % options.length;
46
- while ((_a = options[nextIndex]) == null ? void 0 : _a.disabled) {
47
- nextIndex = (nextIndex + step + options.length) % options.length;
78
+ let nextIndex = (currentIndex + step + filteredOptions.length) % filteredOptions.length;
79
+ while ((_a2 = filteredOptions[nextIndex]) == null ? void 0 : _a2.disabled) {
80
+ nextIndex = (nextIndex + step + filteredOptions.length) % filteredOptions.length;
48
81
  }
49
82
  return nextIndex;
50
83
  };
@@ -56,11 +89,11 @@ import './styles.css';const useSelectField = (options, initialValue, onChange, d
56
89
  toggleDropdown();
57
90
  return;
58
91
  }
59
- if (activeOptionIndex !== null && !options[activeOptionIndex].disabled) {
92
+ if (activeOptionIndex !== null && !filteredOptions[activeOptionIndex].disabled) {
60
93
  e.preventDefault();
61
94
  selectOption(
62
- options[activeOptionIndex].value,
63
- options[activeOptionIndex].disabled
95
+ filteredOptions[activeOptionIndex].value,
96
+ filteredOptions[activeOptionIndex].disabled
64
97
  );
65
98
  }
66
99
  },
@@ -74,7 +107,10 @@ import './styles.css';const useSelectField = (options, initialValue, onChange, d
74
107
  ArrowUp: () => {
75
108
  e.preventDefault();
76
109
  setActiveOptionIndex(
77
- (prev) => _findNextAvailableIndex(prev !== null ? prev : options.length, "up")
110
+ (prev) => _findNextAvailableIndex(
111
+ prev !== null ? prev : filteredOptions.length,
112
+ "up"
113
+ )
78
114
  );
79
115
  if (!isDropdownOpen) toggleDropdown();
80
116
  },
@@ -86,16 +122,46 @@ import './styles.css';const useSelectField = (options, initialValue, onChange, d
86
122
  _actions[e.key]();
87
123
  }
88
124
  };
125
+ const selectOption = (optionValue, optionDisabled) => {
126
+ if (optionDisabled) return;
127
+ const option = options.find((option2) => option2.value === optionValue);
128
+ if (option) {
129
+ setSelectedOption({ value: option.value, label: option.label });
130
+ }
131
+ setActiveOptionIndex(null);
132
+ setIsDropdownOpen(false);
133
+ setSearchValue("");
134
+ if (onChange) {
135
+ onChange(optionValue);
136
+ }
137
+ };
138
+ const handleInputChange = (e) => {
139
+ const value = e.target.value;
140
+ setSearchValue(value);
141
+ if (value === "") {
142
+ setSelectedOption({ value: "", label: "" });
143
+ }
144
+ if (!isDropdownOpen) {
145
+ setIsDropdownOpen(true);
146
+ }
147
+ };
89
148
  return {
90
149
  isDropdownOpen,
91
- currentValue,
92
150
  selectRef,
151
+ activeOptionRef,
93
152
  selectElementRef,
94
153
  toggleDropdown,
95
154
  selectOption,
96
155
  onKeyDownDropdown,
97
156
  setActiveOptionIndex,
98
- activeOptionIndex
157
+ activeOptionIndex,
158
+ filteredOptions,
159
+ searchValue,
160
+ setSearchValue,
161
+ handleInputChange,
162
+ dropdownMaxHeight,
163
+ selectedOption,
164
+ setSelectedOption
99
165
  };
100
166
  };
101
167
  const SelectField = ({
@@ -113,20 +179,26 @@ const SelectField = ({
113
179
  placeholder,
114
180
  name,
115
181
  register,
116
- onBlur
182
+ onBlur,
183
+ autocomplete = false,
184
+ EmptyText = "Nada encontrado"
117
185
  }) => {
118
- var _a;
119
186
  const {
120
187
  isDropdownOpen,
121
- currentValue,
122
188
  selectRef,
123
189
  selectElementRef,
190
+ activeOptionRef,
124
191
  toggleDropdown,
125
192
  selectOption,
126
193
  onKeyDownDropdown,
127
194
  setActiveOptionIndex,
128
- activeOptionIndex
129
- } = useSelectField(options, value, onChange, disabled, register);
195
+ activeOptionIndex,
196
+ filteredOptions,
197
+ searchValue,
198
+ selectedOption,
199
+ handleInputChange,
200
+ dropdownMaxHeight
201
+ } = useSelectField(options, value, onChange, disabled, register, autocomplete);
130
202
  const dropdownClasses = classNames("au-field__select", {
131
203
  "au-field__select--disabled": disabled,
132
204
  "au-field__select--open": isDropdownOpen,
@@ -165,10 +237,20 @@ const SelectField = ({
165
237
  "aria-haspopup": "listbox",
166
238
  "aria-expanded": isDropdownOpen,
167
239
  "aria-labelledby": "select-label",
168
- "aria-activedescendant": activeOptionIndex !== null ? options[activeOptionIndex].value : void 0,
240
+ "aria-activedescendant": activeOptionIndex !== null && filteredOptions[activeOptionIndex] ? filteredOptions[activeOptionIndex].value : void 0,
169
241
  onBlur,
170
242
  children: [
171
- /* @__PURE__ */ jsx("div", { className: "au-field__select-display", children: ((_a = options.find((option) => option.value === currentValue)) == null ? void 0 : _a.label) || placeholder || "Selecionar..." }),
243
+ /* @__PURE__ */ jsx(
244
+ "input",
245
+ {
246
+ className: "au-field__select-input",
247
+ value: searchValue || selectedOption.label,
248
+ placeholder: placeholder || "Selecionar...",
249
+ onChange: handleInputChange,
250
+ readOnly: !autocomplete,
251
+ disabled
252
+ }
253
+ ),
172
254
  /* @__PURE__ */ jsx("div", { className: "au-field__select-icon", children: /* @__PURE__ */ jsx(IconChevronDown, {}) })
173
255
  ]
174
256
  }
@@ -182,22 +264,24 @@ const SelectField = ({
182
264
  role: "listbox",
183
265
  "aria-live": "polite",
184
266
  tabIndex: -1,
185
- children: options.map((option, index) => /* @__PURE__ */ jsxs(
267
+ style: { maxHeight: `${dropdownMaxHeight}px`, overflowY: "auto" },
268
+ children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx("li", { className: "au-field__select-option au-field__select-option--empty", children: EmptyText }) : filteredOptions.map((option, index) => /* @__PURE__ */ jsxs(
186
269
  "li",
187
270
  {
188
271
  className: classNames("au-field__select-option", {
189
272
  "au-field__select-option--highlighted": activeOptionIndex === index,
190
- "au-field__select-option--selected": option.value === currentValue,
273
+ "au-field__select-option--selected": option.value === selectedOption.value,
191
274
  "au-field__select-option--disabled": option.disabled
192
275
  }),
276
+ ref: activeOptionIndex === index ? activeOptionRef : null,
193
277
  role: "option",
194
- "aria-selected": option.value === currentValue,
278
+ "aria-selected": option.value === selectedOption.value,
195
279
  "aria-disabled": option.disabled,
196
280
  onClick: () => selectOption(option.value, option.disabled),
197
281
  onMouseEnter: () => setActiveOptionIndex(index),
198
282
  children: [
199
283
  option.label,
200
- option.disabled ? /* @__PURE__ */ jsx(IconSlash, {}) : option.value === currentValue ? /* @__PURE__ */ jsx(IconCheck, {}) : null
284
+ option.disabled ? /* @__PURE__ */ jsx(IconSlash, {}) : option.value === selectedOption.value ? /* @__PURE__ */ jsx(IconCheck, {}) : null
201
285
  ]
202
286
  },
203
287
  option.value
@@ -209,7 +293,7 @@ const SelectField = ({
209
293
  {
210
294
  hidden: true,
211
295
  disabled,
212
- value: currentValue,
296
+ value: selectedOption.value,
213
297
  onChange: (e) => selectOption(e.target.value),
214
298
  ref: selectElementRef,
215
299
  name,