@wavelengthusaf/components 1.1.8 → 1.1.9

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
@@ -3367,7 +3367,7 @@ function WavelengthExampleComponent({ width: width2 = 100, height: height2 = 100
3367
3367
  }
3368
3368
 
3369
3369
  // src/components/search/WavelengthSearch.tsx
3370
- import React9, { useState as useState2 } from "react";
3370
+ import React9 from "react";
3371
3371
  import { Autocomplete as Autocomplete2, ListItemText, Popper } from "@mui/material";
3372
3372
  import TextField2 from "@mui/material/TextField";
3373
3373
  import InputAdornment from "@mui/material/InputAdornment";
@@ -3414,6 +3414,7 @@ var CustomPopper = (props) => {
3414
3414
  function WavelengthSearch({
3415
3415
  id,
3416
3416
  mode,
3417
+ type,
3417
3418
  width: width2,
3418
3419
  height: height2,
3419
3420
  label,
@@ -3421,7 +3422,6 @@ function WavelengthSearch({
3421
3422
  borderRadius: borderRadius2,
3422
3423
  children,
3423
3424
  placeholder,
3424
- searchFunction,
3425
3425
  onSearchItemSelected,
3426
3426
  options,
3427
3427
  onChange,
@@ -3432,165 +3432,302 @@ function WavelengthSearch({
3432
3432
  backgroundColor: backgroundColor2
3433
3433
  }) {
3434
3434
  const palette2 = getPalette();
3435
- const template = [];
3436
3435
  borderColor2 = borderColor2 ? borderColor2 : "#2D3140";
3437
3436
  hoverColor = hoverColor ? hoverColor : palette2.primary;
3438
- const [results, setResults] = useState2(template);
3439
- if (mode == "automatic") {
3440
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3441
- Autocomplete2,
3442
- {
3443
- filterOptions: (x) => x,
3444
- loading: true,
3445
- disableListWrap: true,
3446
- freeSolo: true,
3447
- onChange: (e, value) => {
3448
- console.log(" AutoComplete value ", value);
3449
- if (value != null) {
3450
- if (typeof value == "string") {
3451
- console.log("String Input, No Selection");
3452
- } else {
3453
- onSearchItemSelected(value);
3437
+ const onChangeHandler = () => {
3438
+ onChange;
3439
+ };
3440
+ if (type == "search-bar" || type == void 0) {
3441
+ if (mode == "automatic") {
3442
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3443
+ Autocomplete2,
3444
+ {
3445
+ filterOptions: (x) => x,
3446
+ loading: true,
3447
+ disableListWrap: true,
3448
+ freeSolo: true,
3449
+ onChange: (e, value) => {
3450
+ console.log(" AutoComplete value ", value);
3451
+ if (value != null) {
3452
+ if (typeof value != "string") {
3453
+ if (onSearchItemSelected) onSearchItemSelected(value);
3454
+ }
3454
3455
  }
3455
- }
3456
- },
3457
- disableCloseOnSelect: false,
3458
- getOptionLabel: (options2) => {
3459
- const returnVal = typeof options2 === "string" ? options2 : options2.title;
3460
- return returnVal;
3461
- },
3462
- options,
3463
- sx: { width: width2 },
3464
- renderOption: (props, results2) => (
3465
- // @ts-expect-error boneless chicken
3466
- /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: results2.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: results2.title, secondary: results2.subtitle }))
3467
- ),
3468
- renderInput: (params) => /* @__PURE__ */ React9.createElement(
3469
- TextField2,
3470
- __spreadProps(__spreadValues({
3471
- placeholder
3472
- }, params), {
3473
- id,
3474
- size,
3475
- InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3476
- style: { borderRadius: borderRadius2, color: textColor, backgroundColor: backgroundColor2, height: height2, fontSize },
3477
- type: "search",
3478
- endAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(IconButton, { sx: { color: textColor } }, children))
3479
- }),
3480
- sx: {
3481
- "&.MuiTextField-root": {
3482
- "& label": { color: `${textColor}` },
3483
- "& label.Mui-focused": {
3484
- color: `${hoverColor}`
3456
+ },
3457
+ disableCloseOnSelect: false,
3458
+ getOptionLabel: (options2) => {
3459
+ const returnVal = typeof options2 === "string" ? options2 : options2.title;
3460
+ return returnVal;
3461
+ },
3462
+ options,
3463
+ sx: { width: width2 },
3464
+ renderOption: (props, results) => (
3465
+ // @ts-expect-error boneless chicken
3466
+ /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: results.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: results.title, secondary: results.subtitle }))
3467
+ ),
3468
+ renderInput: (params) => /* @__PURE__ */ React9.createElement(
3469
+ TextField2,
3470
+ __spreadProps(__spreadValues({
3471
+ placeholder
3472
+ }, params), {
3473
+ id,
3474
+ size,
3475
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3476
+ style: { borderRadius: borderRadius2, color: textColor, backgroundColor: backgroundColor2, height: height2, fontSize },
3477
+ type: "search",
3478
+ endAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(IconButton, { sx: { color: textColor } }, children))
3479
+ }),
3480
+ sx: {
3481
+ "& .MuiInputBase-root": {
3482
+ height: height2
3485
3483
  },
3486
- "& .MuiOutlinedInput-root": {
3487
- "& fieldset": {
3488
- borderColor: `${borderColor2}`
3484
+ "&.MuiTextField-root": {
3485
+ "& label": { color: `${textColor}` },
3486
+ "& label.Mui-focused": {
3487
+ color: `${hoverColor}`
3489
3488
  },
3490
- "&:hover fieldset": {
3491
- borderColor: `${hoverColor}`
3492
- },
3493
- "&.Mui-focused fieldset": {
3494
- borderColor: `${hoverColor}`
3489
+ "& .MuiOutlinedInput-root": {
3490
+ "& fieldset": {
3491
+ borderColor: `${borderColor2}`
3492
+ },
3493
+ "&:hover fieldset": {
3494
+ borderColor: `${hoverColor}`
3495
+ },
3496
+ "&.Mui-focused fieldset": {
3497
+ borderColor: `${hoverColor}`
3498
+ }
3495
3499
  }
3496
3500
  }
3501
+ },
3502
+ label,
3503
+ onChange
3504
+ })
3505
+ ),
3506
+ PopperComponent: CustomPopper
3507
+ }
3508
+ ));
3509
+ } else if (mode == "manual") {
3510
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3511
+ Autocomplete2,
3512
+ {
3513
+ filterOptions: (x) => x,
3514
+ loading: true,
3515
+ freeSolo: true,
3516
+ onChange: (e, value) => {
3517
+ if (value != null) {
3518
+ if (typeof value == "string") {
3519
+ console.log("String Input, No Selection");
3520
+ } else {
3521
+ if (onSearchItemSelected) onSearchItemSelected(value);
3497
3522
  }
3498
- },
3499
- label,
3500
- onChange
3501
- })
3502
- ),
3503
- PopperComponent: CustomPopper
3504
- }
3505
- ));
3506
- } else if (mode == "manual") {
3507
- const textRef = useRef();
3508
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3509
- Autocomplete2,
3510
- {
3511
- filterOptions: (x) => x,
3512
- loading: true,
3513
- freeSolo: true,
3514
- onChange: (e, value) => {
3515
- if (value != null) {
3516
- if (typeof value == "string") {
3517
- console.log("String Input, No Selection");
3518
- } else {
3519
- onSearchItemSelected(value);
3520
3523
  }
3521
- }
3522
- },
3523
- disableCloseOnSelect: false,
3524
- getOptionLabel: (results2) => {
3525
- const returnVal = typeof results2 === "string" ? results2 : results2.title;
3526
- return returnVal;
3527
- },
3528
- options: results,
3529
- sx: { width: width2 },
3530
- renderOption: (props, results2) => (
3531
- // @ts-expect-error boneless chicken
3532
- /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: results2.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: results2.title, secondary: results2.subtitle }))
3533
- ),
3534
- renderInput: (params) => /* @__PURE__ */ React9.createElement(
3535
- TextField2,
3536
- __spreadProps(__spreadValues({
3537
- placeholder,
3538
- inputRef: textRef,
3539
- onKeyDown: (e) => {
3540
- var _a;
3541
- if (e.key == "Enter") {
3542
- if (textRef.current) {
3543
- const tempResults = searchFunction((_a = textRef.current) == null ? void 0 : _a.value);
3544
- setResults(tempResults);
3545
- console.log(results);
3524
+ },
3525
+ disableCloseOnSelect: false,
3526
+ getOptionLabel: (options2) => {
3527
+ const returnVal = typeof options2 === "string" ? options2 : options2.title;
3528
+ return returnVal;
3529
+ },
3530
+ options,
3531
+ sx: { width: width2 },
3532
+ renderOption: (props, options2) => (
3533
+ // @ts-expect-error boneless chicken
3534
+ /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: options2.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: options2.title, secondary: options2.subtitle }))
3535
+ ),
3536
+ renderInput: (params) => /* @__PURE__ */ React9.createElement(
3537
+ TextField2,
3538
+ __spreadProps(__spreadValues({
3539
+ placeholder,
3540
+ onKeyDown: (e) => {
3541
+ if (e.key == "Enter") {
3542
+ () => {
3543
+ onChangeHandler;
3544
+ };
3546
3545
  }
3547
3546
  }
3548
- }
3549
- }, params), {
3550
- id,
3551
- size,
3552
- InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3553
- style: { borderRadius: borderRadius2, height: height2, color: textColor, fontSize },
3554
- type: "search",
3555
- endAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(
3556
- IconButton,
3557
- {
3558
- sx: { color: textColor },
3559
- onClick: () => {
3560
- var _a;
3561
- if (textRef.current) {
3562
- const tempResults = searchFunction((_a = textRef.current) == null ? void 0 : _a.value);
3563
- setResults(tempResults);
3547
+ }, params), {
3548
+ id,
3549
+ size,
3550
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3551
+ style: { borderRadius: borderRadius2, color: textColor, fontSize },
3552
+ type: "search",
3553
+ endAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(
3554
+ IconButton,
3555
+ {
3556
+ sx: { color: textColor },
3557
+ onClick: () => {
3558
+ onChange;
3564
3559
  }
3565
- }
3566
- },
3567
- children
3568
- ))
3569
- }),
3570
- sx: {
3571
- "&.MuiTextField-root": {
3572
- "& label": { color: `${textColor}` },
3573
- "& label.Mui-focused": {
3574
- color: `${hoverColor}`
3560
+ },
3561
+ children
3562
+ ))
3563
+ }),
3564
+ sx: {
3565
+ "& .MuiInputBase-root": {
3566
+ height: height2
3575
3567
  },
3576
- "& .MuiOutlinedInput-root": {
3577
- "& fieldset": {
3578
- borderColor: `${borderColor2}`
3568
+ "&.MuiTextField-root": {
3569
+ "& label": { color: `${textColor}`, verticalAlign: "bottom" },
3570
+ "& label.Mui-focused": {
3571
+ color: `${hoverColor}`
3579
3572
  },
3580
- "&:hover fieldset": {
3581
- borderColor: `${hoverColor}`
3573
+ "& .MuiOutlinedInput-root": {
3574
+ "& fieldset": {
3575
+ borderColor: `${borderColor2}`
3576
+ },
3577
+ "&:hover fieldset": {
3578
+ borderColor: `${hoverColor}`
3579
+ },
3580
+ "&.Mui-focused fieldset": {
3581
+ borderColor: `${hoverColor}`
3582
+ }
3583
+ }
3584
+ }
3585
+ },
3586
+ label
3587
+ })
3588
+ )
3589
+ }
3590
+ ));
3591
+ }
3592
+ } else if (type == "text-box") {
3593
+ if (mode == "automatic") {
3594
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3595
+ Autocomplete2,
3596
+ {
3597
+ filterOptions: (x) => x,
3598
+ loading: true,
3599
+ disableListWrap: true,
3600
+ freeSolo: true,
3601
+ disableClearable: true,
3602
+ onChange: (e, value) => {
3603
+ if (value != null) {
3604
+ if (typeof value != "string") {
3605
+ if (onSearchItemSelected) onSearchItemSelected(value);
3606
+ }
3607
+ }
3608
+ },
3609
+ disableCloseOnSelect: false,
3610
+ getOptionLabel: (options2) => {
3611
+ const returnVal = typeof options2 === "string" ? options2 : options2.title;
3612
+ return returnVal;
3613
+ },
3614
+ options,
3615
+ sx: { width: width2 },
3616
+ renderOption: (props, results) => (
3617
+ // @ts-expect-error boneless chicken
3618
+ /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: results.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: results.title, secondary: results.subtitle }))
3619
+ ),
3620
+ renderInput: (params) => /* @__PURE__ */ React9.createElement(
3621
+ TextField2,
3622
+ __spreadProps(__spreadValues({
3623
+ placeholder
3624
+ }, params), {
3625
+ id,
3626
+ size,
3627
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3628
+ style: { borderRadius: borderRadius2, color: textColor, backgroundColor: backgroundColor2, height: height2, fontSize },
3629
+ type: "search"
3630
+ }),
3631
+ sx: {
3632
+ "& .MuiInputBase-root": {
3633
+ height: height2
3634
+ },
3635
+ "&.MuiTextField-root": {
3636
+ "& label": { color: `${textColor}` },
3637
+ "& label.Mui-focused": {
3638
+ color: `${hoverColor}`
3582
3639
  },
3583
- "&.Mui-focused fieldset": {
3584
- borderColor: `${hoverColor}`
3640
+ "& .MuiOutlinedInput-root": {
3641
+ "& fieldset": {
3642
+ borderColor: `${borderColor2}`
3643
+ },
3644
+ "&:hover fieldset": {
3645
+ borderColor: `${hoverColor}`
3646
+ },
3647
+ "&.Mui-focused fieldset": {
3648
+ borderColor: `${hoverColor}`
3649
+ }
3585
3650
  }
3586
3651
  }
3652
+ },
3653
+ label,
3654
+ onChange
3655
+ })
3656
+ ),
3657
+ PopperComponent: CustomPopper
3658
+ }
3659
+ ));
3660
+ } else if (mode == "manual") {
3661
+ const textRef = useRef();
3662
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3663
+ Autocomplete2,
3664
+ {
3665
+ filterOptions: (x) => x,
3666
+ loading: true,
3667
+ freeSolo: true,
3668
+ onChange: (e, value) => {
3669
+ if (value != null) {
3670
+ if (typeof value != "string") {
3671
+ if (onSearchItemSelected) onSearchItemSelected(value);
3587
3672
  }
3588
- },
3589
- label
3590
- })
3591
- )
3592
- }
3593
- ));
3673
+ }
3674
+ },
3675
+ disableCloseOnSelect: false,
3676
+ getOptionLabel: (results) => {
3677
+ const returnVal = typeof results === "string" ? results : results.title;
3678
+ return returnVal;
3679
+ },
3680
+ options,
3681
+ sx: { width: width2 },
3682
+ renderOption: (props, options2) => (
3683
+ // @ts-expect-error boneless chicken
3684
+ /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: options2.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: options2.title, secondary: options2.subtitle }))
3685
+ ),
3686
+ renderInput: (params) => /* @__PURE__ */ React9.createElement(
3687
+ TextField2,
3688
+ __spreadProps(__spreadValues({
3689
+ placeholder,
3690
+ inputRef: textRef,
3691
+ onKeyDown: (e) => {
3692
+ if (e.key == "Enter") {
3693
+ onChange;
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
+ }),
3703
+ sx: {
3704
+ "& .MuiInputBase-root": {
3705
+ height: height2
3706
+ },
3707
+ "&.MuiTextField-root": {
3708
+ "& label": { color: `${textColor}`, verticalAlign: "bottom" },
3709
+ "& label.Mui-focused": {
3710
+ color: `${hoverColor}`
3711
+ },
3712
+ "& .MuiOutlinedInput-root": {
3713
+ "& fieldset": {
3714
+ borderColor: `${borderColor2}`
3715
+ },
3716
+ "&:hover fieldset": {
3717
+ borderColor: `${hoverColor}`
3718
+ },
3719
+ "&.Mui-focused fieldset": {
3720
+ borderColor: `${hoverColor}`
3721
+ }
3722
+ }
3723
+ }
3724
+ },
3725
+ label
3726
+ })
3727
+ )
3728
+ }
3729
+ ));
3730
+ }
3594
3731
  }
3595
3732
  return void 0;
3596
3733
  }
@@ -3623,12 +3760,12 @@ function SearchTextField() {
3623
3760
  }
3624
3761
 
3625
3762
  // src/components/PageComponents/WavelengthSideBar.tsx
3626
- import React11, { useState as useState3 } from "react";
3763
+ import React11, { useState as useState2 } from "react";
3627
3764
  import { Box, List, ListItem as ListItem2, Typography, Collapse } from "@mui/material";
3628
3765
  import { KeyboardArrowDownRounded, KeyboardArrowRightRounded } from "@mui/icons-material";
3629
3766
  import { useNavigate } from "react-router-dom";
3630
3767
  function WavelengthSideBar({ sections, txtColor, bgColor, labelColor, arrowColor, marginTop, marginLeft, width: width2 = "fit-content", height: height2 = 300 }) {
3631
- const [openSections, setOpenSections] = useState3({});
3768
+ const [openSections, setOpenSections] = useState2({});
3632
3769
  const navigate = useNavigate();
3633
3770
  const palette2 = getPalette();
3634
3771
  function handleToggle(sectionTitle) {