@kumori/aurora-wui-components 0.0.281-dev4205.4 → 0.0.281-dev4205.5

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.
@@ -1,12 +1,30 @@
1
1
  import { LitElement } from 'lit';
2
- import { CallToActionButton, CallToActionCriticality } from '../axebow-call-to-action-row/axebow-call-to-action-row.js';
2
+ import { CallToActionCriticality } from '../axebow-call-to-action-row/axebow-call-to-action-row.js';
3
+ export interface CallToActionNotificationAction {
4
+ label: string;
5
+ buttonType: string;
6
+ outlined?: boolean;
7
+ icon?: string;
8
+ iconColor?: string;
9
+ route: string;
10
+ }
3
11
  export interface CallToActionNotification {
4
- criticality?: CallToActionCriticality;
5
- heading?: string;
6
- badgeLabel?: string;
7
- description?: string;
8
- buttons?: CallToActionButton[];
9
- lowNoteText?: string;
12
+ type: string;
13
+ subtype: string;
14
+ info_content?: {
15
+ code: string;
16
+ message: string;
17
+ timestamp?: string;
18
+ };
19
+ date: string;
20
+ data?: any;
21
+ status: 'read' | 'unread';
22
+ notificationType: 'callToAction';
23
+ userError?: boolean;
24
+ criticality: CallToActionCriticality;
25
+ support?: boolean;
26
+ noActions?: boolean;
27
+ actions?: CallToActionNotificationAction[];
10
28
  }
11
29
  export declare class AxebowCallToActionFeature extends LitElement {
12
30
  callToActions: CallToActionNotification[];
@@ -16,6 +34,9 @@ export declare class AxebowCallToActionFeature extends LitElement {
16
34
  static styles: import('lit').CSSResult[];
17
35
  private get _highestCriticality();
18
36
  private _toggle;
37
+ private _heading;
38
+ private _badgeLabel;
39
+ private _buttons;
19
40
  render(): import('lit-html').TemplateResult<1>;
20
41
  }
21
42
  //# sourceMappingURL=axebow-call-to-action-feature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"axebow-call-to-action-feature.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-call-to-action-feature/axebow-call-to-action-feature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAwB,MAAM,KAAK,CAAC;AAGvD,OAAO,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,2DAA2D,CAAC;AAC7H,OAAO,2DAA2D,CAAC;AAEnE,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBACa,yBAA0B,SAAQ,UAAU;IAC5B,aAAa,EAAE,wBAAwB,EAAE,CAAM;IAC9C,iBAAiB,SAAmB;IACpC,eAAe,SAAM;IAExC,OAAO,CAAC,QAAQ,CAAS;IAElC,MAAM,CAAC,MAAM,4BASX;IAEF,OAAO,KAAK,mBAAmB,GAI9B;IAED,OAAO,CAAC,OAAO;IAIf,MAAM;CA2DP"}
1
+ {"version":3,"file":"axebow-call-to-action-feature.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-call-to-action-feature/axebow-call-to-action-feature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAwB,MAAM,KAAK,CAAC;AAGvD,OAAO,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAsB,uBAAuB,EAAE,MAAM,2DAA2D,CAAC;AAC7H,OAAO,2DAA2D,CAAC;AAEnE,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,gBAAgB,EAAE,cAAc,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,8BAA8B,EAAE,CAAC;CAC5C;AAQD,qBACa,yBAA0B,SAAQ,UAAU;IAC5B,aAAa,EAAE,wBAAwB,EAAE,CAAM;IAC9C,iBAAiB,SAAmB;IACpC,eAAe,SAAM;IAExC,OAAO,CAAC,QAAQ,CAAS;IAElC,MAAM,CAAC,MAAM,4BASX;IAEF,OAAO,KAAK,mBAAmB,GAI9B;IAED,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,QAAQ;IAkBhB,MAAM;CA4DP"}
package/dist/index.js CHANGED
@@ -13700,6 +13700,11 @@ __decorate([property({ type: String })], AxebowCallToActionRow.prototype, "lowNo
13700
13700
  AxebowCallToActionRow = __decorate([customElement("axebow-call-to-action-row")], AxebowCallToActionRow);
13701
13701
  //#endregion
13702
13702
  //#region src/components/axebow-call-to-action-feature/axebow-call-to-action-feature.ts
13703
+ var BUTTON_TYPE_TO_VARIANT = {
13704
+ primary: "primary",
13705
+ secondary: "tertiary",
13706
+ text: "text"
13707
+ };
13703
13708
  var AxebowCallToActionFeature = class AxebowCallToActionFeature extends LitElement {
13704
13709
  constructor(..._args) {
13705
13710
  super(..._args);
@@ -13721,16 +13726,41 @@ var AxebowCallToActionFeature = class AxebowCallToActionFeature extends LitEleme
13721
13726
  ];
13722
13727
  }
13723
13728
  get _highestCriticality() {
13724
- if (this.callToActions.some((c) => c.criticality === "critical")) return "critical";
13725
- if (this.callToActions.some((c) => c.criticality === "high")) return "high";
13729
+ if (this.callToActions.some((n) => n.criticality === "critical")) return "critical";
13730
+ if (this.callToActions.some((n) => n.criticality === "high")) return "high";
13726
13731
  return "low";
13727
13732
  }
13728
13733
  _toggle() {
13734
+ if (this.callToActions.length === 0) return;
13729
13735
  this.expanded = !this.expanded;
13730
13736
  }
13737
+ _heading(notification) {
13738
+ return notification.subtype.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
13739
+ }
13740
+ _badgeLabel(notification) {
13741
+ return notification.criticality.charAt(0).toUpperCase() + notification.criticality.slice(1);
13742
+ }
13743
+ _buttons(notification) {
13744
+ return (notification.actions ?? []).map((action) => ({
13745
+ label: action.label,
13746
+ variant: BUTTON_TYPE_TO_VARIANT[action.buttonType] ?? "primary",
13747
+ outline: action.outlined,
13748
+ iconName: action.icon,
13749
+ iconColor: action.iconColor,
13750
+ onClick: () => this.dispatchEvent(new CustomEvent("cta-action", {
13751
+ detail: {
13752
+ notification,
13753
+ action
13754
+ },
13755
+ bubbles: true,
13756
+ composed: true
13757
+ }))
13758
+ }));
13759
+ }
13731
13760
  render() {
13732
13761
  const { color: criticalityColor, iconName } = CRITICALITY_STYLES[this._highestCriticality];
13733
13762
  const chevronIconName = this.expanded ? "keyboard_arrow_down" : "chevron_right";
13763
+ const hasCallToActions = this.callToActions.length > 0;
13734
13764
  return html`
13735
13765
  <div class="w-full flex flex-col">
13736
13766
  <div
@@ -13757,7 +13787,7 @@ var AxebowCallToActionFeature = class AxebowCallToActionFeature extends LitEleme
13757
13787
  <axebow-icon iconName="undo" iconColor="var(--axebow-gray)" size="md"></axebow-icon>
13758
13788
  </div>
13759
13789
  <div
13760
- class="w-5 h-5 shrink-0 flex items-center justify-center cursor-pointer"
13790
+ class="w-5 h-5 shrink-0 flex items-center justify-center ${hasCallToActions ? "cursor-pointer" : "cursor-default opacity-50"}"
13761
13791
  @click=${() => this._toggle()}
13762
13792
  >
13763
13793
  <axebow-icon iconName=${chevronIconName} iconColor="var(--axebow-tertiary)" size="md"></axebow-icon>
@@ -13765,16 +13795,16 @@ var AxebowCallToActionFeature = class AxebowCallToActionFeature extends LitEleme
13765
13795
  </div>
13766
13796
  </div>
13767
13797
 
13768
- ${this.expanded ? html`
13798
+ ${this.expanded && hasCallToActions ? html`
13769
13799
  <div class="w-full flex flex-col">
13770
- ${this.callToActions.map((callToAction) => html`
13800
+ ${this.callToActions.map((notification) => html`
13771
13801
  <axebow-call-to-action-row
13772
- criticality=${ifDefined(callToAction.criticality)}
13773
- heading=${ifDefined(callToAction.heading)}
13774
- badgeLabel=${ifDefined(callToAction.badgeLabel)}
13775
- description=${ifDefined(callToAction.description)}
13776
- lowNoteText=${ifDefined(callToAction.lowNoteText)}
13777
- .buttons=${callToAction.buttons ?? []}
13802
+ criticality=${notification.criticality}
13803
+ heading=${this._heading(notification)}
13804
+ badgeLabel=${this._badgeLabel(notification)}
13805
+ description=${ifDefined(notification.info_content?.message)}
13806
+ lowNoteText=${ifDefined(notification.info_content?.message)}
13807
+ .buttons=${this._buttons(notification)}
13778
13808
  ></axebow-call-to-action-row>
13779
13809
  `)}
13780
13810
  </div>