@sikka/hawa 0.11.6-next → 0.11.7-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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -29
- package/dist/index.mjs +89 -80
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1193,8 +1193,8 @@ type ComponentTypes$2 = {
|
|
|
1193
1193
|
tag?: any;
|
|
1194
1194
|
options?: RadioOptionsTypes[];
|
|
1195
1195
|
position?: "bottom-right" | "bottom-left";
|
|
1196
|
-
onOptionClicked?: (option: any) => void;
|
|
1197
1196
|
direction?: "rtl" | "ltr";
|
|
1197
|
+
onSubmitForm?: (e: any) => void;
|
|
1198
1198
|
texts?: {
|
|
1199
1199
|
pleaseSelectOption: string;
|
|
1200
1200
|
textTooShort: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1193,8 +1193,8 @@ type ComponentTypes$2 = {
|
|
|
1193
1193
|
tag?: any;
|
|
1194
1194
|
options?: RadioOptionsTypes[];
|
|
1195
1195
|
position?: "bottom-right" | "bottom-left";
|
|
1196
|
-
onOptionClicked?: (option: any) => void;
|
|
1197
1196
|
direction?: "rtl" | "ltr";
|
|
1197
|
+
onSubmitForm?: (e: any) => void;
|
|
1198
1198
|
texts?: {
|
|
1199
1199
|
pleaseSelectOption: string;
|
|
1200
1200
|
textTooShort: string;
|
package/dist/index.js
CHANGED
|
@@ -7716,7 +7716,6 @@ var UserReferralSource = function(_param) {
|
|
|
7716
7716
|
]);
|
|
7717
7717
|
var _props_texts, _props_texts1;
|
|
7718
7718
|
var _ref = _sliced_to_array((0, import_react45.useState)(false), 2), closed = _ref[0], setClosed = _ref[1];
|
|
7719
|
-
var _ref1 = _sliced_to_array((0, import_react45.useState)(5), 2), closingTimer = _ref1[0], setClosingTimer = _ref1[1];
|
|
7720
7719
|
var popUpRef = (0, import_react45.useRef)(null);
|
|
7721
7720
|
var formSchema = z6.object({
|
|
7722
7721
|
source: z6.string({
|
|
@@ -7724,35 +7723,17 @@ var UserReferralSource = function(_param) {
|
|
|
7724
7723
|
}),
|
|
7725
7724
|
feedback: z6.string().optional()
|
|
7726
7725
|
});
|
|
7727
|
-
var
|
|
7726
|
+
var _ref1 = (0, import_react_hook_form6.useForm)({
|
|
7728
7727
|
resolver: (0, import_zod6.zodResolver)(formSchema)
|
|
7729
|
-
}), handleSubmit =
|
|
7728
|
+
}), handleSubmit = _ref1.handleSubmit, control = _ref1.control, formState = _ref1.formState;
|
|
7730
7729
|
var boxPosition = {
|
|
7731
7730
|
"bottom-right": "hawa-right-4",
|
|
7732
7731
|
"bottom-left": "hawa-left-4"
|
|
7733
7732
|
};
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
}
|
|
7739
|
-
}, 1e3);
|
|
7740
|
-
return function() {
|
|
7741
|
-
clearTimeout(timeoutHide);
|
|
7742
|
-
};
|
|
7743
|
-
}, [
|
|
7744
|
-
closingTimer
|
|
7745
|
-
]);
|
|
7746
|
-
var slowClose = function() {
|
|
7747
|
-
setClosed(true);
|
|
7748
|
-
setTimeout(function() {
|
|
7749
|
-
if (popUpRef.current) {
|
|
7750
|
-
popUpRef.current.removeChild(popUpRef.current.children[0]);
|
|
7751
|
-
}
|
|
7752
|
-
}, 200);
|
|
7753
|
-
};
|
|
7754
|
-
return /* @__PURE__ */ import_react45.default.createElement(Card, {
|
|
7755
|
-
ref: popUpRef,
|
|
7733
|
+
return /* @__PURE__ */ import_react45.default.createElement("div", {
|
|
7734
|
+
className: cn("hawa-transition-all", closed ? "hawa-opacity-0" : "hawa-opacity-100"),
|
|
7735
|
+
ref: popUpRef
|
|
7736
|
+
}, /* @__PURE__ */ import_react45.default.createElement(Card, {
|
|
7756
7737
|
className: cn("hawa-fixed hawa-bottom-4 hawa-p-0 ", boxPosition[position]),
|
|
7757
7738
|
dir: props.direction
|
|
7758
7739
|
}, /* @__PURE__ */ import_react45.default.createElement("button", {
|
|
@@ -7761,7 +7742,12 @@ var UserReferralSource = function(_param) {
|
|
|
7761
7742
|
"data-dismiss-target": "#toast-default",
|
|
7762
7743
|
"aria-label": "Close",
|
|
7763
7744
|
onClick: function() {
|
|
7764
|
-
|
|
7745
|
+
setClosed(true);
|
|
7746
|
+
setTimeout(function() {
|
|
7747
|
+
if (popUpRef === null || popUpRef === void 0 ? void 0 : popUpRef.current) {
|
|
7748
|
+
popUpRef === null || popUpRef === void 0 ? void 0 : popUpRef.current.removeChild(popUpRef === null || popUpRef === void 0 ? void 0 : popUpRef.current.children[0]);
|
|
7749
|
+
}
|
|
7750
|
+
}, 200);
|
|
7765
7751
|
}
|
|
7766
7752
|
}, /* @__PURE__ */ import_react45.default.createElement("svg", {
|
|
7767
7753
|
"aria-hidden": "true",
|
|
@@ -7776,10 +7762,13 @@ var UserReferralSource = function(_param) {
|
|
|
7776
7762
|
headless: true
|
|
7777
7763
|
}, /* @__PURE__ */ import_react45.default.createElement("form", {
|
|
7778
7764
|
onSubmit: handleSubmit(function(e) {
|
|
7779
|
-
|
|
7765
|
+
if (props.onSubmitForm) {
|
|
7766
|
+
props.onSubmitForm(e);
|
|
7767
|
+
}
|
|
7768
|
+
console.log("onSubmitForm was not provided");
|
|
7780
7769
|
})
|
|
7781
7770
|
}, /* @__PURE__ */ import_react45.default.createElement("div", {
|
|
7782
|
-
className: cn("hawa-flex hawa-flex-col hawa-gap-4", closed ? "hawa-opacity-0" : "hawa-opacity-100")
|
|
7771
|
+
className: cn("hawa-flex hawa-flex-col hawa-gap-4 hawa-transition-all", closed ? "hawa-opacity-0" : "hawa-opacity-100")
|
|
7783
7772
|
}, /* @__PURE__ */ import_react45.default.createElement("div", {
|
|
7784
7773
|
className: "hawa-mt-4 hawa-font-bold"
|
|
7785
7774
|
}, props.question), /* @__PURE__ */ import_react45.default.createElement("div", {
|
|
@@ -7814,7 +7803,7 @@ var UserReferralSource = function(_param) {
|
|
|
7814
7803
|
}))), /* @__PURE__ */ import_react45.default.createElement(Button, {
|
|
7815
7804
|
type: "submit",
|
|
7816
7805
|
className: "hawa-mt-4 hawa-w-full"
|
|
7817
|
-
}, ((_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.submit) || "Submit"))));
|
|
7806
|
+
}, ((_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.submit) || "Submit")))));
|
|
7818
7807
|
};
|
|
7819
7808
|
// components/blocks/feedback/FeedbackRating.tsx
|
|
7820
7809
|
var import_react46 = __toESM(require("react"));
|
package/dist/index.mjs
CHANGED
|
@@ -7624,7 +7624,7 @@ var CodeConfirmation = (props) => {
|
|
|
7624
7624
|
};
|
|
7625
7625
|
|
|
7626
7626
|
// components/blocks/feedback/UserReferralSource.tsx
|
|
7627
|
-
import React64, {
|
|
7627
|
+
import React64, { useRef as useRef8, useState as useState25 } from "react";
|
|
7628
7628
|
import { Controller as Controller6, useForm as useForm6 } from "react-hook-form";
|
|
7629
7629
|
import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
|
|
7630
7630
|
import * as z6 from "zod";
|
|
@@ -7634,7 +7634,6 @@ var UserReferralSource = ({
|
|
|
7634
7634
|
...props
|
|
7635
7635
|
}) => {
|
|
7636
7636
|
const [closed, setClosed] = useState25(false);
|
|
7637
|
-
const [closingTimer, setClosingTimer] = useState25(5);
|
|
7638
7637
|
const popUpRef = useRef8(null);
|
|
7639
7638
|
const formSchema = z6.object({
|
|
7640
7639
|
source: z6.string({ required_error: props.texts?.pleaseSelectOption }),
|
|
@@ -7647,106 +7646,116 @@ var UserReferralSource = ({
|
|
|
7647
7646
|
"bottom-right": "hawa-right-4",
|
|
7648
7647
|
"bottom-left": "hawa-left-4"
|
|
7649
7648
|
};
|
|
7650
|
-
useEffect15(() => {
|
|
7651
|
-
const timeoutHide = setTimeout(() => {
|
|
7652
|
-
if (closingTimer >= 0) {
|
|
7653
|
-
setClosingTimer(closingTimer - 1);
|
|
7654
|
-
}
|
|
7655
|
-
}, 1e3);
|
|
7656
|
-
return () => {
|
|
7657
|
-
clearTimeout(timeoutHide);
|
|
7658
|
-
};
|
|
7659
|
-
}, [closingTimer]);
|
|
7660
|
-
const slowClose = () => {
|
|
7661
|
-
setClosed(true);
|
|
7662
|
-
setTimeout(() => {
|
|
7663
|
-
if (popUpRef.current) {
|
|
7664
|
-
popUpRef.current.removeChild(popUpRef.current.children[0]);
|
|
7665
|
-
}
|
|
7666
|
-
}, 200);
|
|
7667
|
-
};
|
|
7668
7649
|
return /* @__PURE__ */ React64.createElement(
|
|
7669
|
-
|
|
7650
|
+
"div",
|
|
7670
7651
|
{
|
|
7671
|
-
ref: popUpRef,
|
|
7672
7652
|
className: cn(
|
|
7673
|
-
"hawa-
|
|
7674
|
-
|
|
7653
|
+
"hawa-transition-all",
|
|
7654
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100"
|
|
7675
7655
|
),
|
|
7676
|
-
|
|
7656
|
+
ref: popUpRef
|
|
7677
7657
|
},
|
|
7678
7658
|
/* @__PURE__ */ React64.createElement(
|
|
7679
|
-
|
|
7659
|
+
Card,
|
|
7680
7660
|
{
|
|
7681
|
-
type: "button",
|
|
7682
7661
|
className: cn(
|
|
7683
|
-
|
|
7684
|
-
|
|
7662
|
+
"hawa-fixed hawa-bottom-4 hawa-p-0 ",
|
|
7663
|
+
boxPosition[position]
|
|
7685
7664
|
),
|
|
7686
|
-
|
|
7687
|
-
"aria-label": "Close",
|
|
7688
|
-
onClick: () => slowClose()
|
|
7665
|
+
dir: props.direction
|
|
7689
7666
|
},
|
|
7690
7667
|
/* @__PURE__ */ React64.createElement(
|
|
7691
|
-
"
|
|
7668
|
+
"button",
|
|
7692
7669
|
{
|
|
7693
|
-
|
|
7694
|
-
className:
|
|
7695
|
-
|
|
7696
|
-
|
|
7670
|
+
type: "button",
|
|
7671
|
+
className: cn(
|
|
7672
|
+
props.direction === "rtl" ? "hawa-left-2" : "hawa-right-2",
|
|
7673
|
+
"hawa-absolute hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white"
|
|
7674
|
+
),
|
|
7675
|
+
"data-dismiss-target": "#toast-default",
|
|
7676
|
+
"aria-label": "Close",
|
|
7677
|
+
onClick: () => {
|
|
7678
|
+
setClosed(true);
|
|
7679
|
+
setTimeout(() => {
|
|
7680
|
+
if (popUpRef?.current) {
|
|
7681
|
+
popUpRef?.current.removeChild(popUpRef?.current.children[0]);
|
|
7682
|
+
}
|
|
7683
|
+
}, 200);
|
|
7684
|
+
}
|
|
7697
7685
|
},
|
|
7698
7686
|
/* @__PURE__ */ React64.createElement(
|
|
7699
|
-
"
|
|
7687
|
+
"svg",
|
|
7700
7688
|
{
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
/* @__PURE__ */ React64.createElement(CardContent, { headless: true }, /* @__PURE__ */ React64.createElement("form", { onSubmit: handleSubmit((e) => console.log("e is ", e)) }, /* @__PURE__ */ React64.createElement(
|
|
7709
|
-
"div",
|
|
7710
|
-
{
|
|
7711
|
-
className: cn(
|
|
7712
|
-
"hawa-flex hawa-flex-col hawa-gap-4",
|
|
7713
|
-
closed ? "hawa-opacity-0" : "hawa-opacity-100"
|
|
7714
|
-
)
|
|
7715
|
-
},
|
|
7716
|
-
/* @__PURE__ */ React64.createElement("div", { className: "hawa-mt-4 hawa-font-bold" }, props.question),
|
|
7717
|
-
/* @__PURE__ */ React64.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded " }, /* @__PURE__ */ React64.createElement(
|
|
7718
|
-
Controller6,
|
|
7719
|
-
{
|
|
7720
|
-
control,
|
|
7721
|
-
name: "source",
|
|
7722
|
-
render: ({ field }) => /* @__PURE__ */ React64.createElement(
|
|
7723
|
-
Radio,
|
|
7689
|
+
"aria-hidden": "true",
|
|
7690
|
+
className: "hawa-h-5 hawa-w-5",
|
|
7691
|
+
fill: "currentColor",
|
|
7692
|
+
viewBox: "0 0 20 20"
|
|
7693
|
+
},
|
|
7694
|
+
/* @__PURE__ */ React64.createElement(
|
|
7695
|
+
"path",
|
|
7724
7696
|
{
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
defaultValue: field.value,
|
|
7729
|
-
onChangeTab: (e) => field.onChange(e),
|
|
7730
|
-
helperText: formState.errors.source?.message?.toString()
|
|
7697
|
+
fillRule: "evenodd",
|
|
7698
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
7699
|
+
clipRule: "evenodd"
|
|
7731
7700
|
}
|
|
7732
7701
|
)
|
|
7733
|
-
|
|
7734
|
-
)
|
|
7735
|
-
/* @__PURE__ */ React64.createElement(
|
|
7736
|
-
|
|
7702
|
+
)
|
|
7703
|
+
),
|
|
7704
|
+
/* @__PURE__ */ React64.createElement(CardContent, { headless: true }, /* @__PURE__ */ React64.createElement(
|
|
7705
|
+
"form",
|
|
7737
7706
|
{
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7707
|
+
onSubmit: handleSubmit((e) => {
|
|
7708
|
+
if (props.onSubmitForm) {
|
|
7709
|
+
props.onSubmitForm(e);
|
|
7710
|
+
}
|
|
7711
|
+
console.log("onSubmitForm was not provided");
|
|
7712
|
+
})
|
|
7713
|
+
},
|
|
7714
|
+
/* @__PURE__ */ React64.createElement(
|
|
7715
|
+
"div",
|
|
7716
|
+
{
|
|
7717
|
+
className: cn(
|
|
7718
|
+
"hawa-flex hawa-flex-col hawa-gap-4 hawa-transition-all",
|
|
7719
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100"
|
|
7720
|
+
)
|
|
7721
|
+
},
|
|
7722
|
+
/* @__PURE__ */ React64.createElement("div", { className: "hawa-mt-4 hawa-font-bold" }, props.question),
|
|
7723
|
+
/* @__PURE__ */ React64.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded " }, /* @__PURE__ */ React64.createElement(
|
|
7724
|
+
Controller6,
|
|
7742
7725
|
{
|
|
7743
|
-
|
|
7744
|
-
|
|
7726
|
+
control,
|
|
7727
|
+
name: "source",
|
|
7728
|
+
render: ({ field }) => /* @__PURE__ */ React64.createElement(
|
|
7729
|
+
Radio,
|
|
7730
|
+
{
|
|
7731
|
+
direction: props.direction,
|
|
7732
|
+
orientation: "vertical",
|
|
7733
|
+
options,
|
|
7734
|
+
defaultValue: field.value,
|
|
7735
|
+
onChangeTab: (e) => field.onChange(e),
|
|
7736
|
+
helperText: formState.errors.source?.message?.toString()
|
|
7737
|
+
}
|
|
7738
|
+
)
|
|
7745
7739
|
}
|
|
7746
|
-
)
|
|
7747
|
-
|
|
7740
|
+
)),
|
|
7741
|
+
/* @__PURE__ */ React64.createElement("div", null, /* @__PURE__ */ React64.createElement(
|
|
7742
|
+
Controller6,
|
|
7743
|
+
{
|
|
7744
|
+
control,
|
|
7745
|
+
name: "feedback",
|
|
7746
|
+
render: ({ field }) => /* @__PURE__ */ React64.createElement(
|
|
7747
|
+
Textarea,
|
|
7748
|
+
{
|
|
7749
|
+
...field,
|
|
7750
|
+
helperText: formState.errors.feedback?.message?.toString()
|
|
7751
|
+
}
|
|
7752
|
+
)
|
|
7753
|
+
}
|
|
7754
|
+
))
|
|
7755
|
+
),
|
|
7756
|
+
/* @__PURE__ */ React64.createElement(Button, { type: "submit", className: "hawa-mt-4 hawa-w-full" }, props.texts?.submit || "Submit")
|
|
7748
7757
|
))
|
|
7749
|
-
)
|
|
7758
|
+
)
|
|
7750
7759
|
);
|
|
7751
7760
|
};
|
|
7752
7761
|
|