@lets-events/react 10.0.1 → 10.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +19 -18
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +426 -1
  5. package/dist/index.d.ts +426 -1
  6. package/dist/index.js +340 -20
  7. package/dist/index.mjs +331 -19
  8. package/package.json +3 -1
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +128 -128
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +12 -12
  14. package/src/components/Button/styledComponents.ts +250 -250
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +136 -136
  17. package/src/components/Calendar/styledComponents.ts +208 -208
  18. package/src/components/Card.tsx +69 -69
  19. package/src/components/CheckboxGroup.tsx +214 -214
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Dropdown.tsx +167 -167
  22. package/src/components/Filter.tsx +164 -164
  23. package/src/components/Flex.tsx +118 -118
  24. package/src/components/Grid.tsx +137 -137
  25. package/src/components/Icon.tsx +47 -47
  26. package/src/components/Modal.tsx +90 -90
  27. package/src/components/RadioGroup.tsx +210 -210
  28. package/src/components/Section.tsx +33 -33
  29. package/src/components/Step.tsx +164 -164
  30. package/src/components/Switch.tsx +108 -108
  31. package/src/components/Text.tsx +30 -30
  32. package/src/components/TextField.tsx +299 -299
  33. package/src/components/TextareaField.tsx +101 -101
  34. package/src/components/TimePicker.tsx +280 -239
  35. package/src/components/Toast/components/ToastItem.tsx +41 -0
  36. package/src/components/Toast/components/ToastProvider.tsx +63 -0
  37. package/src/components/Toast/hooks/useToast.ts +12 -0
  38. package/src/components/Toast/index.tsx +5 -0
  39. package/src/components/Toast/styles/index.ts +135 -0
  40. package/src/components/Toast/types/index.ts +46 -0
  41. package/src/components/Tooltip/index.tsx +67 -0
  42. package/src/components/Tooltip/styles.ts +78 -0
  43. package/src/hooks/useOnClickOutside.tsx +20 -20
  44. package/src/index.tsx +33 -31
  45. package/src/styles/index.ts +38 -38
  46. package/src/types/typographyValues.ts +178 -178
  47. package/tsconfig.json +3 -3
package/dist/index.js CHANGED
@@ -1075,8 +1075,16 @@ __export(index_exports, {
1075
1075
  TimePickerFooterStyled: () => TimePickerFooterStyled,
1076
1076
  TimePickerStyled: () => TimePickerStyled,
1077
1077
  TimerPickerContentStyled: () => TimerPickerContentStyled,
1078
+ ToastItem: () => ToastItem,
1079
+ ToastProvider: () => ToastProvider,
1080
+ Tooltip: () => Tooltip,
1081
+ TooltipContent: () => TooltipContent,
1082
+ TooltipProvider: () => TooltipProvider,
1083
+ TooltipRoot: () => TooltipRoot,
1084
+ TooltipTrigger: () => TooltipTrigger,
1078
1085
  maskFormat: () => maskFormat,
1079
- maskUnformat: () => maskUnformat
1086
+ maskUnformat: () => maskUnformat,
1087
+ useToast: () => useToast
1080
1088
  });
1081
1089
  module.exports = __toCommonJS(index_exports);
1082
1090
 
@@ -7966,8 +7974,21 @@ var InputStyled = styled("input", {
7966
7974
  color: "$dark400",
7967
7975
  border: "1px solid $dark200",
7968
7976
  cursor: "not-allowed"
7977
+ },
7978
+ inputMode: "numeric",
7979
+ "&::-webkit-inner-spin-button": {
7980
+ WebkitAppearance: "none",
7981
+ margin: 0
7982
+ },
7983
+ "&::-webkit-outer-spin-button": {
7984
+ WebkitAppearance: "none",
7985
+ margin: 0
7986
+ },
7987
+ "&[type='number']": {
7988
+ MozAppearance: "textfield"
7969
7989
  }
7970
7990
  });
7991
+ var pad = (num) => String(num).padStart(2, "0");
7971
7992
  function TimePicker({
7972
7993
  selected,
7973
7994
  setSelected,
@@ -7975,25 +7996,21 @@ function TimePicker({
7975
7996
  }) {
7976
7997
  const [hours, setHours] = (0, import_react5.useState)("00");
7977
7998
  const [minutes, setMinutes] = (0, import_react5.useState)("00");
7999
+ const [rawHours, setRawHours] = (0, import_react5.useState)("00");
8000
+ const [rawMinutes, setRawMinutes] = (0, import_react5.useState)("00");
7978
8001
  const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
7979
8002
  const dropdownRef = (0, import_react5.useRef)(null);
7980
8003
  useOnClickOutside(dropdownRef, () => setIsOpen(false));
7981
- const pad = (num) => String(num).padStart(2, "0");
7982
- const handleInputValue = (0, import_react5.useCallback)(
7983
- (time) => {
7984
- setSelected(time);
7985
- setIsOpen(false);
7986
- },
7987
- [setSelected]
7988
- );
7989
8004
  const handleIncrement = (0, import_react5.useCallback)(
7990
8005
  (type) => {
7991
8006
  if (type === "hours") {
7992
8007
  const next = (parseInt(hours) + 1) % 24;
7993
8008
  setHours(pad(next));
8009
+ setRawHours(pad(next));
7994
8010
  } else {
7995
8011
  const next = (parseInt(minutes) + 1) % 60;
7996
8012
  setMinutes(pad(next));
8013
+ setRawMinutes(pad(next));
7997
8014
  }
7998
8015
  },
7999
8016
  [hours, minutes]
@@ -8003,9 +8020,11 @@ function TimePicker({
8003
8020
  if (type === "hours") {
8004
8021
  const prev = (parseInt(hours) - 1 + 24) % 24;
8005
8022
  setHours(pad(prev));
8023
+ setRawHours(pad(prev));
8006
8024
  } else {
8007
8025
  const prev = (parseInt(minutes) - 1 + 60) % 60;
8008
8026
  setMinutes(pad(prev));
8027
+ setRawMinutes(pad(prev));
8009
8028
  }
8010
8029
  },
8011
8030
  [hours, minutes]
@@ -8076,10 +8095,39 @@ function TimePicker({
8076
8095
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8077
8096
  InputStyled,
8078
8097
  {
8079
- value: unit === "hours" ? hours : minutes,
8080
- onChange: (e) => handleInputValue(e.target.value),
8098
+ inputMode: "numeric",
8099
+ pattern: "[0-9]*",
8081
8100
  type: "text",
8082
- placeholder: "00"
8101
+ placeholder: "00",
8102
+ value: unit === "hours" ? rawHours : rawMinutes,
8103
+ onChange: (e) => {
8104
+ const rawValue = e.target.value.replace(/\D/g, "");
8105
+ if (unit === "hours") {
8106
+ setRawHours(rawValue);
8107
+ } else {
8108
+ setRawMinutes(rawValue);
8109
+ }
8110
+ },
8111
+ onBlur: () => {
8112
+ let num = 0;
8113
+ if (unit === "hours") {
8114
+ num = Math.min(parseInt(rawHours || "0", 10), 23);
8115
+ const padded = pad(num);
8116
+ setHours(padded);
8117
+ setRawHours(padded);
8118
+ } else {
8119
+ num = Math.min(parseInt(rawMinutes || "0", 10), 59);
8120
+ const padded = pad(num);
8121
+ setMinutes(padded);
8122
+ setRawMinutes(padded);
8123
+ }
8124
+ },
8125
+ onPaste: (e) => {
8126
+ const paste = e.clipboardData.getData("Text");
8127
+ if (!/^\d{1,2}$/.test(paste)) {
8128
+ e.preventDefault();
8129
+ }
8130
+ }
8083
8131
  }
8084
8132
  ),
8085
8133
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
@@ -8128,7 +8176,10 @@ function TimePicker({
8128
8176
  type: "button",
8129
8177
  variant: "text",
8130
8178
  color: "brand",
8131
- onClick: () => handleInputValue(`${hours}:${minutes}`),
8179
+ onClick: () => {
8180
+ setSelected(`${hours}:${minutes}`);
8181
+ setIsOpen(false);
8182
+ },
8132
8183
  typography: "buttonMedium",
8133
8184
  fontWeight: "medium",
8134
8185
  children: "Aplicar"
@@ -8751,9 +8802,270 @@ function TextareaField(_a) {
8751
8802
  ] });
8752
8803
  }
8753
8804
 
8805
+ // src/components/Toast/components/ToastItem.tsx
8806
+ var import_react10 = require("react");
8807
+
8808
+ // src/components/Toast/styles/index.ts
8809
+ var import_react9 = require("@stitches/react");
8810
+ var ToastPrimitive = __toESM(require("@radix-ui/react-toast"));
8811
+ var slideIn = (0, import_react9.keyframes)({
8812
+ from: {
8813
+ transform: "translateX(calc(100% + 25px))",
8814
+ opacity: 0
8815
+ },
8816
+ to: {
8817
+ transform: "translateX(0)",
8818
+ opacity: 1
8819
+ }
8820
+ });
8821
+ var slideOut = (0, import_react9.keyframes)({
8822
+ from: {
8823
+ transform: "translateX(0)",
8824
+ opacity: 1
8825
+ },
8826
+ to: {
8827
+ transform: "translateX(calc(100% + 25px))",
8828
+ opacity: 0
8829
+ }
8830
+ });
8831
+ var swipeOut = (0, import_react9.keyframes)({
8832
+ from: {
8833
+ transform: "translateX(var(--radix-toast-swipe-end-x))",
8834
+ opacity: 1
8835
+ },
8836
+ to: {
8837
+ transform: "translateX(calc(100% + 25px))",
8838
+ opacity: 0
8839
+ }
8840
+ });
8841
+ var ToastViewport = styled(ToastPrimitive.Viewport, {
8842
+ position: "fixed",
8843
+ top: 0,
8844
+ right: 0,
8845
+ display: "flex",
8846
+ flexDirection: "column",
8847
+ padding: 25,
8848
+ gap: 10,
8849
+ width: 390,
8850
+ maxWidth: "100vw",
8851
+ margin: 0,
8852
+ listStyle: "none",
8853
+ zIndex: 2147483647,
8854
+ outline: "none"
8855
+ });
8856
+ var ToastRoot = styled(ToastPrimitive.Root, {
8857
+ backgroundColor: "$neutral50",
8858
+ borderRadius: "$sm",
8859
+ boxShadow: "hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px",
8860
+ padding: "$16",
8861
+ gap: "$8",
8862
+ display: "flex",
8863
+ alignItems: "center",
8864
+ border: "1px solid",
8865
+ position: "relative",
8866
+ zIndex: 9999,
8867
+ '&[data-state="open"]': {
8868
+ animation: `${slideIn} 150ms cubic-bezier(0.16, 1, 0.3, 1)`
8869
+ },
8870
+ '&[data-state="closed"]': {
8871
+ animation: `${slideOut} 100ms ease-in`
8872
+ },
8873
+ '&[data-swipe="move"]': {
8874
+ transform: "translateX(var(--radix-toast-swipe-move-x))"
8875
+ },
8876
+ '&[data-swipe="cancel"]': {
8877
+ transform: "translateX(0)",
8878
+ transition: "transform 200ms ease-out"
8879
+ },
8880
+ '&[data-swipe="end"]': {
8881
+ animation: `${swipeOut} 100ms ease-out`
8882
+ },
8883
+ $$toastColor: "inherit",
8884
+ color: "$$toastColor",
8885
+ borderColor: "$$toastColor",
8886
+ variants: {
8887
+ type: {
8888
+ success: {
8889
+ $$toastColor: "$colors$success600",
8890
+ backgroundColor: "$success50"
8891
+ },
8892
+ error: {
8893
+ $$toastColor: "$colors$error600",
8894
+ backgroundColor: "$error50"
8895
+ },
8896
+ warning: {
8897
+ $$toastColor: "$colors$warning600",
8898
+ backgroundColor: "$warning50"
8899
+ },
8900
+ info: {
8901
+ $$toastColor: "$colors$info600",
8902
+ backgroundColor: "$info50"
8903
+ }
8904
+ }
8905
+ },
8906
+ defaultVariants: {
8907
+ type: "info"
8908
+ }
8909
+ });
8910
+ var ToastClose = styled(ToastPrimitive.Close, {
8911
+ border: "none",
8912
+ backgroundColor: "transparent",
8913
+ display: "flex",
8914
+ alignItems: "center",
8915
+ justifyContent: "center",
8916
+ color: "inherit",
8917
+ borderRadius: 4,
8918
+ padding: 4,
8919
+ cursor: "pointer",
8920
+ opacity: 0.7,
8921
+ "&:hover": {
8922
+ opacity: 1,
8923
+ backgroundColor: "rgba(0, 0, 0, 0.05)"
8924
+ },
8925
+ "&:focus": {
8926
+ boxShadow: "0 0 0 2px currentColor",
8927
+ opacity: 1
8928
+ }
8929
+ });
8930
+
8931
+ // src/components/Toast/components/ToastItem.tsx
8932
+ var import_jsx_runtime21 = require("react/jsx-runtime");
8933
+ function ToastItem({
8934
+ toast,
8935
+ onRemove
8936
+ }) {
8937
+ const [open, setOpen] = (0, import_react10.useState)(true);
8938
+ const handleOpenChange = (open2) => {
8939
+ setOpen(open2);
8940
+ if (!open2) {
8941
+ onRemove(toast.id);
8942
+ }
8943
+ };
8944
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
8945
+ ToastRoot,
8946
+ {
8947
+ type: toast.type,
8948
+ duration: toast.duration,
8949
+ open,
8950
+ onOpenChange: handleOpenChange,
8951
+ children: [
8952
+ (toast == null ? void 0 : toast.icon) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon_default, { name: toast.icon, size: "xl" }),
8953
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { typography: "bodyS", fontWeight: "medium", children: toast.message }) }),
8954
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToastClose, { "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon_default, { name: "xmark", size: "md" }) })
8955
+ ]
8956
+ }
8957
+ );
8958
+ }
8959
+
8960
+ // src/components/Toast/components/ToastProvider.tsx
8961
+ var import_react11 = require("react");
8962
+ var ToastPrimitive2 = __toESM(require("@radix-ui/react-toast"));
8963
+ var import_jsx_runtime22 = require("react/jsx-runtime");
8964
+ var ToastContext = (0, import_react11.createContext)(null);
8965
+ function ToastProvider({
8966
+ children,
8967
+ defaultDuration = 5e3,
8968
+ maxToasts = 5,
8969
+ swipeDirection = "right"
8970
+ }) {
8971
+ const [toasts, setToasts] = (0, import_react11.useState)([]);
8972
+ const addToast = (toastData) => {
8973
+ const id = Math.random().toString(36).substr(2, 9);
8974
+ const newToast = __spreadProps(__spreadValues({
8975
+ id
8976
+ }, toastData), {
8977
+ type: (toastData == null ? void 0 : toastData.type) || "info",
8978
+ duration: (toastData == null ? void 0 : toastData.duration) || defaultDuration,
8979
+ createdAt: Date.now()
8980
+ });
8981
+ setToasts((prevToasts) => {
8982
+ const updatedToasts = [...prevToasts, newToast];
8983
+ return updatedToasts.slice(-maxToasts);
8984
+ });
8985
+ return id;
8986
+ };
8987
+ const removeToast = (id) => {
8988
+ setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id));
8989
+ };
8990
+ const removeAllToasts = () => {
8991
+ setToasts([]);
8992
+ };
8993
+ const contextValue = {
8994
+ toasts,
8995
+ addToast,
8996
+ removeToast,
8997
+ removeAllToasts
8998
+ };
8999
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToastContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ToastPrimitive2.Provider, { swipeDirection, children: [
9000
+ children,
9001
+ toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToastItem, { toast, onRemove: removeToast }, toast.id)),
9002
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToastViewport, {})
9003
+ ] }) });
9004
+ }
9005
+
9006
+ // src/components/Toast/hooks/useToast.ts
9007
+ var import_react12 = require("react");
9008
+ var useToast = () => {
9009
+ const context = (0, import_react12.useContext)(ToastContext);
9010
+ if (!context) {
9011
+ throw new Error("useToast deve ser usado dentro de um ToastProvider");
9012
+ }
9013
+ return context;
9014
+ };
9015
+
9016
+ // src/components/Tooltip/index.tsx
9017
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
9018
+ var import_jsx_runtime23 = require("react/jsx-runtime");
9019
+ var TooltipProvider = TooltipPrimitive.Provider;
9020
+ var TooltipRoot = TooltipPrimitive.Root;
9021
+ var TooltipTrigger = TooltipPrimitive.Trigger;
9022
+ var TooltipContent = styled(TooltipPrimitive.Content, {
9023
+ backgroundColor: "$dark800",
9024
+ color: "$neutral50",
9025
+ borderRadius: "4px",
9026
+ padding: "10px 15px",
9027
+ fontSize: "14px",
9028
+ lineHeight: 1,
9029
+ zIndex: 100,
9030
+ boxShadow: "0 2px 10px rgba(0, 0, 0, 0.1)",
9031
+ userSelect: "none",
9032
+ animationDuration: "400ms",
9033
+ animationTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)",
9034
+ willChange: "transform, opacity",
9035
+ '&[data-state="delayed-open"][data-side="top"]': {
9036
+ animationName: "slideDownAndFade"
9037
+ },
9038
+ '&[data-state="delayed-open"][data-side="right"]': {
9039
+ animationName: "slideLeftAndFade"
9040
+ },
9041
+ '&[data-state="delayed-open"][data-side="bottom"]': {
9042
+ animationName: "slideUpAndFade"
9043
+ },
9044
+ '&[data-state="delayed-open"][data-side="left"]': {
9045
+ animationName: "slideRightAndFade"
9046
+ }
9047
+ });
9048
+ var TooltipArrow = styled(TooltipPrimitive.Arrow, {
9049
+ fill: "$dark800"
9050
+ });
9051
+ function Tooltip({
9052
+ children,
9053
+ content,
9054
+ delayDuration = 200,
9055
+ side = "top"
9056
+ }) {
9057
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(TooltipRoot, { delayDuration, children: [
9058
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children }),
9059
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(TooltipContent, { side, sideOffset: 5, children: [
9060
+ typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { typography: "tooltip", children: content }) : content,
9061
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipArrow, {})
9062
+ ] })
9063
+ ] }) });
9064
+ }
9065
+
8754
9066
  // src/components/Grid.tsx
8755
9067
  var import_themes19 = require("@radix-ui/themes");
8756
- var import_jsx_runtime21 = require("react/jsx-runtime");
9068
+ var import_jsx_runtime24 = require("react/jsx-runtime");
8757
9069
  var GridStyled = styled(import_themes19.Grid, {
8758
9070
  display: "grid",
8759
9071
  variants: {
@@ -8875,12 +9187,12 @@ var GridStyled = styled(import_themes19.Grid, {
8875
9187
  });
8876
9188
  function Grid(_a) {
8877
9189
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
8878
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridStyled, __spreadProps(__spreadValues({}, props), { children }));
9190
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GridStyled, __spreadProps(__spreadValues({}, props), { children }));
8879
9191
  }
8880
9192
 
8881
9193
  // src/components/Container.tsx
8882
9194
  var import_themes20 = require("@radix-ui/themes");
8883
- var import_jsx_runtime22 = require("react/jsx-runtime");
9195
+ var import_jsx_runtime25 = require("react/jsx-runtime");
8884
9196
  var ContainerStyled = styled(import_themes20.Container, {
8885
9197
  variants: {
8886
9198
  size: {
@@ -8910,12 +9222,12 @@ var ContainerStyled = styled(import_themes20.Container, {
8910
9222
  });
8911
9223
  function Container(_a) {
8912
9224
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
8913
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ContainerStyled, __spreadProps(__spreadValues({}, props), { children }));
9225
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ContainerStyled, __spreadProps(__spreadValues({}, props), { children }));
8914
9226
  }
8915
9227
 
8916
9228
  // src/components/Section.tsx
8917
9229
  var import_themes21 = require("@radix-ui/themes");
8918
- var import_jsx_runtime23 = require("react/jsx-runtime");
9230
+ var import_jsx_runtime26 = require("react/jsx-runtime");
8919
9231
  var SectionStyled = styled(import_themes21.Section, {
8920
9232
  variants: {
8921
9233
  size: {
@@ -8939,7 +9251,7 @@ var SectionStyled = styled(import_themes21.Section, {
8939
9251
  });
8940
9252
  function Section(_a) {
8941
9253
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
8942
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SectionStyled, __spreadProps(__spreadValues({}, props), { children }));
9254
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SectionStyled, __spreadProps(__spreadValues({}, props), { children }));
8943
9255
  }
8944
9256
  // Annotate the CommonJS export names for ESM import in node:
8945
9257
  0 && (module.exports = {
@@ -9007,8 +9319,16 @@ function Section(_a) {
9007
9319
  TimePickerFooterStyled,
9008
9320
  TimePickerStyled,
9009
9321
  TimerPickerContentStyled,
9322
+ ToastItem,
9323
+ ToastProvider,
9324
+ Tooltip,
9325
+ TooltipContent,
9326
+ TooltipProvider,
9327
+ TooltipRoot,
9328
+ TooltipTrigger,
9010
9329
  maskFormat,
9011
- maskUnformat
9330
+ maskUnformat,
9331
+ useToast
9012
9332
  });
9013
9333
  /*! Bundled license information:
9014
9334