courthive-components 3.2.0 → 3.3.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.
@@ -2651,7 +2651,12 @@ var Nr = {
2651
2651
  matchUpBackground: "--chc-color-matchup",
2652
2652
  internalDividers: "--chc-color-internal-dividers",
2653
2653
  score: "--chc-color-score",
2654
- roundHeader: "--chc-color-round-header"
2654
+ roundHeader: "--chc-color-round-header",
2655
+ roundHeaderBackground: "--chc-color-round-header-bg",
2656
+ roundHeaderUnderline: "--chc-color-round-header-underline",
2657
+ matchUpFooterBackground: "--chc-color-matchup-footer-bg",
2658
+ matchUpFooterText: "--chc-color-matchup-footer-text",
2659
+ matchUpFooterDivider: "--chc-color-matchup-footer-divider"
2655
2660
  };
2656
2661
  function Pr(e, t) {
2657
2662
  if (t) for (let [n, r] of Object.entries(Nr)) {
@@ -14626,8 +14631,8 @@ function Hx(e) {
14626
14631
  }
14627
14632
  var Ux = {
14628
14633
  name: "courthive-components",
14629
- packageManager: "pnpm@11.5.2",
14630
- version: "3.2.0",
14634
+ packageManager: "pnpm@11.6.0",
14635
+ version: "3.3.0",
14631
14636
  engines: { node: ">=22" },
14632
14637
  description: "Components for competitions projects",
14633
14638
  files: ["dist"],
@@ -14698,8 +14703,8 @@ var Ux = {
14698
14703
  "@storybook/test-runner": "^0.24.0",
14699
14704
  "@types/d3": "^7.4.3",
14700
14705
  "@types/vanillajs-datepicker": "^1.3.5",
14701
- "@typescript-eslint/eslint-plugin": "8.60.0",
14702
- "@typescript-eslint/parser": "8.60.0",
14706
+ "@typescript-eslint/eslint-plugin": "8.60.1",
14707
+ "@typescript-eslint/parser": "8.60.1",
14703
14708
  "@vitest/browser-playwright": "^4.0.16",
14704
14709
  "@vitest/coverage-v8": "^4.0.16",
14705
14710
  "@vitest/ui": "^4.0.16",
@@ -14713,7 +14718,7 @@ var Ux = {
14713
14718
  "lint-staged": "17.0.7",
14714
14719
  playwright: "^1.57.0",
14715
14720
  prettier: "^3.8.1",
14716
- semver: "7.8.1",
14721
+ semver: "7.8.3",
14717
14722
  storybook: "^10.2.17",
14718
14723
  "tabulator-tables": "6.4.0",
14719
14724
  typescript: "^6.0.2",
@@ -14737,7 +14742,7 @@ var Ux = {
14737
14742
  "focus-trap": "^8.0.0",
14738
14743
  "timepicker-ui": "^4.1.2",
14739
14744
  "tippy.js": "6.3.7",
14740
- "tods-competition-factory": "5.4.0",
14745
+ "tods-competition-factory": "5.5.0",
14741
14746
  "vanillajs-datepicker": "1.3.4"
14742
14747
  }
14743
14748
  };
@@ -21231,8 +21236,8 @@ function RI(e) {
21231
21236
  var zI, BI, VI, HI = !1;
21232
21237
  async function UI() {
21233
21238
  if (!zI) {
21234
- let e = await import("./dist-CwJOJWf0.mjs");
21235
- zI = e.TimepickerUI, BI = e.PluginRegistry, VI = (await import("./range-CBX41Ttl.mjs")).RangePlugin, !HI && BI && VI && (BI.register(VI), HI = !0);
21239
+ let e = await import("./dist-DiYU0jFr.mjs");
21240
+ zI = e.TimepickerUI, BI = e.PluginRegistry, VI = (await import("./range-CRxwaxeo.mjs")).RangePlugin, !HI && BI && VI && (BI.register(VI), HI = !0);
21236
21241
  }
21237
21242
  }
21238
21243
  var WI = class {
@@ -22829,8 +22834,8 @@ function yL(e) {
22829
22834
  var bL, xL, SL, CL = !1;
22830
22835
  async function wL() {
22831
22836
  if (!bL) {
22832
- let e = await import("./dist-CwJOJWf0.mjs");
22833
- bL = e.TimepickerUI, xL = e.PluginRegistry, SL = (await import("./range-CBX41Ttl.mjs")).RangePlugin, !CL && xL && SL && (xL.register(SL), CL = !0);
22837
+ let e = await import("./dist-DiYU0jFr.mjs");
22838
+ bL = e.TimepickerUI, xL = e.PluginRegistry, SL = (await import("./range-CRxwaxeo.mjs")).RangePlugin, !CL && xL && SL && (xL.register(SL), CL = !0);
22834
22839
  }
22835
22840
  }
22836
22841
  var TL = 0;
@@ -27244,7 +27249,30 @@ var OU = [
27244
27249
  },
27245
27250
  {
27246
27251
  key: "roundHeader",
27247
- label: "Round header"
27252
+ label: "Round header text"
27253
+ },
27254
+ {
27255
+ key: "roundHeaderBackground",
27256
+ label: "Round header background",
27257
+ hint: "Leave blank for transparent"
27258
+ },
27259
+ {
27260
+ key: "roundHeaderUnderline",
27261
+ label: "Round header underline",
27262
+ hint: "Divider below header"
27263
+ },
27264
+ {
27265
+ key: "matchUpFooterText",
27266
+ label: "MatchUp footer text"
27267
+ },
27268
+ {
27269
+ key: "matchUpFooterBackground",
27270
+ label: "MatchUp footer background"
27271
+ },
27272
+ {
27273
+ key: "matchUpFooterDivider",
27274
+ label: "MatchUp footer divider",
27275
+ hint: "Border above footer"
27248
27276
  }
27249
27277
  ], kU = /^#[0-9a-f]{6}$/i;
27250
27278
  function AU(e, t, n, r) {
@@ -27501,15 +27529,15 @@ function LU(e) {
27501
27529
  //#endregion
27502
27530
  //#region src/components/composition-editor/sections/layoutSection.ts
27503
27531
  function RU(e) {
27504
- let t = document.createElement("div"), n = e.getState().readOnly, r = e.getState().configuration, i = xU("Schedule info", !!r.scheduleInfo, (t) => e.setConfigField("scheduleInfo", t), n), a = xU("MatchUp footer", !!r.matchUpFooter, (t) => e.setConfigField("matchUpFooter", t), n), o = xU("Center info", !!r.centerInfo, (t) => e.setConfigField("centerInfo", t), n), s = xU("Set number", !!r.resultsInfo, (t) => e.setConfigField("resultsInfo", t), n), c = xU("Winner chevron", !!r.winnerChevron, (t) => e.setConfigField("winnerChevron", t), n);
27505
- t.appendChild(i.element), t.appendChild(a.element), t.appendChild(o.element), t.appendChild(s.element), t.appendChild(c.element);
27506
- function l(e) {
27532
+ let t = document.createElement("div"), n = e.getState().readOnly, r = e.getState().configuration, i = xU("Schedule info", !!r.scheduleInfo, (t) => e.setConfigField("scheduleInfo", t), n), a = xU("Round header", !!r.roundHeader, (t) => e.setConfigField("roundHeader", t), n), o = xU("MatchUp footer", !!r.matchUpFooter, (t) => e.setConfigField("matchUpFooter", t), n), s = xU("Center info", !!r.centerInfo, (t) => e.setConfigField("centerInfo", t), n), c = xU("Set number", !!r.resultsInfo, (t) => e.setConfigField("resultsInfo", t), n), l = xU("Winner chevron", !!r.winnerChevron, (t) => e.setConfigField("winnerChevron", t), n);
27533
+ t.appendChild(i.element), t.appendChild(a.element), t.appendChild(o.element), t.appendChild(s.element), t.appendChild(c.element), t.appendChild(l.element);
27534
+ function u(e) {
27507
27535
  let t = e.configuration;
27508
- i.setChecked(!!t.scheduleInfo), a.setChecked(!!t.matchUpFooter), o.setChecked(!!t.centerInfo), s.setChecked(!!t.resultsInfo), c.setChecked(!!t.winnerChevron);
27536
+ i.setChecked(!!t.scheduleInfo), a.setChecked(!!t.roundHeader), o.setChecked(!!t.matchUpFooter), s.setChecked(!!t.centerInfo), c.setChecked(!!t.resultsInfo), l.setChecked(!!t.winnerChevron);
27509
27537
  }
27510
27538
  return {
27511
27539
  element: t,
27512
- update: l
27540
+ update: u
27513
27541
  };
27514
27542
  }
27515
27543
  //#endregion
@@ -27736,10 +27764,18 @@ function JU() {
27736
27764
  r = e.theme, i = t, a = o, n.innerHTML = "", Fr(n), Pr(n, e.colors);
27737
27765
  let s = {
27738
27766
  theme: e.theme,
27739
- configuration: { ...e.configuration },
27767
+ configuration: {
27768
+ ...e.configuration,
27769
+ matchUpFooter: !0
27770
+ },
27740
27771
  colors: e.colors ? { ...e.colors } : void 0
27741
- }, c = GU();
27742
- for (let e of c) {
27772
+ }, c = Mr({
27773
+ roundNumber: 1,
27774
+ roundProfile: { 1: { roundName: "Round 1" } }
27775
+ });
27776
+ n.appendChild(c);
27777
+ let l = GU();
27778
+ for (let e of l) {
27743
27779
  let t = document.createElement("div");
27744
27780
  t.className = _U();
27745
27781
  let r = hi({
@@ -27749,13 +27785,13 @@ function JU() {
27749
27785
  });
27750
27786
  t.appendChild(r), n.appendChild(t);
27751
27787
  }
27752
- let l = document.createElement("div");
27753
- l.style.cssText = "margin-top:1.5rem; padding:0 0.25rem; font-size:0.7rem; color:var(--chc-text-secondary, #999); text-transform:uppercase; letter-spacing:0.05em;", l.textContent = "Connector preview", n.appendChild(l);
27754
- let u = _i({
27788
+ let u = document.createElement("div");
27789
+ u.style.cssText = "margin-top:1.5rem; padding:0 0.25rem; font-size:0.7rem; color:var(--chc-text-secondary, #999); text-transform:uppercase; letter-spacing:0.05em;", u.textContent = "Connector preview", n.appendChild(u);
27790
+ let d = _i({
27755
27791
  matchUps: qU(),
27756
27792
  composition: s
27757
27793
  });
27758
- n.appendChild(u);
27794
+ n.appendChild(d);
27759
27795
  }
27760
27796
  return {
27761
27797
  element: e,
@@ -31292,7 +31328,7 @@ function NJ(e) {
31292
31328
  //#region src/components/policy-catalog/engine/policyCatalogStore.ts
31293
31329
  var PJ = class {
31294
31330
  constructor(e) {
31295
- this.listeners = /* @__PURE__ */ new Set(), this.config = e;
31331
+ this.listeners = /* @__PURE__ */ new Set(), this.localIdCounter = 0, this.config = e;
31296
31332
  let t = new Set((e.builtinPolicies ?? []).map((e) => e.id)), n = [...e.builtinPolicies ?? [], ...(e.userPolicies ?? []).filter((e) => !t.has(e.id))];
31297
31333
  this.state = {
31298
31334
  catalog: n,
@@ -31300,6 +31336,7 @@ var PJ = class {
31300
31336
  groupBy: "type",
31301
31337
  selectedId: null,
31302
31338
  editorDraft: null,
31339
+ editedName: null,
31303
31340
  dirty: !1
31304
31341
  };
31305
31342
  }
@@ -31321,6 +31358,7 @@ var PJ = class {
31321
31358
  t && (this.setState({
31322
31359
  selectedId: e,
31323
31360
  editorDraft: NJ(t.policyData),
31361
+ editedName: t.name,
31324
31362
  dirty: !1
31325
31363
  }), this.config.onSelectionChanged?.(t));
31326
31364
  }
@@ -31328,9 +31366,18 @@ var PJ = class {
31328
31366
  this.state.selectedId && (this.setState({
31329
31367
  selectedId: null,
31330
31368
  editorDraft: null,
31369
+ editedName: null,
31331
31370
  dirty: !1
31332
31371
  }), this.config.onSelectionChanged?.(null));
31333
31372
  }
31373
+ renamePolicy(e) {
31374
+ if (!this.state.selectedId) return;
31375
+ let t = this.getSelectedItem();
31376
+ !t || t.source === "builtin" || this.state.editedName !== e && this.setState({
31377
+ editedName: e,
31378
+ dirty: !0
31379
+ });
31380
+ }
31334
31381
  updateEditorDraft(e) {
31335
31382
  this.setState({
31336
31383
  editorDraft: e,
@@ -31348,6 +31395,7 @@ var PJ = class {
31348
31395
  if (!e || !this.state.editorDraft) return;
31349
31396
  let t = {
31350
31397
  ...e,
31398
+ name: this.state.editedName ?? e.name,
31351
31399
  policyData: NJ(this.state.editorDraft)
31352
31400
  }, n = this.state.catalog.map((e) => e.id === t.id ? t : e);
31353
31401
  this.state = {
@@ -31360,6 +31408,7 @@ var PJ = class {
31360
31408
  let e = this.getSelectedItem();
31361
31409
  e && this.setState({
31362
31410
  editorDraft: NJ(e.policyData),
31411
+ editedName: e.name,
31363
31412
  dirty: !1
31364
31413
  });
31365
31414
  }
@@ -31373,40 +31422,40 @@ var PJ = class {
31373
31422
  this.config.onPolicyApplied?.(t);
31374
31423
  }
31375
31424
  addNewPolicy(e) {
31376
- let t = `user-${e}-${Date.now()}`, n = {
31425
+ let t = this.nextLocalId(e), n = {
31377
31426
  id: t,
31378
31427
  name: `New ${e} policy`,
31379
31428
  policyType: e,
31380
31429
  source: "user",
31381
31430
  description: "",
31382
31431
  policyData: OJ(e)
31383
- }, r = [...this.state.catalog, n];
31384
- return this.state = {
31385
- ...this.state,
31386
- catalog: r,
31387
- selectedId: t,
31388
- editorDraft: NJ(n.policyData),
31389
- dirty: !1
31390
- }, this.emit(), this.config.onPolicyCreated?.(n), this.config.onSelectionChanged?.(n), t;
31432
+ };
31433
+ return this.appendAndSelect(n), this.runCreateAndReconcile(n), t;
31391
31434
  }
31392
31435
  duplicatePolicy(e) {
31393
31436
  let t = this.state.catalog.find((t) => t.id === e);
31394
31437
  if (!t) return null;
31395
- let n = `user-${t.policyType}-${Date.now()}`, r = {
31438
+ let n = this.nextLocalId(t.policyType), r = {
31396
31439
  id: n,
31397
31440
  name: `${t.name} (Copy)`,
31398
31441
  policyType: t.policyType,
31399
31442
  source: "user",
31400
31443
  description: t.description,
31401
31444
  policyData: NJ(t.policyData)
31402
- }, i = [...this.state.catalog, r];
31403
- return this.state = {
31445
+ };
31446
+ return this.appendAndSelect(r), this.runCreateAndReconcile(r), n;
31447
+ }
31448
+ reconcilePolicyId(e, t) {
31449
+ if (e === t || this.state.catalog.findIndex((t) => t.id === e) === -1) return;
31450
+ let n = this.state.catalog.map((n) => n.id === e ? {
31451
+ ...n,
31452
+ id: t
31453
+ } : n), r = this.state.selectedId === e;
31454
+ this.state = {
31404
31455
  ...this.state,
31405
- catalog: i,
31406
- selectedId: n,
31407
- editorDraft: NJ(r.policyData),
31408
- dirty: !1
31409
- }, this.emit(), this.config.onPolicyCreated?.(r), this.config.onSelectionChanged?.(r), n;
31456
+ catalog: n,
31457
+ ...r ? { selectedId: t } : {}
31458
+ }, this.emit();
31410
31459
  }
31411
31460
  deletePolicy(e) {
31412
31461
  let t = this.state.catalog.find((t) => t.id === e);
@@ -31436,6 +31485,32 @@ var PJ = class {
31436
31485
  emit() {
31437
31486
  for (let e of this.listeners) e(this.state);
31438
31487
  }
31488
+ nextLocalId(e) {
31489
+ return this.localIdCounter += 1, `user-${e}-${Date.now()}-${this.localIdCounter}`;
31490
+ }
31491
+ appendAndSelect(e) {
31492
+ let t = [...this.state.catalog, e];
31493
+ this.state = {
31494
+ ...this.state,
31495
+ catalog: t,
31496
+ selectedId: e.id,
31497
+ editorDraft: NJ(e.policyData),
31498
+ editedName: e.name,
31499
+ dirty: !1
31500
+ }, this.emit(), this.config.onSelectionChanged?.(e);
31501
+ }
31502
+ runCreateAndReconcile(e) {
31503
+ let t = this.config.onPolicyCreated?.(e);
31504
+ if (t !== void 0) {
31505
+ if (typeof t == "string") {
31506
+ this.reconcilePolicyId(e.id, t);
31507
+ return;
31508
+ }
31509
+ Promise.resolve(t).then((t) => {
31510
+ typeof t == "string" && this.reconcilePolicyId(e.id, t);
31511
+ }).catch(() => {});
31512
+ }
31513
+ }
31439
31514
  };
31440
31515
  //#endregion
31441
31516
  //#region src/components/policy-catalog/ui/editorShell.ts
@@ -31450,42 +31525,44 @@ function FJ(e) {
31450
31525
  i.className = Kq();
31451
31526
  let a = document.createElement("div");
31452
31527
  a.className = Aq();
31453
- let o = document.createElement("span");
31454
- o.className = Uq();
31528
+ let o = document.createElement("input");
31529
+ o.type = "text", o.className = `${Aq()} pc-name-input`, o.setAttribute("aria-label", "Policy name"), o.setAttribute("data-testid", "pc-name-input"), o.placeholder = "Policy name", o.addEventListener("input", () => e.onRename(o.value));
31455
31530
  let s = document.createElement("span");
31456
- s.className = Uq(), s.textContent = "read-only", s.style.display = "none";
31457
- let c = document.createElement("div");
31458
- c.className = Xq(), c.style.display = "none", c.title = "Unsaved changes", i.appendChild(c), i.appendChild(a), i.appendChild(o), i.appendChild(s);
31531
+ s.className = Uq();
31532
+ let c = document.createElement("span");
31533
+ c.className = Uq(), c.textContent = "read-only", c.style.display = "none";
31459
31534
  let l = document.createElement("div");
31460
- l.className = qq();
31461
- let u = document.createElement("button");
31462
- u.className = Jq(), u.textContent = "Reset", u.addEventListener("click", () => e.onReset());
31535
+ l.className = Xq(), l.style.display = "none", l.title = "Unsaved changes", i.appendChild(l), i.appendChild(a), i.appendChild(o), i.appendChild(s), i.appendChild(c);
31536
+ let u = document.createElement("div");
31537
+ u.className = qq();
31463
31538
  let d = document.createElement("button");
31464
- d.className = Yq(), d.textContent = "Save", d.addEventListener("click", () => e.onSave());
31539
+ d.className = Jq(), d.textContent = "Reset", d.addEventListener("click", () => e.onReset());
31465
31540
  let f = document.createElement("button");
31466
- f.className = Jq(), f.textContent = "Apply", f.addEventListener("click", () => e.onApply());
31541
+ f.className = Yq(), f.textContent = "Save", f.addEventListener("click", () => e.onSave());
31467
31542
  let p = document.createElement("button");
31468
- p.className = Jq(), p.textContent = "Duplicate", p.addEventListener("click", () => e.onDuplicate()), l.appendChild(u), l.appendChild(d), l.appendChild(f), l.appendChild(p);
31469
- let m = document.createElement("div");
31470
- m.className = qq();
31471
- let h = document.createElement("button");
31472
- h.className = Yq(), h.textContent = "Use as Template", h.addEventListener("click", () => e.onDuplicate()), m.appendChild(h), r.appendChild(i), r.appendChild(l), r.appendChild(m);
31473
- let g = document.createElement("div");
31474
- g.className = Zq(), n.appendChild(r), n.appendChild(g);
31543
+ p.className = Jq(), p.textContent = "Apply", p.addEventListener("click", () => e.onApply());
31544
+ let m = document.createElement("button");
31545
+ m.className = Jq(), m.textContent = "Duplicate", m.addEventListener("click", () => e.onDuplicate()), u.appendChild(d), u.appendChild(f), u.appendChild(p), u.appendChild(m);
31546
+ let h = document.createElement("div");
31547
+ h.className = qq();
31548
+ let g = document.createElement("button");
31549
+ g.className = Yq(), g.textContent = "Use as Template", g.addEventListener("click", () => e.onDuplicate()), h.appendChild(g), r.appendChild(i), r.appendChild(u), r.appendChild(h);
31475
31550
  let _ = document.createElement("div");
31476
- _.className = Qq(), _.textContent = "Select a policy to edit", t.appendChild(n), t.appendChild(_);
31477
- function v(e) {
31551
+ _.className = Zq(), n.appendChild(r), n.appendChild(_);
31552
+ let v = document.createElement("div");
31553
+ v.className = Qq(), v.textContent = "Select a policy to edit", t.appendChild(n), t.appendChild(v);
31554
+ function y(e) {
31478
31555
  let t = e.selectedId !== null;
31479
- if (n.style.display = t ? "flex" : "none", _.style.display = t ? "none" : "flex", !t) return;
31556
+ if (n.style.display = t ? "flex" : "none", v.style.display = t ? "none" : "flex", !t) return;
31480
31557
  let r = e.catalog.find((t) => t.id === e.selectedId);
31481
31558
  if (!r) return;
31482
- let i = r.source === "builtin";
31483
- a.textContent = r.name, o.textContent = DJ(r.policyType)?.label ?? r.policyType, s.style.display = i ? "" : "none", l.style.display = i ? "none" : "flex", m.style.display = i ? "flex" : "none", c.style.display = !i && e.dirty ? "block" : "none";
31559
+ let i = r.source === "builtin", d = e.editedName ?? r.name;
31560
+ a.textContent = d, document.activeElement !== o && o.value !== d && (o.value = d), s.textContent = DJ(r.policyType)?.label ?? r.policyType, a.style.display = i ? "" : "none", o.style.display = i ? "none" : "", c.style.display = i ? "" : "none", u.style.display = i ? "none" : "flex", h.style.display = i ? "flex" : "none", l.style.display = !i && e.dirty ? "block" : "none";
31484
31561
  }
31485
31562
  return {
31486
31563
  element: t,
31487
- update: v,
31488
- bodyElement: g
31564
+ update: y,
31565
+ bodyElement: _
31489
31566
  };
31490
31567
  }
31491
31568
  //#endregion
@@ -31546,7 +31623,8 @@ var LJ = class {
31546
31623
  onDuplicate: () => {
31547
31624
  let e = this.store.getSelectedItem();
31548
31625
  e && (this.store.duplicatePolicy(e.id), this.mountEditorForSelection());
31549
- }
31626
+ },
31627
+ onRename: (e) => this.store.renamePolicy(e)
31550
31628
  }), this.layout = tJ({
31551
31629
  catalogPanel: t,
31552
31630
  editorShell: this.editorShell