@wavelengthusaf/components 1.1.9 → 1.2.1

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
@@ -3400,7 +3400,7 @@ var CustomPopper = (props) => {
3400
3400
  name: "preventOverflow",
3401
3401
  enabled: true,
3402
3402
  options: {
3403
- altAxis: true,
3403
+ altAxis: false,
3404
3404
  altBoundary: true,
3405
3405
  tether: true,
3406
3406
  rootBoundary: "document",
@@ -3422,6 +3422,7 @@ function WavelengthSearch({
3422
3422
  borderRadius: borderRadius2,
3423
3423
  children,
3424
3424
  placeholder,
3425
+ onEnter,
3425
3426
  onSearchItemSelected,
3426
3427
  options,
3427
3428
  onChange,
@@ -3429,16 +3430,14 @@ function WavelengthSearch({
3429
3430
  hoverColor,
3430
3431
  textColor,
3431
3432
  fontSize,
3432
- backgroundColor: backgroundColor2
3433
+ backgroundColor: backgroundColor2,
3434
+ iconPos = "end"
3433
3435
  }) {
3434
3436
  const palette2 = getPalette();
3435
3437
  borderColor2 = borderColor2 ? borderColor2 : "#2D3140";
3436
3438
  hoverColor = hoverColor ? hoverColor : palette2.primary;
3437
- const onChangeHandler = () => {
3438
- onChange;
3439
- };
3440
3439
  if (type == "search-bar" || type == void 0) {
3441
- if (mode == "automatic") {
3440
+ if (mode == "automatic" && iconPos == "end") {
3442
3441
  return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3443
3442
  Autocomplete2,
3444
3443
  {
@@ -3447,7 +3446,6 @@ function WavelengthSearch({
3447
3446
  disableListWrap: true,
3448
3447
  freeSolo: true,
3449
3448
  onChange: (e, value) => {
3450
- console.log(" AutoComplete value ", value);
3451
3449
  if (value != null) {
3452
3450
  if (typeof value != "string") {
3453
3451
  if (onSearchItemSelected) onSearchItemSelected(value);
@@ -3506,18 +3504,84 @@ function WavelengthSearch({
3506
3504
  PopperComponent: CustomPopper
3507
3505
  }
3508
3506
  ));
3509
- } else if (mode == "manual") {
3507
+ } else if (mode == "automatic" && iconPos == "start") {
3510
3508
  return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3511
3509
  Autocomplete2,
3512
3510
  {
3513
3511
  filterOptions: (x) => x,
3514
3512
  loading: true,
3513
+ disableListWrap: true,
3515
3514
  freeSolo: true,
3516
3515
  onChange: (e, value) => {
3517
3516
  if (value != null) {
3518
- if (typeof value == "string") {
3519
- console.log("String Input, No Selection");
3520
- } else {
3517
+ if (typeof value != "string") {
3518
+ if (onSearchItemSelected) onSearchItemSelected(value);
3519
+ }
3520
+ }
3521
+ },
3522
+ disableCloseOnSelect: false,
3523
+ getOptionLabel: (options2) => {
3524
+ const returnVal = typeof options2 === "string" ? options2 : options2.title;
3525
+ return returnVal;
3526
+ },
3527
+ options,
3528
+ sx: { width: width2 },
3529
+ renderOption: (props, results) => (
3530
+ // @ts-expect-error boneless chicken
3531
+ /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: results.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: results.title, secondary: results.subtitle }))
3532
+ ),
3533
+ renderInput: (params) => /* @__PURE__ */ React9.createElement(
3534
+ TextField2,
3535
+ __spreadProps(__spreadValues({
3536
+ placeholder
3537
+ }, params), {
3538
+ id,
3539
+ size,
3540
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3541
+ style: { borderRadius: borderRadius2, color: textColor, backgroundColor: backgroundColor2, height: height2, fontSize },
3542
+ type: "search",
3543
+ startAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React9.createElement(IconButton, { sx: { color: textColor, paddingRight: "0px" } }, children))
3544
+ }),
3545
+ sx: {
3546
+ "& .MuiInputBase-root": {
3547
+ height: height2
3548
+ },
3549
+ "&.MuiTextField-root": {
3550
+ "& label": { color: `${textColor}` },
3551
+ "& label.Mui-focused": {
3552
+ color: `${hoverColor}`
3553
+ },
3554
+ "& .MuiOutlinedInput-root": {
3555
+ "& fieldset": {
3556
+ borderColor: `${borderColor2}`
3557
+ },
3558
+ "&:hover fieldset": {
3559
+ borderColor: `${hoverColor}`
3560
+ },
3561
+ "&.Mui-focused fieldset": {
3562
+ borderColor: `${hoverColor}`
3563
+ }
3564
+ }
3565
+ }
3566
+ },
3567
+ label,
3568
+ onChange
3569
+ })
3570
+ ),
3571
+ PopperComponent: CustomPopper
3572
+ }
3573
+ ));
3574
+ } else if (mode == "manual" && iconPos == "end") {
3575
+ const textRef = useRef();
3576
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3577
+ Autocomplete2,
3578
+ {
3579
+ filterOptions: (x) => x,
3580
+ loading: true,
3581
+ freeSolo: true,
3582
+ onChange: (e, value) => {
3583
+ if (value != null) {
3584
+ if (typeof value !== "string") {
3521
3585
  if (onSearchItemSelected) onSearchItemSelected(value);
3522
3586
  }
3523
3587
  }
@@ -3536,12 +3600,13 @@ function WavelengthSearch({
3536
3600
  renderInput: (params) => /* @__PURE__ */ React9.createElement(
3537
3601
  TextField2,
3538
3602
  __spreadProps(__spreadValues({
3603
+ inputRef: textRef,
3539
3604
  placeholder,
3540
3605
  onKeyDown: (e) => {
3541
3606
  if (e.key == "Enter") {
3542
- () => {
3543
- onChangeHandler;
3544
- };
3607
+ if (textRef.current && onEnter) {
3608
+ onEnter(textRef.current.value);
3609
+ }
3545
3610
  }
3546
3611
  }
3547
3612
  }, params), {
@@ -3555,7 +3620,93 @@ function WavelengthSearch({
3555
3620
  {
3556
3621
  sx: { color: textColor },
3557
3622
  onClick: () => {
3558
- onChange;
3623
+ if (textRef.current && onEnter) {
3624
+ onEnter(textRef.current.value);
3625
+ }
3626
+ }
3627
+ },
3628
+ children
3629
+ ))
3630
+ }),
3631
+ sx: {
3632
+ "& .MuiInputBase-root": {
3633
+ height: height2
3634
+ },
3635
+ "&.MuiTextField-root": {
3636
+ "& label": { color: `${textColor}`, verticalAlign: "bottom" },
3637
+ "& label.Mui-focused": {
3638
+ color: `${hoverColor}`
3639
+ },
3640
+ "& .MuiOutlinedInput-root": {
3641
+ "& fieldset": {
3642
+ borderColor: `${borderColor2}`
3643
+ },
3644
+ "&:hover fieldset": {
3645
+ borderColor: `${hoverColor}`
3646
+ },
3647
+ "&.Mui-focused fieldset": {
3648
+ borderColor: `${hoverColor}`
3649
+ }
3650
+ }
3651
+ }
3652
+ },
3653
+ label
3654
+ })
3655
+ )
3656
+ }
3657
+ ));
3658
+ } else if (mode == "manual" && iconPos == "start") {
3659
+ const textRef = useRef();
3660
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3661
+ Autocomplete2,
3662
+ {
3663
+ filterOptions: (x) => x,
3664
+ loading: true,
3665
+ freeSolo: true,
3666
+ onChange: (e, value) => {
3667
+ if (value != null) {
3668
+ if (typeof value !== "string") {
3669
+ if (onSearchItemSelected) onSearchItemSelected(value);
3670
+ }
3671
+ }
3672
+ },
3673
+ disableCloseOnSelect: false,
3674
+ getOptionLabel: (options2) => {
3675
+ const returnVal = typeof options2 === "string" ? options2 : options2.title;
3676
+ return returnVal;
3677
+ },
3678
+ options,
3679
+ sx: { width: width2 },
3680
+ renderOption: (props, options2) => (
3681
+ // @ts-expect-error boneless chicken
3682
+ /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: options2.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: options2.title, secondary: options2.subtitle }))
3683
+ ),
3684
+ renderInput: (params) => /* @__PURE__ */ React9.createElement(
3685
+ TextField2,
3686
+ __spreadProps(__spreadValues({
3687
+ inputRef: textRef,
3688
+ placeholder,
3689
+ onKeyDown: (e) => {
3690
+ if (e.key == "Enter") {
3691
+ if (textRef.current && onEnter) {
3692
+ onEnter(textRef.current.value);
3693
+ }
3694
+ }
3695
+ }
3696
+ }, params), {
3697
+ id,
3698
+ size,
3699
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3700
+ style: { borderRadius: borderRadius2, color: textColor, fontSize },
3701
+ type: "search",
3702
+ startAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React9.createElement(
3703
+ IconButton,
3704
+ {
3705
+ sx: { color: textColor, paddingRight: "0px" },
3706
+ onClick: () => {
3707
+ if (textRef.current && onEnter) {
3708
+ onEnter(textRef.current.value);
3709
+ }
3559
3710
  }
3560
3711
  },
3561
3712
  children
@@ -3673,8 +3824,8 @@ function WavelengthSearch({
3673
3824
  }
3674
3825
  },
3675
3826
  disableCloseOnSelect: false,
3676
- getOptionLabel: (results) => {
3677
- const returnVal = typeof results === "string" ? results : results.title;
3827
+ getOptionLabel: (options2) => {
3828
+ const returnVal = typeof options2 === "string" ? options2 : options2.title;
3678
3829
  return returnVal;
3679
3830
  },
3680
3831
  options,
@@ -3690,7 +3841,9 @@ function WavelengthSearch({
3690
3841
  inputRef: textRef,
3691
3842
  onKeyDown: (e) => {
3692
3843
  if (e.key == "Enter") {
3693
- onChange;
3844
+ if (textRef.current && onEnter) {
3845
+ onEnter(textRef.current.value);
3846
+ }
3694
3847
  }
3695
3848
  }
3696
3849
  }, params), {
@@ -4842,8 +4995,9 @@ import Snackbar2 from "@mui/material/Snackbar";
4842
4995
  import IconButton5 from "@mui/material/IconButton";
4843
4996
  import CloseIcon3 from "@mui/icons-material/Close";
4844
4997
  import SnackbarContent2 from "@mui/material/SnackbarContent";
4845
- function WavelengthStandardSnackbar(props) {
4846
- const { show, setShow } = props;
4998
+ var WavelengthStandardSnackbar = (props) => {
4999
+ let show = props.show;
5000
+ const setShow = props.setShow;
4847
5001
  const handleClose = () => {
4848
5002
  setShow(false);
4849
5003
  };
@@ -4893,7 +5047,7 @@ function WavelengthStandardSnackbar(props) {
4893
5047
  }
4894
5048
  )
4895
5049
  );
4896
- }
5050
+ };
4897
5051
  export {
4898
5052
  AceOfSpadesComponent,
4899
5053
  AppLogo,