@kumori/aurora-wui-components 0.0.269-dev4124.14 → 0.0.269-dev4124.16

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.
@@ -17,6 +17,9 @@ export declare class AxebowResourceBar extends LitElement {
17
17
  barHeight?: string;
18
18
  unit?: string;
19
19
  private _renderIcon;
20
+ private get _isFixedVariant();
21
+ private _formatValue;
22
+ private _renderCurrent;
20
23
  private _renderBar;
21
24
  private _renderLimit;
22
25
  private _renderValues;
@@ -1 +1 @@
1
- {"version":3,"file":"axebow-resource-bar.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-summary/axebow-resource-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,KAAK,CAAC;AAIvD,OAAO,+BAA+B,CAAC;AAEvC,qBACa,iBAAkB,SAAQ,UAAU;IAC/C,MAAM,CAAC,MAAM,4BAQX;IAE0B,IAAI,SAAM;IACV,KAAK,SAAM;IACX,OAAO,SAAK;IACZ,KAAK,SAAK;IACV,UAAU,SAAK;IACf,MAAM,SAAO;IAEb,QAAQ,SAAQ;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IAE1C,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAkBrB,MAAM;CAyBP"}
1
+ {"version":3,"file":"axebow-resource-bar.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-summary/axebow-resource-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,KAAK,CAAC;AAIvD,OAAO,+BAA+B,CAAC;AAEvC,qBACa,iBAAkB,SAAQ,UAAU;IAC/C,MAAM,CAAC,MAAM,4BAQX;IAE0B,IAAI,SAAM;IACV,KAAK,SAAM;IACX,OAAO,SAAK;IACZ,KAAK,SAAK;IACV,UAAU,SAAK;IACf,MAAM,SAAO;IAEb,QAAQ,SAAQ;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IAE1C,OAAO,CAAC,WAAW;IAsBnB,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,aAAa;IAWrB,MAAM;CAyBP"}
package/dist/index.js CHANGED
@@ -10259,6 +10259,18 @@ var AxebowResourceBar = class AxebowResourceBar extends LitElement {
10259
10259
  </div>
10260
10260
  ` : icon;
10261
10261
  }
10262
+ get _isFixedVariant() {
10263
+ return !!(this.valuesWidth || this.barWidth);
10264
+ }
10265
+ _formatValue(value) {
10266
+ const hundredths = Math.round(value * 100);
10267
+ const decimals = hundredths % 10 === 0 ? 1 : 2;
10268
+ return (hundredths / 100).toFixed(decimals);
10269
+ }
10270
+ _renderCurrent() {
10271
+ const value = this._isFixedVariant ? this._formatValue(this.current) : this.current.toFixed(2);
10272
+ return html`<p class="text-base ${this._isFixedVariant ? "text-(--axebow-primary)" : "text-(--axebow-gray)"}">${value}</p>`;
10273
+ }
10262
10274
  _renderBar() {
10263
10275
  return html`
10264
10276
  <div
@@ -10273,22 +10285,18 @@ var AxebowResourceBar = class AxebowResourceBar extends LitElement {
10273
10285
  `;
10274
10286
  }
10275
10287
  _renderLimit() {
10288
+ const value = this.limit == null ? "-" : this._isFixedVariant ? this._formatValue(this.limit) : this.limit;
10289
+ const colorClass = this._isFixedVariant ? "text-(--axebow-black)" : "text-(--axebow-gray)";
10290
+ const weightClass = this._isFixedVariant ? "font-normal" : "font-bold";
10276
10291
  return html`
10277
- <p class="text-base font-bold text-(--axebow-gray)">${this.limit ?? "-"}</p>
10278
- ${this.unit ? html`<span class="text-xs text-(--axebow-gray)">${this.unit}</span>` : ""}
10292
+ <p class="text-base ${weightClass} ${colorClass}">${value}</p>
10293
+ ${this.unit ? html`<span class="text-xs ${weightClass} ${colorClass}">${this.unit}</span>` : ""}
10279
10294
  `;
10280
10295
  }
10281
10296
  _renderValues() {
10282
- if (!this.valuesWidth && !this.barWidth) return html`
10283
- <p class="text-base text-(--axebow-gray)">${this.current.toFixed(2)}</p>
10284
- ${this._renderBar()}
10285
- ${this._renderLimit()}
10286
- `;
10297
+ if (!this._isFixedVariant) return html` ${this._renderCurrent()} ${this._renderBar()} ${this._renderLimit()} `;
10287
10298
  return html`
10288
- <div class="flex items-center gap-2.75">
10289
- <p class="text-base text-(--axebow-gray)">${this.current.toFixed(2)}</p>
10290
- ${this._renderBar()}
10291
- </div>
10299
+ <div class="flex items-center gap-2.75">${this._renderCurrent()} ${this._renderBar()}</div>
10292
10300
  <div class="flex items-baseline gap-0.5">${this._renderLimit()}</div>
10293
10301
  `;
10294
10302
  }