@swan-io/shared-business 8.14.3 → 8.14.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/shared-business",
3
- "version": "8.14.3",
3
+ "version": "8.14.4",
4
4
  "engines": {
5
5
  "node": ">=20.9.0",
6
6
  "yarn": "^1.22.0"
@@ -0,0 +1,7 @@
1
+ export type BirthdatePickerProps = {
2
+ label: string;
3
+ value: string | undefined;
4
+ error?: string;
5
+ onValueChange: (value: string | undefined) => void;
6
+ };
7
+ export declare const BirthdatePicker: ({ value, label, onValueChange, error: externalError, }: BirthdatePickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -55,7 +55,7 @@ const order = match(getCountry().cca2)
55
55
  .with("US", () => "MDY")
56
56
  .with("CN", "JP", "KR", "KP", "TW", "HU", "MN", "LT", "BT", () => "YMD")
57
57
  .otherwise(() => "DMY");
58
- export const InlineDatePicker = ({ value, label, onValueChange }) => {
58
+ export const BirthdatePicker = ({ value, label, onValueChange, error: externalError, }) => {
59
59
  const { desktop } = useResponsive(breakpoints.small);
60
60
  const { Field } = useForm({
61
61
  birthdate: {
@@ -84,7 +84,7 @@ export const InlineDatePicker = ({ value, label, onValueChange }) => {
84
84
  });
85
85
  return (_jsx(Field, { name: "birthdate", children: ({ error, onBlur, onChange, value }) => (_jsx(LakeLabel, { label: label, render: id => {
86
86
  var _a;
87
- const day = (_jsx(View, { style: desktop ? styles.day : styles.dayMobile, children: _jsx(LakeTextInput, { id: id, style: isNotNullish(error) && styles.error, placeholder: t("datePicker.day"), value: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : undefined, onBlur: onBlur, hideErrors: true, onChangeText: day => {
87
+ const day = (_jsx(View, { style: desktop ? styles.day : styles.dayMobile, children: _jsx(LakeTextInput, { id: id, style: (isNotNullish(error) || isNotNullish(externalError)) && styles.error, placeholder: t("datePicker.day"), value: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : undefined, onBlur: onBlur, hideErrors: true, onChangeText: day => {
88
88
  var _a, _b;
89
89
  onChange({
90
90
  day,
@@ -92,7 +92,7 @@ export const InlineDatePicker = ({ value, label, onValueChange }) => {
92
92
  year: (_b = value === null || value === void 0 ? void 0 : value.year) !== null && _b !== void 0 ? _b : "",
93
93
  });
94
94
  }, pattern: "[0-9]", maxLength: 2, autoComplete: "bday-day" }) }));
95
- const month = (_jsx(LakeSelect, { value: (value === null || value === void 0 ? void 0 : value.month) === "" ? undefined : value === null || value === void 0 ? void 0 : value.month, style: isNotNullish(error) && styles.error, placeholder: t("datePicker.month"), hideErrors: true, items: months, onValueChange: month => {
95
+ const month = (_jsx(LakeSelect, { value: (value === null || value === void 0 ? void 0 : value.month) === "" ? undefined : value === null || value === void 0 ? void 0 : value.month, style: (isNotNullish(error) || isNotNullish(externalError)) && styles.error, placeholder: t("datePicker.month"), hideErrors: true, items: months, onValueChange: month => {
96
96
  var _a, _b;
97
97
  onChange({
98
98
  day: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : "",
@@ -100,7 +100,7 @@ export const InlineDatePicker = ({ value, label, onValueChange }) => {
100
100
  year: (_b = value === null || value === void 0 ? void 0 : value.year) !== null && _b !== void 0 ? _b : "",
101
101
  });
102
102
  } }));
103
- const year = (_jsx(View, { style: desktop ? styles.year : styles.yearMobile, children: _jsx(LakeTextInput, { value: value === null || value === void 0 ? void 0 : value.year, style: isNotNullish(error) && styles.error, placeholder: t("datePicker.year"), onBlur: onBlur, hideErrors: true, onChangeText: year => {
103
+ const year = (_jsx(View, { style: desktop ? styles.year : styles.yearMobile, children: _jsx(LakeTextInput, { value: value === null || value === void 0 ? void 0 : value.year, style: (isNotNullish(error) || isNotNullish(externalError)) && styles.error, placeholder: t("datePicker.year"), onBlur: onBlur, hideErrors: true, onChangeText: year => {
104
104
  var _a, _b;
105
105
  return onChange({
106
106
  day: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : "",
@@ -108,6 +108,6 @@ export const InlineDatePicker = ({ value, label, onValueChange }) => {
108
108
  year,
109
109
  });
110
110
  }, pattern: "[0-9]", maxLength: 4, autoComplete: "bday-year" }) }));
111
- return (_jsxs(Box, { children: [order === "DMY" ? (_jsxs(Stack, { direction: "row", space: 4, children: [day, " ", month, " ", year] })) : (_jsxs(Stack, { direction: "row", space: 4, children: [month, " ", day, " ", year] })), _jsx(InputError, { message: error })] }));
111
+ return (_jsxs(Box, { children: [order === "DMY" ? (_jsxs(Stack, { direction: "row", space: 4, children: [day, " ", month, " ", year] })) : (_jsxs(Stack, { direction: "row", space: 4, children: [month, " ", day, " ", year] })), _jsx(InputError, { message: error !== null && error !== void 0 ? error : externalError })] }));
112
112
  } })) }));
113
113
  };
@@ -1,8 +0,0 @@
1
- export type InlineDatePickerProps = {
2
- label: string;
3
- value: string | undefined;
4
- error?: string;
5
- onBlur?: () => void;
6
- onValueChange: (value: string | undefined) => void;
7
- };
8
- export declare const InlineDatePicker: ({ value, label, onValueChange }: InlineDatePickerProps) => import("react/jsx-runtime").JSX.Element;