@kodaris/krubble-app-components 1.0.127 → 1.0.129

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.
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { KRRouter, KRRouterOutlet } from './router.js';
6
6
  export { KRChatbot } from './chatbot.js';
7
7
  export type { KRSubbarBreadcrumb } from './subbar.js';
8
8
  export type { KRNavItem, KRNavItemFlat, KRUser } from './scaffold.js';
9
- export type { KRScreenNavItem } from './screen-nav.js';
9
+ export type { KRScreenNavItem, KRScreenNavAction } from './screen-nav.js';
10
10
  export type { KRRoute, KRRouterConfig, KRMatchedRoute } from './router.js';
11
11
  export type { KRChatbotMessage, KRChatbotSend, KRChatbotConversationFile, KRChatbotSendFile } from './chatbot.js';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
@@ -11508,17 +11508,31 @@ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators,
11508
11508
  * { id: 'activity', label: 'Activity', url: '/companies/123/activity' },
11509
11509
  * ]}
11510
11510
  * activeId="overview"
11511
+ * .actions=${[
11512
+ * { id: 'edit', label: 'Edit', variant: 'flat' },
11513
+ * { id: 'archive', label: 'Archive' },
11514
+ * { id: 'delete', label: 'Delete' },
11515
+ * { id: 'export', label: 'Export' },
11516
+ * ]}
11511
11517
  * >
11512
11518
  * <div>Screen content here</div>
11513
11519
  * </kr-screen-nav>
11514
11520
  * ```
11515
11521
  *
11522
+ * Actions render in a footer at the bottom of the nav column. With more than
11523
+ * `maxVisibleActions` (default 3), the overflow collapses into a "More" dropdown.
11524
+ * Listen for `action-click` to handle a click: `e.detail.action` is the action id.
11525
+ *
11516
11526
  * @slot - The main screen content
11517
11527
  *
11518
11528
  * @property {string} label - Main label (e.g., entity name like "Acme Corporation")
11519
11529
  * @property {string} subLabel - Sub label (e.g., entity type like "Company")
11520
11530
  * @property {KRScreenNavItem[]} items - Navigation items as JSON array
11521
11531
  * @property {string} activeId - Currently active item ID
11532
+ * @property {KRScreenNavAction[]} actions - Action buttons rendered in the nav footer
11533
+ * @property {number} maxVisibleActions - Max inline actions before collapsing into a "More" dropdown (default 3)
11534
+ *
11535
+ * @fires action-click - When an action button (inline or overflow) is clicked; detail is `{ action: id }`
11522
11536
  */
11523
11537
  class KRScreenNav extends i$3 {
11524
11538
  constructor() {
@@ -11540,6 +11554,17 @@ class KRScreenNav extends i$3 {
11540
11554
  * Can be set explicitly by the parent to override.
11541
11555
  */
11542
11556
  this.activeId = '';
11557
+ /**
11558
+ * Action buttons rendered in the nav footer.
11559
+ */
11560
+ this.actions = [];
11561
+ /**
11562
+ * Max number of inline action buttons before the overflow collapses into a
11563
+ * "More" dropdown. When actions exceed this count, the last visible slot is
11564
+ * used for the "More" button so the total footer button count never exceeds
11565
+ * this value.
11566
+ */
11567
+ this.maxVisibleActions = 3;
11543
11568
  this.handlePopstate = () => {
11544
11569
  this.syncActiveFromUrl();
11545
11570
  };
@@ -11600,7 +11625,35 @@ class KRScreenNav extends i$3 {
11600
11625
  this.activeId = match.id;
11601
11626
  }
11602
11627
  }
11628
+ handleActionClick(e, action) {
11629
+ this.dispatchEvent(new CustomEvent('action-click', {
11630
+ detail: { action: action.id },
11631
+ bubbles: true,
11632
+ composed: true,
11633
+ }));
11634
+ }
11635
+ // Fired by the "More" kr-button when an overflow option is chosen; detail is { id, label }.
11636
+ handleMoreSelect(e) {
11637
+ this.dispatchEvent(new CustomEvent('action-click', {
11638
+ detail: { action: e.detail.id },
11639
+ bubbles: true,
11640
+ composed: true,
11641
+ }));
11642
+ }
11603
11643
  render() {
11644
+ const hasOverflow = this.actions.length > this.maxVisibleActions;
11645
+ // When collapsing, the last visible slot is the "More" button, so only
11646
+ // show the first (maxVisibleActions - 1) actions inline.
11647
+ let inlineActions = this.actions;
11648
+ let overflowOptions = [];
11649
+ if (hasOverflow) {
11650
+ inlineActions = this.actions.slice(0, this.maxVisibleActions - 1);
11651
+ // Everything past the inline slots goes into the "More" dropdown.
11652
+ overflowOptions = this.actions.slice(this.maxVisibleActions - 1).map((action) => ({
11653
+ id: action.id,
11654
+ label: action.label,
11655
+ }));
11656
+ }
11604
11657
  return b `
11605
11658
  <nav class="nav">
11606
11659
  ${this.label ? b `
@@ -11627,6 +11680,31 @@ class KRScreenNav extends i$3 {
11627
11680
  `)}
11628
11681
  </div>
11629
11682
  </div>
11683
+ ${this.actions.length ? b `
11684
+ <div class="nav-actions">
11685
+ ${inlineActions.map((action) => b `
11686
+ <kr-button
11687
+ class="nav-actions__button"
11688
+ variant=${action.variant || 'outline'}
11689
+ size="small"
11690
+ @click=${(e) => this.handleActionClick(e, action)}
11691
+ >
11692
+ ${action.label}
11693
+ </kr-button>
11694
+ `)}
11695
+ ${hasOverflow ? b `
11696
+ <kr-button
11697
+ class="nav-actions__button"
11698
+ variant="outline"
11699
+ size="small"
11700
+ .options=${overflowOptions}
11701
+ @option-select=${this.handleMoreSelect}
11702
+ >
11703
+ More
11704
+ </kr-button>
11705
+ ` : A}
11706
+ </div>
11707
+ ` : A}
11630
11708
  </nav>
11631
11709
  <main class="content">
11632
11710
  <div class="content__main">
@@ -11715,6 +11793,19 @@ KRScreenNav.styles = i$6 `
11715
11793
  font-weight: 700;
11716
11794
  }
11717
11795
 
11796
+ .nav-actions {
11797
+ display: flex;
11798
+ flex-direction: column;
11799
+ gap: 8px;
11800
+ padding: 12px 16px;
11801
+ border-top: 1px solid rgba(0, 0, 0, 0.08);
11802
+ flex-shrink: 0;
11803
+ }
11804
+
11805
+ .nav-actions__button {
11806
+ width: 100%;
11807
+ }
11808
+
11718
11809
  .content {
11719
11810
  flex: 1;
11720
11811
  min-width: 0;
@@ -11739,6 +11830,12 @@ __decorate$2([
11739
11830
  __decorate$2([
11740
11831
  n$1({ type: String })
11741
11832
  ], KRScreenNav.prototype, "activeId", void 0);
11833
+ __decorate$2([
11834
+ n$1({ type: Array })
11835
+ ], KRScreenNav.prototype, "actions", void 0);
11836
+ __decorate$2([
11837
+ n$1({ type: Number })
11838
+ ], KRScreenNav.prototype, "maxVisibleActions", void 0);
11742
11839
  // Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
11743
11840
  // the page (e.g. the Operations shell loads krubble globally while an embedded app bundled its
11744
11841
  // own copy) doesn't throw. First definition wins.