@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
@@ -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 };
|
package/dist/phoneInput/index.js
CHANGED
@@ -1920,6 +1920,7 @@ function Skeleton({
|
|
1920
1920
|
var Select = ({
|
1921
1921
|
labelProps,
|
1922
1922
|
labelKey = "label",
|
1923
|
+
valueKey = "value",
|
1923
1924
|
...props
|
1924
1925
|
}) => {
|
1925
1926
|
const NoOption = () => {
|
@@ -1939,13 +1940,7 @@ var Select = ({
|
|
1939
1940
|
children
|
1940
1941
|
);
|
1941
1942
|
};
|
1942
|
-
const Option = ({
|
1943
|
-
children,
|
1944
|
-
innerProps,
|
1945
|
-
innerRef,
|
1946
|
-
isFocused,
|
1947
|
-
isSelected
|
1948
|
-
}) => {
|
1943
|
+
const Option = ({ children, innerProps, innerRef, isFocused, isSelected }) => {
|
1949
1944
|
return /* @__PURE__ */ import_react4.default.createElement(
|
1950
1945
|
"div",
|
1951
1946
|
{
|
@@ -1960,14 +1955,7 @@ var Select = ({
|
|
1960
1955
|
children
|
1961
1956
|
);
|
1962
1957
|
};
|
1963
|
-
const Menu = ({
|
1964
|
-
cx,
|
1965
|
-
children,
|
1966
|
-
getStyles,
|
1967
|
-
innerProps,
|
1968
|
-
innerRef,
|
1969
|
-
...menuProps
|
1970
|
-
}) => {
|
1958
|
+
const Menu = ({ cx, children, getStyles, innerProps, innerRef, ...menuProps }) => {
|
1971
1959
|
const menuOpen = menuProps.selectProps.menuIsOpen;
|
1972
1960
|
return /* @__PURE__ */ import_react4.default.createElement(
|
1973
1961
|
"div",
|
@@ -1996,71 +1984,72 @@ var Select = ({
|
|
1996
1984
|
)
|
1997
1985
|
},
|
1998
1986
|
props.label && /* @__PURE__ */ import_react4.default.createElement(Label, { ...labelProps }, props.label),
|
1999
|
-
props.isLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? (
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
{
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
2026
|
-
props.disabled && "hawa-opacity-30"
|
2027
|
-
)
|
2028
|
-
},
|
2029
|
-
unstyled: true,
|
2030
|
-
autoFocus: false,
|
2031
|
-
components: props.hideIndicator ? { Option, Menu, IndicatorsContainer: () => null } : {
|
1987
|
+
props.isLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? /* @__PURE__ */ import_react4.default.createElement(
|
1988
|
+
import_react_select.default,
|
1989
|
+
{
|
1990
|
+
noOptionsMessage: NoOption,
|
1991
|
+
classNames: {
|
1992
|
+
control: () => cn(props.phoneCode && "hawa-rounded-r-none", props.controlClassNames),
|
1993
|
+
container: () => cn(
|
1994
|
+
selectContainerStyles,
|
1995
|
+
props.phoneCode && phoneCodeStyles,
|
1996
|
+
props.isMulti && "hawa-ps-0 "
|
1997
|
+
),
|
1998
|
+
placeholder: () => cn(selectPlaceholderStyles, props.disabled && "hawa-text-muted-foreground"),
|
1999
|
+
valueContainer: () => "hawa-text-foreground hawa-px-1",
|
2000
|
+
singleValue: () => cn(
|
2001
|
+
props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
|
2002
|
+
),
|
2003
|
+
indicatorsContainer: () => cn(
|
2004
|
+
selectIndicatorContainerStyles,
|
2005
|
+
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
2006
|
+
props.disabled && "hawa-opacity-30"
|
2007
|
+
)
|
2008
|
+
},
|
2009
|
+
unstyled: true,
|
2010
|
+
autoFocus: false,
|
2011
|
+
components: props.hideIndicator ? {
|
2012
|
+
Option: (optionProps) => /* @__PURE__ */ import_react4.default.createElement(
|
2032
2013
|
Option,
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
className
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2014
|
+
{
|
2015
|
+
...optionProps,
|
2016
|
+
isSelected: optionProps.data[valueKey] === props.value[valueKey]
|
2017
|
+
}
|
2018
|
+
),
|
2019
|
+
Menu,
|
2020
|
+
IndicatorsContainer: () => null
|
2021
|
+
} : {
|
2022
|
+
Option,
|
2023
|
+
Menu,
|
2024
|
+
ValueContainer: (e) => /* @__PURE__ */ import_react4.default.createElement(
|
2025
|
+
"div",
|
2026
|
+
{
|
2027
|
+
className: cn(
|
2028
|
+
e.className,
|
2029
|
+
"hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-2 hawa-w-full hawa-cursor-pointer"
|
2030
|
+
),
|
2031
|
+
...e
|
2032
|
+
}
|
2033
|
+
),
|
2034
|
+
MultiValueContainer: (e) => /* @__PURE__ */ import_react4.default.createElement(
|
2035
|
+
"div",
|
2036
|
+
{
|
2037
|
+
className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
|
2038
|
+
...e
|
2039
|
+
}
|
2040
|
+
)
|
2041
|
+
},
|
2042
|
+
onChange: (newValue, action) => props.onChange(newValue, action),
|
2043
|
+
options: props.options,
|
2044
|
+
getOptionLabel: props.getOptionLabel,
|
2045
|
+
defaultValue: props.defaultValue,
|
2046
|
+
value: props.value,
|
2047
|
+
placeholder: props.placeholder,
|
2048
|
+
isDisabled: props.disabled,
|
2049
|
+
isClearable: props.isClearable,
|
2050
|
+
isMulti: props.isMulti,
|
2051
|
+
isSearchable: props.isSearchable
|
2052
|
+
}
|
2064
2053
|
) : /* @__PURE__ */ import_react4.default.createElement(
|
2065
2054
|
import_creatable.default,
|
2066
2055
|
{
|
@@ -2102,11 +2091,13 @@ var PhoneInput = ({
|
|
2102
2091
|
countryCodes,
|
2103
2092
|
...props
|
2104
2093
|
}) => {
|
2094
|
+
var _a;
|
2105
2095
|
const [phoneNumber, setPhoneNumber] = (0, import_react5.useState)("");
|
2106
|
-
const [countryCode, setCountryCode] = (0, import_react5.useState)(
|
2096
|
+
const [countryCode, setCountryCode] = (0, import_react5.useState)(
|
2097
|
+
props.preferredCountry || { label: "+966" }
|
2098
|
+
);
|
2107
2099
|
const inputRef = (0, import_react5.useRef)(null);
|
2108
2100
|
const handleInputChange = (e) => {
|
2109
|
-
console.log("test e ", e.target.value);
|
2110
2101
|
const validChars = /^[0-9-()]+$/;
|
2111
2102
|
const input = e.target.value;
|
2112
2103
|
if (input === "" || validChars.test(input)) {
|
@@ -2128,11 +2119,13 @@ var PhoneInput = ({
|
|
2128
2119
|
isMulti: false,
|
2129
2120
|
isSearchable: true,
|
2130
2121
|
isClearable: false,
|
2131
|
-
placeholder:
|
2122
|
+
placeholder: (_a = props.preferredCountry) == null ? void 0 : _a.label,
|
2132
2123
|
options: countryCodes || countries_default,
|
2133
|
-
onChange: setCountryCode,
|
2134
|
-
|
2135
|
-
|
2124
|
+
onChange: (e) => setCountryCode({ label: e.label, value: e.label }),
|
2125
|
+
valueKey: "label",
|
2126
|
+
labelKey: "label",
|
2127
|
+
value: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label },
|
2128
|
+
defaultValue: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label }
|
2136
2129
|
}
|
2137
2130
|
), /* @__PURE__ */ import_react5.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_react5.default.createElement(
|
2138
2131
|
"input",
|