@kumori/aurora-wui-components 0.0.306-dev4506.1 → 0.0.306-dev4506.3

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.
@@ -31,7 +31,6 @@ export declare class AxebowFilterBar extends LitElement {
31
31
  firstUpdated(): void;
32
32
  updated(changedProperties: any): void;
33
33
  private _updateHasValueAttributes;
34
- private _onSelectShow;
35
34
  private _updateSeparateLayout;
36
35
  private _onChange;
37
36
  private _clearItem;
@@ -1 +1 @@
1
- {"version":3,"file":"axebow-filter-bar.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-filter-bar/axebow-filter-bar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAwB,MAAM,KAAK,CAAC;AAEvD,OAAO,+BAA+B,CAAC;AACvC,OAAO,2DAA2D,CAAC;AACnE,OAAO,2DAA2D,CAAC;AACnE,OAAO,yDAAyD,CAAC;AAEjE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,MAAM,CAAC,MAAM,4BAoFX;IAEyB,KAAK,EAAE,mBAAmB,EAAE,CAAM;IACjC,gBAAgB,SAAM;IACrB,OAAO,UAAS;IACjB,WAAW,SAAM;IACjB,iBAAiB,SAAM;IACvB,WAAW,SAAM;IAE7C,OAAO,CAAC,eAAe,CAAC,CAAiB;IAEzC,iBAAiB;IAKjB,oBAAoB;IAKpB,YAAY;I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AAE,GAAG;IAM9B,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,qBAAqB;IAa7B,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,WAAW;IAqDnB,MAAM;CAQP"}
@@ -0,0 +1,15 @@
1
+ export interface TypedNumericText {
2
+ text: string;
3
+ value: string;
4
+ caret: number;
5
+ }
6
+ export interface TypedNumericOptions {
7
+ integerOnly: boolean;
8
+ max: number;
9
+ }
10
+ export declare function toNumber(text: unknown): number | null;
11
+ export declare function formatNumericText(raw: string): string;
12
+ export declare function formatNumericValue(value: unknown): string;
13
+ export declare function sanitizeNumericText(text: string, integerOnly: boolean): string;
14
+ export declare function processTypedText(typed: string, caret: number, options: TypedNumericOptions): TypedNumericText;
15
+ //# sourceMappingURL=axebow-numeric-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axebow-numeric-format.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-input/axebow-numeric-format.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKrD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOzD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAS9E;AAeD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,gBAAgB,CAM7G"}
@@ -11,8 +11,11 @@ export declare class AxebowNumericInput extends AxebowInputBase {
11
11
  stepAmount: number;
12
12
  fixedField: boolean;
13
13
  minWidth?: string;
14
+ private _text;
15
+ willUpdate(changed: PropertyValues): void;
14
16
  updated(changed: PropertyValues): void;
15
17
  protected handleChange(e: Event): void;
18
+ private _emitValue;
16
19
  protected handleKeyDown(e: KeyboardEvent): void;
17
20
  private _bumpValue;
18
21
  private _renderStepper;
@@ -1 +1 @@
1
- {"version":3,"file":"axebow-numeric-input.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-input/axebow-numeric-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,yDAAyD,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBACa,kBAAmB,SAAQ,eAAe;IACrD,MAAM,CAAC,MAAM,4BAqEX;IAE0B,GAAG,SAA2B;IAC9B,GAAG,SAAK;IACP,WAAW,UAAS;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,UAAQ;IACpB,UAAU,SAAK;IACd,UAAU,UAAS;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE9C,OAAO,CAAC,OAAO,EAAE,cAAc;IAkC/B,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK;IAgB/B,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,aAAa;IAMxC,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,cAAc;IA2BtB,MAAM;CAqBP"}
1
+ {"version":3,"file":"axebow-numeric-input.d.ts","sourceRoot":"","sources":["../../../src/components/axebow-input/axebow-numeric-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,yDAAyD,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,qBACa,kBAAmB,SAAQ,eAAe;IACrD,MAAM,CAAC,MAAM,4BA6DX;IAE0B,GAAG,SAA2B;IAC9B,GAAG,SAAK;IACP,WAAW,UAAS;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,UAAQ;IACpB,UAAU,SAAK;IACd,UAAU,UAAS;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAErC,OAAO,CAAC,KAAK,CAAM;IAE5B,UAAU,CAAC,OAAO,EAAE,cAAc;IAOlC,OAAO,CAAC,OAAO,EAAE,cAAc;IAkC/B,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK;IAkB/B,OAAO,CAAC,UAAU;IAOlB,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,aAAa;IASxC,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,cAAc;IA2BtB,MAAM;CAsBP"}
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var axebowTheme = css`
30
30
  :host, .theme {
31
31
  --axebow-primary: var(--color-primary, #34495e);
32
32
  --axebow-primary-light: var(--color-primary-light, #b4cded);
33
+ --axebow-indigo-blue: var(--color-indigo-blue, #344966);
33
34
  --axebow-tertiary: var(--color-tertiary, #006bff);
34
35
  --axebow-success: var(--color-success, #0ecd9a);
35
36
  --axebow-secondary: var(--color-secondary, #78787a);
@@ -364,16 +365,6 @@ var AxebowFilterBar = class AxebowFilterBar extends LitElement {
364
365
  sl-option::part(base) {
365
366
  font-size: 0.875rem;
366
367
  }
367
- sl-select[lockable][has-value]::part(expand-icon) {
368
- display: none !important;
369
- }
370
- sl-select[lockable][has-value]::part(combobox) {
371
- pointer-events: none;
372
- }
373
- sl-select[lockable][has-value]::part(clear-button),
374
- sl-select[lockable][has-value]::part(clear-icon) {
375
- pointer-events: auto;
376
- }
377
368
  sl-select:not([has-value])::part(clear-button) {
378
369
  display: none !important;
379
370
  }
@@ -428,10 +419,6 @@ var AxebowFilterBar = class AxebowFilterBar extends LitElement {
428
419
  else select.removeAttribute("has-value");
429
420
  });
430
421
  }
431
- _onSelectShow(e) {
432
- const target = e.target;
433
- if (target.hasAttribute("lockable") && target.hasAttribute("has-value")) target.hide();
434
- }
435
422
  _updateSeparateLayout() {
436
423
  const container = this.shadowRoot?.querySelector(".filter-bar");
437
424
  if (!container) return;
@@ -540,7 +527,6 @@ var AxebowFilterBar = class AxebowFilterBar extends LitElement {
540
527
  ?clearable=${isLockable && !this.clearFilterLabel}
541
528
  data-key=${item.key}
542
529
  @sl-change=${(e) => this._onChange(e, item.key)}
543
- @sl-show=${this._onSelectShow}
544
530
  >
545
531
  <axebow-icon
546
532
  slot="clear-icon"
@@ -2514,6 +2500,68 @@ var AxebowTextInput = class AxebowTextInput extends AxebowInputBase {
2514
2500
  };
2515
2501
  AxebowTextInput = __decorate([customElement("axebow-text-input")], AxebowTextInput);
2516
2502
  //#endregion
2503
+ //#region src/components/axebow-input/axebow-numeric-format.ts
2504
+ var DECIMAL_SEPARATOR = ".";
2505
+ var THOUSANDS_SEPARATOR = ",";
2506
+ var NEGATIVE_SIGN = "-";
2507
+ var SIGNIFICANT_CHARACTER = /[\d.-]/;
2508
+ function toNumber(text) {
2509
+ const normalized = String(text ?? "").replace(/,/g, "").trim();
2510
+ if (normalized === "") return null;
2511
+ const parsed = Number(normalized);
2512
+ return Number.isFinite(parsed) ? parsed : null;
2513
+ }
2514
+ function formatNumericText(raw) {
2515
+ const negative = raw.startsWith(NEGATIVE_SIGN);
2516
+ const unsigned = negative ? raw.slice(1) : raw;
2517
+ const separatorIndex = unsigned.indexOf(DECIMAL_SEPARATOR);
2518
+ const integerPart = separatorIndex === -1 ? unsigned : unsigned.slice(0, separatorIndex);
2519
+ const fractionPart = separatorIndex === -1 ? "" : unsigned.slice(separatorIndex);
2520
+ const grouped = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, THOUSANDS_SEPARATOR);
2521
+ return `${negative ? NEGATIVE_SIGN : ""}${grouped}${fractionPart}`;
2522
+ }
2523
+ function formatNumericValue(value) {
2524
+ const text = String(value ?? "").trim();
2525
+ if (text === "") return "";
2526
+ if (/^-?\d*\.?\d*$/.test(text)) return formatNumericText(text);
2527
+ const parsed = toNumber(text);
2528
+ if (parsed === null) return "";
2529
+ return formatNumericText(parsed.toLocaleString("en-US", {
2530
+ useGrouping: false,
2531
+ maximumFractionDigits: 20
2532
+ }));
2533
+ }
2534
+ function sanitizeNumericText(text, integerOnly) {
2535
+ const negative = text.trim().startsWith(NEGATIVE_SIGN);
2536
+ const cleaned = text.replace(/[^\d.]/g, "");
2537
+ const separatorIndex = cleaned.indexOf(DECIMAL_SEPARATOR);
2538
+ const integerPart = (separatorIndex === -1 ? cleaned : cleaned.slice(0, separatorIndex)).replace(/^0+(?=\d)/, "");
2539
+ const fractionDigits = separatorIndex === -1 ? "" : cleaned.slice(separatorIndex + 1).replace(/\./g, "");
2540
+ const body = integerOnly || separatorIndex === -1 ? integerPart : `${integerPart}${DECIMAL_SEPARATOR}${fractionDigits}`;
2541
+ return `${negative ? NEGATIVE_SIGN : ""}${body}`;
2542
+ }
2543
+ function caretInText(typed, caret, text) {
2544
+ const significantBefore = Array.from(typed.slice(0, caret)).filter((character) => SIGNIFICANT_CHARACTER.test(character)).length;
2545
+ let position = 0;
2546
+ let seen = 0;
2547
+ while (position < text.length && seen < significantBefore) {
2548
+ if (SIGNIFICANT_CHARACTER.test(text[position])) seen++;
2549
+ position++;
2550
+ }
2551
+ return position;
2552
+ }
2553
+ function processTypedText(typed, caret, options) {
2554
+ let raw = sanitizeNumericText(typed, options.integerOnly);
2555
+ const parsed = toNumber(raw);
2556
+ if (options.integerOnly && parsed !== null && parsed > options.max) raw = String(options.max);
2557
+ const text = formatNumericText(raw);
2558
+ return {
2559
+ text,
2560
+ value: toNumber(raw) === null ? "" : raw,
2561
+ caret: caretInText(typed, caret, text)
2562
+ };
2563
+ }
2564
+ //#endregion
2517
2565
  //#region src/components/axebow-input/axebow-numeric-input.ts
2518
2566
  var AxebowNumericInput = class AxebowNumericInput extends AxebowInputBase {
2519
2567
  constructor(..._args) {
@@ -2524,6 +2572,7 @@ var AxebowNumericInput = class AxebowNumericInput extends AxebowInputBase {
2524
2572
  this.showStepper = true;
2525
2573
  this.stepAmount = 1;
2526
2574
  this.fixedField = false;
2575
+ this._text = "";
2527
2576
  }
2528
2577
  static {
2529
2578
  this.styles = [...AxebowInputBase.baseStyles, css`
@@ -2531,14 +2580,6 @@ var AxebowNumericInput = class AxebowNumericInput extends AxebowInputBase {
2531
2580
  display: block;
2532
2581
  width: 100%;
2533
2582
  }
2534
- sl-input::part(input)::-webkit-outer-spin-button,
2535
- sl-input::part(input)::-webkit-inner-spin-button {
2536
- -webkit-appearance: none;
2537
- margin: 0;
2538
- }
2539
- sl-input::part(input) {
2540
- -moz-appearance: textfield;
2541
- }
2542
2583
  :host(.axebow-fixed-width) sl-input {
2543
2584
  width: var(--axebow-input-width) !important;
2544
2585
  }
@@ -2594,6 +2635,10 @@ var AxebowNumericInput = class AxebowNumericInput extends AxebowInputBase {
2594
2635
  }
2595
2636
  `];
2596
2637
  }
2638
+ willUpdate(changed) {
2639
+ super.willUpdate(changed);
2640
+ if (changed.has("value") && toNumber(this.value) !== toNumber(this._text)) this._text = formatNumericValue(this.value);
2641
+ }
2597
2642
  updated(changed) {
2598
2643
  super.updated(changed);
2599
2644
  if (changed.has("fixedWidth")) if (this.fixedWidth) {
@@ -2621,28 +2666,43 @@ var AxebowNumericInput = class AxebowNumericInput extends AxebowInputBase {
2621
2666
  }
2622
2667
  handleChange(e) {
2623
2668
  if (this.disabled) return;
2624
- if (this.integerOnly) {
2625
- const target = e.target;
2626
- let truncated = Math.trunc(Number(target.value));
2627
- if (truncated > this.max) truncated = this.max;
2628
- target.value = truncated.toString();
2629
- this.value = target.value;
2630
- this.callback?.(e);
2631
- return;
2669
+ const input = e.target;
2670
+ const typed = input.value;
2671
+ const { text, value, caret } = processTypedText(typed, input.input?.selectionStart ?? typed.length, {
2672
+ integerOnly: this.integerOnly,
2673
+ max: this.max
2674
+ });
2675
+ if (text !== typed) {
2676
+ const hasFocus = input.shadowRoot?.activeElement === input.input;
2677
+ input.value = text;
2678
+ if (hasFocus) input.updateComplete.then(() => input.setSelectionRange(caret, caret));
2632
2679
  }
2633
- super.handleChange(e);
2680
+ this._text = text;
2681
+ this.value = value;
2682
+ this._emitValue(value);
2683
+ }
2684
+ _emitValue(value) {
2685
+ const source = document.createElement("input");
2686
+ source.value = value;
2687
+ source.addEventListener("input", (event) => this.callback?.(event), { once: true });
2688
+ source.dispatchEvent(new Event("input"));
2634
2689
  }
2635
2690
  handleKeyDown(e) {
2636
- if (this.integerOnly && (e.key === "." || e.key === "," || e.key === "e" || e.key === "E")) e.preventDefault();
2691
+ if (e.key === "ArrowUp" || e.key === "ArrowDown") {
2692
+ e.preventDefault();
2693
+ this._bumpValue(e.key === "ArrowUp" ? 1 : -1);
2694
+ return;
2695
+ }
2696
+ if (this.integerOnly && e.key === ".") e.preventDefault();
2637
2697
  }
2638
2698
  _bumpValue(sign) {
2639
2699
  if (this.disabled) return;
2640
2700
  const step = this.integerOnly ? Math.trunc(this.stepAmount) || 1 : this.stepAmount;
2641
- const current = Number(this.value) || 0;
2701
+ const current = toNumber(this.value) ?? 0;
2642
2702
  const next = Math.min(this.max, Math.max(this.min, current + sign * step));
2643
2703
  const input = this.renderRoot.querySelector("sl-input");
2644
2704
  if (!input) return;
2645
- input.value = next.toString();
2705
+ input.value = formatNumericValue(next);
2646
2706
  input.dispatchEvent(new Event("sl-input", {
2647
2707
  bubbles: true,
2648
2708
  composed: true
@@ -2650,7 +2710,7 @@ var AxebowNumericInput = class AxebowNumericInput extends AxebowInputBase {
2650
2710
  }
2651
2711
  _renderStepper() {
2652
2712
  if (!this.showStepper) return "";
2653
- const current = Number(this.value) || 0;
2713
+ const current = toNumber(this.value) ?? 0;
2654
2714
  return html`
2655
2715
  <div slot="suffix" class="axebow-numeric-stepper">
2656
2716
  <button
@@ -2678,15 +2738,16 @@ var AxebowNumericInput = class AxebowNumericInput extends AxebowInputBase {
2678
2738
  const content = html`
2679
2739
  <div class="${this.hasError ? "input-error" : ""}">
2680
2740
  <sl-input
2681
- type="number"
2741
+ type="text"
2742
+ inputmode="${this.integerOnly ? "numeric" : "decimal"}"
2743
+ autocomplete="off"
2682
2744
  placeholder="${this.placeholder}"
2683
2745
  @sl-input="${this.handleChange}"
2684
2746
  @keydown="${this.handleKeyDown}"
2685
- .value="${live(this.value)}"
2747
+ .value="${live(this._text)}"
2686
2748
  ?disabled="${this.disabled}"
2687
2749
  max=${this.max}
2688
2750
  min=${this.min}
2689
- step=${this.integerOnly ? "1" : "any"}
2690
2751
  >
2691
2752
  ${this._renderStepper()}
2692
2753
  </sl-input>
@@ -2704,6 +2765,7 @@ __decorate([property({ type: Boolean })], AxebowNumericInput.prototype, "showSte
2704
2765
  __decorate([property({ type: Number })], AxebowNumericInput.prototype, "stepAmount", void 0);
2705
2766
  __decorate([property({ type: Boolean })], AxebowNumericInput.prototype, "fixedField", void 0);
2706
2767
  __decorate([property({ type: String })], AxebowNumericInput.prototype, "minWidth", void 0);
2768
+ __decorate([state()], AxebowNumericInput.prototype, "_text", void 0);
2707
2769
  AxebowNumericInput = __decorate([customElement("axebow-numeric-input")], AxebowNumericInput);
2708
2770
  //#endregion
2709
2771
  //#region src/components/axebow-input/axebow-checkbox-input.ts