@lets-events/react 12.10.16 → 12.11.0
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/.eslintrc.json +2 -2
- package/.turbo/turbo-build.log +21 -19
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +70 -52
- package/dist/index.d.ts +70 -52
- package/dist/index.js +358 -263
- package/dist/index.mjs +335 -240
- package/package.json +1 -1
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +132 -132
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +85 -85
- package/src/components/Button/styledComponents.ts +361 -361
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +168 -168
- package/src/components/Calendar/styledComponents.ts +480 -480
- package/src/components/Card.tsx +74 -67
- package/src/components/CheckboxGroup.tsx +176 -176
- package/src/components/Container.tsx +39 -39
- package/src/components/Divider.tsx +7 -7
- package/src/components/DoubleCalendar/index.tsx +204 -204
- package/src/components/Drawer/index.tsx +113 -113
- package/src/components/Drawer/styledComponents.ts +97 -97
- package/src/components/Dropdown.tsx +302 -302
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +130 -130
- package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
- package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
- package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
- package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
- package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
- package/src/components/FormFields/BirthDateFormField.tsx +84 -84
- package/src/components/FormFields/CNPJFormField.tsx +87 -87
- package/src/components/FormFields/CPFFormField.tsx +78 -78
- package/src/components/FormFields/CalendarFormField.tsx +98 -98
- package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
- package/src/components/FormFields/DateAndTimeFormField.tsx +217 -217
- package/src/components/FormFields/DoubleCalendarFormField.tsx +96 -96
- package/src/components/FormFields/EmailFormField.tsx +27 -27
- package/src/components/FormFields/Form.tsx +39 -39
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
- package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
- package/src/components/FormFields/PhoneFormField.tsx +40 -40
- package/src/components/FormFields/RadioGroupFormField.tsx +88 -88
- package/src/components/FormFields/RichEditorFormField.tsx +128 -128
- package/src/components/FormFields/SelectFormField.tsx +113 -113
- package/src/components/FormFields/SwitchFormField.tsx +46 -46
- package/src/components/FormFields/TextAreaFormField.tsx +61 -61
- package/src/components/FormFields/TextFormField.tsx +112 -112
- package/src/components/FormFields/TimePickerFormField.tsx +88 -88
- package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/subComponents/FormLabel.tsx +36 -36
- package/src/components/FormFields/utils/validation.ts +23 -23
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +38 -38
- package/src/components/MenuDropdown/styledComponents.ts +31 -31
- package/src/components/Modal.tsx +130 -114
- package/src/components/MultiSelect/index.tsx +417 -305
- package/src/components/MultiSelect/styledComponents.ts +176 -160
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/RichEditor/QuillComponent.tsx +419 -419
- package/src/components/RichEditor/RichEditor.tsx +53 -53
- package/src/components/RichEditor/RichTextPresenter.tsx +18 -18
- package/src/components/RichEditor/editorConfig.ts +149 -149
- package/src/components/RichEditor/index.ts +3 -3
- package/src/components/RichEditor/styledComponents.ts +1175 -1175
- package/src/components/RichEditor/types.ts +12 -12
- package/src/components/Section.tsx +33 -33
- package/src/components/Step.tsx +164 -164
- package/src/components/Switch.tsx +108 -108
- package/src/components/Text.tsx +54 -54
- package/src/components/TextField.tsx +423 -423
- package/src/components/TextareaField.tsx +116 -116
- package/src/components/TimePicker.tsx +357 -357
- package/src/components/Toast/components/ToastItem.tsx +41 -41
- package/src/components/Toast/components/ToastProvider.tsx +63 -63
- package/src/components/Toast/hooks/useToast.ts +12 -12
- package/src/components/Toast/index.tsx +5 -5
- package/src/components/Toast/styles/index.ts +135 -135
- package/src/components/Toast/types/index.ts +46 -46
- package/src/components/ToggleElement/index.tsx +58 -58
- package/src/components/Tooltip/index.tsx +73 -73
- package/src/components/Tooltip/styles.ts +77 -77
- package/src/hooks/useCountries.ts +41 -41
- package/src/hooks/useImageUpload.ts +139 -139
- package/src/hooks/useMediaQuery.ts +19 -0
- package/src/hooks/useOnClickOutside.tsx +42 -42
- package/src/index.tsx +72 -72
- package/src/styles/index.ts +41 -41
- package/src/types/typographyValues.ts +178 -178
- package/src/utils/getNestedValue.ts +3 -3
- package/src/utils/states.ts +29 -29
- package/src/utils/uploadService.ts +180 -180
- package/tsconfig.json +3 -3
- package/tsup.config.ts +38 -38
package/dist/index.js
CHANGED
|
@@ -149,7 +149,7 @@ var require_react_is_development = __commonJS({
|
|
|
149
149
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
150
150
|
var Element = REACT_ELEMENT_TYPE;
|
|
151
151
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
152
|
-
var
|
|
152
|
+
var Fragment8 = REACT_FRAGMENT_TYPE;
|
|
153
153
|
var Lazy = REACT_LAZY_TYPE;
|
|
154
154
|
var Memo = REACT_MEMO_TYPE;
|
|
155
155
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -208,7 +208,7 @@ var require_react_is_development = __commonJS({
|
|
|
208
208
|
exports2.ContextProvider = ContextProvider;
|
|
209
209
|
exports2.Element = Element;
|
|
210
210
|
exports2.ForwardRef = ForwardRef;
|
|
211
|
-
exports2.Fragment =
|
|
211
|
+
exports2.Fragment = Fragment8;
|
|
212
212
|
exports2.Lazy = Lazy;
|
|
213
213
|
exports2.Memo = Memo;
|
|
214
214
|
exports2.Portal = Portal;
|
|
@@ -3885,13 +3885,21 @@ function Modal(_a) {
|
|
|
3885
3885
|
title,
|
|
3886
3886
|
trigger,
|
|
3887
3887
|
zIndex,
|
|
3888
|
-
maxWidth
|
|
3888
|
+
maxWidth,
|
|
3889
|
+
maxHeight,
|
|
3890
|
+
height,
|
|
3891
|
+
preventAutoFocus = false,
|
|
3892
|
+
fitContent = false
|
|
3889
3893
|
} = _b, props = __objRest(_b, [
|
|
3890
3894
|
"children",
|
|
3891
3895
|
"title",
|
|
3892
3896
|
"trigger",
|
|
3893
3897
|
"zIndex",
|
|
3894
|
-
"maxWidth"
|
|
3898
|
+
"maxWidth",
|
|
3899
|
+
"maxHeight",
|
|
3900
|
+
"height",
|
|
3901
|
+
"preventAutoFocus",
|
|
3902
|
+
"fitContent"
|
|
3895
3903
|
]);
|
|
3896
3904
|
const { onOpenChange } = props;
|
|
3897
3905
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_radix_ui.Dialog.Root, __spreadProps(__spreadValues({}, props), { children: [
|
|
@@ -3905,9 +3913,14 @@ function Modal(_a) {
|
|
|
3905
3913
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
3906
3914
|
ModalContentStyled,
|
|
3907
3915
|
{
|
|
3908
|
-
|
|
3909
|
-
|
|
3916
|
+
onOpenAutoFocus: (event) => {
|
|
3917
|
+
if (preventAutoFocus) {
|
|
3918
|
+
event.preventDefault();
|
|
3919
|
+
}
|
|
3910
3920
|
},
|
|
3921
|
+
css: __spreadValues(__spreadValues(__spreadValues({
|
|
3922
|
+
maxWidth
|
|
3923
|
+
}, maxHeight !== void 0 && { maxHeight }), height !== void 0 && { height }), fitContent && height === void 0 && { height: "fit-content" }),
|
|
3911
3924
|
children: [
|
|
3912
3925
|
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ModalHeaderStyled, { children: [
|
|
3913
3926
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ModalTitleStyled, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { typography: "headline6", fontWeight: "medium", children: title }) }),
|
|
@@ -10086,11 +10099,27 @@ function Tooltip({
|
|
|
10086
10099
|
}
|
|
10087
10100
|
|
|
10088
10101
|
// src/components/MultiSelect/index.tsx
|
|
10089
|
-
var
|
|
10102
|
+
var import_react19 = __toESM(require("react"));
|
|
10090
10103
|
var import_themes19 = require("@radix-ui/themes");
|
|
10091
10104
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
10092
10105
|
var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
|
|
10093
|
-
var
|
|
10106
|
+
var import_react20 = require("react");
|
|
10107
|
+
|
|
10108
|
+
// src/hooks/useMediaQuery.ts
|
|
10109
|
+
var import_react18 = require("react");
|
|
10110
|
+
function useMediaQuery(query) {
|
|
10111
|
+
const [matches, setMatches] = (0, import_react18.useState)(
|
|
10112
|
+
() => typeof window !== "undefined" ? window.matchMedia(query).matches : false
|
|
10113
|
+
);
|
|
10114
|
+
(0, import_react18.useEffect)(() => {
|
|
10115
|
+
const media = window.matchMedia(query);
|
|
10116
|
+
const listener = (event) => setMatches(event.matches);
|
|
10117
|
+
setMatches(media.matches);
|
|
10118
|
+
media.addEventListener("change", listener);
|
|
10119
|
+
return () => media.removeEventListener("change", listener);
|
|
10120
|
+
}, [query]);
|
|
10121
|
+
return matches;
|
|
10122
|
+
}
|
|
10094
10123
|
|
|
10095
10124
|
// src/components/MultiSelect/styledComponents.ts
|
|
10096
10125
|
var import_themes18 = require("@radix-ui/themes");
|
|
@@ -10203,6 +10232,19 @@ var StyledText = styled(Text, {
|
|
|
10203
10232
|
whiteSpace: "nowrap",
|
|
10204
10233
|
textOverflow: "ellipsis"
|
|
10205
10234
|
});
|
|
10235
|
+
var StyledSectionDivider = styled("div", {
|
|
10236
|
+
borderBottom: "1px solid #CFCFCF",
|
|
10237
|
+
margin: "0 16px"
|
|
10238
|
+
});
|
|
10239
|
+
var StyledSectionTitle = styled(Text, {
|
|
10240
|
+
padding: "$8 $16 $4"
|
|
10241
|
+
});
|
|
10242
|
+
var StyledModalOptionsWrapper = styled("div", {
|
|
10243
|
+
overflowY: "auto",
|
|
10244
|
+
padding: "$16 0",
|
|
10245
|
+
width: "100%",
|
|
10246
|
+
boxSizing: "border-box"
|
|
10247
|
+
});
|
|
10206
10248
|
var ButtonSelectAllStyled = styled("button", {
|
|
10207
10249
|
display: "flex !important",
|
|
10208
10250
|
alignItems: "center",
|
|
@@ -10240,12 +10282,16 @@ var ButtonSelectAllStyled = styled("button", {
|
|
|
10240
10282
|
|
|
10241
10283
|
// src/components/MultiSelect/index.tsx
|
|
10242
10284
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
10243
|
-
var
|
|
10285
|
+
var MOBILE_MODAL_MAX_HEIGHT = "90vh";
|
|
10286
|
+
var MOBILE_MODAL_HEADER_OFFSET = "65px";
|
|
10287
|
+
var MOBILE_BREAKPOINT = "(max-width: 840px)";
|
|
10288
|
+
var MultiSelect = import_react19.default.forwardRef(
|
|
10244
10289
|
({
|
|
10245
10290
|
placeholder,
|
|
10246
10291
|
value: selectedValues = [],
|
|
10247
10292
|
onValueChange,
|
|
10248
|
-
options,
|
|
10293
|
+
options = [],
|
|
10294
|
+
optionsBySection,
|
|
10249
10295
|
color,
|
|
10250
10296
|
width = "100%",
|
|
10251
10297
|
zIndex = "auto",
|
|
@@ -10259,52 +10305,64 @@ var MultiSelect = import_react18.default.forwardRef(
|
|
|
10259
10305
|
selectedScroll = false,
|
|
10260
10306
|
showMoreButton = false,
|
|
10261
10307
|
showMoreButtonLabel = "Carregar mais",
|
|
10262
|
-
showMoreButtonOnClick
|
|
10308
|
+
showMoreButtonOnClick,
|
|
10309
|
+
helperTextAfterField = ""
|
|
10263
10310
|
}, fowardedRef) => {
|
|
10264
|
-
const [isOpen, setIsOpen] = (0,
|
|
10265
|
-
const triggerRef = (0,
|
|
10266
|
-
const [allOptionsSelected, setAllOptionsSelected] = (0,
|
|
10267
|
-
const
|
|
10268
|
-
|
|
10311
|
+
const [isOpen, setIsOpen] = (0, import_react19.useState)(false);
|
|
10312
|
+
const triggerRef = (0, import_react19.useRef)(null);
|
|
10313
|
+
const [allOptionsSelected, setAllOptionsSelected] = (0, import_react19.useState)(false);
|
|
10314
|
+
const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
|
|
10315
|
+
const hasSections = !!(optionsBySection == null ? void 0 : optionsBySection.length);
|
|
10316
|
+
const resolvedOptions = (0, import_react20.useMemo)(() => {
|
|
10317
|
+
if (hasSections) {
|
|
10318
|
+
return optionsBySection.reduce(
|
|
10319
|
+
(acc, section) => acc.concat(section.options),
|
|
10320
|
+
[]
|
|
10321
|
+
);
|
|
10322
|
+
}
|
|
10323
|
+
return options;
|
|
10324
|
+
}, [hasSections, options, optionsBySection]);
|
|
10325
|
+
const labelByValue = (0, import_react20.useMemo)(() => {
|
|
10326
|
+
return resolvedOptions.reduce((prev, curr) => {
|
|
10269
10327
|
return __spreadProps(__spreadValues({}, prev), {
|
|
10270
10328
|
[curr.value]: curr.label
|
|
10271
10329
|
});
|
|
10272
10330
|
}, {});
|
|
10273
|
-
}, [
|
|
10274
|
-
const handleRemove = (0,
|
|
10331
|
+
}, [resolvedOptions]);
|
|
10332
|
+
const handleRemove = (0, import_react19.useCallback)(
|
|
10275
10333
|
(value) => {
|
|
10276
10334
|
const newValue = selectedValues.filter((v) => v !== value);
|
|
10277
10335
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
10278
10336
|
},
|
|
10279
10337
|
[selectedValues, onValueChange]
|
|
10280
10338
|
);
|
|
10281
|
-
const handleSelectAll = (0,
|
|
10339
|
+
const handleSelectAll = (0, import_react19.useCallback)(
|
|
10282
10340
|
(e) => {
|
|
10283
10341
|
e.preventDefault();
|
|
10284
10342
|
e.stopPropagation();
|
|
10285
|
-
const allSelected = selectedValues.length ===
|
|
10343
|
+
const allSelected = selectedValues.length === resolvedOptions.length;
|
|
10286
10344
|
if (allSelected) {
|
|
10287
10345
|
onValueChange == null ? void 0 : onValueChange([]);
|
|
10288
10346
|
setAllOptionsSelected(false);
|
|
10289
10347
|
} else {
|
|
10290
|
-
onValueChange == null ? void 0 : onValueChange(
|
|
10348
|
+
onValueChange == null ? void 0 : onValueChange(resolvedOptions.map((o) => o.value));
|
|
10291
10349
|
setAllOptionsSelected(true);
|
|
10292
10350
|
}
|
|
10293
10351
|
},
|
|
10294
|
-
[selectedValues,
|
|
10352
|
+
[selectedValues, resolvedOptions, onValueChange]
|
|
10295
10353
|
);
|
|
10296
|
-
const text = (0,
|
|
10354
|
+
const text = (0, import_react20.useMemo)(() => {
|
|
10297
10355
|
if (selectedValues.length > 0 && singleSelect) {
|
|
10298
10356
|
const value = selectedValues[0];
|
|
10299
10357
|
return labelByValue[value];
|
|
10300
10358
|
}
|
|
10301
10359
|
return placeholder != null ? placeholder : "Selecione";
|
|
10302
|
-
}, [selectedValues, placeholder, singleSelect]);
|
|
10360
|
+
}, [selectedValues, placeholder, singleSelect, labelByValue]);
|
|
10303
10361
|
const handleItemClick = (v) => {
|
|
10304
10362
|
onValueChange == null ? void 0 : onValueChange([v]);
|
|
10305
10363
|
setIsOpen(false);
|
|
10306
10364
|
};
|
|
10307
|
-
const handleToggle = (0,
|
|
10365
|
+
const handleToggle = (0, import_react19.useCallback)(
|
|
10308
10366
|
(e) => {
|
|
10309
10367
|
e.preventDefault();
|
|
10310
10368
|
e.stopPropagation();
|
|
@@ -10313,43 +10371,153 @@ var MultiSelect = import_react18.default.forwardRef(
|
|
|
10313
10371
|
},
|
|
10314
10372
|
[disabled]
|
|
10315
10373
|
);
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10374
|
+
const triggerElement = /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10375
|
+
StyledTrigger,
|
|
10376
|
+
{
|
|
10377
|
+
ref: (r) => {
|
|
10378
|
+
if (!r) return;
|
|
10379
|
+
triggerRef.current = r;
|
|
10380
|
+
if (fowardedRef) {
|
|
10381
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
10382
|
+
else fowardedRef.current = r;
|
|
10383
|
+
}
|
|
10384
|
+
},
|
|
10385
|
+
color,
|
|
10386
|
+
disabled,
|
|
10387
|
+
style: width !== "100%" ? { width } : void 0,
|
|
10388
|
+
onClick: !isMobile ? handleToggle : void 0,
|
|
10389
|
+
children: [
|
|
10390
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10391
|
+
StyledText,
|
|
10392
|
+
{
|
|
10393
|
+
typography: "labelMedium",
|
|
10394
|
+
color: disabled ? "dark400" : void 0,
|
|
10395
|
+
children: text
|
|
10396
|
+
}
|
|
10397
|
+
),
|
|
10398
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10399
|
+
import_react_fontawesome3.FontAwesomeIcon,
|
|
10400
|
+
{
|
|
10401
|
+
icon: isOpen ? import_free_solid_svg_icons3.faChevronUp : import_free_solid_svg_icons3.faChevronDown,
|
|
10402
|
+
size: "sm",
|
|
10403
|
+
color: disabled ? colors.dark400 : colors.dark600
|
|
10404
|
+
}
|
|
10405
|
+
)
|
|
10406
|
+
]
|
|
10407
|
+
}
|
|
10408
|
+
);
|
|
10409
|
+
const selectAllBlock = selectedAllOptions && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
10410
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10411
|
+
ButtonSelectAllStyled,
|
|
10412
|
+
{
|
|
10413
|
+
css: itemStyle,
|
|
10414
|
+
onClick: (e) => {
|
|
10415
|
+
handleSelectAll(e);
|
|
10416
|
+
setIsOpen(false);
|
|
10417
|
+
},
|
|
10418
|
+
type: "button",
|
|
10419
|
+
children: [
|
|
10420
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: allOptionsSelected ? "checked" : "" }),
|
|
10421
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: selectedAllText ? selectedAllText : "Selecionar Todos" })
|
|
10422
|
+
]
|
|
10423
|
+
}
|
|
10424
|
+
),
|
|
10425
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {})
|
|
10426
|
+
] });
|
|
10427
|
+
const showMoreButtonBlock = showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10428
|
+
Button,
|
|
10429
|
+
{
|
|
10430
|
+
variant: "menuDropdownItem",
|
|
10431
|
+
color: "brand",
|
|
10432
|
+
onClick: showMoreButtonOnClick,
|
|
10433
|
+
fontWeight: "semibold",
|
|
10434
|
+
type: "button",
|
|
10435
|
+
css: {
|
|
10436
|
+
justifyContent: "flex-start",
|
|
10437
|
+
color: "var(--colors-brand500)!important"
|
|
10438
|
+
},
|
|
10439
|
+
children: showMoreButtonLabel
|
|
10440
|
+
}
|
|
10441
|
+
);
|
|
10442
|
+
const renderCheckboxOptions = () => {
|
|
10443
|
+
if (hasSections) {
|
|
10444
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react19.default.Fragment, { children: [
|
|
10445
|
+
sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
|
|
10446
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10447
|
+
section.options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, `${section.name}-${i}`))
|
|
10448
|
+
] }, section.name));
|
|
10449
|
+
}
|
|
10450
|
+
return resolvedOptions.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i));
|
|
10451
|
+
};
|
|
10452
|
+
const renderSingleSelectOptions = () => {
|
|
10453
|
+
if (hasSections) {
|
|
10454
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react19.default.Fragment, { children: [
|
|
10455
|
+
sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
|
|
10456
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10457
|
+
section.options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, `${section.name}-${i}`))
|
|
10458
|
+
] }, section.name));
|
|
10459
|
+
}
|
|
10460
|
+
return resolvedOptions.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i));
|
|
10461
|
+
};
|
|
10462
|
+
const optionsContent = !singleSelect ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10463
|
+
CheckboxGroup,
|
|
10464
|
+
{
|
|
10465
|
+
value: selectedValues,
|
|
10466
|
+
onValueChange: (v) => {
|
|
10467
|
+
onValueChange == null ? void 0 : onValueChange(v);
|
|
10468
|
+
setAllOptionsSelected((v || []).length === resolvedOptions.length);
|
|
10469
|
+
},
|
|
10470
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10471
|
+
StyledFlexWithMaxHeight,
|
|
10320
10472
|
{
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
10326
|
-
else fowardedRef.current = r;
|
|
10327
|
-
}
|
|
10328
|
-
},
|
|
10329
|
-
color,
|
|
10330
|
-
disabled,
|
|
10331
|
-
style: width !== "100%" ? { width } : void 0,
|
|
10332
|
-
onClick: handleToggle,
|
|
10473
|
+
direction: "column",
|
|
10474
|
+
gap: 8,
|
|
10475
|
+
hasMaxHeight: !!maxHeight && !isMobile,
|
|
10476
|
+
style: maxHeight && !isMobile ? { maxHeight } : void 0,
|
|
10333
10477
|
children: [
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
typography: "labelMedium",
|
|
10338
|
-
color: disabled ? "dark400" : void 0,
|
|
10339
|
-
children: text
|
|
10340
|
-
}
|
|
10341
|
-
),
|
|
10342
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10343
|
-
import_react_fontawesome3.FontAwesomeIcon,
|
|
10344
|
-
{
|
|
10345
|
-
icon: isOpen ? import_free_solid_svg_icons3.faChevronUp : import_free_solid_svg_icons3.faChevronDown,
|
|
10346
|
-
size: "sm",
|
|
10347
|
-
color: disabled ? colors.dark400 : colors.dark600
|
|
10348
|
-
}
|
|
10349
|
-
)
|
|
10478
|
+
selectAllBlock,
|
|
10479
|
+
renderCheckboxOptions(),
|
|
10480
|
+
showMoreButtonBlock
|
|
10350
10481
|
]
|
|
10351
10482
|
}
|
|
10352
|
-
)
|
|
10483
|
+
)
|
|
10484
|
+
}
|
|
10485
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10486
|
+
StyledFlexWithMaxHeight,
|
|
10487
|
+
{
|
|
10488
|
+
direction: "column",
|
|
10489
|
+
gap: 8,
|
|
10490
|
+
hasMaxHeight: !!maxHeight && !isMobile,
|
|
10491
|
+
style: maxHeight && !isMobile ? { maxHeight } : void 0,
|
|
10492
|
+
children: [
|
|
10493
|
+
renderSingleSelectOptions(),
|
|
10494
|
+
showMoreButtonBlock
|
|
10495
|
+
]
|
|
10496
|
+
}
|
|
10497
|
+
);
|
|
10498
|
+
const modalZIndex = zIndex === "auto" ? void 0 : Number(zIndex);
|
|
10499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_themes19.Theme, { style: width !== "100%" ? { width } : void 0, children: [
|
|
10500
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10501
|
+
Modal,
|
|
10502
|
+
{
|
|
10503
|
+
open: disabled ? false : isOpen,
|
|
10504
|
+
onOpenChange: (open) => !disabled && setIsOpen(open),
|
|
10505
|
+
trigger: triggerElement,
|
|
10506
|
+
title: placeholder != null ? placeholder : "Selecione",
|
|
10507
|
+
maxHeight: MOBILE_MODAL_MAX_HEIGHT,
|
|
10508
|
+
zIndex: modalZIndex,
|
|
10509
|
+
preventAutoFocus: true,
|
|
10510
|
+
fitContent: true,
|
|
10511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10512
|
+
StyledModalOptionsWrapper,
|
|
10513
|
+
{
|
|
10514
|
+
css: { maxHeight: `calc(${MOBILE_MODAL_MAX_HEIGHT} - ${MOBILE_MODAL_HEADER_OFFSET})` },
|
|
10515
|
+
children: optionsContent
|
|
10516
|
+
}
|
|
10517
|
+
)
|
|
10518
|
+
}
|
|
10519
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_themes19.DropdownMenu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
10520
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_themes19.DropdownMenu.Trigger, { children: triggerElement }),
|
|
10353
10521
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10354
10522
|
StyledContent,
|
|
10355
10523
|
{
|
|
@@ -10357,158 +10525,85 @@ var MultiSelect = import_react18.default.forwardRef(
|
|
|
10357
10525
|
width: "100%",
|
|
10358
10526
|
zIndex: zIndex === "auto" ? 999999 : zIndex
|
|
10359
10527
|
},
|
|
10360
|
-
children:
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
selectedAllOptions && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10377
|
-
ButtonSelectAllStyled,
|
|
10378
|
-
{
|
|
10379
|
-
css: itemStyle,
|
|
10380
|
-
onClick: (e) => {
|
|
10381
|
-
handleSelectAll(e), setIsOpen(false);
|
|
10382
|
-
},
|
|
10383
|
-
type: "button",
|
|
10384
|
-
children: [
|
|
10385
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: allOptionsSelected ? "checked" : "" }),
|
|
10386
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: selectedAllText ? selectedAllText : "Selecionar Todos" })
|
|
10387
|
-
]
|
|
10388
|
-
}
|
|
10389
|
-
),
|
|
10390
|
-
options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i)),
|
|
10391
|
-
showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10392
|
-
Button,
|
|
10393
|
-
{
|
|
10394
|
-
variant: "menuDropdownItem",
|
|
10395
|
-
color: "brand",
|
|
10396
|
-
onClick: showMoreButtonOnClick,
|
|
10397
|
-
fontWeight: "semibold",
|
|
10398
|
-
type: "button",
|
|
10399
|
-
css: {
|
|
10400
|
-
justifyContent: "flex-start",
|
|
10401
|
-
color: "var(--colors-brand500)!important"
|
|
10402
|
-
},
|
|
10403
|
-
children: showMoreButtonLabel
|
|
10404
|
-
}
|
|
10405
|
-
)
|
|
10406
|
-
]
|
|
10407
|
-
}
|
|
10408
|
-
)
|
|
10409
|
-
}
|
|
10410
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10411
|
-
StyledFlexWithMaxHeight,
|
|
10528
|
+
children: optionsContent
|
|
10529
|
+
}
|
|
10530
|
+
)
|
|
10531
|
+
] }),
|
|
10532
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { padding: "4px 8px 0 0" }, children: [
|
|
10533
|
+
helperTextAfterField && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "captionMedium", fontWeight: "regular", color: "dark600", children: helperTextAfterField }),
|
|
10534
|
+
selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10535
|
+
StyledFlexSelectedItems,
|
|
10536
|
+
{
|
|
10537
|
+
direction: selectedOrientation,
|
|
10538
|
+
gap: 8,
|
|
10539
|
+
align: selectedOrientation === "column" ? "start" : "center",
|
|
10540
|
+
justify: "start",
|
|
10541
|
+
css: __spreadValues({}, selectedScroll && { maxHeight: maxHeight || "400px" }),
|
|
10542
|
+
children: allOptionsSelected ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10543
|
+
Flex,
|
|
10412
10544
|
{
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
style: maxHeight ? { maxHeight } : void 0,
|
|
10545
|
+
gap: 4,
|
|
10546
|
+
align: "center",
|
|
10547
|
+
css: { flexWrap: "wrap" },
|
|
10417
10548
|
children: [
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
Button,
|
|
10549
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10550
|
+
CloseBtnStyled,
|
|
10421
10551
|
{
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10552
|
+
onClick: (e) => {
|
|
10553
|
+
e.stopPropagation();
|
|
10554
|
+
onValueChange == null ? void 0 : onValueChange([]);
|
|
10555
|
+
setAllOptionsSelected(false);
|
|
10556
|
+
},
|
|
10426
10557
|
type: "button",
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10558
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
|
|
10559
|
+
}
|
|
10560
|
+
),
|
|
10561
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10562
|
+
Text,
|
|
10563
|
+
{
|
|
10564
|
+
typography: "captionMedium",
|
|
10565
|
+
fontWeight: "regular",
|
|
10566
|
+
color: "dark600",
|
|
10567
|
+
children: "Todos selecionados"
|
|
10568
|
+
}
|
|
10569
|
+
)
|
|
10570
|
+
]
|
|
10571
|
+
},
|
|
10572
|
+
"all-selected"
|
|
10573
|
+
) : selectedValues.map((value) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10574
|
+
Flex,
|
|
10575
|
+
{
|
|
10576
|
+
gap: 4,
|
|
10577
|
+
align: "center",
|
|
10578
|
+
css: { flexWrap: "wrap" },
|
|
10579
|
+
children: [
|
|
10580
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10581
|
+
CloseBtnStyled,
|
|
10582
|
+
{
|
|
10583
|
+
onClick: (e) => {
|
|
10584
|
+
e.stopPropagation();
|
|
10585
|
+
handleRemove(value);
|
|
10430
10586
|
},
|
|
10431
|
-
|
|
10587
|
+
type: "button",
|
|
10588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
|
|
10589
|
+
}
|
|
10590
|
+
),
|
|
10591
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10592
|
+
Text,
|
|
10593
|
+
{
|
|
10594
|
+
typography: "captionMedium",
|
|
10595
|
+
fontWeight: "regular",
|
|
10596
|
+
color: "dark600",
|
|
10597
|
+
children: labelByValue[value]
|
|
10432
10598
|
}
|
|
10433
10599
|
)
|
|
10434
10600
|
]
|
|
10435
|
-
}
|
|
10436
|
-
|
|
10601
|
+
},
|
|
10602
|
+
value
|
|
10603
|
+
))
|
|
10437
10604
|
}
|
|
10438
10605
|
)
|
|
10439
|
-
] })
|
|
10440
|
-
selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10441
|
-
StyledFlexSelectedItems,
|
|
10442
|
-
{
|
|
10443
|
-
direction: selectedOrientation,
|
|
10444
|
-
gap: 8,
|
|
10445
|
-
align: selectedOrientation === "column" ? "start" : "center",
|
|
10446
|
-
justify: "start",
|
|
10447
|
-
css: __spreadValues({}, selectedScroll && { maxHeight: maxHeight || "400px" }),
|
|
10448
|
-
children: allOptionsSelected ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10449
|
-
Flex,
|
|
10450
|
-
{
|
|
10451
|
-
gap: 4,
|
|
10452
|
-
align: "center",
|
|
10453
|
-
css: { flexWrap: "wrap" },
|
|
10454
|
-
children: [
|
|
10455
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10456
|
-
CloseBtnStyled,
|
|
10457
|
-
{
|
|
10458
|
-
onClick: (e) => {
|
|
10459
|
-
e.stopPropagation();
|
|
10460
|
-
onValueChange == null ? void 0 : onValueChange([]);
|
|
10461
|
-
setAllOptionsSelected(false);
|
|
10462
|
-
},
|
|
10463
|
-
type: "button",
|
|
10464
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
|
|
10465
|
-
}
|
|
10466
|
-
),
|
|
10467
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10468
|
-
Text,
|
|
10469
|
-
{
|
|
10470
|
-
typography: "captionMedium",
|
|
10471
|
-
fontWeight: "regular",
|
|
10472
|
-
color: "dark600",
|
|
10473
|
-
children: "Todos selecionados"
|
|
10474
|
-
}
|
|
10475
|
-
)
|
|
10476
|
-
]
|
|
10477
|
-
},
|
|
10478
|
-
"all-selected"
|
|
10479
|
-
) : selectedValues.map((value) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10480
|
-
Flex,
|
|
10481
|
-
{
|
|
10482
|
-
gap: 4,
|
|
10483
|
-
align: "center",
|
|
10484
|
-
css: { flexWrap: "wrap" },
|
|
10485
|
-
children: [
|
|
10486
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10487
|
-
CloseBtnStyled,
|
|
10488
|
-
{
|
|
10489
|
-
onClick: (e) => {
|
|
10490
|
-
e.stopPropagation();
|
|
10491
|
-
handleRemove(value);
|
|
10492
|
-
},
|
|
10493
|
-
type: "button",
|
|
10494
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
|
|
10495
|
-
}
|
|
10496
|
-
),
|
|
10497
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10498
|
-
Text,
|
|
10499
|
-
{
|
|
10500
|
-
typography: "captionMedium",
|
|
10501
|
-
fontWeight: "regular",
|
|
10502
|
-
color: "dark600",
|
|
10503
|
-
children: labelByValue[value]
|
|
10504
|
-
}
|
|
10505
|
-
)
|
|
10506
|
-
]
|
|
10507
|
-
},
|
|
10508
|
-
value
|
|
10509
|
-
))
|
|
10510
|
-
}
|
|
10511
|
-
)
|
|
10606
|
+
] })
|
|
10512
10607
|
] });
|
|
10513
10608
|
}
|
|
10514
10609
|
);
|
|
@@ -10521,7 +10616,7 @@ var Divider = styled("div", {
|
|
|
10521
10616
|
});
|
|
10522
10617
|
|
|
10523
10618
|
// src/components/ToggleElement/index.tsx
|
|
10524
|
-
var
|
|
10619
|
+
var import_react21 = require("react");
|
|
10525
10620
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
10526
10621
|
function ToggleElement({
|
|
10527
10622
|
children,
|
|
@@ -10533,7 +10628,7 @@ function ToggleElement({
|
|
|
10533
10628
|
buttonProps,
|
|
10534
10629
|
onOpenChange
|
|
10535
10630
|
}) {
|
|
10536
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
10631
|
+
const [internalOpen, setInternalOpen] = (0, import_react21.useState)(defaultOpen);
|
|
10537
10632
|
const isControlled = open !== void 0;
|
|
10538
10633
|
const isOpen = isControlled ? open : internalOpen;
|
|
10539
10634
|
const handleClick = () => {
|
|
@@ -10855,7 +10950,7 @@ var TextAreaFormField = (_a) => {
|
|
|
10855
10950
|
|
|
10856
10951
|
// src/components/FormFields/TextFormField.tsx
|
|
10857
10952
|
var import_react_hook_form2 = require("react-hook-form");
|
|
10858
|
-
var
|
|
10953
|
+
var import_react22 = require("react");
|
|
10859
10954
|
var import_mask2 = require("@react-input/mask");
|
|
10860
10955
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10861
10956
|
var TextFormField = (_a) => {
|
|
@@ -10878,7 +10973,7 @@ var TextFormField = (_a) => {
|
|
|
10878
10973
|
"onChange",
|
|
10879
10974
|
"valueFormatter"
|
|
10880
10975
|
]);
|
|
10881
|
-
const handleValidate = (0,
|
|
10976
|
+
const handleValidate = (0, import_react22.useCallback)(
|
|
10882
10977
|
(value) => {
|
|
10883
10978
|
var _a2;
|
|
10884
10979
|
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
@@ -10900,7 +10995,7 @@ var TextFormField = (_a) => {
|
|
|
10900
10995
|
const haveError = !!fieldError;
|
|
10901
10996
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10902
10997
|
const { value: formValue, onChange: formChange } = field;
|
|
10903
|
-
const formattedValue = (0,
|
|
10998
|
+
const formattedValue = (0, import_react22.useMemo)(() => {
|
|
10904
10999
|
let value = formValue;
|
|
10905
11000
|
if (valueFormatter) value = valueFormatter.format(value);
|
|
10906
11001
|
if (mask) value = (0, import_mask2.format)(value != null ? value : "", mask);
|
|
@@ -11512,7 +11607,7 @@ function StateFormField({
|
|
|
11512
11607
|
}
|
|
11513
11608
|
|
|
11514
11609
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
11515
|
-
var
|
|
11610
|
+
var import_react23 = require("react");
|
|
11516
11611
|
var import_react_hook_form7 = require("react-hook-form");
|
|
11517
11612
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11518
11613
|
function CityFormField({
|
|
@@ -11525,9 +11620,9 @@ function CityFormField({
|
|
|
11525
11620
|
}) {
|
|
11526
11621
|
const { control, watch } = (0, import_react_hook_form7.useFormContext)();
|
|
11527
11622
|
const selectedState = watch(stateName);
|
|
11528
|
-
const [cities, setCities] = (0,
|
|
11529
|
-
const [loading, setLoading] = (0,
|
|
11530
|
-
(0,
|
|
11623
|
+
const [cities, setCities] = (0, import_react23.useState)([]);
|
|
11624
|
+
const [loading, setLoading] = (0, import_react23.useState)(false);
|
|
11625
|
+
(0, import_react23.useEffect)(() => {
|
|
11531
11626
|
if (!isBrazil) {
|
|
11532
11627
|
setCities([]);
|
|
11533
11628
|
return;
|
|
@@ -11913,10 +12008,10 @@ var EmailFormField = ({
|
|
|
11913
12008
|
var import_react_hook_form12 = require("react-hook-form");
|
|
11914
12009
|
|
|
11915
12010
|
// src/components/RichEditor/RichEditor.tsx
|
|
11916
|
-
var
|
|
12011
|
+
var import_react25 = require("react");
|
|
11917
12012
|
|
|
11918
12013
|
// src/components/RichEditor/QuillComponent.tsx
|
|
11919
|
-
var
|
|
12014
|
+
var import_react24 = require("react");
|
|
11920
12015
|
var import_react_quilljs = require("react-quilljs");
|
|
11921
12016
|
|
|
11922
12017
|
// src/utils/uploadService.ts
|
|
@@ -11927,12 +12022,12 @@ var generateUniqueFilename = (originalName) => {
|
|
|
11927
12022
|
return `${timestamp}_${random}.${extension}`;
|
|
11928
12023
|
};
|
|
11929
12024
|
var UploadService = class {
|
|
11930
|
-
static getPresignedUrl(filename, contentType,
|
|
12025
|
+
static getPresignedUrl(filename, contentType, config6) {
|
|
11931
12026
|
return __async(this, null, function* () {
|
|
11932
12027
|
var _a;
|
|
11933
|
-
const apiUrl =
|
|
11934
|
-
const presignedUrlEndpoint = (_a =
|
|
11935
|
-
const bucket =
|
|
12028
|
+
const apiUrl = config6.apiUrl;
|
|
12029
|
+
const presignedUrlEndpoint = (_a = config6.endpoints) == null ? void 0 : _a.presignedUrl;
|
|
12030
|
+
const bucket = config6.s3Bucket;
|
|
11936
12031
|
try {
|
|
11937
12032
|
const response = yield fetch(`${apiUrl}${presignedUrlEndpoint}`, {
|
|
11938
12033
|
method: "POST",
|
|
@@ -11956,12 +12051,12 @@ var UploadService = class {
|
|
|
11956
12051
|
}
|
|
11957
12052
|
});
|
|
11958
12053
|
}
|
|
11959
|
-
static uploadToS3(file,
|
|
12054
|
+
static uploadToS3(file, config6, onProgress) {
|
|
11960
12055
|
return __async(this, null, function* () {
|
|
11961
12056
|
try {
|
|
11962
12057
|
const uniqueFilename = generateUniqueFilename(file.name);
|
|
11963
12058
|
const blob = new Blob([file], { type: file.type });
|
|
11964
|
-
const s3Url = `${
|
|
12059
|
+
const s3Url = `${config6.s3Url}/${uniqueFilename}`;
|
|
11965
12060
|
return new Promise((resolve, reject) => {
|
|
11966
12061
|
const xhr = new XMLHttpRequest();
|
|
11967
12062
|
xhr.upload.addEventListener("progress", (event) => {
|
|
@@ -12000,12 +12095,12 @@ var UploadService = class {
|
|
|
12000
12095
|
}
|
|
12001
12096
|
});
|
|
12002
12097
|
}
|
|
12003
|
-
static uploadViaAPI(file,
|
|
12098
|
+
static uploadViaAPI(file, config6, onProgress) {
|
|
12004
12099
|
return __async(this, null, function* () {
|
|
12005
12100
|
try {
|
|
12006
12101
|
const formData = new FormData();
|
|
12007
12102
|
formData.append("file", file);
|
|
12008
|
-
const bucket =
|
|
12103
|
+
const bucket = config6.s3Bucket;
|
|
12009
12104
|
formData.append("bucket", bucket);
|
|
12010
12105
|
const xhr = new XMLHttpRequest();
|
|
12011
12106
|
return new Promise((resolve, reject) => {
|
|
@@ -12041,8 +12136,8 @@ var UploadService = class {
|
|
|
12041
12136
|
xhr.addEventListener("error", () => {
|
|
12042
12137
|
reject(new Error("Erro de rede durante upload"));
|
|
12043
12138
|
});
|
|
12044
|
-
const apiUrl =
|
|
12045
|
-
const uploadEndpoint = (_a =
|
|
12139
|
+
const apiUrl = config6.apiUrl;
|
|
12140
|
+
const uploadEndpoint = (_a = config6.endpoints) == null ? void 0 : _a.upload;
|
|
12046
12141
|
xhr.open("POST", `${apiUrl}${uploadEndpoint}`);
|
|
12047
12142
|
xhr.send(formData);
|
|
12048
12143
|
});
|
|
@@ -13119,12 +13214,12 @@ var QuillComponent = ({
|
|
|
13119
13214
|
onCharacterCountChange,
|
|
13120
13215
|
maxLength
|
|
13121
13216
|
}) => {
|
|
13122
|
-
const [showVideoModal, setShowVideoModal] = (0,
|
|
13123
|
-
const [videoUrl, setVideoUrl] = (0,
|
|
13124
|
-
const [showLinkModal, setShowLinkModal] = (0,
|
|
13125
|
-
const [linkUrl, setLinkUrl] = (0,
|
|
13126
|
-
const videoModalRef = (0,
|
|
13127
|
-
const linkModalRef = (0,
|
|
13217
|
+
const [showVideoModal, setShowVideoModal] = (0, import_react24.useState)(false);
|
|
13218
|
+
const [videoUrl, setVideoUrl] = (0, import_react24.useState)("");
|
|
13219
|
+
const [showLinkModal, setShowLinkModal] = (0, import_react24.useState)(false);
|
|
13220
|
+
const [linkUrl, setLinkUrl] = (0, import_react24.useState)("");
|
|
13221
|
+
const videoModalRef = (0, import_react24.useRef)(null);
|
|
13222
|
+
const linkModalRef = (0, import_react24.useRef)(null);
|
|
13128
13223
|
const { addToast, removeToast } = useToast();
|
|
13129
13224
|
const formatHTML = (html) => {
|
|
13130
13225
|
const parser = new DOMParser();
|
|
@@ -13143,7 +13238,7 @@ var QuillComponent = ({
|
|
|
13143
13238
|
placeholder,
|
|
13144
13239
|
readOnly: disabled
|
|
13145
13240
|
});
|
|
13146
|
-
const handleImageUpload = (0,
|
|
13241
|
+
const handleImageUpload = (0, import_react24.useCallback)(
|
|
13147
13242
|
(file) => __async(null, null, function* () {
|
|
13148
13243
|
if (disabled || !quill || !uploadConfig) return;
|
|
13149
13244
|
try {
|
|
@@ -13175,7 +13270,7 @@ var QuillComponent = ({
|
|
|
13175
13270
|
}),
|
|
13176
13271
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
13177
13272
|
);
|
|
13178
|
-
(0,
|
|
13273
|
+
(0, import_react24.useEffect)(() => {
|
|
13179
13274
|
if (!quill) return;
|
|
13180
13275
|
if (value !== void 0 && value !== null) {
|
|
13181
13276
|
const currentContent = quill.root.innerHTML;
|
|
@@ -13191,7 +13286,7 @@ var QuillComponent = ({
|
|
|
13191
13286
|
}
|
|
13192
13287
|
onCharacterCountChange == null ? void 0 : onCharacterCountChange(quill.getText().trim().length);
|
|
13193
13288
|
}, [quill, value, onCharacterCountChange]);
|
|
13194
|
-
(0,
|
|
13289
|
+
(0, import_react24.useEffect)(() => {
|
|
13195
13290
|
if (quill) {
|
|
13196
13291
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
13197
13292
|
if (source === "user") {
|
|
@@ -13252,7 +13347,7 @@ var QuillComponent = ({
|
|
|
13252
13347
|
}, 2e3);
|
|
13253
13348
|
}
|
|
13254
13349
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange, formats]);
|
|
13255
|
-
(0,
|
|
13350
|
+
(0, import_react24.useEffect)(() => {
|
|
13256
13351
|
if (quill) {
|
|
13257
13352
|
quill.enable(!disabled);
|
|
13258
13353
|
if (!disabled) {
|
|
@@ -13263,11 +13358,11 @@ var QuillComponent = ({
|
|
|
13263
13358
|
}
|
|
13264
13359
|
}
|
|
13265
13360
|
}, [quill, disabled]);
|
|
13266
|
-
const handleLinkCancel = (0,
|
|
13361
|
+
const handleLinkCancel = (0, import_react24.useCallback)(() => {
|
|
13267
13362
|
setLinkUrl("");
|
|
13268
13363
|
setShowLinkModal(false);
|
|
13269
13364
|
}, []);
|
|
13270
|
-
const handleLinkSubmit = (0,
|
|
13365
|
+
const handleLinkSubmit = (0, import_react24.useCallback)(() => {
|
|
13271
13366
|
if (!linkUrl.trim() || !quill) return;
|
|
13272
13367
|
const url = linkUrl.trim();
|
|
13273
13368
|
const selection = quill.getSelection();
|
|
@@ -13282,11 +13377,11 @@ var QuillComponent = ({
|
|
|
13282
13377
|
setLinkUrl("");
|
|
13283
13378
|
setShowLinkModal(false);
|
|
13284
13379
|
}, [linkUrl, quill]);
|
|
13285
|
-
const handleVideoCancel = (0,
|
|
13380
|
+
const handleVideoCancel = (0, import_react24.useCallback)(() => {
|
|
13286
13381
|
setVideoUrl("");
|
|
13287
13382
|
setShowVideoModal(false);
|
|
13288
13383
|
}, []);
|
|
13289
|
-
const handleVideoSubmit = (0,
|
|
13384
|
+
const handleVideoSubmit = (0, import_react24.useCallback)(() => {
|
|
13290
13385
|
var _a, _b;
|
|
13291
13386
|
if (!videoUrl.trim() || !quill) return;
|
|
13292
13387
|
let processedUrl = videoUrl.trim();
|
|
@@ -13319,7 +13414,7 @@ var QuillComponent = ({
|
|
|
13319
13414
|
setVideoUrl("");
|
|
13320
13415
|
setShowVideoModal(false);
|
|
13321
13416
|
}, [videoUrl, quill]);
|
|
13322
|
-
(0,
|
|
13417
|
+
(0, import_react24.useEffect)(() => {
|
|
13323
13418
|
const handleClickOutside = (event) => {
|
|
13324
13419
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
13325
13420
|
handleVideoCancel();
|
|
@@ -13481,8 +13576,8 @@ var QuillComponent_default = QuillComponent;
|
|
|
13481
13576
|
// src/components/RichEditor/RichEditor.tsx
|
|
13482
13577
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
13483
13578
|
var RichEditor = (props) => {
|
|
13484
|
-
const [isClient, setIsClient] = (0,
|
|
13485
|
-
(0,
|
|
13579
|
+
const [isClient, setIsClient] = (0, import_react25.useState)(false);
|
|
13580
|
+
(0, import_react25.useEffect)(() => {
|
|
13486
13581
|
setIsClient(typeof window !== "undefined");
|
|
13487
13582
|
}, []);
|
|
13488
13583
|
if (!isClient) return null;
|
|
@@ -13504,7 +13599,7 @@ var RichTextPresenter = ({ richText }) => {
|
|
|
13504
13599
|
var RichTextPresenter_default = RichTextPresenter;
|
|
13505
13600
|
|
|
13506
13601
|
// src/components/FormFields/RichEditorFormField.tsx
|
|
13507
|
-
var
|
|
13602
|
+
var import_react26 = require("react");
|
|
13508
13603
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
13509
13604
|
var getPlainTextLengthFromHtml = (html) => {
|
|
13510
13605
|
var _a, _b;
|
|
@@ -13553,7 +13648,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13553
13648
|
}
|
|
13554
13649
|
}
|
|
13555
13650
|
});
|
|
13556
|
-
const [caracterQuantity, setCaracterQuantity] = (0,
|
|
13651
|
+
const [caracterQuantity, setCaracterQuantity] = (0, import_react26.useState)(
|
|
13557
13652
|
() => getRemainingCharacters(maxLength, field.value)
|
|
13558
13653
|
);
|
|
13559
13654
|
const handleCharacterCountChange = (count) => {
|
|
@@ -13561,7 +13656,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13561
13656
|
setCaracterQuantity(Math.max(0, maxLength - count));
|
|
13562
13657
|
}
|
|
13563
13658
|
};
|
|
13564
|
-
(0,
|
|
13659
|
+
(0, import_react26.useEffect)(() => {
|
|
13565
13660
|
setCaracterQuantity(getRemainingCharacters(maxLength, field.value));
|
|
13566
13661
|
}, [field.value, maxLength]);
|
|
13567
13662
|
const fieldError = fieldState.error;
|
|
@@ -13607,7 +13702,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13607
13702
|
|
|
13608
13703
|
// src/components/FormFields/CalendarFormField.tsx
|
|
13609
13704
|
var import_react_hook_form13 = require("react-hook-form");
|
|
13610
|
-
var
|
|
13705
|
+
var import_react27 = require("react");
|
|
13611
13706
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
13612
13707
|
var CalendarFormField = (_a) => {
|
|
13613
13708
|
var _b = _a, {
|
|
@@ -13633,7 +13728,7 @@ var CalendarFormField = (_a) => {
|
|
|
13633
13728
|
"maxYearsFromNow",
|
|
13634
13729
|
"maxDate"
|
|
13635
13730
|
]);
|
|
13636
|
-
const handleValidate = (0,
|
|
13731
|
+
const handleValidate = (0, import_react27.useCallback)(
|
|
13637
13732
|
(value) => {
|
|
13638
13733
|
var _a2;
|
|
13639
13734
|
if (value === void 0 || value === null) {
|
|
@@ -13688,7 +13783,7 @@ var CalendarFormField = (_a) => {
|
|
|
13688
13783
|
};
|
|
13689
13784
|
|
|
13690
13785
|
// src/components/FormFields/DoubleCalendarFormField.tsx
|
|
13691
|
-
var
|
|
13786
|
+
var import_react28 = require("react");
|
|
13692
13787
|
var import_react_hook_form14 = require("react-hook-form");
|
|
13693
13788
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
13694
13789
|
var DoubleCalendarFormField = (_a) => {
|
|
@@ -13715,7 +13810,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13715
13810
|
"maxDate",
|
|
13716
13811
|
"disabled"
|
|
13717
13812
|
]);
|
|
13718
|
-
const handleValidate = (0,
|
|
13813
|
+
const handleValidate = (0, import_react28.useCallback)(
|
|
13719
13814
|
(value) => {
|
|
13720
13815
|
var _a2;
|
|
13721
13816
|
if (value === void 0 || value === null) {
|
|
@@ -13764,7 +13859,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13764
13859
|
|
|
13765
13860
|
// src/components/FormFields/TimePickerFormField.tsx
|
|
13766
13861
|
var import_react_hook_form15 = require("react-hook-form");
|
|
13767
|
-
var
|
|
13862
|
+
var import_react29 = require("react");
|
|
13768
13863
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
13769
13864
|
var TimePickerFormField = (_a) => {
|
|
13770
13865
|
var _b = _a, {
|
|
@@ -13782,7 +13877,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13782
13877
|
"validationErrorMessage",
|
|
13783
13878
|
"rules"
|
|
13784
13879
|
]);
|
|
13785
|
-
const handleValidate = (0,
|
|
13880
|
+
const handleValidate = (0, import_react29.useCallback)(
|
|
13786
13881
|
(value) => {
|
|
13787
13882
|
var _a2;
|
|
13788
13883
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -13835,7 +13930,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13835
13930
|
|
|
13836
13931
|
// src/components/FormFields/DateAndTimeFormField.tsx
|
|
13837
13932
|
var import_react_hook_form16 = require("react-hook-form");
|
|
13838
|
-
var
|
|
13933
|
+
var import_react30 = require("react");
|
|
13839
13934
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
13840
13935
|
var DateAndTimeFormField = (_a) => {
|
|
13841
13936
|
var _b = _a, {
|
|
@@ -13864,7 +13959,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13864
13959
|
"maxDate"
|
|
13865
13960
|
]);
|
|
13866
13961
|
const { addToast } = useToast();
|
|
13867
|
-
const handleDisabledClick = (0,
|
|
13962
|
+
const handleDisabledClick = (0, import_react30.useCallback)(
|
|
13868
13963
|
(event) => {
|
|
13869
13964
|
if (!disabled) return;
|
|
13870
13965
|
event.preventDefault();
|
|
@@ -13877,7 +13972,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13877
13972
|
},
|
|
13878
13973
|
[addToast, disabled, disabledInfo]
|
|
13879
13974
|
);
|
|
13880
|
-
const handleDisabledMouseDown = (0,
|
|
13975
|
+
const handleDisabledMouseDown = (0, import_react30.useCallback)(
|
|
13881
13976
|
(event) => {
|
|
13882
13977
|
if (!disabled) return;
|
|
13883
13978
|
event.preventDefault();
|
|
@@ -13885,7 +13980,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13885
13980
|
},
|
|
13886
13981
|
[disabled]
|
|
13887
13982
|
);
|
|
13888
|
-
const handleValidate = (0,
|
|
13983
|
+
const handleValidate = (0, import_react30.useCallback)(
|
|
13889
13984
|
(value) => {
|
|
13890
13985
|
var _a2;
|
|
13891
13986
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -13908,7 +14003,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13908
14003
|
const haveError = !!fieldError;
|
|
13909
14004
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
13910
14005
|
const { value: isoValue, onChange: setIsoValue } = field;
|
|
13911
|
-
const { selectedDateFromIso, selectedTimeFromIso } = (0,
|
|
14006
|
+
const { selectedDateFromIso, selectedTimeFromIso } = (0, import_react30.useMemo)(() => {
|
|
13912
14007
|
if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
13913
14008
|
try {
|
|
13914
14009
|
const date = new Date(isoValue);
|
|
@@ -13923,13 +14018,13 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13923
14018
|
return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
13924
14019
|
}
|
|
13925
14020
|
}, [isoValue]);
|
|
13926
|
-
const [draftDate, setDraftDate] = (0,
|
|
13927
|
-
const [draftTime, setDraftTime] = (0,
|
|
13928
|
-
(0,
|
|
14021
|
+
const [draftDate, setDraftDate] = (0, import_react30.useState)(selectedDateFromIso);
|
|
14022
|
+
const [draftTime, setDraftTime] = (0, import_react30.useState)(selectedTimeFromIso);
|
|
14023
|
+
(0, import_react30.useEffect)(() => {
|
|
13929
14024
|
setDraftDate(selectedDateFromIso);
|
|
13930
14025
|
setDraftTime(selectedTimeFromIso);
|
|
13931
14026
|
}, [selectedDateFromIso, selectedTimeFromIso]);
|
|
13932
|
-
const combineDateTime = (0,
|
|
14027
|
+
const combineDateTime = (0, import_react30.useCallback)(
|
|
13933
14028
|
(date, time) => {
|
|
13934
14029
|
if (!date) {
|
|
13935
14030
|
setIsoValue("");
|
|
@@ -14016,11 +14111,11 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14016
14111
|
};
|
|
14017
14112
|
|
|
14018
14113
|
// src/hooks/useImageUpload.ts
|
|
14019
|
-
var
|
|
14114
|
+
var import_react31 = require("react");
|
|
14020
14115
|
var useImageUpload = (options) => {
|
|
14021
|
-
const [isUploading, setIsUploading] = (0,
|
|
14022
|
-
const [progress, setProgress] = (0,
|
|
14023
|
-
const [error, setError] = (0,
|
|
14116
|
+
const [isUploading, setIsUploading] = (0, import_react31.useState)(false);
|
|
14117
|
+
const [progress, setProgress] = (0, import_react31.useState)(null);
|
|
14118
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
14024
14119
|
const {
|
|
14025
14120
|
onSuccess,
|
|
14026
14121
|
onError,
|
|
@@ -14030,7 +14125,7 @@ var useImageUpload = (options) => {
|
|
|
14030
14125
|
allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
14031
14126
|
uploadConfig
|
|
14032
14127
|
} = options;
|
|
14033
|
-
const validateFile = (0,
|
|
14128
|
+
const validateFile = (0, import_react31.useCallback)(
|
|
14034
14129
|
(file) => {
|
|
14035
14130
|
if (!allowedTypes.includes(file.type)) {
|
|
14036
14131
|
const errorMsg = "Tipo de arquivo n\xE3o suportado";
|
|
@@ -14048,7 +14143,7 @@ var useImageUpload = (options) => {
|
|
|
14048
14143
|
},
|
|
14049
14144
|
[allowedTypes, maxFileSize, onError]
|
|
14050
14145
|
);
|
|
14051
|
-
const uploadFile = (0,
|
|
14146
|
+
const uploadFile = (0, import_react31.useCallback)(
|
|
14052
14147
|
(file) => __async(null, null, function* () {
|
|
14053
14148
|
if (!validateFile(file)) {
|
|
14054
14149
|
return null;
|
|
@@ -14101,7 +14196,7 @@ var useImageUpload = (options) => {
|
|
|
14101
14196
|
}),
|
|
14102
14197
|
[validateFile, onSuccess, onError, onProgress]
|
|
14103
14198
|
);
|
|
14104
|
-
const reset = (0,
|
|
14199
|
+
const reset = (0, import_react31.useCallback)(() => {
|
|
14105
14200
|
setIsUploading(false);
|
|
14106
14201
|
setProgress(null);
|
|
14107
14202
|
setError(null);
|