kupos-ui-components-lib 9.9.10 → 9.10.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.
@@ -106,7 +106,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
106
106
  : "rounded-[10px] border border-[#ccc]"}`, style: Object.assign(Object.assign({}, serviceCardStyle), { backgroundColor: "#fff" }) },
107
107
  React.createElement("div", { style: {
108
108
  padding: "12px 12px 8px 12px",
109
- marginTop: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) && showTopLabel && isConexion
109
+ marginTop: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) && (showTopLabel || isConexion)
110
110
  ? " 10px"
111
111
  : "",
112
112
  } },
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { SurveyProps } from "./types";
3
- declare const SurveyDesktop: ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback, onFeedbackChange, onClose, onSkip, onSubmit, colors, }: SurveyProps) => React.JSX.Element;
3
+ declare const SurveyDesktop: ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback, onFeedbackChange, onClose, onSkip, onSubmit, colors, icons, isLoading, }: SurveyProps) => React.JSX.Element;
4
4
  export default SurveyDesktop;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { Modal } from "../../ui/Modal";
3
- import { ThankYouCard, SurveyHeader, ScoreButtons, FeedbackBanner, FeedbackTextarea, SurveyFooter, getFeedbackConfig, } from "../../ui/Survey";
4
- const SurveyDesktop = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback = "", onFeedbackChange, onClose, onSkip, onSubmit, colors, }) => {
3
+ import { ScoreButtons, FeedbackTextarea, getFeedbackConfig, } from "../../ui/Survey";
4
+ import KuposButton from "../../ui/KuposButton/KuposButton";
5
+ const SurveyDesktop = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback = "", onFeedbackChange, onClose, onSkip, onSubmit, colors, icons, isLoading, }) => {
5
6
  if (!isOpen)
6
7
  return null;
7
8
  const config = getFeedbackConfig(selectedScore);
@@ -10,27 +11,21 @@ const SurveyDesktop = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feed
10
11
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(selectedScore, feedback);
11
12
  }
12
13
  };
13
- return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, variant: "center", size: "lg", maxWidth: 640, padding: isSubmitted ? 0 : "32px 36px 28px", borderRadius: 24, closeOnBackdrop: false }, isSubmitted ? (React.createElement(ThankYouCard, { onClose: onClose })) : (React.createElement(React.Fragment, null,
14
- React.createElement(SurveyHeader, { onClose: onClose }),
15
- React.createElement("h2", { style: {
16
- fontSize: "22px",
17
- lineHeight: 1.25,
18
- color: colors === null || colors === void 0 ? void 0 : colors.primaryColor,
19
- } },
20
- "\u00BFQu\u00E9 tan probable es que",
21
- " ",
22
- React.createElement("em", { style: {
23
- color: colors === null || colors === void 0 ? void 0 : colors.secondaryColor,
24
- } }, "recomiendes"),
25
- " ",
26
- "a un amigo?"),
27
- React.createElement("p", { className: "text-[13.33px]", style: {
28
- color: colors === null || colors === void 0 ? void 0 : colors.primaryColor,
29
- marginBottom: 20,
30
- } }, "Pulsa un n\u00FAmero: 1 significa en absoluto, 10 significa absolutamente."),
31
- React.createElement(ScoreButtons, { selectedScore: selectedScore, onScoreChange: onScoreChange, buttonHeight: 54, fontSize: 15 }),
32
- React.createElement(FeedbackBanner, { config: config }),
33
- React.createElement(FeedbackTextarea, { config: config, feedback: feedback, onFeedbackChange: onFeedbackChange }),
34
- React.createElement(SurveyFooter, { selectedScore: selectedScore, onSkip: onSkip, onSubmit: handleSubmit, colors: colors })))));
14
+ return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, variant: "center", size: "lg", maxWidth: 550, padding: isSubmitted ? 0 : "40px 48px 36px", borderRadius: 28, closeOnBackdrop: false },
15
+ React.createElement(React.Fragment, null,
16
+ React.createElement("button", { onClick: onClose, "aria-label": "Close survey", className: "absolute top-[15px] right-[25px] bg-transparent border-none cursor-pointer text-[22px] text-gray-400 flex items-center justify-center p-1 z-10 transition-colors duration-200 hover:text-gray-600" },
17
+ React.createElement("img", { src: icons.closeIcon, alt: "Close", className: "w-[16px] h-[16px] block" })),
18
+ (icons === null || icons === void 0 ? void 0 : icons.surveyIcon) && (React.createElement("div", { className: "flex justify-center mb-3 mt-2" },
19
+ React.createElement("img", { src: icons.surveyIcon, alt: "Survey Illustration", className: "w-[90px] h-[90px] block" }))),
20
+ React.createElement("h2", { className: "text-[18px] bold-text leading-[1.25] text-center mt-4 mb-2" }, "Ay\u00FAdanos a mejorar"),
21
+ React.createElement("p", { className: "text-[13.33px] text-center leading-[1.4] mb-6 max-w-[460px] mx-auto" },
22
+ "Bas\u00E1ndote en tu experiencia de compra.",
23
+ React.createElement("br", null),
24
+ "\u00BFNos recomendar\u00EDas a un amigo?"),
25
+ React.createElement(ScoreButtons, { selectedScore: selectedScore, onScoreChange: onScoreChange, buttonHeight: 45, fontSize: 15, colors: colors }),
26
+ React.createElement(FeedbackTextarea, { config: config, feedback: feedback, onFeedbackChange: onFeedbackChange, colors: colors }),
27
+ React.createElement("div", { className: "flex justify-center mt-[20px]" },
28
+ React.createElement("div", { className: "w-[180px]" },
29
+ React.createElement(KuposButton, { isSoldOut: selectedScore == null, isLoading: isLoading || false, buttonColor: "#FF8E43", buyLabel: "Enviar", soldOutLabel: "Enviar", onClick: handleSubmit }))))));
35
30
  };
36
31
  export default SurveyDesktop;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { SurveyProps } from "./types";
3
- declare const SurveyMobile: ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback, onFeedbackChange, onClose, onSkip, onSubmit, colors, }: SurveyProps) => React.JSX.Element;
3
+ declare const SurveyMobile: ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback, onFeedbackChange, onClose, onSkip, onSubmit, colors, icons, isLoading, }: SurveyProps) => React.JSX.Element;
4
4
  export default SurveyMobile;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { BottomSheet } from "../../ui/BottomSheet";
3
- import { ThankYouCard, SurveyHeader, ScoreButtons, FeedbackBanner, FeedbackTextarea, SurveyFooter, getFeedbackConfig, } from "../../ui/Survey";
4
- const SurveyMobile = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback = "", onFeedbackChange, onClose, onSkip, onSubmit, colors, }) => {
3
+ import { ThankYouCard, ScoreButtons, FeedbackTextarea, getFeedbackConfig, } from "../../ui/Survey";
4
+ import KuposButton from "../../ui/KuposButton/KuposButton";
5
+ const SurveyMobile = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback = "", onFeedbackChange, onClose, onSkip, onSubmit, colors, icons, isLoading, }) => {
5
6
  if (!isOpen)
6
7
  return null;
7
8
  const config = getFeedbackConfig(selectedScore);
@@ -11,29 +12,19 @@ const SurveyMobile = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedb
11
12
  }
12
13
  };
13
14
  return (React.createElement(BottomSheet, { isOpen: isOpen !== null && isOpen !== void 0 ? isOpen : false, onClose: onClose, showHandle: true, showBackdrop: false, blurBackground: true, blurAmount: "2px", padding: isSubmitted ? 0 : "0 20px 32px" }, isSubmitted ? (React.createElement(ThankYouCard, { onClose: onClose, titleFontSize: "1.35rem" })) : (React.createElement(React.Fragment, null,
14
- React.createElement(SurveyHeader, { onClose: onClose }),
15
- React.createElement("h2", { style: {
16
- fontSize: "1.35rem",
17
- fontWeight: 800,
18
- lineHeight: 1.3,
19
- color: colors === null || colors === void 0 ? void 0 : colors.primaryColor,
20
- marginBottom: 12,
21
- } },
22
- "\u00BFQu\u00E9 tan probable es que",
23
- " ",
24
- React.createElement("em", { style: {
25
- color: colors === null || colors === void 0 ? void 0 : colors.secondaryColor,
26
- } }, "recomiendes"),
27
- " ",
28
- "a un amigo?"),
29
- React.createElement("p", { style: {
30
- fontSize: "13.33px",
31
- color: colors === null || colors === void 0 ? void 0 : colors.primaryColor,
32
- marginBottom: 16,
33
- } }, "Pulsa un n\u00FAmero: 1 significa en absoluto, 10 significa absolutamente."),
34
- React.createElement(ScoreButtons, { selectedScore: selectedScore, onScoreChange: onScoreChange, buttonHeight: 44, fontSize: 13, gap: 6 }),
35
- React.createElement(FeedbackBanner, { config: config }),
15
+ React.createElement("button", { onClick: onClose, "aria-label": "Close survey", className: "absolute top-[15px] right-[25px] bg-transparent border-none cursor-pointer text-[22px] text-gray-400 flex items-center justify-center p-1 z-10 transition-colors duration-200 hover:text-gray-600" },
16
+ React.createElement("img", { src: icons.closeIcon, alt: "Close", className: "w-[16px] h-[16px] block" })),
17
+ (icons === null || icons === void 0 ? void 0 : icons.surveyIcon) && (React.createElement("div", { className: "flex justify-center mb-3 mt-2" },
18
+ React.createElement("img", { src: icons.surveyIcon, alt: "Survey Illustration", className: "w-[90px] h-[90px] block" }))),
19
+ React.createElement("h2", { className: "text-[18px] bold-text leading-[1.25] text-center mt-4 mb-2" }, "Ay\u00FAdanos a mejorar"),
20
+ React.createElement("p", { className: "text-[13.33px] text-center leading-[1.4] mb-6 max-w-[460px] mx-auto" },
21
+ "Bas\u00E1ndote en tu experiencia de compra.",
22
+ React.createElement("br", null),
23
+ "\u00BFNos recomendar\u00EDas a un amigo?"),
24
+ React.createElement(ScoreButtons, { selectedScore: selectedScore, onScoreChange: onScoreChange, buttonHeight: 44, fontSize: 13, gap: 6, colors: colors }),
36
25
  React.createElement(FeedbackTextarea, { config: config, feedback: feedback, onFeedbackChange: onFeedbackChange }),
37
- React.createElement(SurveyFooter, { selectedScore: selectedScore, onSkip: onSkip, onSubmit: handleSubmit, colors: colors, layout: "stacked" })))));
26
+ React.createElement("div", { className: "flex justify-center mt-[20px]" },
27
+ React.createElement("div", { className: "w-[180px]" },
28
+ React.createElement(KuposButton, { isSoldOut: selectedScore == null, isLoading: isLoading || false, buttonColor: "#FF8E43", buyLabel: "Enviar", soldOutLabel: "Enviar", onClick: handleSubmit })))))));
38
29
  };
39
30
  export default SurveyMobile;
@@ -15,4 +15,8 @@ export interface SurveyProps {
15
15
  tertiaryColor?: string;
16
16
  primaryColor?: string;
17
17
  };
18
+ icons?: {
19
+ surveyIcon?: string;
20
+ closeIcon?: string;
21
+ };
18
22
  }
package/dist/styles.css CHANGED
@@ -33,9 +33,6 @@
33
33
  .-top-\[11px\] {
34
34
  top: calc(11px * -1);
35
35
  }
36
- .-top-\[12px\] {
37
- top: calc(12px * -1);
38
- }
39
36
  .-top-\[13px\] {
40
37
  top: calc(13px * -1);
41
38
  }
@@ -4,6 +4,9 @@ interface FeedbackTextareaProps {
4
4
  config: FeedbackConfig | null;
5
5
  feedback: string;
6
6
  onFeedbackChange?: (text: string) => void;
7
+ colors?: {
8
+ primaryColor?: string;
9
+ };
7
10
  }
8
- declare const FeedbackTextarea: ({ config, feedback, onFeedbackChange, }: FeedbackTextareaProps) => React.JSX.Element;
11
+ declare const FeedbackTextarea: ({ config, feedback, onFeedbackChange, colors, }: FeedbackTextareaProps) => React.JSX.Element;
9
12
  export default FeedbackTextarea;
@@ -1,35 +1,33 @@
1
1
  import React from "react";
2
2
  import { MAX_CHARS } from "./constants";
3
- const FeedbackTextarea = ({ config, feedback, onFeedbackChange, }) => {
3
+ const FeedbackTextarea = ({ config, feedback, onFeedbackChange, colors, }) => {
4
4
  if (!config)
5
5
  return null;
6
- return (React.createElement("div", { style: { marginTop: 16 } },
7
- React.createElement("div", { style: {
8
- display: "flex",
9
- alignItems: "center",
10
- gap: 8,
11
- marginBottom: 8,
12
- } },
13
- React.createElement("span", { style: { fontWeight: 700, color: "#111827", fontSize: "13.33px" } }, config.question),
14
- React.createElement("span", { style: {
15
- fontSize: 12,
16
- color: "#6B7280",
17
- background: "#F3F4F6",
18
- borderRadius: 6,
19
- padding: "2px 8px",
20
- } }, "Opcional")),
6
+ return (React.createElement("div", { style: { position: "relative", marginTop: 42 } },
7
+ React.createElement("span", { style: {
8
+ position: "absolute",
9
+ left: 16,
10
+ top: -10,
11
+ background: "#FFFFFF",
12
+ padding: "0 8px",
13
+ fontSize: "13.33px",
14
+ fontWeight: 600,
15
+ color: (colors === null || colors === void 0 ? void 0 : colors.primaryColor) || "#374151",
16
+ zIndex: 1,
17
+ } }, config.question),
21
18
  React.createElement("div", { style: {
22
19
  border: "1.5px solid #E5E7EB",
23
- borderRadius: 14,
20
+ borderRadius: 16,
24
21
  overflow: "hidden",
25
22
  position: "relative",
23
+ background: "transparent",
26
24
  } },
27
25
  React.createElement("textarea", { value: feedback, onChange: (e) => {
28
26
  if (e.target.value.length <= MAX_CHARS)
29
27
  onFeedbackChange === null || onFeedbackChange === void 0 ? void 0 : onFeedbackChange(e.target.value);
30
- }, placeholder: config.placeholder, rows: 4, style: {
28
+ }, placeholder: "D\u00E9janos tus comentarios (opcional)", rows: 4, style: {
31
29
  width: "100%",
32
- padding: "12px 12px 28px",
30
+ padding: "16px 16px 28px",
33
31
  background: "transparent",
34
32
  color: "#374151",
35
33
  fontSize: "13.33px",
@@ -42,12 +40,12 @@ const FeedbackTextarea = ({ config, feedback, onFeedbackChange, }) => {
42
40
  React.createElement("div", { style: {
43
41
  position: "absolute",
44
42
  bottom: 8,
45
- right: 12,
43
+ right: 16,
46
44
  fontSize: 12,
47
45
  color: "#9CA3AF",
48
46
  } },
49
47
  feedback.length,
50
- " / ",
48
+ "/",
51
49
  MAX_CHARS))));
52
50
  };
53
51
  export default FeedbackTextarea;
@@ -5,6 +5,10 @@ interface ScoreButtonsProps {
5
5
  buttonHeight?: number;
6
6
  fontSize?: number;
7
7
  gap?: number;
8
+ colors?: {
9
+ secondaryColor?: string;
10
+ primaryColor?: string;
11
+ };
8
12
  }
9
- declare const ScoreButtons: ({ selectedScore, onScoreChange, buttonHeight, fontSize, gap, }: ScoreButtonsProps) => React.JSX.Element;
13
+ declare const ScoreButtons: ({ selectedScore, onScoreChange, buttonHeight, fontSize, gap, colors, }: ScoreButtonsProps) => React.JSX.Element;
10
14
  export default ScoreButtons;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { getZoneColor, getZoneShadow } from "./constants";
3
- const ScoreButtons = ({ selectedScore, onScoreChange, buttonHeight = 54, fontSize = 15, gap = 8, }) => (React.createElement("div", { style: { marginBottom: 4 } },
3
+ const ScoreButtons = ({ selectedScore, onScoreChange, buttonHeight = 54, fontSize = 15, gap = 8, colors, }) => (React.createElement("div", { style: { marginBottom: 4 } },
4
4
  React.createElement("div", { style: {
5
5
  display: "grid",
6
6
  gridTemplateColumns: "repeat(10, 1fr)",
@@ -8,10 +8,11 @@ const ScoreButtons = ({ selectedScore, onScoreChange, buttonHeight = 54, fontSiz
8
8
  } }, Array.from({ length: 10 }, (_, i) => i + 1).map((num) => {
9
9
  const isSelected = selectedScore === num;
10
10
  const zoneColor = getZoneColor(num);
11
+ const activeColor = (colors === null || colors === void 0 ? void 0 : colors.secondaryColor) || zoneColor;
11
12
  return (React.createElement("button", { key: num, onClick: () => onScoreChange === null || onScoreChange === void 0 ? void 0 : onScoreChange(num), onMouseEnter: (e) => {
12
13
  if (!isSelected) {
13
- e.currentTarget.style.borderColor = zoneColor;
14
- e.currentTarget.style.color = zoneColor;
14
+ e.currentTarget.style.borderColor = activeColor;
15
+ e.currentTarget.style.color = activeColor;
15
16
  }
16
17
  }, onMouseLeave: (e) => {
17
18
  if (!isSelected) {
@@ -20,15 +21,18 @@ const ScoreButtons = ({ selectedScore, onScoreChange, buttonHeight = 54, fontSiz
20
21
  }
21
22
  }, style: {
22
23
  height: buttonHeight,
23
- borderRadius: 14,
24
+ borderRadius: 10,
24
25
  fontSize,
25
- fontWeight: 600,
26
- border: isSelected ? "none" : "1.5px solid #E5E7EB",
27
- background: isSelected ? zoneColor : "#FFFFFF",
26
+ border: isSelected ? "none" : "1px solid #E5E7EB",
27
+ background: isSelected ? activeColor : "#FFFFFF",
28
28
  color: isSelected ? "#FFFFFF" : "#111827",
29
29
  cursor: "pointer",
30
30
  transition: "border-color 0.15s, color 0.15s, background 0.15s",
31
- boxShadow: isSelected ? getZoneShadow(num) : "none",
31
+ boxShadow: isSelected
32
+ ? (colors === null || colors === void 0 ? void 0 : colors.secondaryColor)
33
+ ? `0 2px 8px ${colors.secondaryColor}58`
34
+ : getZoneShadow(num)
35
+ : "none",
32
36
  display: "flex",
33
37
  alignItems: "center",
34
38
  justifyContent: "center",
@@ -40,6 +44,6 @@ const ScoreButtons = ({ selectedScore, onScoreChange, buttonHeight = 54, fontSiz
40
44
  justifyContent: "space-between",
41
45
  marginTop: 8,
42
46
  } },
43
- React.createElement("span", { style: { fontSize: 12, color: "#9CA3AF" } }, "No es probable"),
47
+ React.createElement("span", { style: { fontSize: 12, color: "#9CA3AF" } }, "Poco probable"),
44
48
  React.createElement("span", { style: { fontSize: 12, color: "#9CA3AF" } }, "Muy probable"))));
45
49
  export default ScoreButtons;
@@ -1,5 +1,5 @@
1
1
  export declare const BRAND = "#E84C0D";
2
- export declare const MAX_CHARS = 500;
2
+ export declare const MAX_CHARS = 250;
3
3
  export type FeedbackConfig = {
4
4
  emoji: string;
5
5
  message: string;
@@ -1,5 +1,5 @@
1
1
  export const BRAND = "#E84C0D";
2
- export const MAX_CHARS = 500;
2
+ export const MAX_CHARS = 250;
3
3
  export const getZoneColor = (num) => {
4
4
  if (num <= 6)
5
5
  return "#E84C0D";
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  const ServiceBadgesMobile = ({ showTopLabel, isSoldOut, colors, renderIcon, serviceItem, isConexion, }) => {
3
- return (React.createElement("div", { className: "absolute -top-[12px] left-0 w-full flex items-center justify-end gap-[12px] pr-[17px] z-10" },
4
- showTopLabel && (React.createElement("div", { className: `flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] z-20`, style: {
3
+ return (React.createElement("div", { className: "absolute -top-[11px] left-0 w-full flex items-center justify-end gap-[12px] pr-[17px] z-10" },
4
+ showTopLabel && (React.createElement("div", { className: `flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] h-[24px] z-20`, style: {
5
5
  backgroundColor: "#fff",
6
6
  border: isSoldOut
7
7
  ? "1px solid #ccc"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "9.9.10",
3
+ "version": "9.10.1",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -230,7 +230,7 @@ function ServiceItemMobile({
230
230
  style={{
231
231
  padding: "12px 12px 8px 12px",
232
232
  marginTop:
233
- serviceItem?.is_direct_trip && showTopLabel && isConexion
233
+ serviceItem?.is_direct_trip && (showTopLabel || isConexion)
234
234
  ? " 10px"
235
235
  : "",
236
236
  }}
@@ -24,10 +24,10 @@ const ServiceBadgesMobile: React.FC<ServiceBadgesMobileProps> = ({
24
24
  isConexion,
25
25
  }) => {
26
26
  return (
27
- <div className="absolute -top-[12px] left-0 w-full flex items-center justify-end gap-[12px] pr-[17px] z-10">
27
+ <div className="absolute -top-[11px] left-0 w-full flex items-center justify-end gap-[12px] pr-[17px] z-10">
28
28
  {showTopLabel && (
29
29
  <div
30
- className={`flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] z-20`}
30
+ className={`flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] h-[24px] z-20`}
31
31
  style={{
32
32
  backgroundColor: "#fff",
33
33
  border: isSoldOut