@anker-in/ui 0.1.17 → 0.1.18
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 +10 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1966,7 +1966,7 @@ var QuestionnaireForm = ({
|
|
|
1966
1966
|
onChange: (e) => handleOtherInputChange(questionId, e.target.value),
|
|
1967
1967
|
placeholder: question.placeholder || "Please specify...",
|
|
1968
1968
|
className: cn(
|
|
1969
|
-
"w-full
|
|
1969
|
+
"w-full px-4 py-3 rounded-lg border text-base bg-white dark:bg-white dark:text-gray-900",
|
|
1970
1970
|
"focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:border-transparent",
|
|
1971
1971
|
hasError ? "border-red-500" : "border-[#E4E5E6]"
|
|
1972
1972
|
)
|
|
@@ -2008,11 +2008,17 @@ var QuestionnaireForm = ({
|
|
|
2008
2008
|
optionValue
|
|
2009
2009
|
);
|
|
2010
2010
|
}) });
|
|
2011
|
-
case "select":
|
|
2011
|
+
case "select": {
|
|
2012
|
+
const currentValue = responses[questionId];
|
|
2013
|
+
const hasOnlyOneOption = question.options?.length === 1;
|
|
2014
|
+
const defaultValue = hasOnlyOneOption && !currentValue && question.options?.[0] ? question.options[0].value || question.options[0].label : currentValue || "";
|
|
2015
|
+
if (hasOnlyOneOption && !currentValue && question.options?.[0]) {
|
|
2016
|
+
handleChange(questionId, defaultValue);
|
|
2017
|
+
}
|
|
2012
2018
|
return /* @__PURE__ */ jsx(
|
|
2013
2019
|
"select",
|
|
2014
2020
|
{
|
|
2015
|
-
value:
|
|
2021
|
+
value: defaultValue,
|
|
2016
2022
|
onChange: (e) => handleChange(questionId, e.target.value),
|
|
2017
2023
|
className: cn(
|
|
2018
2024
|
"w-full px-4 py-3 rounded-lg border text-base bg-white dark:bg-white dark:text-gray-900",
|
|
@@ -2030,6 +2036,7 @@ var QuestionnaireForm = ({
|
|
|
2030
2036
|
))
|
|
2031
2037
|
}
|
|
2032
2038
|
);
|
|
2039
|
+
}
|
|
2033
2040
|
default:
|
|
2034
2041
|
return null;
|
|
2035
2042
|
}
|