@wavelengthusaf/components 2.7.2 → 2.8.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.
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ReactNode } from 'react';
2
+ import React__default, { ReactNode, ReactElement } from 'react';
3
3
  import { SxProps, Theme } from '@mui/material/styles';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { TextFieldVariants, SxProps as SxProps$1, Theme as Theme$1 } from '@mui/material';
@@ -270,13 +270,14 @@ interface WavelengthTitleBarProps {
270
270
  declare function WavelengthTitleBar({ titleText, subtitleText, textColor, textShadow }: WavelengthTitleBarProps): react_jsx_runtime.JSX.Element;
271
271
 
272
272
  interface WavelengthBannerProps {
273
- classification?: "unclassified" | "controlled" | "controlled unclassified information" | "cui" | "u" | "confidential" | "c" | "secret" | "s" | "top secret" | "ts" | string;
274
- control?: ("cui" | "sci" | "fouo" | "nf" | "propin" | "frd" | "gbr s" | "si" | "si-g" | "tk" | "relido" | "rd" | "rd-n" | "rel" | "fvey" | "hcs" | string)[];
273
+ headerText?: string;
275
274
  headerColor?: string;
276
275
  textColor?: string;
276
+ opacity?: string | number;
277
+ zIndex?: string | number;
277
278
  id?: string;
278
279
  }
279
- declare function WavelengthBanner({ classification, control, headerColor, textColor, id }: WavelengthBannerProps): react_jsx_runtime.JSX.Element;
280
+ declare function WavelengthBanner({ headerText, headerColor, textColor, opacity, zIndex, id }: WavelengthBannerProps): react_jsx_runtime.JSX.Element;
280
281
 
281
282
  interface AppLogoProps {
282
283
  width?: number;
@@ -506,4 +507,23 @@ interface TextFieldProps {
506
507
  }
507
508
  declare function WavelengthTextField(props: TextFieldProps): react_jsx_runtime.JSX.Element | null;
508
509
 
509
- export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
510
+ interface DataType {
511
+ id: number;
512
+ [key: string]: any;
513
+ }
514
+ interface ColumnProps<T> {
515
+ key: string;
516
+ title: string | ReactElement;
517
+ width?: string;
518
+ editable?: boolean;
519
+ render?: (column: ColumnProps<T>, item: T) => ReactElement;
520
+ }
521
+ type Props<T> = {
522
+ columns: Array<ColumnProps<T>>;
523
+ data?: T[] | undefined;
524
+ itemsPerPage: number;
525
+ totalPages: number;
526
+ };
527
+ declare const WavelengthDataTable: <T extends DataType>({ data, columns, itemsPerPage, totalPages }: Props<T>) => react_jsx_runtime.JSX.Element;
528
+
529
+ export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ReactNode } from 'react';
2
+ import React__default, { ReactNode, ReactElement } from 'react';
3
3
  import { SxProps, Theme } from '@mui/material/styles';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { TextFieldVariants, SxProps as SxProps$1, Theme as Theme$1 } from '@mui/material';
@@ -270,13 +270,14 @@ interface WavelengthTitleBarProps {
270
270
  declare function WavelengthTitleBar({ titleText, subtitleText, textColor, textShadow }: WavelengthTitleBarProps): react_jsx_runtime.JSX.Element;
271
271
 
272
272
  interface WavelengthBannerProps {
273
- classification?: "unclassified" | "controlled" | "controlled unclassified information" | "cui" | "u" | "confidential" | "c" | "secret" | "s" | "top secret" | "ts" | string;
274
- control?: ("cui" | "sci" | "fouo" | "nf" | "propin" | "frd" | "gbr s" | "si" | "si-g" | "tk" | "relido" | "rd" | "rd-n" | "rel" | "fvey" | "hcs" | string)[];
273
+ headerText?: string;
275
274
  headerColor?: string;
276
275
  textColor?: string;
276
+ opacity?: string | number;
277
+ zIndex?: string | number;
277
278
  id?: string;
278
279
  }
279
- declare function WavelengthBanner({ classification, control, headerColor, textColor, id }: WavelengthBannerProps): react_jsx_runtime.JSX.Element;
280
+ declare function WavelengthBanner({ headerText, headerColor, textColor, opacity, zIndex, id }: WavelengthBannerProps): react_jsx_runtime.JSX.Element;
280
281
 
281
282
  interface AppLogoProps {
282
283
  width?: number;
@@ -506,4 +507,23 @@ interface TextFieldProps {
506
507
  }
507
508
  declare function WavelengthTextField(props: TextFieldProps): react_jsx_runtime.JSX.Element | null;
508
509
 
509
- export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
510
+ interface DataType {
511
+ id: number;
512
+ [key: string]: any;
513
+ }
514
+ interface ColumnProps<T> {
515
+ key: string;
516
+ title: string | ReactElement;
517
+ width?: string;
518
+ editable?: boolean;
519
+ render?: (column: ColumnProps<T>, item: T) => ReactElement;
520
+ }
521
+ type Props<T> = {
522
+ columns: Array<ColumnProps<T>>;
523
+ data?: T[] | undefined;
524
+ itemsPerPage: number;
525
+ totalPages: number;
526
+ };
527
+ declare const WavelengthDataTable: <T extends DataType>({ data, columns, itemsPerPage, totalPages }: Props<T>) => react_jsx_runtime.JSX.Element;
528
+
529
+ export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
package/dist/esm/index.js CHANGED
@@ -4988,51 +4988,76 @@ function WavelengthTitleBar2({ titleText, subtitleText, textColor, textShadow })
4988
4988
  }
4989
4989
 
4990
4990
  // src/components/headers/WavelengthTitleBar/WavelengthBanner.tsx
4991
- import { jsx as jsx20 } from "react/jsx-runtime";
4992
- function WavelengthBanner({ classification, control, headerColor, textColor, id }) {
4993
- const palette2 = getPalette();
4994
- if (classification === "unclassified") {
4995
- if (control && control.includes("cui")) {
4996
- headerColor = headerColor ? headerColor : "#502b85";
4997
- textColor = textColor ? textColor : "white";
4998
- }
4999
- headerColor = headerColor ? headerColor : "#007a33";
5000
- textColor = textColor ? textColor : "white";
5001
- } else if (classification === "controlled" || classification === "controlled unclassified information" || classification === "cui" || classification === "u") {
5002
- headerColor = headerColor ? headerColor : "#502b85";
5003
- textColor = textColor ? textColor : "white";
5004
- } else if (classification === "confidential" || classification === "c") {
5005
- headerColor = headerColor ? headerColor : "#0033a0";
5006
- textColor = textColor ? textColor : "white";
5007
- } else if (classification === "secret" || classification === "s") {
5008
- headerColor = headerColor ? headerColor : "#c8102e";
5009
- textColor = textColor ? textColor : "white";
5010
- } else if (classification === "top secret" || classification === "ts") {
5011
- if (control && control.includes("sci")) {
5012
- headerColor = headerColor ? headerColor : "#fce83a";
5013
- textColor = textColor ? textColor : "black";
5014
- }
5015
- headerColor = headerColor ? headerColor : "#ff8c00";
5016
- textColor = textColor ? textColor : "black";
5017
- } else if (classification === "" || classification === null || classification === void 0) {
5018
- classification = "CLASSIFICATION//CONTROL";
5019
- headerColor = palette2.primary;
5020
- textColor = palette2.secondary;
5021
- } else {
5022
- headerColor = headerColor ? headerColor : palette2.primary;
5023
- textColor = textColor ? textColor : palette2.secondary;
4991
+ import { useEffect as useEffect2, useRef as useRef3 } from "react";
4992
+
4993
+ // src/web-components/wavelength-banner.tsx
4994
+ var WavelengthBanner = class extends HTMLElement {
4995
+ static get observedAttributes() {
4996
+ return ["header-text", "header-color", "text-color", "opacity", "z-index", "id"];
5024
4997
  }
5025
- if (control && control.length === 0) {
5026
- classification = `${classification}`;
5027
- } else if (control && control.length === 1) {
5028
- classification = `${classification}//${control[0]}`;
5029
- } else if (control) {
5030
- classification = `${classification}//${control[0]}`;
5031
- for (let i = 1; i < control.length; i++) {
5032
- classification = `${classification}/${control[i]}`;
5033
- }
4998
+ constructor() {
4999
+ super();
5000
+ const shadow = this.attachShadow({ mode: "open" });
5001
+ const style3 = document.createElement("style");
5002
+ style3.textContent = `
5003
+ :host {
5004
+ display: block;
5005
+ width: 100%;
5006
+ }
5007
+
5008
+ .banner {
5009
+ width: 100%;
5010
+ text-align: center;
5011
+ font-weight: normal;
5012
+ font-family: sans-serif;
5013
+ font-size: 1rem;
5014
+ }
5015
+ `;
5016
+ this.container = document.createElement("div");
5017
+ this.container.classList.add("banner");
5018
+ this.textElement = document.createElement("p");
5019
+ this.container.appendChild(this.textElement);
5020
+ shadow.appendChild(style3);
5021
+ shadow.appendChild(this.container);
5022
+ }
5023
+ connectedCallback() {
5024
+ this.updateAttributes();
5034
5025
  }
5035
- return /* @__PURE__ */ jsx20("div", { style: { width: "100%", backgroundColor: headerColor }, id, children: /* @__PURE__ */ jsx20("p", { style: { width: "100%", color: textColor, textAlign: "center" }, children: classification.toUpperCase() }) });
5026
+ attributeChangedCallback() {
5027
+ this.updateAttributes();
5028
+ }
5029
+ updateAttributes() {
5030
+ const headerText = this.getAttribute("header-text") || "CLASSIFICATION//CONTROL";
5031
+ const headerColor = this.getAttribute("header-color") || "#4373aa";
5032
+ const textColor = this.getAttribute("text-color") || "#ffffff";
5033
+ const opacity = this.getAttribute("opacity") || "1";
5034
+ const zIndex = this.getAttribute("z-index") || "10";
5035
+ const id = this.getAttribute("id");
5036
+ this.container.style.backgroundColor = headerColor;
5037
+ this.container.style.opacity = opacity;
5038
+ this.container.style.zIndex = zIndex;
5039
+ if (id) this.container.id = id;
5040
+ this.textElement.textContent = headerText.toUpperCase();
5041
+ this.textElement.style.color = textColor;
5042
+ }
5043
+ };
5044
+ customElements.define("wavelength-banner", WavelengthBanner);
5045
+
5046
+ // src/components/headers/WavelengthTitleBar/WavelengthBanner.tsx
5047
+ import { jsx as jsx20 } from "react/jsx-runtime";
5048
+ function WavelengthBanner2({ headerText = "CLASSIFICATION//CONTROL", headerColor = "#000000", textColor = "#FFFFFF", opacity = 1, zIndex = 10, id }) {
5049
+ const ref = useRef3(null);
5050
+ useEffect2(() => {
5051
+ if (ref.current) {
5052
+ ref.current.setAttribute("header-text", headerText);
5053
+ ref.current.setAttribute("header-color", headerColor);
5054
+ ref.current.setAttribute("text-color", textColor);
5055
+ ref.current.setAttribute("opacity", String(opacity));
5056
+ ref.current.setAttribute("z-index", String(zIndex));
5057
+ if (id) ref.current.setAttribute("id", id);
5058
+ }
5059
+ }, [headerText, headerColor, textColor, opacity, zIndex, id]);
5060
+ return /* @__PURE__ */ jsx20("wavelength-banner", { ref });
5036
5061
  }
5037
5062
 
5038
5063
  // src/components/CSFD/ManyPlanes.tsx
@@ -5553,11 +5578,11 @@ function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign,
5553
5578
  // src/components/snackbars/TestSnackbar.tsx
5554
5579
  import Box6 from "@mui/material/Box";
5555
5580
  import Button5 from "@mui/material/Button";
5556
- import { useEffect as useEffect2, useRef as useRef3 } from "react";
5581
+ import { useEffect as useEffect3, useRef as useRef4 } from "react";
5557
5582
  import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
5558
5583
  var useOutsideClick = (callback) => {
5559
- const ref = useRef3(null);
5560
- useEffect2(() => {
5584
+ const ref = useRef4(null);
5585
+ useEffect3(() => {
5561
5586
  const handleClickOutside = (event) => {
5562
5587
  if (ref.current && !ref.current.contains(event.target)) {
5563
5588
  callback();
@@ -5709,7 +5734,7 @@ var DefaultCarousel = ({ items, buttonSize, imageHeight, imageWidth, cardHeight,
5709
5734
  };
5710
5735
 
5711
5736
  // src/components/carousels/sliderCarousel.tsx
5712
- import { useState as useState5, useEffect as useEffect4 } from "react";
5737
+ import { useState as useState5, useEffect as useEffect5 } from "react";
5713
5738
  import Grid6 from "@mui/material/Grid";
5714
5739
  import Card2 from "@mui/material/Card";
5715
5740
  import CardContent2 from "@mui/material/CardContent";
@@ -5720,7 +5745,7 @@ var delay = 2500;
5720
5745
  var SliderCardCarousel = ({ items, cardHeight, cardWidth, contHeight, contWidth }) => {
5721
5746
  const [index, setIndex] = useState5(0);
5722
5747
  const [isHovered, setIsHovered] = useState5(false);
5723
- useEffect4(() => {
5748
+ useEffect5(() => {
5724
5749
  setTimeout(() => setIndex((prevIndex) => prevIndex === items.length - 1 ? 0 : prevIndex + 1), delay);
5725
5750
  return () => {
5726
5751
  };
@@ -6089,6 +6114,7 @@ function DefaultPagination({ totalPages, currentPageNumber, siblingCount = 1, bo
6089
6114
  );
6090
6115
  }
6091
6116
  }
6117
+ var WavelengthPagination_default = DefaultPagination;
6092
6118
 
6093
6119
  // src/components/TextField/WavelengthTextField.tsx
6094
6120
  import { useCallback, useState as useState9 } from "react";
@@ -6221,6 +6247,367 @@ function WavelengthTextField(props) {
6221
6247
  }
6222
6248
  return null;
6223
6249
  }
6250
+
6251
+ // src/components/DataTable/WavelengthDataTable.tsx
6252
+ import { useEffect as useEffect6, useRef as useRef5, useState as useState10 } from "react";
6253
+ import styled11 from "styled-components";
6254
+ import { jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
6255
+ var ModalInputDiv = styled11.div`
6256
+ display: flex;
6257
+ flex-direction: column; /* Corrected this line */
6258
+ gap: 3px;
6259
+ margin: 3px;
6260
+
6261
+ label {
6262
+ align-self: flex-start;
6263
+ color: #c6c7cc;
6264
+ }
6265
+
6266
+ input,
6267
+ select {
6268
+ width: 100%;
6269
+ padding: 12px 20px;
6270
+ margin: 8px 0;
6271
+ box-sizing: border-box;
6272
+ border: none;
6273
+ outline: none;
6274
+ border-bottom: 2px solid #c6c7cc;
6275
+
6276
+ &:hover {
6277
+ border-bottom: 2px solid black;
6278
+ }
6279
+
6280
+ &:focus {
6281
+ border-bottom: 2px solid #8fd8ff;
6282
+ }
6283
+ }
6284
+ `;
6285
+ var ModalOverlay = styled11.div`
6286
+ position: fixed;
6287
+ bottom: 19%;
6288
+ right: 15%;
6289
+ width: 100%;
6290
+ height: 100%;
6291
+ background-color: rgba(0, 0, 0, 0);
6292
+ display: flex;
6293
+ justify-content: center;
6294
+ align-items: center;
6295
+ z-index: 1;
6296
+ `;
6297
+ var ModalWrapper = styled11.div`
6298
+ background-color: white;
6299
+ border-radius: 8px;
6300
+ padding: 20px;
6301
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
6302
+ position: relative;
6303
+ min-width: 300px;
6304
+ z-index: 1;
6305
+ display: flex;
6306
+ align-items: center;
6307
+ `;
6308
+ var ModalClose = styled11.button`
6309
+ position: absolute;
6310
+ top: 10px;
6311
+ right: 10px;
6312
+ font-size: 20px;
6313
+ cursor: pointer;
6314
+ border: none;
6315
+ background: none;
6316
+ z-index: 2;
6317
+ `;
6318
+ var TableHeadStyle = styled11.th`
6319
+ position: relative;
6320
+ `;
6321
+ var KebabMenu = styled11.div`
6322
+ display: inline-block;
6323
+ position: absolute;
6324
+ right: 0;
6325
+ top: 2px;
6326
+ `;
6327
+ var KebabIcon = styled11.div`
6328
+ cursor: pointer;
6329
+ font-size: 20px;
6330
+ padding: 5px;
6331
+
6332
+ &:hover,
6333
+ &:focus {
6334
+ color: #45beff;
6335
+ }
6336
+ &:active {
6337
+ color: #8fd8ff;
6338
+ }
6339
+ `;
6340
+ var MenuOptions = styled11.ul`
6341
+ position: absolute;
6342
+ right: 0;
6343
+ top: 100%;
6344
+ background-color: #f9f9f9;
6345
+ min-width: 160px;
6346
+ box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
6347
+ z-index: 1;
6348
+ list-style: none;
6349
+ padding: 0;
6350
+ margin: 0;
6351
+
6352
+ li {
6353
+ padding: 10px;
6354
+ text-decoration: none;
6355
+ display: block;
6356
+ cursor: pointer;
6357
+
6358
+ &:hover {
6359
+ background-color: #ddd;
6360
+ }
6361
+ }
6362
+ `;
6363
+ var StyledBoxDiv = styled11.div`
6364
+ background-color: white;
6365
+ width: 700px;
6366
+ height: 480px;
6367
+ position: relative;
6368
+ border-top-left-radius: 10px;
6369
+ border-top-right-radius: 10px;
6370
+ `;
6371
+ var StyledNavBoxDiv = styled11.div`
6372
+ background-color: white;
6373
+ width: 700px;
6374
+ display: flex; /* Make parent a flex-container */
6375
+ justify-content: center;
6376
+ border-bottom-left-radius: 10px;
6377
+ border-bottom-right-radius: 10px;
6378
+
6379
+ box-shadow: 0.5px 3px 5px black;
6380
+ `;
6381
+ var StyledTd = styled11.td`
6382
+ border-top: 1px solid #c6c7cc;
6383
+ border-bottom: 1px solid #c6c7cc;
6384
+ padding: 10px 15px;
6385
+ vertical-align: middle;
6386
+ `;
6387
+ var StyledTableTwo = styled11.table`
6388
+ width: 95%;
6389
+ height: 95%;
6390
+ border-collapse: collapse;
6391
+ background-color: white;
6392
+ color: black;
6393
+
6394
+ margin-left: auto;
6395
+ margin-right: auto;
6396
+
6397
+ th {
6398
+ position: relative; /* Enable absolute positioning of pseudo-elements */
6399
+ padding: 10px 15px;
6400
+
6401
+ /* Create the partial right border */
6402
+ &:not(:last-child):after {
6403
+ content: ""; /* Ensure the pseudo-element is visible */
6404
+ position: absolute;
6405
+ right: 0; /* Position it on the right side of the th */
6406
+ top: 50%; /* Position it in the vertical center */
6407
+ height: 50%; /* Set the height of the border to be half the height of th */
6408
+ border-right: 1px solid #c6c7cc;
6409
+ transform: translateY(-50%); /* Center it vertically */
6410
+ }
6411
+ }
6412
+ `;
6413
+ var StyledInput = styled11.input`
6414
+ height: 100%;
6415
+ width: 100%;
6416
+ outline: none;
6417
+ border: none;
6418
+ color: #8fd8ff;
6419
+ `;
6420
+ var WavelengthDataTable = ({ data, columns, itemsPerPage, totalPages }) => {
6421
+ const [localData, setLocalData] = useState10(data || []);
6422
+ const copiedArray = [...data || []];
6423
+ const [editingId, setEditingId] = useState10(null);
6424
+ const [editedColumnKey, setEditedColumnKey] = useState10(null);
6425
+ const [editedValue, setEditedValue] = useState10("");
6426
+ const [noRowsOpen, setNoRowsOpen] = useState10(false);
6427
+ const [isModalOpen, setIsModalOpen] = useState10(false);
6428
+ const [searchItem, setSearchItem] = useState10("");
6429
+ const [selectedValue, setSelectedValue] = useState10(columns[0]?.key || "");
6430
+ const [currentPage, setCurrentPage] = useState10(1);
6431
+ const [isOpen, setIsOpen] = useState10(false);
6432
+ const [editingMenuKey, setEditingMenuKey] = useState10(null);
6433
+ const menuRef = useRef5(null);
6434
+ const modalRef = useRef5(null);
6435
+ function isNumeric(value) {
6436
+ return /^\d+$/.test(value);
6437
+ }
6438
+ const handleChange = (event) => {
6439
+ setSelectedValue(event.target.value);
6440
+ setLocalData(copiedArray);
6441
+ };
6442
+ useEffect6(() => {
6443
+ if (!selectedValue || searchItem === "") {
6444
+ setLocalData(copiedArray);
6445
+ setNoRowsOpen(false);
6446
+ return;
6447
+ }
6448
+ if (isNumeric(searchItem)) {
6449
+ const filteredItems = localData.filter((item) => item[selectedValue].toString().includes(searchItem));
6450
+ setLocalData(filteredItems);
6451
+ if (filteredItems.length === 0) {
6452
+ setNoRowsOpen(true);
6453
+ } else {
6454
+ setNoRowsOpen(false);
6455
+ }
6456
+ } else {
6457
+ const filteredItems = localData.filter((item) => item[selectedValue].toString().toLowerCase().includes(searchItem.toLowerCase()));
6458
+ if (filteredItems.length === 0) {
6459
+ setNoRowsOpen(true);
6460
+ } else {
6461
+ setLocalData(filteredItems);
6462
+ setNoRowsOpen(false);
6463
+ }
6464
+ }
6465
+ }, [selectedValue, searchItem]);
6466
+ const openModal = () => {
6467
+ setIsModalOpen(true);
6468
+ };
6469
+ const closeModal = () => {
6470
+ setIsModalOpen(false);
6471
+ };
6472
+ useEffect6(() => {
6473
+ const handleClickOutside = (event) => {
6474
+ if (isModalOpen && modalRef.current && !modalRef.current.contains(event.target)) {
6475
+ closeModal();
6476
+ }
6477
+ };
6478
+ if (isOpen) {
6479
+ document.addEventListener("mousedown", handleClickOutside);
6480
+ }
6481
+ return () => {
6482
+ document.removeEventListener("mousedown", handleClickOutside);
6483
+ };
6484
+ }, [isModalOpen]);
6485
+ const toggleMenu = (key) => {
6486
+ setIsOpen(!isOpen);
6487
+ setEditingMenuKey(key);
6488
+ };
6489
+ const indexOfLastItem = currentPage * itemsPerPage;
6490
+ const indexOfFirstItem = indexOfLastItem - itemsPerPage;
6491
+ const currentPageData = localData.filter((_, index) => index >= indexOfFirstItem && index < indexOfLastItem);
6492
+ const [sortOrder, setSortOrder] = useState10("asc");
6493
+ const handleSort = (column, sortType) => {
6494
+ const sortedItems = [...localData].sort((a, b) => {
6495
+ const valueA = a[column];
6496
+ const valueB = b[column];
6497
+ if (typeof valueA === "string" && typeof valueB === "string") {
6498
+ if (sortType === "asc") {
6499
+ return valueA.localeCompare(valueB);
6500
+ } else {
6501
+ return valueB.localeCompare(valueA);
6502
+ }
6503
+ } else if (typeof valueA === "number" && typeof valueB === "number") {
6504
+ if (sortType === "asc") {
6505
+ return valueA - valueB;
6506
+ } else {
6507
+ return valueB - valueA;
6508
+ }
6509
+ } else {
6510
+ return 0;
6511
+ }
6512
+ });
6513
+ setLocalData(sortedItems);
6514
+ setSortOrder(sortOrder === "asc" ? "desc" : "asc");
6515
+ };
6516
+ const handleEdit = (id, value, columnKey) => {
6517
+ setEditingId(id);
6518
+ setEditedValue(value);
6519
+ setEditedColumnKey(columnKey);
6520
+ };
6521
+ const saveEdit = (id, editedValue2, columnKey) => {
6522
+ setLocalData(localData.map((item) => id === item.id ? { ...item, [columnKey]: editedValue2 } : item));
6523
+ setEditingId(null);
6524
+ };
6525
+ const handleCancel = () => {
6526
+ setEditingId(null);
6527
+ };
6528
+ const headers = columns.map((column, index) => {
6529
+ return /* @__PURE__ */ jsxs29(TableHeadStyle, { children: [
6530
+ column.title,
6531
+ /* @__PURE__ */ jsxs29(KebabMenu, { ref: menuRef, children: [
6532
+ /* @__PURE__ */ jsx38(
6533
+ KebabIcon,
6534
+ {
6535
+ title: `KebabIcon-${index}`,
6536
+ onClick: () => {
6537
+ toggleMenu(column.key);
6538
+ },
6539
+ children: "\u22EE"
6540
+ }
6541
+ ),
6542
+ isOpen && editingMenuKey === column.key && /* @__PURE__ */ jsxs29(MenuOptions, { children: [
6543
+ sortOrder === "asc" ? /* @__PURE__ */ jsxs29("li", { title: `MenuListASC-${index}`, onClick: () => handleSort(column.key, "asc"), children: [
6544
+ /* @__PURE__ */ jsx38("span", { children: "\u2B06" }),
6545
+ " Sort ASC"
6546
+ ] }) : /* @__PURE__ */ jsxs29("li", { title: `MenuListDES-${index}`, onClick: () => handleSort(column.key, "desc"), children: [
6547
+ /* @__PURE__ */ jsx38("span", { children: "\u2B07" }),
6548
+ " Sort DESC"
6549
+ ] }),
6550
+ /* @__PURE__ */ jsxs29("li", { title: `MenuListFilterButton-${index}`, onClick: openModal, children: [
6551
+ /* @__PURE__ */ jsx38("span", { children: "\u23F7" }),
6552
+ " Filter"
6553
+ ] }),
6554
+ isModalOpen && /* @__PURE__ */ jsx38(ModalOverlay, { children: /* @__PURE__ */ jsxs29(ModalWrapper, { ref: modalRef, children: [
6555
+ /* @__PURE__ */ jsx38(ModalClose, { title: `ModalClose-${index}`, onClick: closeModal, children: "\xD7" }),
6556
+ /* @__PURE__ */ jsxs29(ModalInputDiv, { children: [
6557
+ /* @__PURE__ */ jsx38("label", { htmlFor: "filterSelectId", children: "Columns: " }),
6558
+ /* @__PURE__ */ jsx38("select", { title: `filterSelect-${index}`, id: "filterSelectId", value: selectedValue, onChange: handleChange, children: columns.map((item) => /* @__PURE__ */ jsx38("option", { children: item.key }, item.key)) })
6559
+ ] }),
6560
+ /* @__PURE__ */ jsxs29(ModalInputDiv, { children: [
6561
+ /* @__PURE__ */ jsx38("label", { htmlFor: "filterInputId", children: "Values: " }),
6562
+ /* @__PURE__ */ jsx38(
6563
+ "input",
6564
+ {
6565
+ title: `Inputfiltertest-${index}`,
6566
+ id: "filterInputId",
6567
+ type: isNumeric(searchItem) ? "number" : "text",
6568
+ value: searchItem,
6569
+ onKeyDown: (e) => {
6570
+ if (e.key === "Backspace") {
6571
+ setLocalData(copiedArray);
6572
+ }
6573
+ },
6574
+ onChange: (e) => setSearchItem(e.target.value)
6575
+ }
6576
+ )
6577
+ ] })
6578
+ ] }) })
6579
+ ] })
6580
+ ] }, index)
6581
+ ] }, `headCell-${index}`);
6582
+ });
6583
+ const rows = !currentPageData?.length || noRowsOpen ? /* @__PURE__ */ jsx38("tr", { children: /* @__PURE__ */ jsx38("td", { title: "NoDataRows", colSpan: columns.length, children: "No data" }) }) : currentPageData?.map((item) => /* @__PURE__ */ jsx38("tr", { children: columns.map((column, index2) => {
6584
+ return /* @__PURE__ */ jsx38(StyledTd, { children: editingId === item.id && editedColumnKey === column.key ? /* @__PURE__ */ jsx38(
6585
+ StyledInput,
6586
+ {
6587
+ title: `styledRow-${item.id}-${column.key}-${index2}`,
6588
+ type: "text",
6589
+ value: editedValue,
6590
+ onChange: (e) => setEditedValue(e.target.value),
6591
+ onBlur: () => saveEdit(item.id, editedValue, column.key),
6592
+ onKeyDown: (e) => {
6593
+ if (e.key === "Enter") {
6594
+ saveEdit(item.id, editedValue, column.key);
6595
+ } else if (e.key === "Escape") {
6596
+ handleCancel();
6597
+ }
6598
+ },
6599
+ autoFocus: true
6600
+ }
6601
+ ) : /* @__PURE__ */ jsx38("span", { title: `spanRow-${item.id}-${column.key}-${index2}`, onDoubleClick: () => handleEdit(item.id, item[column.key], column.key), children: item[column.key] }) }, index2);
6602
+ }) }, item.id));
6603
+ return /* @__PURE__ */ jsxs29("div", { children: [
6604
+ /* @__PURE__ */ jsx38(StyledBoxDiv, { title: "StyledBoxDiv", children: /* @__PURE__ */ jsxs29(StyledTableTwo, { title: "StyledTable", children: [
6605
+ /* @__PURE__ */ jsx38("thead", { children: /* @__PURE__ */ jsx38("tr", { children: headers }) }),
6606
+ /* @__PURE__ */ jsx38("tbody", { children: rows })
6607
+ ] }) }),
6608
+ /* @__PURE__ */ jsx38(StyledNavBoxDiv, { children: /* @__PURE__ */ jsx38(WavelengthPagination_default, { totalPages, currentPageNumber: currentPage, onPageChange: setCurrentPage, style: "circular" }) })
6609
+ ] });
6610
+ };
6224
6611
  export {
6225
6612
  AppLogo,
6226
6613
  ButtonIcon,
@@ -6235,13 +6622,14 @@ export {
6235
6622
  TestSnackbar,
6236
6623
  WavelengthAppTheme,
6237
6624
  WavelengthAutocomplete,
6238
- WavelengthBanner,
6625
+ WavelengthBanner2 as WavelengthBanner,
6239
6626
  WavelengthBox,
6240
6627
  WavelengthButton,
6241
6628
  WavelengthCommentDisplay,
6242
6629
  WavelengthConfirmationModal,
6243
6630
  WavelengthContentModal,
6244
6631
  WavelengthContentPlaceholder,
6632
+ WavelengthDataTable,
6245
6633
  WavelengthDragAndDrop,
6246
6634
  WavelengthDropdown,
6247
6635
  WavelengthDropdownButton,