@wavelengthusaf/components 4.15.0 → 4.17.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.
@@ -6463,32 +6463,36 @@ WavelengthTestSnackbar.displayName = "WavelengthTestSnackbar";
6463
6463
 
6464
6464
  // src/components/sliders/WavelengthSlider.tsx
6465
6465
 
6466
- var _Slider = require('@mui/material/Slider'); var _Slider2 = _interopRequireDefault(_Slider);
6467
6466
 
6468
- function WavelengthSlider({ width: width2 = "300px", color: color2, valueDisplayed, marks, labelColor, value, id, maxVal = 100, minVal, step = 1, labelFunc, handleChange }) {
6469
- const on = valueDisplayed ? "on" : "off";
6470
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Box2.default, { sx: { width: width2 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6471
- _Slider2.default,
6472
- {
6473
- id,
6474
- "aria-label": "Custom marks",
6467
+ var WavelengthSlider = ({ children, customStyle, value, maxVal, minVal, step, handleChange, labelFunc, valueDisplayed, marks, color: color2, width: width2, ...rest }) => {
6468
+ const ref = _react.useRef.call(void 0, null);
6469
+ _react.useEffect.call(void 0, () => {
6470
+ const el = ref.current;
6471
+ if (!el) return;
6472
+ el.customStyles = customStyle;
6473
+ const attrs = {
6475
6474
  value,
6476
- getAriaValueText: labelFunc,
6475
+ "max-val": maxVal,
6476
+ "min-val": minVal,
6477
6477
  step,
6478
- marks,
6479
- valueLabelDisplay: on,
6480
- max: maxVal,
6481
- min: minVal,
6482
- onChange: handleChange,
6483
- sx: {
6484
- color: color2,
6485
- "& .MuiSlider-markLabel": {
6486
- color: labelColor
6487
- }
6488
- }
6489
- }
6490
- ) });
6491
- }
6478
+ marks: marks ? JSON.stringify(marks) : void 0,
6479
+ color: color2,
6480
+ width: width2,
6481
+ "value-displayed": _nullishCoalesce(valueDisplayed, () => ( (labelFunc && value !== void 0 ? labelFunc(value) : void 0)))
6482
+ };
6483
+ Object.entries(attrs).forEach(([key, val]) => {
6484
+ if (val !== void 0) el.setAttribute(key, val.toString());
6485
+ });
6486
+ }, [value, maxVal, minVal, step, marks, customStyle, color2, width2, valueDisplayed, labelFunc]);
6487
+ _react.useEffect.call(void 0, () => {
6488
+ const el = ref.current;
6489
+ if (!el || !handleChange) return;
6490
+ const onSliderChange = (e) => handleChange(e, e.detail.value);
6491
+ el.addEventListener("slider-change", onSliderChange);
6492
+ return () => el.removeEventListener("slider-change", onSliderChange);
6493
+ }, [handleChange]);
6494
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "wavelength-slider", { ref, ...rest, children });
6495
+ };
6492
6496
  WavelengthSlider.displayName = "WavelengthSlider";
6493
6497
 
6494
6498
  // src/components/carousels/WavelengthDefaultCarousel.tsx
@@ -7479,58 +7483,100 @@ ChildDataTable.displayName = "ChildDataTable";
7479
7483
 
7480
7484
  // src/components/DataTable/SubRowTable/ChildDataTable.tsx
7481
7485
 
7482
-
7483
7486
  var _client = require('react-dom/client');
7484
7487
 
7485
- var ChildDataTable2 = ({ columns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon, ...rest }) => {
7488
+
7489
+ var ChildDataTable2 = ({ columns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon, externalSort, sortKey, sortOrder, onAction, ...rest }) => {
7486
7490
  const tableRef = _react.useRef.call(void 0, null);
7487
- const reactDropdownRoots = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
7491
+ const cellRoots = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
7492
+ const dropdownRoots = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
7493
+ const renderReactToDOM = (element) => {
7494
+ const container = document.createElement("div");
7495
+ container.style.display = "contents";
7496
+ const root = _client.createRoot.call(void 0, container);
7497
+ cellRoots.current.set(container, root);
7498
+ root.render(element);
7499
+ return container;
7500
+ };
7501
+ const processedColumns = _react.useMemo.call(void 0, () => {
7502
+ if (!Array.isArray(columns)) return columns;
7503
+ return columns.map((col) => {
7504
+ if (typeof col.renderCell === "function") {
7505
+ const originalRender = col.renderCell;
7506
+ return {
7507
+ ...col,
7508
+ renderCell: (item) => {
7509
+ const content = originalRender(item);
7510
+ if (content !== null && typeof content === "object" && !(content instanceof HTMLElement)) {
7511
+ return renderReactToDOM(content);
7512
+ }
7513
+ return content;
7514
+ }
7515
+ };
7516
+ }
7517
+ return col;
7518
+ });
7519
+ }, [columns]);
7488
7520
  _react.useEffect.call(void 0, () => {
7489
- const customChildDataTableElement = tableRef.current;
7490
- if (!customChildDataTableElement) return;
7491
- if (columns !== void 0) customChildDataTableElement.setColumns = columns;
7492
- if (data !== void 0) customChildDataTableElement.setData = data;
7493
- if (dropdownArrowLocation !== void 0) customChildDataTableElement.setDropdownArrowLocation = dropdownArrowLocation;
7494
- if (sortIcon !== void 0) customChildDataTableElement.setSortIcon = sortIcon;
7495
- if (dropdownButtonIcon !== void 0) customChildDataTableElement.setDropdownButtonIcon = dropdownButtonIcon;
7496
- }, [columns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon]);
7521
+ const el = tableRef.current;
7522
+ if (!el) return;
7523
+ const resolveNodeToDOM = (node) => {
7524
+ if (node !== null && typeof node === "object" && !(node instanceof HTMLElement)) {
7525
+ return renderReactToDOM(node);
7526
+ }
7527
+ return node;
7528
+ };
7529
+ if (processedColumns !== void 0) el.setColumns = processedColumns;
7530
+ if (data !== void 0) el.setData = data;
7531
+ if (dropdownArrowLocation !== void 0) el.setDropdownArrowLocation = dropdownArrowLocation;
7532
+ if (sortIcon !== void 0) el.setSortIcon = resolveNodeToDOM(sortIcon);
7533
+ if (dropdownButtonIcon !== void 0) el.setDropdownButtonIcon = resolveNodeToDOM(dropdownButtonIcon);
7534
+ if (externalSort !== void 0) el.setExternalSort = externalSort;
7535
+ if (sortKey !== void 0) el.setSortKey = sortKey;
7536
+ if (sortOrder !== void 0) el.setSortOrder = sortOrder;
7537
+ }, [processedColumns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon, externalSort, sortKey, sortOrder]);
7497
7538
  _react.useEffect.call(void 0, () => {
7498
7539
  const el = tableRef.current;
7499
7540
  if (!el) return;
7541
+ const handleAction = (event) => {
7542
+ if (onAction) onAction(event);
7543
+ };
7500
7544
  const handleReactDropdown = (event) => {
7501
7545
  const customEvent = event;
7502
7546
  event.stopPropagation();
7503
7547
  const { container, itemId } = customEvent.detail;
7504
- let root = reactDropdownRoots.current.get(container);
7548
+ let root = dropdownRoots.current.get(container);
7505
7549
  if (!root) {
7506
7550
  root = _client.createRoot.call(void 0, container);
7507
- reactDropdownRoots.current.set(container, root);
7551
+ dropdownRoots.current.set(container, root);
7508
7552
  }
7509
- const item = _optionalChain([data, 'optionalAccess', _83 => _83.find, 'call', _84 => _84((item2) => String(item2.id) === String(itemId))]);
7510
- if (item && item.dropdown && root) {
7553
+ const item = _optionalChain([data, 'optionalAccess', _83 => _83.find, 'call', _84 => _84((i) => String(i.id) === String(itemId))]);
7554
+ if (_optionalChain([item, 'optionalAccess', _85 => _85.dropdown]) && root) {
7511
7555
  root.render(item.dropdown);
7512
7556
  }
7513
- const dropdown = container.querySelector(".dropdown");
7514
- if (dropdown) {
7515
- dropdown.hidden = false;
7516
- }
7517
7557
  };
7518
7558
  const handleCleanupDropdown = (event) => {
7519
7559
  event.stopPropagation();
7520
7560
  const { container } = event.detail;
7521
- const root = reactDropdownRoots.current.get(container);
7522
- const dropdown = container.querySelector(".dropdown");
7523
- if (root && dropdown) {
7524
- dropdown.hidden = true;
7561
+ const root = dropdownRoots.current.get(container);
7562
+ if (root) {
7563
+ root.unmount();
7564
+ dropdownRoots.current.delete(container);
7525
7565
  }
7526
7566
  };
7567
+ el.addEventListener("action", handleAction);
7527
7568
  el.addEventListener("getReactDropdown", handleReactDropdown);
7528
7569
  el.addEventListener("cleanupDropdown", handleCleanupDropdown);
7529
7570
  return () => {
7571
+ el.removeEventListener("action", handleAction);
7530
7572
  el.removeEventListener("getReactDropdown", handleReactDropdown);
7531
7573
  el.removeEventListener("cleanupDropdown", handleCleanupDropdown);
7574
+ cellRoots.current.forEach((root) => root.unmount());
7575
+ cellRoots.current.clear();
7576
+ dropdownRoots.current.forEach((root) => root.unmount());
7577
+ dropdownRoots.current.clear();
7532
7578
  };
7533
- }, [data]);
7579
+ }, [data, onAction]);
7534
7580
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "wavelength-child-data-table", { ref: tableRef, ...rest });
7535
7581
  };
7536
7582
  ChildDataTable2.displayName = "ChildDataTable";
@@ -7633,9 +7679,9 @@ var NestedDataTable = ({ data, columns, id }) => {
7633
7679
  const SubDataHeaders = SubDataColumns.map((column, index) => {
7634
7680
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { children: column.title }, `SubHeadCell-${index}`);
7635
7681
  });
7636
- const subDataRows = !_optionalChain([data, 'optionalAccess', _85 => _85.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { title: "NoSubDataRows", colSpan: columns.length, children: "No data" }) }) : data.map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubDataTr, { children: SubDataColumns.map((column, colIndex) => {
7682
+ const subDataRows = !_optionalChain([data, 'optionalAccess', _86 => _86.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { title: "NoSubDataRows", colSpan: columns.length, children: "No data" }) }) : data.map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubDataTr, { children: SubDataColumns.map((column, colIndex) => {
7637
7683
  const columnKey = trimBeforePeriod(column.key);
7638
- const value = _optionalChain([item, 'access', _86 => _86.Details, 'optionalAccess', _87 => _87[columnKey]]);
7684
+ const value = _optionalChain([item, 'access', _87 => _87.Details, 'optionalAccess', _88 => _88[columnKey]]);
7639
7685
  console.log("value: ", value);
7640
7686
  if (value !== void 0) {
7641
7687
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: value }) }, `Span-${item.id}-${colIndex}`);
@@ -7645,7 +7691,7 @@ var NestedDataTable = ({ data, columns, id }) => {
7645
7691
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: SubDataHeaders }) }),
7646
7692
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: subDataRows })
7647
7693
  ] });
7648
- const rows = !_optionalChain([data, 'optionalAccess', _88 => _88.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { title: "NoDataRows", colSpan: columns.length, children: "No data" }) }) : _optionalChain([data, 'optionalAccess', _89 => _89.map, 'call', _90 => _90((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
7694
+ const rows = !_optionalChain([data, 'optionalAccess', _89 => _89.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { title: "NoDataRows", colSpan: columns.length, children: "No data" }) }) : _optionalChain([data, 'optionalAccess', _90 => _90.map, 'call', _91 => _91((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
7649
7695
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, PrimaryTrRows, { $index: index, children: [
7650
7696
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownButton, { onClick: () => toggleDropdown(index), children: isAscending && isOpen && primaryRowIndex === index ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: "\u2227" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: "\u2228" }) }),
7651
7697
  HeadColumns.map((column, index2) => {
@@ -5,7 +5,6 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { TextFieldVariants } from '@mui/material';
6
6
  import { CSSProperties } from 'styled-components';
7
7
  import { z } from 'zod';
8
- import { Mark } from '@mui/material/Slider/useSlider.types';
9
8
 
10
9
  /**
11
10
  * Helper Functions
@@ -173,7 +172,7 @@ type StyleProp = {
173
172
  } & CSSProperties;
174
173
  /** Extending from this instead of HTMLElement in component refs allows for integration with the styling mixin in web components*/
175
174
  interface StylableElement extends HTMLElement {
176
- customStyles: StyleProp;
175
+ customStyles?: StyleProp;
177
176
  }
178
177
 
179
178
  interface WavelengthSearchProps extends React__default.HTMLAttributes<HTMLElement> {
@@ -856,24 +855,23 @@ declare namespace WavelengthTestSnackbar {
856
855
  var displayName: string;
857
856
  }
858
857
 
859
- interface sliderProps {
860
- width?: string;
861
- labelColor?: string;
858
+ interface WavelengthSliderProps extends React__default.HTMLAttributes<HTMLElement> {
859
+ customStyle?: StyleProp;
860
+ value?: number;
861
+ maxVal?: number;
862
+ minVal?: number;
863
+ step?: number;
864
+ handleChange?: (event: Event, newValue: number | number[]) => void;
865
+ labelFunc?: (val: number) => string;
866
+ valueDisplayed?: string;
867
+ marks?: (number | {
868
+ value: number;
869
+ label: string;
870
+ })[];
862
871
  color?: string;
863
- value: number;
864
- id?: string;
865
- valueDisplayed?: boolean;
866
- minVal: number;
867
- maxVal: number;
868
- step: number;
869
- handleChange: (event: Event, newValue: number | number[]) => void;
870
- labelFunc?(val: number): string;
871
- marks?: Mark[];
872
- }
873
- declare function WavelengthSlider({ width, color, valueDisplayed, marks, labelColor, value, id, maxVal, minVal, step, labelFunc, handleChange }: sliderProps): react_jsx_runtime.JSX.Element;
874
- declare namespace WavelengthSlider {
875
- var displayName: string;
872
+ width?: string;
876
873
  }
874
+ declare const WavelengthSlider: React__default.FC<WavelengthSliderProps>;
877
875
 
878
876
  interface carouselItem$1 {
879
877
  title?: string;
@@ -977,11 +975,15 @@ declare const WavelengthDataTable: {
977
975
  };
978
976
 
979
977
  interface ChildDataTableProps extends React__default.HTMLAttributes<HTMLElement> {
980
- columns?: object;
981
- data?: object;
982
- dropdownArrowLocation?: string;
983
- sortIcon?: string | HTMLElement;
984
- dropdownButtonIcon?: string | HTMLElement;
978
+ columns?: any[];
979
+ data?: any[];
980
+ dropdownArrowLocation?: "left" | "right" | "bottom";
981
+ sortIcon?: string | HTMLElement | React__default.ReactNode;
982
+ dropdownButtonIcon?: string | HTMLElement | React__default.ReactNode;
983
+ externalSort?: boolean | string;
984
+ sortKey?: string;
985
+ sortOrder?: "asc" | "desc";
986
+ onAction?: (event: CustomEvent) => void;
985
987
  }
986
988
  declare const ChildDataTable: React__default.FC<ChildDataTableProps>;
987
989
 
@@ -5,7 +5,6 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { TextFieldVariants } from '@mui/material';
6
6
  import { CSSProperties } from 'styled-components';
7
7
  import { z } from 'zod';
8
- import { Mark } from '@mui/material/Slider/useSlider.types';
9
8
 
10
9
  /**
11
10
  * Helper Functions
@@ -173,7 +172,7 @@ type StyleProp = {
173
172
  } & CSSProperties;
174
173
  /** Extending from this instead of HTMLElement in component refs allows for integration with the styling mixin in web components*/
175
174
  interface StylableElement extends HTMLElement {
176
- customStyles: StyleProp;
175
+ customStyles?: StyleProp;
177
176
  }
178
177
 
179
178
  interface WavelengthSearchProps extends React__default.HTMLAttributes<HTMLElement> {
@@ -856,24 +855,23 @@ declare namespace WavelengthTestSnackbar {
856
855
  var displayName: string;
857
856
  }
858
857
 
859
- interface sliderProps {
860
- width?: string;
861
- labelColor?: string;
858
+ interface WavelengthSliderProps extends React__default.HTMLAttributes<HTMLElement> {
859
+ customStyle?: StyleProp;
860
+ value?: number;
861
+ maxVal?: number;
862
+ minVal?: number;
863
+ step?: number;
864
+ handleChange?: (event: Event, newValue: number | number[]) => void;
865
+ labelFunc?: (val: number) => string;
866
+ valueDisplayed?: string;
867
+ marks?: (number | {
868
+ value: number;
869
+ label: string;
870
+ })[];
862
871
  color?: string;
863
- value: number;
864
- id?: string;
865
- valueDisplayed?: boolean;
866
- minVal: number;
867
- maxVal: number;
868
- step: number;
869
- handleChange: (event: Event, newValue: number | number[]) => void;
870
- labelFunc?(val: number): string;
871
- marks?: Mark[];
872
- }
873
- declare function WavelengthSlider({ width, color, valueDisplayed, marks, labelColor, value, id, maxVal, minVal, step, labelFunc, handleChange }: sliderProps): react_jsx_runtime.JSX.Element;
874
- declare namespace WavelengthSlider {
875
- var displayName: string;
872
+ width?: string;
876
873
  }
874
+ declare const WavelengthSlider: React__default.FC<WavelengthSliderProps>;
877
875
 
878
876
  interface carouselItem$1 {
879
877
  title?: string;
@@ -977,11 +975,15 @@ declare const WavelengthDataTable: {
977
975
  };
978
976
 
979
977
  interface ChildDataTableProps extends React__default.HTMLAttributes<HTMLElement> {
980
- columns?: object;
981
- data?: object;
982
- dropdownArrowLocation?: string;
983
- sortIcon?: string | HTMLElement;
984
- dropdownButtonIcon?: string | HTMLElement;
978
+ columns?: any[];
979
+ data?: any[];
980
+ dropdownArrowLocation?: "left" | "right" | "bottom";
981
+ sortIcon?: string | HTMLElement | React__default.ReactNode;
982
+ dropdownButtonIcon?: string | HTMLElement | React__default.ReactNode;
983
+ externalSort?: boolean | string;
984
+ sortKey?: string;
985
+ sortOrder?: "asc" | "desc";
986
+ onAction?: (event: CustomEvent) => void;
985
987
  }
986
988
  declare const ChildDataTable: React__default.FC<ChildDataTableProps>;
987
989
 
package/dist/esm/index.js CHANGED
@@ -6462,33 +6462,37 @@ function WavelengthTestSnackbar({ isPopUpOpen, toggleOpen, type, message, custom
6462
6462
  WavelengthTestSnackbar.displayName = "WavelengthTestSnackbar";
6463
6463
 
6464
6464
  // src/components/sliders/WavelengthSlider.tsx
6465
- import Box4 from "@mui/material/Box";
6466
- import Slider from "@mui/material/Slider";
6465
+ import { useRef as useRef22, useEffect as useEffect22 } from "react";
6467
6466
  import { jsx as jsx47 } from "react/jsx-runtime";
6468
- function WavelengthSlider({ width: width2 = "300px", color: color2, valueDisplayed, marks, labelColor, value, id, maxVal = 100, minVal, step = 1, labelFunc, handleChange }) {
6469
- const on = valueDisplayed ? "on" : "off";
6470
- return /* @__PURE__ */ jsx47(Box4, { sx: { width: width2 }, children: /* @__PURE__ */ jsx47(
6471
- Slider,
6472
- {
6473
- id,
6474
- "aria-label": "Custom marks",
6467
+ var WavelengthSlider = ({ children, customStyle, value, maxVal, minVal, step, handleChange, labelFunc, valueDisplayed, marks, color: color2, width: width2, ...rest }) => {
6468
+ const ref = useRef22(null);
6469
+ useEffect22(() => {
6470
+ const el = ref.current;
6471
+ if (!el) return;
6472
+ el.customStyles = customStyle;
6473
+ const attrs = {
6475
6474
  value,
6476
- getAriaValueText: labelFunc,
6475
+ "max-val": maxVal,
6476
+ "min-val": minVal,
6477
6477
  step,
6478
- marks,
6479
- valueLabelDisplay: on,
6480
- max: maxVal,
6481
- min: minVal,
6482
- onChange: handleChange,
6483
- sx: {
6484
- color: color2,
6485
- "& .MuiSlider-markLabel": {
6486
- color: labelColor
6487
- }
6488
- }
6489
- }
6490
- ) });
6491
- }
6478
+ marks: marks ? JSON.stringify(marks) : void 0,
6479
+ color: color2,
6480
+ width: width2,
6481
+ "value-displayed": valueDisplayed ?? (labelFunc && value !== void 0 ? labelFunc(value) : void 0)
6482
+ };
6483
+ Object.entries(attrs).forEach(([key, val]) => {
6484
+ if (val !== void 0) el.setAttribute(key, val.toString());
6485
+ });
6486
+ }, [value, maxVal, minVal, step, marks, customStyle, color2, width2, valueDisplayed, labelFunc]);
6487
+ useEffect22(() => {
6488
+ const el = ref.current;
6489
+ if (!el || !handleChange) return;
6490
+ const onSliderChange = (e) => handleChange(e, e.detail.value);
6491
+ el.addEventListener("slider-change", onSliderChange);
6492
+ return () => el.removeEventListener("slider-change", onSliderChange);
6493
+ }, [handleChange]);
6494
+ return /* @__PURE__ */ jsx47("wavelength-slider", { ref, ...rest, children });
6495
+ };
6492
6496
  WavelengthSlider.displayName = "WavelengthSlider";
6493
6497
 
6494
6498
  // src/components/carousels/WavelengthDefaultCarousel.tsx
@@ -6553,7 +6557,7 @@ var DefaultCarousel = ({ items, buttonSize, imageHeight, imageWidth, cardHeight,
6553
6557
  DefaultCarousel.displayName = "DefaultCarousel";
6554
6558
 
6555
6559
  // src/components/carousels/WavelengthSliderCarousel.tsx
6556
- import { useState as useState8, useEffect as useEffect23 } from "react";
6560
+ import { useState as useState8, useEffect as useEffect24 } from "react";
6557
6561
  import Grid4 from "@mui/material/Grid";
6558
6562
  import Card2 from "@mui/material/Card";
6559
6563
  import CardContent2 from "@mui/material/CardContent";
@@ -6564,7 +6568,7 @@ var delay = 2500;
6564
6568
  var SliderCardCarousel = ({ items, cardHeight, cardWidth, contHeight, contWidth }) => {
6565
6569
  const [index, setIndex] = useState8(0);
6566
6570
  const [isHovered, setIsHovered] = useState8(false);
6567
- useEffect23(() => {
6571
+ useEffect24(() => {
6568
6572
  setTimeout(() => setIndex((prevIndex) => prevIndex === items.length - 1 ? 0 : prevIndex + 1), delay);
6569
6573
  return () => {
6570
6574
  };
@@ -6637,7 +6641,7 @@ var SliderCardCarousel = ({ items, cardHeight, cardWidth, contHeight, contWidth
6637
6641
  SliderCardCarousel.displayName = "SliderCardCarousel";
6638
6642
 
6639
6643
  // src/components/TextField/WavelengthInput.tsx
6640
- import { useRef as useRef22, useEffect as useEffect24, forwardRef as forwardRef2, useImperativeHandle as useImperativeHandle3 } from "react";
6644
+ import { useRef as useRef23, useEffect as useEffect25, forwardRef as forwardRef2, useImperativeHandle as useImperativeHandle3 } from "react";
6641
6645
  import "@wavelengthusaf/web-components";
6642
6646
  import { jsx as jsx50 } from "react/jsx-runtime";
6643
6647
  var WavelengthInput = forwardRef2(
@@ -6677,12 +6681,12 @@ var WavelengthInput = forwardRef2(
6677
6681
  onBlurCallback,
6678
6682
  ...rest
6679
6683
  }, ref) => {
6680
- const internalRef = useRef22(null);
6684
+ const internalRef = useRef23(null);
6681
6685
  useImperativeHandle3(ref, () => ({
6682
6686
  ...internalRef.current,
6683
6687
  validate: () => internalRef.current?.validate?.(true)
6684
6688
  }));
6685
- useEffect24(() => {
6689
+ useEffect25(() => {
6686
6690
  const el = internalRef.current;
6687
6691
  if (!el) return;
6688
6692
  const set = (attr, val) => {
@@ -6755,7 +6759,7 @@ var WavelengthInput = forwardRef2(
6755
6759
  disabled,
6756
6760
  multiLine
6757
6761
  ]);
6758
- useEffect24(() => {
6762
+ useEffect25(() => {
6759
6763
  const el = internalRef.current;
6760
6764
  if (!el || !onBlurCallback) return;
6761
6765
  const handler = (e) => {
@@ -6767,7 +6771,7 @@ var WavelengthInput = forwardRef2(
6767
6771
  el.addEventListener("blur", handler);
6768
6772
  return () => el.removeEventListener("blur", handler);
6769
6773
  }, [onBlurCallback]);
6770
- useEffect24(() => {
6774
+ useEffect25(() => {
6771
6775
  const el = internalRef.current;
6772
6776
  if (!el || !onChange) return;
6773
6777
  const handler = (e) => {
@@ -6797,7 +6801,7 @@ WavelengthInput.displayName = "WavelengthInput";
6797
6801
  import { WavelengthInput as WavelengthInput2 } from "@wavelengthusaf/web-components";
6798
6802
 
6799
6803
  // src/components/DataTable/WavelengthDataTable.tsx
6800
- import { useEffect as useEffect25, useRef as useRef23, useState as useState9 } from "react";
6804
+ import { useEffect as useEffect26, useRef as useRef24, useState as useState9 } from "react";
6801
6805
  import styled7 from "styled-components";
6802
6806
  import { jsx as jsx51, jsxs as jsxs27 } from "react/jsx-runtime";
6803
6807
  var ModalInputDiv = styled7.div`
@@ -6978,8 +6982,8 @@ var WavelengthDataTable = ({ data, columns, itemsPerPage, totalPages, id }) => {
6978
6982
  const [currentPage, setCurrentPage] = useState9(1);
6979
6983
  const [isOpen, setIsOpen] = useState9(false);
6980
6984
  const [editingMenuKey, setEditingMenuKey] = useState9(null);
6981
- const menuRef = useRef23(null);
6982
- const modalRef = useRef23(null);
6985
+ const menuRef = useRef24(null);
6986
+ const modalRef = useRef24(null);
6983
6987
  function isNumeric(value) {
6984
6988
  return /^\d+$/.test(value);
6985
6989
  }
@@ -6987,7 +6991,7 @@ var WavelengthDataTable = ({ data, columns, itemsPerPage, totalPages, id }) => {
6987
6991
  setSelectedValue(event.target.value);
6988
6992
  setLocalData(copiedArray);
6989
6993
  };
6990
- useEffect25(() => {
6994
+ useEffect26(() => {
6991
6995
  if (!selectedValue || searchItem === "") {
6992
6996
  setLocalData(copiedArray);
6993
6997
  setNoRowsOpen(false);
@@ -7017,7 +7021,7 @@ var WavelengthDataTable = ({ data, columns, itemsPerPage, totalPages, id }) => {
7017
7021
  const closeModal = () => {
7018
7022
  setIsModalOpen(false);
7019
7023
  };
7020
- useEffect25(() => {
7024
+ useEffect26(() => {
7021
7025
  const handleClickOutside = (event) => {
7022
7026
  if (isModalOpen && modalRef.current && !modalRef.current.contains(event.target)) {
7023
7027
  closeModal();
@@ -7478,59 +7482,101 @@ var ChildDataTable = ({ data, columns, downloadArrowOnClick, downloadMissionOnCl
7478
7482
  ChildDataTable.displayName = "ChildDataTable";
7479
7483
 
7480
7484
  // src/components/DataTable/SubRowTable/ChildDataTable.tsx
7481
- import { useRef as useRef24, useEffect as useEffect26 } from "react";
7482
- import "@wavelengthusaf/web-components";
7485
+ import { useRef as useRef25, useEffect as useEffect27, useMemo as useMemo4 } from "react";
7483
7486
  import { createRoot } from "react-dom/client";
7487
+ import "@wavelengthusaf/web-components";
7484
7488
  import { jsx as jsx53 } from "react/jsx-runtime";
7485
- var ChildDataTable2 = ({ columns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon, ...rest }) => {
7486
- const tableRef = useRef24(null);
7487
- const reactDropdownRoots = useRef24(/* @__PURE__ */ new Map());
7488
- useEffect26(() => {
7489
- const customChildDataTableElement = tableRef.current;
7490
- if (!customChildDataTableElement) return;
7491
- if (columns !== void 0) customChildDataTableElement.setColumns = columns;
7492
- if (data !== void 0) customChildDataTableElement.setData = data;
7493
- if (dropdownArrowLocation !== void 0) customChildDataTableElement.setDropdownArrowLocation = dropdownArrowLocation;
7494
- if (sortIcon !== void 0) customChildDataTableElement.setSortIcon = sortIcon;
7495
- if (dropdownButtonIcon !== void 0) customChildDataTableElement.setDropdownButtonIcon = dropdownButtonIcon;
7496
- }, [columns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon]);
7497
- useEffect26(() => {
7489
+ var ChildDataTable2 = ({ columns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon, externalSort, sortKey, sortOrder, onAction, ...rest }) => {
7490
+ const tableRef = useRef25(null);
7491
+ const cellRoots = useRef25(/* @__PURE__ */ new Map());
7492
+ const dropdownRoots = useRef25(/* @__PURE__ */ new Map());
7493
+ const renderReactToDOM = (element) => {
7494
+ const container = document.createElement("div");
7495
+ container.style.display = "contents";
7496
+ const root = createRoot(container);
7497
+ cellRoots.current.set(container, root);
7498
+ root.render(element);
7499
+ return container;
7500
+ };
7501
+ const processedColumns = useMemo4(() => {
7502
+ if (!Array.isArray(columns)) return columns;
7503
+ return columns.map((col) => {
7504
+ if (typeof col.renderCell === "function") {
7505
+ const originalRender = col.renderCell;
7506
+ return {
7507
+ ...col,
7508
+ renderCell: (item) => {
7509
+ const content = originalRender(item);
7510
+ if (content !== null && typeof content === "object" && !(content instanceof HTMLElement)) {
7511
+ return renderReactToDOM(content);
7512
+ }
7513
+ return content;
7514
+ }
7515
+ };
7516
+ }
7517
+ return col;
7518
+ });
7519
+ }, [columns]);
7520
+ useEffect27(() => {
7521
+ const el = tableRef.current;
7522
+ if (!el) return;
7523
+ const resolveNodeToDOM = (node) => {
7524
+ if (node !== null && typeof node === "object" && !(node instanceof HTMLElement)) {
7525
+ return renderReactToDOM(node);
7526
+ }
7527
+ return node;
7528
+ };
7529
+ if (processedColumns !== void 0) el.setColumns = processedColumns;
7530
+ if (data !== void 0) el.setData = data;
7531
+ if (dropdownArrowLocation !== void 0) el.setDropdownArrowLocation = dropdownArrowLocation;
7532
+ if (sortIcon !== void 0) el.setSortIcon = resolveNodeToDOM(sortIcon);
7533
+ if (dropdownButtonIcon !== void 0) el.setDropdownButtonIcon = resolveNodeToDOM(dropdownButtonIcon);
7534
+ if (externalSort !== void 0) el.setExternalSort = externalSort;
7535
+ if (sortKey !== void 0) el.setSortKey = sortKey;
7536
+ if (sortOrder !== void 0) el.setSortOrder = sortOrder;
7537
+ }, [processedColumns, data, dropdownArrowLocation, sortIcon, dropdownButtonIcon, externalSort, sortKey, sortOrder]);
7538
+ useEffect27(() => {
7498
7539
  const el = tableRef.current;
7499
7540
  if (!el) return;
7541
+ const handleAction = (event) => {
7542
+ if (onAction) onAction(event);
7543
+ };
7500
7544
  const handleReactDropdown = (event) => {
7501
7545
  const customEvent = event;
7502
7546
  event.stopPropagation();
7503
7547
  const { container, itemId } = customEvent.detail;
7504
- let root = reactDropdownRoots.current.get(container);
7548
+ let root = dropdownRoots.current.get(container);
7505
7549
  if (!root) {
7506
7550
  root = createRoot(container);
7507
- reactDropdownRoots.current.set(container, root);
7551
+ dropdownRoots.current.set(container, root);
7508
7552
  }
7509
- const item = data?.find((item2) => String(item2.id) === String(itemId));
7510
- if (item && item.dropdown && root) {
7553
+ const item = data?.find((i) => String(i.id) === String(itemId));
7554
+ if (item?.dropdown && root) {
7511
7555
  root.render(item.dropdown);
7512
7556
  }
7513
- const dropdown = container.querySelector(".dropdown");
7514
- if (dropdown) {
7515
- dropdown.hidden = false;
7516
- }
7517
7557
  };
7518
7558
  const handleCleanupDropdown = (event) => {
7519
7559
  event.stopPropagation();
7520
7560
  const { container } = event.detail;
7521
- const root = reactDropdownRoots.current.get(container);
7522
- const dropdown = container.querySelector(".dropdown");
7523
- if (root && dropdown) {
7524
- dropdown.hidden = true;
7561
+ const root = dropdownRoots.current.get(container);
7562
+ if (root) {
7563
+ root.unmount();
7564
+ dropdownRoots.current.delete(container);
7525
7565
  }
7526
7566
  };
7567
+ el.addEventListener("action", handleAction);
7527
7568
  el.addEventListener("getReactDropdown", handleReactDropdown);
7528
7569
  el.addEventListener("cleanupDropdown", handleCleanupDropdown);
7529
7570
  return () => {
7571
+ el.removeEventListener("action", handleAction);
7530
7572
  el.removeEventListener("getReactDropdown", handleReactDropdown);
7531
7573
  el.removeEventListener("cleanupDropdown", handleCleanupDropdown);
7574
+ cellRoots.current.forEach((root) => root.unmount());
7575
+ cellRoots.current.clear();
7576
+ dropdownRoots.current.forEach((root) => root.unmount());
7577
+ dropdownRoots.current.clear();
7532
7578
  };
7533
- }, [data]);
7579
+ }, [data, onAction]);
7534
7580
  return /* @__PURE__ */ jsx53("wavelength-child-data-table", { ref: tableRef, ...rest });
7535
7581
  };
7536
7582
  ChildDataTable2.displayName = "ChildDataTable";
@@ -7665,7 +7711,7 @@ var NestedDataTable = ({ data, columns, id }) => {
7665
7711
  NestedDataTable.displayName = "NestedDataTable";
7666
7712
 
7667
7713
  // src/components/AutoComplete/WavelengthAutoComplete.tsx
7668
- import { useEffect as useEffect27, useRef as useRef26, useState as useState12 } from "react";
7714
+ import { useEffect as useEffect28, useRef as useRef27, useState as useState12 } from "react";
7669
7715
  import styled10 from "styled-components";
7670
7716
  import { Fragment as Fragment14, jsx as jsx55, jsxs as jsxs30 } from "react/jsx-runtime";
7671
7717
  var AutoContainer = styled10.div`
@@ -7796,9 +7842,9 @@ var WavelengthAutoComplete = ({
7796
7842
  placeholder,
7797
7843
  onBlurCallback
7798
7844
  }) => {
7799
- const inputRef = useRef26(null);
7800
- const listRef = useRef26(null);
7801
- const noItemListRef = useRef26(null);
7845
+ const inputRef = useRef27(null);
7846
+ const listRef = useRef27(null);
7847
+ const noItemListRef = useRef27(null);
7802
7848
  const [inputValue, setInputValue] = useState12(placeholder ?? "");
7803
7849
  const [suggestions, setSuggestions] = useState12([]);
7804
7850
  const [isDropdownVisible, setIsDropdownVisible] = useState12(false);
@@ -7806,7 +7852,7 @@ var WavelengthAutoComplete = ({
7806
7852
  const arrayLength = suggestions.length;
7807
7853
  const [focusedIndex, setFocusedIndex] = useState12(0);
7808
7854
  const idName = id ? id : "auto-comp";
7809
- useEffect27(() => {
7855
+ useEffect28(() => {
7810
7856
  const handleClickOutsideList = (event) => {
7811
7857
  if (listRef.current && !listRef.current.contains(event.target)) {
7812
7858
  setIsDropdownVisible(false);
@@ -7818,7 +7864,7 @@ var WavelengthAutoComplete = ({
7818
7864
  };
7819
7865
  }, [focusedIndex]);
7820
7866
  if (onDataChange !== void 0) {
7821
- useEffect27(() => {
7867
+ useEffect28(() => {
7822
7868
  onDataChange(inputValue);
7823
7869
  }, [inputValue]);
7824
7870
  }
@@ -7938,7 +7984,7 @@ var WavelengthAutoComplete = ({
7938
7984
  WavelengthAutoComplete.displayName = "WavelengthAutoComplete";
7939
7985
 
7940
7986
  // src/components/inputs/WavelengthDatePicker.tsx
7941
- import { useEffect as useEffect28, useState as useState13 } from "react";
7987
+ import { useEffect as useEffect29, useState as useState13 } from "react";
7942
7988
  import styled11 from "styled-components";
7943
7989
  import { jsx as jsx56, jsxs as jsxs31 } from "react/jsx-runtime";
7944
7990
  var Label2 = styled11.label`
@@ -8012,7 +8058,7 @@ var WavelengthDatePicker = ({
8012
8058
  const [minAdjusted, setMinAdjusted] = useState13("");
8013
8059
  const [maxAdjusted, setMaxAdjusted] = useState13("");
8014
8060
  const idName = id ? id : "WlDatePick";
8015
- useEffect28(() => {
8061
+ useEffect29(() => {
8016
8062
  const minDate = new Date(min || "");
8017
8063
  const maxDate = new Date(max || "");
8018
8064
  if (inputTimeType === "datetime-local") {
@@ -8095,7 +8141,7 @@ WavelengthDatePicker.displayName = "WavelengthDatePicker";
8095
8141
  import { WavelengthDatePicker as WavelengthDatePicker2 } from "@wavelengthusaf/web-components";
8096
8142
 
8097
8143
  // src/components/inputs/WavelengthCheckbox.tsx
8098
- import { useRef as useRef27, useEffect as useEffect29 } from "react";
8144
+ import { useRef as useRef28, useEffect as useEffect30 } from "react";
8099
8145
  import "@wavelengthusaf/web-components";
8100
8146
  import { jsx as jsx57 } from "react/jsx-runtime";
8101
8147
  var WavelengthCheckbox = ({
@@ -8107,8 +8153,8 @@ var WavelengthCheckbox = ({
8107
8153
  textSize,
8108
8154
  ...rest
8109
8155
  }) => {
8110
- const ref = useRef27(null);
8111
- useEffect29(() => {
8156
+ const ref = useRef28(null);
8157
+ useEffect30(() => {
8112
8158
  const el = ref.current;
8113
8159
  if (!el) return;
8114
8160
  if (size !== void 0) {
@@ -8137,7 +8183,7 @@ var WavelengthCheckbox = ({
8137
8183
  WavelengthCheckbox.displayName = "WavelengthCheckbox";
8138
8184
 
8139
8185
  // src/components/samples/SampleComponent.tsx
8140
- import { useRef as useRef28, useEffect as useEffect30 } from "react";
8186
+ import { useRef as useRef29, useEffect as useEffect31 } from "react";
8141
8187
  import { jsx as jsx58 } from "react/jsx-runtime";
8142
8188
  var SampleComponent = ({
8143
8189
  testProp,
@@ -8147,8 +8193,8 @@ var SampleComponent = ({
8147
8193
  ...rest
8148
8194
  // This rest operator includes className, style, onClick, etc.
8149
8195
  }) => {
8150
- const ref = useRef28(null);
8151
- useEffect30(() => {
8196
+ const ref = useRef29(null);
8197
+ useEffect31(() => {
8152
8198
  const el = ref.current;
8153
8199
  if (!el) return;
8154
8200
  el.customStyles = customStyle;
@@ -8161,7 +8207,7 @@ var SampleComponent = ({
8161
8207
  SampleComponent.displayName = "SampleComponent";
8162
8208
 
8163
8209
  // src/components/NotificationPanel/WavelengthNotificationPanel.tsx
8164
- import { useRef as useRef29, useEffect as useEffect31 } from "react";
8210
+ import { useRef as useRef30, useEffect as useEffect32 } from "react";
8165
8211
  import "@wavelengthusaf/web-components";
8166
8212
  import { jsx as jsx59 } from "react/jsx-runtime";
8167
8213
  var WavelengthNotificationPanel = ({
@@ -8172,8 +8218,8 @@ var WavelengthNotificationPanel = ({
8172
8218
  ...rest
8173
8219
  // This rest operator includes className, style, onClick, etc.
8174
8220
  }) => {
8175
- const ref = useRef29(null);
8176
- useEffect31(() => {
8221
+ const ref = useRef30(null);
8222
+ useEffect32(() => {
8177
8223
  const el = ref.current;
8178
8224
  if (!el) return;
8179
8225
  if (notifications !== void 0) {
@@ -8199,11 +8245,11 @@ var WavelengthNotificationPanel = ({
8199
8245
  import { SampleComponent as SampleComponent2 } from "@wavelengthusaf/web-components";
8200
8246
 
8201
8247
  // src/components/MultiSelect/WavelengthMultiSelectAutocomplete.tsx
8202
- import { useEffect as useEffect32, useRef as useRef30 } from "react";
8248
+ import { useEffect as useEffect33, useRef as useRef31 } from "react";
8203
8249
  import { jsx as jsx60 } from "react/jsx-runtime";
8204
8250
  var WavelengthMultiSelectAutocomplete = ({ options, placeholder = "Select Options", label, name, style: style3, onChange, value, disabled, ...rest }) => {
8205
- const componentRef = useRef30(null);
8206
- useEffect32(() => {
8251
+ const componentRef = useRef31(null);
8252
+ useEffect33(() => {
8207
8253
  const component = componentRef.current;
8208
8254
  if (!component) return;
8209
8255
  const handleValueChange = (event) => {
@@ -8216,7 +8262,7 @@ var WavelengthMultiSelectAutocomplete = ({ options, placeholder = "Select Option
8216
8262
  component.removeEventListener("change", handleValueChange);
8217
8263
  };
8218
8264
  }, [onChange]);
8219
- useEffect32(() => {
8265
+ useEffect33(() => {
8220
8266
  const component = componentRef.current;
8221
8267
  if (!component) return;
8222
8268
  if (placeholder) component.setAttribute("placeholder", placeholder);
@@ -8226,7 +8272,7 @@ var WavelengthMultiSelectAutocomplete = ({ options, placeholder = "Select Option
8226
8272
  if (options) component.autocompleteOptions = options;
8227
8273
  if (style3) component.customStyles = style3;
8228
8274
  }, [options, placeholder, name, label, style3]);
8229
- useEffect32(() => {
8275
+ useEffect33(() => {
8230
8276
  const component = componentRef.current;
8231
8277
  if (component && value) {
8232
8278
  component.value = value;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wavelengthusaf/components",
3
3
  "author": "563 EWS - Wavelength",
4
4
  "license": "MIT",
5
- "version": "4.15.0",
5
+ "version": "4.17.0",
6
6
  "description": "Common component library used by Wavelength developers",
7
7
  "main": "/dist/cjs/index.cjs",
8
8
  "module": "/dist/esm/index.js",
@@ -71,7 +71,7 @@
71
71
  "@emotion/styled": "^11.11.0",
72
72
  "@mui/icons-material": "^5.16.5",
73
73
  "@mui/material": "^5.15.7",
74
- "@wavelengthusaf/web-components": "^1.17.0",
74
+ "@wavelengthusaf/web-components": "^1.19.0",
75
75
  "react": "^18.2.0",
76
76
  "react-router-dom": "^6.26.2",
77
77
  "styled-components": "^6.1.12",