@consumidor-positivo/aurora 0.0.76 → 0.0.78

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.
@@ -0,0 +1,135 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import $dbSRa$react__default, { useState, useEffect } from "react";
3
+ import { c as classNames } from "../../index-CweZ_OcN.js";
4
+ import "../Icon/index.es.js";
5
+ import { IconCheck } from "../icons/IconCheck/index.es.js";
6
+ import { F as Field } from "../../index-DfksciAR.js";
7
+ import { m as COLOR_NEUTRAL_00 } from "../../tokens-DGTtjw-_.js";
8
+ import { Conditional } from "../Conditional/index.es.js";
9
+ import { Text } from "../Text/index.es.js";
10
+ import './styles.css';const CheckboxField = ({
11
+ label,
12
+ error,
13
+ errorMessage,
14
+ disabled,
15
+ id,
16
+ style,
17
+ ...props
18
+ }) => {
19
+ const checkboxClasses = classNames("au-checkbox", {
20
+ "au-checkbox--error": !!error,
21
+ "au-checkbox--disabled": !!disabled
22
+ });
23
+ const getSafeId = (id2) => {
24
+ return id2 ? id2 : `au-checkbox-${Math.random()}`;
25
+ };
26
+ const [safeId] = useState(getSafeId(id));
27
+ return /* @__PURE__ */ jsxs("div", { className: checkboxClasses, style, children: [
28
+ /* @__PURE__ */ jsxs("label", { htmlFor: safeId, className: "au-checkbox__holder", children: [
29
+ /* @__PURE__ */ jsx(
30
+ "input",
31
+ {
32
+ className: "au-checkbox__input",
33
+ type: "checkbox",
34
+ id: safeId,
35
+ disabled,
36
+ ...props
37
+ }
38
+ ),
39
+ /* @__PURE__ */ jsx("span", { className: "au-checkbox__check", children: /* @__PURE__ */ jsx(IconCheck, { rawColor: COLOR_NEUTRAL_00 }) }),
40
+ /* @__PURE__ */ jsx("span", { className: "au-checkbox__label", children: label })
41
+ ] }),
42
+ /* @__PURE__ */ jsx(Field.ErrorMessage, { hasError: !!error, message: errorMessage })
43
+ ] });
44
+ };
45
+ const useCheckboxGroup = ({ onChange, name }) => {
46
+ const getSafeName = (name2) => {
47
+ return name2 ? name2 : `au-checkbox-group-${Math.random()}`;
48
+ };
49
+ const [safeName] = useState(getSafeName(name));
50
+ const [selectedOptions, setSelectedOptions] = useState([{}]);
51
+ function handleSelectOption(checked, option, index) {
52
+ setSelectedOptions({
53
+ ...selectedOptions,
54
+ [index]: checked ? option : false
55
+ });
56
+ }
57
+ useEffect(() => {
58
+ const returnResponse = Object.values(selectedOptions).filter(
59
+ (item) => !!item
60
+ );
61
+ if (onChange) {
62
+ const event = {
63
+ target: {
64
+ checked: returnResponse
65
+ }
66
+ };
67
+ onChange(event);
68
+ }
69
+ }, [selectedOptions]);
70
+ return {
71
+ handleSelectOption,
72
+ safeName
73
+ };
74
+ };
75
+ const CheckboxGroup = ({
76
+ name,
77
+ defaultValue,
78
+ orientation = "vertical",
79
+ label,
80
+ error,
81
+ errorMessage,
82
+ required = false,
83
+ children,
84
+ onChange,
85
+ onFocus
86
+ }) => {
87
+ const groupClass = classNames("au-checkbox-group", {
88
+ "au-checkbox-group--horizontal": orientation === "horizontal"
89
+ });
90
+ const { handleSelectOption, safeName } = useCheckboxGroup({ onChange, name });
91
+ const childrenWithProps = $dbSRa$react__default.Children.map(children, (child, index) => {
92
+ if ($dbSRa$react__default.isValidElement(child)) {
93
+ const childProps = child.props;
94
+ return /* @__PURE__ */ jsx(
95
+ CheckboxField,
96
+ {
97
+ name: safeName,
98
+ error,
99
+ defaultChecked: defaultValue === childProps.value,
100
+ onChange: (e) => handleSelectOption(e.target.checked, childProps, index),
101
+ onFocus,
102
+ ...child.props
103
+ }
104
+ );
105
+ }
106
+ return child;
107
+ });
108
+ return /* @__PURE__ */ jsxs("div", { className: groupClass, children: [
109
+ /* @__PURE__ */ jsx(
110
+ Conditional,
111
+ {
112
+ condition: !!label,
113
+ renderIf: /* @__PURE__ */ jsxs(Text, { variant: "body-small", weight: "semibold", color: "secondary", children: [
114
+ label,
115
+ " ",
116
+ !!required && /* @__PURE__ */ jsx("span", { className: "au-checkbox-group__label--required", children: "*" })
117
+ ] })
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsx("div", { className: "au-checkbox-group__fields", children: childrenWithProps }),
121
+ /* @__PURE__ */ jsx(Field.ErrorMessage, { hasError: !!error, message: errorMessage })
122
+ ] });
123
+ };
124
+ const components = {
125
+ Field: CheckboxField,
126
+ Group: CheckboxGroup
127
+ };
128
+ Object.keys(components).forEach((key) => {
129
+ const component = components[key];
130
+ component.displayName = `Checkbox.${key}`;
131
+ });
132
+ export {
133
+ components as Checkbox
134
+ };
135
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/form/Checkbox/Field/index.tsx","../../../lib/components/form/Checkbox/Group/hook.tsx","../../../lib/components/form/Checkbox/Group/index.tsx","../../../lib/components/form/Checkbox/index.tsx"],"sourcesContent":["import { useState } from 'react'\nimport classNames from 'classnames'\nimport { IconCheck } from '@components/icons'\nimport { COLOR_NEUTRAL_00 } from '@core/tokens'\nimport Field from '../../Field'\n\nimport { CheckboxFieldProps } from '../types'\nimport './styles.scss'\n\nexport const CheckboxField = ({\n label,\n error,\n errorMessage,\n disabled,\n id,\n style,\n ...props\n}: CheckboxFieldProps) => {\n const checkboxClasses = classNames('au-checkbox', {\n 'au-checkbox--error': !!error,\n 'au-checkbox--disabled': !!disabled,\n })\n\n const getSafeId = (id: CheckboxFieldProps['id']) => {\n return id ? id : `au-checkbox-${Math.random()}`\n }\n const [safeId] = useState(getSafeId(id))\n\n return (\n <div className={checkboxClasses} style={style}>\n <label htmlFor={safeId} className=\"au-checkbox__holder\">\n <input\n className=\"au-checkbox__input\"\n type=\"checkbox\"\n id={safeId}\n disabled={disabled}\n {...props}\n />\n <span className=\"au-checkbox__check\">\n <IconCheck rawColor={COLOR_NEUTRAL_00} />\n </span>\n <span className=\"au-checkbox__label\">{label}</span>\n </label>\n <Field.ErrorMessage hasError={!!error} message={errorMessage} />\n </div>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { CheckboxFieldProps } from '../types'\n\ntype UseCheckboxGroupProps = {\n name?: string\n onChange?: React.ChangeEventHandler<HTMLInputElement>\n}\n\nexport const useCheckboxGroup = ({ onChange, name }: UseCheckboxGroupProps) => {\n const getSafeName = (name?: string): string => {\n return name ? name : `au-checkbox-group-${Math.random()}`\n }\n const [safeName] = useState(getSafeName(name))\n\n const [selectedOptions, setSelectedOptions] = useState([{}])\n\n function handleSelectOption(\n checked: boolean,\n option: CheckboxFieldProps,\n index: number,\n ) {\n setSelectedOptions({\n ...selectedOptions,\n [index]: checked ? option : false,\n })\n }\n\n useEffect(() => {\n const returnResponse = Object.values(selectedOptions).filter(\n (item) => !!item,\n )\n\n if (onChange) {\n const event = {\n target: {\n checked: returnResponse,\n },\n } as unknown as React.ChangeEvent<HTMLInputElement>\n\n onChange(event)\n }\n }, [selectedOptions])\n\n return {\n handleSelectOption,\n safeName,\n }\n}\n","import React from 'react'\nimport classNames from 'classnames'\nimport './styles.scss'\nimport Field from '@components/form/Field'\nimport { Conditional } from '@components/misc'\nimport { Text } from '@components/Text'\nimport { CheckboxField } from '../Field'\nimport { CheckboxFieldProps, CheckboxGroupProps } from '../types'\nimport { useCheckboxGroup } from './hook'\n\nexport const CheckboxGroup = ({\n name,\n defaultValue,\n orientation = 'vertical',\n label,\n error,\n errorMessage,\n required = false,\n children,\n onChange,\n onFocus,\n}: CheckboxGroupProps) => {\n const groupClass = classNames('au-checkbox-group', {\n 'au-checkbox-group--horizontal': orientation === 'horizontal',\n })\n\n const { handleSelectOption, safeName } = useCheckboxGroup({onChange, name})\n\n const childrenWithProps = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n const childProps = child.props as CheckboxFieldProps\n\n return (\n <CheckboxField\n name={safeName}\n error={error}\n defaultChecked={defaultValue === childProps.value}\n onChange={(e) =>\n handleSelectOption(e.target.checked, childProps, index)\n }\n onFocus={onFocus}\n {...child.props}\n />\n )\n }\n return child\n })\n\n return (\n <div className={groupClass}>\n <Conditional\n condition={!!label}\n renderIf={\n <Text variant=\"body-small\" weight=\"semibold\" color=\"secondary\">\n {label}{' '}\n {!!required && (\n <span className=\"au-checkbox-group__label--required\">*</span>\n )}\n </Text>\n }\n />\n <div className=\"au-checkbox-group__fields\">{childrenWithProps}</div>\n <Field.ErrorMessage hasError={!!error} message={errorMessage} />\n </div>\n )\n}\n","import { CheckboxField } from './Field'\nimport { CheckboxGroup } from './Group'\nimport { CheckboxFieldProps, CheckboxGroupProps } from './types'\n\ntype Components = {\n Field: React.FC<CheckboxFieldProps>\n Group: React.FC<CheckboxGroupProps>\n}\n\nconst components: Components = {\n Field: CheckboxField,\n Group: CheckboxGroup,\n}\n\nObject.keys(components).forEach((key) => {\n const component = components[key as keyof Components]\n component.displayName = `Checkbox.${key}`\n})\n\nexport { components as Checkbox }\n"],"names":["id","name","React"],"mappings":"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"}
@@ -1 +1 @@
1
- .au-checkbox{position:relative}.au-checkbox__holder{cursor:pointer;display:flex;gap:8px;align-items:start}.au-checkbox__input{position:absolute;opacity:0;width:0;height:0}.au-checkbox__input:checked~.au-checkbox__check{background-color:#0048db;border-color:#0048db}.au-checkbox__input:checked~.au-checkbox__check .au-icon svg{opacity:1}.au-checkbox__input:hover:not(:focus)~.au-checkbox__check{border-color:#0048db;outline:2px solid #F2F5FC}.au-checkbox__input:hover:not(:checked)~.au-checkbox__check{background-color:#f2f5fc}.au-checkbox__input:focus~.au-checkbox__check{box-shadow:0 0 0 1px #fff,0 0 0 3px #0048db}.au-checkbox__check{background-color:#fff;border:2px solid #454a54;border-radius:4px;height:24px;width:24px;transition:background-color .2s ease}.au-checkbox__check .au-icon svg{position:absolute;left:0;top:0;opacity:0;transition:opacity .2s ease}.au-checkbox__label{color:#454a54;font-family:"Source Sans 3",sans-serif;font-size:16px;line-height:24px;word-wrap:break-word;max-width:calc(100% - 32px)}.au-checkbox--error .au-checkbox__check{border:2px solid #991717}.au-checkbox--disabled .au-checkbox__holder{cursor:not-allowed}.au-checkbox--disabled .au-checkbox__input:checked~.au-checkbox__check{background-color:#c4c9d4;border-color:#c4c9d4}.au-checkbox--disabled .au-checkbox__input:hover~.au-checkbox__check{border-color:#c4c9d4;outline:none}.au-checkbox--disabled .au-checkbox__input:hover:not(:checked)~.au-checkbox__check{background-color:inherit}.au-checkbox--disabled .au-checkbox__check{border:2px solid #c4c9d4}.au-checkbox--disabled .au-checkbox__label{color:#c4c9d4}
1
+ .au-checkbox{position:relative}.au-checkbox__holder{cursor:pointer;display:flex;gap:8px;align-items:start}.au-checkbox__input{position:absolute;opacity:0;width:0;height:0}.au-checkbox__input:checked~.au-checkbox__check{background-color:#0048db;border-color:#0048db}.au-checkbox__input:checked~.au-checkbox__check .au-icon svg{opacity:1}.au-checkbox__input:hover:not(:focus)~.au-checkbox__check{border-color:#0048db;outline:2px solid #F2F5FC}.au-checkbox__input:hover:not(:checked)~.au-checkbox__check{background-color:#f2f5fc}.au-checkbox__input:focus~.au-checkbox__check{box-shadow:0 0 0 1px #fff,0 0 0 3px #0048db}.au-checkbox__check{background-color:#fff;border:2px solid #454a54;border-radius:4px;height:24px;width:24px;transition:background-color .2s ease}.au-checkbox__check .au-icon svg{position:absolute;left:0;top:0;opacity:0;transition:opacity .2s ease}.au-checkbox__label{color:#454a54;font-family:"Source Sans 3",sans-serif;font-size:16px;line-height:24px;word-wrap:break-word;max-width:calc(100% - 32px)}.au-checkbox--error .au-checkbox__check{border:2px solid #991717}.au-checkbox--disabled .au-checkbox__holder{cursor:not-allowed}.au-checkbox--disabled .au-checkbox__input:checked~.au-checkbox__check{background-color:#c4c9d4;border-color:#c4c9d4}.au-checkbox--disabled .au-checkbox__input:hover~.au-checkbox__check{border-color:#c4c9d4;outline:none}.au-checkbox--disabled .au-checkbox__input:hover:not(:checked)~.au-checkbox__check{background-color:inherit}.au-checkbox--disabled .au-checkbox__check{border:2px solid #c4c9d4}.au-checkbox--disabled .au-checkbox__label{color:#c4c9d4}.au-checkbox-group{display:flex;flex-direction:column;gap:16px}.au-checkbox-group__label--required{color:#991717}.au-checkbox-group__fields{display:flex;flex-direction:column;gap:16px}.au-checkbox-group--horizontal .au-checkbox-group__fields{flex-direction:row}
@@ -298,6 +298,7 @@ import { IconVolumeX } from "../icons/IconVolumeX/index.es.js";
298
298
  import { IconWarning } from "../icons/IconWarning/index.es.js";
299
299
  import { IconWatch } from "../icons/IconWatch/index.es.js";
300
300
  import { IconWebsite } from "../icons/IconWebsite/index.es.js";
301
+ import { IconWhatsapp } from "../icons/IconWhatsapp/index.es.js";
301
302
  import { IconWifi } from "../icons/IconWifi/index.es.js";
302
303
  import { IconWifiOff } from "../icons/IconWifiOff/index.es.js";
303
304
  import { IconWind } from "../icons/IconWind/index.es.js";
@@ -611,6 +612,7 @@ export {
611
612
  IconWarning,
612
613
  IconWatch,
613
614
  IconWebsite,
615
+ IconWhatsapp,
614
616
  IconWifi,
615
617
  IconWifiOff,
616
618
  IconWind,
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,3 @@
1
+ import { CheckboxFieldProps } from '../types';
1
2
 
2
- type CheckboxFieldProps = React.InputHTMLAttributes<HTMLInputElement> & {
3
- label: string;
4
- error?: boolean;
5
- errorMessage?: string;
6
- };
7
3
  export declare const CheckboxField: ({ label, error, errorMessage, disabled, id, style, ...props }: CheckboxFieldProps) => import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -0,0 +1,11 @@
1
+ import { CheckboxFieldProps } from '../types';
2
+
3
+ type UseCheckboxGroupProps = {
4
+ name?: string;
5
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
6
+ };
7
+ export declare const useCheckboxGroup: ({ onChange, name }: UseCheckboxGroupProps) => {
8
+ handleSelectOption: (checked: boolean, option: CheckboxFieldProps, index: number) => void;
9
+ safeName: string;
10
+ };
11
+ export {};
@@ -0,0 +1,3 @@
1
+ import { CheckboxGroupProps } from '../types';
2
+
3
+ export declare const CheckboxGroup: ({ name, defaultValue, orientation, label, error, errorMessage, required, children, onChange, onFocus, }: CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { CheckboxFieldProps, CheckboxGroupProps } from './types';
2
+
3
+ type Components = {
4
+ Field: React.FC<CheckboxFieldProps>;
5
+ Group: React.FC<CheckboxGroupProps>;
6
+ };
7
+ declare const components: Components;
8
+ export { components as Checkbox };
@@ -0,0 +1,19 @@
1
+ import { CheckboxField } from './Field';
2
+
3
+ export type CheckboxFieldProps = React.InputHTMLAttributes<HTMLInputElement> & {
4
+ label?: string;
5
+ error?: boolean;
6
+ errorMessage?: string;
7
+ };
8
+ export type CheckboxGroupProps = {
9
+ children: React.ReactElement<typeof CheckboxField>[];
10
+ name?: string;
11
+ defaultValue?: string | number;
12
+ orientation?: 'horizontal' | 'vertical';
13
+ label?: string;
14
+ error?: boolean;
15
+ errorMessage?: string;
16
+ required?: boolean;
17
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
18
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
19
+ };
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Icon from "../../Icon/index.es.js";
3
+ function IconWhatsapp(props) {
4
+ return /* @__PURE__ */ jsx(
5
+ Icon,
6
+ {
7
+ markup: "<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M12 2.56626C7.08204 2.56626 3.09524 6.54253 3.09524 11.4475C3.09524 13.3999 3.72566 15.2023 4.7948 16.6674L5.08255 17.0618L4.13482 20.8537L7.98889 19.3909L8.38363 19.5661C9.48737 20.0559 10.7103 20.3287 12 20.3287C16.918 20.3287 20.9048 16.3525 20.9048 11.4475C20.9048 6.54253 16.918 2.56626 12 2.56626ZM1 11.4475C1 5.38842 5.92487 0.476562 12 0.476562C18.0751 0.476562 23 5.38842 23 11.4475C23 17.5066 18.0751 22.4184 12 22.4184C10.5671 22.4184 9.19611 22.1447 7.9383 21.646L3.19333 23.447C2.32339 23.7772 1.44013 22.9957 1.66528 22.0948L2.81653 17.4886C1.66856 15.7558 1 13.6782 1 11.4475Z' fill='currentColor'/><path fill-rule='evenodd' clip-rule='evenodd' d='M9.23672 7.42006L7.69336 9.17806C7.6734 9.2008 7.66309 9.22106 7.65856 9.23396C7.65597 9.24132 7.65541 9.2468 7.65541 9.2468C7.84014 11.018 9.24279 14.4629 13.9434 15.8039C13.9807 15.8145 14.0413 15.8086 14.0973 15.7559L15.222 14.6982L16.0941 13.7567L14.7307 12.4378L13.7516 13.5985C13.3868 14.031 12.7542 14.1795 12.2254 13.887C11.1959 13.3177 9.60272 12.175 9.31198 10.2925C9.26547 9.99133 9.35516 9.69875 9.53081 9.48091L10.3382 8.47955L9.23672 7.42006ZM8.42407 5.82833C8.81284 5.3855 9.48888 5.35673 9.9133 5.76496L11.8957 7.67174C12.2859 8.04701 12.3245 8.66137 11.9843 9.08319L11.0052 10.2975C11.2407 11.1191 11.9515 11.7723 12.7188 12.2475L13.8966 10.8512C14.2826 10.3937 14.9714 10.3585 15.4013 10.7744L17.682 12.9805C18.0901 13.3753 18.1078 14.0271 17.7219 14.4439L16.3932 15.8783L15.2268 16.9753C14.7753 17.3998 14.1232 17.5887 13.4925 17.4087C8.03768 15.8526 6.25251 11.7564 6.00911 9.42057C5.95413 8.893 6.15369 8.41447 6.45354 8.07292L8.42407 5.82833Z' fill='currentColor'/></svg>",
8
+ name: "IconWhatsapp",
9
+ ...props
10
+ }
11
+ );
12
+ }
13
+ export {
14
+ IconWhatsapp
15
+ };
16
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../../lib/components/icons/default/IconWhatsapp.tsx"],"sourcesContent":["\n// This file is generated automatically\n// To edit see the file lib/tasks/generateIcons.js\nimport Icon, { IconProps } from \"../Icon\";\n\nexport function IconWhatsapp(props: IconProps) {\n return (\n <Icon\n markup={\"<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M12 2.56626C7.08204 2.56626 3.09524 6.54253 3.09524 11.4475C3.09524 13.3999 3.72566 15.2023 4.7948 16.6674L5.08255 17.0618L4.13482 20.8537L7.98889 19.3909L8.38363 19.5661C9.48737 20.0559 10.7103 20.3287 12 20.3287C16.918 20.3287 20.9048 16.3525 20.9048 11.4475C20.9048 6.54253 16.918 2.56626 12 2.56626ZM1 11.4475C1 5.38842 5.92487 0.476562 12 0.476562C18.0751 0.476562 23 5.38842 23 11.4475C23 17.5066 18.0751 22.4184 12 22.4184C10.5671 22.4184 9.19611 22.1447 7.9383 21.646L3.19333 23.447C2.32339 23.7772 1.44013 22.9957 1.66528 22.0948L2.81653 17.4886C1.66856 15.7558 1 13.6782 1 11.4475Z' fill='currentColor'/><path fill-rule='evenodd' clip-rule='evenodd' d='M9.23672 7.42006L7.69336 9.17806C7.6734 9.2008 7.66309 9.22106 7.65856 9.23396C7.65597 9.24132 7.65541 9.2468 7.65541 9.2468C7.84014 11.018 9.24279 14.4629 13.9434 15.8039C13.9807 15.8145 14.0413 15.8086 14.0973 15.7559L15.222 14.6982L16.0941 13.7567L14.7307 12.4378L13.7516 13.5985C13.3868 14.031 12.7542 14.1795 12.2254 13.887C11.1959 13.3177 9.60272 12.175 9.31198 10.2925C9.26547 9.99133 9.35516 9.69875 9.53081 9.48091L10.3382 8.47955L9.23672 7.42006ZM8.42407 5.82833C8.81284 5.3855 9.48888 5.35673 9.9133 5.76496L11.8957 7.67174C12.2859 8.04701 12.3245 8.66137 11.9843 9.08319L11.0052 10.2975C11.2407 11.1191 11.9515 11.7723 12.7188 12.2475L13.8966 10.8512C14.2826 10.3937 14.9714 10.3585 15.4013 10.7744L17.682 12.9805C18.0901 13.3753 18.1078 14.0271 17.7219 14.4439L16.3932 15.8783L15.2268 16.9753C14.7753 17.3998 14.1232 17.5887 13.4925 17.4087C8.03768 15.8526 6.25251 11.7564 6.00911 9.42057C5.95413 8.893 6.15369 8.41447 6.45354 8.07292L8.42407 5.82833Z' fill='currentColor'/></svg>\"}\n name=\"IconWhatsapp\"\n {...props}\n />\n );\n}\n\n"],"names":[],"mappings":";;AAKO,SAAS,aAAa,OAAkB;AAE3C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,QAAQ;AAAA,MACR,MAAK;AAAA,MACJ,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -0,0 +1,3 @@
1
+ import { IconProps } from '../Icon';
2
+
3
+ export declare function IconWhatsapp(props: IconProps): import("react/jsx-runtime").JSX.Element;
@@ -298,6 +298,7 @@ export { IconVolumeX } from './IconVolumeX';
298
298
  export { IconWarning } from './IconWarning';
299
299
  export { IconWatch } from './IconWatch';
300
300
  export { IconWebsite } from './IconWebsite';
301
+ export { IconWhatsapp } from './IconWhatsapp';
301
302
  export { IconWifi } from './IconWifi';
302
303
  export { IconWifiOff } from './IconWifiOff';
303
304
  export { IconWind } from './IconWind';
@@ -298,6 +298,7 @@ import { IconVolumeX } from "./IconVolumeX/index.es.js";
298
298
  import { IconWarning } from "./IconWarning/index.es.js";
299
299
  import { IconWatch } from "./IconWatch/index.es.js";
300
300
  import { IconWebsite } from "./IconWebsite/index.es.js";
301
+ import { IconWhatsapp } from "./IconWhatsapp/index.es.js";
301
302
  import { IconWifi } from "./IconWifi/index.es.js";
302
303
  import { IconWifiOff } from "./IconWifiOff/index.es.js";
303
304
  import { IconWind } from "./IconWind/index.es.js";
@@ -613,6 +614,7 @@ export {
613
614
  IconWarning,
614
615
  IconWatch,
615
616
  IconWebsite,
617
+ IconWhatsapp,
616
618
  IconWifi,
617
619
  IconWifiOff,
618
620
  IconWind,
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/main.d.ts CHANGED
@@ -14,8 +14,8 @@ export { TokenField } from './components/form/TokenField';
14
14
  export { SelectField } from './components/form/SelectField';
15
15
  export { PasswordField } from './components/form/PasswordField';
16
16
  export { DatepickerField } from './components/form/Datepicker';
17
- export { CheckboxField } from './components/form/CheckboxField';
18
17
  export { TextAreaField } from './components/form/TextareaField';
18
+ export { Checkbox } from './components/form/Checkbox';
19
19
  export { Radio } from './components/form/Radio';
20
20
  export { useDrawer } from './components/Drawer/hooks';
21
21
  export * from './components/Logo';
package/dist/main.es.js CHANGED
@@ -13,8 +13,8 @@ import { TokenField } from "./components/TokenField/index.es.js";
13
13
  import { SelectField } from "./components/SelectField/index.es.js";
14
14
  import { PasswordField } from "./components/PasswordField/index.es.js";
15
15
  import { DatepickerField } from "./components/Datepicker/index.es.js";
16
- import { CheckboxField } from "./components/CheckboxField/index.es.js";
17
16
  import { TextAreaField } from "./components/TextareaField/index.es.js";
17
+ import { Checkbox } from "./components/Checkbox/index.es.js";
18
18
  import { Radio } from "./components/Radio/index.es.js";
19
19
  import { useState } from "react";
20
20
  import { L, a, b, c, d, e, f, g, h, i, j, k, l, m } from "./Tertiary-DMp-1eWT.js";
@@ -318,6 +318,7 @@ import { IconVolumeX } from "./components/icons/IconVolumeX/index.es.js";
318
318
  import { IconWarning } from "./components/icons/IconWarning/index.es.js";
319
319
  import { IconWatch } from "./components/icons/IconWatch/index.es.js";
320
320
  import { IconWebsite } from "./components/icons/IconWebsite/index.es.js";
321
+ import { IconWhatsapp } from "./components/icons/IconWhatsapp/index.es.js";
321
322
  import { IconWifi } from "./components/icons/IconWifi/index.es.js";
322
323
  import { IconWifiOff } from "./components/icons/IconWifiOff/index.es.js";
323
324
  import { IconWind } from "./components/icons/IconWind/index.es.js";
@@ -414,7 +415,7 @@ export {
414
415
  V as COLOR_WARNING_50,
415
416
  U as COLOR_WARNING_60,
416
417
  ak as CONTAINER_SIZE,
417
- CheckboxField,
418
+ Checkbox,
418
419
  Conditional,
419
420
  DatepickerField,
420
421
  Drawer,
@@ -737,6 +738,7 @@ export {
737
738
  IconWarning,
738
739
  IconWatch,
739
740
  IconWebsite,
741
+ IconWhatsapp,
740
742
  IconWifi,
741
743
  IconWifiOff,
742
744
  IconWind,
@@ -1 +1 @@
1
- {"version":3,"file":"main.es.js","sources":["../lib/components/Drawer/hooks.ts"],"sourcesContent":["import { useState } from 'react'\n\ntype UseDrawerProps = Record<string, boolean>\n\nexport function useDrawer(props: UseDrawerProps) {\n const [drawerOpen, setDrawerOpen] = useState<UseDrawerProps>(props)\n\n function handleOpenDrawer(name: string) {\n setDrawerOpen((prev) => {\n return {\n ...prev,\n [name]: !prev[name],\n }\n })\n }\n\n return {\n handleOpenDrawer,\n drawerOpen,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,UAAU,OAAuB;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAyB,KAAK;AAElE,WAAS,iBAAiB,MAAc;AACtC,kBAAc,CAAC,SAAS;AACf,aAAA;AAAA,QACL,GAAG;AAAA,QACH,CAAC,IAAI,GAAG,CAAC,KAAK,IAAI;AAAA,MAAA;AAAA,IACpB,CACD;AAAA,EACH;AAEO,SAAA;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"main.es.js","sources":["../lib/components/Drawer/hooks.ts"],"sourcesContent":["import { useState } from 'react'\n\ntype UseDrawerProps = Record<string, boolean>\n\nexport function useDrawer(props: UseDrawerProps) {\n const [drawerOpen, setDrawerOpen] = useState<UseDrawerProps>(props)\n\n function handleOpenDrawer(name: string) {\n setDrawerOpen((prev) => {\n return {\n ...prev,\n [name]: !prev[name],\n }\n })\n }\n\n return {\n handleOpenDrawer,\n drawerOpen,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,UAAU,OAAuB;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAyB,KAAK;AAElE,WAAS,iBAAiB,MAAc;AACtC,kBAAc,CAAC,SAAS;AACf,aAAA;AAAA,QACL,GAAG;AAAA,QACH,CAAC,IAAI,GAAG,CAAC,KAAK,IAAI;AAAA,MAAA;AAAA,IACpB,CACD;AAAA,EACH;AAEO,SAAA;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@consumidor-positivo/aurora",
3
3
  "private": false,
4
- "version": "0.0.76",
4
+ "version": "0.0.78",
5
5
  "type": "module",
6
6
  "main": "./dist/main.es.js",
7
7
  "modules": "./dist/main.es.js",
@@ -1,46 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { c as classNames } from "../../index-CweZ_OcN.js";
4
- import "../Icon/index.es.js";
5
- import { IconCheck } from "../icons/IconCheck/index.es.js";
6
- import { F as Field } from "../../index-DfksciAR.js";
7
- import { m as COLOR_NEUTRAL_00 } from "../../tokens-DGTtjw-_.js";
8
- import './styles.css';const CheckboxField = ({
9
- label,
10
- error,
11
- errorMessage,
12
- disabled,
13
- id,
14
- style,
15
- ...props
16
- }) => {
17
- const checkboxClasses = classNames("au-checkbox", {
18
- "au-checkbox--error": !!error,
19
- "au-checkbox--disabled": !!disabled
20
- });
21
- const getSafeId = (id2) => {
22
- return id2 ? id2 : `au-checkbox-${Math.random()}`;
23
- };
24
- const [safeId] = useState(getSafeId(id));
25
- return /* @__PURE__ */ jsxs("div", { className: checkboxClasses, style, children: [
26
- /* @__PURE__ */ jsxs("label", { htmlFor: safeId, className: "au-checkbox__holder", children: [
27
- /* @__PURE__ */ jsx(
28
- "input",
29
- {
30
- className: "au-checkbox__input",
31
- type: "checkbox",
32
- id: safeId,
33
- disabled,
34
- ...props
35
- }
36
- ),
37
- /* @__PURE__ */ jsx("span", { className: "au-checkbox__check", children: /* @__PURE__ */ jsx(IconCheck, { rawColor: COLOR_NEUTRAL_00 }) }),
38
- /* @__PURE__ */ jsx("span", { className: "au-checkbox__label", children: label })
39
- ] }),
40
- /* @__PURE__ */ jsx(Field.ErrorMessage, { hasError: !!error, message: errorMessage })
41
- ] });
42
- };
43
- export {
44
- CheckboxField
45
- };
46
- //# sourceMappingURL=index.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../lib/components/form/CheckboxField/index.tsx"],"sourcesContent":["import { useState } from 'react'\nimport classNames from 'classnames'\nimport { IconCheck } from '@components/icons'\nimport { COLOR_NEUTRAL_00 } from '@core/tokens'\nimport Field from '../Field'\n\nimport './styles.scss'\n\ntype CheckboxFieldProps = React.InputHTMLAttributes<HTMLInputElement> & {\n label: string\n error?: boolean\n errorMessage?: string\n}\n\nexport const CheckboxField = ({\n label,\n error,\n errorMessage,\n disabled,\n id,\n style,\n ...props\n}: CheckboxFieldProps) => {\n const checkboxClasses = classNames('au-checkbox', {\n 'au-checkbox--error': !!error,\n 'au-checkbox--disabled': !!disabled,\n })\n\n const getSafeId = (id: CheckboxFieldProps['id']) => {\n return id ? id : `au-checkbox-${Math.random()}`\n }\n const [safeId] = useState(getSafeId(id))\n\n return (\n <div className={checkboxClasses} style={style}>\n <label htmlFor={safeId} className=\"au-checkbox__holder\">\n <input\n className=\"au-checkbox__input\"\n type=\"checkbox\"\n id={safeId}\n disabled={disabled}\n {...props}\n />\n <span className=\"au-checkbox__check\">\n <IconCheck rawColor={COLOR_NEUTRAL_00} />\n </span>\n <span className=\"au-checkbox__label\">{label}</span>\n </label>\n <Field.ErrorMessage hasError={!!error} message={errorMessage} />\n </div>\n )\n}\n"],"names":["id"],"mappings":";;;;;;;AAcO,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA0B;AAClB,QAAA,kBAAkB,WAAW,eAAe;AAAA,IAChD,sBAAsB,CAAC,CAAC;AAAA,IACxB,yBAAyB,CAAC,CAAC;AAAA,EAAA,CAC5B;AAEK,QAAA,YAAY,CAACA,QAAiC;AAClD,WAAOA,MAAKA,MAAK,eAAe,KAAK,OAAQ,CAAA;AAAA,EAAA;AAE/C,QAAM,CAAC,MAAM,IAAI,SAAS,UAAU,EAAE,CAAC;AAEvC,SACG,qBAAA,OAAA,EAAI,WAAW,iBAAiB,OAC/B,UAAA;AAAA,IAAA,qBAAC,SAAM,EAAA,SAAS,QAAQ,WAAU,uBAChC,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,MAAK;AAAA,UACL,IAAI;AAAA,UACJ;AAAA,UACC,GAAG;AAAA,QAAA;AAAA,MACN;AAAA,MACA,oBAAC,UAAK,WAAU,sBACd,8BAAC,WAAU,EAAA,UAAU,kBAAkB,EACzC,CAAA;AAAA,MACC,oBAAA,QAAA,EAAK,WAAU,sBAAsB,UAAM,OAAA;AAAA,IAAA,GAC9C;AAAA,IACA,oBAAC,MAAM,cAAN,EAAmB,UAAU,CAAC,CAAC,OAAO,SAAS,cAAc;AAAA,EAChE,EAAA,CAAA;AAEJ;"}