@consumidor-positivo/aurora 0.0.205 → 0.0.207

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 (54) hide show
  1. package/README.md +16 -0
  2. package/dist/components/Alert/Alert.test.d.ts +1 -0
  3. package/dist/components/Alert/index.es.js +1 -1
  4. package/dist/components/Button/Button.test.d.ts +1 -0
  5. package/dist/components/Calendar/index.es.js +2 -2
  6. package/dist/components/CalendarHeader/index.es.js +2 -2
  7. package/dist/components/Card/Card.test.d.ts +1 -0
  8. package/dist/components/Checkbox/index.es.js +1 -1
  9. package/dist/components/Container/Container.test.d.ts +1 -0
  10. package/dist/components/Datepicker/index.es.js +3 -3
  11. package/dist/components/Image/index.d.ts +0 -1
  12. package/dist/components/LazyImage/types.d.ts +0 -1
  13. package/dist/components/Modal/Modal.test.d.ts +1 -0
  14. package/dist/components/Modal/index.es.js +1 -1
  15. package/dist/components/Modal/index.es.js.map +1 -1
  16. package/dist/components/Modal/styles.css +1 -1
  17. package/dist/components/PortalHolder/index.es.js +1 -1
  18. package/dist/components/ProgressBar/ProgressBar.test.d.ts +1 -0
  19. package/dist/components/Prototype/Carousel/types.d.ts +0 -1
  20. package/dist/components/Segment/index.es.js +1 -1
  21. package/dist/components/SelectField/index.es.js +1 -1
  22. package/dist/components/Skeleton/Skeleton.test.d.ts +1 -0
  23. package/dist/components/Spinner/Spinner.test.d.ts +1 -0
  24. package/dist/components/Switch/Pure/Switch.test.d.ts +1 -0
  25. package/dist/components/Tabs/Tabs.test.d.ts +1 -0
  26. package/dist/components/Tag/Tag.test.d.ts +1 -0
  27. package/dist/components/Tag/index.d.ts +5 -1
  28. package/dist/components/Tag/index.es.js +18 -3
  29. package/dist/components/Tag/index.es.js.map +1 -1
  30. package/dist/components/Tag/styles.css +1 -1
  31. package/dist/components/Text/Text.test.d.ts +1 -0
  32. package/dist/components/Text/types.d.ts +0 -1
  33. package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
  34. package/dist/components/form/Datepicker/PortalHolder/index.d.ts +0 -1
  35. package/dist/components/form/EmailField/hook.d.ts +0 -1
  36. package/dist/components/form/Field/Input/index.d.ts +0 -1
  37. package/dist/components/form/Field/Label/index.d.ts +0 -1
  38. package/dist/components/form/Field/Root/index.d.ts +0 -1
  39. package/dist/components/form/Field/TextArea/hook.d.ts +0 -1
  40. package/dist/components/form/InputField/index.d.ts +0 -1
  41. package/dist/components/form/SelectField/types.d.ts +0 -1
  42. package/dist/components/form/TextareaField/index.d.ts +0 -1
  43. package/dist/components/form/TokenField/hook.d.ts +0 -1
  44. package/dist/components/misc/Portal/index.d.ts +0 -1
  45. package/dist/core/hooks/useOutsideClick.d.ts +0 -1
  46. package/dist/docs/components.d.ts +0 -1
  47. package/dist/{index-RHj6RFlT.js → index-C1N6rwrZ.js} +3 -3
  48. package/dist/{index-RHj6RFlT.js.map → index-C1N6rwrZ.js.map} +1 -1
  49. package/dist/{index-BzVR1Tq6.js → index-C8AM9yBn.js} +2 -2
  50. package/dist/{index-BzVR1Tq6.js.map → index-C8AM9yBn.js.map} +1 -1
  51. package/dist/{index-uWXGnhjd.js → index-CL0DrUGQ.js} +2 -2
  52. package/dist/{index-uWXGnhjd.js.map → index-CL0DrUGQ.js.map} +1 -1
  53. package/dist/main.es.js +1 -1
  54. package/package.json +11 -2
package/README.md CHANGED
@@ -57,3 +57,19 @@ import { Carousel } from '@consumidor-positivo/aurora'
57
57
  ```
58
58
 
59
59
  > **Nota:** Se você tentar usar o Carousel sem instalar o `react-snap-carousel`, receberá um erro de dependência em tempo de execução.
60
+
61
+ ## Testes
62
+
63
+ Este projeto usa Vitest para testes unitáriåos e @testing-library/react para testes de componentes React.
64
+
65
+ execute os testes com:
66
+
67
+ ```bash
68
+ npm test
69
+ ```
70
+
71
+ Para rodar em modo watch:
72
+
73
+ ```bash
74
+ npm run test:watch
75
+ ```
@@ -0,0 +1 @@
1
+ export {};
@@ -8,9 +8,9 @@ import { IconCheck } from "../icons/IconCheck/index.es.js";
8
8
  import { IconClock } from "../icons/IconClock/index.es.js";
9
9
  import { IconInfo } from "../icons/IconInfo/index.es.js";
10
10
  import { IconX } from "../icons/IconX/index.es.js";
11
- import { d as COLOR_NEUTRAL_70, C as COLOR_SUCCESS_50, b as COLOR_ERROR_50, e as COLOR_WARNING_50, f as COLOR_INFO_50 } from "../../tokens-D_iASp38.js";
12
11
  import { Conditional } from "../Conditional/index.es.js";
13
12
  import { Text } from "../Text/index.es.js";
13
+ import { d as COLOR_NEUTRAL_70, C as COLOR_SUCCESS_50, b as COLOR_ERROR_50, e as COLOR_WARNING_50, f as COLOR_INFO_50 } from "../../tokens-D_iASp38.js";
14
14
  import './styles.css';const Alert = ({
15
15
  showIcon = true,
16
16
  status = "info",
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,9 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../index-CweZ_OcN.js";
3
- import "../../index-BzVR1Tq6.js";
3
+ import "../../index-C8AM9yBn.js";
4
4
  import "../Button/index.es.js";
5
5
  import "../PortalHolder/index.es.js";
6
- import { a } from "../../index-RHj6RFlT.js";
6
+ import { a } from "../../index-C1N6rwrZ.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-uWXGnhjd.js";
7
- import { C } from "../../index-BzVR1Tq6.js";
6
+ import "../../index-CL0DrUGQ.js";
7
+ import { C } from "../../index-C8AM9yBn.js";
8
8
  export {
9
9
  C as CalendarHeader
10
10
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -3,9 +3,9 @@ import $dbSRa$react__default, { useState, useEffect } from "react";
3
3
  import { c as classNames } from "../../index-CweZ_OcN.js";
4
4
  import "../Icon/index.es.js";
5
5
  import { IconCheck } from "../icons/IconCheck/index.es.js";
6
- import { h as COLOR_NEUTRAL_00 } from "../../tokens-D_iASp38.js";
7
6
  import { F as Field } from "../../index-ZE6zszxw.js";
8
7
  import { Conditional } from "../Conditional/index.es.js";
8
+ import { h as COLOR_NEUTRAL_00 } from "../../tokens-D_iASp38.js";
9
9
  import { Text } from "../Text/index.es.js";
10
10
  import './styles.css';const CheckboxField = ({
11
11
  label,
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,13 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { B as BREAKPOINT_MD, c as COLOR_NEUTRAL_40 } from "../../tokens-D_iASp38.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-RHj6RFlT.js";
6
+ import { g as getDefaultDate, D as DDMMYYYY, a as DatepickerCalendar, A as AUCalendarDate } from "../../index-C1N6rwrZ.js";
8
7
  import { useRef, useState, useMemo, useEffect } from "react";
9
8
  import { a as above } from "../../screen-DfYo7XQ_.js";
10
- import { u as useOutsideClick } from "../../index-uWXGnhjd.js";
9
+ import { u as useOutsideClick } from "../../index-CL0DrUGQ.js";
10
+ import { B as BREAKPOINT_MD, c as COLOR_NEUTRAL_40 } from "../../tokens-D_iASp38.js";
11
11
  import './styles.css';function useDatepicker({
12
12
  value,
13
13
  defaultValue = "empty",
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type ImageProps = React.ImgHTMLAttributes<HTMLImageElement> & {
3
2
  srcMob?: string;
4
3
  srcTablet?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type LazyImageProps = {
3
2
  className?: string;
4
3
  lazy?: boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -19,7 +19,7 @@ import './styles.css';const Modal = ({
19
19
  });
20
20
  return /* @__PURE__ */ jsx("div", { className: modalClasses, children: /* @__PURE__ */ jsxs("div", { className: "au-modal__container", children: [
21
21
  /* @__PURE__ */ jsxs("div", { className: "au-modal__header", children: [
22
- /* @__PURE__ */ jsx(When, { condition: !!onClose, children: /* @__PURE__ */ jsx("div", { className: "au-modal__header-close", onClick: onClose, children: /* @__PURE__ */ jsx(IconX, {}) }) }),
22
+ /* @__PURE__ */ jsx(When, { condition: !!onClose, children: /* @__PURE__ */ jsx("button", { className: "au-modal__header-close", onClick: onClose, children: /* @__PURE__ */ jsx(IconX, {}) }) }),
23
23
  headerContent
24
24
  ] }),
25
25
  /* @__PURE__ */ jsx("div", { className: "au-modal__content", children: content })
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../lib/components/Modal/index.tsx"],"sourcesContent":["import { IconX } from '@components/icons'\nimport classNames from 'classnames'\nimport { If } from '../misc'\n\nimport './styles.scss'\n\ntype ModalLayout = 'default' | 'centralized'\n\ntype ModalProps = {\n isOpen: boolean\n onClose?: () => void\n headerContent?: React.ReactNode | string | JSX.Element | JSX.Element[]\n content?: React.ReactNode | string | JSX.Element | JSX.Element[]\n layoutMobile?: ModalLayout\n layoutDesktop?: ModalLayout\n}\n\nexport const Modal = ({\n isOpen,\n onClose,\n headerContent,\n content,\n layoutMobile = 'default',\n layoutDesktop = 'default',\n}: ModalProps) => {\n if (!isOpen) return null\n\n const modalClasses = classNames('au-modal', {\n 'au-modal--is-open': isOpen,\n 'au-modal--mobile-centralized': layoutMobile === 'centralized',\n 'au-modal--desktop-centralized': layoutDesktop === 'centralized',\n })\n\n return (\n <div className={modalClasses}>\n <div className=\"au-modal__container\">\n <div className=\"au-modal__header\">\n <If condition={!!onClose}>\n <div className=\"au-modal__header-close\" onClick={onClose}>\n <IconX />\n </div>\n </If>\n {headerContent}\n </div>\n <div className=\"au-modal__content\">{content}</div>\n </div>\n </div>\n )\n}\n"],"names":["If"],"mappings":";;;;;AAiBO,MAAM,QAAQ,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,gBAAgB;AAClB,MAAkB;AACZ,MAAA,CAAC,OAAe,QAAA;AAEd,QAAA,eAAe,WAAW,YAAY;AAAA,IAC1C,qBAAqB;AAAA,IACrB,gCAAgC,iBAAiB;AAAA,IACjD,iCAAiC,kBAAkB;AAAA,EAAA,CACpD;AAED,6BACG,OAAI,EAAA,WAAW,cACd,UAAC,qBAAA,OAAA,EAAI,WAAU,uBACb,UAAA;AAAA,IAAC,qBAAA,OAAA,EAAI,WAAU,oBACb,UAAA;AAAA,MAAA,oBAACA,MAAG,EAAA,WAAW,CAAC,CAAC,SACjB,UAAC,oBAAA,OAAA,EAAI,WAAU,0BAAyB,SAAS,SAC/C,UAAC,oBAAA,OAAA,CAAA,CAAM,EACT,CAAA,GACA;AAAA,MACC;AAAA,IAAA,GACH;AAAA,IACC,oBAAA,OAAA,EAAI,WAAU,qBAAqB,UAAQ,SAAA;AAAA,EAAA,EAC9C,CAAA,EACF,CAAA;AAEJ;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/Modal/index.tsx"],"sourcesContent":["import { IconX } from '@components/icons'\nimport classNames from 'classnames'\nimport { If } from '../misc'\n\nimport './styles.scss'\n\ntype ModalLayout = 'default' | 'centralized'\n\ntype ModalProps = {\n isOpen: boolean\n onClose?: () => void\n headerContent?: React.ReactNode | string | JSX.Element | JSX.Element[]\n content?: React.ReactNode | string | JSX.Element | JSX.Element[]\n layoutMobile?: ModalLayout\n layoutDesktop?: ModalLayout\n}\n\nexport const Modal = ({\n isOpen,\n onClose,\n headerContent,\n content,\n layoutMobile = 'default',\n layoutDesktop = 'default',\n}: ModalProps) => {\n if (!isOpen) return null\n\n const modalClasses = classNames('au-modal', {\n 'au-modal--is-open': isOpen,\n 'au-modal--mobile-centralized': layoutMobile === 'centralized',\n 'au-modal--desktop-centralized': layoutDesktop === 'centralized',\n })\n\n return (\n <div className={modalClasses}>\n <div className=\"au-modal__container\">\n <div className=\"au-modal__header\">\n <If condition={!!onClose}>\n <button className=\"au-modal__header-close\" onClick={onClose}>\n <IconX />\n </button>\n </If>\n {headerContent}\n </div>\n <div className=\"au-modal__content\">{content}</div>\n </div>\n </div>\n )\n}\n"],"names":["If"],"mappings":";;;;;AAiBO,MAAM,QAAQ,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,gBAAgB;AAClB,MAAkB;AACZ,MAAA,CAAC,OAAe,QAAA;AAEd,QAAA,eAAe,WAAW,YAAY;AAAA,IAC1C,qBAAqB;AAAA,IACrB,gCAAgC,iBAAiB;AAAA,IACjD,iCAAiC,kBAAkB;AAAA,EAAA,CACpD;AAED,6BACG,OAAI,EAAA,WAAW,cACd,UAAC,qBAAA,OAAA,EAAI,WAAU,uBACb,UAAA;AAAA,IAAC,qBAAA,OAAA,EAAI,WAAU,oBACb,UAAA;AAAA,MAAA,oBAACA,MAAG,EAAA,WAAW,CAAC,CAAC,SACjB,UAAC,oBAAA,UAAA,EAAO,WAAU,0BAAyB,SAAS,SAClD,UAAC,oBAAA,OAAA,CAAA,CAAM,EACT,CAAA,GACA;AAAA,MACC;AAAA,IAAA,GACH;AAAA,IACC,oBAAA,OAAA,EAAI,WAAU,qBAAqB,UAAQ,SAAA;AAAA,EAAA,EAC9C,CAAA,EACF,CAAA;AAEJ;"}
@@ -1 +1 @@
1
- .au-modal{height:100vh;width:100vw;position:fixed;top:0;left:0;bottom:0;right:0;background-color:#16181dcc;opacity:0;visibility:hidden;pointer-events:none;transition:all .3s ease;z-index:5}@keyframes slideInY{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideInX{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideCentralized{0%{transform:translate(-50%,calc(100% + 12px))}to{transform:translate(-50%,-50%)}}.au-modal--is-open{opacity:1;visibility:visible;pointer-events:all}.au-modal--is-open .au-modal__container{animation:slideInY .3s ease forwards}.au-modal--is-open.au-modal--mobile-centralized .au-modal__container{animation:slideCentralized .3s ease forwards}@media (min-width: 600px){.au-modal--is-open.au-modal--desktop-centralized .au-modal__container{animation:slideCentralized .3s ease forwards}.au-modal--is-open:not(.au-modal--desktop-centralized) .au-modal__container{animation:slideInX .3s ease forwards}}.au-modal__container{background-color:#fff;border-radius:16px 16px 0 0;padding:16px;position:fixed;z-index:6;bottom:0;display:flex;flex-direction:column;justify-content:space-between;gap:16px;width:100%;max-height:90vh}.au-modal.au-modal--mobile-centralized .au-modal__container{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:90%;max-width:500px;height:min-content;border-radius:16px;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.au-modal:not(.au-modal--desktop-centralized) .au-modal__container{border-radius:16px 0 0 16px;box-shadow:0 24px 56px #7686ad14,0 12px 12px #0048db0a;top:0;right:0;bottom:auto;left:auto;margin:0;height:100vh;height:100dvh;max-width:414px;max-height:100vh}.au-modal.au-modal--desktop-centralized .au-modal__container{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;display:flex;max-width:500px;gap:16px;height:min-content;flex-direction:column;border-radius:16px}}.au-modal__header{position:relative}.au-modal__header-close{cursor:pointer;display:flex;justify-content:end;width:100%}.au-modal__content{height:calc(100% - 150px);overflow-y:auto;flex:1}.au-modal__content::-webkit-scrollbar{width:16px}.au-modal__content::-webkit-scrollbar-track{background:#f4f7fb;border-radius:32px}.au-modal__content::-webkit-scrollbar-thumb{background:#0048db;border-radius:8px;border:4px solid #f4f7fb}.au-modal__content::-webkit-scrollbar-thumb:hover{background:#1737a4;transition:all .3s ease}
1
+ .au-modal{height:100vh;width:100vw;position:fixed;top:0;left:0;bottom:0;right:0;background-color:#16181dcc;opacity:0;visibility:hidden;pointer-events:none;transition:all .3s ease;z-index:5}@keyframes slideInY{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideInX{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideCentralized{0%{transform:translate(-50%,calc(100% + 12px))}to{transform:translate(-50%,-50%)}}.au-modal--is-open{opacity:1;visibility:visible;pointer-events:all}.au-modal--is-open .au-modal__container{animation:slideInY .3s ease forwards}.au-modal--is-open.au-modal--mobile-centralized .au-modal__container{animation:slideCentralized .3s ease forwards}@media (min-width: 600px){.au-modal--is-open.au-modal--desktop-centralized .au-modal__container{animation:slideCentralized .3s ease forwards}.au-modal--is-open:not(.au-modal--desktop-centralized) .au-modal__container{animation:slideInX .3s ease forwards}}.au-modal__container{background-color:#fff;border-radius:16px 16px 0 0;padding:16px;position:fixed;z-index:6;bottom:0;display:flex;flex-direction:column;justify-content:space-between;gap:16px;width:100%;max-height:90vh}.au-modal.au-modal--mobile-centralized .au-modal__container{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:90%;max-width:500px;height:min-content;border-radius:16px;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.au-modal:not(.au-modal--desktop-centralized) .au-modal__container{border-radius:16px 0 0 16px;box-shadow:0 24px 56px #7686ad14,0 12px 12px #0048db0a;top:0;right:0;bottom:auto;left:auto;margin:0;height:100vh;height:100dvh;max-width:414px;max-height:100vh}.au-modal.au-modal--desktop-centralized .au-modal__container{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;display:flex;max-width:500px;gap:16px;height:min-content;flex-direction:column;border-radius:16px}}.au-modal__header{position:relative}.au-modal__header-close{background-color:transparent;border:none;cursor:pointer;display:flex;justify-content:end;width:100%}.au-modal__content{height:calc(100% - 150px);overflow-y:auto;flex:1}.au-modal__content::-webkit-scrollbar{width:16px}.au-modal__content::-webkit-scrollbar-track{background:#f4f7fb;border-radius:32px}.au-modal__content::-webkit-scrollbar-thumb{background:#0048db;border-radius:8px;border:4px solid #f4f7fb}.au-modal__content::-webkit-scrollbar-thumb:hover{background:#1737a4;transition:all .3s ease}
@@ -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-D_iASp38.js";
4
3
  import { Portal } from "../Portal/index.es.js";
4
+ import { B as BREAKPOINT_MD } from "../../tokens-D_iASp38.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 @@
1
+ export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface CarouselProps {
3
2
  items: JSX.Element[];
4
3
  type: 'pages' | 'scrollbar';
@@ -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-uWXGnhjd.js";
7
+ import { S } from "../../index-CL0DrUGQ.js";
8
8
  export {
9
9
  S as Segment
10
10
  };
@@ -9,10 +9,10 @@ import { IconSlash } from "../icons/IconSlash/index.es.js";
9
9
  import { Modal } from "../Modal/index.es.js";
10
10
  import { Text } from "../Text/index.es.js";
11
11
  import { Conditional } from "../Conditional/index.es.js";
12
- import { c as COLOR_NEUTRAL_40 } from "../../tokens-D_iASp38.js";
13
12
  import { i as isMobile } from "../../isMobile-RyKhTreE.js";
14
13
  import { F as Field } from "../../index-ZE6zszxw.js";
15
14
  import { useState, useRef, useEffect } from "react";
15
+ import { c as COLOR_NEUTRAL_40 } from "../../tokens-D_iASp38.js";
16
16
  import './styles.css';const useSelectField = (options, initialValue, onChange, onBlur, disabled, register, autocomplete = false, fullScreenOptions = false) => {
17
17
  var _a;
18
18
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -9,5 +9,9 @@ export type TagProps = {
9
9
  children?: React.ReactNode;
10
10
  customIcon?: string | JSX.Element;
11
11
  fullWidth?: boolean;
12
+ actionButton?: {
13
+ content?: string;
14
+ onClick?: () => void;
15
+ };
12
16
  };
13
- export declare const Tag: ({ status, border, size, type, color, customIcon, text, children, fullWidth, }: TagProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const Tag: ({ status, border, size, type, color, customIcon, text, children, fullWidth, actionButton, }: TagProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,8 +6,8 @@ import { IconAlertTriangle } from "../icons/IconAlertTriangle/index.es.js";
6
6
  import { IconCheck } from "../icons/IconCheck/index.es.js";
7
7
  import { IconInfo } from "../icons/IconInfo/index.es.js";
8
8
  import { IconSlash } from "../icons/IconSlash/index.es.js";
9
- import { C as COLOR_SUCCESS_50, b as COLOR_ERROR_50, e as COLOR_WARNING_50, f as COLOR_INFO_50, g as COLOR_BRAND_CYAN_50, d as COLOR_NEUTRAL_70 } from "../../tokens-D_iASp38.js";
10
9
  import { Conditional } from "../Conditional/index.es.js";
10
+ import { C as COLOR_SUCCESS_50, b as COLOR_ERROR_50, e as COLOR_WARNING_50, f as COLOR_INFO_50, g as COLOR_BRAND_CYAN_50, d as COLOR_NEUTRAL_70 } from "../../tokens-D_iASp38.js";
11
11
  import './styles.css';const Tag = ({
12
12
  status,
13
13
  border = "square",
@@ -17,7 +17,8 @@ import './styles.css';const Tag = ({
17
17
  customIcon,
18
18
  text,
19
19
  children,
20
- fullWidth
20
+ fullWidth,
21
+ actionButton
21
22
  }) => {
22
23
  const statusMap = {
23
24
  success: {
@@ -72,7 +73,21 @@ import './styles.css';const Tag = ({
72
73
  ) })
73
74
  }
74
75
  ),
75
- /* @__PURE__ */ jsx("p", { className: `au-tag__content-support-text`, children: supportText })
76
+ /* @__PURE__ */ jsx("p", { className: `au-tag__content-support-text`, children: supportText }),
77
+ /* @__PURE__ */ jsx(
78
+ Conditional,
79
+ {
80
+ condition: !!actionButton,
81
+ renderIf: /* @__PURE__ */ jsx(
82
+ "button",
83
+ {
84
+ className: "au-tag__action-btn",
85
+ onClick: actionButton == null ? void 0 : actionButton.onClick,
86
+ children: actionButton == null ? void 0 : actionButton.content
87
+ }
88
+ )
89
+ }
90
+ )
76
91
  ] }),
77
92
  children
78
93
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../lib/components/Tag/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport {\n IconAlertOctagon,\n IconAlertTriangle,\n IconCheck,\n IconInfo,\n IconSlash,\n} from '@components/icons'\nimport {\n COLOR_ERROR_50,\n COLOR_INFO_50,\n COLOR_SUCCESS_50,\n COLOR_WARNING_50,\n COLOR_BRAND_CYAN_50,\n COLOR_NEUTRAL_70,\n} from '@core/tokens'\nimport './styles.scss'\nimport { Conditional } from '@components/misc'\n\nexport type TagProps = {\n status: 'info' | 'success' | 'error' | 'warning' | 'support' | 'neutral'\n border?: 'rounded' | 'square'\n type?: 'read-only' | 'badge'\n color?: 'primary' | 'secondary'\n size?: 'small' | 'medium' | 'large'\n text: string\n children?: React.ReactNode\n customIcon?: string | JSX.Element\n fullWidth?: boolean\n}\n\nexport const Tag = ({\n status,\n border = 'square',\n size = 'medium',\n type = 'read-only',\n color = 'primary',\n customIcon,\n text,\n children,\n fullWidth,\n}: TagProps) => {\n const statusMap = {\n success: {\n option: 'success',\n icon: <IconCheck rawColor={COLOR_SUCCESS_50} />,\n },\n error: {\n option: 'error',\n icon: <IconAlertOctagon rawColor={COLOR_ERROR_50} />,\n },\n warning: {\n option: 'warning',\n icon: <IconAlertTriangle rawColor={COLOR_WARNING_50} />,\n },\n info: { option: 'info', icon: <IconInfo rawColor={COLOR_INFO_50} /> },\n support: {\n option: 'support',\n icon: <IconInfo rawColor={COLOR_BRAND_CYAN_50} />,\n },\n neutral: {\n option: 'neutral',\n icon: <IconSlash rawColor={COLOR_NEUTRAL_70} />,\n },\n custom: {\n option: 'custom',\n icon: customIcon,\n },\n }\n\n const tagClasses = classNames('au-tag', {\n [`au-tag--${statusMap[status].option}`]: statusMap[status].option,\n [`au-tag--size-${size}`]: !!size,\n [`au-tag--type-${type}`]: !!type,\n [`au-tag--border-${border}`]: !!border,\n [`au-tag--color-${color}`]: !!color,\n [`au-tag--full-width`]: !!fullWidth,\n })\n\n const isBadgeTag = type === 'badge'\n const supportText = isBadgeTag ? text.toUpperCase() : text\n\n return (\n <div className={tagClasses}>\n <div className=\"au-tag__content\">\n <Conditional\n condition={!isBadgeTag}\n renderIf={\n <div className=\"au-tag__content-icon\">\n <Conditional\n condition={!!customIcon}\n renderIf={customIcon}\n renderElse={statusMap[status].icon}\n />\n </div>\n }\n />\n <p className={`au-tag__content-support-text`}>{supportText}</p>\n </div>\n {children}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;AA+BO,MAAM,MAAM,CAAC;AAAA,EAClB;AAAA,EACA,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAgB;AACd,QAAM,YAAY;AAAA,IAChB,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,WAAU,EAAA,UAAU,iBAAkB,CAAA;AAAA,IAC/C;AAAA,IACA,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,MAAM,oBAAC,kBAAiB,EAAA,UAAU,eAAgB,CAAA;AAAA,IACpD;AAAA,IACA,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,mBAAkB,EAAA,UAAU,iBAAkB,CAAA;AAAA,IACvD;AAAA,IACA,MAAM,EAAE,QAAQ,QAAQ,MAAO,oBAAA,UAAA,EAAS,UAAU,cAAA,CAAe,EAAG;AAAA,IACpE,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,UAAS,EAAA,UAAU,oBAAqB,CAAA;AAAA,IACjD;AAAA,IACA,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,WAAU,EAAA,UAAU,iBAAkB,CAAA;AAAA,IAC/C;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAGI,QAAA,aAAa,WAAW,UAAU;AAAA,IACtC,CAAC,WAAW,UAAU,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,MAAM,EAAE;AAAA,IAC3D,CAAC,gBAAgB,IAAI,EAAE,GAAG,CAAC,CAAC;AAAA,IAC5B,CAAC,gBAAgB,IAAI,EAAE,GAAG,CAAC,CAAC;AAAA,IAC5B,CAAC,kBAAkB,MAAM,EAAE,GAAG,CAAC,CAAC;AAAA,IAChC,CAAC,iBAAiB,KAAK,EAAE,GAAG,CAAC,CAAC;AAAA,IAC9B,CAAC,oBAAoB,GAAG,CAAC,CAAC;AAAA,EAAA,CAC3B;AAED,QAAM,aAAa,SAAS;AAC5B,QAAM,cAAc,aAAa,KAAK,YAAA,IAAgB;AAGpD,SAAA,qBAAC,OAAI,EAAA,WAAW,YACd,UAAA;AAAA,IAAC,qBAAA,OAAA,EAAI,WAAU,mBACb,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,CAAC;AAAA,UACZ,UACE,oBAAC,OAAI,EAAA,WAAU,wBACb,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,CAAC,CAAC;AAAA,cACb,UAAU;AAAA,cACV,YAAY,UAAU,MAAM,EAAE;AAAA,YAAA;AAAA,UAAA,GAElC;AAAA,QAAA;AAAA,MAEJ;AAAA,MACC,oBAAA,KAAA,EAAE,WAAW,gCAAiC,UAAY,aAAA;AAAA,IAAA,GAC7D;AAAA,IACC;AAAA,EACH,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/Tag/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport {\n IconAlertOctagon,\n IconAlertTriangle,\n IconCheck,\n IconInfo,\n IconSlash,\n} from '@components/icons'\nimport {\n COLOR_ERROR_50,\n COLOR_INFO_50,\n COLOR_SUCCESS_50,\n COLOR_WARNING_50,\n COLOR_BRAND_CYAN_50,\n COLOR_NEUTRAL_70,\n} from '@core/tokens'\nimport './styles.scss'\nimport { Conditional } from '@components/misc'\n\nexport type TagProps = {\n status: 'info' | 'success' | 'error' | 'warning' | 'support' | 'neutral'\n border?: 'rounded' | 'square'\n type?: 'read-only' | 'badge'\n color?: 'primary' | 'secondary'\n size?: 'small' | 'medium' | 'large'\n text: string\n children?: React.ReactNode\n customIcon?: string | JSX.Element\n fullWidth?: boolean\n actionButton?: { content?: string; onClick?: () => void }\n}\n\nexport const Tag = ({\n status,\n border = 'square',\n size = 'medium',\n type = 'read-only',\n color = 'primary',\n customIcon,\n text,\n children,\n fullWidth,\n actionButton,\n}: TagProps) => {\n const statusMap = {\n success: {\n option: 'success',\n icon: <IconCheck rawColor={COLOR_SUCCESS_50} />,\n },\n error: {\n option: 'error',\n icon: <IconAlertOctagon rawColor={COLOR_ERROR_50} />,\n },\n warning: {\n option: 'warning',\n icon: <IconAlertTriangle rawColor={COLOR_WARNING_50} />,\n },\n info: { option: 'info', icon: <IconInfo rawColor={COLOR_INFO_50} /> },\n support: {\n option: 'support',\n icon: <IconInfo rawColor={COLOR_BRAND_CYAN_50} />,\n },\n neutral: {\n option: 'neutral',\n icon: <IconSlash rawColor={COLOR_NEUTRAL_70} />,\n },\n custom: {\n option: 'custom',\n icon: customIcon,\n },\n }\n\n const tagClasses = classNames('au-tag', {\n [`au-tag--${statusMap[status].option}`]: statusMap[status].option,\n [`au-tag--size-${size}`]: !!size,\n [`au-tag--type-${type}`]: !!type,\n [`au-tag--border-${border}`]: !!border,\n [`au-tag--color-${color}`]: !!color,\n [`au-tag--full-width`]: !!fullWidth,\n })\n\n const isBadgeTag = type === 'badge'\n const supportText = isBadgeTag ? text.toUpperCase() : text\n\n return (\n <div className={tagClasses}>\n <div className=\"au-tag__content\">\n <Conditional\n condition={!isBadgeTag}\n renderIf={\n <div className=\"au-tag__content-icon\">\n <Conditional\n condition={!!customIcon}\n renderIf={customIcon}\n renderElse={statusMap[status].icon}\n />\n </div>\n }\n />\n <p className={`au-tag__content-support-text`}>{supportText}</p>\n\n <Conditional\n condition={!!actionButton}\n renderIf={\n <button\n className=\"au-tag__action-btn\"\n onClick={actionButton?.onClick}>\n {actionButton?.content}\n </button>\n }\n />\n </div>\n {children}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;AAgCO,MAAM,MAAM,CAAC;AAAA,EAClB;AAAA,EACA,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAgB;AACd,QAAM,YAAY;AAAA,IAChB,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,WAAU,EAAA,UAAU,iBAAkB,CAAA;AAAA,IAC/C;AAAA,IACA,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,MAAM,oBAAC,kBAAiB,EAAA,UAAU,eAAgB,CAAA;AAAA,IACpD;AAAA,IACA,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,mBAAkB,EAAA,UAAU,iBAAkB,CAAA;AAAA,IACvD;AAAA,IACA,MAAM,EAAE,QAAQ,QAAQ,MAAO,oBAAA,UAAA,EAAS,UAAU,cAAA,CAAe,EAAG;AAAA,IACpE,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,UAAS,EAAA,UAAU,oBAAqB,CAAA;AAAA,IACjD;AAAA,IACA,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,oBAAC,WAAU,EAAA,UAAU,iBAAkB,CAAA;AAAA,IAC/C;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAGI,QAAA,aAAa,WAAW,UAAU;AAAA,IACtC,CA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content{display:flex;gap:8px;justify-content:center;align-items:center}.au-tag__content-icon .au-icon,.au-tag__content-icon .au-icon>svg{width:16px;height:16px}.au-tag__content-support-text{color:#16181d;font-size:12px;font-weight:600;line-height:18px}.au-tag--size-small{height:26px;padding:4px 8px}.au-tag--size-medium{height:36px}.au-tag--size-large{height:38px}.au-tag--size-large-support-text{font-size:14px;line-height:22px}.au-tag--border-rounded{border-radius:500px}.au-tag--color-primary.au-tag--info{background-color:#eee6ff}.au-tag--color-primary.au-tag--success{background-color:#e5fff0}.au-tag--color-primary.au-tag--error{background-color:#ffe5e5}.au-tag--color-primary.au-tag--warning{background-color:#fff0e6}.au-tag--color-primary.au-tag--support{background-color:#f1fcff}.au-tag--color-primary.au-tag--neutral{background-color:#e2e4e9}.au-tag--color-secondary.au-tag--info{background-color:#d4bfff}.au-tag--color-secondary.au-tag--success{background-color:#a1e5bd}.au-tag--color-secondary.au-tag--error{background-color:#ffbfbf}.au-tag--color-secondary.au-tag--warning{background-color:#ffdabf}.au-tag--color-secondary.au-tag--support{background-color:#ccf3ff}.au-tag--color-secondary.au-tag--neutral{background-color:#c4c9d4}.au-tag--type-badge.au-tag--info p{color:#46008c}.au-tag--type-badge.au-tag--error p{color:#731111}.au-tag--type-badge.au-tag--success p{color:#08331a}.au-tag--type-badge.au-tag--warning p{color:#803500}.au-tag--type-badge.au-tag--support p{color:#004155}.au-tag--type-badge.au-tag--size-large{height:36px;font-size:12px;line-height:18px}.au-tag--full-width{width:100%}
1
+ .au-tag{font-family:"Source Sans 3",sans-serif;display:flex;justify-content:center;border-radius:8px;padding:8px;width:fit-content}.au-tag__content{display:flex;gap:8px;justify-content:center;align-items:center}.au-tag__content-icon .au-icon,.au-tag__content-icon .au-icon>svg{width:16px;height:16px}.au-tag__content-support-text{color:#16181d;font-size:12px;font-weight:600;line-height:18px}.au-tag--size-small{height:26px;padding:4px 8px}.au-tag--size-medium{height:36px}.au-tag--size-large{height:38px}.au-tag--size-large-support-text{font-size:14px;line-height:22px}.au-tag--border-rounded{border-radius:500px}.au-tag--color-primary.au-tag--info{background-color:#eee6ff}.au-tag--color-primary.au-tag--success{background-color:#e5fff0}.au-tag--color-primary.au-tag--error{background-color:#ffe5e5}.au-tag--color-primary.au-tag--warning{background-color:#fff0e6}.au-tag--color-primary.au-tag--support{background-color:#f1fcff}.au-tag--color-primary.au-tag--neutral{background-color:#e2e4e9}.au-tag--color-secondary.au-tag--info{background-color:#d4bfff}.au-tag--color-secondary.au-tag--success{background-color:#a1e5bd}.au-tag--color-secondary.au-tag--error{background-color:#ffbfbf}.au-tag--color-secondary.au-tag--warning{background-color:#ffdabf}.au-tag--color-secondary.au-tag--support{background-color:#ccf3ff}.au-tag--color-secondary.au-tag--neutral{background-color:#c4c9d4}.au-tag--type-badge.au-tag--info p{color:#46008c}.au-tag--type-badge.au-tag--error p{color:#731111}.au-tag--type-badge.au-tag--success p{color:#08331a}.au-tag--type-badge.au-tag--warning p{color:#803500}.au-tag--type-badge.au-tag--support p{color:#004155}.au-tag--type-badge.au-tag--size-large{height:36px;font-size:12px;line-height:18px}.au-tag--full-width{width:100%}.au-tag__action-btn{font-family:"Source Sans 3",sans-serif;background-color:transparent;border:none;color:#0048db;cursor:pointer;font-size:12px;font-weight:600;line-height:19px}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type TextVariant = 'display-large' | 'display-medium' | 'display-small' | 'heading-big' | 'heading-large' | 'heading-medium' | 'heading-small' | 'heading-micro' | 'body-big' | 'body-large' | 'body-medium' | 'body-small' | 'caption';
3
2
  type TextWeight = 'bold' | 'semibold' | 'medium' | 'regular' | 'light';
4
3
  type TextColor = 'common' | 'secondary' | 'white';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type PortalHolderProps = {
3
2
  withPortal?: boolean;
4
3
  children: React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const useEmailAutocomplete: (propsOnChange?: ((value: string) => void) | undefined) => {
3
2
  inputValue: string;
4
3
  setInputValue: import('react').Dispatch<import('react').SetStateAction<string>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type FieldInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
3
2
  inputRef?: React.RefObject<HTMLInputElement>;
4
3
  customclass?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type FieldLabelProps = {
3
2
  id?: string;
4
3
  text?: string | React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type FieldRootProps = {
3
2
  children: React.ReactNode;
4
3
  disabled?: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type UseFieldTextAreaProps = {
3
2
  onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
4
3
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
3
2
  showOptionalLabel?: boolean;
4
3
  requiredInput?: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type OptionProps = {
3
2
  value: string;
4
3
  label: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type TextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
3
2
  showOptionalLabel?: boolean;
4
3
  success?: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type UseTokenInputProps = {
3
2
  size: number;
4
3
  onComplete?: (token: string) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * A helper component designed to address z-index conflicts within modals and dialogs.
4
3
  * This component ensures that the element remains fixed in its position, unaffected by other elements
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type UseOutsideClickProps = {
3
2
  rootEl: React.RefObject<HTMLDivElement>;
4
3
  breakpoint?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type IconsPresentationProps = {
3
2
  iconsMap: Record<string, React.FC>;
4
3
  };
@@ -1,11 +1,11 @@
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-BzVR1Tq6.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-C8AM9yBn.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-D_iASp38.js";
8
7
  import { a as above } from "./screen-DfYo7XQ_.js";
8
+ import { B as BREAKPOINT_MD } from "./tokens-D_iASp38.js";
9
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 */
@@ -238,4 +238,4 @@ export {
238
238
  DatepickerCalendar as a,
239
239
  getDefaultDate as g
240
240
  };
241
- //# sourceMappingURL=index-RHj6RFlT.js.map
241
+ //# sourceMappingURL=index-C1N6rwrZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-RHj6RFlT.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,GAA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BAAC,OAAI,EAAA,WAAU,oCAAmC,SAAS,SAAS;AAAA,IACpE,qBAAC,OAAI,EAAA,WAAU,gCACb,UAAA;AAAA,MAAA;AAAA,QAACC;AAAAA,QAAA;AAAA,UACC,WAAS;AAAA,UACT,WAAU;AAAA,UACV,UAAU;AAAA,UACV,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU;AAAA,UACV,UAAA;AAAA,YAAC,oBAAA,gBAAA,EAAe,kBAAkB,sBAAuB,CAAA;AAAA,YACzD;AAAA,cAACC;AAAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,cAAa;AAAA,gBACb,UAAA;AAAA,kBAAC,oBAAAC,2CAAA,EACE,UAAC,CAAA,QACC,oBAAAC,2CAAA,EAAmB,WAAU,mCAC3B,UAAA,WAAW,GAAG,EAAA,CACjB,EAEJ,CAAA;AAAA,kBACA,oBAACC,2CACE,EAAA,UAAA,CAAC,SACA;AAAA,oBAACC;AAAAA,oBAAA;AAAA,sBACC,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-C1N6rwrZ.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,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AU,oCAAmC,SAAS,SAAS;AAAA,IACpE,qBAAC,OAAI,EAAA,WAAU,gCACb,UAAA;AAAA,MAAA;AAAA,QAACC;AAAAA,QAAA;AAAA,UACC,WAAS;AAAA,UACT,WAAU;AAAA,UACV,UAAU;AAAA,UACV,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU;AAAA,UACV,UAAA;AAAA,YAAC,oBAAA,gBAAA,EAAe,kBAAkB,sBAAuB,CAAA;AAAA,YACzD;AAAA,cAACC;AAAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,cAAa;AAAA,gBACb,UAAA;AAAA,kBAAC,oBAAAC,2CAAA,EACE,UAAC,CAAA,QACC,oBAAAC,2CAAA,EAAmB,WAAU,mCAC3B,UAAA,WAAW,GAAG,EAAA,CACjB,EAEJ,CAAA;AAAA,kBACA,oBAACC,2CACE,EAAA,UAAA,CAAC,SACA;AAAA,oBAACC;AAAAA,oBAAA;AAAA,sBACC,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;"}
@@ -3,7 +3,7 @@ import "./index-CweZ_OcN.js";
3
3
  import "./components/Icon/index.es.js";
4
4
  import { IconChevronLeft } from "./components/icons/IconChevronLeft/index.es.js";
5
5
  import { IconChevronRight } from "./components/icons/IconChevronRight/index.es.js";
6
- import { S as Segment } from "./index-uWXGnhjd.js";
6
+ import { S as Segment } from "./index-CL0DrUGQ.js";
7
7
  import $dbSRa$react__default, { createContext, useContext, useState, useRef, useCallback, useEffect, useMemo, forwardRef } from "react";
8
8
  import "react-dom";
9
9
  createContext(null);
@@ -5686,4 +5686,4 @@ export {
5686
5686
  $dfd62f934fc76fed$export$e11f8ba65d857bff as e,
5687
5687
  $dfd62f934fc76fed$export$5d847498420df57b as f
5688
5688
  };
5689
- //# sourceMappingURL=index-BzVR1Tq6.js.map
5689
+ //# sourceMappingURL=index-C8AM9yBn.js.map