@sikka/hawa 0.44.0-next → 0.45.1-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/blocks/auth/index.d.mts +3 -2
- package/dist/blocks/auth/index.d.ts +3 -2
- package/dist/blocks/auth/index.js +63 -34
- package/dist/blocks/auth/index.mjs +44 -23
- package/dist/blocks/feedback/index.js +22 -13
- package/dist/blocks/feedback/index.mjs +2 -2
- package/dist/blocks/index.d.mts +5 -2
- package/dist/blocks/index.d.ts +5 -2
- package/dist/blocks/index.js +143 -41
- package/dist/blocks/index.mjs +45 -15
- package/dist/blocks/misc/index.d.mts +2 -0
- package/dist/blocks/misc/index.d.ts +2 -0
- package/dist/blocks/misc/index.js +98 -18
- package/dist/blocks/misc/index.mjs +79 -7
- package/dist/blocks/pricing/index.js +2 -1
- package/dist/blocks/pricing/index.mjs +1 -1
- package/dist/{chunk-DYYINLRJ.mjs → chunk-D3B3MKLS.mjs} +20 -12
- package/dist/{chunk-MEXJAHQV.mjs → chunk-QOVVJCFE.mjs} +44 -28
- package/dist/{chunk-OE6XZ6LW.mjs → chunk-YABFWOF3.mjs} +2 -1
- package/dist/elements/index.js +44 -28
- package/dist/elements/index.mjs +1 -1
- package/dist/index.css +4 -1
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +85 -41
- package/dist/index.mjs +85 -41
- package/dist/interfaceSettings/index.js +2 -1
- package/dist/interfaceSettings/index.js.map +1 -1
- package/dist/interfaceSettings/index.mjs +2 -1
- package/dist/interfaceSettings/index.mjs.map +1 -1
- package/dist/phoneInput/index.js +20 -12
- package/dist/phoneInput/index.js.map +1 -1
- package/dist/phoneInput/index.mjs +20 -12
- package/dist/phoneInput/index.mjs.map +1 -1
- package/dist/pinInput/index.js +22 -15
- package/dist/pinInput/index.js.map +1 -1
- package/dist/pinInput/index.mjs +22 -15
- package/dist/pinInput/index.mjs.map +1 -1
- package/dist/radio/index.js +2 -1
- package/dist/radio/index.js.map +1 -1
- package/dist/radio/index.mjs +2 -1
- package/dist/radio/index.mjs.map +1 -1
- package/dist/select/index.js +20 -12
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +20 -12
- package/dist/select/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/blocks/index.js
CHANGED
@@ -3320,13 +3320,21 @@ var Select = ({
|
|
3320
3320
|
children
|
3321
3321
|
);
|
3322
3322
|
};
|
3323
|
-
const Option = ({
|
3323
|
+
const Option = ({
|
3324
|
+
children,
|
3325
|
+
innerProps,
|
3326
|
+
innerRef,
|
3327
|
+
isFocused,
|
3328
|
+
isSelected
|
3329
|
+
}) => {
|
3324
3330
|
return /* @__PURE__ */ import_react9.default.createElement(
|
3325
3331
|
"div",
|
3326
3332
|
{
|
3327
3333
|
ref: innerRef,
|
3328
3334
|
className: cn(
|
3329
|
-
"hawa-flex hawa-cursor-pointer hawa-select-none hawa-flex-row hawa-items-center hawa-justify-between hawa-rounded-inner hawa-p-1 hawa-px-2 hawa-transition-all
|
3335
|
+
"hawa-flex hawa-cursor-pointer hawa-select-none hawa-flex-row hawa-items-center hawa-justify-between hawa-rounded-inner hawa-p-1 hawa-px-2 hawa-transition-all",
|
3336
|
+
isFocused ? "hawa-bg-accent hawa-text-bg-accent-foreground" : "hover:hawa-bg-accent hover:hawa-text-accent-foreground",
|
3337
|
+
isSelected && "hawa-bg-primary hawa-text-primary-foreground"
|
3330
3338
|
),
|
3331
3339
|
...innerProps
|
3332
3340
|
},
|
@@ -3383,15 +3391,20 @@ var Select = ({
|
|
3383
3391
|
container: () => cn(
|
3384
3392
|
selectContainerStyles,
|
3385
3393
|
props.phoneCode && phoneCodeStyles,
|
3386
|
-
props.disabled ? "hawa-cursor-not-allowed" : "hawa-cursor-pointer",
|
3387
3394
|
props.isMulti && "hawa-ps-0 "
|
3388
3395
|
),
|
3389
|
-
placeholder: () =>
|
3396
|
+
placeholder: () => cn(
|
3397
|
+
selectPlaceholderStyles,
|
3398
|
+
props.disabled && "hawa-text-muted-foreground"
|
3399
|
+
),
|
3390
3400
|
valueContainer: () => "hawa-text-foreground hawa-px-1 ",
|
3391
|
-
singleValue: () =>
|
3401
|
+
singleValue: () => cn(
|
3402
|
+
props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
|
3403
|
+
),
|
3392
3404
|
indicatorsContainer: () => cn(
|
3393
3405
|
selectIndicatorContainerStyles,
|
3394
|
-
props.hideIndicator ? "hawa-invisible" : "hawa-px-1"
|
3406
|
+
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
3407
|
+
props.disabled && "hawa-opacity-30"
|
3395
3408
|
)
|
3396
3409
|
},
|
3397
3410
|
unstyled: true,
|
@@ -3399,12 +3412,6 @@ var Select = ({
|
|
3399
3412
|
components: props.hideIndicator ? { Option, Menu, IndicatorsContainer: () => null } : {
|
3400
3413
|
Option,
|
3401
3414
|
Menu,
|
3402
|
-
// Control: (e) => (
|
3403
|
-
// <div
|
3404
|
-
// className={cn(e.className, "hawa-flex hawa-flex-row")}
|
3405
|
-
// {...e}
|
3406
|
-
// />
|
3407
|
-
// ),
|
3408
3415
|
ValueContainer: (e) => /* @__PURE__ */ import_react9.default.createElement(
|
3409
3416
|
"div",
|
3410
3417
|
{
|
@@ -3427,6 +3434,7 @@ var Select = ({
|
|
3427
3434
|
options: props.options,
|
3428
3435
|
getOptionLabel: props.getOptionLabel,
|
3429
3436
|
defaultValue: props.defaultValue,
|
3437
|
+
value: props.value,
|
3430
3438
|
placeholder: props.placeholder,
|
3431
3439
|
isDisabled: props.disabled,
|
3432
3440
|
isClearable: props.isClearable,
|
@@ -4823,19 +4831,19 @@ var z5 = __toESM(require("zod"));
|
|
4823
4831
|
var React25 = __toESM(require("react"));
|
4824
4832
|
var import_input_otp = require("input-otp");
|
4825
4833
|
|
4826
|
-
// ../../node_modules/.pnpm/lucide-react@0.
|
4834
|
+
// ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
4827
4835
|
var import_react23 = require("react");
|
4828
4836
|
|
4829
|
-
// ../../node_modules/.pnpm/lucide-react@0.
|
4837
|
+
// ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
|
4830
4838
|
var toKebabCase = (string9) => string9.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
4831
4839
|
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
4832
4840
|
return Boolean(className) && array.indexOf(className) === index;
|
4833
4841
|
}).join(" ");
|
4834
4842
|
|
4835
|
-
// ../../node_modules/.pnpm/lucide-react@0.
|
4843
|
+
// ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
|
4836
4844
|
var import_react22 = require("react");
|
4837
4845
|
|
4838
|
-
// ../../node_modules/.pnpm/lucide-react@0.
|
4846
|
+
// ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
|
4839
4847
|
var defaultAttributes = {
|
4840
4848
|
xmlns: "http://www.w3.org/2000/svg",
|
4841
4849
|
width: 24,
|
@@ -4848,7 +4856,7 @@ var defaultAttributes = {
|
|
4848
4856
|
strokeLinejoin: "round"
|
4849
4857
|
};
|
4850
4858
|
|
4851
|
-
// ../../node_modules/.pnpm/lucide-react@0.
|
4859
|
+
// ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
|
4852
4860
|
var Icon = (0, import_react22.forwardRef)(
|
4853
4861
|
({
|
4854
4862
|
color = "currentColor",
|
@@ -4880,7 +4888,7 @@ var Icon = (0, import_react22.forwardRef)(
|
|
4880
4888
|
}
|
4881
4889
|
);
|
4882
4890
|
|
4883
|
-
// ../../node_modules/.pnpm/lucide-react@0.
|
4891
|
+
// ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
4884
4892
|
var createLucideIcon = (iconName, iconNode) => {
|
4885
4893
|
const Component = (0, import_react23.forwardRef)(
|
4886
4894
|
({ className, ...props }, ref) => (0, import_react23.createElement)(Icon, {
|
@@ -4894,7 +4902,7 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
4894
4902
|
return Component;
|
4895
4903
|
};
|
4896
4904
|
|
4897
|
-
// ../../node_modules/.pnpm/lucide-react@0.
|
4905
|
+
// ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
|
4898
4906
|
var Dot = createLucideIcon("Dot", [
|
4899
4907
|
["circle", { cx: "12.1", cy: "12.1", r: "1", key: "18d7e5" }]
|
4900
4908
|
]);
|
@@ -4951,12 +4959,19 @@ var PinInput = ({
|
|
4951
4959
|
const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
|
4952
4960
|
const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
|
4953
4961
|
const secondGroupLength = maxLength - firstGroupLength;
|
4954
|
-
return /* @__PURE__ */ React25.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, /* @__PURE__ */ React25.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React25.createElement(PinInputGroup, { className: "hawa-w-full
|
4962
|
+
return /* @__PURE__ */ React25.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, /* @__PURE__ */ React25.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React25.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React25.createElement(
|
4963
|
+
PinInputSlot,
|
4964
|
+
{
|
4965
|
+
key: index,
|
4966
|
+
index,
|
4967
|
+
className: "hawa-w-full hawa-border"
|
4968
|
+
}
|
4969
|
+
))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React25.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React25.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React25.createElement(
|
4955
4970
|
PinInputSlot,
|
4956
4971
|
{
|
4957
4972
|
key: index + firstGroupLength,
|
4958
4973
|
index: index + firstGroupLength,
|
4959
|
-
className: "hawa-w-full"
|
4974
|
+
className: "hawa-w-full hawa-border"
|
4960
4975
|
}
|
4961
4976
|
)))), /* @__PURE__ */ React25.createElement(HelperText, { helperText: props.helperText }));
|
4962
4977
|
};
|
@@ -5016,12 +5031,10 @@ var CodeConfirmation = ({
|
|
5016
5031
|
{
|
5017
5032
|
noValidate: true,
|
5018
5033
|
onSubmit: handleSubmit((e) => {
|
5019
|
-
if (props.
|
5020
|
-
return props.
|
5034
|
+
if (props.onConfirm) {
|
5035
|
+
return props.onConfirm(e);
|
5021
5036
|
} else {
|
5022
|
-
console.log(
|
5023
|
-
"Form is submitted but handleConfirm prop is missing"
|
5024
|
-
);
|
5037
|
+
console.log("Form is submitted but onConfirm prop is missing");
|
5025
5038
|
}
|
5026
5039
|
})
|
5027
5040
|
},
|
@@ -5049,12 +5062,28 @@ var CodeConfirmation = ({
|
|
5049
5062
|
className: "clickable-link",
|
5050
5063
|
onClick: () => {
|
5051
5064
|
startResendTimer();
|
5052
|
-
props.
|
5065
|
+
props.onResend();
|
5053
5066
|
}
|
5054
5067
|
},
|
5055
5068
|
((_i = props.texts) == null ? void 0 : _i.resendCode) || "Click to resend"
|
5056
5069
|
)),
|
5057
|
-
/* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ import_react24.default.createElement(
|
5070
|
+
/* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ import_react24.default.createElement(
|
5071
|
+
Button,
|
5072
|
+
{
|
5073
|
+
type: "button",
|
5074
|
+
onClick: () => {
|
5075
|
+
if (props.onCancel) {
|
5076
|
+
return props.onCancel();
|
5077
|
+
} else {
|
5078
|
+
console.log(
|
5079
|
+
"Cancel button clicked but onCancel prop is missing"
|
5080
|
+
);
|
5081
|
+
}
|
5082
|
+
},
|
5083
|
+
variant: "outline"
|
5084
|
+
},
|
5085
|
+
((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"
|
5086
|
+
), /* @__PURE__ */ import_react24.default.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
|
5058
5087
|
)));
|
5059
5088
|
};
|
5060
5089
|
|
@@ -5220,7 +5249,8 @@ var Radio = (0, import_react25.forwardRef)(
|
|
5220
5249
|
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium hawa-h-[40px]",
|
5221
5250
|
orientationStyle[orientation],
|
5222
5251
|
widthStyle[width],
|
5223
|
-
tabsContainerClassName
|
5252
|
+
tabsContainerClassName,
|
5253
|
+
props.direction === "rtl" ? "hawa-flex-row-reverse" : ""
|
5224
5254
|
)
|
5225
5255
|
},
|
5226
5256
|
(_b = props.options) == null ? void 0 : _b.map((opt, o) => {
|
@@ -6113,6 +6143,64 @@ var import_react45 = require("react");
|
|
6113
6143
|
|
6114
6144
|
// hooks/useShortcuts.ts
|
6115
6145
|
var import_react46 = require("react");
|
6146
|
+
function parseHotkey(hotkey) {
|
6147
|
+
const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
|
6148
|
+
const modifiers = {
|
6149
|
+
alt: keys.includes("alt"),
|
6150
|
+
ctrl: keys.includes("ctrl"),
|
6151
|
+
meta: keys.includes("meta"),
|
6152
|
+
mod: keys.includes("mod"),
|
6153
|
+
shift: keys.includes("shift")
|
6154
|
+
};
|
6155
|
+
const reservedKeys = ["alt", "ctrl", "meta", "shift", "mod"];
|
6156
|
+
const freeKey = keys.find((key) => !reservedKeys.includes(key));
|
6157
|
+
return {
|
6158
|
+
...modifiers,
|
6159
|
+
key: freeKey
|
6160
|
+
};
|
6161
|
+
}
|
6162
|
+
function isExactHotkey(hotkey, event) {
|
6163
|
+
const { alt, ctrl, meta, mod, shift, key } = hotkey;
|
6164
|
+
const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey } = event;
|
6165
|
+
if (alt !== altKey) {
|
6166
|
+
return false;
|
6167
|
+
}
|
6168
|
+
if (mod) {
|
6169
|
+
if (!ctrlKey && !metaKey) {
|
6170
|
+
return false;
|
6171
|
+
}
|
6172
|
+
} else {
|
6173
|
+
if (ctrl !== ctrlKey) {
|
6174
|
+
return false;
|
6175
|
+
}
|
6176
|
+
if (meta !== metaKey) {
|
6177
|
+
return false;
|
6178
|
+
}
|
6179
|
+
}
|
6180
|
+
if (shift !== shiftKey) {
|
6181
|
+
return false;
|
6182
|
+
}
|
6183
|
+
if (key && (pressedKey.toLowerCase() === key.toLowerCase() || event.code.replace("Key", "").toLowerCase() === key.toLowerCase())) {
|
6184
|
+
return true;
|
6185
|
+
}
|
6186
|
+
return false;
|
6187
|
+
}
|
6188
|
+
function getHotkeyMatcher(hotkey) {
|
6189
|
+
return (event) => isExactHotkey(parseHotkey(hotkey), event);
|
6190
|
+
}
|
6191
|
+
function getHotkeyHandler(hotkeys) {
|
6192
|
+
return (event) => {
|
6193
|
+
const _event = "nativeEvent" in event ? event.nativeEvent : event;
|
6194
|
+
hotkeys.forEach(([hotkey, handler, options = { preventDefault: true }]) => {
|
6195
|
+
if (getHotkeyMatcher(hotkey)(_event)) {
|
6196
|
+
if (options.preventDefault) {
|
6197
|
+
event.preventDefault();
|
6198
|
+
}
|
6199
|
+
handler(_event);
|
6200
|
+
}
|
6201
|
+
});
|
6202
|
+
};
|
6203
|
+
}
|
6116
6204
|
|
6117
6205
|
// hooks/useWindowEvent.ts
|
6118
6206
|
var import_react47 = require("react");
|
@@ -6562,6 +6650,7 @@ var ContactForm = ({
|
|
6562
6650
|
onSubmit,
|
6563
6651
|
customFields,
|
6564
6652
|
classNames,
|
6653
|
+
clearOnSubmit = true,
|
6565
6654
|
...props
|
6566
6655
|
}) => {
|
6567
6656
|
var _a, _b, _c, _d, _e;
|
@@ -6605,8 +6694,11 @@ var ContactForm = ({
|
|
6605
6694
|
control,
|
6606
6695
|
handleSubmit,
|
6607
6696
|
formState: { errors },
|
6608
|
-
reset
|
6697
|
+
reset,
|
6698
|
+
getValues,
|
6699
|
+
trigger
|
6609
6700
|
} = (0, import_react_hook_form9.useForm)({
|
6701
|
+
mode: "all",
|
6610
6702
|
resolver: (0, import_zod8.zodResolver)(MainSchema),
|
6611
6703
|
defaultValues: {
|
6612
6704
|
name: "",
|
@@ -6615,10 +6707,16 @@ var ContactForm = ({
|
|
6615
6707
|
...customFieldsDefaultValues
|
6616
6708
|
}
|
6617
6709
|
});
|
6618
|
-
const
|
6710
|
+
const SubmitForm = async (data) => {
|
6711
|
+
const isValid = await trigger();
|
6712
|
+
if (!isValid) {
|
6713
|
+
return;
|
6714
|
+
}
|
6619
6715
|
if (onSubmit) {
|
6620
6716
|
onSubmit(data);
|
6621
|
-
|
6717
|
+
if (clearOnSubmit) {
|
6718
|
+
reset();
|
6719
|
+
}
|
6622
6720
|
} else {
|
6623
6721
|
console.log("Form is submitted but onSubmit prop is missing");
|
6624
6722
|
}
|
@@ -6628,7 +6726,8 @@ var ContactForm = ({
|
|
6628
6726
|
{
|
6629
6727
|
className: cn(
|
6630
6728
|
"hawa-w-full",
|
6631
|
-
cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
|
6729
|
+
cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none",
|
6730
|
+
classNames == null ? void 0 : classNames.container
|
6632
6731
|
),
|
6633
6732
|
style: cardless ? { boxShadow: "none" } : void 0
|
6634
6733
|
},
|
@@ -6636,7 +6735,7 @@ var ContactForm = ({
|
|
6636
6735
|
"form",
|
6637
6736
|
{
|
6638
6737
|
noValidate: true,
|
6639
|
-
onSubmit: handleSubmit(
|
6738
|
+
onSubmit: handleSubmit(SubmitForm),
|
6640
6739
|
className: "hawa-space-y-2",
|
6641
6740
|
id: formId,
|
6642
6741
|
autoComplete: formAutoComplete
|
@@ -6747,7 +6846,10 @@ var ContactForm = ({
|
|
6747
6846
|
textareaProps: {
|
6748
6847
|
placeholder: texts == null ? void 0 : texts.message.placeholder,
|
6749
6848
|
className: "hawa-min-h-20",
|
6750
|
-
...field
|
6849
|
+
...field,
|
6850
|
+
onKeyDown: getHotkeyHandler([
|
6851
|
+
["mod+enter", () => SubmitForm(getValues())]
|
6852
|
+
])
|
6751
6853
|
},
|
6752
6854
|
classNames: { textarea: "hawa-min-h-40 hawa-h-full" },
|
6753
6855
|
helperText: (_a2 = errors.message) == null ? void 0 : _a2.message
|
@@ -7954,7 +8056,7 @@ var Usage = (props) => {
|
|
7954
8056
|
|
7955
8057
|
lucide-react/dist/esm/shared/src/utils.js:
|
7956
8058
|
(**
|
7957
|
-
* @license lucide-react v0.
|
8059
|
+
* @license lucide-react v0.424.0 - ISC
|
7958
8060
|
*
|
7959
8061
|
* This source code is licensed under the ISC license.
|
7960
8062
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -7962,7 +8064,7 @@ lucide-react/dist/esm/shared/src/utils.js:
|
|
7962
8064
|
|
7963
8065
|
lucide-react/dist/esm/defaultAttributes.js:
|
7964
8066
|
(**
|
7965
|
-
* @license lucide-react v0.
|
8067
|
+
* @license lucide-react v0.424.0 - ISC
|
7966
8068
|
*
|
7967
8069
|
* This source code is licensed under the ISC license.
|
7968
8070
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -7970,7 +8072,7 @@ lucide-react/dist/esm/defaultAttributes.js:
|
|
7970
8072
|
|
7971
8073
|
lucide-react/dist/esm/Icon.js:
|
7972
8074
|
(**
|
7973
|
-
* @license lucide-react v0.
|
8075
|
+
* @license lucide-react v0.424.0 - ISC
|
7974
8076
|
*
|
7975
8077
|
* This source code is licensed under the ISC license.
|
7976
8078
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -7978,7 +8080,7 @@ lucide-react/dist/esm/Icon.js:
|
|
7978
8080
|
|
7979
8081
|
lucide-react/dist/esm/createLucideIcon.js:
|
7980
8082
|
(**
|
7981
|
-
* @license lucide-react v0.
|
8083
|
+
* @license lucide-react v0.424.0 - ISC
|
7982
8084
|
*
|
7983
8085
|
* This source code is licensed under the ISC license.
|
7984
8086
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -7986,7 +8088,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
7986
8088
|
|
7987
8089
|
lucide-react/dist/esm/icons/dot.js:
|
7988
8090
|
(**
|
7989
|
-
* @license lucide-react v0.
|
8091
|
+
* @license lucide-react v0.424.0 - ISC
|
7990
8092
|
*
|
7991
8093
|
* This source code is licensed under the ISC license.
|
7992
8094
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -7994,7 +8096,7 @@ lucide-react/dist/esm/icons/dot.js:
|
|
7994
8096
|
|
7995
8097
|
lucide-react/dist/esm/lucide-react.js:
|
7996
8098
|
(**
|
7997
|
-
* @license lucide-react v0.
|
8099
|
+
* @license lucide-react v0.424.0 - ISC
|
7998
8100
|
*
|
7999
8101
|
* This source code is licensed under the ISC license.
|
8000
8102
|
* See the LICENSE file in the root directory of this source tree.
|
package/dist/blocks/index.mjs
CHANGED
@@ -17,8 +17,10 @@ import {
|
|
17
17
|
TabsList,
|
18
18
|
TabsTrigger,
|
19
19
|
Textarea
|
20
|
-
} from "../chunk-
|
21
|
-
import
|
20
|
+
} from "../chunk-QOVVJCFE.mjs";
|
21
|
+
import {
|
22
|
+
getHotkeyHandler
|
23
|
+
} from "../chunk-WL7C2A5D.mjs";
|
22
24
|
import {
|
23
25
|
BadEmoji,
|
24
26
|
Button,
|
@@ -1179,12 +1181,10 @@ var CodeConfirmation = ({
|
|
1179
1181
|
{
|
1180
1182
|
noValidate: true,
|
1181
1183
|
onSubmit: handleSubmit((e) => {
|
1182
|
-
if (props.
|
1183
|
-
return props.
|
1184
|
+
if (props.onConfirm) {
|
1185
|
+
return props.onConfirm(e);
|
1184
1186
|
} else {
|
1185
|
-
console.log(
|
1186
|
-
"Form is submitted but handleConfirm prop is missing"
|
1187
|
-
);
|
1187
|
+
console.log("Form is submitted but onConfirm prop is missing");
|
1188
1188
|
}
|
1189
1189
|
})
|
1190
1190
|
},
|
@@ -1212,12 +1212,28 @@ var CodeConfirmation = ({
|
|
1212
1212
|
className: "clickable-link",
|
1213
1213
|
onClick: () => {
|
1214
1214
|
startResendTimer();
|
1215
|
-
props.
|
1215
|
+
props.onResend();
|
1216
1216
|
}
|
1217
1217
|
},
|
1218
1218
|
((_i = props.texts) == null ? void 0 : _i.resendCode) || "Click to resend"
|
1219
1219
|
)),
|
1220
|
-
/* @__PURE__ */ React8.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ React8.createElement(
|
1220
|
+
/* @__PURE__ */ React8.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ React8.createElement(
|
1221
|
+
Button,
|
1222
|
+
{
|
1223
|
+
type: "button",
|
1224
|
+
onClick: () => {
|
1225
|
+
if (props.onCancel) {
|
1226
|
+
return props.onCancel();
|
1227
|
+
} else {
|
1228
|
+
console.log(
|
1229
|
+
"Cancel button clicked but onCancel prop is missing"
|
1230
|
+
);
|
1231
|
+
}
|
1232
|
+
},
|
1233
|
+
variant: "outline"
|
1234
|
+
},
|
1235
|
+
((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"
|
1236
|
+
), /* @__PURE__ */ React8.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
|
1221
1237
|
)));
|
1222
1238
|
};
|
1223
1239
|
|
@@ -1860,6 +1876,7 @@ var ContactForm = ({
|
|
1860
1876
|
onSubmit,
|
1861
1877
|
customFields,
|
1862
1878
|
classNames,
|
1879
|
+
clearOnSubmit = true,
|
1863
1880
|
...props
|
1864
1881
|
}) => {
|
1865
1882
|
var _a, _b, _c, _d, _e;
|
@@ -1903,8 +1920,11 @@ var ContactForm = ({
|
|
1903
1920
|
control,
|
1904
1921
|
handleSubmit,
|
1905
1922
|
formState: { errors },
|
1906
|
-
reset
|
1923
|
+
reset,
|
1924
|
+
getValues,
|
1925
|
+
trigger
|
1907
1926
|
} = useForm9({
|
1927
|
+
mode: "all",
|
1908
1928
|
resolver: zodResolver8(MainSchema),
|
1909
1929
|
defaultValues: {
|
1910
1930
|
name: "",
|
@@ -1913,10 +1933,16 @@ var ContactForm = ({
|
|
1913
1933
|
...customFieldsDefaultValues
|
1914
1934
|
}
|
1915
1935
|
});
|
1916
|
-
const
|
1936
|
+
const SubmitForm = async (data) => {
|
1937
|
+
const isValid = await trigger();
|
1938
|
+
if (!isValid) {
|
1939
|
+
return;
|
1940
|
+
}
|
1917
1941
|
if (onSubmit) {
|
1918
1942
|
onSubmit(data);
|
1919
|
-
|
1943
|
+
if (clearOnSubmit) {
|
1944
|
+
reset();
|
1945
|
+
}
|
1920
1946
|
} else {
|
1921
1947
|
console.log("Form is submitted but onSubmit prop is missing");
|
1922
1948
|
}
|
@@ -1926,7 +1952,8 @@ var ContactForm = ({
|
|
1926
1952
|
{
|
1927
1953
|
className: cn(
|
1928
1954
|
"hawa-w-full",
|
1929
|
-
cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
|
1955
|
+
cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none",
|
1956
|
+
classNames == null ? void 0 : classNames.container
|
1930
1957
|
),
|
1931
1958
|
style: cardless ? { boxShadow: "none" } : void 0
|
1932
1959
|
},
|
@@ -1934,7 +1961,7 @@ var ContactForm = ({
|
|
1934
1961
|
"form",
|
1935
1962
|
{
|
1936
1963
|
noValidate: true,
|
1937
|
-
onSubmit: handleSubmit(
|
1964
|
+
onSubmit: handleSubmit(SubmitForm),
|
1938
1965
|
className: "hawa-space-y-2",
|
1939
1966
|
id: formId,
|
1940
1967
|
autoComplete: formAutoComplete
|
@@ -2045,7 +2072,10 @@ var ContactForm = ({
|
|
2045
2072
|
textareaProps: {
|
2046
2073
|
placeholder: texts == null ? void 0 : texts.message.placeholder,
|
2047
2074
|
className: "hawa-min-h-20",
|
2048
|
-
...field
|
2075
|
+
...field,
|
2076
|
+
onKeyDown: getHotkeyHandler([
|
2077
|
+
["mod+enter", () => SubmitForm(getValues())]
|
2078
|
+
])
|
2049
2079
|
},
|
2050
2080
|
classNames: { textarea: "hawa-min-h-40 hawa-h-full" },
|
2051
2081
|
helperText: (_a2 = errors.message) == null ? void 0 : _a2.message
|
@@ -85,12 +85,14 @@ type ContactFormProps = {
|
|
85
85
|
cardless?: boolean;
|
86
86
|
formId?: string;
|
87
87
|
formAutoComplete?: "on" | "off";
|
88
|
+
clearOnSubmit?: boolean;
|
88
89
|
size?: "sm" | "default";
|
89
90
|
onSubmit: (e: ContactFormData) => void;
|
90
91
|
customFields?: CustomField[];
|
91
92
|
showSuccess?: boolean;
|
92
93
|
classNames?: {
|
93
94
|
submitButton?: string;
|
95
|
+
container?: string;
|
94
96
|
};
|
95
97
|
texts?: {
|
96
98
|
submit: string;
|
@@ -85,12 +85,14 @@ type ContactFormProps = {
|
|
85
85
|
cardless?: boolean;
|
86
86
|
formId?: string;
|
87
87
|
formAutoComplete?: "on" | "off";
|
88
|
+
clearOnSubmit?: boolean;
|
88
89
|
size?: "sm" | "default";
|
89
90
|
onSubmit: (e: ContactFormData) => void;
|
90
91
|
customFields?: CustomField[];
|
91
92
|
showSuccess?: boolean;
|
92
93
|
classNames?: {
|
93
94
|
submitButton?: string;
|
95
|
+
container?: string;
|
94
96
|
};
|
95
97
|
texts?: {
|
96
98
|
submit: string;
|