@pantheon-systems/pds-toolkit-react 2.0.0-alpha.34 → 2.0.0-alpha.35

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.
Files changed (47) hide show
  1. package/bin/pds-codemod.cjs +58 -0
  2. package/codemods/v1-to-v2/mappings.json +1258 -0
  3. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.input.tsx +36 -0
  4. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.output.tsx +36 -0
  5. package/codemods/v1-to-v2/transforms/__tests__/prop-value-standardization.test.js +6 -0
  6. package/codemods/v1-to-v2/transforms/prop-value-standardization.js +112 -0
  7. package/dist/components/Table/Table.d.ts +107 -1
  8. package/dist/components/buttons/SegmentedButton/SegmentedButton.d.ts +6 -5
  9. package/dist/components/icons/Icon/generated-icon-data.d.ts +16 -2
  10. package/dist/css/component-css/pds-button-nav.css +1 -1
  11. package/dist/css/component-css/pds-datepicker.css +1 -1
  12. package/dist/css/component-css/pds-drawer.css +1 -1
  13. package/dist/css/component-css/pds-dropdown-menu.css +1 -1
  14. package/dist/css/component-css/pds-index.css +19 -15
  15. package/dist/css/component-css/pds-menu-button.css +1 -1
  16. package/dist/css/component-css/pds-nav-menu.css +1 -1
  17. package/dist/css/component-css/pds-navbar.css +1 -1
  18. package/dist/css/component-css/pds-pagination-mini.css +1 -1
  19. package/dist/css/component-css/pds-panel-list.css +1 -1
  20. package/dist/css/component-css/pds-panel.css +1 -1
  21. package/dist/css/component-css/pds-segmented-button.css +1 -1
  22. package/dist/css/component-css/pds-side-nav-global.css +1 -1
  23. package/dist/css/component-css/pds-side-nav.css +1 -1
  24. package/dist/css/component-css/pds-site-footer.css +1 -1
  25. package/dist/css/component-css/pds-sortable-list.css +1 -1
  26. package/dist/css/component-css/pds-status-checker.css +1 -1
  27. package/dist/css/component-css/pds-stepper.css +3 -1
  28. package/dist/css/component-css/pds-table-of-contents.css +1 -1
  29. package/dist/css/component-css/pds-table.css +3 -1
  30. package/dist/css/component-css/pds-tally.css +1 -1
  31. package/dist/css/component-css/pds-theme-switcher.css +1 -1
  32. package/dist/css/component-css/pds-tree-nav.css +1 -1
  33. package/dist/css/component-css/pds-user-menu.css +2 -2
  34. package/dist/css/component-css/pds-utility-button.css +1 -1
  35. package/dist/css/component-css/pds-workspace-selector.css +1 -1
  36. package/dist/css/design-tokens/variables.dark.css +31 -21
  37. package/dist/css/design-tokens/variables.light.css +32 -22
  38. package/dist/css/pds-components.css +19 -15
  39. package/dist/css/pds-core.css +2 -2
  40. package/dist/index.css +1 -1
  41. package/dist/index.js +227 -133
  42. package/dist/index.js.map +1 -1
  43. package/dist/libs/types/layout-types.d.ts +1 -1
  44. package/dist/svg/anglesDown.svg +3 -0
  45. package/dist/svg/anglesUp.svg +3 -0
  46. package/dist/utilities/FlexContainer/FlexContainer.d.ts +2 -1
  47. package/package.json +17 -2
package/dist/index.js CHANGED
@@ -116,6 +116,17 @@ var X = (e) => {
116
116
  svgPathData: "M241.5 239c9.4 9.4 9.4 24.6 0 33.9L81.5 433c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l143-143-143-143c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l160 160z",
117
117
  width: 256
118
118
  },
119
+ anglesDown: {
120
+ aliases: [
121
+ "chevrons down",
122
+ "double down",
123
+ "scroll to bottom"
124
+ ],
125
+ categories: ["arrows"],
126
+ height: 512,
127
+ svgPathData: "M369.5 113l-160 160c-9.4 9.4-24.6 9.4-33.9 0L15.5 113c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l143 143 143-143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9zm0 192l-160 160c-9.4 9.4-24.6 9.4-33.9 0L15.5 305c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l143 143 143-143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z",
128
+ width: 384
129
+ },
119
130
  anglesLeft: {
120
131
  aliases: ["chevrons left", "double left"],
121
132
  categories: ["arrows"],
@@ -130,6 +141,17 @@ var X = (e) => {
130
141
  svgPathData: "M81.5 433l160-160c9.4-9.4 9.4-24.6 0-33.9L81.5 79c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l143 143-143 143c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0zm192 0l160-160c9.4-9.4 9.4-24.6 0-33.9L273.5 79c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l143 143-143 143c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0z",
131
142
  width: 448
132
143
  },
144
+ anglesUp: {
145
+ aliases: [
146
+ "chevrons up",
147
+ "double up",
148
+ "scroll to top"
149
+ ],
150
+ categories: ["arrows"],
151
+ height: 512,
152
+ svgPathData: "M209.5 47c-9.4-9.4-24.6-9.4-33.9 0L15.5 207c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l143-143 143 143c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L209.5 47zm160 352l-160-160c-9.4-9.4-24.6-9.4-33.9 0L15.5 399c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l143-143 143 143c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9z",
153
+ width: 384
154
+ },
133
155
  angleUp: {
134
156
  aliases: ["chevron up"],
135
157
  categories: ["arrows"],
@@ -2138,7 +2160,7 @@ var X = (e) => {
2138
2160
  svgPathData: "M549.7 124.1C543.5 100.4 524.9 81.8 501.4 75.5 458.9 64 288.1 64 288.1 64S117.3 64 74.7 75.5C51.2 81.8 32.7 100.4 26.4 124.1 15 167 15 256.4 15 256.4s0 89.4 11.4 132.3c6.3 23.6 24.8 41.5 48.3 47.8 42.6 11.5 213.4 11.5 213.4 11.5s170.8 0 213.4-11.5c23.5-6.3 42-24.2 48.3-47.8 11.4-42.9 11.4-132.3 11.4-132.3s0-89.4-11.4-132.3zM232.2 337.6l0-162.4 142.7 81.2-142.7 81.2z",
2139
2161
  width: 576
2140
2162
  }
2141
- }, Oe = /* @__PURE__ */ "angleDown.angleLeft.angleRight.anglesLeft.anglesRight.angleUp.arrowDownLeftAndArrowUpRightToCenter.arrowDownToLine.arrowLeft.arrowRight.arrowsRetweet.arrowsUpDownLeftRight.asterisk.banBug.bars.barsFilter.barsStaggered.bell.billboard.bitbucket.bluesky.bolt.boltPantheon.boltSolid.book.books.bracketRight.bracketsSquare.brainCircuit.broomWide.building.buildings.bullhorn.calendarDays.caretDown.caretLeft.caretRight.caretUp.ccAmex.ccApplePay.ccDiscover.ccGeneric.ccMC.ccPaypal.ccVisa.chartLine.chartNetwork.chartSimple.check.circle.circleCheck.circleExclamation.circleExclamationSolid.circleInfo.circleInfoSolid.circleMinus.circleNotch.circlePlus.circleQuestion.circleQuestionSolid.circleUser.circleXmark.cloud.cloudArrowDown.cloudArrowUp.cloudPlus.code.codeBranch.codeMerge.command.comment.compress.copy.desktop.diamondExclamation.diamonds4.discourse.display.dollarSign.download.drupal.ellipsis.ellipsisVertical.emptySet.envelope.envelopeOpen.exclamation.expand.expandFromCenter.externalLink.eye.eyeSlash.facebook.file.fileCheck.fileContract.fileCSV.fileDiff.fileExport.fileImport.fileLines.filePDF.fileZip.folder.folderTree.gear.gem.github.gitlab.globe.graduationCap.grid.gripDots.gripDotsVertical.heart.heartSolid.house.idCard.image.inputText.instagram.keySkeleton.landmark.laptop.laptopCode.leaf.lifeRing.linkedin.linkSimple.linkSimpleSlash.listCheck.locationCrosshairs.lock.lockOpen.magnifyingGlass.medal.memo.messages.minus.moon.nextJs.paperclip.paperPlane.pause.pen.penField.phone.play.plus.question.quotesLeft.quotesRight.rectangleList.reply.robot.rocketLaunch.rotate.rotateClock.rotateLeft.rotateRight.rss.save.server.shareNodes.shield.shieldQuartered.shovel.sidebar.siren.sirenOn.sitemap.slack.slashForward.slidersSimple.snowflake.sparkles.squareCheck.squareCode.squareMinus.squarePen.squareQuestion.squareTerminal.star.starSolid.sun.sunBright.table.tableRows.terminal.text.threads.thumbsDown.thumbsUp.trash.triangleExclamation.twitter.upload.user.userAstronaut.userGear.userPlus.users.video.wavePulse.windowRestore.wordpress.wreathLaurel.wrench.xmark.xmarkLarge.xTwitter.youtube".split("."), Q = ({ className: t, display: n = "inline-block", iconName: r, size: i = "l", style: a, verticalAlign: o = "middle", ...s }) => {
2163
+ }, Oe = /* @__PURE__ */ "angleDown.angleLeft.angleRight.anglesDown.anglesLeft.anglesRight.anglesUp.angleUp.arrowDownLeftAndArrowUpRightToCenter.arrowDownToLine.arrowLeft.arrowRight.arrowsRetweet.arrowsUpDownLeftRight.asterisk.banBug.bars.barsFilter.barsStaggered.bell.billboard.bitbucket.bluesky.bolt.boltPantheon.boltSolid.book.books.bracketRight.bracketsSquare.brainCircuit.broomWide.building.buildings.bullhorn.calendarDays.caretDown.caretLeft.caretRight.caretUp.ccAmex.ccApplePay.ccDiscover.ccGeneric.ccMC.ccPaypal.ccVisa.chartLine.chartNetwork.chartSimple.check.circle.circleCheck.circleExclamation.circleExclamationSolid.circleInfo.circleInfoSolid.circleMinus.circleNotch.circlePlus.circleQuestion.circleQuestionSolid.circleUser.circleXmark.cloud.cloudArrowDown.cloudArrowUp.cloudPlus.code.codeBranch.codeMerge.command.comment.compress.copy.desktop.diamondExclamation.diamonds4.discourse.display.dollarSign.download.drupal.ellipsis.ellipsisVertical.emptySet.envelope.envelopeOpen.exclamation.expand.expandFromCenter.externalLink.eye.eyeSlash.facebook.file.fileCheck.fileContract.fileCSV.fileDiff.fileExport.fileImport.fileLines.filePDF.fileZip.folder.folderTree.gear.gem.github.gitlab.globe.graduationCap.grid.gripDots.gripDotsVertical.heart.heartSolid.house.idCard.image.inputText.instagram.keySkeleton.landmark.laptop.laptopCode.leaf.lifeRing.linkedin.linkSimple.linkSimpleSlash.listCheck.locationCrosshairs.lock.lockOpen.magnifyingGlass.medal.memo.messages.minus.moon.nextJs.paperclip.paperPlane.pause.pen.penField.phone.play.plus.question.quotesLeft.quotesRight.rectangleList.reply.robot.rocketLaunch.rotate.rotateClock.rotateLeft.rotateRight.rss.save.server.shareNodes.shield.shieldQuartered.shovel.sidebar.siren.sirenOn.sitemap.slack.slashForward.slidersSimple.snowflake.sparkles.squareCheck.squareCode.squareMinus.squarePen.squareQuestion.squareTerminal.star.starSolid.sun.sunBright.table.tableRows.terminal.text.threads.thumbsDown.thumbsUp.trash.triangleExclamation.twitter.upload.user.userAstronaut.userGear.userPlus.users.video.wavePulse.windowRestore.wordpress.wreathLaurel.wrench.xmark.xmarkLarge.xTwitter.youtube".split("."), Q = ({ className: t, display: n = "inline-block", iconName: r, size: i = "l", style: a, verticalAlign: o = "middle", ...s }) => {
2142
2164
  let c = "pds-icon", l = `${c} ${c}--${i} ${c}--${r}`, u = De[r], d = `0 0 ${u.width} ${u.height}`, f = r in Ee ? Ee[r] : null, p;
2143
2165
  if (f?.type === "complex") p = f.render();
2144
2166
  else {
@@ -3157,38 +3179,41 @@ var Fe = "7rem", Ie = "10rem", Le = "8rem", Re = "6rem", ze = "5rem", Be = "4rem
3157
3179
  role: "menu"
3158
3180
  }, c.map((e, t) => I(e, t)))), z, S && L(c));
3159
3181
  }, Jt = ({ className: t, defaultValue: n, disabled: r = !1, id: i, label: a, onChange: o, options: s, size: c = "s", value: l, ...u }) => {
3160
- let d = "pds-segmented-button", f = r ? "pds-is-disabled" : null, p = `${d}--${c}`, m = c === "s" ? "s" : "m", g = l !== void 0, [_, v] = h(n === void 0 ? "" : n), y = (e) => {
3161
- v(e.target.value), o && o(e.target.value);
3182
+ let d = "pds-segmented-button", f = l !== void 0, [p, m] = h(n === void 0 ? "" : n), g = (e) => {
3183
+ m(e.target.value), o?.(e.target.value);
3162
3184
  };
3163
- if (s.length >= 2 && s.length <= 6) return /* @__PURE__ */ e.createElement("fieldset", {
3185
+ return s.length < 2 || s.length > 6 ? null : /* @__PURE__ */ e.createElement("fieldset", {
3164
3186
  className: Z([
3165
3187
  d,
3166
- p,
3167
- f,
3188
+ `${d}--${c}`,
3168
3189
  t ?? ""
3169
3190
  ]),
3170
3191
  ...u
3171
3192
  }, /* @__PURE__ */ e.createElement("legend", { className: "visually-hidden" }, a), /* @__PURE__ */ e.createElement("div", { className: `${d}__options` }, s.map((t, n) => {
3172
- let a = g ? l === t.value : _ === t.value, o = `${d}__option`, s = a ? `${o}--checked` : null;
3193
+ let a = f ? l === t.value : p === t.value, o = r || !!t.disabled, s = t.id ?? `${i}-option-${n}`, u = c === "s" ? "m" : "l";
3173
3194
  return /* @__PURE__ */ e.createElement("div", {
3174
- key: `${i}-option-${n}`,
3175
- className: Z([o, s])
3195
+ key: s,
3196
+ className: Z([
3197
+ `${d}__option`,
3198
+ a ? `${d}__option--checked` : null,
3199
+ o ? `${d}__option--disabled` : null
3200
+ ])
3176
3201
  }, /* @__PURE__ */ e.createElement("input", {
3177
3202
  checked: a,
3178
3203
  className: "visually-hidden",
3179
- disabled: r || t.disabled,
3180
- id: t.id ? t.id : `${i}-option-${n}`,
3204
+ disabled: o,
3205
+ id: s,
3181
3206
  name: i,
3182
- onChange: y,
3207
+ onChange: g,
3183
3208
  type: "radio",
3184
3209
  value: t.value
3185
3210
  }), /* @__PURE__ */ e.createElement("label", {
3186
- htmlFor: t.id ? t.id : `${i}-option-${n}`,
3211
+ htmlFor: s,
3187
3212
  title: t.label
3188
3213
  }, t.iconName && /* @__PURE__ */ e.createElement(Q, {
3189
3214
  className: `${d}__icon`,
3190
3215
  iconName: t.iconName,
3191
- size: m
3216
+ size: u
3192
3217
  }), /* @__PURE__ */ e.createElement("span", { className: `${d}__label-text` }, t.label), t.tally && /* @__PURE__ */ e.createElement(Pe, {
3193
3218
  className: `${d}__tally`,
3194
3219
  label: t.tally.label,
@@ -8326,70 +8351,70 @@ var Kn = ({ className: t, platform: n, videoId: r, videoTitle: i, ...a }) => {
8326
8351
  exit: "pds-toast--slideOut"
8327
8352
  })
8328
8353
  ], mi = ({ ariaLabel: t, children: n, className: r, closeButtonLabel: i = "Close drawer", disableOutsideClick: a, hasCloseButton: o = !0, isOpen: c = !1, placement: u = "right", setIsOpen: d = () => {}, size: f = "m", title: p, width: g, ..._ }) => {
8329
- let v = "pds-drawer", y = g ? null : `${v}--${f}`, b = `${v}--${u}`, x = g ? { width: g } : void 0, [S, C] = h(c), [w, T] = h(!1), E = m(null), { closeOverlay: D, openOverlay: O } = ft();
8354
+ let v = X(n), y = v.__unslotted, b = v.footer, x = "pds-drawer", S = g ? null : `${x}--${f}`, C = `${x}--${u}`, w = g ? { width: g } : void 0, [T, E] = h(c), [D, O] = h(!1), k = m(null), { closeOverlay: A, openOverlay: j } = ft();
8330
8355
  l(() => {
8331
- c ? C(!0) : T(!1);
8356
+ c ? E(!0) : O(!1);
8332
8357
  }, [c]), l(() => {
8333
- S && requestAnimationFrame(() => {
8358
+ T && requestAnimationFrame(() => {
8334
8359
  requestAnimationFrame(() => {
8335
- T(!0);
8360
+ O(!0);
8336
8361
  });
8337
8362
  });
8338
- }, [S]), l(() => {
8339
- d(S);
8340
- }, [S]), l(() => {
8341
- if (!(!O || !D) && S) return O(), () => D();
8363
+ }, [T]), l(() => {
8364
+ d(T);
8365
+ }, [T]), l(() => {
8366
+ if (!(!j || !A) && T) return j(), () => A();
8342
8367
  }, [
8343
- S,
8344
- O,
8345
- D
8368
+ T,
8369
+ j,
8370
+ A
8346
8371
  ]), l(() => {
8347
- if (S) return document.body.style.overflow = "hidden", () => {
8372
+ if (T) return document.body.style.overflow = "hidden", () => {
8348
8373
  document.body.style.overflow = "";
8349
8374
  };
8350
- }, [S]);
8351
- let k = s(() => {
8352
- T(!1);
8353
- }, []), A = s(() => {
8354
- w || C(!1);
8355
- }, [w]), j = s(() => {
8356
- a || k();
8357
- }, [a, k]);
8375
+ }, [T]);
8376
+ let M = s(() => {
8377
+ O(!1);
8378
+ }, []), N = s(() => {
8379
+ D || E(!1);
8380
+ }, [D]), P = s(() => {
8381
+ a || M();
8382
+ }, [a, M]);
8358
8383
  return l(() => {
8359
- if (!S) return;
8384
+ if (!T) return;
8360
8385
  let e = (e) => {
8361
- e.key === "Escape" && k();
8386
+ e.key === "Escape" && M();
8362
8387
  };
8363
8388
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
8364
- }, [S, k]), S ? ue(/* @__PURE__ */ e.createElement(Y, {
8365
- active: w,
8389
+ }, [T, M]), T ? ue(/* @__PURE__ */ e.createElement(Y, {
8390
+ active: D,
8366
8391
  focusTrapOptions: {
8367
8392
  clickOutsideDeactivates: !a,
8368
8393
  initialFocus: !1,
8369
8394
  escapeDeactivates: !1
8370
8395
  }
8371
- }, /* @__PURE__ */ e.createElement("div", { className: `${v}__wrapper` }, /* @__PURE__ */ e.createElement("div", {
8372
- className: Z([`${v}__overlay`, w ? `${v}__overlay--visible` : null]),
8373
- onClick: j
8396
+ }, /* @__PURE__ */ e.createElement("div", { className: `${x}__wrapper` }, /* @__PURE__ */ e.createElement("div", {
8397
+ className: Z([`${x}__overlay`, D ? `${x}__overlay--visible` : null]),
8398
+ onClick: P
8374
8399
  }), /* @__PURE__ */ e.createElement("div", {
8375
- ref: E,
8400
+ ref: k,
8376
8401
  "aria-label": t || (typeof p == "string" ? p : void 0),
8377
8402
  className: Z([
8378
- v,
8379
- y,
8380
- b,
8381
- w ? `${v}--open` : null,
8403
+ x,
8404
+ S,
8405
+ C,
8406
+ D ? `${x}--open` : null,
8382
8407
  r
8383
8408
  ]),
8384
- onTransitionEnd: A,
8409
+ onTransitionEnd: N,
8385
8410
  role: "dialog",
8386
- style: x,
8411
+ style: w,
8387
8412
  ..._
8388
- }, /* @__PURE__ */ e.createElement("div", { className: `${v}__header` }, p && /* @__PURE__ */ e.createElement("div", { className: `${v}__title` }, p), o && /* @__PURE__ */ e.createElement(It, {
8413
+ }, /* @__PURE__ */ e.createElement("div", { className: `${x}__header` }, p && /* @__PURE__ */ e.createElement("div", { className: `${x}__title` }, p), o && /* @__PURE__ */ e.createElement(It, {
8389
8414
  ariaLabel: i,
8390
- onClick: k,
8415
+ onClick: M,
8391
8416
  size: "l"
8392
- })), /* @__PURE__ */ e.createElement("div", { className: `${v}__content` }, n)))), document.body) : null;
8417
+ })), /* @__PURE__ */ e.createElement("div", { className: `${x}__content` }, y), b && /* @__PURE__ */ e.createElement("div", { className: `${x}__footer` }, b)))), document.body) : null;
8393
8418
  }, hi = ({ ariaLabel: t, background: n = "default", children: r, className: i, closeButtonLabel: a = "Close", closeIconName: o = "compress", hasCloseButton: s = !0, isOpen: c, onClose: u, ...d }) => {
8394
8419
  let f = "pds-full-screen-overlay", p = n === "default" ? null : `${f}--bg-${n}`, { closeOverlay: m, openOverlay: h } = ft();
8395
8420
  l(() => {
@@ -9708,128 +9733,197 @@ var Yi = ({ children: t, className: n, columns: r, depth: i = 0, hasChildren: a
9708
9733
  className: Z([a, t ?? ""]),
9709
9734
  ...i
9710
9735
  }, /* @__PURE__ */ e.createElement("ol", { className: `${a}__steps` }, r && c));
9711
- }, na = ({ className: t, columns: n, currentPage: r, defaultSortKey: i, defaultSortOrder: a = "asc", emptyState: o, emptyStateHeading: s = "No results found.", emptyStateMessage: c, getPageSizeLabel: d = (e) => `Show ${e} rows per page`, getRowId: f, getSelectRowLabel: m = (e, t) => `Select row ${t}`, getSortLabel: g = (e) => `Sort by ${e}`, isLoading: _ = !1, itemsPerPage: v, loadingRowCount: y = 5, onPageChange: b, onPageSizeChange: x, onRowSelectionChange: S, onSort: C, pageSizeOptions: w, rowData: T, selectAllLabel: E = "Select all rows", selectedRows: D, sortKey: O, sortOrder: k, totalItemCount: A, ...j }) => {
9712
- let M = "pds-table", N = u(), P = u(), F = C !== void 0, I = b !== void 0, L = x !== void 0, R = I || v !== void 0 || w !== void 0, [z, B] = h({
9713
- key: i ?? "",
9714
- order: i === void 0 ? "asc" : a
9715
- }), [V, H] = h(1), [U, ee] = h(v ?? w?.[0] ?? 10), W = I ? v ?? 10 : U, G = (e) => {
9716
- L ? x(e) : ee(e), I || H(1);
9736
+ }, na = ({ className: t, closeDetailPanelLabel: n = "Close detail panel", columns: r, currentPage: i, defaultSortKey: a, defaultSortOrder: o = "asc", detailPanelNav: s = !0, detailPanelTitle: c, detailPanelWidth: d, emptyState: f, emptyStateHeading: m = "No results found.", emptyStateMessage: g, footer: _, getPageSizeLabel: v = (e) => `Show ${e} rows per page`, getRowClassName: y, getRowId: b, getSelectRowLabel: x = (e, t) => `Select row ${t}`, getSortLabel: S = (e) => `Sort by ${e}`, inspectedRowId: C, isLoading: w = !1, itemsPerPage: T, loadingRowCount: E = 5, nextDetailPanelRowLabel: D = "Next row", onDetailPanelNext: O, onDetailPanelPrev: k, onPageChange: A, onPageSizeChange: j, onRowInspect: M, onRowSelectionChange: N, onSort: P, pageSizeOptions: F, panel: I, prevDetailPanelRowLabel: L = "Previous row", renderDetailPanel: R, renderDetailPanelFooter: z, rowData: B, selectAllLabel: V = "Select all rows", selectedRows: H, sortKey: U, sortOrder: ee, totalItemCount: W, ...G }) => {
9737
+ let K = "pds-table", q = u(), te = u(), ne = P !== void 0, re = A !== void 0, J = j !== void 0, ie = re || T !== void 0 || F !== void 0, [ae, Y] = h({
9738
+ key: a ?? "",
9739
+ order: a === void 0 ? "asc" : o
9740
+ }), [oe, se] = h(1), [ce, le] = h(T ?? F?.[0] ?? 10), [ue, de] = h(null), fe = C ?? ue, pe = !!fe && !!R, me = re ? T ?? 10 : ce, he = (e) => {
9741
+ J ? j(e) : le(e), re || se(1);
9717
9742
  };
9718
9743
  l(() => {
9719
- I || H(1);
9720
- }, [T.length, I]), l(() => {
9721
- process.env.NODE_ENV !== "production" && r !== void 0 && !b && console.warn("[Table] `currentPage` was provided without `onPageChange`. Controlled pagination requires both props. The table is running in uncontrolled mode.");
9744
+ re || se(1);
9745
+ }, [B.length, re]), l(() => {
9746
+ process.env.NODE_ENV !== "production" && i !== void 0 && !A && console.warn("[Table] `currentPage` was provided without `onPageChange`. Controlled pagination requires both props. The table is running in uncontrolled mode.");
9722
9747
  }, []);
9723
- let K = S !== void 0, q = D !== void 0, [te, ne] = h(/* @__PURE__ */ new Set()), re = q ? new Set(D) : te, J = p(() => new Map(T.map((e, t) => [e, t])), [T]), ie = (e, t) => f ? f(e) : String(J.get(e) ?? t), ae = F ? O ?? "" : z.key, Y = F ? k ?? "asc" : z.order, oe = p(() => {
9724
- if (_) return [];
9725
- let e = T;
9726
- if (!F && z.key !== "") {
9727
- let t = n.find((e) => e.id === z.key)?.sortKey ?? z.key;
9748
+ let ge = N !== void 0, _e = H !== void 0, [ve, ye] = h(/* @__PURE__ */ new Set()), be = _e ? new Set(H) : ve, xe = p(() => new Map(B.map((e, t) => [e, t])), [B]), Se = (e, t) => b ? b(e) : String(xe.get(e) ?? t), Ce = p(() => B.findIndex((e, t) => (b ? b(e) : String(xe.get(e) ?? t)) === fe), [
9749
+ B,
9750
+ fe,
9751
+ b,
9752
+ xe
9753
+ ]), we = Ce >= 0 ? B[Ce] : null, X = (e, t) => {
9754
+ R && C === void 0 && de(t), M?.(e, t);
9755
+ }, Te = () => {
9756
+ C === void 0 && de(null);
9757
+ }, Ee = () => {
9758
+ if (Ce <= 0) return;
9759
+ let e = B[Ce - 1], t = Se(e, Ce - 1);
9760
+ C === void 0 && de(t), M?.(e, t), k?.(e, t);
9761
+ }, De = () => {
9762
+ if (Ce >= B.length - 1) return;
9763
+ let e = B[Ce + 1], t = Se(e, Ce + 1);
9764
+ C === void 0 && de(t), M?.(e, t), O?.(e, t);
9765
+ }, Oe = ne ? U ?? "" : ae.key, ke = ne ? ee ?? "asc" : ae.order, Ae = p(() => {
9766
+ if (w) return [];
9767
+ let e = B;
9768
+ if (!ne && ae.key !== "") {
9769
+ let t = r.find((e) => e.id === ae.key)?.sortKey ?? ae.key;
9728
9770
  e = [...e].sort((e, n) => {
9729
9771
  let r = String(e[t]).localeCompare(String(n[t]));
9730
- return z.order === "asc" ? r : -r;
9772
+ return ae.order === "asc" ? r : -r;
9731
9773
  });
9732
9774
  }
9733
- if (!I && R && W) {
9734
- let t = (V - 1) * W;
9735
- e = e.slice(t, t + W);
9775
+ if (!re && ie && me) {
9776
+ let t = (oe - 1) * me;
9777
+ e = e.slice(t, t + me);
9736
9778
  }
9737
9779
  return e;
9738
9780
  }, [
9739
- T,
9740
- z,
9741
- F,
9742
- I,
9743
- R,
9744
- V,
9745
- W,
9746
- _
9747
- ]), se = (e) => {
9748
- F ? C(e, O === e && k === "asc" ? "desc" : "asc") : B((t) => ({
9781
+ B,
9782
+ ae,
9783
+ ne,
9784
+ re,
9785
+ ie,
9786
+ oe,
9787
+ me,
9788
+ w
9789
+ ]), je = (e) => {
9790
+ ne ? P(e, U === e && ee === "asc" ? "desc" : "asc") : Y((t) => ({
9749
9791
  key: e,
9750
9792
  order: t.key === e && t.order === "asc" ? "desc" : "asc"
9751
9793
  }));
9752
- }, ce = (e) => ae === e ? Y === "asc" ? "ascending" : "descending" : "none", le = (e, t) => {
9753
- let n = ae === e, r = ae !== "" && !n, i = `${M}__sort-button-${t}`;
9754
- return t === "top" && r ? `${i}--inactive` : n && Y === "desc" ? `${i}--desc` : "";
9755
- }, ue = oe.map((e, t) => ie(e, t)), de = ue.length > 0 && ue.every((e) => re.has(e)), fe = !de && ue.some((e) => re.has(e)), pe = (e) => {
9756
- let t = new Set(re);
9757
- t.has(e) ? t.delete(e) : t.add(e), q || ne(t), S?.(Array.from(t));
9758
- }, me = () => {
9759
- let e = new Set(re);
9760
- de || fe ? ue.forEach((t) => e.delete(t)) : ue.forEach((t) => e.add(t)), q || ne(e), S?.(Array.from(e));
9761
- }, he = (t) => /* @__PURE__ */ e.createElement("tr", { key: `skeleton-${t}` }, K && /* @__PURE__ */ e.createElement("td", { className: "pds-table__checkbox-cell" }, /* @__PURE__ */ e.createElement(wn, {
9794
+ }, Me = (e) => Oe === e ? ke === "asc" ? "ascending" : "descending" : "none", Ne = (e, t) => {
9795
+ let n = `${K}__sort-button-${t}`, r = !w && Ae.length === 0;
9796
+ if (w || r || Oe === "") return t === "top" ? `${n}--inactive` : "";
9797
+ let i = Oe === e;
9798
+ return t === "top" ? i && ke === "asc" ? "" : `${n}--inactive` : i && ke === "desc" ? `${n}--desc` : "";
9799
+ }, Pe = Ae.map((e, t) => Se(e, t)), Fe = Pe.length > 0 && Pe.every((e) => be.has(e)), Ie = !Fe && Pe.some((e) => be.has(e)), Le = (e) => {
9800
+ let t = new Set(be);
9801
+ t.has(e) ? t.delete(e) : t.add(e), _e || ye(t), N?.(Array.from(t));
9802
+ }, Re = () => {
9803
+ let e = new Set(be);
9804
+ Fe || Ie ? Pe.forEach((t) => e.delete(t)) : Pe.forEach((t) => e.add(t)), _e || ye(e), N?.(Array.from(e));
9805
+ }, ze = (t) => /* @__PURE__ */ e.createElement("tr", { key: `skeleton-${t}` }, ge && /* @__PURE__ */ e.createElement("td", { className: "pds-table__checkbox-cell" }, /* @__PURE__ */ e.createElement(wn, {
9762
9806
  shape: "rounded",
9763
9807
  size: {
9764
9808
  height: 1,
9765
9809
  width: 1
9766
9810
  }
9767
- })), n.map((n) => /* @__PURE__ */ e.createElement("td", { key: `skeleton-${t}-${n.id}` }, /* @__PURE__ */ e.createElement(wn, {
9811
+ })), r.map((n) => /* @__PURE__ */ e.createElement("td", { key: `skeleton-${t}-${n.id}` }, /* @__PURE__ */ e.createElement(wn, {
9768
9812
  shape: "rounded",
9769
9813
  size: { height: 1 }
9770
- })))), ge = () => /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("td", {
9814
+ })))), Be = () => /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("td", {
9771
9815
  className: "pds-table__empty-cell",
9772
- colSpan: n.length + +!!K
9773
- }, o ?? /* @__PURE__ */ e.createElement(sn, {
9774
- heading: s,
9816
+ colSpan: r.length + +!!ge
9817
+ }, f ?? /* @__PURE__ */ e.createElement(sn, {
9818
+ heading: m,
9775
9819
  iconName: "emptySet",
9776
- message: c
9777
- }))), _e = (t, r) => {
9778
- let i = ie(t, r);
9779
- return /* @__PURE__ */ e.createElement("tr", { key: `row-${i}` }, K && /* @__PURE__ */ e.createElement("td", { className: "pds-table__checkbox-cell" }, /* @__PURE__ */ e.createElement($n, {
9780
- checked: re.has(i),
9781
- id: `${P}-row-${i}`,
9782
- label: m(t, r + 1),
9783
- onChange: () => pe(i),
9820
+ message: g
9821
+ }))), Ve = (t, n) => {
9822
+ let i = Se(t, n), a = M !== void 0 || R !== void 0, o = a && fe === i;
9823
+ return /* @__PURE__ */ e.createElement("tr", {
9824
+ key: `row-${i}`,
9825
+ "aria-selected": a ? o : void 0,
9826
+ className: Z([
9827
+ a ? `${K}__row--inspectable` : null,
9828
+ o ? `${K}__row--inspected` : null,
9829
+ y?.(t, i) ?? null
9830
+ ]),
9831
+ onClick: a ? () => X(t, i) : void 0,
9832
+ onKeyDown: a ? (e) => {
9833
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), X(t, i));
9834
+ } : void 0,
9835
+ tabIndex: a ? 0 : void 0
9836
+ }, ge && /* @__PURE__ */ e.createElement("td", { className: "pds-table__checkbox-cell" }, /* @__PURE__ */ e.createElement($n, {
9837
+ checked: be.has(i),
9838
+ id: `${te}-row-${i}`,
9839
+ label: x(t, n + 1),
9840
+ onChange: () => Le(i),
9784
9841
  showLabel: !1
9785
- })), n.map((n) => /* @__PURE__ */ e.createElement("td", { key: `${i}-${n.id}` }, t[n.id])));
9786
- };
9787
- return /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper" }, /* @__PURE__ */ e.createElement("table", {
9788
- "aria-busy": _,
9789
- className: Z([M, t]),
9790
- ...j
9791
- }, /* @__PURE__ */ e.createElement("thead", null, /* @__PURE__ */ e.createElement("tr", null, K && /* @__PURE__ */ e.createElement("th", { className: "pds-table__checkbox-cell" }, /* @__PURE__ */ e.createElement($n, {
9792
- checked: de,
9793
- id: P,
9794
- indeterminate: fe,
9795
- label: E,
9796
- onChange: me,
9842
+ })), r.map((n) => /* @__PURE__ */ e.createElement("td", { key: `${i}-${n.id}` }, t[n.id])));
9843
+ }, He = d ? { "--pds-detail-panel-width": d } : void 0, Ue = /* @__PURE__ */ e.createElement("div", { className: Z(["pds-table-wrapper", I ? "pds-table-wrapper--in-panel" : null]) }, /* @__PURE__ */ e.createElement("div", {
9844
+ className: Z(["pds-table-wrapper__content", pe ? "pds-table-wrapper__content--panel-open" : null]),
9845
+ style: He
9846
+ }, /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__table-column" }, /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__table-area" }, /* @__PURE__ */ e.createElement("table", {
9847
+ "aria-busy": w,
9848
+ className: Z([K, t]),
9849
+ ...G
9850
+ }, /* @__PURE__ */ e.createElement("thead", null, /* @__PURE__ */ e.createElement("tr", null, ge && /* @__PURE__ */ e.createElement("th", { className: "pds-table__checkbox-cell" }, /* @__PURE__ */ e.createElement($n, {
9851
+ checked: Fe,
9852
+ id: te,
9853
+ indeterminate: Ie,
9854
+ label: V,
9855
+ onChange: Re,
9797
9856
  showLabel: !1
9798
- })), n.map((t) => /* @__PURE__ */ e.createElement("th", {
9857
+ })), r.map((t) => /* @__PURE__ */ e.createElement("th", {
9799
9858
  key: t.id,
9800
- "aria-sort": t.sortable ? ce(t.id) : void 0
9859
+ "aria-sort": t.sortable ? Me(t.id) : void 0
9801
9860
  }, t.sortable ? /* @__PURE__ */ e.createElement("button", {
9802
- "aria-label": g(it(t.header)),
9803
- className: `${M}__sort-button`,
9804
- onClick: () => se(t.id),
9861
+ "aria-label": S(it(t.header)),
9862
+ className: `${K}__sort-button`,
9863
+ onClick: () => je(t.id),
9805
9864
  type: "button"
9806
9865
  }, t.header, /* @__PURE__ */ e.createElement("span", {
9807
9866
  "aria-hidden": "true",
9808
- className: `${M}__sort-icons`
9809
- }, /* @__PURE__ */ e.createElement("span", { className: Z([`${M}__sort-button-top`, le(t.id, "top")]) }, /* @__PURE__ */ e.createElement(Q, {
9867
+ className: `${K}__sort-icons`
9868
+ }, /* @__PURE__ */ e.createElement("span", { className: Z([`${K}__sort-button-top`, Ne(t.id, "top")]) }, /* @__PURE__ */ e.createElement(Q, {
9810
9869
  iconName: "caretUp",
9811
9870
  size: "m"
9812
- })), /* @__PURE__ */ e.createElement("span", { className: Z([`${M}__sort-button-bottom`, le(t.id, "bottom")]) }, /* @__PURE__ */ e.createElement(Q, {
9871
+ })), /* @__PURE__ */ e.createElement("span", { className: Z([`${K}__sort-button-bottom`, Ne(t.id, "bottom")]) }, /* @__PURE__ */ e.createElement(Q, {
9813
9872
  iconName: "caretDown",
9814
9873
  size: "m"
9815
- })))) : /* @__PURE__ */ e.createElement("span", null, t.header))))), /* @__PURE__ */ e.createElement("tbody", null, _ ? Array.from({ length: y }, (e, t) => he(t)) : oe.length === 0 ? ge() : oe.map((e, t) => _e(e, t)))), R && !_ && (I || T.length > 0) && /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__pagination" }, w && w.length > 0 && /* @__PURE__ */ e.createElement(un, {
9874
+ })))) : /* @__PURE__ */ e.createElement("span", null, t.header))))), /* @__PURE__ */ e.createElement("tbody", null, w ? Array.from({ length: E }, (e, t) => ze(t)) : Ae.length === 0 ? Be() : Ae.map((e, t) => Ve(e, t))))), ie && !w && (re || B.length > 0) && /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__pagination" }, F && F.length > 0 && /* @__PURE__ */ e.createElement(un, {
9816
9875
  autoWidth: !0,
9817
- id: N,
9876
+ id: q,
9818
9877
  label: "Rows per page",
9819
- onOptionSelect: (e) => G(Number(e.value)),
9820
- options: w.map((e) => ({
9821
- label: d(e),
9878
+ onOptionSelect: (e) => he(Number(e.value)),
9879
+ options: F.map((e) => ({
9880
+ label: v(e),
9822
9881
  value: String(e)
9823
9882
  })),
9824
9883
  showLabel: !1,
9825
9884
  size: "s",
9826
- value: String(W)
9885
+ value: String(me)
9827
9886
  }), /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__pagination-controls" }, /* @__PURE__ */ e.createElement(bi, {
9828
- currentPage: I ? r ?? 1 : V,
9829
- itemsPerPage: W,
9830
- onPageChange: I ? b : H,
9831
- totalItemCount: I ? A ?? 0 : T.length
9832
- }))));
9887
+ currentPage: re ? i ?? 1 : oe,
9888
+ itemsPerPage: me,
9889
+ onPageChange: re ? A : se,
9890
+ totalItemCount: re ? W ?? 0 : B.length
9891
+ }))), _ && /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__footer" }, _)), R && /* @__PURE__ */ e.createElement("div", { className: Z(["pds-table-wrapper__detail-panel", pe ? "pds-table-wrapper__detail-panel--open" : null]) }, /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__detail-panel-upper" }, /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__detail-panel-header" }, c && /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__detail-panel-title" }, c), /* @__PURE__ */ e.createElement(It, {
9892
+ ariaLabel: n,
9893
+ onClick: Te,
9894
+ size: "m"
9895
+ })), /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__detail-panel-content" }, pe && we && R(we, {
9896
+ rowId: fe,
9897
+ onClose: Te,
9898
+ onPrev: Ee,
9899
+ onNext: De,
9900
+ hasPrev: Ce > 0,
9901
+ hasNext: Ce < B.length - 1
9902
+ }))), pe && we && (z || s) && /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__detail-panel-footer" }, z ? z(we, {
9903
+ hasNext: Ce < B.length - 1,
9904
+ hasPrev: Ce > 0,
9905
+ onClose: Te,
9906
+ onNext: De,
9907
+ onPrev: Ee,
9908
+ rowId: fe
9909
+ }) : /* @__PURE__ */ e.createElement("div", { className: "pds-table-wrapper__detail-panel-nav" }, /* @__PURE__ */ e.createElement(Pt, {
9910
+ hasBorder: !0,
9911
+ ariaLabel: L,
9912
+ disabled: Ce <= 0,
9913
+ iconName: "angleUp",
9914
+ onClick: Ee,
9915
+ size: "s",
9916
+ variant: "standard"
9917
+ }), /* @__PURE__ */ e.createElement(Pt, {
9918
+ hasBorder: !0,
9919
+ ariaLabel: D,
9920
+ disabled: Ce >= B.length - 1,
9921
+ iconName: "angleDown",
9922
+ onClick: De,
9923
+ size: "s",
9924
+ variant: "standard"
9925
+ }))))));
9926
+ return I ? /* @__PURE__ */ e.createElement(wi, { padding: "none" }, Ue) : Ue;
9833
9927
  }, ra = [
9834
9928
  " ",
9835
9929
  "/",