@wavelengthusaf/components 2.9.3 → 2.10.1

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.
@@ -579,4 +579,9 @@ type Props<T> = {
579
579
  };
580
580
  declare const WavelengthDataTable: <T extends DataType>({ data, columns, itemsPerPage, totalPages }: Props<T>) => react_jsx_runtime.JSX.Element;
581
581
 
582
- export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAccessAlert, WavelengthAlert, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, type WavelengthButtonProps, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPermissionAlert, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
582
+ interface SampleComponentProps extends React__default.HTMLAttributes<HTMLElement> {
583
+ testProp?: string;
584
+ }
585
+ declare const SampleComponent: React__default.FC<SampleComponentProps>;
586
+
587
+ export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, SampleComponent, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAccessAlert, WavelengthAlert, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, type WavelengthButtonProps, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPermissionAlert, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
@@ -579,4 +579,9 @@ type Props<T> = {
579
579
  };
580
580
  declare const WavelengthDataTable: <T extends DataType>({ data, columns, itemsPerPage, totalPages }: Props<T>) => react_jsx_runtime.JSX.Element;
581
581
 
582
- export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAccessAlert, WavelengthAlert, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, type WavelengthButtonProps, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPermissionAlert, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
582
+ interface SampleComponentProps extends React__default.HTMLAttributes<HTMLElement> {
583
+ testProp?: string;
584
+ }
585
+ declare const SampleComponent: React__default.FC<SampleComponentProps>;
586
+
587
+ export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, SampleComponent, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAccessAlert, WavelengthAlert, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, type WavelengthButtonProps, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPermissionAlert, 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
@@ -1182,6 +1182,48 @@ var require_react_is2 = __commonJS({
1182
1182
  }
1183
1183
  });
1184
1184
 
1185
+ // src/web-components/sample-component.ts
1186
+ var template = document.createElement("template");
1187
+ template.innerHTML = `
1188
+ <style>
1189
+ :host {
1190
+ display: block;
1191
+ /* Define component defaults here */
1192
+ }
1193
+ </style>
1194
+ <div class="content">
1195
+ <slot></slot> <!-- Enables user-defined inner HTML -->
1196
+ </div>
1197
+ `;
1198
+ var SampleComponent = class extends HTMLElement {
1199
+ // List of attributes to observe for changes
1200
+ static get observedAttributes() {
1201
+ return ["test-prop"];
1202
+ }
1203
+ constructor() {
1204
+ super();
1205
+ this.shadow = this.attachShadow({ mode: "open" });
1206
+ this.shadow.append(template.content.cloneNode(true));
1207
+ }
1208
+ // Called when component is inserted into the DOM
1209
+ connectedCallback() {
1210
+ this.updateComponent();
1211
+ }
1212
+ // Called when observed attributes change
1213
+ attributeChangedCallback() {
1214
+ this.updateComponent();
1215
+ }
1216
+ // Main update logic; Your component's functionality will go here and/or in other methods that you have below
1217
+ updateComponent() {
1218
+ const prop = this.getAttribute("test-prop") || "";
1219
+ const container = this.shadow.querySelector(".content");
1220
+ if (container) container.textContent = prop;
1221
+ }
1222
+ };
1223
+ if (!customElements.get("sample-component")) {
1224
+ customElements.define("sample-component", SampleComponent);
1225
+ }
1226
+
1185
1227
  // src/web-components/wavelength-banner.ts
1186
1228
  var WavelengthBanner = class extends HTMLElement {
1187
1229
  static get observedAttributes() {
@@ -1238,6 +1280,78 @@ if (!customElements.get("wavelength-banner")) {
1238
1280
  }
1239
1281
 
1240
1282
  // src/web-components/wavelength-button.ts
1283
+ var buttonTemplate = document.createElement("template");
1284
+ buttonTemplate.innerHTML = `
1285
+ <style>
1286
+ :host {
1287
+ display: inline-flex;
1288
+ }
1289
+
1290
+ button {
1291
+ display: inline-flex;
1292
+ align-items: center;
1293
+ justify-content: center;
1294
+ position: relative;
1295
+ overflow: hidden;
1296
+ border: none;
1297
+ border-radius: 0.25rem;
1298
+ cursor: pointer;
1299
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
1300
+ font-weight: 500;
1301
+ font-size: 0.875rem;
1302
+ letter-spacing: 0.02857rem;
1303
+ text-transform: uppercase;
1304
+ user-select: none;
1305
+ white-space: normal;
1306
+ word-break: break-word;
1307
+ text-align: center;
1308
+ height: auto;
1309
+ }
1310
+
1311
+ button .ripple {
1312
+ position: absolute;
1313
+ border-radius: 50%;
1314
+ transform: scale(0);
1315
+ animation: ripple 600ms linear;
1316
+ pointer-events: none;
1317
+ z-index: 0;
1318
+ }
1319
+
1320
+ button .label {
1321
+ position: relative;
1322
+ z-index: 1;
1323
+ display: block;
1324
+ width: 100%;
1325
+ }
1326
+
1327
+ @keyframes ripple {
1328
+ to {
1329
+ transform: scale(4);
1330
+ opacity: 0;
1331
+ }
1332
+ }
1333
+
1334
+ button.contained {
1335
+ box-shadow: 0rem 0.125rem 0.25rem -0.063rem #000000;
1336
+ }
1337
+
1338
+ button.contained:hover,
1339
+ button.outlined:hover,
1340
+ button.text:hover {
1341
+ opacity: 0.96;
1342
+ transition: background-color 300ms ease-in-out;
1343
+ }
1344
+
1345
+ button:disabled {
1346
+ opacity: 0.5;
1347
+ pointer-events: none;
1348
+ }
1349
+ </style>
1350
+
1351
+ <button>
1352
+ <span class="label"><slot>LABEL</slot></span>
1353
+ </button>
1354
+ `;
1241
1355
  var WavelengthButton = class extends HTMLElement {
1242
1356
  constructor() {
1243
1357
  super();
@@ -1246,76 +1360,14 @@ var WavelengthButton = class extends HTMLElement {
1246
1360
  this.handleHoverOut = () => {
1247
1361
  };
1248
1362
  const shadow = this.attachShadow({ mode: "open" });
1249
- this.button = document.createElement("button");
1250
- const style3 = document.createElement("style");
1251
- style3.textContent = `
1252
- :host {
1253
- display: inline-flex;
1254
- }
1255
-
1256
- button {
1257
- display: inline-flex;
1258
- align-items: center;
1259
- justify-content: center;
1260
- position: relative;
1261
- overflow: hidden;
1262
- border: none;
1263
- border-radius: 0.25rem;
1264
- cursor: pointer;
1265
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
1266
- font-weight: 500;
1267
- font-size: 0.875rem;
1268
- letter-spacing: 0.02857rem;
1269
- text-transform: uppercase;
1270
- user-select: none;
1271
- white-space: normal;
1272
- word-break: break-word;
1273
- text-align: center;
1274
- height: auto;
1275
- }
1276
-
1277
- button .ripple {
1278
- position: absolute;
1279
- border-radius: 50%;
1280
- transform: scale(0);
1281
- animation: ripple 600ms linear;
1282
- pointer-events: none;
1283
- z-index: 0;
1284
- }
1285
-
1286
- button .label {
1287
- position: relative;
1288
- z-index: 1;
1289
- display: block;
1290
- width: 100%;
1291
- }
1292
-
1293
- @keyframes ripple {
1294
- to {
1295
- transform: scale(4);
1296
- opacity: 0;
1297
- }
1298
- }
1299
-
1300
- button.contained {
1301
- box-shadow: 0rem 0.125rem 0.25rem -0.063rem #000000;
1302
- }
1303
-
1304
- button.contained:hover,
1305
- button.outlined:hover,
1306
- button.text:hover {
1307
- opacity: 0.96;
1308
- transition: background-color 300ms ease-in-out;
1309
- }
1310
-
1311
- button:disabled {
1312
- opacity: 0.5;
1313
- pointer-events: none;
1314
- }
1315
- `;
1316
- this.button.addEventListener("click", this.handleRipple.bind(this));
1317
- shadow.appendChild(style3);
1318
- shadow.appendChild(this.button);
1363
+ shadow.appendChild(buttonTemplate.content.cloneNode(true));
1364
+ this.button = shadow.querySelector("button");
1365
+ this.button.addEventListener("click", (event) => {
1366
+ this.handleRipple(event);
1367
+ if (!this.getAttribute("href")) {
1368
+ this.dispatchEvent(new MouseEvent("click", { bubbles: true, composed: true }));
1369
+ }
1370
+ });
1319
1371
  }
1320
1372
  static get observedAttributes() {
1321
1373
  return ["variant", "size", "margin", "padding", "color-one", "color-two", "font-size", "disabled", "border-radius", "href", "width", "height", "box-shadow", "target"];
@@ -1352,15 +1404,8 @@ var WavelengthButton = class extends HTMLElement {
1352
1404
  } else {
1353
1405
  this.applyPresetSize(size);
1354
1406
  }
1355
- if (width2) {
1356
- this.button.style.width = width2;
1357
- }
1358
- if (height2) {
1359
- this.button.style.height = height2;
1360
- } else {
1361
- this.button.style.height = "auto";
1362
- }
1363
- this.button.innerHTML = `<span class="label"><slot>LABEL</slot></span>`;
1407
+ if (width2) this.button.style.width = width2;
1408
+ this.button.style.height = height2;
1364
1409
  if (variant === "contained") {
1365
1410
  this.button.style.backgroundColor = colorOne;
1366
1411
  this.button.style.color = colorTwo;
@@ -1371,7 +1416,7 @@ var WavelengthButton = class extends HTMLElement {
1371
1416
  this.button.style.color = colorOne;
1372
1417
  this.button.style.border = `0.063rem solid ${colorOne}`;
1373
1418
  this.button.style.boxShadow = boxShadow || "none";
1374
- } else if (variant === "text") {
1419
+ } else {
1375
1420
  this.button.style.backgroundColor = "transparent";
1376
1421
  this.button.style.color = colorOne;
1377
1422
  this.button.style.border = "none";
@@ -1388,7 +1433,7 @@ var WavelengthButton = class extends HTMLElement {
1388
1433
  this.handleHoverIn = () => {
1389
1434
  if (variant === "contained") {
1390
1435
  this.button.style.backgroundColor = this.shadeColor(colorOne, -15);
1391
- } else if (variant === "outlined" || variant === "text") {
1436
+ } else {
1392
1437
  this.button.style.backgroundColor = this.hexToRgba(colorOne, 0.05);
1393
1438
  }
1394
1439
  };
@@ -1441,24 +1486,17 @@ var WavelengthButton = class extends HTMLElement {
1441
1486
  if (this.button.disabled) return;
1442
1487
  const variant = this.getAttribute("variant") || "outlined";
1443
1488
  const colorOne = this.getAttribute("color-one") || "#1976D2";
1444
- let rippleColor = "rgba(0,0,0,0.2)";
1445
- if (variant === "contained") {
1446
- rippleColor = this.hexToRgba(this.shadeColor(colorOne, 40), 0.6);
1447
- } else {
1448
- rippleColor = this.hexToRgba(this.shadeColor(colorOne, -40), 0.3);
1449
- }
1450
1489
  const ripple = document.createElement("span");
1451
1490
  ripple.className = "ripple";
1452
- ripple.style.backgroundColor = rippleColor;
1491
+ const color2 = variant === "contained" ? this.hexToRgba(this.shadeColor(colorOne, 40), 0.6) : this.hexToRgba(this.shadeColor(colorOne, -40), 0.3);
1492
+ ripple.style.backgroundColor = color2;
1453
1493
  const rect = this.button.getBoundingClientRect();
1454
1494
  const size = Math.max(rect.width, rect.height);
1455
1495
  ripple.style.width = ripple.style.height = `${size}px`;
1456
1496
  ripple.style.left = `${event.clientX - rect.left - size / 2}px`;
1457
1497
  ripple.style.top = `${event.clientY - rect.top - size / 2}px`;
1458
1498
  this.button.appendChild(ripple);
1459
- setTimeout(() => {
1460
- ripple.remove();
1461
- }, 600);
1499
+ setTimeout(() => ripple.remove(), 600);
1462
1500
  }
1463
1501
  };
1464
1502
  if (!customElements.get("wavelength-button")) {
@@ -1675,13 +1713,14 @@ var WavelengthButton2 = ({
1675
1713
  setAttr("href", href);
1676
1714
  setAttr("target", target);
1677
1715
  setAttr("box-shadow", boxShadow);
1678
- disabled ? el.setAttribute("disabled", "") : el.removeAttribute("disabled");
1716
+ if (disabled) el.setAttribute("disabled", "");
1717
+ else el.removeAttribute("disabled");
1679
1718
  const handleClick = (e) => {
1680
1719
  onClick?.(e);
1681
1720
  };
1682
1721
  el.addEventListener("click", handleClick);
1683
1722
  return () => el.removeEventListener("click", handleClick);
1684
- }, [variant, size, height2, width2, margin2, padding2, colorOne, colorTwo, fontSize, borderRadius2, disabled, href, onClick]);
1723
+ }, [variant, size, height2, width2, margin2, padding2, colorOne, colorTwo, fontSize, borderRadius2, disabled, href, onClick, boxShadow, target]);
1685
1724
  return /* @__PURE__ */ jsx("wavelength-button", { ref, className, style: style3, ...rest, children });
1686
1725
  };
1687
1726
 
@@ -7176,6 +7215,26 @@ var WavelengthDataTable = ({ data, columns, itemsPerPage, totalPages }) => {
7176
7215
  /* @__PURE__ */ jsx41(StyledNavBoxDiv, { children: /* @__PURE__ */ jsx41(WavelengthPagination_default, { totalPages, currentPageNumber: currentPage, onPageChange: setCurrentPage, style: "circular" }) })
7177
7216
  ] });
7178
7217
  };
7218
+
7219
+ // src/components/samples/SampleComponent.tsx
7220
+ import { useRef as useRef7, useEffect as useEffect8 } from "react";
7221
+ import { jsx as jsx42 } from "react/jsx-runtime";
7222
+ var SampleComponent2 = ({
7223
+ testProp,
7224
+ children,
7225
+ ...rest
7226
+ // This rest operator includes className, style, onClick, etc.
7227
+ }) => {
7228
+ const ref = useRef7(null);
7229
+ useEffect8(() => {
7230
+ const el = ref.current;
7231
+ if (!el) return;
7232
+ if (testProp !== void 0) {
7233
+ el.setAttribute("test-prop", testProp);
7234
+ }
7235
+ }, [testProp]);
7236
+ return /* @__PURE__ */ jsx42("sample-component", { ref, ...rest, children });
7237
+ };
7179
7238
  export {
7180
7239
  AppLogo,
7181
7240
  ButtonIcon,
@@ -7185,6 +7244,7 @@ export {
7185
7244
  DefaultPagination,
7186
7245
  ManyPlanesComponent,
7187
7246
  NotAvailablePage,
7247
+ SampleComponent2 as SampleComponent,
7188
7248
  SearchTextField,
7189
7249
  SliderCardCarousel,
7190
7250
  TestSnackbar,