@lets-events/react 11.8.1 → 12.1.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 -18
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +139 -11
- package/dist/index.d.ts +139 -11
- package/dist/index.js +1260 -361
- package/dist/index.mjs +1251 -358
- package/package.json +7 -2
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +125 -125
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +16 -16
- package/src/components/Button/styledComponents.ts +288 -287
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +146 -136
- package/src/components/Calendar/styledComponents.ts +250 -209
- package/src/components/Card.tsx +48 -48
- package/src/components/CheckboxGroup.tsx +176 -176
- package/src/components/Container.tsx +39 -39
- package/src/components/Drawer/index.tsx +129 -55
- package/src/components/Drawer/styledComponents.ts +46 -46
- package/src/components/Dropdown.tsx +302 -302
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- 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 +92 -0
- package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
- package/src/components/FormFields/EmailFormField.tsx +27 -27
- package/src/components/FormFields/Form.tsx +39 -39
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +37 -40
- package/src/components/FormFields/MultiSelectFormField.tsx +64 -55
- package/src/components/FormFields/PhoneFormField.tsx +40 -40
- package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
- package/src/components/FormFields/RichEditorFormField.tsx +69 -0
- package/src/components/FormFields/SelectFormField.tsx +93 -93
- package/src/components/FormFields/TextAreaFormField.tsx +57 -48
- package/src/components/FormFields/TextFormField.tsx +112 -112
- package/src/components/FormFields/TimePickerFormField.tsx +88 -0
- package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
- 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 +90 -90
- package/src/components/MultiSelect.tsx +311 -267
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/RichEditor/QuillComponent.tsx +413 -0
- package/src/components/RichEditor/RichEditor.tsx +38 -0
- package/src/components/RichEditor/index.ts +2 -0
- package/src/components/RichEditor/styledComponents.ts +62 -0
- 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 +38 -38
- package/src/components/TextField.tsx +372 -365
- package/src/components/TextareaField.tsx +128 -128
- package/src/components/TimePicker.tsx +325 -298
- 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/Tooltip/index.tsx +66 -66
- package/src/components/Tooltip/styles.ts +77 -77
- package/src/hooks/useCountries.ts +41 -41
- package/src/hooks/useImageUpload.ts +139 -0
- package/src/hooks/useOnClickOutside.tsx +42 -20
- package/src/index.tsx +67 -55
- package/src/styles/index.ts +38 -38
- 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 -0
- package/tsconfig.json +3 -3
- package/tsup.config.ts +38 -0
- package/dist/index.css +0 -171
package/dist/index.mjs
CHANGED
|
@@ -74,124 +74,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
// ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
|
|
78
|
-
var require_react_is_production_min = __commonJS({
|
|
79
|
-
"../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
|
|
80
|
-
"use strict";
|
|
81
|
-
var b = "function" === typeof Symbol && Symbol.for;
|
|
82
|
-
var c = b ? Symbol.for("react.element") : 60103;
|
|
83
|
-
var d = b ? Symbol.for("react.portal") : 60106;
|
|
84
|
-
var e = b ? Symbol.for("react.fragment") : 60107;
|
|
85
|
-
var f = b ? Symbol.for("react.strict_mode") : 60108;
|
|
86
|
-
var g = b ? Symbol.for("react.profiler") : 60114;
|
|
87
|
-
var h = b ? Symbol.for("react.provider") : 60109;
|
|
88
|
-
var k = b ? Symbol.for("react.context") : 60110;
|
|
89
|
-
var l = b ? Symbol.for("react.async_mode") : 60111;
|
|
90
|
-
var m = b ? Symbol.for("react.concurrent_mode") : 60111;
|
|
91
|
-
var n = b ? Symbol.for("react.forward_ref") : 60112;
|
|
92
|
-
var p = b ? Symbol.for("react.suspense") : 60113;
|
|
93
|
-
var q = b ? Symbol.for("react.suspense_list") : 60120;
|
|
94
|
-
var r = b ? Symbol.for("react.memo") : 60115;
|
|
95
|
-
var t = b ? Symbol.for("react.lazy") : 60116;
|
|
96
|
-
var v = b ? Symbol.for("react.block") : 60121;
|
|
97
|
-
var w = b ? Symbol.for("react.fundamental") : 60117;
|
|
98
|
-
var x = b ? Symbol.for("react.responder") : 60118;
|
|
99
|
-
var y = b ? Symbol.for("react.scope") : 60119;
|
|
100
|
-
function z(a) {
|
|
101
|
-
if ("object" === typeof a && null !== a) {
|
|
102
|
-
var u = a.$$typeof;
|
|
103
|
-
switch (u) {
|
|
104
|
-
case c:
|
|
105
|
-
switch (a = a.type, a) {
|
|
106
|
-
case l:
|
|
107
|
-
case m:
|
|
108
|
-
case e:
|
|
109
|
-
case g:
|
|
110
|
-
case f:
|
|
111
|
-
case p:
|
|
112
|
-
return a;
|
|
113
|
-
default:
|
|
114
|
-
switch (a = a && a.$$typeof, a) {
|
|
115
|
-
case k:
|
|
116
|
-
case n:
|
|
117
|
-
case t:
|
|
118
|
-
case r:
|
|
119
|
-
case h:
|
|
120
|
-
return a;
|
|
121
|
-
default:
|
|
122
|
-
return u;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
case d:
|
|
126
|
-
return u;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function A(a) {
|
|
131
|
-
return z(a) === m;
|
|
132
|
-
}
|
|
133
|
-
exports.AsyncMode = l;
|
|
134
|
-
exports.ConcurrentMode = m;
|
|
135
|
-
exports.ContextConsumer = k;
|
|
136
|
-
exports.ContextProvider = h;
|
|
137
|
-
exports.Element = c;
|
|
138
|
-
exports.ForwardRef = n;
|
|
139
|
-
exports.Fragment = e;
|
|
140
|
-
exports.Lazy = t;
|
|
141
|
-
exports.Memo = r;
|
|
142
|
-
exports.Portal = d;
|
|
143
|
-
exports.Profiler = g;
|
|
144
|
-
exports.StrictMode = f;
|
|
145
|
-
exports.Suspense = p;
|
|
146
|
-
exports.isAsyncMode = function(a) {
|
|
147
|
-
return A(a) || z(a) === l;
|
|
148
|
-
};
|
|
149
|
-
exports.isConcurrentMode = A;
|
|
150
|
-
exports.isContextConsumer = function(a) {
|
|
151
|
-
return z(a) === k;
|
|
152
|
-
};
|
|
153
|
-
exports.isContextProvider = function(a) {
|
|
154
|
-
return z(a) === h;
|
|
155
|
-
};
|
|
156
|
-
exports.isElement = function(a) {
|
|
157
|
-
return "object" === typeof a && null !== a && a.$$typeof === c;
|
|
158
|
-
};
|
|
159
|
-
exports.isForwardRef = function(a) {
|
|
160
|
-
return z(a) === n;
|
|
161
|
-
};
|
|
162
|
-
exports.isFragment = function(a) {
|
|
163
|
-
return z(a) === e;
|
|
164
|
-
};
|
|
165
|
-
exports.isLazy = function(a) {
|
|
166
|
-
return z(a) === t;
|
|
167
|
-
};
|
|
168
|
-
exports.isMemo = function(a) {
|
|
169
|
-
return z(a) === r;
|
|
170
|
-
};
|
|
171
|
-
exports.isPortal = function(a) {
|
|
172
|
-
return z(a) === d;
|
|
173
|
-
};
|
|
174
|
-
exports.isProfiler = function(a) {
|
|
175
|
-
return z(a) === g;
|
|
176
|
-
};
|
|
177
|
-
exports.isStrictMode = function(a) {
|
|
178
|
-
return z(a) === f;
|
|
179
|
-
};
|
|
180
|
-
exports.isSuspense = function(a) {
|
|
181
|
-
return z(a) === p;
|
|
182
|
-
};
|
|
183
|
-
exports.isValidElementType = function(a) {
|
|
184
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
185
|
-
};
|
|
186
|
-
exports.typeOf = z;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
77
|
// ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
|
|
191
78
|
var require_react_is_development = __commonJS({
|
|
192
79
|
"../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
193
80
|
"use strict";
|
|
194
|
-
if (
|
|
81
|
+
if (true) {
|
|
195
82
|
(function() {
|
|
196
83
|
"use strict";
|
|
197
84
|
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
@@ -346,8 +233,8 @@ var require_react_is_development = __commonJS({
|
|
|
346
233
|
var require_react_is = __commonJS({
|
|
347
234
|
"../../node_modules/prop-types/node_modules/react-is/index.js"(exports, module) {
|
|
348
235
|
"use strict";
|
|
349
|
-
if (
|
|
350
|
-
module.exports =
|
|
236
|
+
if (false) {
|
|
237
|
+
module.exports = null;
|
|
351
238
|
} else {
|
|
352
239
|
module.exports = require_react_is_development();
|
|
353
240
|
}
|
|
@@ -447,7 +334,7 @@ var require_checkPropTypes = __commonJS({
|
|
|
447
334
|
"use strict";
|
|
448
335
|
var printWarning = function() {
|
|
449
336
|
};
|
|
450
|
-
if (
|
|
337
|
+
if (true) {
|
|
451
338
|
ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
452
339
|
loggedTypeFailures = {};
|
|
453
340
|
has = require_has();
|
|
@@ -466,7 +353,7 @@ var require_checkPropTypes = __commonJS({
|
|
|
466
353
|
var loggedTypeFailures;
|
|
467
354
|
var has;
|
|
468
355
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
469
|
-
if (
|
|
356
|
+
if (true) {
|
|
470
357
|
for (var typeSpecName in typeSpecs) {
|
|
471
358
|
if (has(typeSpecs, typeSpecName)) {
|
|
472
359
|
var error;
|
|
@@ -499,7 +386,7 @@ var require_checkPropTypes = __commonJS({
|
|
|
499
386
|
}
|
|
500
387
|
}
|
|
501
388
|
checkPropTypes.resetWarningCache = function() {
|
|
502
|
-
if (
|
|
389
|
+
if (true) {
|
|
503
390
|
loggedTypeFailures = {};
|
|
504
391
|
}
|
|
505
392
|
};
|
|
@@ -518,7 +405,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
518
405
|
var checkPropTypes = require_checkPropTypes();
|
|
519
406
|
var printWarning = function() {
|
|
520
407
|
};
|
|
521
|
-
if (
|
|
408
|
+
if (true) {
|
|
522
409
|
printWarning = function(text) {
|
|
523
410
|
var message2 = "Warning: " + text;
|
|
524
411
|
if (typeof console !== "undefined") {
|
|
@@ -578,7 +465,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
578
465
|
}
|
|
579
466
|
PropTypeError.prototype = Error.prototype;
|
|
580
467
|
function createChainableTypeChecker(validate) {
|
|
581
|
-
if (
|
|
468
|
+
if (true) {
|
|
582
469
|
var manualPropTypeCallCache = {};
|
|
583
470
|
var manualPropTypeWarningCount = 0;
|
|
584
471
|
}
|
|
@@ -592,7 +479,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
592
479
|
);
|
|
593
480
|
err.name = "Invariant Violation";
|
|
594
481
|
throw err;
|
|
595
|
-
} else if (
|
|
482
|
+
} else if (typeof console !== "undefined") {
|
|
596
483
|
var cacheKey = componentName + ":" + propName;
|
|
597
484
|
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
598
485
|
manualPropTypeWarningCount < 3) {
|
|
@@ -693,7 +580,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
693
580
|
}
|
|
694
581
|
function createEnumTypeChecker(expectedValues) {
|
|
695
582
|
if (!Array.isArray(expectedValues)) {
|
|
696
|
-
if (
|
|
583
|
+
if (true) {
|
|
697
584
|
if (arguments.length > 1) {
|
|
698
585
|
printWarning(
|
|
699
586
|
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
@@ -746,7 +633,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
746
633
|
}
|
|
747
634
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
748
635
|
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
749
|
-
|
|
636
|
+
true ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
750
637
|
return emptyFunctionThatReturnsNull;
|
|
751
638
|
}
|
|
752
639
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
@@ -950,72 +837,16 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
950
837
|
}
|
|
951
838
|
});
|
|
952
839
|
|
|
953
|
-
// ../../node_modules/prop-types/factoryWithThrowingShims.js
|
|
954
|
-
var require_factoryWithThrowingShims = __commonJS({
|
|
955
|
-
"../../node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
|
|
956
|
-
"use strict";
|
|
957
|
-
var ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
958
|
-
function emptyFunction() {
|
|
959
|
-
}
|
|
960
|
-
function emptyFunctionWithReset() {
|
|
961
|
-
}
|
|
962
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
963
|
-
module.exports = function() {
|
|
964
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
965
|
-
if (secret === ReactPropTypesSecret) {
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
var err = new Error(
|
|
969
|
-
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
970
|
-
);
|
|
971
|
-
err.name = "Invariant Violation";
|
|
972
|
-
throw err;
|
|
973
|
-
}
|
|
974
|
-
;
|
|
975
|
-
shim.isRequired = shim;
|
|
976
|
-
function getShim() {
|
|
977
|
-
return shim;
|
|
978
|
-
}
|
|
979
|
-
;
|
|
980
|
-
var ReactPropTypes = {
|
|
981
|
-
array: shim,
|
|
982
|
-
bigint: shim,
|
|
983
|
-
bool: shim,
|
|
984
|
-
func: shim,
|
|
985
|
-
number: shim,
|
|
986
|
-
object: shim,
|
|
987
|
-
string: shim,
|
|
988
|
-
symbol: shim,
|
|
989
|
-
any: shim,
|
|
990
|
-
arrayOf: getShim,
|
|
991
|
-
element: shim,
|
|
992
|
-
elementType: shim,
|
|
993
|
-
instanceOf: getShim,
|
|
994
|
-
node: shim,
|
|
995
|
-
objectOf: getShim,
|
|
996
|
-
oneOf: getShim,
|
|
997
|
-
oneOfType: getShim,
|
|
998
|
-
shape: getShim,
|
|
999
|
-
exact: getShim,
|
|
1000
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
1001
|
-
resetWarningCache: emptyFunction
|
|
1002
|
-
};
|
|
1003
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1004
|
-
return ReactPropTypes;
|
|
1005
|
-
};
|
|
1006
|
-
}
|
|
1007
|
-
});
|
|
1008
|
-
|
|
1009
840
|
// ../../node_modules/prop-types/index.js
|
|
1010
841
|
var require_prop_types = __commonJS({
|
|
1011
842
|
"../../node_modules/prop-types/index.js"(exports, module) {
|
|
1012
843
|
"use strict";
|
|
1013
|
-
if (
|
|
844
|
+
if (true) {
|
|
1014
845
|
ReactIs = require_react_is();
|
|
1015
846
|
throwOnDirectAccess = true;
|
|
1016
847
|
module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
1017
848
|
} else {
|
|
1018
|
-
module.exports =
|
|
849
|
+
module.exports = null();
|
|
1019
850
|
}
|
|
1020
851
|
var ReactIs;
|
|
1021
852
|
var throwOnDirectAccess;
|
|
@@ -1852,6 +1683,7 @@ var ButtonStyled = styled(ButtonRadix, {
|
|
|
1852
1683
|
color: "$$buttonColor",
|
|
1853
1684
|
width: "100%",
|
|
1854
1685
|
borderRadius: 0,
|
|
1686
|
+
whiteSpace: "nowrap",
|
|
1855
1687
|
"&:hover": {
|
|
1856
1688
|
backgroundColor: "$dark100"
|
|
1857
1689
|
}
|
|
@@ -2735,7 +2567,8 @@ var TextField = React.forwardRef(
|
|
|
2735
2567
|
addon,
|
|
2736
2568
|
textAlign = "left",
|
|
2737
2569
|
mask,
|
|
2738
|
-
maxLength
|
|
2570
|
+
maxLength,
|
|
2571
|
+
hasError
|
|
2739
2572
|
} = _b, props = __objRest(_b, [
|
|
2740
2573
|
"children",
|
|
2741
2574
|
"isValid",
|
|
@@ -2746,7 +2579,8 @@ var TextField = React.forwardRef(
|
|
|
2746
2579
|
"addon",
|
|
2747
2580
|
"textAlign",
|
|
2748
2581
|
"mask",
|
|
2749
|
-
"maxLength"
|
|
2582
|
+
"maxLength",
|
|
2583
|
+
"hasError"
|
|
2750
2584
|
]);
|
|
2751
2585
|
const maskRef = mask ? useMask(mask) : void 0;
|
|
2752
2586
|
const inputRef = React.useRef(null);
|
|
@@ -2764,11 +2598,18 @@ var TextField = React.forwardRef(
|
|
|
2764
2598
|
};
|
|
2765
2599
|
return /* @__PURE__ */ jsxs(Flex2, { direction: "column", css: { width: "100%", position: "relative" }, children: [
|
|
2766
2600
|
/* @__PURE__ */ jsxs(Flex2, { gap: "0", css: { width: "100%" }, children: [
|
|
2767
|
-
!!addon && /* @__PURE__ */ jsx7(
|
|
2601
|
+
!!addon && /* @__PURE__ */ jsx7(
|
|
2602
|
+
InputAddon,
|
|
2603
|
+
{
|
|
2604
|
+
color: hasError ? "error" : color,
|
|
2605
|
+
typography: "labelSmall",
|
|
2606
|
+
children: addon
|
|
2607
|
+
}
|
|
2608
|
+
),
|
|
2768
2609
|
/* @__PURE__ */ jsxs(
|
|
2769
2610
|
TextFieldStyled,
|
|
2770
2611
|
__spreadProps(__spreadValues({
|
|
2771
|
-
color,
|
|
2612
|
+
color: hasError ? "error" : color || "default",
|
|
2772
2613
|
isValid: isValid2,
|
|
2773
2614
|
name,
|
|
2774
2615
|
typography,
|
|
@@ -2797,7 +2638,7 @@ var TextField = React.forwardRef(
|
|
|
2797
2638
|
{
|
|
2798
2639
|
position: "flex-end",
|
|
2799
2640
|
name,
|
|
2800
|
-
color,
|
|
2641
|
+
color: hasError ? "error" : color,
|
|
2801
2642
|
typography,
|
|
2802
2643
|
fontWeight,
|
|
2803
2644
|
textAlign,
|
|
@@ -3820,10 +3661,24 @@ import { useEffect as useEffect2 } from "react";
|
|
|
3820
3661
|
function useOnClickOutside(ref, handler) {
|
|
3821
3662
|
useEffect2(() => {
|
|
3822
3663
|
const listener = (event) => {
|
|
3823
|
-
if (!ref.current ||
|
|
3664
|
+
if (!(ref == null ? void 0 : ref.current) || !event.target) {
|
|
3665
|
+
return;
|
|
3666
|
+
}
|
|
3667
|
+
const target = event.target;
|
|
3668
|
+
const currentTarget = event.currentTarget;
|
|
3669
|
+
if (ref.current.contains(target) || ref.current.contains(currentTarget)) {
|
|
3824
3670
|
return;
|
|
3825
3671
|
}
|
|
3826
|
-
|
|
3672
|
+
if (target.tagName === "HTML" || target.tagName === "BODY") {
|
|
3673
|
+
const elementAtPoint = document.elementFromPoint(
|
|
3674
|
+
event.clientX,
|
|
3675
|
+
event.clientY
|
|
3676
|
+
);
|
|
3677
|
+
if (elementAtPoint && ref.current.contains(elementAtPoint)) {
|
|
3678
|
+
return;
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
handler(event);
|
|
3827
3682
|
};
|
|
3828
3683
|
document.addEventListener("mousedown", listener);
|
|
3829
3684
|
document.addEventListener("touchstart", listener);
|
|
@@ -7749,7 +7604,17 @@ var CalendarStyled = styled("div", {
|
|
|
7749
7604
|
lineHeight: "$base",
|
|
7750
7605
|
fontSize: "$14",
|
|
7751
7606
|
borderRadius: "$sm",
|
|
7752
|
-
position: "relative"
|
|
7607
|
+
position: "relative",
|
|
7608
|
+
width: "fit-content",
|
|
7609
|
+
variants: {
|
|
7610
|
+
expand: {
|
|
7611
|
+
true: {
|
|
7612
|
+
width: "100%",
|
|
7613
|
+
flex: "1",
|
|
7614
|
+
display: "flex"
|
|
7615
|
+
}
|
|
7616
|
+
}
|
|
7617
|
+
}
|
|
7753
7618
|
});
|
|
7754
7619
|
var CalendarButtonStyled = styled("button", {
|
|
7755
7620
|
backgroundColor: "transparent",
|
|
@@ -7758,25 +7623,52 @@ var CalendarButtonStyled = styled("button", {
|
|
|
7758
7623
|
padding: "0",
|
|
7759
7624
|
cursor: "pointer",
|
|
7760
7625
|
"> div > div": {
|
|
7761
|
-
paddingLeft: "
|
|
7762
|
-
|
|
7626
|
+
paddingLeft: "0",
|
|
7627
|
+
input: {
|
|
7763
7628
|
textAlign: "right"
|
|
7764
7629
|
}
|
|
7630
|
+
},
|
|
7631
|
+
variants: {
|
|
7632
|
+
expand: {
|
|
7633
|
+
true: {
|
|
7634
|
+
flex: "1",
|
|
7635
|
+
display: "flex",
|
|
7636
|
+
maxWidth: "100%"
|
|
7637
|
+
}
|
|
7638
|
+
}
|
|
7765
7639
|
}
|
|
7766
7640
|
});
|
|
7767
7641
|
var CalendarContentStyled = styled("div", {
|
|
7768
7642
|
fontFamily: "$default",
|
|
7769
7643
|
lineHeight: "$base",
|
|
7770
7644
|
fontSize: "$14",
|
|
7771
|
-
width: "100%",
|
|
7772
7645
|
maxWidth: "fit-content",
|
|
7773
7646
|
border: "1px solid $neutral300",
|
|
7774
7647
|
borderRadius: "$sm",
|
|
7775
7648
|
boxShadow: "0px 2px 8px 0px $shadow50",
|
|
7776
7649
|
position: "absolute",
|
|
7777
|
-
left: "0",
|
|
7778
7650
|
backgroundColor: "$neutral50",
|
|
7779
|
-
zIndex: "999999"
|
|
7651
|
+
zIndex: "999999",
|
|
7652
|
+
variants: {
|
|
7653
|
+
position: {
|
|
7654
|
+
top: {
|
|
7655
|
+
bottom: "110%",
|
|
7656
|
+
left: "0"
|
|
7657
|
+
},
|
|
7658
|
+
bottom: {
|
|
7659
|
+
top: "110%",
|
|
7660
|
+
left: "0"
|
|
7661
|
+
},
|
|
7662
|
+
"top-right": {
|
|
7663
|
+
bottom: "110%",
|
|
7664
|
+
right: "0"
|
|
7665
|
+
},
|
|
7666
|
+
"bottom-right": {
|
|
7667
|
+
top: "110%",
|
|
7668
|
+
right: "0"
|
|
7669
|
+
}
|
|
7670
|
+
}
|
|
7671
|
+
}
|
|
7780
7672
|
});
|
|
7781
7673
|
var CalendarFooterStyled = styled("div", {
|
|
7782
7674
|
borderTop: "2px solid $neutral100",
|
|
@@ -7793,7 +7685,7 @@ var DayPickerWrapperStyled = styled("div", {
|
|
|
7793
7685
|
color: "$dark500"
|
|
7794
7686
|
},
|
|
7795
7687
|
".rdp-root": {
|
|
7796
|
-
padding: "$
|
|
7688
|
+
padding: "$8"
|
|
7797
7689
|
},
|
|
7798
7690
|
".rdp-today .rdp-day_button": {
|
|
7799
7691
|
color: "$brand500",
|
|
@@ -7964,14 +7856,20 @@ function Calendar(_a) {
|
|
|
7964
7856
|
calendarLayout,
|
|
7965
7857
|
selected,
|
|
7966
7858
|
setSelected,
|
|
7967
|
-
position = "bottom"
|
|
7859
|
+
position = "bottom",
|
|
7860
|
+
hasError,
|
|
7861
|
+
expand,
|
|
7862
|
+
allowPastDates = false
|
|
7968
7863
|
} = _b, props = __objRest(_b, [
|
|
7969
7864
|
"action",
|
|
7970
7865
|
"actionText",
|
|
7971
7866
|
"calendarLayout",
|
|
7972
7867
|
"selected",
|
|
7973
7868
|
"setSelected",
|
|
7974
|
-
"position"
|
|
7869
|
+
"position",
|
|
7870
|
+
"hasError",
|
|
7871
|
+
"expand",
|
|
7872
|
+
"allowPastDates"
|
|
7975
7873
|
]);
|
|
7976
7874
|
const [inputValue, setInputValue] = useState2("");
|
|
7977
7875
|
const [showContainer, setShowCalendar] = useState2(false);
|
|
@@ -7993,15 +7891,20 @@ function Calendar(_a) {
|
|
|
7993
7891
|
setInputValue(masked);
|
|
7994
7892
|
const parsed = parse(masked, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
7995
7893
|
if (isValid(parsed)) {
|
|
7894
|
+
if (!allowPastDates && parsed < today) {
|
|
7895
|
+
console.warn("Datas passadas n\xE3o s\xE3o permitidas:", masked);
|
|
7896
|
+
return;
|
|
7897
|
+
}
|
|
7996
7898
|
setSelected(parsed);
|
|
7997
7899
|
} else {
|
|
7998
7900
|
console.warn("Data inv\xE1lida inserida no input:", masked);
|
|
7999
7901
|
}
|
|
8000
7902
|
};
|
|
8001
|
-
return /* @__PURE__ */ jsx15("div", { children: /* @__PURE__ */ jsxs6(CalendarStyled, __spreadProps(__spreadValues({}, props), { ref: dropdownRef, children: [
|
|
7903
|
+
return /* @__PURE__ */ jsx15("div", { children: /* @__PURE__ */ jsxs6(CalendarStyled, __spreadProps(__spreadValues({}, props), { expand, ref: dropdownRef, children: [
|
|
8002
7904
|
/* @__PURE__ */ jsx15(
|
|
8003
7905
|
CalendarButtonStyled,
|
|
8004
7906
|
{
|
|
7907
|
+
expand,
|
|
8005
7908
|
type: "button",
|
|
8006
7909
|
onClick: () => setShowCalendar((prev) => !prev),
|
|
8007
7910
|
children: /* @__PURE__ */ jsx15(
|
|
@@ -8013,47 +7916,42 @@ function Calendar(_a) {
|
|
|
8013
7916
|
onChange: handleInputChange,
|
|
8014
7917
|
inputMode: "numeric",
|
|
8015
7918
|
textAlign: "right",
|
|
7919
|
+
color: hasError ? "error" : "default",
|
|
8016
7920
|
children: /* @__PURE__ */ jsx15(TextFieldSlot, { children: /* @__PURE__ */ jsx15(Icon_default, { name: "calendar", size: "xl" }) })
|
|
8017
7921
|
}
|
|
8018
7922
|
)
|
|
8019
7923
|
}
|
|
8020
7924
|
),
|
|
8021
|
-
showContainer && /* @__PURE__ */ jsxs6(
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
children: actionText != null ? actionText : "Aplicar"
|
|
8052
|
-
}
|
|
8053
|
-
) })
|
|
8054
|
-
]
|
|
8055
|
-
}
|
|
8056
|
-
)
|
|
7925
|
+
showContainer && /* @__PURE__ */ jsxs6(CalendarContentStyled, { position, children: [
|
|
7926
|
+
/* @__PURE__ */ jsx15(Box, { children: /* @__PURE__ */ jsx15(DayPickerWrapperStyled, { children: /* @__PURE__ */ jsx15(
|
|
7927
|
+
DayPicker,
|
|
7928
|
+
{
|
|
7929
|
+
mode: "single",
|
|
7930
|
+
captionLayout: calendarLayout,
|
|
7931
|
+
selected,
|
|
7932
|
+
onSelect: setSelected,
|
|
7933
|
+
required: true,
|
|
7934
|
+
locale: ptBR,
|
|
7935
|
+
disabled: allowPastDates ? void 0 : { before: today },
|
|
7936
|
+
startMonth: allowPastDates ? void 0 : today,
|
|
7937
|
+
endMonth: maxDate
|
|
7938
|
+
}
|
|
7939
|
+
) }) }),
|
|
7940
|
+
action && /* @__PURE__ */ jsx15(CalendarFooterStyled, { children: /* @__PURE__ */ jsx15(
|
|
7941
|
+
Button,
|
|
7942
|
+
{
|
|
7943
|
+
variant: "text",
|
|
7944
|
+
color: "brand",
|
|
7945
|
+
type: "button",
|
|
7946
|
+
onClick: () => {
|
|
7947
|
+
setShowCalendar(false);
|
|
7948
|
+
},
|
|
7949
|
+
size: "medium",
|
|
7950
|
+
fontWeight: "medium",
|
|
7951
|
+
children: actionText != null ? actionText : "Aplicar"
|
|
7952
|
+
}
|
|
7953
|
+
) })
|
|
7954
|
+
] })
|
|
8057
7955
|
] })) });
|
|
8058
7956
|
}
|
|
8059
7957
|
|
|
@@ -8116,8 +8014,45 @@ function Drawer({
|
|
|
8116
8014
|
}) {
|
|
8117
8015
|
if (!isOpen) return null;
|
|
8118
8016
|
const drawerContainerRef = useRef4(null);
|
|
8119
|
-
useOnClickOutside(drawerContainerRef, () => {
|
|
8120
|
-
|
|
8017
|
+
useOnClickOutside(drawerContainerRef, (event) => {
|
|
8018
|
+
var _a;
|
|
8019
|
+
if (!event || !drawerContainerRef.current) {
|
|
8020
|
+
return;
|
|
8021
|
+
}
|
|
8022
|
+
let target = event.target;
|
|
8023
|
+
if (target.tagName === "HTML" || target.tagName === "BODY") {
|
|
8024
|
+
if (event instanceof MouseEvent) {
|
|
8025
|
+
const actualElement = document.elementFromPoint(
|
|
8026
|
+
event.clientX,
|
|
8027
|
+
event.clientY
|
|
8028
|
+
);
|
|
8029
|
+
if (actualElement) {
|
|
8030
|
+
target = actualElement;
|
|
8031
|
+
}
|
|
8032
|
+
}
|
|
8033
|
+
}
|
|
8034
|
+
let currentElement = target;
|
|
8035
|
+
let hierarchy = [];
|
|
8036
|
+
while (currentElement && currentElement !== document.body) {
|
|
8037
|
+
hierarchy.push({
|
|
8038
|
+
tagName: currentElement.tagName,
|
|
8039
|
+
className: currentElement.className,
|
|
8040
|
+
id: currentElement.id,
|
|
8041
|
+
attributes: Array.from(currentElement.attributes || []).map((attr) => ({
|
|
8042
|
+
name: attr.name,
|
|
8043
|
+
value: attr.value
|
|
8044
|
+
}))
|
|
8045
|
+
});
|
|
8046
|
+
currentElement = currentElement.parentElement;
|
|
8047
|
+
}
|
|
8048
|
+
if ((_a = drawerContainerRef.current) == null ? void 0 : _a.contains(target)) {
|
|
8049
|
+
return;
|
|
8050
|
+
}
|
|
8051
|
+
const isDropdownOpen = target.closest("[data-radix-popper-content-wrapper]") || target.closest('[role="dialog"]') || target.closest('[data-state="open"]') || target.closest("[data-radix-dropdown-menu-content]") || target.closest("[data-radix-dropdown-menu-root]") || target.closest("[data-radix-dropdown-menu-trigger]") || target.closest("[data-radix-dropdown-menu-portal]") || target.closest("[data-radix-dropdown-menu-item]") || target.closest("[data-radix-dropdown-menu-checkbox-item]") || target.closest("[data-radix-dropdown-menu-radio-item]") || target.closest("[data-radix-dropdown-menu-separator]") || target.closest("[data-radix-dropdown-menu-label]") || target.closest("[data-radix-dropdown-menu-group]") || target.closest("[data-radix-dropdown-menu-sub]") || target.closest("[data-radix-dropdown-menu-sub-trigger]") || target.closest("[data-radix-dropdown-menu-sub-content]") || target.closest("[data-radix-dropdown-menu-radio-group]");
|
|
8052
|
+
const shouldPreventClose = isDropdownOpen || target.closest("[data-radix-dropdown-menu-root]") || target.closest("[data-radix-dropdown-menu-trigger]") || target.closest("[data-radix-dropdown-menu-content]") || target.closest("[data-radix-dropdown-menu-portal]") || target.closest("[data-radix-dropdown-menu-item]") || target.closest("[data-radix-dropdown-menu-checkbox-item]") || target.closest("[data-radix-dropdown-menu-radio-item]") || target.closest("[data-radix-dropdown-menu-separator]") || target.closest("[data-radix-dropdown-menu-label]") || target.closest("[data-radix-dropdown-menu-group]") || target.closest("[data-radix-dropdown-menu-sub]") || target.closest("[data-radix-dropdown-menu-sub-trigger]") || target.closest("[data-radix-dropdown-menu-sub-content]") || target.closest("[data-radix-dropdown-menu-radio-group]");
|
|
8053
|
+
if (!shouldPreventClose) {
|
|
8054
|
+
onClose();
|
|
8055
|
+
}
|
|
8121
8056
|
});
|
|
8122
8057
|
return /* @__PURE__ */ jsx16(DrawerOverlayStyled, { children: /* @__PURE__ */ jsxs7(
|
|
8123
8058
|
DrawerContainerStyled,
|
|
@@ -8146,18 +8081,24 @@ var TimePickerStyled = styled("div", {
|
|
|
8146
8081
|
fontFamily: "$default",
|
|
8147
8082
|
lineHeight: "$base",
|
|
8148
8083
|
fontSize: "$14",
|
|
8149
|
-
maxWidth: "200px",
|
|
8150
8084
|
borderRadius: "$sm",
|
|
8151
8085
|
"> div > div": {
|
|
8152
|
-
paddingLeft: "1rem",
|
|
8153
8086
|
input: {
|
|
8154
8087
|
textAlign: "right"
|
|
8155
8088
|
}
|
|
8089
|
+
},
|
|
8090
|
+
variants: {
|
|
8091
|
+
expand: {
|
|
8092
|
+
true: {
|
|
8093
|
+
width: "100%",
|
|
8094
|
+
flex: "1",
|
|
8095
|
+
display: "flex"
|
|
8096
|
+
}
|
|
8097
|
+
}
|
|
8156
8098
|
}
|
|
8157
8099
|
});
|
|
8158
8100
|
var TimePickerDropdownStyled = styled("div", {
|
|
8159
8101
|
position: "absolute",
|
|
8160
|
-
left: 0,
|
|
8161
8102
|
zIndex: 10,
|
|
8162
8103
|
width: "100%",
|
|
8163
8104
|
maxWidth: "8.875rem",
|
|
@@ -8227,21 +8168,30 @@ var InputStyled = styled("input", {
|
|
|
8227
8168
|
var TimePickerButtonStyled = styled("button", {
|
|
8228
8169
|
backgroundColor: "transparent",
|
|
8229
8170
|
border: "none",
|
|
8230
|
-
maxWidth: "200px",
|
|
8231
8171
|
padding: "0",
|
|
8232
8172
|
cursor: "pointer",
|
|
8233
8173
|
"> div > div": {
|
|
8234
|
-
paddingLeft: "1rem",
|
|
8235
8174
|
input: {
|
|
8236
8175
|
textAlign: "right"
|
|
8237
8176
|
}
|
|
8177
|
+
},
|
|
8178
|
+
variants: {
|
|
8179
|
+
expand: {
|
|
8180
|
+
true: {
|
|
8181
|
+
flex: "1",
|
|
8182
|
+
display: "flex",
|
|
8183
|
+
maxWidth: "100%"
|
|
8184
|
+
}
|
|
8185
|
+
}
|
|
8238
8186
|
}
|
|
8239
8187
|
});
|
|
8240
8188
|
var pad = (num) => String(num).padStart(2, "0");
|
|
8241
8189
|
function TimePicker({
|
|
8242
8190
|
selected,
|
|
8243
8191
|
setSelected,
|
|
8244
|
-
position = "bottom"
|
|
8192
|
+
position = "bottom",
|
|
8193
|
+
hasError,
|
|
8194
|
+
expand = false
|
|
8245
8195
|
}) {
|
|
8246
8196
|
const [hours, setHours] = useState3("00");
|
|
8247
8197
|
const [minutes, setMinutes] = useState3("00");
|
|
@@ -8278,12 +8228,13 @@ function TimePicker({
|
|
|
8278
8228
|
},
|
|
8279
8229
|
[hours, minutes]
|
|
8280
8230
|
);
|
|
8281
|
-
return /* @__PURE__ */ jsxs8(TimePickerStyled, { ref: dropdownRef, children: [
|
|
8231
|
+
return /* @__PURE__ */ jsxs8(TimePickerStyled, { ref: dropdownRef, expand, children: [
|
|
8282
8232
|
/* @__PURE__ */ jsx17(
|
|
8283
8233
|
TimePickerButtonStyled,
|
|
8284
8234
|
{
|
|
8285
8235
|
type: "button",
|
|
8286
8236
|
onClick: () => setIsOpen((prev) => !prev),
|
|
8237
|
+
expand,
|
|
8287
8238
|
children: /* @__PURE__ */ jsx17(
|
|
8288
8239
|
TextField,
|
|
8289
8240
|
{
|
|
@@ -8293,6 +8244,7 @@ function TimePicker({
|
|
|
8293
8244
|
placeholder: "00:00",
|
|
8294
8245
|
typography: "labelSmall",
|
|
8295
8246
|
fontWeight: "regular",
|
|
8247
|
+
color: hasError ? "error" : "default",
|
|
8296
8248
|
children: /* @__PURE__ */ jsx17(TextFieldSlot, { children: /* @__PURE__ */ jsx17(Icon_default, { name: "clock", size: "xl" }) })
|
|
8297
8249
|
}
|
|
8298
8250
|
)
|
|
@@ -8301,7 +8253,7 @@ function TimePicker({
|
|
|
8301
8253
|
isOpen && /* @__PURE__ */ jsxs8(
|
|
8302
8254
|
TimePickerDropdownStyled,
|
|
8303
8255
|
{
|
|
8304
|
-
style: position === "top" ? { bottom: "110%" } : { top: "110%" },
|
|
8256
|
+
style: position === "top" ? { bottom: "110%", left: "0" } : position === "top-right" ? { bottom: "110%", right: "0" } : position === "bottom-right" ? { top: "110%", right: "0" } : { top: "110%", left: "0" },
|
|
8305
8257
|
children: [
|
|
8306
8258
|
/* @__PURE__ */ jsxs8(TimerPickerContentStyled, { children: [
|
|
8307
8259
|
["hours", "minutes"].map((unit) => /* @__PURE__ */ jsxs8(
|
|
@@ -9326,6 +9278,7 @@ function Tooltip({
|
|
|
9326
9278
|
}
|
|
9327
9279
|
|
|
9328
9280
|
// src/components/MultiSelect.tsx
|
|
9281
|
+
import React9, { useCallback as useCallback2, useRef as useRef7, useState as useState6 } from "react";
|
|
9329
9282
|
import { DropdownMenu as DropdownMenu3, Theme as Theme3 } from "@radix-ui/themes";
|
|
9330
9283
|
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
9331
9284
|
import {
|
|
@@ -9333,8 +9286,7 @@ import {
|
|
|
9333
9286
|
faChevronUp as faChevronUp2,
|
|
9334
9287
|
faSquareXmark
|
|
9335
9288
|
} from "@fortawesome/free-solid-svg-icons";
|
|
9336
|
-
import {
|
|
9337
|
-
import React9 from "react";
|
|
9289
|
+
import { useMemo } from "react";
|
|
9338
9290
|
import { Fragment as Fragment2, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9339
9291
|
var StyledContent = styled(DropdownMenu3.Content, {
|
|
9340
9292
|
backgroundColor: "$dark50",
|
|
@@ -9342,7 +9294,10 @@ var StyledContent = styled(DropdownMenu3.Content, {
|
|
|
9342
9294
|
padding: "$8 0",
|
|
9343
9295
|
boxShadow: "0px 2px 4px 0px #23354329, 0px 4px 4px 0px #23354314",
|
|
9344
9296
|
boxSizing: "border-box",
|
|
9345
|
-
border: "1px solid $dark300"
|
|
9297
|
+
border: "1px solid $dark300",
|
|
9298
|
+
zIndex: 999999,
|
|
9299
|
+
minWidth: "var(--radix-dropdown-menu-trigger-width)",
|
|
9300
|
+
maxWidth: "var(--radix-dropdown-menu-trigger-width)"
|
|
9346
9301
|
});
|
|
9347
9302
|
var StyledTrigger = styled("div", {
|
|
9348
9303
|
minHeight: "40px",
|
|
@@ -9354,6 +9309,7 @@ var StyledTrigger = styled("div", {
|
|
|
9354
9309
|
padding: "$6 $14",
|
|
9355
9310
|
boxSizing: "border-box",
|
|
9356
9311
|
gap: "4px",
|
|
9312
|
+
width: "100%",
|
|
9357
9313
|
variants: {
|
|
9358
9314
|
color: {
|
|
9359
9315
|
default: {
|
|
@@ -9386,16 +9342,41 @@ var itemStyle = {
|
|
|
9386
9342
|
}
|
|
9387
9343
|
};
|
|
9388
9344
|
var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
|
|
9389
|
-
var BadgeWrapper = styled("div", {
|
|
9390
|
-
flex: "1",
|
|
9391
|
-
display: "flex",
|
|
9392
|
-
gap: "4px",
|
|
9393
|
-
marginTop: "8px",
|
|
9394
|
-
flexDirection: "column"
|
|
9395
|
-
});
|
|
9396
9345
|
var BadgeCloseBtn = styled("div", {
|
|
9397
9346
|
cursor: "pointer"
|
|
9398
9347
|
});
|
|
9348
|
+
var StyledFlexWithMaxHeight = styled(Flex2, {
|
|
9349
|
+
variants: {
|
|
9350
|
+
hasMaxHeight: {
|
|
9351
|
+
true: {
|
|
9352
|
+
overflowY: "auto",
|
|
9353
|
+
"&::-webkit-scrollbar": {
|
|
9354
|
+
width: "4px"
|
|
9355
|
+
},
|
|
9356
|
+
"&::-webkit-scrollbar-track": {
|
|
9357
|
+
backgroundColor: "$dark100",
|
|
9358
|
+
borderRadius: "2px"
|
|
9359
|
+
},
|
|
9360
|
+
"&::-webkit-scrollbar-thumb": {
|
|
9361
|
+
backgroundColor: "$dark300",
|
|
9362
|
+
borderRadius: "2px",
|
|
9363
|
+
"&:hover": {
|
|
9364
|
+
backgroundColor: "$dark400"
|
|
9365
|
+
}
|
|
9366
|
+
}
|
|
9367
|
+
}
|
|
9368
|
+
}
|
|
9369
|
+
},
|
|
9370
|
+
defaultVariants: {
|
|
9371
|
+
hasMaxHeight: false
|
|
9372
|
+
}
|
|
9373
|
+
});
|
|
9374
|
+
var StyledText = styled(Text, {
|
|
9375
|
+
flex: 1,
|
|
9376
|
+
overflow: "hidden",
|
|
9377
|
+
whiteSpace: "nowrap",
|
|
9378
|
+
textOverflow: "ellipsis"
|
|
9379
|
+
});
|
|
9399
9380
|
var MultiSelect = React9.forwardRef(
|
|
9400
9381
|
({
|
|
9401
9382
|
placeholder,
|
|
@@ -9407,9 +9388,10 @@ var MultiSelect = React9.forwardRef(
|
|
|
9407
9388
|
zIndex = "auto",
|
|
9408
9389
|
showSelectedValues = true,
|
|
9409
9390
|
singleSelect = false,
|
|
9410
|
-
|
|
9391
|
+
selectedOrientation = "column",
|
|
9392
|
+
disabled = false,
|
|
9393
|
+
maxHeight
|
|
9411
9394
|
}, fowardedRef) => {
|
|
9412
|
-
var _a;
|
|
9413
9395
|
const [isOpen, setIsOpen] = useState6(false);
|
|
9414
9396
|
const triggerRef = useRef7(null);
|
|
9415
9397
|
const labelByValue = useMemo(() => {
|
|
@@ -9426,7 +9408,6 @@ var MultiSelect = React9.forwardRef(
|
|
|
9426
9408
|
},
|
|
9427
9409
|
[selectedValues, onValueChange]
|
|
9428
9410
|
);
|
|
9429
|
-
const menuWidth = (_a = triggerRef.current) == null ? void 0 : _a.offsetWidth;
|
|
9430
9411
|
const text = useMemo(() => {
|
|
9431
9412
|
if (selectedValues.length > 0 && singleSelect) {
|
|
9432
9413
|
const value = selectedValues[0];
|
|
@@ -9438,67 +9419,60 @@ var MultiSelect = React9.forwardRef(
|
|
|
9438
9419
|
onValueChange == null ? void 0 : onValueChange([v]);
|
|
9439
9420
|
setIsOpen(false);
|
|
9440
9421
|
};
|
|
9422
|
+
const handleToggle = useCallback2(
|
|
9423
|
+
(e) => {
|
|
9424
|
+
e.preventDefault();
|
|
9425
|
+
e.stopPropagation();
|
|
9426
|
+
if (disabled) return;
|
|
9427
|
+
setIsOpen((prev) => !prev);
|
|
9428
|
+
},
|
|
9429
|
+
[disabled]
|
|
9430
|
+
);
|
|
9441
9431
|
return /* @__PURE__ */ jsxs14(Theme3, { children: [
|
|
9442
|
-
/* @__PURE__ */ jsxs14(DropdownMenu3.Root, {
|
|
9443
|
-
/* @__PURE__ */ jsx26(
|
|
9444
|
-
|
|
9432
|
+
/* @__PURE__ */ jsxs14(DropdownMenu3.Root, { children: [
|
|
9433
|
+
/* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { children: /* @__PURE__ */ jsxs14(
|
|
9434
|
+
StyledTrigger,
|
|
9445
9435
|
{
|
|
9446
|
-
|
|
9447
|
-
if (
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
width
|
|
9455
|
-
},
|
|
9456
|
-
ref: (r) => {
|
|
9457
|
-
if (!r) return;
|
|
9458
|
-
triggerRef.current = r;
|
|
9459
|
-
if (fowardedRef) {
|
|
9460
|
-
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
9461
|
-
else {
|
|
9462
|
-
fowardedRef.current = r;
|
|
9463
|
-
}
|
|
9464
|
-
}
|
|
9465
|
-
},
|
|
9466
|
-
color,
|
|
9467
|
-
disabled,
|
|
9468
|
-
children: [
|
|
9469
|
-
/* @__PURE__ */ jsx26(
|
|
9470
|
-
Text,
|
|
9471
|
-
{
|
|
9472
|
-
typography: "labelMedium",
|
|
9473
|
-
css: {
|
|
9474
|
-
flex: 1,
|
|
9475
|
-
overflow: "hidden",
|
|
9476
|
-
whiteSpace: "nowrap",
|
|
9477
|
-
textOverflow: "ellipsis"
|
|
9478
|
-
},
|
|
9479
|
-
color: disabled ? "dark400" : void 0,
|
|
9480
|
-
children: text
|
|
9481
|
-
}
|
|
9482
|
-
),
|
|
9483
|
-
/* @__PURE__ */ jsx26(
|
|
9484
|
-
FontAwesomeIcon3,
|
|
9485
|
-
{
|
|
9486
|
-
icon: isOpen ? faChevronUp2 : faChevronDown2,
|
|
9487
|
-
size: "sm",
|
|
9488
|
-
color: disabled ? colors.dark400 : colors.dark600
|
|
9489
|
-
}
|
|
9490
|
-
)
|
|
9491
|
-
]
|
|
9436
|
+
ref: (r) => {
|
|
9437
|
+
if (!r) return;
|
|
9438
|
+
triggerRef.current = r;
|
|
9439
|
+
if (fowardedRef) {
|
|
9440
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
9441
|
+
else {
|
|
9442
|
+
fowardedRef.current = r;
|
|
9443
|
+
}
|
|
9492
9444
|
}
|
|
9493
|
-
|
|
9445
|
+
},
|
|
9446
|
+
color,
|
|
9447
|
+
disabled,
|
|
9448
|
+
style: width !== "100%" ? { width } : void 0,
|
|
9449
|
+
onClick: handleToggle,
|
|
9450
|
+
children: [
|
|
9451
|
+
/* @__PURE__ */ jsx26(
|
|
9452
|
+
StyledText,
|
|
9453
|
+
{
|
|
9454
|
+
typography: "labelMedium",
|
|
9455
|
+
color: disabled ? "dark400" : void 0,
|
|
9456
|
+
children: text
|
|
9457
|
+
}
|
|
9458
|
+
),
|
|
9459
|
+
/* @__PURE__ */ jsx26(
|
|
9460
|
+
FontAwesomeIcon3,
|
|
9461
|
+
{
|
|
9462
|
+
icon: isOpen ? faChevronUp2 : faChevronDown2,
|
|
9463
|
+
size: "sm",
|
|
9464
|
+
color: disabled ? colors.dark400 : colors.dark600
|
|
9465
|
+
}
|
|
9466
|
+
)
|
|
9467
|
+
]
|
|
9494
9468
|
}
|
|
9495
|
-
),
|
|
9469
|
+
) }),
|
|
9496
9470
|
/* @__PURE__ */ jsx26(
|
|
9497
9471
|
StyledContent,
|
|
9498
9472
|
{
|
|
9499
9473
|
css: {
|
|
9500
|
-
width:
|
|
9501
|
-
zIndex
|
|
9474
|
+
width: "100%",
|
|
9475
|
+
zIndex: zIndex === "auto" ? 999999 : zIndex
|
|
9502
9476
|
},
|
|
9503
9477
|
children: !singleSelect ? /* @__PURE__ */ jsx26(
|
|
9504
9478
|
CheckboxGroup,
|
|
@@ -9507,36 +9481,71 @@ var MultiSelect = React9.forwardRef(
|
|
|
9507
9481
|
onValueChange: (v) => {
|
|
9508
9482
|
onValueChange == null ? void 0 : onValueChange(v);
|
|
9509
9483
|
},
|
|
9510
|
-
children: /* @__PURE__ */ jsx26(
|
|
9484
|
+
children: /* @__PURE__ */ jsx26(
|
|
9485
|
+
StyledFlexWithMaxHeight,
|
|
9486
|
+
{
|
|
9487
|
+
direction: "column",
|
|
9488
|
+
gap: 8,
|
|
9489
|
+
hasMaxHeight: !!maxHeight,
|
|
9490
|
+
style: maxHeight ? { maxHeight } : void 0,
|
|
9491
|
+
children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx26(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: label }) }, i))
|
|
9492
|
+
}
|
|
9493
|
+
)
|
|
9494
|
+
}
|
|
9495
|
+
) : /* @__PURE__ */ jsx26(
|
|
9496
|
+
StyledFlexWithMaxHeight,
|
|
9497
|
+
{
|
|
9498
|
+
direction: "column",
|
|
9499
|
+
gap: 8,
|
|
9500
|
+
hasMaxHeight: !!maxHeight,
|
|
9501
|
+
style: maxHeight ? { maxHeight } : void 0,
|
|
9502
|
+
children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx26(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: label }) }, i))
|
|
9511
9503
|
}
|
|
9512
|
-
)
|
|
9504
|
+
)
|
|
9513
9505
|
}
|
|
9514
9506
|
)
|
|
9515
9507
|
] }),
|
|
9516
|
-
selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26(
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
|
|
9527
|
-
}
|
|
9528
|
-
),
|
|
9529
|
-
/* @__PURE__ */ jsx26(
|
|
9530
|
-
Text,
|
|
9508
|
+
selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26(
|
|
9509
|
+
Flex2,
|
|
9510
|
+
{
|
|
9511
|
+
direction: selectedOrientation,
|
|
9512
|
+
gap: 8,
|
|
9513
|
+
align: selectedOrientation === "column" ? "start" : "center",
|
|
9514
|
+
justify: "start",
|
|
9515
|
+
css: { margin: "8px 0" },
|
|
9516
|
+
children: selectedValues.map((value) => /* @__PURE__ */ jsxs14(
|
|
9517
|
+
Flex2,
|
|
9531
9518
|
{
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
children:
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9519
|
+
gap: 4,
|
|
9520
|
+
align: "center",
|
|
9521
|
+
css: { flexWrap: "wrap" },
|
|
9522
|
+
children: [
|
|
9523
|
+
/* @__PURE__ */ jsx26(
|
|
9524
|
+
BadgeCloseBtn,
|
|
9525
|
+
{
|
|
9526
|
+
onClick: (e) => {
|
|
9527
|
+
e.stopPropagation();
|
|
9528
|
+
handleRemove(value);
|
|
9529
|
+
},
|
|
9530
|
+
role: "button",
|
|
9531
|
+
children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
|
|
9532
|
+
}
|
|
9533
|
+
),
|
|
9534
|
+
/* @__PURE__ */ jsx26(
|
|
9535
|
+
Text,
|
|
9536
|
+
{
|
|
9537
|
+
typography: "captionMedium",
|
|
9538
|
+
fontWeight: "regular",
|
|
9539
|
+
color: "dark600",
|
|
9540
|
+
children: labelByValue[value]
|
|
9541
|
+
}
|
|
9542
|
+
)
|
|
9543
|
+
]
|
|
9544
|
+
},
|
|
9545
|
+
value
|
|
9546
|
+
))
|
|
9547
|
+
}
|
|
9548
|
+
) })
|
|
9540
9549
|
] });
|
|
9541
9550
|
}
|
|
9542
9551
|
);
|
|
@@ -9779,12 +9788,16 @@ var TextAreaFormField = (_a) => {
|
|
|
9779
9788
|
name,
|
|
9780
9789
|
label,
|
|
9781
9790
|
required,
|
|
9782
|
-
placeholder
|
|
9791
|
+
placeholder,
|
|
9792
|
+
validate,
|
|
9793
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio."
|
|
9783
9794
|
} = _b, props = __objRest(_b, [
|
|
9784
9795
|
"name",
|
|
9785
9796
|
"label",
|
|
9786
9797
|
"required",
|
|
9787
|
-
"placeholder"
|
|
9798
|
+
"placeholder",
|
|
9799
|
+
"validate",
|
|
9800
|
+
"validationErrorMessage"
|
|
9788
9801
|
]);
|
|
9789
9802
|
var _a2;
|
|
9790
9803
|
const {
|
|
@@ -9793,6 +9806,10 @@ var TextAreaFormField = (_a) => {
|
|
|
9793
9806
|
} = useFormContext();
|
|
9794
9807
|
const haveError = !!errors[name];
|
|
9795
9808
|
const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
|
|
9809
|
+
const validationRules = {
|
|
9810
|
+
required: required ? validationErrorMessage : false,
|
|
9811
|
+
validate
|
|
9812
|
+
};
|
|
9796
9813
|
return /* @__PURE__ */ jsxs17(Flex2, { direction: "column", children: [
|
|
9797
9814
|
/* @__PURE__ */ jsx32(
|
|
9798
9815
|
FormLabel,
|
|
@@ -9805,7 +9822,7 @@ var TextAreaFormField = (_a) => {
|
|
|
9805
9822
|
),
|
|
9806
9823
|
/* @__PURE__ */ jsx32(
|
|
9807
9824
|
TextareaField,
|
|
9808
|
-
__spreadProps(__spreadValues(__spreadValues({}, props), register(name,
|
|
9825
|
+
__spreadProps(__spreadValues(__spreadValues({}, props), register(name, validationRules)), {
|
|
9809
9826
|
placeholder,
|
|
9810
9827
|
color: haveError ? "error" : "default",
|
|
9811
9828
|
"aria-labelledby": `${name}-label`
|
|
@@ -9933,11 +9950,17 @@ var MultiSelectFormField = (_a) => {
|
|
|
9933
9950
|
var _b = _a, {
|
|
9934
9951
|
name,
|
|
9935
9952
|
label,
|
|
9936
|
-
required
|
|
9953
|
+
required,
|
|
9954
|
+
selectedOrientation = "column",
|
|
9955
|
+
zIndex,
|
|
9956
|
+
maxHeight
|
|
9937
9957
|
} = _b, rest = __objRest(_b, [
|
|
9938
9958
|
"name",
|
|
9939
9959
|
"label",
|
|
9940
|
-
"required"
|
|
9960
|
+
"required",
|
|
9961
|
+
"selectedOrientation",
|
|
9962
|
+
"zIndex",
|
|
9963
|
+
"maxHeight"
|
|
9941
9964
|
]);
|
|
9942
9965
|
var _a2;
|
|
9943
9966
|
const { field, fieldState } = useController2({
|
|
@@ -9969,7 +9992,10 @@ var MultiSelectFormField = (_a) => {
|
|
|
9969
9992
|
value,
|
|
9970
9993
|
onValueChange: handleChange,
|
|
9971
9994
|
ref,
|
|
9972
|
-
color: haveError ? "error" : "default"
|
|
9995
|
+
color: haveError ? "error" : "default",
|
|
9996
|
+
selectedOrientation,
|
|
9997
|
+
zIndex,
|
|
9998
|
+
maxHeight
|
|
9973
9999
|
}, rest)
|
|
9974
10000
|
),
|
|
9975
10001
|
/* @__PURE__ */ jsx35(ErrorFormMessage, { message: errorMsg })
|
|
@@ -10219,10 +10245,6 @@ var BirthDateFormField = ({
|
|
|
10219
10245
|
|
|
10220
10246
|
// src/components/FormFields/IdentityDocumentNumberFormField.tsx
|
|
10221
10247
|
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
10222
|
-
var isValidRG = (rg) => {
|
|
10223
|
-
const cleaned = rg.replace(/[^\d]/g, "");
|
|
10224
|
-
return /^\d{9}$/.test(cleaned);
|
|
10225
|
-
};
|
|
10226
10248
|
var IdentityDocumentNumberFormField = ({
|
|
10227
10249
|
name,
|
|
10228
10250
|
label,
|
|
@@ -10242,9 +10264,11 @@ var IdentityDocumentNumberFormField = ({
|
|
|
10242
10264
|
replacement: { _: /[0-9]/ }
|
|
10243
10265
|
},
|
|
10244
10266
|
validate: (value) => {
|
|
10245
|
-
const
|
|
10267
|
+
const cleaned = value.replace(/[^\d]/g, "");
|
|
10268
|
+
const isEmpty = cleaned.length === 0;
|
|
10246
10269
|
if (!required && isEmpty) return true;
|
|
10247
|
-
|
|
10270
|
+
if (cleaned.length >= 3) return true;
|
|
10271
|
+
return validationErrorMessage;
|
|
10248
10272
|
}
|
|
10249
10273
|
}
|
|
10250
10274
|
);
|
|
@@ -10822,6 +10846,879 @@ var EmailFormField = ({
|
|
|
10822
10846
|
}
|
|
10823
10847
|
);
|
|
10824
10848
|
};
|
|
10849
|
+
|
|
10850
|
+
// src/components/FormFields/RichEditorFormField.tsx
|
|
10851
|
+
import { useController as useController3 } from "react-hook-form";
|
|
10852
|
+
|
|
10853
|
+
// src/components/RichEditor/QuillComponent.tsx
|
|
10854
|
+
import { useState as useState8, useRef as useRef8, useEffect as useEffect5, useCallback as useCallback4 } from "react";
|
|
10855
|
+
import { useQuill } from "react-quilljs";
|
|
10856
|
+
import "quill/dist/quill.snow.css";
|
|
10857
|
+
|
|
10858
|
+
// src/utils/uploadService.ts
|
|
10859
|
+
var generateUniqueFilename = (originalName) => {
|
|
10860
|
+
const timestamp = Date.now().toString(36);
|
|
10861
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
10862
|
+
const extension = originalName.split(".").pop();
|
|
10863
|
+
return `${timestamp}_${random}.${extension}`;
|
|
10864
|
+
};
|
|
10865
|
+
var UploadService = class {
|
|
10866
|
+
static getPresignedUrl(filename, contentType, config2) {
|
|
10867
|
+
return __async(this, null, function* () {
|
|
10868
|
+
var _a;
|
|
10869
|
+
const apiUrl = config2.apiUrl;
|
|
10870
|
+
const presignedUrlEndpoint = (_a = config2.endpoints) == null ? void 0 : _a.presignedUrl;
|
|
10871
|
+
const bucket = config2.s3Bucket;
|
|
10872
|
+
try {
|
|
10873
|
+
const response = yield fetch(`${apiUrl}${presignedUrlEndpoint}`, {
|
|
10874
|
+
method: "POST",
|
|
10875
|
+
headers: {
|
|
10876
|
+
"Content-Type": "application/json"
|
|
10877
|
+
},
|
|
10878
|
+
body: JSON.stringify({
|
|
10879
|
+
filename,
|
|
10880
|
+
contentType,
|
|
10881
|
+
bucket
|
|
10882
|
+
})
|
|
10883
|
+
});
|
|
10884
|
+
if (!response.ok) {
|
|
10885
|
+
throw new Error("Falha ao gerar URL de upload");
|
|
10886
|
+
}
|
|
10887
|
+
const data = yield response.json();
|
|
10888
|
+
return data.presignedUrl;
|
|
10889
|
+
} catch (error) {
|
|
10890
|
+
console.error("Erro ao gerar URL pr\xE9-assinada:", error);
|
|
10891
|
+
throw new Error("Falha ao gerar URL de upload");
|
|
10892
|
+
}
|
|
10893
|
+
});
|
|
10894
|
+
}
|
|
10895
|
+
static uploadToS3(file, config2, onProgress) {
|
|
10896
|
+
return __async(this, null, function* () {
|
|
10897
|
+
try {
|
|
10898
|
+
const uniqueFilename = generateUniqueFilename(file.name);
|
|
10899
|
+
const blob = new Blob([file], { type: file.type });
|
|
10900
|
+
const s3Url = `${config2.s3Url}/${uniqueFilename}`;
|
|
10901
|
+
return new Promise((resolve, reject) => {
|
|
10902
|
+
const xhr = new XMLHttpRequest();
|
|
10903
|
+
xhr.upload.addEventListener("progress", (event) => {
|
|
10904
|
+
if (event.lengthComputable) {
|
|
10905
|
+
const percentComplete = Math.round(
|
|
10906
|
+
event.loaded / event.total * 100
|
|
10907
|
+
);
|
|
10908
|
+
onProgress == null ? void 0 : onProgress({
|
|
10909
|
+
amount: percentComplete,
|
|
10910
|
+
message: `Fazendo upload... ${percentComplete}%`
|
|
10911
|
+
});
|
|
10912
|
+
}
|
|
10913
|
+
});
|
|
10914
|
+
xhr.addEventListener("load", () => {
|
|
10915
|
+
if (xhr.status === 200) {
|
|
10916
|
+
resolve({
|
|
10917
|
+
url: s3Url,
|
|
10918
|
+
filename: uniqueFilename,
|
|
10919
|
+
size: file.size,
|
|
10920
|
+
type: file.type
|
|
10921
|
+
});
|
|
10922
|
+
} else {
|
|
10923
|
+
reject(new Error(`Upload falhou com status: ${xhr.status}`));
|
|
10924
|
+
}
|
|
10925
|
+
});
|
|
10926
|
+
xhr.addEventListener("error", () => {
|
|
10927
|
+
reject(new Error("Erro de rede durante upload"));
|
|
10928
|
+
});
|
|
10929
|
+
xhr.open("PUT", s3Url);
|
|
10930
|
+
xhr.setRequestHeader("Content-Type", file.type);
|
|
10931
|
+
xhr.send(blob);
|
|
10932
|
+
});
|
|
10933
|
+
} catch (error) {
|
|
10934
|
+
console.error("Erro no upload:", error);
|
|
10935
|
+
throw error;
|
|
10936
|
+
}
|
|
10937
|
+
});
|
|
10938
|
+
}
|
|
10939
|
+
static uploadViaAPI(file, config2, onProgress) {
|
|
10940
|
+
return __async(this, null, function* () {
|
|
10941
|
+
try {
|
|
10942
|
+
const formData = new FormData();
|
|
10943
|
+
formData.append("file", file);
|
|
10944
|
+
const bucket = config2.s3Bucket;
|
|
10945
|
+
formData.append("bucket", bucket);
|
|
10946
|
+
const xhr = new XMLHttpRequest();
|
|
10947
|
+
return new Promise((resolve, reject) => {
|
|
10948
|
+
var _a;
|
|
10949
|
+
xhr.upload.addEventListener("progress", (event) => {
|
|
10950
|
+
if (event.lengthComputable) {
|
|
10951
|
+
const percentComplete = Math.round(
|
|
10952
|
+
event.loaded / event.total * 100
|
|
10953
|
+
);
|
|
10954
|
+
onProgress == null ? void 0 : onProgress({
|
|
10955
|
+
amount: percentComplete,
|
|
10956
|
+
message: `Fazendo upload... ${percentComplete}%`
|
|
10957
|
+
});
|
|
10958
|
+
}
|
|
10959
|
+
});
|
|
10960
|
+
xhr.addEventListener("load", () => {
|
|
10961
|
+
if (xhr.status === 200) {
|
|
10962
|
+
try {
|
|
10963
|
+
const response = JSON.parse(xhr.responseText);
|
|
10964
|
+
resolve({
|
|
10965
|
+
url: response.url,
|
|
10966
|
+
filename: response.filename,
|
|
10967
|
+
size: file.size,
|
|
10968
|
+
type: file.type
|
|
10969
|
+
});
|
|
10970
|
+
} catch (error) {
|
|
10971
|
+
reject(new Error("Resposta inv\xE1lida do servidor"));
|
|
10972
|
+
}
|
|
10973
|
+
} else {
|
|
10974
|
+
reject(new Error(`Upload falhou com status: ${xhr.status}`));
|
|
10975
|
+
}
|
|
10976
|
+
});
|
|
10977
|
+
xhr.addEventListener("error", () => {
|
|
10978
|
+
reject(new Error("Erro de rede durante upload"));
|
|
10979
|
+
});
|
|
10980
|
+
const apiUrl = config2.apiUrl;
|
|
10981
|
+
const uploadEndpoint = (_a = config2.endpoints) == null ? void 0 : _a.upload;
|
|
10982
|
+
xhr.open("POST", `${apiUrl}${uploadEndpoint}`);
|
|
10983
|
+
xhr.send(formData);
|
|
10984
|
+
});
|
|
10985
|
+
} catch (error) {
|
|
10986
|
+
console.error("Erro no upload via API:", error);
|
|
10987
|
+
throw error;
|
|
10988
|
+
}
|
|
10989
|
+
});
|
|
10990
|
+
}
|
|
10991
|
+
};
|
|
10992
|
+
|
|
10993
|
+
// src/components/RichEditor/styledComponents.ts
|
|
10994
|
+
var QuillContainer = styled("div", {
|
|
10995
|
+
display: "flex",
|
|
10996
|
+
flexDirection: "column"
|
|
10997
|
+
});
|
|
10998
|
+
var QuillEditor = styled("div", {
|
|
10999
|
+
"& .ql-editor": {
|
|
11000
|
+
minHeight: "200px",
|
|
11001
|
+
padding: "$12",
|
|
11002
|
+
fontSize: "$14",
|
|
11003
|
+
lineHeight: "$base",
|
|
11004
|
+
fontFamily: "$default",
|
|
11005
|
+
color: "$neutral900",
|
|
11006
|
+
backgroundColor: "$white",
|
|
11007
|
+
border: "none",
|
|
11008
|
+
outline: "none",
|
|
11009
|
+
cursor: "text",
|
|
11010
|
+
caretColor: "$primary500",
|
|
11011
|
+
"&:focus": {
|
|
11012
|
+
borderColor: "$primary500",
|
|
11013
|
+
boxShadow: "0 0 0 1px $primary500"
|
|
11014
|
+
},
|
|
11015
|
+
"& p": {
|
|
11016
|
+
margin: "0 0 $8 0"
|
|
11017
|
+
},
|
|
11018
|
+
"& p:last-child": {
|
|
11019
|
+
marginBottom: 0
|
|
11020
|
+
},
|
|
11021
|
+
"& .ql-cursor": {
|
|
11022
|
+
borderLeft: "2px solid $primary500"
|
|
11023
|
+
}
|
|
11024
|
+
},
|
|
11025
|
+
"& .ql-toolbar": {
|
|
11026
|
+
backgroundColor: "$grey100",
|
|
11027
|
+
border: "1px solid $neutral300",
|
|
11028
|
+
borderBottom: "none",
|
|
11029
|
+
borderTopLeftRadius: "$sm",
|
|
11030
|
+
borderTopRightRadius: "$sm",
|
|
11031
|
+
padding: "$8 $12"
|
|
11032
|
+
},
|
|
11033
|
+
"& .ql-container": {
|
|
11034
|
+
border: "1px solid $neutral300",
|
|
11035
|
+
borderTop: "none",
|
|
11036
|
+
borderBottomLeftRadius: "$sm",
|
|
11037
|
+
borderBottomRightRadius: "$sm",
|
|
11038
|
+
fontFamily: "$default"
|
|
11039
|
+
},
|
|
11040
|
+
"& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before": {
|
|
11041
|
+
content: "T\xEDtulo 1"
|
|
11042
|
+
},
|
|
11043
|
+
"& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before": {
|
|
11044
|
+
content: "T\xEDtulo 2"
|
|
11045
|
+
}
|
|
11046
|
+
});
|
|
11047
|
+
|
|
11048
|
+
// src/components/RichEditor/QuillComponent.tsx
|
|
11049
|
+
import { jsx as jsx50, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
11050
|
+
var QuillComponent = ({
|
|
11051
|
+
value = "",
|
|
11052
|
+
onChange,
|
|
11053
|
+
placeholder = "Digite seu texto aqui...",
|
|
11054
|
+
disabled = false,
|
|
11055
|
+
className,
|
|
11056
|
+
uploadConfig
|
|
11057
|
+
}) => {
|
|
11058
|
+
const [showVideoModal, setShowVideoModal] = useState8(false);
|
|
11059
|
+
const [videoUrl, setVideoUrl] = useState8("");
|
|
11060
|
+
const [showLinkModal, setShowLinkModal] = useState8(false);
|
|
11061
|
+
const [linkUrl, setLinkUrl] = useState8("");
|
|
11062
|
+
const videoModalRef = useRef8(null);
|
|
11063
|
+
const linkModalRef = useRef8(null);
|
|
11064
|
+
const { addToast, removeToast } = useToast();
|
|
11065
|
+
const modules = {
|
|
11066
|
+
toolbar: [
|
|
11067
|
+
[{ header: [1, 2, false] }],
|
|
11068
|
+
["bold", "italic", "underline", "strike"],
|
|
11069
|
+
[{ color: [] }, { background: [] }],
|
|
11070
|
+
[{ align: [] }],
|
|
11071
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
11072
|
+
["link", "image", "video"]
|
|
11073
|
+
],
|
|
11074
|
+
clipboard: {
|
|
11075
|
+
matchVisual: false
|
|
11076
|
+
}
|
|
11077
|
+
};
|
|
11078
|
+
const formats = [
|
|
11079
|
+
"header",
|
|
11080
|
+
"bold",
|
|
11081
|
+
"italic",
|
|
11082
|
+
"underline",
|
|
11083
|
+
"strike",
|
|
11084
|
+
"color",
|
|
11085
|
+
"background",
|
|
11086
|
+
"align",
|
|
11087
|
+
"list",
|
|
11088
|
+
"link",
|
|
11089
|
+
"image",
|
|
11090
|
+
"video"
|
|
11091
|
+
];
|
|
11092
|
+
const { quill, quillRef } = useQuill({
|
|
11093
|
+
theme: "snow",
|
|
11094
|
+
modules,
|
|
11095
|
+
formats,
|
|
11096
|
+
placeholder,
|
|
11097
|
+
readOnly: disabled
|
|
11098
|
+
});
|
|
11099
|
+
const handleImageUpload = useCallback4(
|
|
11100
|
+
(file) => __async(null, null, function* () {
|
|
11101
|
+
if (disabled || !quill || !uploadConfig) return;
|
|
11102
|
+
try {
|
|
11103
|
+
addToast({
|
|
11104
|
+
type: "info",
|
|
11105
|
+
message: "Carregando imagem...",
|
|
11106
|
+
duration: 2e3
|
|
11107
|
+
});
|
|
11108
|
+
const uploadedFile = yield UploadService.uploadToS3(file, uploadConfig);
|
|
11109
|
+
removeToast("info");
|
|
11110
|
+
addToast({
|
|
11111
|
+
type: "success",
|
|
11112
|
+
message: "Imagem adicionada com sucesso!"
|
|
11113
|
+
});
|
|
11114
|
+
const selection = quill.getSelection();
|
|
11115
|
+
const index = selection ? selection.index : quill.getLength();
|
|
11116
|
+
quill.insertEmbed(index, "image", uploadedFile.url);
|
|
11117
|
+
quill.setSelection(index + 1, 0);
|
|
11118
|
+
} catch (error) {
|
|
11119
|
+
console.error("Erro no upload:", error);
|
|
11120
|
+
addToast({
|
|
11121
|
+
type: "error",
|
|
11122
|
+
message: "Erro no upload: N\xE3o foi poss\xEDvel enviar a imagem. Tente novamente."
|
|
11123
|
+
});
|
|
11124
|
+
}
|
|
11125
|
+
}),
|
|
11126
|
+
[disabled, quill, addToast, removeToast, uploadConfig]
|
|
11127
|
+
);
|
|
11128
|
+
useEffect5(() => {
|
|
11129
|
+
if (quill && value) {
|
|
11130
|
+
const currentContent = quill.root.innerHTML;
|
|
11131
|
+
if (currentContent !== value) {
|
|
11132
|
+
const selection = quill.getSelection();
|
|
11133
|
+
quill.clipboard.dangerouslyPasteHTML(value);
|
|
11134
|
+
if (selection) {
|
|
11135
|
+
quill.setSelection(selection.index, selection.length);
|
|
11136
|
+
} else {
|
|
11137
|
+
quill.setSelection(quill.getLength(), 0);
|
|
11138
|
+
}
|
|
11139
|
+
}
|
|
11140
|
+
}
|
|
11141
|
+
}, [quill, value]);
|
|
11142
|
+
useEffect5(() => {
|
|
11143
|
+
if (quill) {
|
|
11144
|
+
quill.on("text-change", (delta, oldDelta, source) => {
|
|
11145
|
+
if (source === "user") {
|
|
11146
|
+
const html = quill.root.innerHTML;
|
|
11147
|
+
onChange == null ? void 0 : onChange(html);
|
|
11148
|
+
}
|
|
11149
|
+
});
|
|
11150
|
+
const toolbar = quill.getModule("toolbar");
|
|
11151
|
+
if (toolbar) {
|
|
11152
|
+
toolbar.addHandler("link", () => setShowLinkModal(true));
|
|
11153
|
+
toolbar.addHandler("video", () => setShowVideoModal(true));
|
|
11154
|
+
toolbar.addHandler("image", () => {
|
|
11155
|
+
const input = document.createElement("input");
|
|
11156
|
+
input.setAttribute("type", "file");
|
|
11157
|
+
input.setAttribute("accept", "image/*");
|
|
11158
|
+
input.click();
|
|
11159
|
+
input.onchange = () => __async(null, null, function* () {
|
|
11160
|
+
var _a;
|
|
11161
|
+
const file = (_a = input.files) == null ? void 0 : _a[0];
|
|
11162
|
+
if (file) {
|
|
11163
|
+
yield handleImageUpload(file);
|
|
11164
|
+
}
|
|
11165
|
+
});
|
|
11166
|
+
});
|
|
11167
|
+
}
|
|
11168
|
+
setTimeout(() => {
|
|
11169
|
+
var _a, _b;
|
|
11170
|
+
const toolbarElement = (_b = (_a = quillRef.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.querySelector(".ql-toolbar");
|
|
11171
|
+
if (toolbarElement) {
|
|
11172
|
+
const headerSelect = toolbarElement.querySelector(
|
|
11173
|
+
"select[data-value]"
|
|
11174
|
+
);
|
|
11175
|
+
if (headerSelect) {
|
|
11176
|
+
const options = headerSelect.querySelectorAll("option");
|
|
11177
|
+
options.forEach((option) => {
|
|
11178
|
+
if (option.value === "1") {
|
|
11179
|
+
option.textContent = "T\xEDtulo 1";
|
|
11180
|
+
} else if (option.value === "2") {
|
|
11181
|
+
option.textContent = "T\xEDtulo 2";
|
|
11182
|
+
} else if (option.value === "") {
|
|
11183
|
+
option.textContent = "Normal";
|
|
11184
|
+
}
|
|
11185
|
+
});
|
|
11186
|
+
}
|
|
11187
|
+
}
|
|
11188
|
+
}, 2e3);
|
|
11189
|
+
}
|
|
11190
|
+
}, [quill, onChange, handleImageUpload]);
|
|
11191
|
+
useEffect5(() => {
|
|
11192
|
+
if (quill) {
|
|
11193
|
+
quill.enable(!disabled);
|
|
11194
|
+
if (!disabled) {
|
|
11195
|
+
if (quill.getLength() <= 1) {
|
|
11196
|
+
quill.focus();
|
|
11197
|
+
quill.setSelection(0, 0);
|
|
11198
|
+
}
|
|
11199
|
+
}
|
|
11200
|
+
}
|
|
11201
|
+
}, [quill, disabled]);
|
|
11202
|
+
const handleLinkCancel = useCallback4(() => {
|
|
11203
|
+
setLinkUrl("");
|
|
11204
|
+
setShowLinkModal(false);
|
|
11205
|
+
}, []);
|
|
11206
|
+
const handleLinkSubmit = useCallback4(() => {
|
|
11207
|
+
if (!linkUrl.trim() || !quill) return;
|
|
11208
|
+
const url = linkUrl.trim();
|
|
11209
|
+
const selection = quill.getSelection();
|
|
11210
|
+
if (selection && selection.length > 0) {
|
|
11211
|
+
quill.format("link", url);
|
|
11212
|
+
} else {
|
|
11213
|
+
const index = quill.getLength();
|
|
11214
|
+
quill.insertText(index, url, "link", url);
|
|
11215
|
+
quill.setSelection(index + url.length, 0);
|
|
11216
|
+
}
|
|
11217
|
+
setLinkUrl("");
|
|
11218
|
+
setShowLinkModal(false);
|
|
11219
|
+
}, [linkUrl, quill]);
|
|
11220
|
+
const handleVideoCancel = useCallback4(() => {
|
|
11221
|
+
setVideoUrl("");
|
|
11222
|
+
setShowVideoModal(false);
|
|
11223
|
+
}, []);
|
|
11224
|
+
const handleVideoSubmit = useCallback4(() => {
|
|
11225
|
+
var _a, _b;
|
|
11226
|
+
if (!videoUrl.trim() || !quill) return;
|
|
11227
|
+
let processedUrl = videoUrl.trim();
|
|
11228
|
+
if (processedUrl.includes("youtube.com/watch")) {
|
|
11229
|
+
const videoId = (_a = processedUrl.match(/[?&]v=([^&]+)/)) == null ? void 0 : _a[1];
|
|
11230
|
+
if (videoId) {
|
|
11231
|
+
processedUrl = `https://www.youtube.com/embed/${videoId}`;
|
|
11232
|
+
}
|
|
11233
|
+
} else if (processedUrl.includes("youtu.be/")) {
|
|
11234
|
+
const videoId = (_b = processedUrl.split("youtu.be/")[1]) == null ? void 0 : _b.split("?")[0];
|
|
11235
|
+
if (videoId) {
|
|
11236
|
+
processedUrl = `https://www.youtube.com/embed/${videoId}`;
|
|
11237
|
+
}
|
|
11238
|
+
}
|
|
11239
|
+
const videoHTML = `
|
|
11240
|
+
<iframe
|
|
11241
|
+
src="${processedUrl}"
|
|
11242
|
+
style="max-width:100%; height:315px; border:0;"
|
|
11243
|
+
title="Video player"
|
|
11244
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
11245
|
+
allowfullscreen>
|
|
11246
|
+
</iframe>
|
|
11247
|
+
<br/>
|
|
11248
|
+
`;
|
|
11249
|
+
const selection = quill.getSelection();
|
|
11250
|
+
const insertIndex = selection ? selection.index : quill.getLength();
|
|
11251
|
+
quill.clipboard.dangerouslyPasteHTML(insertIndex, videoHTML);
|
|
11252
|
+
quill.setSelection(insertIndex + 1, 0);
|
|
11253
|
+
setVideoUrl("");
|
|
11254
|
+
setShowVideoModal(false);
|
|
11255
|
+
}, [videoUrl, quill]);
|
|
11256
|
+
useEffect5(() => {
|
|
11257
|
+
const handleClickOutside = (event) => {
|
|
11258
|
+
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
11259
|
+
handleVideoCancel();
|
|
11260
|
+
}
|
|
11261
|
+
if (showLinkModal && linkModalRef.current && !linkModalRef.current.contains(event.target)) {
|
|
11262
|
+
handleLinkCancel();
|
|
11263
|
+
}
|
|
11264
|
+
};
|
|
11265
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
11266
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
11267
|
+
}, [showVideoModal, showLinkModal, handleVideoCancel, handleLinkCancel]);
|
|
11268
|
+
return /* @__PURE__ */ jsx50(QuillContainer, { className, children: /* @__PURE__ */ jsxs25(QuillEditor, { style: { position: "relative" }, children: [
|
|
11269
|
+
/* @__PURE__ */ jsx50("div", { ref: quillRef }),
|
|
11270
|
+
showVideoModal && /* @__PURE__ */ jsx50(
|
|
11271
|
+
"div",
|
|
11272
|
+
{
|
|
11273
|
+
ref: videoModalRef,
|
|
11274
|
+
style: {
|
|
11275
|
+
position: "absolute",
|
|
11276
|
+
top: "20px",
|
|
11277
|
+
left: "20px",
|
|
11278
|
+
right: "20px",
|
|
11279
|
+
backgroundColor: "white",
|
|
11280
|
+
border: "1px solid #e0e0e0",
|
|
11281
|
+
borderRadius: "4px",
|
|
11282
|
+
padding: "12px",
|
|
11283
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
|
|
11284
|
+
zIndex: 1e3,
|
|
11285
|
+
width: "fit-content"
|
|
11286
|
+
},
|
|
11287
|
+
children: /* @__PURE__ */ jsxs25(Flex2, { gap: 8, align: "center", children: [
|
|
11288
|
+
/* @__PURE__ */ jsx50(
|
|
11289
|
+
Text,
|
|
11290
|
+
{
|
|
11291
|
+
style: { fontSize: "14px", fontWeight: "500", color: "#333" },
|
|
11292
|
+
children: "V\xEDdeo:"
|
|
11293
|
+
}
|
|
11294
|
+
),
|
|
11295
|
+
/* @__PURE__ */ jsx50(
|
|
11296
|
+
"input",
|
|
11297
|
+
{
|
|
11298
|
+
type: "text",
|
|
11299
|
+
value: videoUrl,
|
|
11300
|
+
onChange: (e) => setVideoUrl(e.target.value),
|
|
11301
|
+
placeholder: "Embed URL",
|
|
11302
|
+
style: {
|
|
11303
|
+
padding: "8px 12px",
|
|
11304
|
+
border: "1px solid #d0d0d0",
|
|
11305
|
+
borderRadius: "4px",
|
|
11306
|
+
fontSize: "14px",
|
|
11307
|
+
backgroundColor: "#f8f8f8"
|
|
11308
|
+
},
|
|
11309
|
+
onKeyDown: (e) => {
|
|
11310
|
+
if (e.key === "Enter") {
|
|
11311
|
+
handleVideoSubmit();
|
|
11312
|
+
} else if (e.key === "Escape") {
|
|
11313
|
+
handleVideoCancel();
|
|
11314
|
+
}
|
|
11315
|
+
},
|
|
11316
|
+
autoFocus: true
|
|
11317
|
+
}
|
|
11318
|
+
),
|
|
11319
|
+
/* @__PURE__ */ jsx50(
|
|
11320
|
+
"button",
|
|
11321
|
+
{
|
|
11322
|
+
onClick: handleVideoSubmit,
|
|
11323
|
+
disabled: !videoUrl.trim(),
|
|
11324
|
+
style: {
|
|
11325
|
+
padding: "8px 16px",
|
|
11326
|
+
backgroundColor: "#007bff",
|
|
11327
|
+
color: "white",
|
|
11328
|
+
border: "none",
|
|
11329
|
+
borderRadius: "4px",
|
|
11330
|
+
fontSize: "14px",
|
|
11331
|
+
cursor: videoUrl.trim() ? "pointer" : "not-allowed",
|
|
11332
|
+
opacity: videoUrl.trim() ? 1 : 0.6
|
|
11333
|
+
},
|
|
11334
|
+
children: "Ok"
|
|
11335
|
+
}
|
|
11336
|
+
)
|
|
11337
|
+
] })
|
|
11338
|
+
}
|
|
11339
|
+
),
|
|
11340
|
+
showLinkModal && /* @__PURE__ */ jsx50(
|
|
11341
|
+
"div",
|
|
11342
|
+
{
|
|
11343
|
+
ref: linkModalRef,
|
|
11344
|
+
style: {
|
|
11345
|
+
position: "absolute",
|
|
11346
|
+
top: "20px",
|
|
11347
|
+
left: "20px",
|
|
11348
|
+
right: "20px",
|
|
11349
|
+
backgroundColor: "white",
|
|
11350
|
+
border: "1px solid #e0e0e0",
|
|
11351
|
+
borderRadius: "4px",
|
|
11352
|
+
padding: "12px",
|
|
11353
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
|
|
11354
|
+
zIndex: 1e3,
|
|
11355
|
+
width: "fit-content"
|
|
11356
|
+
},
|
|
11357
|
+
children: /* @__PURE__ */ jsxs25(Flex2, { gap: 8, align: "center", children: [
|
|
11358
|
+
/* @__PURE__ */ jsx50(
|
|
11359
|
+
Text,
|
|
11360
|
+
{
|
|
11361
|
+
style: { fontSize: "14px", fontWeight: "500", color: "#333" },
|
|
11362
|
+
children: "Link:"
|
|
11363
|
+
}
|
|
11364
|
+
),
|
|
11365
|
+
/* @__PURE__ */ jsx50(
|
|
11366
|
+
"input",
|
|
11367
|
+
{
|
|
11368
|
+
type: "text",
|
|
11369
|
+
value: linkUrl,
|
|
11370
|
+
onChange: (e) => setLinkUrl(e.target.value),
|
|
11371
|
+
placeholder: "URL do link",
|
|
11372
|
+
style: {
|
|
11373
|
+
padding: "8px 12px",
|
|
11374
|
+
border: "1px solid #d0d0d0",
|
|
11375
|
+
borderRadius: "4px",
|
|
11376
|
+
fontSize: "14px",
|
|
11377
|
+
backgroundColor: "#f8f8f8",
|
|
11378
|
+
width: "300px"
|
|
11379
|
+
},
|
|
11380
|
+
onKeyDown: (e) => {
|
|
11381
|
+
if (e.key === "Enter") {
|
|
11382
|
+
handleLinkSubmit();
|
|
11383
|
+
} else if (e.key === "Escape") {
|
|
11384
|
+
handleLinkCancel();
|
|
11385
|
+
}
|
|
11386
|
+
},
|
|
11387
|
+
autoFocus: true
|
|
11388
|
+
}
|
|
11389
|
+
),
|
|
11390
|
+
/* @__PURE__ */ jsx50(
|
|
11391
|
+
"button",
|
|
11392
|
+
{
|
|
11393
|
+
onClick: handleLinkSubmit,
|
|
11394
|
+
disabled: !linkUrl.trim(),
|
|
11395
|
+
style: {
|
|
11396
|
+
padding: "8px 16px",
|
|
11397
|
+
backgroundColor: "#007bff",
|
|
11398
|
+
color: "white",
|
|
11399
|
+
border: "none",
|
|
11400
|
+
borderRadius: "4px",
|
|
11401
|
+
fontSize: "14px",
|
|
11402
|
+
cursor: linkUrl.trim() ? "pointer" : "not-allowed",
|
|
11403
|
+
opacity: linkUrl.trim() ? 1 : 0.6
|
|
11404
|
+
},
|
|
11405
|
+
children: "Ok"
|
|
11406
|
+
}
|
|
11407
|
+
)
|
|
11408
|
+
] })
|
|
11409
|
+
}
|
|
11410
|
+
)
|
|
11411
|
+
] }) });
|
|
11412
|
+
};
|
|
11413
|
+
var QuillComponent_default = QuillComponent;
|
|
11414
|
+
|
|
11415
|
+
// src/components/RichEditor/RichEditor.tsx
|
|
11416
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
11417
|
+
var RichEditor = (props) => {
|
|
11418
|
+
return /* @__PURE__ */ jsx51("div", { children: /* @__PURE__ */ jsx51(ToastProvider, { children: /* @__PURE__ */ jsx51(QuillComponent_default, __spreadValues({}, props)) }) });
|
|
11419
|
+
};
|
|
11420
|
+
var RichEditor_default = RichEditor;
|
|
11421
|
+
|
|
11422
|
+
// src/components/FormFields/RichEditorFormField.tsx
|
|
11423
|
+
import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
11424
|
+
var RichEditorFormField = (_a) => {
|
|
11425
|
+
var _b = _a, {
|
|
11426
|
+
name,
|
|
11427
|
+
label,
|
|
11428
|
+
required,
|
|
11429
|
+
validate,
|
|
11430
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio."
|
|
11431
|
+
} = _b, props = __objRest(_b, [
|
|
11432
|
+
"name",
|
|
11433
|
+
"label",
|
|
11434
|
+
"required",
|
|
11435
|
+
"validate",
|
|
11436
|
+
"validationErrorMessage"
|
|
11437
|
+
]);
|
|
11438
|
+
const { field, fieldState } = useController3({
|
|
11439
|
+
name,
|
|
11440
|
+
rules: {
|
|
11441
|
+
required: required ? validationErrorMessage : false,
|
|
11442
|
+
validate: (value) => {
|
|
11443
|
+
var _a2;
|
|
11444
|
+
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
11445
|
+
return true;
|
|
11446
|
+
return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
|
|
11447
|
+
}
|
|
11448
|
+
},
|
|
11449
|
+
defaultValue: ""
|
|
11450
|
+
});
|
|
11451
|
+
const fieldError = fieldState.error;
|
|
11452
|
+
const haveError = !!fieldError;
|
|
11453
|
+
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
11454
|
+
return /* @__PURE__ */ jsxs26(Flex2, { direction: "column", children: [
|
|
11455
|
+
label && /* @__PURE__ */ jsx52(
|
|
11456
|
+
FormLabel,
|
|
11457
|
+
{
|
|
11458
|
+
name,
|
|
11459
|
+
label,
|
|
11460
|
+
required,
|
|
11461
|
+
haveError
|
|
11462
|
+
}
|
|
11463
|
+
),
|
|
11464
|
+
/* @__PURE__ */ jsx52(
|
|
11465
|
+
RichEditor_default,
|
|
11466
|
+
__spreadProps(__spreadValues({}, props), {
|
|
11467
|
+
value: field.value,
|
|
11468
|
+
onChange: field.onChange,
|
|
11469
|
+
"aria-labelledby": `${name}-label`
|
|
11470
|
+
})
|
|
11471
|
+
),
|
|
11472
|
+
/* @__PURE__ */ jsx52(ErrorFormMessage, { message: errorMsg })
|
|
11473
|
+
] });
|
|
11474
|
+
};
|
|
11475
|
+
|
|
11476
|
+
// src/components/FormFields/CalendarFormField.tsx
|
|
11477
|
+
import { useController as useController4 } from "react-hook-form";
|
|
11478
|
+
import { useCallback as useCallback5 } from "react";
|
|
11479
|
+
import { jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
11480
|
+
var CalendarFormField = (_a) => {
|
|
11481
|
+
var _b = _a, {
|
|
11482
|
+
name,
|
|
11483
|
+
label,
|
|
11484
|
+
required,
|
|
11485
|
+
validate,
|
|
11486
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
|
|
11487
|
+
rules,
|
|
11488
|
+
onChange,
|
|
11489
|
+
allowPastDates
|
|
11490
|
+
} = _b, calendarProps = __objRest(_b, [
|
|
11491
|
+
"name",
|
|
11492
|
+
"label",
|
|
11493
|
+
"required",
|
|
11494
|
+
"validate",
|
|
11495
|
+
"validationErrorMessage",
|
|
11496
|
+
"rules",
|
|
11497
|
+
"onChange",
|
|
11498
|
+
"allowPastDates"
|
|
11499
|
+
]);
|
|
11500
|
+
const handleValidate = useCallback5(
|
|
11501
|
+
(value) => {
|
|
11502
|
+
var _a2;
|
|
11503
|
+
if (value === void 0 || value === null) {
|
|
11504
|
+
if (required) return validationErrorMessage;
|
|
11505
|
+
return true;
|
|
11506
|
+
}
|
|
11507
|
+
return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
|
|
11508
|
+
},
|
|
11509
|
+
[validate, required, validationErrorMessage]
|
|
11510
|
+
);
|
|
11511
|
+
const { field, fieldState } = useController4({
|
|
11512
|
+
name,
|
|
11513
|
+
rules: __spreadValues({
|
|
11514
|
+
required: required ? validationErrorMessage : false,
|
|
11515
|
+
validate: handleValidate
|
|
11516
|
+
}, rules),
|
|
11517
|
+
defaultValue: void 0
|
|
11518
|
+
});
|
|
11519
|
+
const fieldError = fieldState.error;
|
|
11520
|
+
const haveError = !!fieldError;
|
|
11521
|
+
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
11522
|
+
const { value: selected, onChange: setSelected } = field;
|
|
11523
|
+
const handleCalendarChange = (date) => {
|
|
11524
|
+
setSelected(date);
|
|
11525
|
+
};
|
|
11526
|
+
return /* @__PURE__ */ jsxs27(Flex2, { direction: "column", style: { flex: "1" }, children: [
|
|
11527
|
+
label && /* @__PURE__ */ jsx53(
|
|
11528
|
+
FormLabel,
|
|
11529
|
+
{
|
|
11530
|
+
name,
|
|
11531
|
+
label,
|
|
11532
|
+
required,
|
|
11533
|
+
haveError
|
|
11534
|
+
}
|
|
11535
|
+
),
|
|
11536
|
+
/* @__PURE__ */ jsx53(
|
|
11537
|
+
Calendar,
|
|
11538
|
+
__spreadValues({
|
|
11539
|
+
selected,
|
|
11540
|
+
setSelected: (value) => {
|
|
11541
|
+
const date = typeof value === "function" ? value(selected) : value;
|
|
11542
|
+
handleCalendarChange(date);
|
|
11543
|
+
},
|
|
11544
|
+
hasError: haveError,
|
|
11545
|
+
allowPastDates
|
|
11546
|
+
}, calendarProps)
|
|
11547
|
+
),
|
|
11548
|
+
/* @__PURE__ */ jsx53(ErrorFormMessage, { message: errorMsg })
|
|
11549
|
+
] });
|
|
11550
|
+
};
|
|
11551
|
+
|
|
11552
|
+
// src/components/FormFields/TimePickerFormField.tsx
|
|
11553
|
+
import { useController as useController5 } from "react-hook-form";
|
|
11554
|
+
import { useCallback as useCallback6 } from "react";
|
|
11555
|
+
import { jsx as jsx54, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
11556
|
+
var TimePickerFormField = (_a) => {
|
|
11557
|
+
var _b = _a, {
|
|
11558
|
+
name,
|
|
11559
|
+
label,
|
|
11560
|
+
required,
|
|
11561
|
+
validate,
|
|
11562
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
|
|
11563
|
+
rules
|
|
11564
|
+
} = _b, timePickerProps = __objRest(_b, [
|
|
11565
|
+
"name",
|
|
11566
|
+
"label",
|
|
11567
|
+
"required",
|
|
11568
|
+
"validate",
|
|
11569
|
+
"validationErrorMessage",
|
|
11570
|
+
"rules"
|
|
11571
|
+
]);
|
|
11572
|
+
const handleValidate = useCallback6(
|
|
11573
|
+
(value) => {
|
|
11574
|
+
var _a2;
|
|
11575
|
+
if (value === void 0 || value === null || value === "") {
|
|
11576
|
+
if (required) return validationErrorMessage;
|
|
11577
|
+
return true;
|
|
11578
|
+
}
|
|
11579
|
+
return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
|
|
11580
|
+
},
|
|
11581
|
+
[validate, required, validationErrorMessage]
|
|
11582
|
+
);
|
|
11583
|
+
const { field, fieldState } = useController5({
|
|
11584
|
+
name,
|
|
11585
|
+
rules: __spreadValues({
|
|
11586
|
+
required: required ? validationErrorMessage : false,
|
|
11587
|
+
validate: handleValidate
|
|
11588
|
+
}, rules),
|
|
11589
|
+
defaultValue: void 0
|
|
11590
|
+
});
|
|
11591
|
+
const fieldError = fieldState.error;
|
|
11592
|
+
const haveError = !!fieldError;
|
|
11593
|
+
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
11594
|
+
const { value: selected, onChange: setSelected } = field;
|
|
11595
|
+
const handleTimePickerChange = (time) => {
|
|
11596
|
+
setSelected(time);
|
|
11597
|
+
};
|
|
11598
|
+
return /* @__PURE__ */ jsxs28(Flex2, { direction: "column", style: { flex: "1" }, children: [
|
|
11599
|
+
label && /* @__PURE__ */ jsx54(
|
|
11600
|
+
FormLabel,
|
|
11601
|
+
{
|
|
11602
|
+
name,
|
|
11603
|
+
label,
|
|
11604
|
+
required,
|
|
11605
|
+
haveError
|
|
11606
|
+
}
|
|
11607
|
+
),
|
|
11608
|
+
/* @__PURE__ */ jsx54(
|
|
11609
|
+
TimePicker,
|
|
11610
|
+
__spreadValues({
|
|
11611
|
+
selected,
|
|
11612
|
+
setSelected: (value) => {
|
|
11613
|
+
const time = typeof value === "function" ? value(selected) : value;
|
|
11614
|
+
handleTimePickerChange(time);
|
|
11615
|
+
},
|
|
11616
|
+
hasError: haveError
|
|
11617
|
+
}, timePickerProps)
|
|
11618
|
+
),
|
|
11619
|
+
/* @__PURE__ */ jsx54(ErrorFormMessage, { message: errorMsg })
|
|
11620
|
+
] });
|
|
11621
|
+
};
|
|
11622
|
+
|
|
11623
|
+
// src/hooks/useImageUpload.ts
|
|
11624
|
+
import { useState as useState9, useCallback as useCallback7 } from "react";
|
|
11625
|
+
var useImageUpload = (options) => {
|
|
11626
|
+
const [isUploading, setIsUploading] = useState9(false);
|
|
11627
|
+
const [progress, setProgress] = useState9(null);
|
|
11628
|
+
const [error, setError] = useState9(null);
|
|
11629
|
+
const {
|
|
11630
|
+
onSuccess,
|
|
11631
|
+
onError,
|
|
11632
|
+
onProgress,
|
|
11633
|
+
maxFileSize = 5 * 1024 * 1024,
|
|
11634
|
+
// 5MB default
|
|
11635
|
+
allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
11636
|
+
uploadConfig
|
|
11637
|
+
} = options;
|
|
11638
|
+
const validateFile = useCallback7(
|
|
11639
|
+
(file) => {
|
|
11640
|
+
if (!allowedTypes.includes(file.type)) {
|
|
11641
|
+
const errorMsg = "Tipo de arquivo n\xE3o suportado";
|
|
11642
|
+
setError(errorMsg);
|
|
11643
|
+
onError == null ? void 0 : onError(errorMsg);
|
|
11644
|
+
return false;
|
|
11645
|
+
}
|
|
11646
|
+
if (file.size > maxFileSize) {
|
|
11647
|
+
const errorMsg = `Arquivo muito grande. M\xE1ximo: ${(maxFileSize / 1024 / 1024).toFixed(1)}MB`;
|
|
11648
|
+
setError(errorMsg);
|
|
11649
|
+
onError == null ? void 0 : onError(errorMsg);
|
|
11650
|
+
return false;
|
|
11651
|
+
}
|
|
11652
|
+
return true;
|
|
11653
|
+
},
|
|
11654
|
+
[allowedTypes, maxFileSize, onError]
|
|
11655
|
+
);
|
|
11656
|
+
const uploadFile = useCallback7(
|
|
11657
|
+
(file) => __async(null, null, function* () {
|
|
11658
|
+
if (!validateFile(file)) {
|
|
11659
|
+
return null;
|
|
11660
|
+
}
|
|
11661
|
+
setIsUploading(true);
|
|
11662
|
+
setError(null);
|
|
11663
|
+
setProgress(null);
|
|
11664
|
+
try {
|
|
11665
|
+
const uploadedFile = yield UploadService.uploadToS3(
|
|
11666
|
+
file,
|
|
11667
|
+
uploadConfig,
|
|
11668
|
+
(progress2) => {
|
|
11669
|
+
setProgress(progress2);
|
|
11670
|
+
onProgress == null ? void 0 : onProgress(progress2);
|
|
11671
|
+
}
|
|
11672
|
+
);
|
|
11673
|
+
setIsUploading(false);
|
|
11674
|
+
setProgress(null);
|
|
11675
|
+
onSuccess == null ? void 0 : onSuccess(uploadedFile);
|
|
11676
|
+
return uploadedFile;
|
|
11677
|
+
} catch (error2) {
|
|
11678
|
+
console.error("Erro no upload S3:", error2);
|
|
11679
|
+
try {
|
|
11680
|
+
setProgress({
|
|
11681
|
+
amount: 0,
|
|
11682
|
+
message: "Tentando m\xE9todo alternativo..."
|
|
11683
|
+
});
|
|
11684
|
+
const uploadedFile = yield UploadService.uploadViaAPI(
|
|
11685
|
+
file,
|
|
11686
|
+
uploadConfig,
|
|
11687
|
+
(progress2) => {
|
|
11688
|
+
setProgress(progress2);
|
|
11689
|
+
onProgress == null ? void 0 : onProgress(progress2);
|
|
11690
|
+
}
|
|
11691
|
+
);
|
|
11692
|
+
setIsUploading(false);
|
|
11693
|
+
setProgress(null);
|
|
11694
|
+
onSuccess == null ? void 0 : onSuccess(uploadedFile);
|
|
11695
|
+
return uploadedFile;
|
|
11696
|
+
} catch (fallbackError) {
|
|
11697
|
+
console.error("Erro no fallback:", fallbackError);
|
|
11698
|
+
const errorMsg = "Falha no upload da imagem. Tente novamente.";
|
|
11699
|
+
setError(errorMsg);
|
|
11700
|
+
setIsUploading(false);
|
|
11701
|
+
setProgress(null);
|
|
11702
|
+
onError == null ? void 0 : onError(errorMsg);
|
|
11703
|
+
return null;
|
|
11704
|
+
}
|
|
11705
|
+
}
|
|
11706
|
+
}),
|
|
11707
|
+
[validateFile, onSuccess, onError, onProgress]
|
|
11708
|
+
);
|
|
11709
|
+
const reset = useCallback7(() => {
|
|
11710
|
+
setIsUploading(false);
|
|
11711
|
+
setProgress(null);
|
|
11712
|
+
setError(null);
|
|
11713
|
+
}, []);
|
|
11714
|
+
return {
|
|
11715
|
+
uploadFile,
|
|
11716
|
+
isUploading,
|
|
11717
|
+
progress,
|
|
11718
|
+
error,
|
|
11719
|
+
reset
|
|
11720
|
+
};
|
|
11721
|
+
};
|
|
10825
11722
|
export {
|
|
10826
11723
|
AddressFormFields,
|
|
10827
11724
|
Alert,
|
|
@@ -10846,6 +11743,7 @@ export {
|
|
|
10846
11743
|
CNPJFormField,
|
|
10847
11744
|
CPFFormField,
|
|
10848
11745
|
Calendar,
|
|
11746
|
+
CalendarFormField,
|
|
10849
11747
|
Card,
|
|
10850
11748
|
CardStyled,
|
|
10851
11749
|
CheckboxGroup,
|
|
@@ -10880,6 +11778,8 @@ export {
|
|
|
10880
11778
|
RadioGroupFormField,
|
|
10881
11779
|
RadioGroupStyled,
|
|
10882
11780
|
RadioItem,
|
|
11781
|
+
RichEditor_default as RichEditor,
|
|
11782
|
+
RichEditorFormField,
|
|
10883
11783
|
Section,
|
|
10884
11784
|
SectionStyled,
|
|
10885
11785
|
SelectFormField,
|
|
@@ -10905,6 +11805,7 @@ export {
|
|
|
10905
11805
|
TimePickerButtonStyled,
|
|
10906
11806
|
TimePickerDropdownStyled,
|
|
10907
11807
|
TimePickerFooterStyled,
|
|
11808
|
+
TimePickerFormField,
|
|
10908
11809
|
TimePickerStyled,
|
|
10909
11810
|
TimerPickerContentStyled,
|
|
10910
11811
|
ToastItem,
|
|
@@ -10914,23 +11815,15 @@ export {
|
|
|
10914
11815
|
TooltipProvider,
|
|
10915
11816
|
TooltipRoot,
|
|
10916
11817
|
TooltipTrigger,
|
|
11818
|
+
UploadService,
|
|
10917
11819
|
isValidCNPJ,
|
|
10918
11820
|
maskFormat,
|
|
10919
11821
|
maskUnformat,
|
|
11822
|
+
useImageUpload,
|
|
10920
11823
|
useToast
|
|
10921
11824
|
};
|
|
10922
11825
|
/*! Bundled license information:
|
|
10923
11826
|
|
|
10924
|
-
react-is/cjs/react-is.production.min.js:
|
|
10925
|
-
(** @license React v16.13.1
|
|
10926
|
-
* react-is.production.min.js
|
|
10927
|
-
*
|
|
10928
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
10929
|
-
*
|
|
10930
|
-
* This source code is licensed under the MIT license found in the
|
|
10931
|
-
* LICENSE file in the root directory of this source tree.
|
|
10932
|
-
*)
|
|
10933
|
-
|
|
10934
11827
|
react-is/cjs/react-is.development.js:
|
|
10935
11828
|
(** @license React v16.13.1
|
|
10936
11829
|
* react-is.development.js
|