@wavelengthusaf/components 1.1.9 → 1.2.0

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 CHANGED
@@ -127,13 +127,14 @@ interface SearchProps {
127
127
  textColor?: string;
128
128
  backgroundColor?: string;
129
129
  placeholder?: string;
130
+ onEnter?: (arg0?: any) => any;
130
131
  size?: "small" | "medium";
131
132
  fontSize?: string;
132
133
  options: SearchResult[];
133
134
  onChange?: React__default.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
134
135
  onSearchItemSelected?: (selectedItem: SearchResult | string) => void;
135
136
  }
136
- declare function WavelengthSearch({ id, mode, type, width, height, label, size, borderRadius, children, placeholder, onSearchItemSelected, options, onChange, borderColor, hoverColor, textColor, fontSize, backgroundColor, }: SearchProps): React__default.JSX.Element | undefined;
137
+ declare function WavelengthSearch({ id, mode, type, width, height, label, size, borderRadius, children, placeholder, onEnter, onSearchItemSelected, options, onChange, borderColor, hoverColor, textColor, fontSize, backgroundColor, }: SearchProps): React__default.JSX.Element | undefined;
137
138
 
138
139
  declare function SearchTextField(): React__default.JSX.Element;
139
140
 
package/dist/index.d.ts CHANGED
@@ -127,13 +127,14 @@ interface SearchProps {
127
127
  textColor?: string;
128
128
  backgroundColor?: string;
129
129
  placeholder?: string;
130
+ onEnter?: (arg0?: any) => any;
130
131
  size?: "small" | "medium";
131
132
  fontSize?: string;
132
133
  options: SearchResult[];
133
134
  onChange?: React__default.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
134
135
  onSearchItemSelected?: (selectedItem: SearchResult | string) => void;
135
136
  }
136
- declare function WavelengthSearch({ id, mode, type, width, height, label, size, borderRadius, children, placeholder, onSearchItemSelected, options, onChange, borderColor, hoverColor, textColor, fontSize, backgroundColor, }: SearchProps): React__default.JSX.Element | undefined;
137
+ declare function WavelengthSearch({ id, mode, type, width, height, label, size, borderRadius, children, placeholder, onEnter, onSearchItemSelected, options, onChange, borderColor, hoverColor, textColor, fontSize, backgroundColor, }: SearchProps): React__default.JSX.Element | undefined;
137
138
 
138
139
  declare function SearchTextField(): React__default.JSX.Element;
139
140
 
package/dist/index.js CHANGED
@@ -3450,7 +3450,7 @@ var CustomPopper = (props) => {
3450
3450
  name: "preventOverflow",
3451
3451
  enabled: true,
3452
3452
  options: {
3453
- altAxis: true,
3453
+ altAxis: false,
3454
3454
  altBoundary: true,
3455
3455
  tether: true,
3456
3456
  rootBoundary: "document",
@@ -3472,6 +3472,7 @@ function WavelengthSearch({
3472
3472
  borderRadius: borderRadius2,
3473
3473
  children,
3474
3474
  placeholder,
3475
+ onEnter,
3475
3476
  onSearchItemSelected,
3476
3477
  options,
3477
3478
  onChange,
@@ -3484,9 +3485,6 @@ function WavelengthSearch({
3484
3485
  const palette2 = getPalette();
3485
3486
  borderColor2 = borderColor2 ? borderColor2 : "#2D3140";
3486
3487
  hoverColor = hoverColor ? hoverColor : palette2.primary;
3487
- const onChangeHandler = () => {
3488
- onChange;
3489
- };
3490
3488
  if (type == "search-bar" || type == void 0) {
3491
3489
  if (mode == "automatic") {
3492
3490
  return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement(
@@ -3497,7 +3495,6 @@ function WavelengthSearch({
3497
3495
  disableListWrap: true,
3498
3496
  freeSolo: true,
3499
3497
  onChange: (e, value) => {
3500
- console.log(" AutoComplete value ", value);
3501
3498
  if (value != null) {
3502
3499
  if (typeof value != "string") {
3503
3500
  if (onSearchItemSelected) onSearchItemSelected(value);
@@ -3557,6 +3554,7 @@ function WavelengthSearch({
3557
3554
  }
3558
3555
  ));
3559
3556
  } else if (mode == "manual") {
3557
+ const textRef = (0, import_react13.useRef)();
3560
3558
  return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement(
3561
3559
  import_material5.Autocomplete,
3562
3560
  {
@@ -3565,9 +3563,7 @@ function WavelengthSearch({
3565
3563
  freeSolo: true,
3566
3564
  onChange: (e, value) => {
3567
3565
  if (value != null) {
3568
- if (typeof value == "string") {
3569
- console.log("String Input, No Selection");
3570
- } else {
3566
+ if (typeof value !== "string") {
3571
3567
  if (onSearchItemSelected) onSearchItemSelected(value);
3572
3568
  }
3573
3569
  }
@@ -3586,12 +3582,13 @@ function WavelengthSearch({
3586
3582
  renderInput: (params) => /* @__PURE__ */ import_react12.default.createElement(
3587
3583
  import_TextField.default,
3588
3584
  __spreadProps(__spreadValues({
3585
+ inputRef: textRef,
3589
3586
  placeholder,
3590
3587
  onKeyDown: (e) => {
3591
3588
  if (e.key == "Enter") {
3592
- () => {
3593
- onChangeHandler;
3594
- };
3589
+ if (textRef.current && onEnter) {
3590
+ onEnter(textRef.current.value);
3591
+ }
3595
3592
  }
3596
3593
  }
3597
3594
  }, params), {
@@ -3605,7 +3602,9 @@ function WavelengthSearch({
3605
3602
  {
3606
3603
  sx: { color: textColor },
3607
3604
  onClick: () => {
3608
- onChange;
3605
+ if (textRef.current && onEnter) {
3606
+ onEnter(textRef.current.value);
3607
+ }
3609
3608
  }
3610
3609
  },
3611
3610
  children
@@ -3723,8 +3722,8 @@ function WavelengthSearch({
3723
3722
  }
3724
3723
  },
3725
3724
  disableCloseOnSelect: false,
3726
- getOptionLabel: (results) => {
3727
- const returnVal = typeof results === "string" ? results : results.title;
3725
+ getOptionLabel: (options2) => {
3726
+ const returnVal = typeof options2 === "string" ? options2 : options2.title;
3728
3727
  return returnVal;
3729
3728
  },
3730
3729
  options,
@@ -3740,7 +3739,9 @@ function WavelengthSearch({
3740
3739
  inputRef: textRef,
3741
3740
  onKeyDown: (e) => {
3742
3741
  if (e.key == "Enter") {
3743
- onChange;
3742
+ if (textRef.current && onEnter) {
3743
+ onEnter(textRef.current.value);
3744
+ }
3744
3745
  }
3745
3746
  }
3746
3747
  }, params), {