@sikka/hawa 0.44.0-next → 0.45.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.
@@ -3320,13 +3320,21 @@ var Select = ({
3320
3320
  children
3321
3321
  );
3322
3322
  };
3323
- const Option = ({ children, innerProps, innerRef }) => {
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 hover:hawa-bg-primary hover:hawa-text-primary-foreground"
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: () => selectPlaceholderStyles,
3396
+ placeholder: () => cn(
3397
+ selectPlaceholderStyles,
3398
+ props.disabled && "hawa-text-muted-foreground"
3399
+ ),
3390
3400
  valueContainer: () => "hawa-text-foreground hawa-px-1 ",
3391
- singleValue: () => "hawa-text-foreground",
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
  {
@@ -4823,19 +4830,19 @@ var z5 = __toESM(require("zod"));
4823
4830
  var React25 = __toESM(require("react"));
4824
4831
  var import_input_otp = require("input-otp");
4825
4832
 
4826
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
4833
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
4827
4834
  var import_react23 = require("react");
4828
4835
 
4829
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
4836
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
4830
4837
  var toKebabCase = (string9) => string9.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4831
4838
  var mergeClasses = (...classes) => classes.filter((className, index, array) => {
4832
4839
  return Boolean(className) && array.indexOf(className) === index;
4833
4840
  }).join(" ");
4834
4841
 
4835
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
4842
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
4836
4843
  var import_react22 = require("react");
4837
4844
 
4838
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
4845
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
4839
4846
  var defaultAttributes = {
4840
4847
  xmlns: "http://www.w3.org/2000/svg",
4841
4848
  width: 24,
@@ -4848,7 +4855,7 @@ var defaultAttributes = {
4848
4855
  strokeLinejoin: "round"
4849
4856
  };
4850
4857
 
4851
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
4858
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
4852
4859
  var Icon = (0, import_react22.forwardRef)(
4853
4860
  ({
4854
4861
  color = "currentColor",
@@ -4880,7 +4887,7 @@ var Icon = (0, import_react22.forwardRef)(
4880
4887
  }
4881
4888
  );
4882
4889
 
4883
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
4890
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
4884
4891
  var createLucideIcon = (iconName, iconNode) => {
4885
4892
  const Component = (0, import_react23.forwardRef)(
4886
4893
  ({ className, ...props }, ref) => (0, import_react23.createElement)(Icon, {
@@ -4894,7 +4901,7 @@ var createLucideIcon = (iconName, iconNode) => {
4894
4901
  return Component;
4895
4902
  };
4896
4903
 
4897
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
4904
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
4898
4905
  var Dot = createLucideIcon("Dot", [
4899
4906
  ["circle", { cx: "12.1", cy: "12.1", r: "1", key: "18d7e5" }]
4900
4907
  ]);
@@ -4951,12 +4958,19 @@ var PinInput = ({
4951
4958
  const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
4952
4959
  const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
4953
4960
  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" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React25.createElement(PinInputSlot, { key: index, index, className: "hawa-w-full" }))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React25.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React25.createElement(PinInputGroup, { className: "hawa-w-full" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React25.createElement(
4961
+ 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(
4962
+ PinInputSlot,
4963
+ {
4964
+ key: index,
4965
+ index,
4966
+ className: "hawa-w-full hawa-border"
4967
+ }
4968
+ ))), 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
4969
  PinInputSlot,
4956
4970
  {
4957
4971
  key: index + firstGroupLength,
4958
4972
  index: index + firstGroupLength,
4959
- className: "hawa-w-full"
4973
+ className: "hawa-w-full hawa-border"
4960
4974
  }
4961
4975
  )))), /* @__PURE__ */ React25.createElement(HelperText, { helperText: props.helperText }));
4962
4976
  };
@@ -5016,12 +5030,10 @@ var CodeConfirmation = ({
5016
5030
  {
5017
5031
  noValidate: true,
5018
5032
  onSubmit: handleSubmit((e) => {
5019
- if (props.handleConfirm) {
5020
- return props.handleConfirm(e);
5033
+ if (props.onConfirm) {
5034
+ return props.onConfirm(e);
5021
5035
  } else {
5022
- console.log(
5023
- "Form is submitted but handleConfirm prop is missing"
5024
- );
5036
+ console.log("Form is submitted but onConfirm prop is missing");
5025
5037
  }
5026
5038
  })
5027
5039
  },
@@ -5049,12 +5061,28 @@ var CodeConfirmation = ({
5049
5061
  className: "clickable-link",
5050
5062
  onClick: () => {
5051
5063
  startResendTimer();
5052
- props.handleResend();
5064
+ props.onResend();
5053
5065
  }
5054
5066
  },
5055
5067
  ((_i = props.texts) == null ? void 0 : _i.resendCode) || "Click to resend"
5056
5068
  )),
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(Button, { variant: "outline" }, ((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"), /* @__PURE__ */ import_react24.default.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
5069
+ /* @__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
+ Button,
5071
+ {
5072
+ type: "button",
5073
+ onClick: () => {
5074
+ if (props.onCancel) {
5075
+ return props.onCancel();
5076
+ } else {
5077
+ console.log(
5078
+ "Cancel button clicked but onCancel prop is missing"
5079
+ );
5080
+ }
5081
+ },
5082
+ variant: "outline"
5083
+ },
5084
+ ((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"
5085
+ ), /* @__PURE__ */ import_react24.default.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
5058
5086
  )));
5059
5087
  };
5060
5088
 
@@ -6113,6 +6141,64 @@ var import_react45 = require("react");
6113
6141
 
6114
6142
  // hooks/useShortcuts.ts
6115
6143
  var import_react46 = require("react");
6144
+ function parseHotkey(hotkey) {
6145
+ const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
6146
+ const modifiers = {
6147
+ alt: keys.includes("alt"),
6148
+ ctrl: keys.includes("ctrl"),
6149
+ meta: keys.includes("meta"),
6150
+ mod: keys.includes("mod"),
6151
+ shift: keys.includes("shift")
6152
+ };
6153
+ const reservedKeys = ["alt", "ctrl", "meta", "shift", "mod"];
6154
+ const freeKey = keys.find((key) => !reservedKeys.includes(key));
6155
+ return {
6156
+ ...modifiers,
6157
+ key: freeKey
6158
+ };
6159
+ }
6160
+ function isExactHotkey(hotkey, event) {
6161
+ const { alt, ctrl, meta, mod, shift, key } = hotkey;
6162
+ const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey } = event;
6163
+ if (alt !== altKey) {
6164
+ return false;
6165
+ }
6166
+ if (mod) {
6167
+ if (!ctrlKey && !metaKey) {
6168
+ return false;
6169
+ }
6170
+ } else {
6171
+ if (ctrl !== ctrlKey) {
6172
+ return false;
6173
+ }
6174
+ if (meta !== metaKey) {
6175
+ return false;
6176
+ }
6177
+ }
6178
+ if (shift !== shiftKey) {
6179
+ return false;
6180
+ }
6181
+ if (key && (pressedKey.toLowerCase() === key.toLowerCase() || event.code.replace("Key", "").toLowerCase() === key.toLowerCase())) {
6182
+ return true;
6183
+ }
6184
+ return false;
6185
+ }
6186
+ function getHotkeyMatcher(hotkey) {
6187
+ return (event) => isExactHotkey(parseHotkey(hotkey), event);
6188
+ }
6189
+ function getHotkeyHandler(hotkeys) {
6190
+ return (event) => {
6191
+ const _event = "nativeEvent" in event ? event.nativeEvent : event;
6192
+ hotkeys.forEach(([hotkey, handler, options = { preventDefault: true }]) => {
6193
+ if (getHotkeyMatcher(hotkey)(_event)) {
6194
+ if (options.preventDefault) {
6195
+ event.preventDefault();
6196
+ }
6197
+ handler(_event);
6198
+ }
6199
+ });
6200
+ };
6201
+ }
6116
6202
 
6117
6203
  // hooks/useWindowEvent.ts
6118
6204
  var import_react47 = require("react");
@@ -6562,6 +6648,7 @@ var ContactForm = ({
6562
6648
  onSubmit,
6563
6649
  customFields,
6564
6650
  classNames,
6651
+ clearOnSubmit = true,
6565
6652
  ...props
6566
6653
  }) => {
6567
6654
  var _a, _b, _c, _d, _e;
@@ -6605,8 +6692,11 @@ var ContactForm = ({
6605
6692
  control,
6606
6693
  handleSubmit,
6607
6694
  formState: { errors },
6608
- reset
6695
+ reset,
6696
+ getValues,
6697
+ trigger
6609
6698
  } = (0, import_react_hook_form9.useForm)({
6699
+ mode: "all",
6610
6700
  resolver: (0, import_zod8.zodResolver)(MainSchema),
6611
6701
  defaultValues: {
6612
6702
  name: "",
@@ -6615,10 +6705,16 @@ var ContactForm = ({
6615
6705
  ...customFieldsDefaultValues
6616
6706
  }
6617
6707
  });
6618
- const handleFormSubmit = (data) => {
6708
+ const SubmitForm = async (data) => {
6709
+ const isValid = await trigger();
6710
+ if (!isValid) {
6711
+ return;
6712
+ }
6619
6713
  if (onSubmit) {
6620
6714
  onSubmit(data);
6621
- reset();
6715
+ if (clearOnSubmit) {
6716
+ reset();
6717
+ }
6622
6718
  } else {
6623
6719
  console.log("Form is submitted but onSubmit prop is missing");
6624
6720
  }
@@ -6628,7 +6724,8 @@ var ContactForm = ({
6628
6724
  {
6629
6725
  className: cn(
6630
6726
  "hawa-w-full",
6631
- cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
6727
+ cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none",
6728
+ classNames == null ? void 0 : classNames.container
6632
6729
  ),
6633
6730
  style: cardless ? { boxShadow: "none" } : void 0
6634
6731
  },
@@ -6636,7 +6733,7 @@ var ContactForm = ({
6636
6733
  "form",
6637
6734
  {
6638
6735
  noValidate: true,
6639
- onSubmit: handleSubmit(handleFormSubmit),
6736
+ onSubmit: handleSubmit(SubmitForm),
6640
6737
  className: "hawa-space-y-2",
6641
6738
  id: formId,
6642
6739
  autoComplete: formAutoComplete
@@ -6747,7 +6844,10 @@ var ContactForm = ({
6747
6844
  textareaProps: {
6748
6845
  placeholder: texts == null ? void 0 : texts.message.placeholder,
6749
6846
  className: "hawa-min-h-20",
6750
- ...field
6847
+ ...field,
6848
+ onKeyDown: getHotkeyHandler([
6849
+ ["mod+enter", () => SubmitForm(getValues())]
6850
+ ])
6751
6851
  },
6752
6852
  classNames: { textarea: "hawa-min-h-40 hawa-h-full" },
6753
6853
  helperText: (_a2 = errors.message) == null ? void 0 : _a2.message
@@ -7954,7 +8054,7 @@ var Usage = (props) => {
7954
8054
 
7955
8055
  lucide-react/dist/esm/shared/src/utils.js:
7956
8056
  (**
7957
- * @license lucide-react v0.417.0 - ISC
8057
+ * @license lucide-react v0.424.0 - ISC
7958
8058
  *
7959
8059
  * This source code is licensed under the ISC license.
7960
8060
  * See the LICENSE file in the root directory of this source tree.
@@ -7962,7 +8062,7 @@ lucide-react/dist/esm/shared/src/utils.js:
7962
8062
 
7963
8063
  lucide-react/dist/esm/defaultAttributes.js:
7964
8064
  (**
7965
- * @license lucide-react v0.417.0 - ISC
8065
+ * @license lucide-react v0.424.0 - ISC
7966
8066
  *
7967
8067
  * This source code is licensed under the ISC license.
7968
8068
  * See the LICENSE file in the root directory of this source tree.
@@ -7970,7 +8070,7 @@ lucide-react/dist/esm/defaultAttributes.js:
7970
8070
 
7971
8071
  lucide-react/dist/esm/Icon.js:
7972
8072
  (**
7973
- * @license lucide-react v0.417.0 - ISC
8073
+ * @license lucide-react v0.424.0 - ISC
7974
8074
  *
7975
8075
  * This source code is licensed under the ISC license.
7976
8076
  * See the LICENSE file in the root directory of this source tree.
@@ -7978,7 +8078,7 @@ lucide-react/dist/esm/Icon.js:
7978
8078
 
7979
8079
  lucide-react/dist/esm/createLucideIcon.js:
7980
8080
  (**
7981
- * @license lucide-react v0.417.0 - ISC
8081
+ * @license lucide-react v0.424.0 - ISC
7982
8082
  *
7983
8083
  * This source code is licensed under the ISC license.
7984
8084
  * See the LICENSE file in the root directory of this source tree.
@@ -7986,7 +8086,7 @@ lucide-react/dist/esm/createLucideIcon.js:
7986
8086
 
7987
8087
  lucide-react/dist/esm/icons/dot.js:
7988
8088
  (**
7989
- * @license lucide-react v0.417.0 - ISC
8089
+ * @license lucide-react v0.424.0 - ISC
7990
8090
  *
7991
8091
  * This source code is licensed under the ISC license.
7992
8092
  * See the LICENSE file in the root directory of this source tree.
@@ -7994,7 +8094,7 @@ lucide-react/dist/esm/icons/dot.js:
7994
8094
 
7995
8095
  lucide-react/dist/esm/lucide-react.js:
7996
8096
  (**
7997
- * @license lucide-react v0.417.0 - ISC
8097
+ * @license lucide-react v0.424.0 - ISC
7998
8098
  *
7999
8099
  * This source code is licensed under the ISC license.
8000
8100
  * See the LICENSE file in the root directory of this source tree.
@@ -17,8 +17,10 @@ import {
17
17
  TabsList,
18
18
  TabsTrigger,
19
19
  Textarea
20
- } from "../chunk-MEXJAHQV.mjs";
21
- import "../chunk-WL7C2A5D.mjs";
20
+ } from "../chunk-QMNXTGM4.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.handleConfirm) {
1183
- return props.handleConfirm(e);
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.handleResend();
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(Button, { variant: "outline" }, ((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"), /* @__PURE__ */ React8.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
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 handleFormSubmit = (data) => {
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
- reset();
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(handleFormSubmit),
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;