@wavelengthusaf/components 3.3.4 → 3.3.6

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.
@@ -37,6 +37,8 @@ interface WavelengthButtonProps extends React__default.HTMLAttributes<HTMLElemen
37
37
  href?: string;
38
38
  target?: "_self" | "_blank" | "_parent" | "_top";
39
39
  boxShadow?: string;
40
+ className?: string;
41
+ style?: React__default.CSSProperties;
40
42
  }
41
43
  declare const WavelengthButton: React__default.FC<WavelengthButtonProps>;
42
44
 
@@ -658,8 +660,9 @@ interface AutocompleteProps {
658
660
  labelColor?: string;
659
661
  FocusedlabelColor?: string;
660
662
  id?: string;
663
+ name?: string;
661
664
  }
662
- declare const WLAutoComplete: ({ floatLabel, data, height, width, inputBorderStyle, inputFocusBorderColor, onDataChange, autoBackGroundColor, labelColor, FocusedlabelColor, id, }: AutocompleteProps) => react_jsx_runtime.JSX.Element;
665
+ declare const WLAutoComplete: ({ floatLabel, data, height, width, inputBorderStyle, inputFocusBorderColor, onDataChange, autoBackGroundColor, labelColor, FocusedlabelColor, id, name, }: AutocompleteProps) => react_jsx_runtime.JSX.Element;
663
666
 
664
667
  declare const WLInputDatePicker: React.FC;
665
668
 
@@ -37,6 +37,8 @@ interface WavelengthButtonProps extends React__default.HTMLAttributes<HTMLElemen
37
37
  href?: string;
38
38
  target?: "_self" | "_blank" | "_parent" | "_top";
39
39
  boxShadow?: string;
40
+ className?: string;
41
+ style?: React__default.CSSProperties;
40
42
  }
41
43
  declare const WavelengthButton: React__default.FC<WavelengthButtonProps>;
42
44
 
@@ -658,8 +660,9 @@ interface AutocompleteProps {
658
660
  labelColor?: string;
659
661
  FocusedlabelColor?: string;
660
662
  id?: string;
663
+ name?: string;
661
664
  }
662
- declare const WLAutoComplete: ({ floatLabel, data, height, width, inputBorderStyle, inputFocusBorderColor, onDataChange, autoBackGroundColor, labelColor, FocusedlabelColor, id, }: AutocompleteProps) => react_jsx_runtime.JSX.Element;
665
+ declare const WLAutoComplete: ({ floatLabel, data, height, width, inputBorderStyle, inputFocusBorderColor, onDataChange, autoBackGroundColor, labelColor, FocusedlabelColor, id, name, }: AutocompleteProps) => react_jsx_runtime.JSX.Element;
663
666
 
664
667
  declare const WLInputDatePicker: React.FC;
665
668
 
package/dist/esm/index.js CHANGED
@@ -1421,10 +1421,12 @@ var WavelengthButton = class extends HTMLElement {
1421
1421
  shadow.appendChild(buttonTemplate.content.cloneNode(true));
1422
1422
  this.button = shadow.querySelector("button");
1423
1423
  this.button.addEventListener("click", (event) => {
1424
- this.handleRipple(event);
1425
- if (!this.getAttribute("href")) {
1426
- this.dispatchEvent(new MouseEvent("click", { bubbles: true, composed: true }));
1424
+ if (this.button.disabled || this.hasAttribute("disabled")) {
1425
+ event.preventDefault();
1426
+ event.stopImmediatePropagation();
1427
+ return;
1427
1428
  }
1429
+ this.handleRipple(event);
1428
1430
  });
1429
1431
  }
1430
1432
  static get observedAttributes() {
@@ -2412,16 +2414,22 @@ var WavelengthButton2 = ({
2412
2414
  ...rest
2413
2415
  }) => {
2414
2416
  const ref = useRef(null);
2417
+ const latestOnClick = useRef();
2418
+ useEffect(() => {
2419
+ latestOnClick.current = onClick;
2420
+ }, [onClick]);
2415
2421
  useEffect(() => {
2416
2422
  const el = ref.current;
2417
2423
  if (!el) return;
2418
2424
  const setAttr = (name, value) => {
2419
- if (value !== void 0) {
2420
- if (typeof value === "boolean") {
2421
- value ? el.setAttribute(name, "") : el.removeAttribute(name);
2422
- } else {
2423
- el.setAttribute(name, value);
2424
- }
2425
+ if (value === void 0 || value === null || value === false) {
2426
+ el.removeAttribute(name);
2427
+ return;
2428
+ }
2429
+ if (typeof value === "boolean") {
2430
+ el.setAttribute(name, "");
2431
+ } else {
2432
+ el.setAttribute(name, value);
2425
2433
  }
2426
2434
  };
2427
2435
  setAttr("variant", variant);
@@ -2439,12 +2447,22 @@ var WavelengthButton2 = ({
2439
2447
  setAttr("box-shadow", boxShadow);
2440
2448
  if (disabled) el.setAttribute("disabled", "");
2441
2449
  else el.removeAttribute("disabled");
2450
+ }, [variant, size, height2, width2, margin2, padding2, colorOne, colorTwo, fontSize, borderRadius2, disabled, href, target, boxShadow]);
2451
+ useEffect(() => {
2452
+ const el = ref.current;
2453
+ if (!el) return;
2442
2454
  const handleClick = (e) => {
2443
- onClick?.(e);
2455
+ if (el.hasAttribute("disabled")) return;
2456
+ const fn = latestOnClick.current;
2457
+ if (fn) {
2458
+ fn(e);
2459
+ }
2444
2460
  };
2445
2461
  el.addEventListener("click", handleClick);
2446
- return () => el.removeEventListener("click", handleClick);
2447
- }, [variant, size, height2, width2, margin2, padding2, colorOne, colorTwo, fontSize, borderRadius2, disabled, href, onClick, boxShadow, target]);
2462
+ return () => {
2463
+ el.removeEventListener("click", handleClick);
2464
+ };
2465
+ }, []);
2448
2466
  return /* @__PURE__ */ jsx("wavelength-button", { ref, className, style: style3, ...rest, children });
2449
2467
  };
2450
2468
 
@@ -8384,9 +8402,6 @@ var OuterContainer = styled13.div`
8384
8402
  align-items: center;
8385
8403
  justify-content: center;
8386
8404
  border-radius: 5px;
8387
- background-color: ${(props) => props.$primary || "#FFFFFF"};
8388
- height: calc(${(props) => props.$inputheight || "51px"} * 1.45);
8389
- width: calc(${(props) => props.$inputwidth || "320px"} * 1.07);
8390
8405
  `;
8391
8406
  var AutoContainer = styled13.div`
8392
8407
  position: absolute;
@@ -8402,7 +8417,6 @@ var Label = styled13.label`
8402
8417
  top: 50%;
8403
8418
  left: 10px;
8404
8419
  transform: translateY(-50%);
8405
- color: ${(props) => props.$primary || "#ccc"};
8406
8420
  font-size: 16px;
8407
8421
  pointer-events: none;
8408
8422
  transition: 0.3s ease all;
@@ -8435,7 +8449,8 @@ var Input = styled13.input`
8435
8449
  &:focus + ${Label}, &:not(:placeholder-shown) + ${Label} {
8436
8450
  top: 0;
8437
8451
  left: 10px;
8438
- padding: 0 2px;
8452
+
8453
+ padding: 0 5px;
8439
8454
  color: ${(props) => {
8440
8455
  const { $focusedLabelColor, $dropDownVisible, $suggestBoolean } = props;
8441
8456
  if (!$focusedLabelColor) return "#4a90e2";
@@ -8443,7 +8458,12 @@ var Input = styled13.input`
8443
8458
  if (!$suggestBoolean) return "#FF0000";
8444
8459
  return $focusedLabelColor;
8445
8460
  }};
8446
- background-color: ${(props) => props.$primary || "#FFFFFF"};
8461
+ transform: translate(0%, -50%) scale(0.8);
8462
+ background: linear-gradient(to bottom, transparent 50%, white 0%);
8463
+ }
8464
+
8465
+ &:not(:focus) + ${Label} {
8466
+ color: ${(props) => props.$defaultLabelColor || "#ccc"};
8447
8467
  }
8448
8468
  `;
8449
8469
  var DropDownList = styled13.ul`
@@ -8460,8 +8480,9 @@ var DropDownList = styled13.ul`
8460
8480
  max-height: 390px; //neccesary for limiting scroll options, limit to 10 per view
8461
8481
  `;
8462
8482
  var ActiveListItem = styled13.li`
8483
+ position: relative;
8484
+ z-index: 9999;
8463
8485
  padding: 10px;
8464
- cursor: pointer;
8465
8486
  border-radius: 8px;
8466
8487
  background-color: ${(props) => props.$highlighted ? "#eee" : "white"};
8467
8488
  cursor: pointer;
@@ -8475,6 +8496,8 @@ var ActiveListItem = styled13.li`
8475
8496
  }
8476
8497
  `;
8477
8498
  var NoHoverListItem = styled13.li`
8499
+ position: relative;
8500
+ z-index: 9999;
8478
8501
  padding: 10px;
8479
8502
  cursor: pointer;
8480
8503
  background-color: white;
@@ -8500,7 +8523,8 @@ var WLAutoComplete = ({
8500
8523
  autoBackGroundColor,
8501
8524
  labelColor,
8502
8525
  FocusedlabelColor,
8503
- id
8526
+ id,
8527
+ name
8504
8528
  }) => {
8505
8529
  const inputRef = useRef10(null);
8506
8530
  const listRef = useRef10(null);
@@ -8587,12 +8611,13 @@ var WLAutoComplete = ({
8587
8611
  break;
8588
8612
  }
8589
8613
  };
8590
- return /* @__PURE__ */ jsx44(Fragment17, { children: /* @__PURE__ */ jsx44("div", { id: idName, children: /* @__PURE__ */ jsx44(OuterContainer, { id: `${idName}-outercontain`, $primary: autoBackGroundColor, $inputheight: height2, $inputwidth: width2, children: /* @__PURE__ */ jsxs33(AutoContainer, { id: `${idName}-autocontain`, $primary: autoBackGroundColor, children: [
8591
- /* @__PURE__ */ jsxs33(InputWrapper, { id: `${idName}-inputwrapper`, $primary: autoBackGroundColor, $inputheight: height2, $inputwidth: width2, children: [
8614
+ return /* @__PURE__ */ jsx44(Fragment17, { children: /* @__PURE__ */ jsx44(OuterContainer, { id: `${idName}-outercontain`, $primary: autoBackGroundColor, $inputheight: height2, $inputwidth: width2, children: /* @__PURE__ */ jsxs33(AutoContainer, { id: `${idName}-autocontain`, $primary: autoBackGroundColor, children: [
8615
+ /* @__PURE__ */ jsxs33(InputWrapper, { id: `${idName}-inputwrapper`, $inputheight: height2, $inputwidth: width2, children: [
8592
8616
  /* @__PURE__ */ jsx44(
8593
8617
  Input,
8594
8618
  {
8595
- id: `${idName}-input`,
8619
+ id: idName,
8620
+ name,
8596
8621
  "data-testid": "InputSearchBar",
8597
8622
  type: "text",
8598
8623
  $primary: autoBackGroundColor,
@@ -8601,16 +8626,18 @@ var WLAutoComplete = ({
8601
8626
  $suggestBoolean: suggestHasItems,
8602
8627
  $dropDownVisible: isDropdownVisible,
8603
8628
  $focusedLabelColor: FocusedlabelColor,
8629
+ $defaultLabelColor: labelColor,
8604
8630
  value: inputValue,
8605
8631
  ref: inputRef,
8606
8632
  onClick: handleInputClick,
8607
8633
  onInput: handleChange,
8608
8634
  onKeyDown: handleKeyDown,
8609
8635
  onBlur: handleBlur,
8610
- placeholder: ""
8636
+ placeholder: "",
8637
+ autoComplete: "off"
8611
8638
  }
8612
8639
  ),
8613
- /* @__PURE__ */ jsx44(Label, { id: `${idName}-label`, $primary: labelColor, children: floatLabel })
8640
+ /* @__PURE__ */ jsx44(Label, { id: `${idName}-label`, htmlFor: idName, children: floatLabel })
8614
8641
  ] }),
8615
8642
  isDropdownVisible && /* @__PURE__ */ jsx44(DropDownList, { id: `${idName}-droplist`, ref: listRef, $inputwidth: width2, "data-testid": "InputSearchOptionsList", children: suggestHasItems ? (
8616
8643
  //suggestions length controls showing the suggestions
@@ -8628,7 +8655,7 @@ var WLAutoComplete = ({
8628
8655
  `ActivelistItem-${item}-${index}`
8629
8656
  ))
8630
8657
  ) : /* @__PURE__ */ jsx44(NoHoverListItem, { "data-testid": "NoOptionsListitem", ref: noItemListRef, id: "No-Option-List-item", onMouseDown: (e) => e.preventDefault(), children: "No Options found" }) })
8631
- ] }) }) }) });
8658
+ ] }) }) });
8632
8659
  };
8633
8660
 
8634
8661
  // src/components/inputs/WavelengthInputDatePicketer.tsx