@anker-in/ui 0.1.17 → 0.1.19
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/dist/index.js +103 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1798,6 +1798,16 @@ var QuestionnaireForm = ({
|
|
|
1798
1798
|
}
|
|
1799
1799
|
});
|
|
1800
1800
|
onSubmit?.(finalResponses);
|
|
1801
|
+
} else {
|
|
1802
|
+
setTimeout(() => {
|
|
1803
|
+
const firstErrorElement = document.querySelector('[data-has-error="true"]');
|
|
1804
|
+
if (firstErrorElement) {
|
|
1805
|
+
firstErrorElement.scrollIntoView({
|
|
1806
|
+
behavior: "smooth",
|
|
1807
|
+
block: "center"
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
}, 100);
|
|
1801
1811
|
}
|
|
1802
1812
|
};
|
|
1803
1813
|
const renderQuestion = (question) => {
|
|
@@ -1980,7 +1990,7 @@ var QuestionnaireForm = ({
|
|
|
1980
1990
|
onChange: (e) => handleOtherInputChange(questionId, e.target.value),
|
|
1981
1991
|
placeholder: question.placeholder || "Please specify...",
|
|
1982
1992
|
className: cn(
|
|
1983
|
-
"w-full
|
|
1993
|
+
"w-full px-4 py-3 rounded-lg border text-base bg-white dark:bg-white dark:text-gray-900",
|
|
1984
1994
|
"focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:border-transparent",
|
|
1985
1995
|
hasError ? "border-red-500" : "border-[#E4E5E6]"
|
|
1986
1996
|
)
|
|
@@ -2022,11 +2032,17 @@ var QuestionnaireForm = ({
|
|
|
2022
2032
|
optionValue
|
|
2023
2033
|
);
|
|
2024
2034
|
}) });
|
|
2025
|
-
case "select":
|
|
2035
|
+
case "select": {
|
|
2036
|
+
const currentValue = responses[questionId];
|
|
2037
|
+
const hasOnlyOneOption = question.options?.length === 1;
|
|
2038
|
+
const defaultValue = hasOnlyOneOption && !currentValue && question.options?.[0] ? question.options[0].value || question.options[0].label : currentValue || "";
|
|
2039
|
+
if (hasOnlyOneOption && !currentValue && question.options?.[0]) {
|
|
2040
|
+
handleChange(questionId, defaultValue);
|
|
2041
|
+
}
|
|
2026
2042
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2027
2043
|
"select",
|
|
2028
2044
|
{
|
|
2029
|
-
value:
|
|
2045
|
+
value: defaultValue,
|
|
2030
2046
|
onChange: (e) => handleChange(questionId, e.target.value),
|
|
2031
2047
|
className: cn(
|
|
2032
2048
|
"w-full px-4 py-3 rounded-lg border text-base bg-white dark:bg-white dark:text-gray-900",
|
|
@@ -2044,6 +2060,7 @@ var QuestionnaireForm = ({
|
|
|
2044
2060
|
))
|
|
2045
2061
|
}
|
|
2046
2062
|
);
|
|
2063
|
+
}
|
|
2047
2064
|
default:
|
|
2048
2065
|
return null;
|
|
2049
2066
|
}
|
|
@@ -2051,62 +2068,78 @@ var QuestionnaireForm = ({
|
|
|
2051
2068
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pb-[80px] light", children: [
|
|
2052
2069
|
questions && questions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-[12px] border border-[#E4E5E6] p-8 dark:bg-white dark:border-[#E4E5E6] l:p-4", children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit, className: cn("space-y-6", className), children: questions.map((question) => {
|
|
2053
2070
|
const questionId = getQuestionId(question);
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2071
|
+
const hasError = !!errors[questionId];
|
|
2072
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2073
|
+
"div",
|
|
2074
|
+
{
|
|
2075
|
+
className: "space-y-2",
|
|
2076
|
+
"data-has-error": hasError ? "true" : "false",
|
|
2077
|
+
children: [
|
|
2078
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block", children: [
|
|
2079
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-base font-bold text-gray-900 dark:text-gray-900", children: [
|
|
2080
|
+
question.label,
|
|
2081
|
+
question.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2082
|
+
] }),
|
|
2083
|
+
question.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm text-gray-600 dark:text-gray-600 font-bold mt-1", children: question.description }),
|
|
2084
|
+
question.type === "email" && questionId === "email" && pageData?.emailDescription && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm text-gray-600 dark:text-gray-600 font-bold mt-1", children: pageData.emailDescription })
|
|
2085
|
+
] }),
|
|
2086
|
+
renderQuestion(question),
|
|
2087
|
+
question.hint && !errors[questionId] && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-500 font-bold", children: question.hint }),
|
|
2088
|
+
errors[questionId] && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2089
|
+
"p",
|
|
2090
|
+
{
|
|
2091
|
+
className: "text-sm font-bold",
|
|
2092
|
+
style: { color: "#FF4D4D" },
|
|
2093
|
+
children: errors[questionId]
|
|
2094
|
+
}
|
|
2095
|
+
)
|
|
2096
|
+
]
|
|
2097
|
+
},
|
|
2098
|
+
questionId
|
|
2099
|
+
);
|
|
2074
2100
|
}) }) }),
|
|
2075
2101
|
!!selectedTimeslotId && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
2076
|
-
pageData?.agrees && pageData.agrees.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2102
|
+
pageData?.agrees && pageData.agrees.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2103
|
+
"div",
|
|
2104
|
+
{
|
|
2105
|
+
className: "space-y-4 mt-8",
|
|
2106
|
+
"data-has-error": agreementError ? "true" : "false",
|
|
2107
|
+
children: [
|
|
2108
|
+
pageData.agrees.map((agreeContent, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2109
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2110
|
+
"input",
|
|
2111
|
+
{
|
|
2112
|
+
type: "checkbox",
|
|
2113
|
+
id: `agreement-${index}`,
|
|
2114
|
+
checked: agreements[index] || false,
|
|
2115
|
+
onChange: (e) => handleAgreementChange(index, e.target.checked),
|
|
2116
|
+
className: "w-5 h-5 rounded text-[#3ADB67] focus:ring-[#3ADB67] cursor-pointer flex-shrink-0",
|
|
2117
|
+
style: {
|
|
2118
|
+
accentColor: "#3ADB67"
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
),
|
|
2122
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2123
|
+
"label",
|
|
2124
|
+
{
|
|
2125
|
+
htmlFor: `agreement-${index}`,
|
|
2126
|
+
className: "text-sm text-gray-700 dark:text-gray-700 font-bold cursor-pointer select-none flex-1 [&_a]:underline [&_a]:text-blue-600 [&_a:hover]:text-blue-700",
|
|
2127
|
+
dangerouslySetInnerHTML: { __html: agreeContent },
|
|
2128
|
+
"aria-label": `Agreement ${index + 1}`
|
|
2129
|
+
}
|
|
2130
|
+
)
|
|
2131
|
+
] }, index)),
|
|
2132
|
+
agreementError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2133
|
+
"p",
|
|
2134
|
+
{
|
|
2135
|
+
className: "text-sm font-bold mt-2",
|
|
2136
|
+
style: { color: "#FF4D4D" },
|
|
2137
|
+
children: agreementError
|
|
2088
2138
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
{
|
|
2094
|
-
htmlFor: `agreement-${index}`,
|
|
2095
|
-
className: "text-sm text-gray-700 dark:text-gray-700 font-bold cursor-pointer select-none flex-1 [&_a]:underline [&_a]:text-blue-600 [&_a:hover]:text-blue-700",
|
|
2096
|
-
dangerouslySetInnerHTML: { __html: agreeContent },
|
|
2097
|
-
"aria-label": `Agreement ${index + 1}`
|
|
2098
|
-
}
|
|
2099
|
-
)
|
|
2100
|
-
] }, index)),
|
|
2101
|
-
agreementError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2102
|
-
"p",
|
|
2103
|
-
{
|
|
2104
|
-
className: "text-sm font-bold mt-2",
|
|
2105
|
-
style: { color: "#FF4D4D" },
|
|
2106
|
-
children: agreementError
|
|
2107
|
-
}
|
|
2108
|
-
)
|
|
2109
|
-
] }),
|
|
2139
|
+
)
|
|
2140
|
+
]
|
|
2141
|
+
}
|
|
2142
|
+
),
|
|
2110
2143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2111
2144
|
"button",
|
|
2112
2145
|
{
|
|
@@ -8936,23 +8969,23 @@ var BookingSuccess = ({
|
|
|
8936
8969
|
return null;
|
|
8937
8970
|
}
|
|
8938
8971
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen l:py-0 l:px-0 py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto", children: [
|
|
8939
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[
|
|
8972
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[48px] xxl:text-[32px] font-bold text-[#080A0F] mb-8", children: pageData.yourAppointment }),
|
|
8940
8973
|
isCancelled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-[16px] l:items-start p-6 mb-4 l:gap-2 flex l:flex-col items-center justify-between", children: [
|
|
8941
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-
|
|
8974
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-[#080A0F]", children: pageData.appointmentCanceled }),
|
|
8942
8975
|
onScheduleAgain && bookingData && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8943
8976
|
"button",
|
|
8944
8977
|
{
|
|
8945
8978
|
onClick: () => onScheduleAgain(bookingData.demoroom_code),
|
|
8946
|
-
className: "px-6 py-3 bg-black text-white rounded-full hover:bg-gray-800 transition-colors whitespace-nowrap",
|
|
8979
|
+
className: "px-6 py-3 text-[16px] bg-black text-white rounded-full hover:bg-gray-800 transition-colors whitespace-nowrap",
|
|
8947
8980
|
children: pageData.scheduleAgain
|
|
8948
8981
|
}
|
|
8949
8982
|
)
|
|
8950
8983
|
] }),
|
|
8951
8984
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-8 bg-white px-[48px] l:px-[16px] l:py-[16px] py-[32px] rounded-[16px]", children: [
|
|
8952
8985
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8953
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-
|
|
8986
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[24px] l:text-[20px] text-[#4A4C56] mb-3", children: pageData.location }),
|
|
8954
8987
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8955
|
-
bookingData.demoroom_name && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-
|
|
8988
|
+
bookingData.demoroom_name && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-[#4A4C56]", children: bookingData.demoroom_name }),
|
|
8956
8989
|
bookingData.address && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-600", children: bookingData.address }),
|
|
8957
8990
|
bookingData.latitude && bookingData.longitude && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8958
8991
|
"a",
|
|
@@ -8967,25 +9000,25 @@ var BookingSuccess = ({
|
|
|
8967
9000
|
] })
|
|
8968
9001
|
] }),
|
|
8969
9002
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8970
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-
|
|
8971
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-base text-
|
|
9003
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[24px] l:text-[20px] text-[#4A4C56] mb-3", children: pageData.dateAndTime }),
|
|
9004
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-base text-[#4A4C56]", children: [
|
|
8972
9005
|
bookingData.booking_date,
|
|
8973
9006
|
bookingData.time_slot && `, ${bookingData.time_slot}`,
|
|
8974
9007
|
!bookingData.time_slot && bookingData.booking_time && `, ${bookingData.booking_time}`
|
|
8975
9008
|
] })
|
|
8976
9009
|
] }),
|
|
8977
9010
|
bookingData.equipment && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8978
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-
|
|
8979
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-
|
|
9011
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[24px] l:text-[20px] text-[#4A4C56] mb-3", children: pageData.event }),
|
|
9012
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-[#4A4C56]", children: Array.isArray(bookingData.equipment) ? bookingData.equipment.join(", ") : bookingData.equipment })
|
|
8980
9013
|
] }),
|
|
8981
9014
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8982
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-
|
|
8983
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-
|
|
9015
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[24px] l:text-[20px] text-[#4A4C56] mb-3", children: pageData.demoRoom }),
|
|
9016
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-[#4A4C56]", children: bookingData.demoroom_code })
|
|
8984
9017
|
] }),
|
|
8985
9018
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8986
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-
|
|
9019
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[24px] l:text-[20px] text-[#4A4C56] mb-3", children: pageData.visitorInfo }),
|
|
8987
9020
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8988
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-
|
|
9021
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-[#4A4C56]", children: bookingData.customer_name }),
|
|
8989
9022
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
|
|
8990
9023
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8991
9024
|
"svg",
|
|
@@ -9098,7 +9131,7 @@ var BookingSuccess = ({
|
|
|
9098
9131
|
}
|
|
9099
9132
|
) }) }),
|
|
9100
9133
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center mb-8", children: [
|
|
9101
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[18px] text-
|
|
9134
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[18px] text-[#4A4C56] mb-2", children: pageData.cancelDialog?.title }),
|
|
9102
9135
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[14px] text-gray-600", children: pageData.cancelDialog?.description })
|
|
9103
9136
|
] }),
|
|
9104
9137
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 justify-center", children: [
|