@cupra/ui-kit 1.0.0-canary.13 → 1.0.0-canary.14

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.
@@ -0,0 +1,14 @@
1
+ import { UiKitElement } from '../base/UiKitElement.ts';
2
+ import '../ds-icon/ds-icon.ts';
3
+ import type { DsRatingAttrs } from './ds-rating.types';
4
+ export declare class DsRating extends UiKitElement {
5
+ static styles: import("lit").CSSResult[];
6
+ value: DsRatingAttrs['value'];
7
+ disabled: DsRatingAttrs['disabled'];
8
+ hideRatingText: DsRatingAttrs['hide-rating-text'];
9
+ private get displayValue();
10
+ private get classes();
11
+ private getStarIconName;
12
+ protected get starsTemplate(): any[];
13
+ render(): import("lit").TemplateResult<1>;
14
+ }
@@ -0,0 +1,73 @@
1
+ import { UiKitElement as c } from "../base/UiKitElement.js";
2
+ import { customUiKitElement as h } from "../../decorators/customUiKitElement.js";
3
+ import { booleanConverter as u } from "../../utils/booleanConverter.js";
4
+ import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
5
+ import { html as p } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
6
+ import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
7
+ import { property as m } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
8
+ import { classMap as d } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
9
+ import "../ds-icon/ds-icon.js";
10
+ import { commonStyles as f } from "./styles/common.styles.js";
11
+ var v = Object.defineProperty, g = Object.getOwnPropertyDescriptor, o = (e, t, r, a) => {
12
+ for (var s = a > 1 ? void 0 : a ? g(t, r) : t, l = e.length - 1, n; l >= 0; l--)
13
+ (n = e[l]) && (s = (a ? n(t, r, s) : n(s)) || s);
14
+ return a && s && v(t, r, s), s;
15
+ };
16
+ let i = class extends c {
17
+ constructor() {
18
+ super(...arguments), this.disabled = !1, this.hideRatingText = !1;
19
+ }
20
+ get displayValue() {
21
+ if (this.value === void 0 || this.value === null || this.value < 0) return 0;
22
+ const e = Math.max(0, Math.min(5, this.value)), t = Math.floor(e), r = Number((e - t).toFixed(2));
23
+ return t + Math.round(r / 0.5) * 0.5;
24
+ }
25
+ get classes() {
26
+ return {
27
+ container: !0,
28
+ disabled: this.disabled
29
+ };
30
+ }
31
+ getStarIconName(e, t) {
32
+ return t >= e ? "star-filled" : t >= e - 0.5 ? "half-star-filled" : "star";
33
+ }
34
+ get starsTemplate() {
35
+ const e = this.displayValue, t = [];
36
+ for (let r = 1; r <= 5; r++) {
37
+ const a = this.getStarIconName(r, e);
38
+ a && t.push(
39
+ this.componentFactory.createIcon({
40
+ class: "star-icon",
41
+ "icon-name": a,
42
+ size: 16
43
+ })
44
+ );
45
+ }
46
+ return t;
47
+ }
48
+ render() {
49
+ const e = this.value !== void 0 && this.value >= 0 ? this.value : 0, r = Math.max(0, Math.min(5, e)).toString();
50
+ return p`
51
+ <div class=${d(this.classes)} aria-label=${`Rating: ${r} out of 5`} role="img">
52
+ <div class="stars-wrapper">${this.starsTemplate}</div>
53
+ ${this.hideRatingText ? "" : p`<span class="rating-text">${r}</span>`}
54
+ </div>
55
+ `;
56
+ }
57
+ };
58
+ i.styles = [f];
59
+ o([
60
+ m({ type: Number })
61
+ ], i.prototype, "value", 2);
62
+ o([
63
+ m({ type: Boolean, converter: u, reflect: !0 })
64
+ ], i.prototype, "disabled", 2);
65
+ o([
66
+ m({ type: Boolean, converter: u, attribute: "hide-rating-text" })
67
+ ], i.prototype, "hideRatingText", 2);
68
+ i = o([
69
+ h("ds-rating")
70
+ ], i);
71
+ export {
72
+ i as DsRating
73
+ };
@@ -0,0 +1,8 @@
1
+ import type { DsRating } from './ds-rating';
2
+ import './ds-rating';
3
+ import '../ds-theme-provider/ds-theme-provider.ts';
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'ds-rating': DsRating;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import type { CommonAttrs } from '../../types/types.ts';
2
+ export type DsRatingAttrs = {
3
+ value?: number;
4
+ disabled?: boolean;
5
+ 'hide-rating-text'?: boolean;
6
+ } & CommonAttrs;
@@ -0,0 +1 @@
1
+ export declare const commonStyles: import("lit").CSSResult;
@@ -0,0 +1,14 @@
1
+ import "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
2
+ import "../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
3
+ import "../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
4
+ import { css as r } from "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
5
+ const e = r`
6
+ .container,
7
+ .stars-wrapper {
8
+ display: flex;
9
+ align-items: center;
10
+ }
11
+ `;
12
+ export {
13
+ e as commonStyles
14
+ };
@@ -53,7 +53,7 @@ let m = class extends $ {
53
53
  }
54
54
  loadThemeStyles() {
55
55
  return this.loadStyles ? new Promise((t, o) => {
56
- const s = "/1.0.0-canary.13", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
56
+ const s = "/1.0.0-canary.14", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
57
57
  if (document.head.querySelector(`link[href="${r}"]`)) t();
58
58
  else {
59
59
  const e = `ui-kit-theme-${s}`, a = document.getElementById(e), n = document.createElement("link");
@@ -27,9 +27,10 @@ import './ds-password-input/ds-password-input.ts';
27
27
  import './ds-picker-item/ds-picker-item.ts';
28
28
  import './ds-portal/ds-portal.ts';
29
29
  import './ds-progress-bar/ds-progress-bar.ts';
30
+ import './ds-radio/ds-radio.ts';
30
31
  import './ds-radio-button/ds-radio-button.ts';
31
32
  import './ds-radio-group/ds-radio-group.ts';
32
- import './ds-radio/ds-radio.ts';
33
+ import './ds-rating/ds-rating.ts';
33
34
  import './ds-search-input/ds-search-input.ts';
34
35
  import './ds-search/ds-search.ts';
35
36
  import './ds-secondary-navigation/ds-secondary-navigation.ts';
package/dist/index.js CHANGED
@@ -27,9 +27,10 @@ import "./components/ds-password-input/ds-password-input.js";
27
27
  import "./components/ds-picker-item/ds-picker-item.js";
28
28
  import "./components/ds-portal/ds-portal.js";
29
29
  import "./components/ds-progress-bar/ds-progress-bar.js";
30
+ import "./components/ds-radio/ds-radio.js";
30
31
  import "./components/ds-radio-button/ds-radio-button.js";
31
32
  import "./components/ds-radio-group/ds-radio-group.js";
32
- import "./components/ds-radio/ds-radio.js";
33
+ import "./components/ds-rating/ds-rating.js";
33
34
  import "./components/ds-search-input/ds-search-input.js";
34
35
  import "./components/ds-search/ds-search.js";
35
36
  import "./components/ds-secondary-navigation/ds-secondary-navigation.js";
@@ -54,7 +55,7 @@ import "./components/ds-static-box/ds-static-box.js";
54
55
  import "./components/ds-interactive-card/ds-interactive-card.js";
55
56
  import "./components/ds-radio-button-group/ds-radio-button-group.js";
56
57
  import "./components/ds-sidebar-navigation/ds-sidebar-navigation.js";
57
- import { iconNames as po } from "./components/ds-icon/iconNames.js";
58
+ import { iconNames as to } from "./components/ds-icon/iconNames.js";
58
59
  export {
59
- po as iconNames
60
+ to as iconNames
60
61
  };
@@ -5,7 +5,7 @@ class s {
5
5
  theme: t
6
6
  }) => {
7
7
  if (!t || !e) return;
8
- const c = `https://ds-assets.cupra.com/1.0.0-canary.13/styles/${t}/components/${e}.css`, r = this.getCachedStyleSheetPromise({ url: c });
8
+ const c = `https://ds-assets.cupra.com/1.0.0-canary.14/styles/${t}/components/${e}.css`, r = this.getCachedStyleSheetPromise({ url: c });
9
9
  if (r) return r;
10
10
  const i = this.fetchStyle({ url: c }).then((n) => (n || this.stylePromises.delete(c), n));
11
11
  return this.stylePromises.set(c, i), this.stylePromises.get(c);
@@ -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-v1-0-0-canary-13"), i = n(e);
6
+ const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-14"), 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-v1-0-0-canary-13"), e = i(o);
6
+ const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-14"), e = i(o);
7
7
  return n`${e}`;
8
8
  }
9
9
  export {
@@ -0,0 +1,14 @@
1
+ import { UiKitElement } from '../base/UiKitElement.ts';
2
+ import '../ds-icon/ds-icon.ts';
3
+ import type { DsRatingAttrs } from './ds-rating.types';
4
+ export declare class DsRating extends UiKitElement {
5
+ static styles: import("lit").CSSResult[];
6
+ value: DsRatingAttrs['value'];
7
+ disabled: DsRatingAttrs['disabled'];
8
+ hideRatingText: DsRatingAttrs['hide-rating-text'];
9
+ private get displayValue();
10
+ private get classes();
11
+ private getStarIconName;
12
+ protected get starsTemplate(): any[];
13
+ render(): import("lit").TemplateResult<1>;
14
+ }
@@ -0,0 +1,73 @@
1
+ import { UiKitElement as c } from "../base/UiKitElement.js";
2
+ import { customUiKitElement as h } from "../../decorators/customUiKitElement.js";
3
+ import { booleanConverter as u } from "../../utils/booleanConverter.js";
4
+ import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
5
+ import { html as p } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
6
+ import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
7
+ import { property as m } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
8
+ import { classMap as d } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
9
+ import "../ds-icon/ds-icon.js";
10
+ import { commonStyles as f } from "./styles/common.styles.js";
11
+ var v = Object.defineProperty, g = Object.getOwnPropertyDescriptor, o = (e, t, r, a) => {
12
+ for (var s = a > 1 ? void 0 : a ? g(t, r) : t, l = e.length - 1, n; l >= 0; l--)
13
+ (n = e[l]) && (s = (a ? n(t, r, s) : n(s)) || s);
14
+ return a && s && v(t, r, s), s;
15
+ };
16
+ let i = class extends c {
17
+ constructor() {
18
+ super(...arguments), this.disabled = !1, this.hideRatingText = !1;
19
+ }
20
+ get displayValue() {
21
+ if (this.value === void 0 || this.value === null || this.value < 0) return 0;
22
+ const e = Math.max(0, Math.min(5, this.value)), t = Math.floor(e), r = Number((e - t).toFixed(2));
23
+ return t + Math.round(r / 0.5) * 0.5;
24
+ }
25
+ get classes() {
26
+ return {
27
+ container: !0,
28
+ disabled: this.disabled
29
+ };
30
+ }
31
+ getStarIconName(e, t) {
32
+ return t >= e ? "star-filled" : t >= e - 0.5 ? "half-star-filled" : "star";
33
+ }
34
+ get starsTemplate() {
35
+ const e = this.displayValue, t = [];
36
+ for (let r = 1; r <= 5; r++) {
37
+ const a = this.getStarIconName(r, e);
38
+ a && t.push(
39
+ this.componentFactory.createIcon({
40
+ class: "star-icon",
41
+ "icon-name": a,
42
+ size: 16
43
+ })
44
+ );
45
+ }
46
+ return t;
47
+ }
48
+ render() {
49
+ const e = this.value !== void 0 && this.value >= 0 ? this.value : 0, r = Math.max(0, Math.min(5, e)).toString();
50
+ return p`
51
+ <div class=${d(this.classes)} aria-label=${`Rating: ${r} out of 5`} role="img">
52
+ <div class="stars-wrapper">${this.starsTemplate}</div>
53
+ ${this.hideRatingText ? "" : p`<span class="rating-text">${r}</span>`}
54
+ </div>
55
+ `;
56
+ }
57
+ };
58
+ i.styles = [f];
59
+ o([
60
+ m({ type: Number })
61
+ ], i.prototype, "value", 2);
62
+ o([
63
+ m({ type: Boolean, converter: u, reflect: !0 })
64
+ ], i.prototype, "disabled", 2);
65
+ o([
66
+ m({ type: Boolean, converter: u, attribute: "hide-rating-text" })
67
+ ], i.prototype, "hideRatingText", 2);
68
+ i = o([
69
+ h("ds-rating")
70
+ ], i);
71
+ export {
72
+ i as DsRating
73
+ };
@@ -0,0 +1,8 @@
1
+ import type { DsRating } from './ds-rating';
2
+ import './ds-rating';
3
+ import '../ds-theme-provider/ds-theme-provider.ts';
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'ds-rating': DsRating;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import type { CommonAttrs } from '../../types/types.ts';
2
+ export type DsRatingAttrs = {
3
+ value?: number;
4
+ disabled?: boolean;
5
+ 'hide-rating-text'?: boolean;
6
+ } & CommonAttrs;
@@ -0,0 +1 @@
1
+ export declare const commonStyles: import("lit").CSSResult;
@@ -0,0 +1,14 @@
1
+ import "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
2
+ import "../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
3
+ import "../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
4
+ import { css as r } from "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
5
+ const e = r`
6
+ .container,
7
+ .stars-wrapper {
8
+ display: flex;
9
+ align-items: center;
10
+ }
11
+ `;
12
+ export {
13
+ e as commonStyles
14
+ };
@@ -53,7 +53,7 @@ let m = class extends $ {
53
53
  }
54
54
  loadThemeStyles() {
55
55
  return this.loadStyles ? new Promise((t, o) => {
56
- const s = "/1.0.0-canary.13", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
56
+ const s = "/1.0.0-canary.14", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
57
57
  if (document.head.querySelector(`link[href="${r}"]`)) t();
58
58
  else {
59
59
  const e = `ui-kit-theme-${s}`, a = document.getElementById(e), n = document.createElement("link");
@@ -27,9 +27,10 @@ import './ds-password-input/ds-password-input.ts';
27
27
  import './ds-picker-item/ds-picker-item.ts';
28
28
  import './ds-portal/ds-portal.ts';
29
29
  import './ds-progress-bar/ds-progress-bar.ts';
30
+ import './ds-radio/ds-radio.ts';
30
31
  import './ds-radio-button/ds-radio-button.ts';
31
32
  import './ds-radio-group/ds-radio-group.ts';
32
- import './ds-radio/ds-radio.ts';
33
+ import './ds-rating/ds-rating.ts';
33
34
  import './ds-search-input/ds-search-input.ts';
34
35
  import './ds-search/ds-search.ts';
35
36
  import './ds-secondary-navigation/ds-secondary-navigation.ts';
@@ -27,9 +27,10 @@ import "./components/ds-password-input/ds-password-input.js";
27
27
  import "./components/ds-picker-item/ds-picker-item.js";
28
28
  import "./components/ds-portal/ds-portal.js";
29
29
  import "./components/ds-progress-bar/ds-progress-bar.js";
30
+ import "./components/ds-radio/ds-radio.js";
30
31
  import "./components/ds-radio-button/ds-radio-button.js";
31
32
  import "./components/ds-radio-group/ds-radio-group.js";
32
- import "./components/ds-radio/ds-radio.js";
33
+ import "./components/ds-rating/ds-rating.js";
33
34
  import "./components/ds-search-input/ds-search-input.js";
34
35
  import "./components/ds-search/ds-search.js";
35
36
  import "./components/ds-secondary-navigation/ds-secondary-navigation.js";
@@ -54,7 +55,7 @@ import "./components/ds-static-box/ds-static-box.js";
54
55
  import "./components/ds-interactive-card/ds-interactive-card.js";
55
56
  import "./components/ds-radio-button-group/ds-radio-button-group.js";
56
57
  import "./components/ds-sidebar-navigation/ds-sidebar-navigation.js";
57
- import { iconNames as po } from "./components/ds-icon/iconNames.js";
58
+ import { iconNames as to } from "./components/ds-icon/iconNames.js";
58
59
  export {
59
- po as iconNames
60
+ to as iconNames
60
61
  };
@@ -5,7 +5,7 @@ class s {
5
5
  theme: t
6
6
  }) => {
7
7
  if (!t || !e) return;
8
- const c = `https://ds-assets.cupra.com/1.0.0-canary.13/styles/${t}/components/${e}.css`, r = this.getCachedStyleSheetPromise({ url: c });
8
+ const c = `https://ds-assets.cupra.com/1.0.0-canary.14/styles/${t}/components/${e}.css`, r = this.getCachedStyleSheetPromise({ url: c });
9
9
  if (r) return r;
10
10
  const i = this.fetchStyle({ url: c }).then((n) => (n || this.stylePromises.delete(c), n));
11
11
  return this.stylePromises.set(c, i), this.stylePromises.get(c);
@@ -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-v1-0-0-canary-13"), i = n(e);
6
+ const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-14"), 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-v1-0-0-canary-13"), e = i(o);
6
+ const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-14"), e = i(o);
7
7
  return n`${e}`;
8
8
  }
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cupra/ui-kit",
3
- "version": "1.0.0-canary.13",
3
+ "version": "1.0.0-canary.14",
4
4
  "description": "Web components library",
5
5
  "author": "SEAT S.A.",
6
6
  "license": "SEAT S.A. Library EULA 1.0",