@sikka/hawa 0.46.4-next → 0.47.0-next
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/{Radio-Dyvlywnk.d.mts → Radio-BPHTeDMz.d.mts} +8 -7
- package/dist/{Radio-DlPwVCG4.d.ts → Radio-cRcIH8_L.d.ts} +8 -7
- package/dist/blocks/auth/index.d.mts +8 -8
- package/dist/blocks/auth/index.d.ts +8 -8
- package/dist/blocks/auth/index.js +85 -128
- package/dist/blocks/auth/index.mjs +18 -50
- package/dist/blocks/feedback/index.js +68 -79
- package/dist/blocks/feedback/index.mjs +1 -1
- package/dist/blocks/index.d.mts +3 -3
- package/dist/blocks/index.d.ts +3 -3
- package/dist/blocks/index.js +85 -128
- package/dist/blocks/index.mjs +5 -24
- package/dist/blocks/misc/index.js +68 -79
- package/dist/blocks/misc/index.mjs +1 -1
- package/dist/{chunk-5CTMGPEF.mjs → chunk-342KIV4R.mjs} +81 -105
- package/dist/{chunk-6TG2PHZK.mjs → chunk-AWJSHOYU.mjs} +68 -79
- package/dist/elements/index.d.mts +2 -2
- package/dist/elements/index.d.ts +2 -2
- package/dist/elements/index.js +81 -105
- package/dist/elements/index.mjs +1 -1
- package/dist/index.d.mts +10 -9
- package/dist/index.d.ts +10 -9
- package/dist/index.js +85 -128
- package/dist/index.mjs +85 -128
- package/dist/phoneInput/index.d.mts +7 -7
- package/dist/phoneInput/index.d.ts +7 -7
- package/dist/phoneInput/index.js +78 -85
- package/dist/phoneInput/index.js.map +1 -1
- package/dist/phoneInput/index.mjs +78 -85
- package/dist/phoneInput/index.mjs.map +1 -1
- package/dist/pinInput/index.js +3 -20
- package/dist/pinInput/index.js.map +1 -1
- package/dist/pinInput/index.mjs +3 -20
- package/dist/pinInput/index.mjs.map +1 -1
- package/dist/select/index.d.mts +1 -0
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +68 -79
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +68 -79
- package/dist/select/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -5790,6 +5790,7 @@ var import_clsx3 = __toESM(require("clsx"));
|
|
5790
5790
|
var Select = ({
|
5791
5791
|
labelProps,
|
5792
5792
|
labelKey = "label",
|
5793
|
+
valueKey = "value",
|
5793
5794
|
...props
|
5794
5795
|
}) => {
|
5795
5796
|
const NoOption = () => {
|
@@ -5809,13 +5810,7 @@ var Select = ({
|
|
5809
5810
|
children
|
5810
5811
|
);
|
5811
5812
|
};
|
5812
|
-
const Option = ({
|
5813
|
-
children,
|
5814
|
-
innerProps,
|
5815
|
-
innerRef,
|
5816
|
-
isFocused,
|
5817
|
-
isSelected
|
5818
|
-
}) => {
|
5813
|
+
const Option = ({ children, innerProps, innerRef, isFocused, isSelected }) => {
|
5819
5814
|
return /* @__PURE__ */ import_react35.default.createElement(
|
5820
5815
|
"div",
|
5821
5816
|
{
|
@@ -5830,14 +5825,7 @@ var Select = ({
|
|
5830
5825
|
children
|
5831
5826
|
);
|
5832
5827
|
};
|
5833
|
-
const Menu2 = ({
|
5834
|
-
cx,
|
5835
|
-
children,
|
5836
|
-
getStyles,
|
5837
|
-
innerProps,
|
5838
|
-
innerRef,
|
5839
|
-
...menuProps
|
5840
|
-
}) => {
|
5828
|
+
const Menu2 = ({ cx, children, getStyles, innerProps, innerRef, ...menuProps }) => {
|
5841
5829
|
const menuOpen = menuProps.selectProps.menuIsOpen;
|
5842
5830
|
return /* @__PURE__ */ import_react35.default.createElement(
|
5843
5831
|
"div",
|
@@ -5866,71 +5854,72 @@ var Select = ({
|
|
5866
5854
|
)
|
5867
5855
|
},
|
5868
5856
|
props.label && /* @__PURE__ */ import_react35.default.createElement(Label2, { ...labelProps }, props.label),
|
5869
|
-
props.isLoading ? /* @__PURE__ */ import_react35.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? (
|
5870
|
-
|
5871
|
-
|
5872
|
-
|
5873
|
-
{
|
5874
|
-
|
5875
|
-
|
5876
|
-
|
5877
|
-
|
5878
|
-
|
5879
|
-
|
5880
|
-
|
5881
|
-
|
5882
|
-
|
5883
|
-
|
5884
|
-
|
5885
|
-
|
5886
|
-
|
5887
|
-
|
5888
|
-
|
5889
|
-
|
5890
|
-
|
5891
|
-
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5896
|
-
props.disabled && "hawa-opacity-30"
|
5897
|
-
)
|
5898
|
-
},
|
5899
|
-
unstyled: true,
|
5900
|
-
autoFocus: false,
|
5901
|
-
components: props.hideIndicator ? { Option, Menu: Menu2, IndicatorsContainer: () => null } : {
|
5857
|
+
props.isLoading ? /* @__PURE__ */ import_react35.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? /* @__PURE__ */ import_react35.default.createElement(
|
5858
|
+
import_react_select.default,
|
5859
|
+
{
|
5860
|
+
noOptionsMessage: NoOption,
|
5861
|
+
classNames: {
|
5862
|
+
control: () => cn(props.phoneCode && "hawa-rounded-r-none", props.controlClassNames),
|
5863
|
+
container: () => cn(
|
5864
|
+
selectContainerStyles,
|
5865
|
+
props.phoneCode && phoneCodeStyles,
|
5866
|
+
props.isMulti && "hawa-ps-0 "
|
5867
|
+
),
|
5868
|
+
placeholder: () => cn(selectPlaceholderStyles, props.disabled && "hawa-text-muted-foreground"),
|
5869
|
+
valueContainer: () => "hawa-text-foreground hawa-px-1",
|
5870
|
+
singleValue: () => cn(
|
5871
|
+
props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
|
5872
|
+
),
|
5873
|
+
indicatorsContainer: () => cn(
|
5874
|
+
selectIndicatorContainerStyles,
|
5875
|
+
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5876
|
+
props.disabled && "hawa-opacity-30"
|
5877
|
+
)
|
5878
|
+
},
|
5879
|
+
unstyled: true,
|
5880
|
+
autoFocus: false,
|
5881
|
+
components: props.hideIndicator ? {
|
5882
|
+
Option: (optionProps) => /* @__PURE__ */ import_react35.default.createElement(
|
5902
5883
|
Option,
|
5903
|
-
|
5904
|
-
|
5905
|
-
|
5906
|
-
|
5907
|
-
|
5908
|
-
|
5909
|
-
|
5910
|
-
|
5911
|
-
|
5912
|
-
|
5913
|
-
|
5914
|
-
|
5915
|
-
|
5916
|
-
|
5917
|
-
className
|
5918
|
-
|
5919
|
-
|
5920
|
-
|
5921
|
-
|
5922
|
-
|
5923
|
-
|
5924
|
-
|
5925
|
-
|
5926
|
-
|
5927
|
-
|
5928
|
-
|
5929
|
-
|
5930
|
-
|
5931
|
-
|
5932
|
-
|
5933
|
-
|
5884
|
+
{
|
5885
|
+
...optionProps,
|
5886
|
+
isSelected: optionProps.data[valueKey] === props.value[valueKey]
|
5887
|
+
}
|
5888
|
+
),
|
5889
|
+
Menu: Menu2,
|
5890
|
+
IndicatorsContainer: () => null
|
5891
|
+
} : {
|
5892
|
+
Option,
|
5893
|
+
Menu: Menu2,
|
5894
|
+
ValueContainer: (e) => /* @__PURE__ */ import_react35.default.createElement(
|
5895
|
+
"div",
|
5896
|
+
{
|
5897
|
+
className: cn(
|
5898
|
+
e.className,
|
5899
|
+
"hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-2 hawa-w-full hawa-cursor-pointer"
|
5900
|
+
),
|
5901
|
+
...e
|
5902
|
+
}
|
5903
|
+
),
|
5904
|
+
MultiValueContainer: (e) => /* @__PURE__ */ import_react35.default.createElement(
|
5905
|
+
"div",
|
5906
|
+
{
|
5907
|
+
className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
|
5908
|
+
...e
|
5909
|
+
}
|
5910
|
+
)
|
5911
|
+
},
|
5912
|
+
onChange: (newValue, action) => props.onChange(newValue, action),
|
5913
|
+
options: props.options,
|
5914
|
+
getOptionLabel: props.getOptionLabel,
|
5915
|
+
defaultValue: props.defaultValue,
|
5916
|
+
value: props.value,
|
5917
|
+
placeholder: props.placeholder,
|
5918
|
+
isDisabled: props.disabled,
|
5919
|
+
isClearable: props.isClearable,
|
5920
|
+
isMulti: props.isMulti,
|
5921
|
+
isSearchable: props.isSearchable
|
5922
|
+
}
|
5934
5923
|
) : /* @__PURE__ */ import_react35.default.createElement(
|
5935
5924
|
import_creatable.default,
|
5936
5925
|
{
|
@@ -7920,11 +7909,13 @@ var PhoneInput = ({
|
|
7920
7909
|
countryCodes,
|
7921
7910
|
...props
|
7922
7911
|
}) => {
|
7912
|
+
var _a;
|
7923
7913
|
const [phoneNumber, setPhoneNumber] = (0, import_react39.useState)("");
|
7924
|
-
const [countryCode, setCountryCode] = (0, import_react39.useState)(
|
7914
|
+
const [countryCode, setCountryCode] = (0, import_react39.useState)(
|
7915
|
+
props.preferredCountry || { label: "+966" }
|
7916
|
+
);
|
7925
7917
|
const inputRef = (0, import_react39.useRef)(null);
|
7926
7918
|
const handleInputChange = (e) => {
|
7927
|
-
console.log("test e ", e.target.value);
|
7928
7919
|
const validChars = /^[0-9-()]+$/;
|
7929
7920
|
const input = e.target.value;
|
7930
7921
|
if (input === "" || validChars.test(input)) {
|
@@ -7946,11 +7937,13 @@ var PhoneInput = ({
|
|
7946
7937
|
isMulti: false,
|
7947
7938
|
isSearchable: true,
|
7948
7939
|
isClearable: false,
|
7949
|
-
placeholder:
|
7940
|
+
placeholder: (_a = props.preferredCountry) == null ? void 0 : _a.label,
|
7950
7941
|
options: countryCodes || countries_default,
|
7951
|
-
onChange: setCountryCode,
|
7952
|
-
|
7953
|
-
|
7942
|
+
onChange: (e) => setCountryCode({ label: e.label, value: e.label }),
|
7943
|
+
valueKey: "label",
|
7944
|
+
labelKey: "label",
|
7945
|
+
value: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label },
|
7946
|
+
defaultValue: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label }
|
7954
7947
|
}
|
7955
7948
|
), /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-relative hawa-flex hawa-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0" }, /* @__PURE__ */ import_react39.default.createElement(
|
7956
7949
|
"input",
|
@@ -8063,14 +8056,7 @@ var PinInputRoot = React50.forwardRef(({ className, containerClassName, ...props
|
|
8063
8056
|
}
|
8064
8057
|
));
|
8065
8058
|
PinInputRoot.displayName = "PinInputRoot";
|
8066
|
-
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement(
|
8067
|
-
"div",
|
8068
|
-
{
|
8069
|
-
ref,
|
8070
|
-
className: cn("hawa-flex hawa-items-center", className),
|
8071
|
-
...props
|
8072
|
-
}
|
8073
|
-
));
|
8059
|
+
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, className: cn("hawa-flex hawa-items-center", className), ...props }));
|
8074
8060
|
PinInputGroup.displayName = "PinInputGroup";
|
8075
8061
|
var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
8076
8062
|
const pinInputContext = React50.useContext(import_input_otp.OTPInputContext);
|
@@ -8093,22 +8079,12 @@ var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
|
8093
8079
|
PinInputSlot.displayName = "PinInputSlot";
|
8094
8080
|
var PinInputSeperator = React50.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, role: "separator", ...props }, /* @__PURE__ */ React50.createElement(Dot, null)));
|
8095
8081
|
PinInputSeperator.displayName = "PinInputSeperator";
|
8096
|
-
var PinInput = ({
|
8097
|
-
separatorPosition = 0,
|
8098
|
-
...props
|
8099
|
-
}) => {
|
8082
|
+
var PinInput = ({ separatorPosition = 0, ...props }) => {
|
8100
8083
|
const maxLength = props.maxLength || 6;
|
8101
8084
|
const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
|
8102
8085
|
const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
|
8103
8086
|
const secondGroupLength = maxLength - firstGroupLength;
|
8104
|
-
return /* @__PURE__ */ React50.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, /* @__PURE__ */ React50.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
8105
|
-
PinInputSlot,
|
8106
|
-
{
|
8107
|
-
key: index,
|
8108
|
-
index,
|
8109
|
-
className: "hawa-w-full hawa-border"
|
8110
|
-
}
|
8111
|
-
))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React50.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
8087
|
+
return /* @__PURE__ */ React50.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2", dir: "ltr" }, /* @__PURE__ */ React50.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(PinInputSlot, { key: index, index, className: "hawa-w-full hawa-border" }))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React50.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
8112
8088
|
PinInputSlot,
|
8113
8089
|
{
|
8114
8090
|
key: index + firstGroupLength,
|
@@ -11320,14 +11296,7 @@ var LoginForm = ({
|
|
11320
11296
|
(texts == null ? void 0 : texts.loginText) || "Login"
|
11321
11297
|
),
|
11322
11298
|
props.additionalButtons && props.additionalButtons,
|
11323
|
-
props.allowRegister && /* @__PURE__ */ import_react67.default.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ import_react67.default.createElement(
|
11324
|
-
"span",
|
11325
|
-
{
|
11326
|
-
onClick: props.onRouteToRegister,
|
11327
|
-
className: "clickable-link"
|
11328
|
-
},
|
11329
|
-
(texts == null ? void 0 : texts.createAccount) || "Create Account"
|
11330
|
-
))
|
11299
|
+
props.allowRegister && /* @__PURE__ */ import_react67.default.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ import_react67.default.createElement("span", { onClick: props.onRouteToRegister, className: "clickable-link" }, (texts == null ? void 0 : texts.createAccount) || "Create Account"))
|
11331
11300
|
)),
|
11332
11301
|
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react67.default.createElement(
|
11333
11302
|
CardFooter,
|
@@ -11997,10 +11966,7 @@ var import_react74 = __toESM(require("react"));
|
|
11997
11966
|
var import_react_hook_form5 = require("react-hook-form");
|
11998
11967
|
var import_zod5 = require("@hookform/resolvers/zod");
|
11999
11968
|
var z5 = __toESM(require("zod"));
|
12000
|
-
var CodeConfirmation = ({
|
12001
|
-
codeLength = 6,
|
12002
|
-
...props
|
12003
|
-
}) => {
|
11969
|
+
var CodeConfirmation = ({ codeLength = 6, ...props }) => {
|
12004
11970
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
12005
11971
|
const formSchema = z5.object({
|
12006
11972
|
otp_code: z5.string({ required_error: (_a = props.texts) == null ? void 0 : _a.codeRequiredText }).min(codeLength, { message: (_b = props.texts) == null ? void 0 : _b.codeTooShort })
|
@@ -12039,14 +12005,7 @@ var CodeConfirmation = ({
|
|
12039
12005
|
}
|
12040
12006
|
};
|
12041
12007
|
}, []);
|
12042
|
-
return /* @__PURE__ */ import_react74.default.createElement(Card, null, /* @__PURE__ */ import_react74.default.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ import_react74.default.createElement(
|
12043
|
-
Alert,
|
12044
|
-
{
|
12045
|
-
title: props.errorTitle,
|
12046
|
-
text: props.errorText,
|
12047
|
-
severity: "error"
|
12048
|
-
}
|
12049
|
-
), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourPhone) || "Please check your phone"), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ import_react74.default.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ import_react74.default.createElement("span", null, props.phoneNumber))), /* @__PURE__ */ import_react74.default.createElement(
|
12008
|
+
return /* @__PURE__ */ import_react74.default.createElement(Card, null, /* @__PURE__ */ import_react74.default.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ import_react74.default.createElement(Alert, { title: props.errorTitle, text: props.errorText, severity: "error" }), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourIdentifier) || "Please check your phone"), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ import_react74.default.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ import_react74.default.createElement("span", null, props.identifier))), /* @__PURE__ */ import_react74.default.createElement(
|
12050
12009
|
"form",
|
12051
12010
|
{
|
12052
12011
|
noValidate: true,
|
@@ -12095,9 +12054,7 @@ var CodeConfirmation = ({
|
|
12095
12054
|
if (props.onCancel) {
|
12096
12055
|
return props.onCancel();
|
12097
12056
|
} else {
|
12098
|
-
console.log(
|
12099
|
-
"Cancel button clicked but onCancel prop is missing"
|
12100
|
-
);
|
12057
|
+
console.log("Cancel button clicked but onCancel prop is missing");
|
12101
12058
|
}
|
12102
12059
|
},
|
12103
12060
|
variant: "outline"
|
package/dist/index.mjs
CHANGED
@@ -5546,6 +5546,7 @@ import clsx3 from "clsx";
|
|
5546
5546
|
var Select = ({
|
5547
5547
|
labelProps,
|
5548
5548
|
labelKey = "label",
|
5549
|
+
valueKey = "value",
|
5549
5550
|
...props
|
5550
5551
|
}) => {
|
5551
5552
|
const NoOption = () => {
|
@@ -5565,13 +5566,7 @@ var Select = ({
|
|
5565
5566
|
children
|
5566
5567
|
);
|
5567
5568
|
};
|
5568
|
-
const Option = ({
|
5569
|
-
children,
|
5570
|
-
innerProps,
|
5571
|
-
innerRef,
|
5572
|
-
isFocused,
|
5573
|
-
isSelected
|
5574
|
-
}) => {
|
5569
|
+
const Option = ({ children, innerProps, innerRef, isFocused, isSelected }) => {
|
5575
5570
|
return /* @__PURE__ */ React43.createElement(
|
5576
5571
|
"div",
|
5577
5572
|
{
|
@@ -5586,14 +5581,7 @@ var Select = ({
|
|
5586
5581
|
children
|
5587
5582
|
);
|
5588
5583
|
};
|
5589
|
-
const Menu2 = ({
|
5590
|
-
cx,
|
5591
|
-
children,
|
5592
|
-
getStyles,
|
5593
|
-
innerProps,
|
5594
|
-
innerRef,
|
5595
|
-
...menuProps
|
5596
|
-
}) => {
|
5584
|
+
const Menu2 = ({ cx, children, getStyles, innerProps, innerRef, ...menuProps }) => {
|
5597
5585
|
const menuOpen = menuProps.selectProps.menuIsOpen;
|
5598
5586
|
return /* @__PURE__ */ React43.createElement(
|
5599
5587
|
"div",
|
@@ -5622,71 +5610,72 @@ var Select = ({
|
|
5622
5610
|
)
|
5623
5611
|
},
|
5624
5612
|
props.label && /* @__PURE__ */ React43.createElement(Label2, { ...labelProps }, props.label),
|
5625
|
-
props.isLoading ? /* @__PURE__ */ React43.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? (
|
5626
|
-
|
5627
|
-
|
5628
|
-
|
5629
|
-
{
|
5630
|
-
|
5631
|
-
|
5632
|
-
|
5633
|
-
|
5634
|
-
|
5635
|
-
|
5636
|
-
|
5637
|
-
|
5638
|
-
|
5639
|
-
|
5640
|
-
|
5641
|
-
|
5642
|
-
|
5643
|
-
|
5644
|
-
|
5645
|
-
|
5646
|
-
|
5647
|
-
|
5648
|
-
|
5649
|
-
|
5650
|
-
|
5651
|
-
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5652
|
-
props.disabled && "hawa-opacity-30"
|
5653
|
-
)
|
5654
|
-
},
|
5655
|
-
unstyled: true,
|
5656
|
-
autoFocus: false,
|
5657
|
-
components: props.hideIndicator ? { Option, Menu: Menu2, IndicatorsContainer: () => null } : {
|
5613
|
+
props.isLoading ? /* @__PURE__ */ React43.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? /* @__PURE__ */ React43.createElement(
|
5614
|
+
ReactSelect,
|
5615
|
+
{
|
5616
|
+
noOptionsMessage: NoOption,
|
5617
|
+
classNames: {
|
5618
|
+
control: () => cn(props.phoneCode && "hawa-rounded-r-none", props.controlClassNames),
|
5619
|
+
container: () => cn(
|
5620
|
+
selectContainerStyles,
|
5621
|
+
props.phoneCode && phoneCodeStyles,
|
5622
|
+
props.isMulti && "hawa-ps-0 "
|
5623
|
+
),
|
5624
|
+
placeholder: () => cn(selectPlaceholderStyles, props.disabled && "hawa-text-muted-foreground"),
|
5625
|
+
valueContainer: () => "hawa-text-foreground hawa-px-1",
|
5626
|
+
singleValue: () => cn(
|
5627
|
+
props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
|
5628
|
+
),
|
5629
|
+
indicatorsContainer: () => cn(
|
5630
|
+
selectIndicatorContainerStyles,
|
5631
|
+
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5632
|
+
props.disabled && "hawa-opacity-30"
|
5633
|
+
)
|
5634
|
+
},
|
5635
|
+
unstyled: true,
|
5636
|
+
autoFocus: false,
|
5637
|
+
components: props.hideIndicator ? {
|
5638
|
+
Option: (optionProps) => /* @__PURE__ */ React43.createElement(
|
5658
5639
|
Option,
|
5659
|
-
|
5660
|
-
|
5661
|
-
|
5662
|
-
|
5663
|
-
|
5664
|
-
|
5665
|
-
|
5666
|
-
|
5667
|
-
|
5668
|
-
|
5669
|
-
|
5670
|
-
|
5671
|
-
|
5672
|
-
|
5673
|
-
className
|
5674
|
-
|
5675
|
-
|
5676
|
-
|
5677
|
-
|
5678
|
-
|
5679
|
-
|
5680
|
-
|
5681
|
-
|
5682
|
-
|
5683
|
-
|
5684
|
-
|
5685
|
-
|
5686
|
-
|
5687
|
-
|
5688
|
-
|
5689
|
-
|
5640
|
+
{
|
5641
|
+
...optionProps,
|
5642
|
+
isSelected: optionProps.data[valueKey] === props.value[valueKey]
|
5643
|
+
}
|
5644
|
+
),
|
5645
|
+
Menu: Menu2,
|
5646
|
+
IndicatorsContainer: () => null
|
5647
|
+
} : {
|
5648
|
+
Option,
|
5649
|
+
Menu: Menu2,
|
5650
|
+
ValueContainer: (e) => /* @__PURE__ */ React43.createElement(
|
5651
|
+
"div",
|
5652
|
+
{
|
5653
|
+
className: cn(
|
5654
|
+
e.className,
|
5655
|
+
"hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-2 hawa-w-full hawa-cursor-pointer"
|
5656
|
+
),
|
5657
|
+
...e
|
5658
|
+
}
|
5659
|
+
),
|
5660
|
+
MultiValueContainer: (e) => /* @__PURE__ */ React43.createElement(
|
5661
|
+
"div",
|
5662
|
+
{
|
5663
|
+
className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
|
5664
|
+
...e
|
5665
|
+
}
|
5666
|
+
)
|
5667
|
+
},
|
5668
|
+
onChange: (newValue, action) => props.onChange(newValue, action),
|
5669
|
+
options: props.options,
|
5670
|
+
getOptionLabel: props.getOptionLabel,
|
5671
|
+
defaultValue: props.defaultValue,
|
5672
|
+
value: props.value,
|
5673
|
+
placeholder: props.placeholder,
|
5674
|
+
isDisabled: props.disabled,
|
5675
|
+
isClearable: props.isClearable,
|
5676
|
+
isMulti: props.isMulti,
|
5677
|
+
isSearchable: props.isSearchable
|
5678
|
+
}
|
5690
5679
|
) : /* @__PURE__ */ React43.createElement(
|
5691
5680
|
CreatableSelect,
|
5692
5681
|
{
|
@@ -7676,11 +7665,13 @@ var PhoneInput = ({
|
|
7676
7665
|
countryCodes,
|
7677
7666
|
...props
|
7678
7667
|
}) => {
|
7668
|
+
var _a;
|
7679
7669
|
const [phoneNumber, setPhoneNumber] = useState29("");
|
7680
|
-
const [countryCode, setCountryCode] = useState29(
|
7670
|
+
const [countryCode, setCountryCode] = useState29(
|
7671
|
+
props.preferredCountry || { label: "+966" }
|
7672
|
+
);
|
7681
7673
|
const inputRef = useRef17(null);
|
7682
7674
|
const handleInputChange = (e) => {
|
7683
|
-
console.log("test e ", e.target.value);
|
7684
7675
|
const validChars = /^[0-9-()]+$/;
|
7685
7676
|
const input = e.target.value;
|
7686
7677
|
if (input === "" || validChars.test(input)) {
|
@@ -7702,11 +7693,13 @@ var PhoneInput = ({
|
|
7702
7693
|
isMulti: false,
|
7703
7694
|
isSearchable: true,
|
7704
7695
|
isClearable: false,
|
7705
|
-
placeholder:
|
7696
|
+
placeholder: (_a = props.preferredCountry) == null ? void 0 : _a.label,
|
7706
7697
|
options: countryCodes || countries_default,
|
7707
|
-
onChange: setCountryCode,
|
7708
|
-
|
7709
|
-
|
7698
|
+
onChange: (e) => setCountryCode({ label: e.label, value: e.label }),
|
7699
|
+
valueKey: "label",
|
7700
|
+
labelKey: "label",
|
7701
|
+
value: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label },
|
7702
|
+
defaultValue: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label }
|
7710
7703
|
}
|
7711
7704
|
), /* @__PURE__ */ React49.createElement("div", { className: "hawa-relative hawa-flex hawa-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0" }, /* @__PURE__ */ React49.createElement(
|
7712
7705
|
"input",
|
@@ -7819,14 +7812,7 @@ var PinInputRoot = React50.forwardRef(({ className, containerClassName, ...props
|
|
7819
7812
|
}
|
7820
7813
|
));
|
7821
7814
|
PinInputRoot.displayName = "PinInputRoot";
|
7822
|
-
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement(
|
7823
|
-
"div",
|
7824
|
-
{
|
7825
|
-
ref,
|
7826
|
-
className: cn("hawa-flex hawa-items-center", className),
|
7827
|
-
...props
|
7828
|
-
}
|
7829
|
-
));
|
7815
|
+
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, className: cn("hawa-flex hawa-items-center", className), ...props }));
|
7830
7816
|
PinInputGroup.displayName = "PinInputGroup";
|
7831
7817
|
var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
7832
7818
|
const pinInputContext = React50.useContext(OTPInputContext);
|
@@ -7849,22 +7835,12 @@ var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
|
7849
7835
|
PinInputSlot.displayName = "PinInputSlot";
|
7850
7836
|
var PinInputSeperator = React50.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, role: "separator", ...props }, /* @__PURE__ */ React50.createElement(Dot, null)));
|
7851
7837
|
PinInputSeperator.displayName = "PinInputSeperator";
|
7852
|
-
var PinInput = ({
|
7853
|
-
separatorPosition = 0,
|
7854
|
-
...props
|
7855
|
-
}) => {
|
7838
|
+
var PinInput = ({ separatorPosition = 0, ...props }) => {
|
7856
7839
|
const maxLength = props.maxLength || 6;
|
7857
7840
|
const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
|
7858
7841
|
const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
|
7859
7842
|
const secondGroupLength = maxLength - firstGroupLength;
|
7860
|
-
return /* @__PURE__ */ React50.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, /* @__PURE__ */ React50.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
7861
|
-
PinInputSlot,
|
7862
|
-
{
|
7863
|
-
key: index,
|
7864
|
-
index,
|
7865
|
-
className: "hawa-w-full hawa-border"
|
7866
|
-
}
|
7867
|
-
))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React50.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
7843
|
+
return /* @__PURE__ */ React50.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2", dir: "ltr" }, /* @__PURE__ */ React50.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(PinInputSlot, { key: index, index, className: "hawa-w-full hawa-border" }))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React50.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
7868
7844
|
PinInputSlot,
|
7869
7845
|
{
|
7870
7846
|
key: index + firstGroupLength,
|
@@ -11088,14 +11064,7 @@ var LoginForm = ({
|
|
11088
11064
|
(texts == null ? void 0 : texts.loginText) || "Login"
|
11089
11065
|
),
|
11090
11066
|
props.additionalButtons && props.additionalButtons,
|
11091
|
-
props.allowRegister && /* @__PURE__ */ React82.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ React82.createElement(
|
11092
|
-
"span",
|
11093
|
-
{
|
11094
|
-
onClick: props.onRouteToRegister,
|
11095
|
-
className: "clickable-link"
|
11096
|
-
},
|
11097
|
-
(texts == null ? void 0 : texts.createAccount) || "Create Account"
|
11098
|
-
))
|
11067
|
+
props.allowRegister && /* @__PURE__ */ React82.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ React82.createElement("span", { onClick: props.onRouteToRegister, className: "clickable-link" }, (texts == null ? void 0 : texts.createAccount) || "Create Account"))
|
11099
11068
|
)),
|
11100
11069
|
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React82.createElement(
|
11101
11070
|
CardFooter,
|
@@ -11765,10 +11734,7 @@ import React88, { useEffect as useEffect34, useState as useState43 } from "react
|
|
11765
11734
|
import { Controller as Controller5, useForm as useForm5 } from "react-hook-form";
|
11766
11735
|
import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
|
11767
11736
|
import * as z5 from "zod";
|
11768
|
-
var CodeConfirmation = ({
|
11769
|
-
codeLength = 6,
|
11770
|
-
...props
|
11771
|
-
}) => {
|
11737
|
+
var CodeConfirmation = ({ codeLength = 6, ...props }) => {
|
11772
11738
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
11773
11739
|
const formSchema = z5.object({
|
11774
11740
|
otp_code: z5.string({ required_error: (_a = props.texts) == null ? void 0 : _a.codeRequiredText }).min(codeLength, { message: (_b = props.texts) == null ? void 0 : _b.codeTooShort })
|
@@ -11807,14 +11773,7 @@ var CodeConfirmation = ({
|
|
11807
11773
|
}
|
11808
11774
|
};
|
11809
11775
|
}, []);
|
11810
|
-
return /* @__PURE__ */ React88.createElement(Card, null, /* @__PURE__ */ React88.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ React88.createElement(
|
11811
|
-
Alert,
|
11812
|
-
{
|
11813
|
-
title: props.errorTitle,
|
11814
|
-
text: props.errorText,
|
11815
|
-
severity: "error"
|
11816
|
-
}
|
11817
|
-
), /* @__PURE__ */ React88.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourPhone) || "Please check your phone"), /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ React88.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ React88.createElement("span", null, props.phoneNumber))), /* @__PURE__ */ React88.createElement(
|
11776
|
+
return /* @__PURE__ */ React88.createElement(Card, null, /* @__PURE__ */ React88.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ React88.createElement(Alert, { title: props.errorTitle, text: props.errorText, severity: "error" }), /* @__PURE__ */ React88.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourIdentifier) || "Please check your phone"), /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ React88.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ React88.createElement("span", null, props.identifier))), /* @__PURE__ */ React88.createElement(
|
11818
11777
|
"form",
|
11819
11778
|
{
|
11820
11779
|
noValidate: true,
|
@@ -11863,9 +11822,7 @@ var CodeConfirmation = ({
|
|
11863
11822
|
if (props.onCancel) {
|
11864
11823
|
return props.onCancel();
|
11865
11824
|
} else {
|
11866
|
-
console.log(
|
11867
|
-
"Cancel button clicked but onCancel prop is missing"
|
11868
|
-
);
|
11825
|
+
console.log("Cancel button clicked but onCancel prop is missing");
|
11869
11826
|
}
|
11870
11827
|
},
|
11871
11828
|
variant: "outline"
|
@@ -9,20 +9,20 @@ type LabelProps = {
|
|
9
9
|
required?: boolean;
|
10
10
|
};
|
11
11
|
|
12
|
+
type PhoneCodeValue = {
|
13
|
+
label: string;
|
14
|
+
value?: string;
|
15
|
+
};
|
12
16
|
type PhoneInputProps = {
|
13
|
-
preferredCountry?:
|
14
|
-
label: string;
|
15
|
-
};
|
17
|
+
preferredCountry?: PhoneCodeValue;
|
16
18
|
helperText?: any;
|
17
19
|
label?: string;
|
18
20
|
labelProps?: LabelProps;
|
19
21
|
placeholder?: string;
|
20
22
|
handleChange?: (value: string) => void;
|
21
23
|
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
22
|
-
countryCodes?:
|
23
|
-
label: string;
|
24
|
-
}[];
|
24
|
+
countryCodes?: PhoneCodeValue[];
|
25
25
|
};
|
26
26
|
declare const PhoneInput: FC<PhoneInputProps>;
|
27
27
|
|
28
|
-
export { PhoneInput, type PhoneInputProps };
|
28
|
+
export { type PhoneCodeValue, PhoneInput, type PhoneInputProps };
|