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