@consumidor-positivo/aurora 0.0.69 → 0.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Calendar/index.es.js +2 -2
- package/dist/components/CalendarHeader/index.es.js +2 -2
- package/dist/components/CheckboxField/index.es.js +2 -2
- package/dist/components/Datepicker/index.es.js +3 -3
- package/dist/components/ErrorMessage/index.es.js +9 -0
- package/dist/components/ErrorMessage/index.es.js.map +1 -0
- package/dist/components/Group/index.es.js +1 -1
- package/dist/components/Input/index.es.js +14 -0
- package/dist/components/Input/index.es.js.map +1 -0
- package/dist/components/InputField/index.es.js +1 -1
- package/dist/components/InputHolder/index.es.js +14 -0
- package/dist/components/InputHolder/index.es.js.map +1 -0
- package/dist/components/Label/index.es.js +49 -0
- package/dist/components/Label/index.es.js.map +1 -0
- package/dist/components/PasswordField/index.es.js +1 -1
- package/dist/components/PortalHolder/index.es.js +1 -1
- package/dist/components/Root/index.es.js +21 -0
- package/dist/components/Root/index.es.js.map +1 -0
- package/dist/components/Segment/index.es.js +1 -1
- package/dist/components/SelectField/index.es.js +1 -1
- package/dist/components/TextArea/index.es.js +58 -0
- package/dist/components/TextArea/index.es.js.map +1 -0
- package/dist/components/TextareaField/index.es.js +3 -15
- package/dist/components/TextareaField/index.es.js.map +1 -1
- package/dist/components/TokenField/index.es.js +1 -1
- package/dist/components/form/Field/TextArea/hook.d.ts +9 -0
- package/dist/components/form/Field/TextArea/index.d.ts +10 -0
- package/dist/components/form/Field/index.d.ts +4 -2
- package/dist/components/form/TextareaField/index.d.ts +2 -1
- package/dist/components/index/styles.css +1 -1
- package/dist/components/index/styles2.css +1 -1
- package/dist/components/index/styles3.css +1 -1
- package/dist/{index-EAEcmr1o.js → index-B2qlxNd4.js} +4 -4
- package/dist/{index-EAEcmr1o.js.map → index-B2qlxNd4.js.map} +1 -1
- package/dist/{index-CLq9qZyb.js → index-CclsoEnK.js} +3 -3
- package/dist/{index-CLq9qZyb.js.map → index-CclsoEnK.js.map} +1 -1
- package/dist/{index-BuHGuwbT.js → index-D1oGcejt.js} +2 -2
- package/dist/{index-BuHGuwbT.js.map → index-D1oGcejt.js.map} +1 -1
- package/dist/index-DfksciAR.js +18 -0
- package/dist/index-DfksciAR.js.map +1 -0
- package/dist/main.es.js +41 -41
- package/dist/{tokens-TYOJv1j5.js → tokens-DGTtjw-_.js} +41 -41
- package/dist/{tokens-TYOJv1j5.js.map → tokens-DGTtjw-_.js.map} +1 -1
- package/package.json +1 -1
- package/dist/components/form/Field/TextArea.d.ts +0 -7
- package/dist/index-DY3hp3Pl.js +0 -101
- package/dist/index-DY3hp3Pl.js.map +0 -1
- /package/dist/components/form/Field/{ErrorMessage.d.ts → ErrorMessage/index.d.ts} +0 -0
- /package/dist/components/form/Field/{Input.d.ts → Input/index.d.ts} +0 -0
- /package/dist/components/form/Field/{InputHolder.d.ts → InputHolder/index.d.ts} +0 -0
- /package/dist/components/form/Field/{Label.d.ts → Label/index.d.ts} +0 -0
- /package/dist/components/form/Field/{Root.d.ts → Root/index.d.ts} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../index-CweZ_OcN.js";
|
|
3
|
-
import "../../index-
|
|
3
|
+
import "../../index-D1oGcejt.js";
|
|
4
4
|
import "../Button/index.es.js";
|
|
5
5
|
import "../PortalHolder/index.es.js";
|
|
6
|
-
import { a } from "../../index-
|
|
6
|
+
import { a } from "../../index-B2qlxNd4.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-
|
|
7
|
-
import { C } from "../../index-
|
|
6
|
+
import "../../index-CclsoEnK.js";
|
|
7
|
+
import { C } from "../../index-D1oGcejt.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 {
|
|
6
|
-
import { F as Field } from "../../index-
|
|
5
|
+
import { m as COLOR_NEUTRAL_00 } from "../../tokens-DGTtjw-_.js";
|
|
6
|
+
import { F as Field } from "../../index-DfksciAR.js";
|
|
7
7
|
import './styles.css';const CheckboxField = ({
|
|
8
8
|
label,
|
|
9
9
|
error,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { B as BREAKPOINT_MD,
|
|
2
|
+
import { B as BREAKPOINT_MD, b as COLOR_NEUTRAL_40 } from "../../tokens-DGTtjw-_.js";
|
|
3
3
|
import "../../index-CweZ_OcN.js";
|
|
4
4
|
import "../Icon/index.es.js";
|
|
5
5
|
import { IconCalendar } from "../icons/IconCalendar/index.es.js";
|
|
6
6
|
import { InputField } from "../InputField/index.es.js";
|
|
7
|
-
import { g as getDefaultDate, D as DDMMYYYY, a as DatepickerCalendar, A as AUCalendarDate } from "../../index-
|
|
7
|
+
import { g as getDefaultDate, D as DDMMYYYY, a as DatepickerCalendar, A as AUCalendarDate } from "../../index-B2qlxNd4.js";
|
|
8
8
|
import { useRef, useState, useMemo, useEffect } from "react";
|
|
9
9
|
import { a as above } from "../../screen-DfYo7XQ_.js";
|
|
10
|
-
import { u as useOutsideClick } from "../../index-
|
|
10
|
+
import { u as useOutsideClick } from "../../index-CclsoEnK.js";
|
|
11
11
|
import './styles.css';function useDatepicker({
|
|
12
12
|
value,
|
|
13
13
|
defaultValue = "empty",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const FieldErrorMessage = ({ hasError, message }) => {
|
|
3
|
+
if (!hasError || !message) return null;
|
|
4
|
+
return /* @__PURE__ */ jsx("p", { className: "au-field__error-message", children: message });
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
FieldErrorMessage
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Field/ErrorMessage/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"],"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;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c as classNames } from "../../index-CweZ_OcN.js";
|
|
3
|
-
import { F as Field } from "../../index-
|
|
3
|
+
import { F as Field } from "../../index-DfksciAR.js";
|
|
4
4
|
import { Conditional } from "../Conditional/index.es.js";
|
|
5
5
|
import { Text } from "../Text/index.es.js";
|
|
6
6
|
import $dbSRa$react__default, { useState } from "react";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
|
3
|
+
const FieldInput = ({
|
|
4
|
+
inputRef,
|
|
5
|
+
customclass,
|
|
6
|
+
...props
|
|
7
|
+
}) => {
|
|
8
|
+
const inputClasses = classNames("au-field__input", customclass);
|
|
9
|
+
return /* @__PURE__ */ jsx("input", { className: inputClasses, ref: inputRef, ...props });
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
FieldInput
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Field/Input/index.tsx"],"sourcesContent":["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"],"names":[],"mappings":";;AAOO,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;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const FieldInputHolder = ({
|
|
3
|
+
children,
|
|
4
|
+
rightSideSlot
|
|
5
|
+
}) => {
|
|
6
|
+
return /* @__PURE__ */ jsxs("div", { className: "au-field__input-holder", children: [
|
|
7
|
+
children,
|
|
8
|
+
rightSideSlot && /* @__PURE__ */ jsx("div", { className: "au-field__right-slot", children: rightSideSlot })
|
|
9
|
+
] });
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
FieldInputHolder
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Field/InputHolder/index.tsx"],"sourcesContent":["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"],"names":[],"mappings":";AAOO,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;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "../../index-CweZ_OcN.js";
|
|
3
|
+
import "../Icon/index.es.js";
|
|
4
|
+
import { IconAlertOctagon } from "../icons/IconAlertOctagon/index.es.js";
|
|
5
|
+
import { IconCheck } from "../icons/IconCheck/index.es.js";
|
|
6
|
+
import { IconSlash } from "../icons/IconSlash/index.es.js";
|
|
7
|
+
import { C as COLOR_SUCCESS_50, a as COLOR_ERROR_50, b as COLOR_NEUTRAL_40 } from "../../tokens-DGTtjw-_.js";
|
|
8
|
+
const FieldLabel = ({
|
|
9
|
+
id,
|
|
10
|
+
text,
|
|
11
|
+
required,
|
|
12
|
+
optional,
|
|
13
|
+
success,
|
|
14
|
+
error,
|
|
15
|
+
disabled
|
|
16
|
+
}) => {
|
|
17
|
+
if (!text) return null;
|
|
18
|
+
const states = [
|
|
19
|
+
{ state: "optional", value: !!optional, icon: /* @__PURE__ */ jsx("span", { children: "(Opcional)" }) },
|
|
20
|
+
{
|
|
21
|
+
state: "success",
|
|
22
|
+
value: !!success,
|
|
23
|
+
icon: /* @__PURE__ */ jsx(IconCheck, { rawColor: COLOR_SUCCESS_50 })
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
state: "error",
|
|
27
|
+
value: !!error,
|
|
28
|
+
icon: /* @__PURE__ */ jsx(IconAlertOctagon, { rawColor: COLOR_ERROR_50 })
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
state: "disabled",
|
|
32
|
+
value: !!disabled,
|
|
33
|
+
icon: /* @__PURE__ */ jsx(IconSlash, { rawColor: COLOR_NEUTRAL_40 })
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
const currentState = states.find(({ value }) => !!value);
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", { className: "au-field__header", children: [
|
|
38
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, className: "au-field__header-label", children: [
|
|
39
|
+
text,
|
|
40
|
+
" ",
|
|
41
|
+
required && /* @__PURE__ */ jsx("strong", { className: "au-field__header-label--required", children: "*" })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsx("div", { className: "au-field__header-icon", children: currentState == null ? void 0 : currentState.icon })
|
|
44
|
+
] });
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
FieldLabel
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Field/Label/index.tsx"],"sourcesContent":["import { IconAlertOctagon, 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: <IconAlertOctagon 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"],"names":[],"mappings":";;;;;;;AAiBO,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,kBAAiB,EAAA,UAAU,eAAgB,CAAA;AAAA,IACpD;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;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { F as Field } from "../../index-
|
|
2
|
+
import { F as Field } from "../../index-DfksciAR.js";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import './styles.css';const usePasswordField = () => {
|
|
5
5
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
+
import { B as BREAKPOINT_MD } from "../../tokens-DGTtjw-_.js";
|
|
4
4
|
import { Portal } from "../Portal/index.es.js";
|
|
5
5
|
const PortalHolder = ({ withPortal, children }) => {
|
|
6
6
|
const shouldUsePortal = !above(BREAKPOINT_MD) && withPortal;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
|
3
|
+
const FieldRoot = ({
|
|
4
|
+
children,
|
|
5
|
+
disabled,
|
|
6
|
+
success,
|
|
7
|
+
error,
|
|
8
|
+
style,
|
|
9
|
+
customclass
|
|
10
|
+
}) => {
|
|
11
|
+
const inputClasses = classNames("au-field", customclass, {
|
|
12
|
+
"au-field--disabled": !!disabled,
|
|
13
|
+
"au-field--success": !!success,
|
|
14
|
+
"au-field--error": !!error
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ jsx("div", { className: inputClasses, style, children });
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
FieldRoot
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Field/Root/index.tsx"],"sourcesContent":["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"],"names":[],"mappings":";;AAWO,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;"}
|
|
@@ -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-
|
|
7
|
+
import { S } from "../../index-CclsoEnK.js";
|
|
8
8
|
export {
|
|
9
9
|
S as Segment
|
|
10
10
|
};
|
|
@@ -4,7 +4,7 @@ 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 { F as Field } from "../../index-
|
|
7
|
+
import { F as Field } from "../../index-DfksciAR.js";
|
|
8
8
|
import { useState, useRef, useEffect } from "react";
|
|
9
9
|
import './styles.css';const useSelectField = (options, initialValue, onChange, disabled, register, autocomplete = false) => {
|
|
10
10
|
var _a;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
|
3
|
+
import { Text } from "../Text/index.es.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
const useFieldTextArea = ({ onChange }) => {
|
|
6
|
+
const [charCount, setCharCount] = useState(0);
|
|
7
|
+
const handleInputChange = (e) => {
|
|
8
|
+
setCharCount(e.target.value.length);
|
|
9
|
+
if (onChange) onChange(e);
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
charCount,
|
|
13
|
+
handleInputChange
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const FieldTextArea = ({
|
|
17
|
+
textareaRef,
|
|
18
|
+
customClass,
|
|
19
|
+
horizontalResize,
|
|
20
|
+
maxLength,
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
const { charCount, handleInputChange } = useFieldTextArea({
|
|
24
|
+
onChange: props.onChange
|
|
25
|
+
});
|
|
26
|
+
const textareaClasses = classNames("au-field__textarea", customClass, {
|
|
27
|
+
"au-field__textarea--horizontal-resize": horizontalResize
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: "au-field__textarea-container", children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
"textarea",
|
|
32
|
+
{
|
|
33
|
+
ref: textareaRef,
|
|
34
|
+
className: textareaClasses,
|
|
35
|
+
maxLength,
|
|
36
|
+
onChange: handleInputChange,
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
maxLength && /* @__PURE__ */ jsxs(
|
|
41
|
+
Text,
|
|
42
|
+
{
|
|
43
|
+
variant: "caption",
|
|
44
|
+
className: "au-field__char-counter",
|
|
45
|
+
"aria-live": "polite",
|
|
46
|
+
children: [
|
|
47
|
+
charCount,
|
|
48
|
+
"/",
|
|
49
|
+
maxLength
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
FieldTextArea
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Field/TextArea/hook.ts","../../../lib/components/form/Field/TextArea/index.tsx"],"sourcesContent":["import { useState } from 'react'\n\ntype UseFieldTextAreaProps = {\n onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void\n}\n\nexport const useFieldTextArea = ({ onChange }: UseFieldTextAreaProps) => {\n const [charCount, setCharCount] = useState(0)\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setCharCount(e.target.value.length)\n if (onChange) onChange(e)\n }\n\n return {\n charCount,\n handleInputChange,\n }\n}\n","import React from 'react'\nimport classNames from 'classnames'\nimport { Text } from '@components/Text'\nimport { useFieldTextArea } from './hook'\n\ntype FieldTextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n textareaRef?: React.RefObject<HTMLTextAreaElement>\n customClass?: string\n horizontalResize?: boolean\n maxLength?: number\n}\n\nexport const FieldTextArea = ({\n textareaRef,\n customClass,\n horizontalResize,\n maxLength,\n ...props\n}: FieldTextAreaProps) => {\n const { charCount, handleInputChange } = useFieldTextArea({\n onChange: props.onChange,\n })\n const textareaClasses = classNames('au-field__textarea', customClass, {\n 'au-field__textarea--horizontal-resize': horizontalResize,\n })\n\n return (\n <div className=\"au-field__textarea-container\">\n <textarea\n ref={textareaRef}\n className={textareaClasses}\n maxLength={maxLength}\n onChange={handleInputChange}\n {...props}\n />\n {maxLength && (\n <Text\n variant=\"caption\"\n className=\"au-field__char-counter\"\n aria-live=\"polite\">\n {charCount}/{maxLength}\n </Text>\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;AAMO,MAAM,mBAAmB,CAAC,EAAE,eAAsC;AACvE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,CAAC;AAEtC,QAAA,oBAAoB,CAAC,MAA8C;AAC1D,iBAAA,EAAE,OAAO,MAAM,MAAM;AAC9B,QAAA,mBAAmB,CAAC;AAAA,EAAA;AAGnB,SAAA;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;ACNO,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA0B;AACxB,QAAM,EAAE,WAAW,kBAAkB,IAAI,iBAAiB;AAAA,IACxD,UAAU,MAAM;AAAA,EAAA,CACjB;AACK,QAAA,kBAAkB,WAAW,sBAAsB,aAAa;AAAA,IACpE,yCAAyC;AAAA,EAAA,CAC1C;AAGC,SAAA,qBAAC,OAAI,EAAA,WAAU,gCACb,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK;AAAA,QACL,WAAW;AAAA,QACX;AAAA,QACA,UAAU;AAAA,QACT,GAAG;AAAA,MAAA;AAAA,IACN;AAAA,IACC,aACC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,WAAU;AAAA,QACV,aAAU;AAAA,QACT,UAAA;AAAA,UAAA;AAAA,UAAU;AAAA,UAAE;AAAA,QAAA;AAAA,MAAA;AAAA,IACf;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Text } from "../Text/index.es.js";
|
|
4
|
-
import { F as Field } from "../../index-DY3hp3Pl.js";
|
|
2
|
+
import { F as Field } from "../../index-DfksciAR.js";
|
|
5
3
|
const TextAreaField = ({
|
|
6
4
|
optional,
|
|
7
5
|
required,
|
|
@@ -16,14 +14,9 @@ const TextAreaField = ({
|
|
|
16
14
|
textAreaStyle,
|
|
17
15
|
textareaRef,
|
|
18
16
|
maxLength,
|
|
19
|
-
|
|
17
|
+
horizontalResize,
|
|
20
18
|
...props
|
|
21
19
|
}) => {
|
|
22
|
-
const [charCount, setCharCount] = useState(0);
|
|
23
|
-
const handleInputChange = (e) => {
|
|
24
|
-
setCharCount(e.target.value.length);
|
|
25
|
-
if (onChange) onChange(e);
|
|
26
|
-
};
|
|
27
20
|
return /* @__PURE__ */ jsxs(
|
|
28
21
|
Field.Root,
|
|
29
22
|
{
|
|
@@ -53,15 +46,10 @@ const TextAreaField = ({
|
|
|
53
46
|
disabled,
|
|
54
47
|
style: textAreaStyle,
|
|
55
48
|
maxLength,
|
|
56
|
-
|
|
49
|
+
horizontalResize,
|
|
57
50
|
...props
|
|
58
51
|
}
|
|
59
52
|
),
|
|
60
|
-
maxLength && /* @__PURE__ */ jsxs(Text, { className: "au-field__char-counter", children: [
|
|
61
|
-
charCount,
|
|
62
|
-
"/",
|
|
63
|
-
maxLength
|
|
64
|
-
] }),
|
|
65
53
|
/* @__PURE__ */ jsx(Field.ErrorMessage, { hasError: !!error, message: errorMessage })
|
|
66
54
|
]
|
|
67
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/TextareaField/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/form/TextareaField/index.tsx"],"sourcesContent":["import Field from '../Field'\n\nexport type TextAreaProps =\n React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n optional?: boolean\n success?: boolean\n error?: boolean\n errorMessage?: string\n label?: string\n textAreaStyle?: React.CSSProperties\n textareaRef?: React.RefObject<HTMLTextAreaElement>\n horizontalResize?: boolean\n }\n\nexport const TextAreaField = ({\n optional,\n required,\n success,\n error,\n errorMessage,\n label,\n id,\n disabled,\n style,\n className,\n textAreaStyle,\n textareaRef,\n maxLength,\n horizontalResize,\n ...props\n}: TextAreaProps) => {\n return (\n <Field.Root\n style={style}\n customclass={className}\n success={success}\n error={error}\n disabled={disabled}>\n <Field.Label\n text={label}\n id={id}\n required={required}\n optional={optional}\n success={success}\n error={error}\n disabled={disabled}\n />\n <Field.TextArea\n id={id}\n textareaRef={textareaRef}\n disabled={disabled}\n style={textAreaStyle}\n maxLength={maxLength}\n horizontalResize={horizontalResize}\n {...props}\n />\n <Field.ErrorMessage hasError={!!error} message={errorMessage} />\n </Field.Root>\n )\n}\n"],"names":[],"mappings":";;AAcO,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAqB;AAEjB,SAAA;AAAA,IAAC,MAAM;AAAA,IAAN;AAAA,MACC;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAA;AAAA,QAAA;AAAA,UAAC,MAAM;AAAA,UAAN;AAAA,YACC,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,QACA;AAAA,UAAC,MAAM;AAAA,UAAN;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAO;AAAA,YACP;AAAA,YACA;AAAA,YACC,GAAG;AAAA,UAAA;AAAA,QACN;AAAA,QACA,oBAAC,MAAM,cAAN,EAAmB,UAAU,CAAC,CAAC,OAAO,SAAS,cAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGpE;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { F as Field } from "../../index-
|
|
2
|
+
import { F as Field } from "../../index-DfksciAR.js";
|
|
3
3
|
import { useRef, useState, useEffect } from "react";
|
|
4
4
|
import './styles.css';function inputtedValueIsValid(value) {
|
|
5
5
|
const numberValue = Number(value);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type UseFieldTextAreaProps = {
|
|
3
|
+
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const useFieldTextArea: ({ onChange }: UseFieldTextAreaProps) => {
|
|
6
|
+
charCount: number;
|
|
7
|
+
handleInputChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
type FieldTextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
4
|
+
textareaRef?: React.RefObject<HTMLTextAreaElement>;
|
|
5
|
+
customClass?: string;
|
|
6
|
+
horizontalResize?: boolean;
|
|
7
|
+
maxLength?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const FieldTextArea: ({ textareaRef, customClass, horizontalResize, maxLength, ...props }: FieldTextAreaProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -29,9 +29,11 @@ declare const _default: {
|
|
|
29
29
|
hasError?: boolean | undefined;
|
|
30
30
|
message?: string | undefined;
|
|
31
31
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
32
|
-
TextArea: ({ textareaRef,
|
|
32
|
+
TextArea: ({ textareaRef, customClass, horizontalResize, maxLength, ...props }: import('react').TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
33
33
|
textareaRef?: import('react').RefObject<HTMLTextAreaElement> | undefined;
|
|
34
|
-
|
|
34
|
+
customClass?: string | undefined;
|
|
35
|
+
horizontalResize?: boolean | undefined;
|
|
36
|
+
maxLength?: number | undefined;
|
|
35
37
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
36
38
|
};
|
|
37
39
|
export default _default;
|
|
@@ -7,5 +7,6 @@ export type TextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
|
|
|
7
7
|
label?: string;
|
|
8
8
|
textAreaStyle?: React.CSSProperties;
|
|
9
9
|
textareaRef?: React.RefObject<HTMLTextAreaElement>;
|
|
10
|
+
horizontalResize?: boolean;
|
|
10
11
|
};
|
|
11
|
-
export declare const TextAreaField: ({ optional, required, success, error, errorMessage, label, id, disabled, style, className, textAreaStyle, textareaRef, maxLength,
|
|
12
|
+
export declare const TextAreaField: ({ optional, required, success, error, errorMessage, label, id, disabled, style, className, textAreaStyle, textareaRef, maxLength, horizontalResize, ...props }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.au-
|
|
1
|
+
.au-field{cursor:pointer;border-radius:8px}.au-field__input-holder{position:relative;height:56px}.au-field__input{height:56px}.au-field__textarea{padding:10px;box-sizing:border-box;resize:vertical;border:none;outline:none;width:100%;height:100%;min-width:100%}.au-field__textarea--horizontal-resize{resize:both}.au-field__textarea-container{position:relative;display:inline-block;min-width:100%}.au-field__input,.au-field__textarea{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;width:100%}.au-field__input:hover,.au-field__textarea:hover{border:1px solid #16181d}.au-field__input:focus,.au-field__textarea:focus{border-color:#0048db;outline:1px solid #0048db}.au-field__char-counter{text-align:right;color:#454a54}.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,.au-field--disabled .au-field__textarea{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,.au-field--error .au-field__textarea{background-color:#f5eff0;border-color:#991717}.au-field--error .au-field__input:focus,.au-field--error .au-field__textarea:focus{border-color:#0048db}.au-field--error .au-field__header-label{color:#991717}.au-field--success .au-field__input,.au-field--success .au-field__textarea{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 +1 @@
|
|
|
1
|
-
@media (min-width: 600px){.au-
|
|
1
|
+
.au-datepicker__calendar{visibility:hidden;opacity:0;position:fixed;z-index:1000;top:0;right:0;bottom:0;left:0;transition:opacity .2s,visibility .2s}@media (min-width: 600px){.au-datepicker__calendar{width:414px;position:absolute;top:calc(100% + 90px);left:0;right:auto;bottom:auto;transition:opacity .2s,visibility .2s,transform .2s ease-in-out}}.au-datepicker__calendar--visible,.au-datepicker__calendar--visible .au-datepicker__calendar-backdrop{visibility:visible;opacity:1}.au-datepicker__calendar--visible .au-datepicker__calendar-card{transform:translateY(0)}@media (min-width: 600px){.au-datepicker__calendar--visible{transform:translateY(-74px)}}.au-datepicker__calendar-backdrop{background-color:#16181dcc;cursor:pointer;position:absolute;width:100%;height:100%;visibility:0;z-index:1;-webkit-tap-highlight-color:transparent;opacity:0;transition:visibility .2s,opacity .2s}@media (min-width: 600px){.au-datepicker__calendar-backdrop{display:none}}.au-datepicker__calendar-card{width:100%;padding:16px;position:absolute;border-radius:16px 16px 0 0;border:1px solid #e2e4e9;background:#fff;bottom:0;z-index:2;transform:translateY(500px);transition:transform .2s ease-in-out}@media (min-width: 600px){.au-datepicker__calendar-card{position:relative;height:auto;transform:none;bottom:auto;transition:none;border-radius:16px}}.au-datepicker__calendar-base{width:100%}.au-datepicker__calendar-grid{width:100%;margin-top:16px}.au-datepicker__calendar-weekday,.au-datepicker__calendar-day{width:48px;height:48px;font-size:16px;font-weight:400;text-align:center;color:#16181d}@media (max-width: 320px){.au-datepicker__calendar-weekday,.au-datepicker__calendar-day{width:30px;height:30px}}.au-datepicker__calendar-day{cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:50%;border:1px solid transparent;transition:border .2s ease-in-out,color .2s ease-in-out,background-color .2s ease-in-out}.au-datepicker__calendar-day:hover{border:1px solid #0048db}.au-datepicker__calendar-day[data-disabled]{cursor:default;color:#5e6573}.au-datepicker__calendar-day[data-disabled]:hover{border:1px solid transparent}.au-datepicker__calendar-day[data-selected]{background-color:#0048db;color:#fff}.au-datepicker__calendar-actions-dock{display:flex;gap:8px;padding-top:16px}@media (min-width: 600px){.au-datepicker__calendar-actions-dock{display:none}}.au-datepicker__calendar-cancel{max-width:125px}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.au-
|
|
1
|
+
@media (min-width: 600px){.au-datepicker__segment{position:relative}}.au-datepicker__segment--open .au-datepicker__segment-input .au-icon{transform:rotate(180deg)}.au-datepicker__segment--open .au-datepicker__segment-list-holder{transform:translate(0);visibility:visible}@media (min-width: 600px){.au-datepicker__segment--open .au-datepicker__segment-list-holder{opacity:1;transform:none}}.au-datepicker__segment-input{padding:8px;gap:8px;display:flex;border-radius:8px;cursor:pointer;border:1px solid #e2e4e9}.au-datepicker__segment-list-holder{background:#fff;border-radius:16px 16px 0 0;position:absolute;top:0;right:0;bottom:0;left:0;visibility:hidden;opacity:1;display:flex;flex-direction:column;transform:translate(100%);transition:visibility .2s,transform .2s}@media (min-width: 600px){.au-datepicker__segment-list-holder{inset:unset;left:0;opacity:0;top:calc(100% + 8px);height:224px;border-radius:16px;border:1px solid #e2e4e9;transform:none;transition:opacity .2s,visibility .2s,transform .2s}}.au-datepicker__segment-list-header{padding:24px 16px;display:flex;align-items:center;justify-content:space-between}@media (min-width: 600px){.au-datepicker__segment-list-header{display:none}}.au-datepicker__segment-list{overflow-x:scroll;flex:1}.au-datepicker__segment-list-item{padding:16px 24px;font-size:16px;line-height:150%;cursor:pointer}.au-datepicker__segment-list-item:hover,.au-datepicker__segment-list-item--active{background-color:#f6f7fa}.au-datepicker__segment-list-item:not(:last-of-type){border-bottom:1px solid #e2e4e9}@media (min-width: 600px){.au-datepicker__segment-list-item:not(:last-of-type){border-bottom:none}}.au-datepicker__segment-title{font-family:"Source Sans 3",sans-serif;font-size:16px;font-weight:600}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c as classNames } from "./index-CweZ_OcN.js";
|
|
3
|
-
import { $ as $35ea8db9cb2ccb90$export$99faa760c7908e4f, a as $dfd62f934fc76fed$export$e1aef45b828286de, C as CalendarHeader, b as $dfd62f934fc76fed$export$5bd780d491cfc46c, c as $dfd62f934fc76fed$export$22e2d15eaa4d2377, d as $dfd62f934fc76fed$export$ad2135cac3a11b3d, e as $dfd62f934fc76fed$export$e11f8ba65d857bff, f as $dfd62f934fc76fed$export$5d847498420df57b } from "./index-
|
|
3
|
+
import { $ as $35ea8db9cb2ccb90$export$99faa760c7908e4f, a as $dfd62f934fc76fed$export$e1aef45b828286de, C as CalendarHeader, b as $dfd62f934fc76fed$export$5bd780d491cfc46c, c as $dfd62f934fc76fed$export$22e2d15eaa4d2377, d as $dfd62f934fc76fed$export$ad2135cac3a11b3d, e as $dfd62f934fc76fed$export$e11f8ba65d857bff, f as $dfd62f934fc76fed$export$5d847498420df57b } from "./index-D1oGcejt.js";
|
|
4
4
|
import { Button } from "./components/Button/index.es.js";
|
|
5
5
|
import { PortalHolder } from "./components/PortalHolder/index.es.js";
|
|
6
6
|
import { useRef, useState, useEffect } from "react";
|
|
7
|
-
import { B as BREAKPOINT_MD } from "./tokens-
|
|
7
|
+
import { B as BREAKPOINT_MD } from "./tokens-DGTtjw-_.js";
|
|
8
8
|
import { a as above } from "./screen-DfYo7XQ_.js";
|
|
9
|
-
import './components/index/
|
|
9
|
+
import './components/index/styles2.css';const DDMMYYYY = {
|
|
10
10
|
placeholder: "DD/MM/YYYY",
|
|
11
11
|
/** Apply DD/MM/YYYY to a field text while typing */
|
|
12
12
|
maskDate(dateStr) {
|
|
@@ -238,4 +238,4 @@ export {
|
|
|
238
238
|
DatepickerCalendar as a,
|
|
239
239
|
getDefaultDate as g
|
|
240
240
|
};
|
|
241
|
-
//# sourceMappingURL=index-
|
|
241
|
+
//# sourceMappingURL=index-B2qlxNd4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-EAEcmr1o.js","sources":["../lib/components/form/Datepicker/helpers.ts","../lib/components/form/Datepicker/Calendar/hook.ts","../lib/components/form/Datepicker/Calendar/index.tsx"],"sourcesContent":["import { AUCalendarDateShape, DefaultValue, FormatAdapter } from './types'\n\n/**\n * This adapter Handle the input format and convert to a more\n * universal structure, that can be used accross all subcomponents in the datepicker.\n * if we need to support another format like dd-mm-yyyy, we only need to create another adapter\n * following this model\n */\nexport const DDMMYYYY: FormatAdapter = {\n placeholder: 'DD/MM/YYYY',\n /** Apply DD/MM/YYYY to a field text while typing */\n maskDate(dateStr) {\n let fmtInputDate = dateStr\n fmtInputDate = fmtInputDate.replace(/\\D/g, '') // Remove non-numeric characters\n\n if (fmtInputDate.length > 2) {\n fmtInputDate = `${fmtInputDate.slice(0, 2)}/${fmtInputDate.slice(2)}`\n }\n if (fmtInputDate.length > 5) {\n fmtInputDate = `${fmtInputDate.slice(0, 5)}/${fmtInputDate.slice(5)}`\n }\n return fmtInputDate\n },\n /** Check if a string is on DD/MM/YYYY Format */\n validateFormat(dateStr) {\n const pattern = /^\\d{2}\\/\\d{2}\\/\\d{4}$/\n return pattern.test(dateStr)\n },\n /** Covert a DD/MM/YYYY to the datepicker date structure */\n toCalendarDate(dateStr): AUCalendarDateShape {\n const [day, month, year] = dateStr.split('/').map(Number)\n return AUCalendarDate(day, month, year)\n },\n /** Covert a Date in the datepicker structure into a DD/MM/YYYY string */\n toString(dateObj: AUCalendarDateShape): string {\n const fmtNumber = (digit: number) =>\n String(digit).length === 1 ? `0${digit}` : String(digit)\n const { day, month, year } = dateObj\n\n return `${fmtNumber(day)}/${fmtNumber(month)}/${year}`\n },\n /** Check if a DD/MM/YYYY is a valid date */\n validate(dateStr, minValue, maxValue): boolean {\n const [day, month, year] = dateStr.split('/').map(Number)\n const date = new Date(year, month - 1, day)\n const isOlderThanMinDate =\n !!minValue &&\n date < new Date(minValue.year, minValue.month - 1, minValue.day)\n\n const exceedsMaxDate =\n !!maxValue &&\n date > new Date(maxValue.year, maxValue.month - 1, maxValue.day)\n\n return (\n date.getDate() === day &&\n date.getMonth() + 1 === month &&\n date.getFullYear() === year &&\n !isOlderThanMinDate &&\n !exceedsMaxDate\n )\n },\n}\n\nexport function AUCalendarDate(\n day: number,\n month: number,\n year: number,\n): AUCalendarDateShape {\n return {\n day,\n month,\n year,\n }\n}\n\nexport function getDefaultDate(\n defaultDateProp: DefaultValue,\n): AUCalendarDateShape | null {\n if (defaultDateProp == 'empty') return null\n if (defaultDateProp === 'now') {\n const now = new Date()\n return AUCalendarDate(now.getDate(), now.getMonth() + 1, now.getFullYear())\n }\n\n return defaultDateProp\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { CalendarDate } from '@internationalized/date'\nimport { BREAKPOINT_MD } from '@core/tokens'\nimport { above } from '@core/utils/screen'\nimport { AUCalendarDate } from '../helpers'\nimport { AUCalendarDateShape } from '../types'\n\ntype UseCalendarProps = {\n minValue: AUCalendarDateShape\n maxValue: AUCalendarDateShape\n value?: AUCalendarDateShape | null\n isVisible: boolean\n onClose: () => void\n onChange: (date: AUCalendarDateShape) => void\n}\n\nexport function useCalendar({\n onChange,\n onClose,\n minValue,\n maxValue,\n value,\n isVisible,\n}: UseCalendarProps) {\n const rootEl = useRef<HTMLDivElement>(null)\n const [enteredAnimation, setEnteredAnimation] = useState(false)\n const [calendarInternalState, setCalendarInternalState] =\n useState<CalendarDate>()\n\n const [delayedIsVisible, setDelayedIsVisible] = useState(false)\n\n const usedMinValue = new CalendarDate(\n minValue.year,\n minValue.month,\n minValue.day,\n )\n const usedMaxValue = new CalendarDate(\n maxValue.year,\n maxValue.month,\n maxValue.day,\n )\n\n useEffect(() => {\n if (!value) return\n const { day, month, year } = value\n setCalendarInternalState(new CalendarDate(year, month, day))\n }, [value])\n\n useEffect(() => {\n if (isVisible) {\n setDelayedIsVisible(true)\n return delayComponentMount()\n } else {\n return delayComponentUnmount()\n }\n }, [isVisible])\n\n function delayComponentMount(delayTime = 100) {\n const t = setTimeout(() => {\n setEnteredAnimation(true)\n }, delayTime)\n\n return () => {\n clearTimeout(t)\n }\n }\n\n function delayComponentUnmount(delayTime = 200) {\n setEnteredAnimation(false)\n const timoutToUnmount = setTimeout(() => {\n setDelayedIsVisible(false)\n }, delayTime)\n\n return () => {\n clearTimeout(timoutToUnmount)\n }\n }\n\n function fmtWeekday(day: string) {\n const capitalized = `${day.charAt(0).toUpperCase()}${day.slice(1)}`\n return capitalized.replace('.', '')\n }\n\n function triggerChange(date: CalendarDate) {\n const { day, month, year } = date\n onChange(AUCalendarDate(day, month, year))\n onClose()\n }\n\n function calendarChange(date: CalendarDate) {\n setCalendarInternalState(date)\n if (!above(BREAKPOINT_MD)) return\n triggerChange(date)\n }\n\n function actionChange() {\n if (calendarInternalState) {\n triggerChange(calendarInternalState)\n }\n }\n\n return {\n actionChange,\n calendarChange,\n fmtWeekday,\n usedMaxValue,\n usedMinValue,\n rootEl,\n calendarInternalState,\n enteredAnimation,\n delayedIsVisible,\n }\n}\n","import classNames from 'classnames'\nimport {\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n} from 'react-aria-components'\nimport { Button } from '@components/Button'\nimport { CalendarHeader } from '../CalendarHeader'\nimport { PortalHolder } from '../PortalHolder'\n\n\nimport { AUCalendarDateShape } from '../types'\nimport { useCalendar } from './hook'\nimport './styles.scss'\n\ntype DatepickerCalendarProps = {\n withPortal?: boolean\n minValue: AUCalendarDateShape\n maxValue: AUCalendarDateShape\n value?: AUCalendarDateShape | null\n onClose: () => void\n onChange: (date: AUCalendarDateShape) => void\n isVisible: boolean\n}\n\nexport const DatepickerCalendar = ({\n onClose,\n withPortal,\n minValue,\n maxValue,\n value,\n onChange,\n isVisible,\n}: DatepickerCalendarProps) => {\n const {\n rootEl,\n usedMaxValue,\n usedMinValue,\n calendarInternalState,\n calendarChange,\n fmtWeekday,\n actionChange,\n enteredAnimation,\n delayedIsVisible,\n } = useCalendar({\n onChange,\n onClose,\n minValue,\n maxValue,\n value,\n isVisible,\n })\n\n const componentClass = classNames('au-datepicker__calendar', {\n 'au-datepicker__calendar--visible': enteredAnimation,\n })\n\n if (!delayedIsVisible) return\n\n return (\n <PortalHolder withPortal={withPortal}>\n <div className={componentClass} ref={rootEl}>\n <div className=\"au-datepicker__calendar-backdrop\" onClick={onClose} />\n <div className=\"au-datepicker__calendar-card\">\n <Calendar\n autoFocus\n className=\"au-datepicker__calendar-base\"\n minValue={usedMinValue}\n maxValue={usedMaxValue}\n value={calendarInternalState}\n onChange={calendarChange}>\n <CalendarHeader defaultFocusDate={calendarInternalState} />\n <CalendarGrid\n className=\"au-datepicker__calendar-grid\"\n weekdayStyle=\"short\">\n <CalendarGridHeader>\n {(day) => (\n <CalendarHeaderCell className=\"au-datepicker__calendar-weekday\">\n {fmtWeekday(day)}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody>\n {(date) => (\n <CalendarCell\n className=\"au-datepicker__calendar-day\"\n date={date}\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </Calendar>\n <div className=\"au-datepicker__calendar-actions-dock\">\n <Button\n type=\"outlined\"\n className=\"au-datepicker__calendar-cancel\"\n expand=\"x\"\n onClick={onClose}>\n Cancelar\n </Button>\n <Button\n disabled={!calendarInternalState}\n onClick={actionChange}\n expand=\"x\">\n Confirmar\n </Button>\n </div>\n </div>\n </div>\n </PortalHolder>\n )\n}\n"],"names":["CalendarDate","Calendar","CalendarGrid","CalendarGridHeader","CalendarHeaderCell","CalendarGridBody","CalendarCell"],"mappings":";;;;;;;;AAQO,MAAM,WAA0B;AAAA,EACrC,aAAa;AAAA;AAAA,EAEb,SAAS,SAAS;AAChB,QAAI,eAAe;AACJ,mBAAA,aAAa,QAAQ,OAAO,EAAE;AAEzC,QAAA,aAAa,SAAS,GAAG;AACZ,qBAAA,GAAG,aAAa,MAAM,GAAG,CAAC,CAAC,IAAI,aAAa,MAAM,CAAC,CAAC;AAAA,IACrE;AACI,QAAA,aAAa,SAAS,GAAG;AACZ,qBAAA,GAAG,aAAa,MAAM,GAAG,CAAC,CAAC,IAAI,aAAa,MAAM,CAAC,CAAC;AAAA,IACrE;AACO,WAAA;AAAA,EACT;AAAA;AAAA,EAEA,eAAe,SAAS;AACtB,UAAM,UAAU;AACT,WAAA,QAAQ,KAAK,OAAO;AAAA,EAC7B;AAAA;AAAA,EAEA,eAAe,SAA8B;AACrC,UAAA,CAAC,KAAK,OAAO,IAAI,IAAI,QAAQ,MAAM,GAAG,EAAE,IAAI,MAAM;AACjD,WAAA,eAAe,KAAK,OAAO,IAAI;AAAA,EACxC;AAAA;AAAA,EAEA,SAAS,SAAsC;AAC7C,UAAM,YAAY,CAAC,UACjB,OAAO,KAAK,EAAE,WAAW,IAAI,IAAI,KAAK,KAAK,OAAO,KAAK;AACzD,UAAM,EAAE,KAAK,OAAO,KAAA,IAAS;AAEtB,WAAA,GAAG,UAAU,GAAG,CAAC,IAAI,UAAU,KAAK,CAAC,IAAI,IAAI;AAAA,EACtD;AAAA;AAAA,EA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ACC,WAAU;AAAA,sBACV;AAAA,oBAAA;AAAA,kBAAA,GAGN;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,MACA,qBAAC,OAAI,EAAA,WAAU,wCACb,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAU;AAAA,YACV,QAAO;AAAA,YACP,SAAS;AAAA,YAAS,UAAA;AAAA,UAAA;AAAA,QAEpB;AAAA,QACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,UAAU,CAAC;AAAA,YACX,SAAS;AAAA,YACT,QAAO;AAAA,YAAI,UAAA;AAAA,UAAA;AAAA,QAEb;AAAA,MAAA,GACF;AAAA,IAAA,GACF;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index-B2qlxNd4.js","sources":["../lib/components/form/Datepicker/helpers.ts","../lib/components/form/Datepicker/Calendar/hook.ts","../lib/components/form/Datepicker/Calendar/index.tsx"],"sourcesContent":["import { AUCalendarDateShape, DefaultValue, FormatAdapter } from './types'\n\n/**\n * This adapter Handle the input format and convert to a more\n * universal structure, that can be used accross all subcomponents in the datepicker.\n * if we need to support another format like dd-mm-yyyy, we only need to create another adapter\n * following this model\n */\nexport const DDMMYYYY: FormatAdapter = {\n placeholder: 'DD/MM/YYYY',\n /** Apply DD/MM/YYYY to a field text while typing */\n maskDate(dateStr) {\n let fmtInputDate = dateStr\n fmtInputDate = fmtInputDate.replace(/\\D/g, '') // Remove non-numeric characters\n\n if (fmtInputDate.length > 2) {\n fmtInputDate = `${fmtInputDate.slice(0, 2)}/${fmtInputDate.slice(2)}`\n }\n if (fmtInputDate.length > 5) {\n fmtInputDate = `${fmtInputDate.slice(0, 5)}/${fmtInputDate.slice(5)}`\n }\n return fmtInputDate\n },\n /** Check if a string is on DD/MM/YYYY Format */\n validateFormat(dateStr) {\n const pattern = /^\\d{2}\\/\\d{2}\\/\\d{4}$/\n return pattern.test(dateStr)\n },\n /** Covert a DD/MM/YYYY to the datepicker date structure */\n toCalendarDate(dateStr): AUCalendarDateShape {\n const [day, month, year] = dateStr.split('/').map(Number)\n return AUCalendarDate(day, month, year)\n },\n /** Covert a Date in the datepicker structure into a DD/MM/YYYY string */\n toString(dateObj: AUCalendarDateShape): string {\n const fmtNumber = (digit: number) =>\n String(digit).length === 1 ? `0${digit}` : String(digit)\n const { day, month, year } = dateObj\n\n return `${fmtNumber(day)}/${fmtNumber(month)}/${year}`\n },\n /** Check if a DD/MM/YYYY is a valid date */\n validate(dateStr, minValue, maxValue): boolean {\n const [day, month, year] = dateStr.split('/').map(Number)\n const date = new Date(year, month - 1, day)\n const isOlderThanMinDate =\n !!minValue &&\n date < new Date(minValue.year, minValue.month - 1, minValue.day)\n\n const exceedsMaxDate =\n !!maxValue &&\n date > new Date(maxValue.year, maxValue.month - 1, maxValue.day)\n\n return (\n date.getDate() === day &&\n date.getMonth() + 1 === month &&\n date.getFullYear() === year &&\n !isOlderThanMinDate &&\n !exceedsMaxDate\n )\n },\n}\n\nexport function AUCalendarDate(\n day: number,\n month: number,\n year: number,\n): AUCalendarDateShape {\n return {\n day,\n month,\n year,\n }\n}\n\nexport function getDefaultDate(\n defaultDateProp: DefaultValue,\n): AUCalendarDateShape | null {\n if (defaultDateProp == 'empty') return null\n if (defaultDateProp === 'now') {\n const now = new Date()\n return AUCalendarDate(now.getDate(), now.getMonth() + 1, now.getFullYear())\n }\n\n return defaultDateProp\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { CalendarDate } from '@internationalized/date'\nimport { BREAKPOINT_MD } from '@core/tokens'\nimport { above } from '@core/utils/screen'\nimport { AUCalendarDate } from '../helpers'\nimport { AUCalendarDateShape } from '../types'\n\ntype UseCalendarProps = {\n minValue: AUCalendarDateShape\n maxValue: AUCalendarDateShape\n value?: AUCalendarDateShape | null\n isVisible: boolean\n onClose: () => void\n onChange: (date: AUCalendarDateShape) => void\n}\n\nexport function useCalendar({\n onChange,\n onClose,\n minValue,\n maxValue,\n value,\n isVisible,\n}: UseCalendarProps) {\n const rootEl = useRef<HTMLDivElement>(null)\n const [enteredAnimation, setEnteredAnimation] = useState(false)\n const [calendarInternalState, setCalendarInternalState] =\n useState<CalendarDate>()\n\n const [delayedIsVisible, setDelayedIsVisible] = useState(false)\n\n const usedMinValue = new CalendarDate(\n minValue.year,\n minValue.month,\n minValue.day,\n )\n const usedMaxValue = new CalendarDate(\n maxValue.year,\n maxValue.month,\n maxValue.day,\n )\n\n useEffect(() => {\n if (!value) return\n const { day, month, year } = value\n setCalendarInternalState(new CalendarDate(year, month, day))\n }, [value])\n\n useEffect(() => {\n if (isVisible) {\n setDelayedIsVisible(true)\n return delayComponentMount()\n } else {\n return delayComponentUnmount()\n }\n }, [isVisible])\n\n function delayComponentMount(delayTime = 100) {\n const t = setTimeout(() => {\n setEnteredAnimation(true)\n }, delayTime)\n\n return () => {\n clearTimeout(t)\n }\n }\n\n function delayComponentUnmount(delayTime = 200) {\n setEnteredAnimation(false)\n const timoutToUnmount = setTimeout(() => {\n setDelayedIsVisible(false)\n }, delayTime)\n\n return () => {\n clearTimeout(timoutToUnmount)\n }\n }\n\n function fmtWeekday(day: string) {\n const capitalized = `${day.charAt(0).toUpperCase()}${day.slice(1)}`\n return capitalized.replace('.', '')\n }\n\n function triggerChange(date: CalendarDate) {\n const { day, month, year } = date\n onChange(AUCalendarDate(day, month, year))\n onClose()\n }\n\n function calendarChange(date: CalendarDate) {\n setCalendarInternalState(date)\n if (!above(BREAKPOINT_MD)) return\n triggerChange(date)\n }\n\n function actionChange() {\n if (calendarInternalState) {\n triggerChange(calendarInternalState)\n }\n }\n\n return {\n actionChange,\n calendarChange,\n fmtWeekday,\n usedMaxValue,\n usedMinValue,\n rootEl,\n calendarInternalState,\n enteredAnimation,\n delayedIsVisible,\n }\n}\n","import classNames from 'classnames'\nimport {\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n} from 'react-aria-components'\nimport { Button } from '@components/Button'\nimport { CalendarHeader } from '../CalendarHeader'\nimport { PortalHolder } from '../PortalHolder'\n\n\nimport { AUCalendarDateShape } from '../types'\nimport { useCalendar } from './hook'\nimport './styles.scss'\n\ntype DatepickerCalendarProps = {\n withPortal?: boolean\n minValue: AUCalendarDateShape\n maxValue: AUCalendarDateShape\n value?: AUCalendarDateShape | null\n onClose: () => void\n onChange: (date: AUCalendarDateShape) => void\n isVisible: boolean\n}\n\nexport const DatepickerCalendar = ({\n onClose,\n withPortal,\n minValue,\n maxValue,\n value,\n onChange,\n isVisible,\n}: DatepickerCalendarProps) => {\n const {\n rootEl,\n usedMaxValue,\n usedMinValue,\n calendarInternalState,\n calendarChange,\n fmtWeekday,\n actionChange,\n enteredAnimation,\n delayedIsVisible,\n } = useCalendar({\n onChange,\n onClose,\n minValue,\n maxValue,\n value,\n isVisible,\n })\n\n const componentClass = classNames('au-datepicker__calendar', {\n 'au-datepicker__calendar--visible': enteredAnimation,\n })\n\n if (!delayedIsVisible) return\n\n return (\n <PortalHolder withPortal={withPortal}>\n <div className={componentClass} ref={rootEl}>\n <div className=\"au-datepicker__calendar-backdrop\" onClick={onClose} />\n <div className=\"au-datepicker__calendar-card\">\n <Calendar\n autoFocus\n className=\"au-datepicker__calendar-base\"\n minValue={usedMinValue}\n maxValue={usedMaxValue}\n value={calendarInternalState}\n onChange={calendarChange}>\n <CalendarHeader defaultFocusDate={calendarInternalState} />\n <CalendarGrid\n className=\"au-datepicker__calendar-grid\"\n weekdayStyle=\"short\">\n <CalendarGridHeader>\n {(day) => (\n <CalendarHeaderCell className=\"au-datepicker__calendar-weekday\">\n {fmtWeekday(day)}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody>\n {(date) => (\n <CalendarCell\n className=\"au-datepicker__calendar-day\"\n date={date}\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </Calendar>\n <div className=\"au-datepicker__calendar-actions-dock\">\n <Button\n type=\"outlined\"\n className=\"au-datepicker__calendar-cancel\"\n expand=\"x\"\n onClick={onClose}>\n Cancelar\n </Button>\n <Button\n disabled={!calendarInternalState}\n onClick={actionChange}\n expand=\"x\">\n Confirmar\n </Button>\n </div>\n </div>\n </div>\n </PortalHolder>\n )\n}\n"],"names":["CalendarDate","Calendar","CalendarGrid","CalendarGridHeader","CalendarHeaderCell","CalendarGridBody","CalendarCell"],"mappings":";;;;;;;;AAQO,MAAM,WAA0B;AAAA,EACrC,aAAa;AAAA;AAAA,EAEb,SAAS,SAAS;AAChB,QAAI,eAAe;AACJ,mBAAA,aAAa,QAAQ,OAAO,EAAE;AAEzC,QAAA,aAAa,SAAS,GAAG;AACZ,qBAAA,GAAG,aAAa,MAAM,GAAG,CAAC,CAAC,IAAI,aAAa,MAAM,CAAC,CAAC;AAAA,IACrE;AACI,QAAA,aAAa,SAAS,GAAG;AACZ,qBAAA,GAAG,aAAa,MAAM,GAAG,CAAC,CAAC,IAAI,aAAa,MAAM,CAAC,CAAC;AAAA,IACrE;AACO,WAAA;AAAA,EACT;AAAA;AAAA,EAEA,eAAe,SAAS;AACtB,UAAM,UAAU;AACT,WAAA,QAAQ,KAAK,OAAO;AAAA,EAC7B;AAAA;AAAA,EAEA,eAAe,SAA8B;AACrC,UAAA,CAAC,KAAK,OAAO,IAAI,IAAI,QAAQ,MAAM,GAAG,EAAE,IAAI,MAAM;AACjD,WAAA,eAAe,KAAK,OAAO,IAAI;AAAA,EACxC;AAAA;AAAA,EAEA,SAAS,SAAsC;AAC7C,UAAM,YAAY,CAAC,UACjB,OAAO,KAAK,EAAE,WAAW,IAAI,IAAI,KAAK,KAAK,OAAO,KAAK;AACzD,UAAM,EAAE,KAAK,OAAO,KAAA,IAAS;AAEtB,WAAA,GAAG,UAAU,GAAG,CAAC,IAAI,UAAU,KAAK,CAAC,IAAI,IAAI;AAAA,EACtD;AAAA;AAAA,EAEA,SAAS,SAAS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,sBACV;AAAA,oBAAA;AAAA,kBAAA,GAGN;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,MACA,qBAAC,OAAI,EAAA,WAAU,wCACb,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAU;AAAA,YACV,QAAO;AAAA,YACP,SAAS;AAAA,YAAS,UAAA;AAAA,UAAA;AAAA,QAEpB;AAAA,QACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,UAAU,CAAC;AAAA,YACX,SAAS;AAAA,YACT,QAAO;AAAA,YAAI,UAAA;AAAA,UAAA;AAAA,QAEb;AAAA,MAAA,GACF;AAAA,IAAA,GACF;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;"}
|
|
@@ -5,9 +5,9 @@ import { IconChevronDown } from "./components/icons/IconChevronDown/index.es.js"
|
|
|
5
5
|
import { IconChevronLeft } from "./components/icons/IconChevronLeft/index.es.js";
|
|
6
6
|
import { IconX } from "./components/icons/IconX/index.es.js";
|
|
7
7
|
import { useState, useRef, useEffect } from "react";
|
|
8
|
-
import { B as BREAKPOINT_MD } from "./tokens-
|
|
8
|
+
import { B as BREAKPOINT_MD } from "./tokens-DGTtjw-_.js";
|
|
9
9
|
import { a as above } from "./screen-DfYo7XQ_.js";
|
|
10
|
-
import './components/index/
|
|
10
|
+
import './components/index/styles3.css';function useOutsideClick({
|
|
11
11
|
rootEl,
|
|
12
12
|
breakpoint,
|
|
13
13
|
onLoseFocusCB
|
|
@@ -138,4 +138,4 @@ export {
|
|
|
138
138
|
Segment as S,
|
|
139
139
|
useOutsideClick as u
|
|
140
140
|
};
|
|
141
|
-
//# sourceMappingURL=index-
|
|
141
|
+
//# sourceMappingURL=index-CclsoEnK.js.map
|