@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.
package/dist/index.mjs CHANGED
@@ -5548,13 +5548,21 @@ var Select = ({
5548
5548
  children
5549
5549
  );
5550
5550
  };
5551
- const Option = ({ children, innerProps, innerRef }) => {
5551
+ const Option = ({
5552
+ children,
5553
+ innerProps,
5554
+ innerRef,
5555
+ isFocused,
5556
+ isSelected
5557
+ }) => {
5552
5558
  return /* @__PURE__ */ React43.createElement(
5553
5559
  "div",
5554
5560
  {
5555
5561
  ref: innerRef,
5556
5562
  className: cn(
5557
- "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"
5563
+ "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",
5564
+ isFocused ? "hawa-bg-accent hawa-text-bg-accent-foreground" : "hover:hawa-bg-accent hover:hawa-text-accent-foreground",
5565
+ isSelected && "hawa-bg-primary hawa-text-primary-foreground"
5558
5566
  ),
5559
5567
  ...innerProps
5560
5568
  },
@@ -5611,15 +5619,20 @@ var Select = ({
5611
5619
  container: () => cn(
5612
5620
  selectContainerStyles,
5613
5621
  props.phoneCode && phoneCodeStyles,
5614
- props.disabled ? "hawa-cursor-not-allowed" : "hawa-cursor-pointer",
5615
5622
  props.isMulti && "hawa-ps-0 "
5616
5623
  ),
5617
- placeholder: () => selectPlaceholderStyles,
5624
+ placeholder: () => cn(
5625
+ selectPlaceholderStyles,
5626
+ props.disabled && "hawa-text-muted-foreground"
5627
+ ),
5618
5628
  valueContainer: () => "hawa-text-foreground hawa-px-1 ",
5619
- singleValue: () => "hawa-text-foreground",
5629
+ singleValue: () => cn(
5630
+ props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
5631
+ ),
5620
5632
  indicatorsContainer: () => cn(
5621
5633
  selectIndicatorContainerStyles,
5622
- props.hideIndicator ? "hawa-invisible" : "hawa-px-1"
5634
+ props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
5635
+ props.disabled && "hawa-opacity-30"
5623
5636
  )
5624
5637
  },
5625
5638
  unstyled: true,
@@ -5627,12 +5640,6 @@ var Select = ({
5627
5640
  components: props.hideIndicator ? { Option, Menu: Menu2, IndicatorsContainer: () => null } : {
5628
5641
  Option,
5629
5642
  Menu: Menu2,
5630
- // Control: (e) => (
5631
- // <div
5632
- // className={cn(e.className, "hawa-flex hawa-flex-row")}
5633
- // {...e}
5634
- // />
5635
- // ),
5636
5643
  ValueContainer: (e) => /* @__PURE__ */ React43.createElement(
5637
5644
  "div",
5638
5645
  {
@@ -7704,19 +7711,19 @@ var PhoneInput = ({
7704
7711
  import * as React50 from "react";
7705
7712
  import { OTPInput, OTPInputContext } from "input-otp";
7706
7713
 
7707
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
7714
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
7708
7715
  import { forwardRef as forwardRef25, createElement as createElement24 } from "react";
7709
7716
 
7710
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
7717
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
7711
7718
  var toKebabCase = (string9) => string9.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
7712
7719
  var mergeClasses = (...classes) => classes.filter((className, index, array) => {
7713
7720
  return Boolean(className) && array.indexOf(className) === index;
7714
7721
  }).join(" ");
7715
7722
 
7716
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
7723
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
7717
7724
  import { forwardRef as forwardRef24, createElement as createElement23 } from "react";
7718
7725
 
7719
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
7726
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
7720
7727
  var defaultAttributes = {
7721
7728
  xmlns: "http://www.w3.org/2000/svg",
7722
7729
  width: 24,
@@ -7729,7 +7736,7 @@ var defaultAttributes = {
7729
7736
  strokeLinejoin: "round"
7730
7737
  };
7731
7738
 
7732
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
7739
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
7733
7740
  var Icon = forwardRef24(
7734
7741
  ({
7735
7742
  color = "currentColor",
@@ -7761,7 +7768,7 @@ var Icon = forwardRef24(
7761
7768
  }
7762
7769
  );
7763
7770
 
7764
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
7771
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
7765
7772
  var createLucideIcon = (iconName, iconNode) => {
7766
7773
  const Component = forwardRef25(
7767
7774
  ({ className, ...props }, ref) => createElement24(Icon, {
@@ -7775,7 +7782,7 @@ var createLucideIcon = (iconName, iconNode) => {
7775
7782
  return Component;
7776
7783
  };
7777
7784
 
7778
- // ../../node_modules/.pnpm/lucide-react@0.417.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
7785
+ // ../../node_modules/.pnpm/lucide-react@0.424.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
7779
7786
  var Dot = createLucideIcon("Dot", [
7780
7787
  ["circle", { cx: "12.1", cy: "12.1", r: "1", key: "18d7e5" }]
7781
7788
  ]);
@@ -7832,12 +7839,19 @@ var PinInput = ({
7832
7839
  const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
7833
7840
  const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
7834
7841
  const secondGroupLength = maxLength - firstGroupLength;
7835
- 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" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(PinInputSlot, { key: index, index, className: "hawa-w-full" }))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React50.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
7842
+ 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(
7843
+ PinInputSlot,
7844
+ {
7845
+ key: index,
7846
+ index,
7847
+ className: "hawa-w-full hawa-border"
7848
+ }
7849
+ ))), 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(
7836
7850
  PinInputSlot,
7837
7851
  {
7838
7852
  key: index + firstGroupLength,
7839
7853
  index: index + firstGroupLength,
7840
- className: "hawa-w-full"
7854
+ className: "hawa-w-full hawa-border"
7841
7855
  }
7842
7856
  )))), /* @__PURE__ */ React50.createElement(HelperText, { helperText: props.helperText }));
7843
7857
  };
@@ -11787,12 +11801,10 @@ var CodeConfirmation = ({
11787
11801
  {
11788
11802
  noValidate: true,
11789
11803
  onSubmit: handleSubmit((e) => {
11790
- if (props.handleConfirm) {
11791
- return props.handleConfirm(e);
11804
+ if (props.onConfirm) {
11805
+ return props.onConfirm(e);
11792
11806
  } else {
11793
- console.log(
11794
- "Form is submitted but handleConfirm prop is missing"
11795
- );
11807
+ console.log("Form is submitted but onConfirm prop is missing");
11796
11808
  }
11797
11809
  })
11798
11810
  },
@@ -11820,12 +11832,28 @@ var CodeConfirmation = ({
11820
11832
  className: "clickable-link",
11821
11833
  onClick: () => {
11822
11834
  startResendTimer();
11823
- props.handleResend();
11835
+ props.onResend();
11824
11836
  }
11825
11837
  },
11826
11838
  ((_i = props.texts) == null ? void 0 : _i.resendCode) || "Click to resend"
11827
11839
  )),
11828
- /* @__PURE__ */ React88.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ React88.createElement(Button, { variant: "outline" }, ((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"), /* @__PURE__ */ React88.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
11840
+ /* @__PURE__ */ React88.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ React88.createElement(
11841
+ Button,
11842
+ {
11843
+ type: "button",
11844
+ onClick: () => {
11845
+ if (props.onCancel) {
11846
+ return props.onCancel();
11847
+ } else {
11848
+ console.log(
11849
+ "Cancel button clicked but onCancel prop is missing"
11850
+ );
11851
+ }
11852
+ },
11853
+ variant: "outline"
11854
+ },
11855
+ ((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"
11856
+ ), /* @__PURE__ */ React88.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
11829
11857
  )));
11830
11858
  };
11831
11859
 
@@ -12468,6 +12496,7 @@ var ContactForm = ({
12468
12496
  onSubmit,
12469
12497
  customFields,
12470
12498
  classNames,
12499
+ clearOnSubmit = true,
12471
12500
  ...props
12472
12501
  }) => {
12473
12502
  var _a, _b, _c, _d, _e;
@@ -12511,8 +12540,11 @@ var ContactForm = ({
12511
12540
  control,
12512
12541
  handleSubmit,
12513
12542
  formState: { errors },
12514
- reset
12543
+ reset,
12544
+ getValues,
12545
+ trigger
12515
12546
  } = useForm9({
12547
+ mode: "all",
12516
12548
  resolver: zodResolver8(MainSchema),
12517
12549
  defaultValues: {
12518
12550
  name: "",
@@ -12521,10 +12553,16 @@ var ContactForm = ({
12521
12553
  ...customFieldsDefaultValues
12522
12554
  }
12523
12555
  });
12524
- const handleFormSubmit = (data) => {
12556
+ const SubmitForm = async (data) => {
12557
+ const isValid = await trigger();
12558
+ if (!isValid) {
12559
+ return;
12560
+ }
12525
12561
  if (onSubmit) {
12526
12562
  onSubmit(data);
12527
- reset();
12563
+ if (clearOnSubmit) {
12564
+ reset();
12565
+ }
12528
12566
  } else {
12529
12567
  console.log("Form is submitted but onSubmit prop is missing");
12530
12568
  }
@@ -12534,7 +12572,8 @@ var ContactForm = ({
12534
12572
  {
12535
12573
  className: cn(
12536
12574
  "hawa-w-full",
12537
- cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
12575
+ cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none",
12576
+ classNames == null ? void 0 : classNames.container
12538
12577
  ),
12539
12578
  style: cardless ? { boxShadow: "none" } : void 0
12540
12579
  },
@@ -12542,7 +12581,7 @@ var ContactForm = ({
12542
12581
  "form",
12543
12582
  {
12544
12583
  noValidate: true,
12545
- onSubmit: handleSubmit(handleFormSubmit),
12584
+ onSubmit: handleSubmit(SubmitForm),
12546
12585
  className: "hawa-space-y-2",
12547
12586
  id: formId,
12548
12587
  autoComplete: formAutoComplete
@@ -12653,7 +12692,10 @@ var ContactForm = ({
12653
12692
  textareaProps: {
12654
12693
  placeholder: texts == null ? void 0 : texts.message.placeholder,
12655
12694
  className: "hawa-min-h-20",
12656
- ...field
12695
+ ...field,
12696
+ onKeyDown: getHotkeyHandler([
12697
+ ["mod+enter", () => SubmitForm(getValues())]
12698
+ ])
12657
12699
  },
12658
12700
  classNames: { textarea: "hawa-min-h-40 hawa-h-full" },
12659
12701
  helperText: (_a2 = errors.message) == null ? void 0 : _a2.message
@@ -13618,7 +13660,7 @@ export {
13618
13660
 
13619
13661
  lucide-react/dist/esm/shared/src/utils.js:
13620
13662
  (**
13621
- * @license lucide-react v0.417.0 - ISC
13663
+ * @license lucide-react v0.424.0 - ISC
13622
13664
  *
13623
13665
  * This source code is licensed under the ISC license.
13624
13666
  * See the LICENSE file in the root directory of this source tree.
@@ -13626,7 +13668,7 @@ lucide-react/dist/esm/shared/src/utils.js:
13626
13668
 
13627
13669
  lucide-react/dist/esm/defaultAttributes.js:
13628
13670
  (**
13629
- * @license lucide-react v0.417.0 - ISC
13671
+ * @license lucide-react v0.424.0 - ISC
13630
13672
  *
13631
13673
  * This source code is licensed under the ISC license.
13632
13674
  * See the LICENSE file in the root directory of this source tree.
@@ -13634,7 +13676,7 @@ lucide-react/dist/esm/defaultAttributes.js:
13634
13676
 
13635
13677
  lucide-react/dist/esm/Icon.js:
13636
13678
  (**
13637
- * @license lucide-react v0.417.0 - ISC
13679
+ * @license lucide-react v0.424.0 - ISC
13638
13680
  *
13639
13681
  * This source code is licensed under the ISC license.
13640
13682
  * See the LICENSE file in the root directory of this source tree.
@@ -13642,7 +13684,7 @@ lucide-react/dist/esm/Icon.js:
13642
13684
 
13643
13685
  lucide-react/dist/esm/createLucideIcon.js:
13644
13686
  (**
13645
- * @license lucide-react v0.417.0 - ISC
13687
+ * @license lucide-react v0.424.0 - ISC
13646
13688
  *
13647
13689
  * This source code is licensed under the ISC license.
13648
13690
  * See the LICENSE file in the root directory of this source tree.
@@ -13650,7 +13692,7 @@ lucide-react/dist/esm/createLucideIcon.js:
13650
13692
 
13651
13693
  lucide-react/dist/esm/icons/dot.js:
13652
13694
  (**
13653
- * @license lucide-react v0.417.0 - ISC
13695
+ * @license lucide-react v0.424.0 - ISC
13654
13696
  *
13655
13697
  * This source code is licensed under the ISC license.
13656
13698
  * See the LICENSE file in the root directory of this source tree.
@@ -13658,7 +13700,7 @@ lucide-react/dist/esm/icons/dot.js:
13658
13700
 
13659
13701
  lucide-react/dist/esm/lucide-react.js:
13660
13702
  (**
13661
- * @license lucide-react v0.417.0 - ISC
13703
+ * @license lucide-react v0.424.0 - ISC
13662
13704
  *
13663
13705
  * This source code is licensed under the ISC license.
13664
13706
  * See the LICENSE file in the root directory of this source tree.
@@ -1933,13 +1933,21 @@ var Select = ({
1933
1933
  children
1934
1934
  );
1935
1935
  };
1936
- const Option = ({ children, innerProps, innerRef }) => {
1936
+ const Option = ({
1937
+ children,
1938
+ innerProps,
1939
+ innerRef,
1940
+ isFocused,
1941
+ isSelected
1942
+ }) => {
1937
1943
  return /* @__PURE__ */ import_react4.default.createElement(
1938
1944
  "div",
1939
1945
  {
1940
1946
  ref: innerRef,
1941
1947
  className: cn(
1942
- "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"
1948
+ "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",
1949
+ isFocused ? "hawa-bg-accent hawa-text-bg-accent-foreground" : "hover:hawa-bg-accent hover:hawa-text-accent-foreground",
1950
+ isSelected && "hawa-bg-primary hawa-text-primary-foreground"
1943
1951
  ),
1944
1952
  ...innerProps
1945
1953
  },
@@ -1996,15 +2004,20 @@ var Select = ({
1996
2004
  container: () => cn(
1997
2005
  selectContainerStyles,
1998
2006
  props.phoneCode && phoneCodeStyles,
1999
- props.disabled ? "hawa-cursor-not-allowed" : "hawa-cursor-pointer",
2000
2007
  props.isMulti && "hawa-ps-0 "
2001
2008
  ),
2002
- placeholder: () => selectPlaceholderStyles,
2009
+ placeholder: () => cn(
2010
+ selectPlaceholderStyles,
2011
+ props.disabled && "hawa-text-muted-foreground"
2012
+ ),
2003
2013
  valueContainer: () => "hawa-text-foreground hawa-px-1 ",
2004
- singleValue: () => "hawa-text-foreground",
2014
+ singleValue: () => cn(
2015
+ props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
2016
+ ),
2005
2017
  indicatorsContainer: () => cn(
2006
2018
  selectIndicatorContainerStyles,
2007
- props.hideIndicator ? "hawa-invisible" : "hawa-px-1"
2019
+ props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
2020
+ props.disabled && "hawa-opacity-30"
2008
2021
  )
2009
2022
  },
2010
2023
  unstyled: true,
@@ -2012,12 +2025,6 @@ var Select = ({
2012
2025
  components: props.hideIndicator ? { Option, Menu, IndicatorsContainer: () => null } : {
2013
2026
  Option,
2014
2027
  Menu,
2015
- // Control: (e) => (
2016
- // <div
2017
- // className={cn(e.className, "hawa-flex hawa-flex-row")}
2018
- // {...e}
2019
- // />
2020
- // ),
2021
2028
  ValueContainer: (e) => /* @__PURE__ */ import_react4.default.createElement(
2022
2029
  "div",
2023
2030
  {