@cupra/ui-kit 2.0.0-canary.62 → 2.0.0-canary.63

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.
Files changed (82) hide show
  1. package/dist/cjs/components/ds-select/ds-select.cjs +4 -3
  2. package/dist/cjs/components/ds-slider/ds-slider.cjs +18 -18
  3. package/dist/cjs/components/ds-text-input/ds-text-input.cjs +3 -2
  4. package/dist/cjs/components/ds-textarea/ds-textarea.cjs +4 -3
  5. package/dist/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
  6. package/dist/cjs/mixins/inputStatesMixin.cjs +1 -1
  7. package/dist/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.cjs +2 -2
  8. package/dist/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.cjs +1 -1
  9. package/dist/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs +5 -0
  10. package/dist/cjs/utils/IconsManager.cjs +1 -1
  11. package/dist/cjs/utils/PubSub.cjs +1 -1
  12. package/dist/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
  13. package/dist/cjs/utils/concurrencyLimit.cjs +1 -0
  14. package/dist/cjs/utils/cssWithTokens.cjs +1 -1
  15. package/dist/cjs/utils/htmlWithTokens.cjs +1 -1
  16. package/dist/esm/components/ds-select/ds-select.js +38 -32
  17. package/dist/esm/components/ds-slider/ds-slider.js +84 -67
  18. package/dist/esm/components/ds-text-input/ds-text-input.js +38 -30
  19. package/dist/esm/components/ds-textarea/ds-textarea.js +45 -37
  20. package/dist/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
  21. package/dist/esm/mixins/inputStatesMixin.js +4 -3
  22. package/dist/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.js +17 -16
  23. package/dist/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.js +4 -4
  24. package/dist/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.js +30 -0
  25. package/dist/esm/utils/IconsManager.js +1 -1
  26. package/dist/esm/utils/PubSub.js +1 -1
  27. package/dist/esm/utils/StylesRegistry/StylesRegistry.js +8 -6
  28. package/dist/esm/utils/concurrencyLimit.js +32 -0
  29. package/dist/esm/utils/cssWithTokens.js +1 -1
  30. package/dist/esm/utils/htmlWithTokens.js +1 -1
  31. package/dist/types/components/ds-select/ds-select.d.ts +2 -0
  32. package/dist/types/components/ds-select/ds-select.types.d.ts +1 -0
  33. package/dist/types/components/ds-slider/ds-slider.d.ts +7 -2
  34. package/dist/types/components/ds-slider/ds-slider.types.d.ts +18 -3
  35. package/dist/types/components/ds-text-input/ds-text-input.d.ts +2 -0
  36. package/dist/types/components/ds-text-input/ds-text-input.types.d.ts +1 -0
  37. package/dist/types/components/ds-textarea/ds-textarea.d.ts +2 -0
  38. package/dist/types/components/ds-textarea/ds-textarea.types.d.ts +1 -0
  39. package/dist/types/mixins/inputStatesMixin.d.ts +1 -0
  40. package/dist/types/utils/concurrencyLimit.d.ts +4 -0
  41. package/dist/types/utils/concurrencyLimit.test.d.ts +1 -0
  42. package/dist-react/cjs/components/ds-select/ds-select.cjs +4 -3
  43. package/dist-react/cjs/components/ds-slider/ds-slider.cjs +18 -18
  44. package/dist-react/cjs/components/ds-text-input/ds-text-input.cjs +3 -2
  45. package/dist-react/cjs/components/ds-textarea/ds-textarea.cjs +4 -3
  46. package/dist-react/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
  47. package/dist-react/cjs/mixins/inputStatesMixin.cjs +1 -1
  48. package/dist-react/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.cjs +2 -2
  49. package/dist-react/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.cjs +1 -1
  50. package/dist-react/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs +5 -0
  51. package/dist-react/cjs/utils/IconsManager.cjs +1 -1
  52. package/dist-react/cjs/utils/PubSub.cjs +1 -1
  53. package/dist-react/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
  54. package/dist-react/cjs/utils/concurrencyLimit.cjs +1 -0
  55. package/dist-react/cjs/utils/cssWithTokens.cjs +1 -1
  56. package/dist-react/cjs/utils/htmlWithTokens.cjs +1 -1
  57. package/dist-react/esm/components/ds-select/ds-select.js +38 -32
  58. package/dist-react/esm/components/ds-slider/ds-slider.js +84 -67
  59. package/dist-react/esm/components/ds-text-input/ds-text-input.js +38 -30
  60. package/dist-react/esm/components/ds-textarea/ds-textarea.js +45 -37
  61. package/dist-react/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
  62. package/dist-react/esm/mixins/inputStatesMixin.js +4 -3
  63. package/dist-react/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.js +17 -16
  64. package/dist-react/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.js +4 -4
  65. package/dist-react/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.js +30 -0
  66. package/dist-react/esm/utils/IconsManager.js +1 -1
  67. package/dist-react/esm/utils/PubSub.js +1 -1
  68. package/dist-react/esm/utils/StylesRegistry/StylesRegistry.js +8 -6
  69. package/dist-react/esm/utils/concurrencyLimit.js +32 -0
  70. package/dist-react/esm/utils/cssWithTokens.js +1 -1
  71. package/dist-react/esm/utils/htmlWithTokens.js +1 -1
  72. package/dist-react/types/components/ds-select/ds-select.d.ts +2 -0
  73. package/dist-react/types/components/ds-select/ds-select.types.d.ts +1 -0
  74. package/dist-react/types/components/ds-slider/ds-slider.d.ts +7 -2
  75. package/dist-react/types/components/ds-slider/ds-slider.types.d.ts +18 -3
  76. package/dist-react/types/components/ds-text-input/ds-text-input.d.ts +2 -0
  77. package/dist-react/types/components/ds-text-input/ds-text-input.types.d.ts +1 -0
  78. package/dist-react/types/components/ds-textarea/ds-textarea.d.ts +2 -0
  79. package/dist-react/types/components/ds-textarea/ds-textarea.types.d.ts +1 -0
  80. package/dist-react/types/mixins/inputStatesMixin.d.ts +1 -0
  81. package/dist-react/types/utils/concurrencyLimit.d.ts +4 -0
  82. package/package.json +1 -1
@@ -4,34 +4,35 @@ import { _$LH as l } from "./lit-html.js";
4
4
  * Copyright 2020 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
6
  */
7
- const { I: f } = l, m = () => document.createComment(""), u = (e, A, t) => {
7
+ const { I: f } = l, v = (e) => e.strings === void 0, m = () => document.createComment(""), p = (e, i, t) => {
8
8
  var o;
9
- const $ = e._$AA.parentNode, i = A === void 0 ? e._$AB : A._$AA;
9
+ const $ = e._$AA.parentNode, r = i === void 0 ? e._$AB : i._$AA;
10
10
  if (t === void 0) {
11
- const s = $.insertBefore(m(), i), _ = $.insertBefore(m(), i);
12
- t = new f(s, _, e, e.options);
11
+ const A = $.insertBefore(m(), r), _ = $.insertBefore(m(), r);
12
+ t = new f(A, _, e, e.options);
13
13
  } else {
14
- const s = t._$AB.nextSibling, _ = t._$AM, a = _ !== e;
14
+ const A = t._$AB.nextSibling, _ = t._$AM, a = _ !== e;
15
15
  if (a) {
16
- let r;
17
- (o = t._$AQ) == null || o.call(t, e), t._$AM = e, t._$AP !== void 0 && (r = e._$AU) !== _._$AU && t._$AP(r);
16
+ let s;
17
+ (o = t._$AQ) == null || o.call(t, e), t._$AM = e, t._$AP !== void 0 && (s = e._$AU) !== _._$AU && t._$AP(s);
18
18
  }
19
- if (s !== i || a) {
20
- let r = t._$AA;
21
- for (; r !== s; ) {
22
- const d = r.nextSibling;
23
- $.insertBefore(r, i), r = d;
19
+ if (A !== r || a) {
20
+ let s = t._$AA;
21
+ for (; s !== A; ) {
22
+ const d = s.nextSibling;
23
+ $.insertBefore(s, r), s = d;
24
24
  }
25
25
  }
26
26
  }
27
27
  return t;
28
- }, v = (e, A, t = e) => (e._$AI(A, t), e), c = {}, p = (e, A = c) => e._$AH = A, B = (e) => e._$AH, P = (e) => {
28
+ }, u = (e, i, t = e) => (e._$AI(i, t), e), n = {}, g = (e, i = n) => e._$AH = i, B = (e) => e._$AH, P = (e) => {
29
29
  e._$AR(), e._$AA.remove();
30
30
  };
31
31
  export {
32
32
  B as getCommittedValue,
33
- u as insertPart,
33
+ p as insertPart,
34
+ v as isSingleExpression,
34
35
  P as removePart,
35
- v as setChildPartValue,
36
- p as setCommittedValue
36
+ u as setChildPartValue,
37
+ g as setCommittedValue
37
38
  };
@@ -3,8 +3,8 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- const s = { ATTRIBUTE: 1, CHILD: 2 }, $ = (i) => (...t) => ({ _$litDirective$: i, values: t });
7
- class _ {
6
+ const s = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4 }, _ = (i) => (...t) => ({ _$litDirective$: i, values: t });
7
+ class $ {
8
8
  constructor(t) {
9
9
  }
10
10
  get _$AU() {
@@ -21,7 +21,7 @@ class _ {
21
21
  }
22
22
  }
23
23
  export {
24
- _ as Directive,
24
+ $ as Directive,
25
25
  s as PartType,
26
- $ as directive
26
+ _ as directive
27
27
  };
@@ -0,0 +1,30 @@
1
+ import { noChange as i, nothing as o } from "../lit-html.js";
2
+ import { directive as a, Directive as T, PartType as r } from "../directive.js";
3
+ import { isSingleExpression as l, setCommittedValue as p } from "../directive-helpers.js";
4
+ /**
5
+ * @license
6
+ * Copyright 2020 Google LLC
7
+ * SPDX-License-Identifier: BSD-3-Clause
8
+ */
9
+ const c = a(class extends T {
10
+ constructor(e) {
11
+ if (super(e), e.type !== r.PROPERTY && e.type !== r.ATTRIBUTE && e.type !== r.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
12
+ if (!l(e)) throw Error("`live` bindings can only contain a single expression");
13
+ }
14
+ render(e) {
15
+ return e;
16
+ }
17
+ update(e, [t]) {
18
+ if (t === i || t === o) return t;
19
+ const n = e.element, s = e.name;
20
+ if (e.type === r.PROPERTY) {
21
+ if (t === n[s]) return i;
22
+ } else if (e.type === r.BOOLEAN_ATTRIBUTE) {
23
+ if (!!t === n.hasAttribute(s)) return i;
24
+ } else if (e.type === r.ATTRIBUTE && n.getAttribute(s) === t + "") return i;
25
+ return p(e), t;
26
+ }
27
+ });
28
+ export {
29
+ c as live
30
+ };
@@ -25,7 +25,7 @@ class l {
25
25
  }), f.subscribe("theme", this.handleChangeTheme);
26
26
  }
27
27
  }
28
- const c = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.62"), h = globalThis;
28
+ const c = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.63"), h = globalThis;
29
29
  let i = h[c];
30
30
  i || (i = new l(), Object.defineProperty(h, c, {
31
31
  value: i,
@@ -18,7 +18,7 @@ class e {
18
18
  });
19
19
  }
20
20
  }
21
- const u = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.62"), t = globalThis;
21
+ const u = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.63"), t = globalThis;
22
22
  let b = t[u];
23
23
  b || (b = new e(), Object.defineProperty(t, u, {
24
24
  value: b,
@@ -1,3 +1,5 @@
1
+ import { concurrencyLimit as o } from "../concurrencyLimit.js";
2
+ const h = o(20);
1
3
  class s {
2
4
  constructor() {
3
5
  this.stylePromises = /* @__PURE__ */ new Map(), this.getStyles = async ({
@@ -5,10 +7,10 @@ class s {
5
7
  theme: t
6
8
  }) => {
7
9
  if (!t || !e) return;
8
- const r = `https://ds-assets.cupra.com/2.0.0-canary.62/styles/${t}/components/${e}.css`, c = this.getCachedStyleSheetPromise({ url: r });
9
- if (c) return c;
10
- const i = this.fetchStyle({ url: r }).then((n) => (n || this.stylePromises.delete(r), n));
11
- return this.stylePromises.set(r, i), this.stylePromises.get(r);
10
+ const c = `https://ds-assets.cupra.com/2.0.0-canary.63/styles/${t}/components/${e}.css`, r = this.getCachedStyleSheetPromise({ url: c });
11
+ if (r) return r;
12
+ const i = h(() => this.fetchStyle({ url: c })).then((n) => (n || this.stylePromises.delete(c), n));
13
+ return this.stylePromises.set(c, i), this.stylePromises.get(c);
12
14
  };
13
15
  }
14
16
  async fetchStyle({ url: e }) {
@@ -27,7 +29,7 @@ class s {
27
29
  return s.instance || (s.instance = new s()), s.instance;
28
30
  }
29
31
  }
30
- const a = s.getInstance();
32
+ const y = s.getInstance();
31
33
  export {
32
- a as stylesRegistry
34
+ y as stylesRegistry
33
35
  };
@@ -0,0 +1,32 @@
1
+ function c(r) {
2
+ let t = 0;
3
+ const e = [];
4
+ function u() {
5
+ if (t < r) {
6
+ t++;
7
+ return;
8
+ }
9
+ return new Promise((n) => {
10
+ e.push(() => {
11
+ t++, n();
12
+ });
13
+ });
14
+ }
15
+ function o() {
16
+ t--;
17
+ const n = e.shift();
18
+ n && n();
19
+ }
20
+ return async (n) => {
21
+ const i = u();
22
+ i && await i;
23
+ try {
24
+ return await n();
25
+ } finally {
26
+ o();
27
+ }
28
+ };
29
+ }
30
+ export {
31
+ c as concurrencyLimit
32
+ };
@@ -3,7 +3,7 @@ import "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
3
3
  import "../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
4
4
  import { unsafeCSS as n, css as o } from "../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
5
5
  function x(t, ...r) {
6
- const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v2-0-0-canary-62"), i = n(e);
6
+ const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v2-0-0-canary-63"), i = n(e);
7
7
  return o`${i}`;
8
8
  }
9
9
  export {
@@ -3,7 +3,7 @@ import { html as n } from "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit
3
3
  import "../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
4
4
  import { unsafeHTML as i } from "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.js";
5
5
  function x(t, ...r) {
6
- const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v2-0-0-canary-62"), e = i(o);
6
+ const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v2-0-0-canary-63"), e = i(o);
7
7
  return n`${e}`;
8
8
  }
9
9
  export {
@@ -7,6 +7,7 @@ export declare class DsSelect extends UiKitElement {
7
7
  mode: DsSelectAttrs['mode'];
8
8
  size: DsSelectAttrs['size'];
9
9
  variant: DsSelectAttrs['variant'];
10
+ readonly: DsSelectAttrs['readonly'];
10
11
  private _open;
11
12
  private nativeSelect;
12
13
  private nativeLabel;
@@ -44,6 +45,7 @@ export declare class DsSelect extends UiKitElement {
44
45
  container: boolean;
45
46
  open: boolean;
46
47
  disabled: boolean;
48
+ readonly: boolean;
47
49
  filled: boolean;
48
50
  invalid: boolean;
49
51
  error: boolean;
@@ -3,4 +3,5 @@ export interface DsSelectAttrs extends CommonAttrs {
3
3
  mode?: 'dark' | 'light';
4
4
  size?: 'medium' | 'small';
5
5
  variant?: 'primary' | 'secondary' | (string & {});
6
+ readonly?: boolean;
6
7
  }
@@ -11,6 +11,8 @@ export declare class DsSlider extends DsSlider_base {
11
11
  step: DsSliderAttrs['step'];
12
12
  initialValueMin: DsSliderAttrs['initial-value-min'];
13
13
  initialValueMax: DsSliderAttrs['initial-value-max'];
14
+ valueMin: DsSliderAttrs['value-min'];
15
+ valueMax: DsSliderAttrs['value-max'];
14
16
  mode: DsSliderAttrs['mode'];
15
17
  locale: DsSliderAttrs['locale'];
16
18
  localeMatcher: DsSliderAttrs['locale-matcher'];
@@ -30,13 +32,16 @@ export declare class DsSlider extends DsSlider_base {
30
32
  inputMinAriaLabel: DsSliderAttrs['input-min-aria-label'];
31
33
  inputMaxAriaLabel: DsSliderAttrs['input-max-aria-label'];
32
34
  protected track: HTMLInputElement;
33
- protected valueMin: number;
34
- protected valueMax: number;
35
+ protected _valueMin: number;
36
+ protected _valueMax: number;
35
37
  protected activeThumb: 'min' | 'max' | null;
36
38
  protected animationFrameRequest: number;
37
39
  protected editingField?: 'min' | 'max' | null;
38
40
  protected keyboardMode: boolean;
39
41
  static styles: import("lit").CSSResult[];
42
+ protected get isRange(): boolean;
43
+ private isControlled;
44
+ protected willUpdate(changedProps: PropertyValues): void;
40
45
  disconnectedCallback(): void;
41
46
  protected firstUpdated(changedProps: PropertyValues): void;
42
47
  protected getTrackPct(value: number): number;
@@ -29,14 +29,29 @@ type SliderCustomUnit = Omit<NoUnit, 'style'> & {
29
29
  'unit-symbol': string;
30
30
  };
31
31
  type SliderUnitStyle = SliderCurrency | SliderDecimal | SliderPercent | SliderUnit | SliderNoUnit | SliderCustomUnit;
32
+ type UncontrolledMin = {
33
+ 'initial-value-min'?: number;
34
+ 'value-min'?: never;
35
+ };
36
+ type ControlledMin = {
37
+ 'initial-value-min'?: never;
38
+ 'value-min'?: number;
39
+ };
40
+ type UncontrolledMax = {
41
+ 'initial-value-max'?: number;
42
+ 'value-max'?: never;
43
+ };
44
+ type ControlledMax = {
45
+ 'initial-value-max'?: never;
46
+ 'value-max'?: number;
47
+ };
48
+ type SliderValueProps = (UncontrolledMin | ControlledMin) & (UncontrolledMax | ControlledMax);
32
49
  export type DsSliderAttrs = CommonAttrs & {
33
50
  min?: number;
34
51
  max?: number;
35
52
  'min-label'?: string;
36
53
  'max-label'?: string;
37
54
  step?: number;
38
- 'initial-value-min'?: number;
39
- 'initial-value-max'?: number;
40
55
  mode?: 'dark' | 'light';
41
56
  size?: Size | ResponsiveSize;
42
57
  disabled?: boolean;
@@ -51,5 +66,5 @@ export type DsSliderAttrs = CommonAttrs & {
51
66
  'use-grouping'?: 'auto' | boolean;
52
67
  'input-min-aria-label'?: string;
53
68
  'input-max-aria-label'?: string;
54
- } & SliderUnitStyle;
69
+ } & SliderValueProps & SliderUnitStyle;
55
70
  export {};
@@ -9,6 +9,7 @@ export declare class DsTextInput extends DsTextInput_base {
9
9
  helperText: DsTextInputAttrs['helper-text'];
10
10
  forcedError: DsTextInputAttrs['forced-error'];
11
11
  invalidError: DsTextInputAttrs['invalid-error'];
12
+ readonlyText: DsTextInputAttrs['readonly-text'];
12
13
  dataAriaLabelRemoveButton: DsTextInputAttrs['data-aria-label-remove-button'];
13
14
  protected handleClickIcon: () => void;
14
15
  private get classes();
@@ -17,6 +18,7 @@ export declare class DsTextInput extends DsTextInput_base {
17
18
  protected get lengthTemplate(): typeof nothing | import("lit").TemplateResult<1>;
18
19
  protected get helperTextTemplate(): typeof nothing | import("lit").TemplateResult<1>;
19
20
  protected get forcedErrorTemplate(): typeof nothing | import("lit").TemplateResult<1>;
21
+ protected get readonlyTextTemplate(): typeof nothing | import("lit").TemplateResult<1>;
20
22
  protected get invalidErrorTemplate(): typeof nothing | import("lit").TemplateResult<1>;
21
23
  }
22
24
  export {};
@@ -4,5 +4,6 @@ export type DsTextInputAttrs = {
4
4
  'helper-text'?: string;
5
5
  'forced-error'?: string;
6
6
  'invalid-error'?: string;
7
+ 'readonly-text'?: string;
7
8
  'data-aria-label-remove-button'?: string;
8
9
  } & CommonAttrs;
@@ -9,6 +9,7 @@ export declare class DsTextarea extends DsTextarea_base {
9
9
  helperText: DsTextareaAttrs['helper-text'];
10
10
  forcedError: DsTextareaAttrs['forced-error'];
11
11
  invalidError: DsTextareaAttrs['invalid-error'];
12
+ readonlyText: DsTextareaAttrs['readonly-text'];
12
13
  mode: DsTextareaAttrs['mode'];
13
14
  protected onInputReady(nativeInput: HTMLInputElement | HTMLTextAreaElement): void;
14
15
  private get classes();
@@ -16,6 +17,7 @@ export declare class DsTextarea extends DsTextarea_base {
16
17
  protected get lengthTemplate(): typeof nothing | import("lit").TemplateResult<1>;
17
18
  protected get helperTextTemplate(): typeof nothing | import("lit").TemplateResult<1>;
18
19
  protected get forcedErrorTemplate(): typeof nothing | import("lit").TemplateResult<1>;
20
+ protected get readonlyTextTemplate(): typeof nothing | import("lit").TemplateResult<1>;
19
21
  protected get invalidErrorTemplate(): typeof nothing | import("lit").TemplateResult<1>;
20
22
  }
21
23
  export {};
@@ -8,6 +8,7 @@ export type DsTextareaAttrs = {
8
8
  'helper-text'?: string;
9
9
  'forced-error'?: string;
10
10
  'invalid-error'?: string;
11
+ 'readonly-text'?: string;
11
12
  mode?: 'dark' | 'light';
12
13
  } & CommonAttrs;
13
14
  export {};
@@ -8,6 +8,7 @@ export interface InputStatesInterface {
8
8
  invalid: boolean;
9
9
  filled: boolean;
10
10
  disabled: boolean;
11
+ readonly: boolean;
11
12
  };
12
13
  nativeInput: HTMLInputElement | HTMLTextAreaElement | undefined;
13
14
  }
@@ -0,0 +1,4 @@
1
+ type Callback<T> = () => Promise<T>;
2
+ type LimitedPromises = <T>(callback: Callback<T>) => Promise<T>;
3
+ export declare function concurrencyLimit(maxConcurrent: number): LimitedPromises;
4
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,14 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../base/UiKitElement.cjs"),y=require("../../decorators/customUiKitElement.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const r=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const h=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),b=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs"),p=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query-assigned-elements.cjs"),u=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),S=require("./controllers/SelectKeyboardController.cjs"),O=require("./styles/common.styles.cjs");var f=Object.defineProperty,g=Object.getOwnPropertyDescriptor,n=(c,e,t,i)=>{for(var s=i>1?void 0:i?g(e,t):e,a=c.length-1,l;a>=0;a--)(l=c[a])&&(s=(i?l(e,t,s):l(s))||s);return i&&s&&f(e,t,s),s};exports.DsSelect=class extends m.UiKitElement{constructor(){super(...arguments),this.mode="light",this.size="medium",this.variant="primary",this._open=!1,this.nativeSelect=null,this.nativeLabel=null,this.nativeOptions=[],this.activeIndex=-1,this.hasForcedError=!1,this.handleMutations=e=>{e.forEach(t=>{t.type==="childList"&&this.syncNativeOptions()}),this.requestUpdate()},this.syncNativeOptions=()=>{this.nativeOptions=Array.from(this.nativeSelect.options)},this.handleOpen=()=>{this._open=!0,this.activeIndex=this.findSelectedOptionIndex(),this.focusDisplaySelect()},this.handleClose=()=>{this._open=!1},this.handleClickDisplaySelect=()=>{this._open?this.handleClose():this.handleOpen()},this.handleKeydown=e=>{this._open?S.SelectKeyboardController.handleKeydownWhenOpen(e,{commit:()=>this.commitSelection(),navigateNext:()=>this.advanceSelection(1),navigatePrev:()=>this.advanceSelection(-1),navigateFirst:()=>this.advanceToFirst(),navigateLast:()=>this.advanceToLast(),close:this.handleClose}):S.SelectKeyboardController.handleKeydownWhenClosed(e,{open:this.handleOpen})}}firstUpdated(){this.initializeNativeSelect()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}initializeNativeSelect(){var e,t;this.nativeSelect=(e=this.nativeSelects)==null?void 0:e[0],this.nativeLabel=(t=this.nativeLabels)==null?void 0:t[0],this.nativeSelect&&(this.syncNativeOptions(),this.setupNativeElementsAttributes(),this.setupEventListeners())}handleChangeForcedError(){var e;this.hasForcedError=((e=this.forcedError)==null?void 0:e.length)>0}setupNativeElementsAttributes(){this.nativeSelect.setAttribute("aria-hidden","true"),this.nativeSelect.setAttribute("tabindex","-1")}setupEventListeners(){this.nativeSelect.addEventListener("change",this.syncNativeOptions),this.observer=new MutationObserver(this.handleMutations),this.observer.observe(this.nativeSelect,{childList:!0,subtree:!0,attributes:!0})}cleanup(){var e,t;(e=this.nativeSelect)==null||e.removeEventListener("change",this.syncNativeOptions),(t=this.observer)==null||t.disconnect()}findSelectedOptionIndex(){var t;const e=this.nativeOptions.findIndex(i=>i.value===this.nativeSelect.value);return(t=this.nativeOptions[e])!=null&&t.hidden?this.nativeOptions.findIndex(i=>!i.hidden):e}focusDisplaySelect(){this.updateComplete.then(()=>{var e;(e=this.displaySelect)==null||e.focus()})}advanceToFirst(){if(this.nativeOptions.length){const t=this.nativeOptions.findIndex(i=>!i.hidden);this.advanceSelection(t-this.activeIndex)}}advanceToLast(){if(this.nativeOptions.length){let t=-1;for(let i=this.nativeOptions.length-1;i>=0;i--)if(!this.nativeOptions[i].hidden){t=i;break}this.advanceSelection(t-this.activeIndex)}}advanceSelection(e){const t=this.nativeOptions.length;this.activeIndex=(this.activeIndex+e+t)%t,this.shouldSkipHiddenOption()?this.advanceSelection(Math.sign(e)):this.scrollToActive(this.nativeOptions[this.activeIndex])}shouldSkipHiddenOption(){return this.nativeOptions.some(t=>!t.hidden)&&this.nativeOptions[this.activeIndex].hidden}scrollToActive(e){var t;(t=e==null?void 0:e.scrollIntoView)==null||t.call(e,{block:"nearest"})}commitSelection(){this.handleClose();const e=this.nativeOptions[this.activeIndex];this.nativeSelect&&(e!=null&&e.value)&&this.updateNativeSelectValue(e.value)}updateNativeSelectValue(e){this.nativeSelect.value=e,["input","change"].forEach(t=>this.nativeSelect.dispatchEvent(new Event(t,{bubbles:!0,composed:!0})))}get containerClasses(){var e,t,i,s;return{container:!0,open:this._open,disabled:!!((e=this.nativeSelect)!=null&&e.disabled),filled:!!((i=(t=this.nativeOptions)==null?void 0:t.find(a=>a.selected&&!a.hidden))!=null&&i.selected),invalid:!((s=this.nativeSelect)!=null&&s.validity.valid),error:this.hasForcedError,[this.size]:!!this.size,[this.mode]:!!this.mode,[this.variant]:!!this.variant}}set open(e){this._open=e}get open(){return this._open}render(){return r.html`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../base/UiKitElement.cjs"),m=require("../../decorators/customUiKitElement.cjs"),b=require("../../utils/booleanConverter.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const r=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const c=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),O=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs"),p=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query-assigned-elements.cjs"),u=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),S=require("./controllers/SelectKeyboardController.cjs"),f=require("./styles/common.styles.cjs");var g=Object.defineProperty,C=Object.getOwnPropertyDescriptor,n=(d,e,t,i)=>{for(var s=i>1?void 0:i?C(e,t):e,a=d.length-1,l;a>=0;a--)(l=d[a])&&(s=(i?l(e,t,s):l(s))||s);return i&&s&&g(e,t,s),s};exports.DsSelect=class extends y.UiKitElement{constructor(){super(...arguments),this.mode="light",this.size="medium",this.variant="primary",this.readonly=!1,this._open=!1,this.nativeSelect=null,this.nativeLabel=null,this.nativeOptions=[],this.activeIndex=-1,this.hasForcedError=!1,this.handleMutations=e=>{e.forEach(t=>{t.type==="childList"&&this.syncNativeOptions()}),this.requestUpdate()},this.syncNativeOptions=()=>{this.nativeOptions=Array.from(this.nativeSelect.options)},this.handleOpen=()=>{this.readonly||(this._open=!0,this.activeIndex=this.findSelectedOptionIndex(),this.focusDisplaySelect())},this.handleClose=()=>{this._open=!1},this.handleClickDisplaySelect=()=>{this._open?this.handleClose():this.handleOpen()},this.handleKeydown=e=>{this._open?S.SelectKeyboardController.handleKeydownWhenOpen(e,{commit:()=>this.commitSelection(),navigateNext:()=>this.advanceSelection(1),navigatePrev:()=>this.advanceSelection(-1),navigateFirst:()=>this.advanceToFirst(),navigateLast:()=>this.advanceToLast(),close:this.handleClose}):S.SelectKeyboardController.handleKeydownWhenClosed(e,{open:this.handleOpen})}}firstUpdated(){this.initializeNativeSelect()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}initializeNativeSelect(){var e,t;this.nativeSelect=(e=this.nativeSelects)==null?void 0:e[0],this.nativeLabel=(t=this.nativeLabels)==null?void 0:t[0],this.nativeSelect&&(this.syncNativeOptions(),this.setupNativeElementsAttributes(),this.setupEventListeners())}handleChangeForcedError(){var e;this.hasForcedError=((e=this.forcedError)==null?void 0:e.length)>0}setupNativeElementsAttributes(){this.nativeSelect.setAttribute("aria-hidden","true"),this.nativeSelect.setAttribute("tabindex","-1")}setupEventListeners(){this.nativeSelect.addEventListener("change",this.syncNativeOptions),this.observer=new MutationObserver(this.handleMutations),this.observer.observe(this.nativeSelect,{childList:!0,subtree:!0,attributes:!0})}cleanup(){var e,t;(e=this.nativeSelect)==null||e.removeEventListener("change",this.syncNativeOptions),(t=this.observer)==null||t.disconnect()}findSelectedOptionIndex(){var t;const e=this.nativeOptions.findIndex(i=>i.value===this.nativeSelect.value);return(t=this.nativeOptions[e])!=null&&t.hidden?this.nativeOptions.findIndex(i=>!i.hidden):e}focusDisplaySelect(){this.updateComplete.then(()=>{var e;(e=this.displaySelect)==null||e.focus()})}advanceToFirst(){if(this.nativeOptions.length){const t=this.nativeOptions.findIndex(i=>!i.hidden);this.advanceSelection(t-this.activeIndex)}}advanceToLast(){if(this.nativeOptions.length){let t=-1;for(let i=this.nativeOptions.length-1;i>=0;i--)if(!this.nativeOptions[i].hidden){t=i;break}this.advanceSelection(t-this.activeIndex)}}advanceSelection(e){const t=this.nativeOptions.length;this.activeIndex=(this.activeIndex+e+t)%t,this.shouldSkipHiddenOption()?this.advanceSelection(Math.sign(e)):this.scrollToActive(this.nativeOptions[this.activeIndex])}shouldSkipHiddenOption(){return this.nativeOptions.some(t=>!t.hidden)&&this.nativeOptions[this.activeIndex].hidden}scrollToActive(e){var t;(t=e==null?void 0:e.scrollIntoView)==null||t.call(e,{block:"nearest"})}commitSelection(){this.handleClose();const e=this.nativeOptions[this.activeIndex];this.nativeSelect&&(e!=null&&e.value)&&this.updateNativeSelectValue(e.value)}updateNativeSelectValue(e){this.nativeSelect.value=e,["input","change"].forEach(t=>this.nativeSelect.dispatchEvent(new Event(t,{bubbles:!0,composed:!0})))}get containerClasses(){var e,t,i,s;return{container:!0,open:this._open,disabled:!!((e=this.nativeSelect)!=null&&e.disabled),readonly:!!this.readonly,filled:!!((i=(t=this.nativeOptions)==null?void 0:t.find(a=>a.selected&&!a.hidden))!=null&&i.selected),invalid:!((s=this.nativeSelect)!=null&&s.validity.valid),error:this.hasForcedError,[this.size]:!!this.size,[this.mode]:!!this.mode,[this.variant]:!!this.variant}}set open(e){this._open=e}get open(){return this._open}render(){return r.html`
2
2
  <slot @slotchange=${this.initializeNativeSelect}></slot>
3
3
  <div class=${u.classMap(this.containerClasses)}>
4
4
  ${this.displaySelectTemplate}
5
5
  ${this.optionsContainerTemplate}
6
6
  <slot name="helper-text"></slot>
7
+ <slot name="readonly-text"></slot>
7
8
  <slot name="forced-error" @slotchange=${this.handleChangeForcedError}></slot>
8
9
  <slot name="invalid-error"></slot>
9
10
  </div>
10
- `}get iconTemplate(){return this.componentFactory.createIcon({class:"icon","icon-name":this._open?"arrow-up":"arrow-down"})}get displaySelectTemplate(){var i,s,a;const e=this.nativeOptions.find(l=>l.selected),t=(i=Array.from((e==null?void 0:e.childNodes)||[]))==null?void 0:i.map(l=>{const v=l.cloneNode(!0);if(l.nodeType!==3)return v;if(l.textContent.trim()==="")return"";const d=document.createElement("span");return d.classList.add("text"),d.appendChild(v),d});return r.html`
11
+ `}get iconTemplate(){return this.componentFactory.createIcon({class:"icon","icon-name":this._open?"arrow-up":"arrow-down"})}get displaySelectTemplate(){var i,s,a;const e=this.nativeOptions.find(l=>l.selected),t=(i=Array.from((e==null?void 0:e.childNodes)||[]))==null?void 0:i.map(l=>{const v=l.cloneNode(!0);if(l.nodeType!==3)return v;if(l.textContent.trim()==="")return"";const h=document.createElement("span");return h.classList.add("text"),h.appendChild(v),h});return r.html`
11
12
  <div class="select-outline">
12
13
  <div class="select-container">
13
14
  <label id="display-label" class="label">${(s=this.nativeLabel)==null?void 0:s.innerText}</label>
@@ -44,4 +45,4 @@
44
45
  >
45
46
  ${i}
46
47
  </div>
47
- `}};exports.DsSelect.styles=[O.commonStyles];exports.DsSelect.ARIA_OPTION_PREFIX="option-";n([h.property({type:String})],exports.DsSelect.prototype,"mode",2);n([h.property({type:String})],exports.DsSelect.prototype,"size",2);n([h.property({type:String})],exports.DsSelect.prototype,"variant",2);n([o.state()],exports.DsSelect.prototype,"_open",2);n([o.state()],exports.DsSelect.prototype,"nativeSelect",2);n([o.state()],exports.DsSelect.prototype,"nativeLabel",2);n([o.state()],exports.DsSelect.prototype,"nativeOptions",2);n([o.state()],exports.DsSelect.prototype,"activeIndex",2);n([o.state()],exports.DsSelect.prototype,"hasForcedError",2);n([p.queryAssignedElements({slot:"",selector:"select",flatten:!0})],exports.DsSelect.prototype,"nativeSelects",2);n([p.queryAssignedElements({slot:"",selector:"label",flatten:!0})],exports.DsSelect.prototype,"nativeLabels",2);n([p.queryAssignedElements({slot:"forced-error",flatten:!0})],exports.DsSelect.prototype,"forcedError",2);n([b.query(".select")],exports.DsSelect.prototype,"displaySelect",2);exports.DsSelect=n([y.customUiKitElement("ds-select")],exports.DsSelect);
48
+ `}};exports.DsSelect.styles=[f.commonStyles];exports.DsSelect.ARIA_OPTION_PREFIX="option-";n([c.property({type:String})],exports.DsSelect.prototype,"mode",2);n([c.property({type:String})],exports.DsSelect.prototype,"size",2);n([c.property({type:String})],exports.DsSelect.prototype,"variant",2);n([c.property({type:Boolean,converter:b.booleanConverter,reflect:!0})],exports.DsSelect.prototype,"readonly",2);n([o.state()],exports.DsSelect.prototype,"_open",2);n([o.state()],exports.DsSelect.prototype,"nativeSelect",2);n([o.state()],exports.DsSelect.prototype,"nativeLabel",2);n([o.state()],exports.DsSelect.prototype,"nativeOptions",2);n([o.state()],exports.DsSelect.prototype,"activeIndex",2);n([o.state()],exports.DsSelect.prototype,"hasForcedError",2);n([p.queryAssignedElements({slot:"",selector:"select",flatten:!0})],exports.DsSelect.prototype,"nativeSelects",2);n([p.queryAssignedElements({slot:"",selector:"label",flatten:!0})],exports.DsSelect.prototype,"nativeLabels",2);n([p.queryAssignedElements({slot:"forced-error",flatten:!0})],exports.DsSelect.prototype,"forcedError",2);n([O.query(".select")],exports.DsSelect.prototype,"displaySelect",2);exports.DsSelect=n([m.customUiKitElement("ds-select")],exports.DsSelect);
@@ -1,17 +1,17 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../base/UiKitElement.cjs"),c=require("./utils/getStepValue/getStepValue.cjs"),D=require("./utils/roundToDecimals/roundToDecimals.cjs"),V=require("../../decorators/customUiKitElement.cjs"),$=require("../../mixins/ViewportMixin.cjs"),T=require("../../utils/booleanConverter.cjs"),L=require("../../utils/formatNumber/formatNumber.cjs"),P=require("../../utils/htmlWithTokens.cjs"),k=require("../../utils/objectConverter.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const o=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),m=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),E=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs"),q=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),d=require("./styles/common.styles.cjs");var F=Object.defineProperty,N=Object.getOwnPropertyDescriptor,n=(u,t,e,i)=>{for(var s=i>1?void 0:i?N(t,e):t,r=u.length-1,l;r>=0;r--)(l=u[r])&&(s=(i?l(t,e,s):l(s))||s);return i&&s&&F(t,e,s),s};exports.DsSlider=class extends $.ViewportMixin(w.UiKitElement){constructor(){super(...arguments),this.min=0,this.max=100,this.minLabel="",this.maxLabel="",this.step=1,this.initialValueMin=0,this.mode="light",this.locale=void 0,this.localeMatcher="lookup",this.useGrouping=!0,this.minimumIntegerDigits=1,this.minimumFractionDigits=0,this.maximumFractionDigits=3,this.size="medium",this.disabled=!1,this.keyboardMode=!1,this.getNewValue=t=>{const{width:e,left:i}=this.track.getBoundingClientRect(),s=t.type.indexOf("mouse")!==-1?t.clientX:t.touches[0].clientX,l=Math.min(Math.max(0,s-i),e)*100/e;return this.min+l*(this.max-this.min)/100},this.setActiveThumb=t=>{const e=this.getNewValue(t);typeof this.valueMax!="number"||e<=this.valueMin?this.activeThumb="min":e>=this.valueMax?this.activeThumb="max":e-this.valueMin<this.valueMax-e?this.activeThumb="min":this.activeThumb="max"},this.handleMouseMove=t=>{this.animationFrameRequest&&cancelAnimationFrame(this.animationFrameRequest),this.animationFrameRequest=requestAnimationFrame(()=>{const e=this.getNewValue(t),i=this.activeThumb??"min",{stepValue:s}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:e,role:i,currentValues:{1:this.valueMin,...typeof this.valueMax=="number"?{2:this.valueMax}:{}}});this.handleChange({value:s,role:i})})},this.handleMouseDown=t=>{var e;this.disabled||((e=t==null?void 0:t.preventDefault)==null||e.call(t),this.setActiveThumb(t),this.handleMouseMove(t),window==null||window.addEventListener("mousemove",this.handleMouseMove),window==null||window.addEventListener("touchmove",this.handleMouseMove),window==null||window.addEventListener("pointerup",this.handlePointerUp))},this.handlePointerUp=()=>{window==null||window.removeEventListener("mousemove",this.handleMouseMove),window==null||window.removeEventListener("touchmove",this.handleMouseMove),window==null||window.removeEventListener("pointerup",this.handlePointerUp)},this.handleKeydown=()=>{this.keyboardMode=!0},this.handlePointerOrMouseDown=()=>{this.keyboardMode=!1},this.onInputFocus=(t,e)=>{const i=t.currentTarget,s=e===1?"min":"max";this.editingField=s,i.type="number",i.step=String(this.step??1);const r=s==="min"?this.valueMin:this.valueMax;i.value=String(r??""),this.keyboardMode&&i.classList.add("focus-visible")},this.commitInputValue=(t,e)=>{const i=t.currentTarget,s=e===1?"min":"max",{stepValue:r}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:Number(i.value),role:s,currentValues:{1:this.valueMin,...typeof this.valueMax=="number"?{2:this.valueMax}:{}}});this.handleChange({value:r,role:s}),i.value=String(r)},this.onInputBlur=t=>{var i;this.editingField=void 0;const e=t.currentTarget;(i=e==null?void 0:e.classList)==null||i.remove("focus-visible")},this.onInputKeyDown=(t,e)=>{t.key==="Enter"&&(t.preventDefault(),this.commitInputValue(t,e))},this.onThumbKeyDown=(t,e)=>{if(!this.disabled&&(t.key==="ArrowLeft"||t.key==="ArrowRight")){t.preventDefault();const i=this.step??1,s=t.key==="ArrowLeft"?-i:i,r=e===1?"min":"max",p=(r==="min"?this.valueMin:this.valueMax)+s,{stepValue:y}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:p,role:r,currentValues:{1:this.valueMin,...typeof this.valueMax=="number"?{2:this.valueMax}:{}}});this.handleChange({value:y,role:r})}}}disconnectedCallback(){super.disconnectedCallback(),window==null||window.removeEventListener("mousemove",this.handleMouseMove),window==null||window.removeEventListener("touchmove",this.handleMouseMove),window==null||window.removeEventListener("pointerup",this.handlePointerUp),window==null||window.removeEventListener("keydown",this.handleKeydown),window==null||window.removeEventListener("mousedown",this.handlePointerOrMouseDown),window==null||window.removeEventListener("pointerdown",this.handlePointerOrMouseDown)}firstUpdated(t){super.firstUpdated(t),window==null||window.addEventListener("keydown",this.handleKeydown),window==null||window.addEventListener("mousedown",this.handlePointerOrMouseDown),window==null||window.addEventListener("pointerdown",this.handlePointerOrMouseDown),["min","max"].forEach(i=>{const r=this[i==="min"?"initialValueMin":"initialValueMax"];if(typeof r!="number")return;const{stepValue:l}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:r,role:i,currentValues:{1:this.valueMin,...typeof this.valueMax=="number"?{2:this.valueMax}:{}}});this[i==="min"?"valueMin":"valueMax"]!==l&&this.handleChange({value:l,role:i})})}getTrackPct(t){const e=this.max-this.min;return e===0?0:(t-this.min)/e*100}handleChange({value:t,role:e}){const i=D.roundToDecimals({value:t,fractionDigits:this.maximumFractionDigits}),s=e==="min"?"valueMin":"valueMax";this[s]!==i&&(this[s]=i,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{role:e,value:i}})))}formatNumber(t){const e={value:t,locale:this.locale,...this.unitStyle&&{style:this.unitStyle},...this.currency&&{currency:this.currency},...this.unit&&{unit:this.unit},localeMatcher:this.localeMatcher,minimumIntegerDigits:this.minimumIntegerDigits,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,thousandSeparator:this.thousandSeparator,fractionSeparator:this.fractionSeparator,useGrouping:this.useGrouping};return L.formatNumber(e)}get rangeValuesTemplates(){const{formattedValue:t,unitSymbol:e,unitSymbolPosition:i}=this.formatNumber(this.min),s=this.unitSymbol??e,r=this.unitSymbolPosition??i,{formattedValue:l}=this.formatNumber(this.max);return o.html`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../base/UiKitElement.cjs"),c=require("./utils/getStepValue/getStepValue.cjs"),D=require("./utils/roundToDecimals/roundToDecimals.cjs"),$=require("../../decorators/customUiKitElement.cjs"),V=require("../../mixins/ViewportMixin.cjs"),_=require("../../utils/booleanConverter.cjs"),T=require("../../utils/formatNumber/formatNumber.cjs"),L=require("../../utils/htmlWithTokens.cjs"),P=require("../../utils/objectConverter.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const o=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),h=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),k=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs"),q=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),E=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs"),d=require("./styles/common.styles.cjs");var F=Object.defineProperty,C=Object.getOwnPropertyDescriptor,s=(u,t,e,i)=>{for(var n=i>1?void 0:i?C(t,e):t,r=u.length-1,l;r>=0;r--)(l=u[r])&&(n=(i?l(t,e,n):l(n))||n);return i&&n&&F(t,e,n),n};exports.DsSlider=class extends V.ViewportMixin(w.UiKitElement){constructor(){super(...arguments),this.min=0,this.max=100,this.minLabel="",this.maxLabel="",this.step=1,this.initialValueMin=0,this.mode="light",this.locale=void 0,this.localeMatcher="lookup",this.useGrouping=!0,this.minimumIntegerDigits=1,this.minimumFractionDigits=0,this.maximumFractionDigits=3,this.size="medium",this.disabled=!1,this.keyboardMode=!1,this.getNewValue=t=>{const{width:e,left:i}=this.track.getBoundingClientRect(),n=t.type.indexOf("mouse")!==-1?t.clientX:t.touches[0].clientX,l=Math.min(Math.max(0,n-i),e)*100/e;return this.min+l*(this.max-this.min)/100},this.setActiveThumb=t=>{const e=this.getNewValue(t);typeof this._valueMax!="number"||e<=this._valueMin?this.activeThumb="min":e>=this._valueMax?this.activeThumb="max":e-this._valueMin<this._valueMax-e?this.activeThumb="min":this.activeThumb="max"},this.handleMouseMove=t=>{this.animationFrameRequest&&cancelAnimationFrame(this.animationFrameRequest),this.animationFrameRequest=requestAnimationFrame(()=>{const e=this.getNewValue(t),i=this.activeThumb??"min",{stepValue:n}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:e,role:i,currentValues:{1:this._valueMin,...typeof this._valueMax=="number"?{2:this._valueMax}:{}}});this.handleChange({value:n,role:i})})},this.handleMouseDown=t=>{var e;this.disabled||((e=t==null?void 0:t.preventDefault)==null||e.call(t),this.setActiveThumb(t),this.handleMouseMove(t),window==null||window.addEventListener("mousemove",this.handleMouseMove),window==null||window.addEventListener("touchmove",this.handleMouseMove),window==null||window.addEventListener("pointerup",this.handlePointerUp))},this.handlePointerUp=()=>{window==null||window.removeEventListener("mousemove",this.handleMouseMove),window==null||window.removeEventListener("touchmove",this.handleMouseMove),window==null||window.removeEventListener("pointerup",this.handlePointerUp)},this.handleKeydown=()=>{this.keyboardMode=!0},this.handlePointerOrMouseDown=()=>{this.keyboardMode=!1},this.onInputFocus=(t,e)=>{const i=t.currentTarget,n=e===1?"min":"max";this.editingField=n,i.type="number",i.step=String(this.step??1);const r=n==="min"?this._valueMin:this._valueMax;i.value=String(r??""),this.keyboardMode&&i.classList.add("focus-visible")},this.commitInputValue=(t,e)=>{const i=t.currentTarget,n=e===1?"min":"max",{stepValue:r}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:Number(i.value),role:n,currentValues:{1:this._valueMin,...typeof this._valueMax=="number"?{2:this._valueMax}:{}}});this.handleChange({value:r,role:n}),this.isControlled(n)||(i.value=String(r))},this.onInputBlur=t=>{var i;this.editingField=void 0;const e=t.currentTarget;(i=e==null?void 0:e.classList)==null||i.remove("focus-visible")},this.onInputKeyDown=(t,e)=>{t.key==="Enter"&&(t.preventDefault(),this.commitInputValue(t,e))},this.onThumbKeyDown=(t,e)=>{if(!this.disabled&&(t.key==="ArrowLeft"||t.key==="ArrowRight")){t.preventDefault();const i=this.step??1,n=t.key==="ArrowLeft"?-i:i,r=e===1?"min":"max",p=(r==="min"?this._valueMin:this._valueMax)+n,{stepValue:y}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:p,role:r,currentValues:{1:this._valueMin,...typeof this._valueMax=="number"?{2:this._valueMax}:{}}});this.handleChange({value:y,role:r})}}}get isRange(){return typeof this.initialValueMax=="number"||typeof this.valueMax=="number"}isControlled(t){return typeof(t==="min"?this.valueMin:this.valueMax)=="number"}willUpdate(t){super.willUpdate(t),typeof this.valueMin=="number"&&(this._valueMin=this.valueMin),typeof this.valueMax=="number"&&(this._valueMax=this.valueMax)}disconnectedCallback(){super.disconnectedCallback(),window==null||window.removeEventListener("mousemove",this.handleMouseMove),window==null||window.removeEventListener("touchmove",this.handleMouseMove),window==null||window.removeEventListener("pointerup",this.handlePointerUp),window==null||window.removeEventListener("keydown",this.handleKeydown),window==null||window.removeEventListener("mousedown",this.handlePointerOrMouseDown),window==null||window.removeEventListener("pointerdown",this.handlePointerOrMouseDown)}firstUpdated(t){super.firstUpdated(t),window==null||window.addEventListener("keydown",this.handleKeydown),window==null||window.addEventListener("mousedown",this.handlePointerOrMouseDown),window==null||window.addEventListener("pointerdown",this.handlePointerOrMouseDown),["min","max"].forEach(i=>{if(this.isControlled(i))return;const r=this[i==="min"?"initialValueMin":"initialValueMax"];if(typeof r!="number")return;const{stepValue:l}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:r,role:i,currentValues:{1:this._valueMin,...typeof this._valueMax=="number"?{2:this._valueMax}:{}}});this[i==="min"?"_valueMin":"_valueMax"]!==l&&this.handleChange({value:l,role:i})})}getTrackPct(t){const e=this.max-this.min;return e===0?0:(t-this.min)/e*100}handleChange({value:t,role:e}){const i=D.roundToDecimals({value:t,fractionDigits:this.maximumFractionDigits}),n=e==="min"?"_valueMin":"_valueMax";this[n]!==i&&(this.isControlled(e)||(this[n]=i),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{role:e,value:i}})))}formatNumber(t){const e={value:t,locale:this.locale,...this.unitStyle&&{style:this.unitStyle},...this.currency&&{currency:this.currency},...this.unit&&{unit:this.unit},localeMatcher:this.localeMatcher,minimumIntegerDigits:this.minimumIntegerDigits,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,thousandSeparator:this.thousandSeparator,fractionSeparator:this.fractionSeparator,useGrouping:this.useGrouping};return T.formatNumber(e)}get rangeValuesTemplates(){const{formattedValue:t,unitSymbol:e,unitSymbolPosition:i}=this.formatNumber(this.min),n=this.unitSymbol??e,r=this.unitSymbolPosition??i,{formattedValue:l}=this.formatNumber(this.max);return o.html`
2
2
  <div class="range-value-text">
3
3
  ${this.minLabel?o.html`<span class="range-value-label">${this.minLabel}</span>`:o.nothing}
4
- ${r==="left"?o.html`<span>${s}</span>`:o.nothing}
4
+ ${r==="left"?o.html`<span>${n}</span>`:o.nothing}
5
5
  <span>${t}</span>
6
- ${r==="right"?o.html`<span>${s}</span>`:o.nothing}
6
+ ${r==="right"?o.html`<span>${n}</span>`:o.nothing}
7
7
  </div>
8
8
  <div class="range-value-text">
9
9
  ${this.maxLabel?o.html` <span class="range-value-label">${this.maxLabel}</span>`:o.nothing}
10
- ${r==="left"?o.html`<span>${s}</span>`:o.nothing}
10
+ ${r==="left"?o.html`<span>${n}</span>`:o.nothing}
11
11
  <span>${l}</span>
12
- ${r==="right"?o.html`<span>${s}</span>`:o.nothing}
12
+ ${r==="right"?o.html`<span>${n}</span>`:o.nothing}
13
13
  </div>
14
- `}getThumbTemplate(t){const e=t===1?"min":"max",i=e==="min"?this.valueMin:this.valueMax,{minLimit:s,maxLimit:r}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:i,role:e,currentValues:{1:this.valueMin,...typeof this.valueMax=="number"?{2:this.valueMax}:{}}}),l=this.getTrackPct(i);return o.html`
14
+ `}getThumbTemplate(t){const e=t===1?"min":"max",i=e==="min"?this._valueMin:this._valueMax,{minLimit:n,maxLimit:r}=c.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:i,role:e,currentValues:{1:this._valueMin,...typeof this._valueMax=="number"?{2:this._valueMax}:{}}}),l=this.getTrackPct(i);return o.html`
15
15
  <style>
16
16
  .thumb${t} {
17
17
  left: ${l}%;
@@ -25,7 +25,7 @@
25
25
  tabindex=${this.disabled?-1:0}
26
26
  aria-disabled=${String(!!this.disabled)}
27
27
  aria-label=${t===1?"Minumum value":"Maximum Value"}
28
- aria-valuemin=${s}
28
+ aria-valuemin=${n}
29
29
  aria-valuemax=${r}
30
30
  aria-valuenow=${i}
31
31
  >
@@ -40,8 +40,8 @@
40
40
  </div>
41
41
  `}get thumbTemplates(){return o.html`
42
42
  ${this.getThumbTemplate(1)}
43
- ${typeof this.initialValueMax=="number"?this.getThumbTemplate(2):o.nothing}
44
- `}get trackRangeTemplate(){let t,e;return typeof this.initialValueMax!="number"?(t=0,e=this.getTrackPct(this.valueMin)):(t=this.getTrackPct(this.valueMin),e=this.getTrackPct(this.valueMax)-t),o.html`
43
+ ${this.isRange?this.getThumbTemplate(2):o.nothing}
44
+ `}get trackRangeTemplate(){let t,e;return this.isRange?(t=this.getTrackPct(this._valueMin),e=this.getTrackPct(this._valueMax)-t):(t=0,e=this.getTrackPct(this._valueMin)),o.html`
45
45
  <style>
46
46
  .track-range {
47
47
  left: ${t}%;
@@ -49,31 +49,31 @@
49
49
  }
50
50
  </style>
51
51
  <div class="track-range" role="presentation"></div>
52
- `}getInputTemplate(t){const e=t===1?"min":"max",i=this.editingField===e,s=e==="min"?this.valueMin:this.valueMax,{formattedValue:r,unitSymbol:l,unitSymbolPosition:p}=this.formatNumber(s),y=this.unitSymbolPosition??p,b=this.unitSymbol??l,g=b?y==="left"?`${b} ${r}`:`${r} ${b}`:`${r}`,S=i?"number":"text",v=i?String(s??""):g,M=t===1?this.inputMinAriaLabel:this.inputMaxAriaLabel,x=typeof this.initialValueMax=="number"?t===1?"Start value":"End value":"Value",f=M??x;return o.html`
52
+ `}getInputTemplate(t){const e=t===1?"min":"max",i=this.editingField===e,n=e==="min"?this._valueMin:this._valueMax,{formattedValue:r,unitSymbol:l,unitSymbolPosition:p}=this.formatNumber(n),y=this.unitSymbolPosition??p,b=this.unitSymbol??l,g=b?y==="left"?`${b} ${r}`:`${r} ${b}`:`${r}`,S=i?"number":"text",v=i?String(n??""):g,M=t===1?this.inputMinAriaLabel:this.inputMaxAriaLabel,f=this.isRange?t===1?"Start value":"End value":"Value",x=M??f;return o.html`
53
53
  <div class="input-wrapper">
54
54
  <input
55
55
  class="input-value input-value-${t}"
56
56
  type=${S}
57
- .value=${v}
57
+ .value=${E.live(v)}
58
58
  step=${String(this.step??1)}
59
59
  ?disabled=${this.disabled}
60
60
  tabindex=${this.disabled?-1:0}
61
61
  aria-disabled=${String(!!this.disabled)}
62
- aria-label=${f}
62
+ aria-label=${x}
63
63
  ?readonly=${this.disabled}
64
- @focus=${h=>this.onInputFocus(h,t)}
64
+ @focus=${m=>this.onInputFocus(m,t)}
65
65
  @blur=${this.onInputBlur}
66
- @change=${h=>this.commitInputValue(h,t)}
67
- @keydown=${h=>this.onInputKeyDown(h,t)}
66
+ @change=${m=>this.commitInputValue(m,t)}
67
+ @keydown=${m=>this.onInputKeyDown(m,t)}
68
68
  title=${v}
69
69
  />
70
70
  </div>
71
71
  `}get inputsTemplate(){return o.html`
72
72
  <div class="inputs-container">
73
73
  ${this.getInputTemplate(1)}
74
- ${typeof this.initialValueMax=="number"?this.getInputTemplate(2):o.nothing}
74
+ ${this.isRange?this.getInputTemplate(2):o.nothing}
75
75
  </div>
76
- `}get containerClasses(){var e;const t=typeof this.size=="string"?this.size:(e=this.size)==null?void 0:e[this.viewport];return{container:!0,[this.mode]:!!this.mode,[t]:!!t,disabled:!!this.disabled}}get styleTokens(){return P.htmlWithTokens`
76
+ `}get containerClasses(){var e;const t=typeof this.size=="string"?this.size:(e=this.size)==null?void 0:e[this.viewport];return{container:!0,[this.mode]:!!this.mode,[t]:!!t,disabled:!!this.disabled}}get styleTokens(){return L.htmlWithTokens`
77
77
  <style>
78
78
  :host{
79
79
  color-scheme: ${this.mode};
@@ -89,4 +89,4 @@
89
89
  <div class="range-value-container">${this.rangeValuesTemplates}</div>
90
90
  ${this.inputsTemplate}
91
91
  </div>
92
- `}};exports.DsSlider.styles=[d.commonStyles,d.trackStyles,d.thumbStyles,d.currentValueStyles,d.rangeValueStyles];n([a.property({type:Number})],exports.DsSlider.prototype,"min",2);n([a.property({type:Number})],exports.DsSlider.prototype,"max",2);n([a.property({type:String,attribute:"min-label"})],exports.DsSlider.prototype,"minLabel",2);n([a.property({type:String,attribute:"max-label"})],exports.DsSlider.prototype,"maxLabel",2);n([a.property({type:Number})],exports.DsSlider.prototype,"step",2);n([a.property({type:Number,attribute:"initial-value-min"})],exports.DsSlider.prototype,"initialValueMin",2);n([a.property({type:Number,attribute:"initial-value-max"})],exports.DsSlider.prototype,"initialValueMax",2);n([a.property({type:String,reflect:!0})],exports.DsSlider.prototype,"mode",2);n([a.property({type:String,attribute:"locale"})],exports.DsSlider.prototype,"locale",2);n([a.property({type:String,attribute:"locale-matcher"})],exports.DsSlider.prototype,"localeMatcher",2);n([a.property({type:String,attribute:"unit-symbol"})],exports.DsSlider.prototype,"unitSymbol",2);n([a.property({type:String,attribute:"unit-symbol-position"})],exports.DsSlider.prototype,"unitSymbolPosition",2);n([a.property({type:String,attribute:"unit-style"})],exports.DsSlider.prototype,"unitStyle",2);n([a.property({type:String,attribute:"currency"})],exports.DsSlider.prototype,"currency",2);n([a.property({type:String,attribute:"unit"})],exports.DsSlider.prototype,"unit",2);n([a.property({type:String,attribute:"use-grouping",converter:u=>u==="auto"?"auto":typeof u=="boolean"?u:u==="true"||u===""?!0:u!=="false"})],exports.DsSlider.prototype,"useGrouping",2);n([a.property({type:Number,attribute:"minimum-integer-digits"})],exports.DsSlider.prototype,"minimumIntegerDigits",2);n([a.property({type:Number,attribute:"minimum-fraction-digits"})],exports.DsSlider.prototype,"minimumFractionDigits",2);n([a.property({type:Number,attribute:"maximum-fraction-digits"})],exports.DsSlider.prototype,"maximumFractionDigits",2);n([a.property({type:String,attribute:"thousand-separator"})],exports.DsSlider.prototype,"thousandSeparator",2);n([a.property({type:String,attribute:"fraction-separator"})],exports.DsSlider.prototype,"fractionSeparator",2);n([a.property({type:String,converter:k.objectConverter})],exports.DsSlider.prototype,"size",2);n([a.property({type:Boolean,converter:T.booleanConverter})],exports.DsSlider.prototype,"disabled",2);n([a.property({type:String,attribute:"input-min-aria-label"})],exports.DsSlider.prototype,"inputMinAriaLabel",2);n([a.property({type:String,attribute:"input-max-aria-label"})],exports.DsSlider.prototype,"inputMaxAriaLabel",2);n([E.query(".track")],exports.DsSlider.prototype,"track",2);n([m.state()],exports.DsSlider.prototype,"valueMin",2);n([m.state()],exports.DsSlider.prototype,"valueMax",2);n([m.state()],exports.DsSlider.prototype,"activeThumb",2);n([m.state()],exports.DsSlider.prototype,"animationFrameRequest",2);n([m.state()],exports.DsSlider.prototype,"editingField",2);n([m.state()],exports.DsSlider.prototype,"keyboardMode",2);exports.DsSlider=n([V.customUiKitElement("ds-slider")],exports.DsSlider);
92
+ `}};exports.DsSlider.styles=[d.commonStyles,d.trackStyles,d.thumbStyles,d.currentValueStyles,d.rangeValueStyles];s([a.property({type:Number})],exports.DsSlider.prototype,"min",2);s([a.property({type:Number})],exports.DsSlider.prototype,"max",2);s([a.property({type:String,attribute:"min-label"})],exports.DsSlider.prototype,"minLabel",2);s([a.property({type:String,attribute:"max-label"})],exports.DsSlider.prototype,"maxLabel",2);s([a.property({type:Number})],exports.DsSlider.prototype,"step",2);s([a.property({type:Number,attribute:"initial-value-min"})],exports.DsSlider.prototype,"initialValueMin",2);s([a.property({type:Number,attribute:"initial-value-max"})],exports.DsSlider.prototype,"initialValueMax",2);s([a.property({type:Number,attribute:"value-min"})],exports.DsSlider.prototype,"valueMin",2);s([a.property({type:Number,attribute:"value-max"})],exports.DsSlider.prototype,"valueMax",2);s([a.property({type:String,reflect:!0})],exports.DsSlider.prototype,"mode",2);s([a.property({type:String,attribute:"locale"})],exports.DsSlider.prototype,"locale",2);s([a.property({type:String,attribute:"locale-matcher"})],exports.DsSlider.prototype,"localeMatcher",2);s([a.property({type:String,attribute:"unit-symbol"})],exports.DsSlider.prototype,"unitSymbol",2);s([a.property({type:String,attribute:"unit-symbol-position"})],exports.DsSlider.prototype,"unitSymbolPosition",2);s([a.property({type:String,attribute:"unit-style"})],exports.DsSlider.prototype,"unitStyle",2);s([a.property({type:String,attribute:"currency"})],exports.DsSlider.prototype,"currency",2);s([a.property({type:String,attribute:"unit"})],exports.DsSlider.prototype,"unit",2);s([a.property({type:String,attribute:"use-grouping",converter:u=>u==="auto"?"auto":typeof u=="boolean"?u:u==="true"||u===""?!0:u!=="false"})],exports.DsSlider.prototype,"useGrouping",2);s([a.property({type:Number,attribute:"minimum-integer-digits"})],exports.DsSlider.prototype,"minimumIntegerDigits",2);s([a.property({type:Number,attribute:"minimum-fraction-digits"})],exports.DsSlider.prototype,"minimumFractionDigits",2);s([a.property({type:Number,attribute:"maximum-fraction-digits"})],exports.DsSlider.prototype,"maximumFractionDigits",2);s([a.property({type:String,attribute:"thousand-separator"})],exports.DsSlider.prototype,"thousandSeparator",2);s([a.property({type:String,attribute:"fraction-separator"})],exports.DsSlider.prototype,"fractionSeparator",2);s([a.property({type:String,converter:P.objectConverter})],exports.DsSlider.prototype,"size",2);s([a.property({type:Boolean,converter:_.booleanConverter})],exports.DsSlider.prototype,"disabled",2);s([a.property({type:String,attribute:"input-min-aria-label"})],exports.DsSlider.prototype,"inputMinAriaLabel",2);s([a.property({type:String,attribute:"input-max-aria-label"})],exports.DsSlider.prototype,"inputMaxAriaLabel",2);s([k.query(".track")],exports.DsSlider.prototype,"track",2);s([h.state()],exports.DsSlider.prototype,"_valueMin",2);s([h.state()],exports.DsSlider.prototype,"_valueMax",2);s([h.state()],exports.DsSlider.prototype,"activeThumb",2);s([h.state()],exports.DsSlider.prototype,"animationFrameRequest",2);s([h.state()],exports.DsSlider.prototype,"editingField",2);s([h.state()],exports.DsSlider.prototype,"keyboardMode",2);exports.DsSlider=s([$.customUiKitElement("ds-slider")],exports.DsSlider);
@@ -1,14 +1,15 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../base/UiKitElement.cjs"),h=require("../../decorators/customUiKitElement.cjs"),c=require("../../mixins/inputStatesMixin.cjs"),d=require("../../utils/validateMaxLength.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const i=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),v=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),m=require("./styles/common.styles.cjs");var f=Object.defineProperty,x=Object.getOwnPropertyDescriptor,n=(o,t,s,e)=>{for(var r=e>1?void 0:e?x(t,s):t,p=o.length-1,l;p>=0;p--)(l=o[p])&&(r=(e?l(t,s,r):l(r))||r);return e&&r&&f(t,s,r),r};exports.DsTextInput=class extends c.inputStatesMixin(u.UiKitElement){constructor(){super(...arguments),this.keyboardMode=!1,this.size="medium",this.helperText="",this.forcedError="",this.invalidError="",this.dataAriaLabelRemoveButton="",this.handleClickIcon=()=>{this.nativeInput.value="",this.nativeInput.focus(),["input","change"].forEach(t=>this.nativeInput.dispatchEvent(new Event(t,{bubbles:!0,composed:!0})))}}get classes(){return{container:!0,error:!!this.forcedError,[this.size]:!!this.size,disabled:this.inputStates.disabled,filled:this.inputStates.filled,invalid:this.inputStates.invalid,focus:this.inputStates.focus,"focus-visible":this.inputStates.focusVisible}}render(){return i.html`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../base/UiKitElement.cjs"),h=require("../../decorators/customUiKitElement.cjs"),d=require("../../mixins/inputStatesMixin.cjs"),c=require("../../utils/validateMaxLength.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const e=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),v=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),m=require("./styles/common.styles.cjs");var y=Object.defineProperty,x=Object.getOwnPropertyDescriptor,s=(o,t,n,r)=>{for(var i=r>1?void 0:r?x(t,n):t,l=o.length-1,p;l>=0;l--)(p=o[l])&&(i=(r?p(t,n,i):p(i))||i);return r&&i&&y(t,n,i),i};exports.DsTextInput=class extends d.inputStatesMixin(u.UiKitElement){constructor(){super(...arguments),this.keyboardMode=!1,this.size="medium",this.helperText="",this.forcedError="",this.invalidError="",this.readonlyText="",this.dataAriaLabelRemoveButton="",this.handleClickIcon=()=>{this.nativeInput.value="",this.nativeInput.focus(),["input","change"].forEach(t=>this.nativeInput.dispatchEvent(new Event(t,{bubbles:!0,composed:!0})))}}get classes(){return{container:!0,error:!!this.forcedError,[this.size]:!!this.size,disabled:this.inputStates.disabled,readonly:this.inputStates.readonly,filled:this.inputStates.filled,invalid:this.inputStates.invalid,focus:this.inputStates.focus,"focus-visible":this.inputStates.focusVisible}}render(){return e.html`
2
2
  <div class=${v.classMap(this.classes)}>
3
3
  <div class="input-container">
4
4
  <div><slot></slot></div>
5
5
  ${this.iconTemplate}
6
6
  </div>
7
7
  <div class="footer">
8
+ ${this.readonlyTextTemplate}
8
9
  ${this.helperTextTemplate}
9
10
  ${this.forcedErrorTemplate}
10
11
  ${this.invalidErrorTemplate}
11
12
  ${this.lengthTemplate}
12
13
  </div>
13
14
  </div>
14
- `}get iconTemplate(){var t,s,e;return(s=(t=this.nativeInput)==null?void 0:t.value)!=null&&s.length?this.componentFactory.createIconButton({class:"icon-button","icon-name":"cross",size:this.size,disabled:!!((e=this.nativeInput)!=null&&e.disabled),variant:"naked","@click":this.handleClickIcon,"data-aria-label":this.dataAriaLabelRemoveButton||"remove button"}):i.nothing}get lengthTemplate(){var s,e,r;const t=(e=(s=this.nativeInput)==null?void 0:s.maxLength)==null?void 0:e.toString();return d.validateMaxLength(t)?i.html`<span class="char-counter">${((r=this.inputStates.currentValue)==null?void 0:r.length)||0}/${t}</span>`:i.nothing}get helperTextTemplate(){return this.forcedError||this.inputStates.invalid&&this.invalidError?i.nothing:i.html`<span class="support-text helper-text">${this.helperText}</span>`}get forcedErrorTemplate(){return this.forcedError?i.html`<span class="support-text error-text forced-error">${this.forcedError}</span>`:i.nothing}get invalidErrorTemplate(){return this.forcedError||!this.inputStates.invalid||!this.invalidError?i.nothing:i.html`<span class="support-text error-text invalid-error">${this.invalidError}</span>`}};exports.DsTextInput.styles=[m.commonStyles];n([a.property({type:String})],exports.DsTextInput.prototype,"size",2);n([a.property({type:String,attribute:"helper-text"})],exports.DsTextInput.prototype,"helperText",2);n([a.property({type:String,attribute:"forced-error"})],exports.DsTextInput.prototype,"forcedError",2);n([a.property({type:String,attribute:"invalid-error"})],exports.DsTextInput.prototype,"invalidError",2);n([a.property({type:String,attribute:"data-aria-label-remove-button"})],exports.DsTextInput.prototype,"dataAriaLabelRemoveButton",2);exports.DsTextInput=n([h.customUiKitElement("ds-text-input")],exports.DsTextInput);
15
+ `}get iconTemplate(){var t,n,r;return!((n=(t=this.nativeInput)==null?void 0:t.value)!=null&&n.length)||this.inputStates.readonly?e.nothing:this.componentFactory.createIconButton({class:"icon-button","icon-name":"cross",size:this.size,disabled:!!((r=this.nativeInput)!=null&&r.disabled),variant:"naked","@click":this.handleClickIcon,"data-aria-label":this.dataAriaLabelRemoveButton||"remove button"})}get lengthTemplate(){var n,r,i;const t=(r=(n=this.nativeInput)==null?void 0:n.maxLength)==null?void 0:r.toString();return c.validateMaxLength(t)?e.html`<span class="char-counter">${((i=this.inputStates.currentValue)==null?void 0:i.length)||0}/${t}</span>`:e.nothing}get helperTextTemplate(){return this.inputStates.readonly||this.forcedError||this.inputStates.invalid&&this.invalidError?e.nothing:e.html`<span class="support-text helper-text">${this.helperText}</span>`}get forcedErrorTemplate(){return this.inputStates.readonly||!this.forcedError?e.nothing:e.html`<span class="support-text error-text forced-error">${this.forcedError}</span>`}get readonlyTextTemplate(){return!this.inputStates.readonly||!this.readonlyText?e.nothing:e.html`<span class="support-text readonly-text">${this.readonlyText}</span>`}get invalidErrorTemplate(){return this.inputStates.readonly||this.forcedError||!this.inputStates.invalid||!this.invalidError?e.nothing:e.html`<span class="support-text error-text invalid-error">${this.invalidError}</span>`}};exports.DsTextInput.styles=[m.commonStyles];s([a.property({type:String})],exports.DsTextInput.prototype,"size",2);s([a.property({type:String,attribute:"helper-text"})],exports.DsTextInput.prototype,"helperText",2);s([a.property({type:String,attribute:"forced-error"})],exports.DsTextInput.prototype,"forcedError",2);s([a.property({type:String,attribute:"invalid-error"})],exports.DsTextInput.prototype,"invalidError",2);s([a.property({type:String,attribute:"readonly-text"})],exports.DsTextInput.prototype,"readonlyText",2);s([a.property({type:String,attribute:"data-aria-label-remove-button"})],exports.DsTextInput.prototype,"dataAriaLabelRemoveButton",2);exports.DsTextInput=s([h.customUiKitElement("ds-text-input")],exports.DsTextInput);