@wavelengthusaf/components 1.1.7 → 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,188 +3367,367 @@ 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";
3371
- import { Autocomplete as Autocomplete2, ListItemText } from "@mui/material";
3370
+ import React9 from "react";
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";
3374
3374
  import IconButton from "@mui/material/IconButton";
3375
3375
  import { useRef } from "react";
3376
3376
  import ListItem from "@mui/material/ListItem";
3377
+ var CustomPopper = (props) => {
3378
+ return /* @__PURE__ */ React9.createElement(
3379
+ Popper,
3380
+ __spreadProps(__spreadValues({
3381
+ sx: {
3382
+ "&.MuiAutocomplete-popper": {
3383
+ zIndex: 5
3384
+ }
3385
+ }
3386
+ }, props), {
3387
+ placement: "bottom",
3388
+ disablePortal: true,
3389
+ modifiers: [
3390
+ {
3391
+ name: "flip",
3392
+ enabled: true,
3393
+ options: {
3394
+ altBoundary: true,
3395
+ rootBoundary: "document",
3396
+ padding: 8
3397
+ }
3398
+ },
3399
+ {
3400
+ name: "preventOverflow",
3401
+ enabled: true,
3402
+ options: {
3403
+ altAxis: true,
3404
+ altBoundary: true,
3405
+ tether: true,
3406
+ rootBoundary: "document",
3407
+ padding: 8
3408
+ }
3409
+ }
3410
+ ]
3411
+ })
3412
+ );
3413
+ };
3377
3414
  function WavelengthSearch({
3378
3415
  id,
3379
3416
  mode,
3417
+ type,
3380
3418
  width: width2,
3381
3419
  height: height2,
3382
3420
  label,
3421
+ size,
3383
3422
  borderRadius: borderRadius2,
3384
3423
  children,
3385
3424
  placeholder,
3386
- searchFunction,
3387
3425
  onSearchItemSelected,
3388
3426
  options,
3389
3427
  onChange,
3390
3428
  borderColor: borderColor2,
3391
3429
  hoverColor,
3392
3430
  textColor,
3431
+ fontSize,
3393
3432
  backgroundColor: backgroundColor2
3394
3433
  }) {
3395
3434
  const palette2 = getPalette();
3396
- const template = [];
3397
3435
  borderColor2 = borderColor2 ? borderColor2 : "#2D3140";
3398
3436
  hoverColor = hoverColor ? hoverColor : palette2.primary;
3399
- const [results, setResults] = useState2(template);
3400
- if (mode == "automatic") {
3401
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3402
- Autocomplete2,
3403
- {
3404
- filterOptions: (x) => x,
3405
- loading: true,
3406
- disableListWrap: true,
3407
- freeSolo: true,
3408
- onChange: (e, value) => {
3409
- console.log(" AutoComplete value ", value);
3410
- if (value != null) {
3411
- if (typeof value == "string") {
3412
- console.log("String Input, No Selection");
3413
- } else {
3414
- 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
+ }
3415
3455
  }
3416
- }
3417
- },
3418
- disableCloseOnSelect: false,
3419
- getOptionLabel: (options2) => {
3420
- const returnVal = typeof options2 === "string" ? options2 : options2.title;
3421
- return returnVal;
3422
- },
3423
- options,
3424
- sx: { width: width2 },
3425
- renderOption: (props, results2) => (
3426
- // @ts-expect-error boneless chicken
3427
- /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: results2.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: results2.title, secondary: results2.subtitle }))
3428
- ),
3429
- renderInput: (params) => /* @__PURE__ */ React9.createElement(
3430
- TextField2,
3431
- __spreadProps(__spreadValues({
3432
- placeholder
3433
- }, params), {
3434
- id,
3435
- InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3436
- style: { borderRadius: borderRadius2, height: height2, color: textColor, backgroundColor: backgroundColor2 },
3437
- type: "search",
3438
- endAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(IconButton, { sx: { color: textColor } }, children))
3439
- }),
3440
- sx: {
3441
- "&.MuiTextField-root": {
3442
- "& label": { color: `${textColor}` },
3443
- "& label.Mui-focused": {
3444
- 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
3445
3483
  },
3446
- "& .MuiOutlinedInput-root": {
3447
- "& fieldset": {
3448
- borderColor: `${borderColor2}`
3484
+ "&.MuiTextField-root": {
3485
+ "& label": { color: `${textColor}` },
3486
+ "& label.Mui-focused": {
3487
+ color: `${hoverColor}`
3449
3488
  },
3450
- "&:hover fieldset": {
3451
- borderColor: `${hoverColor}`
3452
- },
3453
- "&.Mui-focused fieldset": {
3454
- 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
+ }
3455
3499
  }
3456
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);
3457
3522
  }
3458
- },
3459
- label,
3460
- onChange
3461
- })
3462
- )
3463
- }
3464
- ));
3465
- } else if (mode == "manual") {
3466
- const textRef = useRef();
3467
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3468
- Autocomplete2,
3469
- {
3470
- filterOptions: (x) => x,
3471
- loading: true,
3472
- freeSolo: true,
3473
- onChange: (e, value) => {
3474
- if (value != null) {
3475
- if (typeof value == "string") {
3476
- console.log("String Input, No Selection");
3477
- } else {
3478
- onSearchItemSelected(value);
3479
3523
  }
3480
- }
3481
- },
3482
- disableCloseOnSelect: false,
3483
- getOptionLabel: (results2) => {
3484
- const returnVal = typeof results2 === "string" ? results2 : results2.title;
3485
- return returnVal;
3486
- },
3487
- options: results,
3488
- sx: { width: width2 },
3489
- renderOption: (props, results2) => (
3490
- // @ts-expect-error boneless chicken
3491
- /* @__PURE__ */ React9.createElement(ListItem, __spreadValues({ key: results2.id }, props), /* @__PURE__ */ React9.createElement(ListItemText, { primary: results2.title, secondary: results2.subtitle }))
3492
- ),
3493
- renderInput: (params) => /* @__PURE__ */ React9.createElement(
3494
- TextField2,
3495
- __spreadProps(__spreadValues({
3496
- placeholder,
3497
- inputRef: textRef,
3498
- onKeyDown: (e) => {
3499
- var _a;
3500
- if (e.key == "Enter") {
3501
- if (textRef.current) {
3502
- const tempResults = searchFunction((_a = textRef.current) == null ? void 0 : _a.value);
3503
- setResults(tempResults);
3504
- 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
+ };
3505
3545
  }
3506
3546
  }
3507
- }
3508
- }, params), {
3509
- id,
3510
- InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3511
- style: { borderRadius: borderRadius2, height: height2, color: textColor },
3512
- type: "search",
3513
- endAdornment: /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(
3514
- IconButton,
3515
- {
3516
- sx: { color: textColor },
3517
- onClick: () => {
3518
- var _a;
3519
- if (textRef.current) {
3520
- const tempResults = searchFunction((_a = textRef.current) == null ? void 0 : _a.value);
3521
- 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;
3522
3559
  }
3523
- }
3524
- },
3525
- children
3526
- ))
3527
- }),
3528
- sx: {
3529
- "&.MuiTextField-root": {
3530
- "& label": { color: `${textColor}` },
3531
- "& label.Mui-focused": {
3532
- color: `${hoverColor}`
3560
+ },
3561
+ children
3562
+ ))
3563
+ }),
3564
+ sx: {
3565
+ "& .MuiInputBase-root": {
3566
+ height: height2
3533
3567
  },
3534
- "& .MuiOutlinedInput-root": {
3535
- "& fieldset": {
3536
- borderColor: `${borderColor2}`
3568
+ "&.MuiTextField-root": {
3569
+ "& label": { color: `${textColor}`, verticalAlign: "bottom" },
3570
+ "& label.Mui-focused": {
3571
+ color: `${hoverColor}`
3537
3572
  },
3538
- "&:hover fieldset": {
3539
- 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}`
3540
3639
  },
3541
- "&.Mui-focused fieldset": {
3542
- 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
+ }
3543
3650
  }
3544
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);
3545
3672
  }
3546
- },
3547
- label
3548
- })
3549
- )
3550
- }
3551
- ));
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
+ }
3552
3731
  }
3553
3732
  return void 0;
3554
3733
  }
@@ -3581,12 +3760,12 @@ function SearchTextField() {
3581
3760
  }
3582
3761
 
3583
3762
  // src/components/PageComponents/WavelengthSideBar.tsx
3584
- import React11, { useState as useState3 } from "react";
3763
+ import React11, { useState as useState2 } from "react";
3585
3764
  import { Box, List, ListItem as ListItem2, Typography, Collapse } from "@mui/material";
3586
3765
  import { KeyboardArrowDownRounded, KeyboardArrowRightRounded } from "@mui/icons-material";
3587
3766
  import { useNavigate } from "react-router-dom";
3588
3767
  function WavelengthSideBar({ sections, txtColor, bgColor, labelColor, arrowColor, marginTop, marginLeft, width: width2 = "fit-content", height: height2 = 300 }) {
3589
- const [openSections, setOpenSections] = useState3({});
3768
+ const [openSections, setOpenSections] = useState2({});
3590
3769
  const navigate = useNavigate();
3591
3770
  const palette2 = getPalette();
3592
3771
  function handleToggle(sectionTitle) {