@cupra/ui-kit 1.0.0-canary.13 → 1.0.0-canary.15
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.
- package/dist/components/ds-rating/ds-rating.d.ts +14 -0
- package/dist/components/ds-rating/ds-rating.js +73 -0
- package/dist/components/ds-rating/ds-rating.test.d.ts +8 -0
- package/dist/components/ds-rating/ds-rating.types.d.ts +6 -0
- package/dist/components/ds-rating/styles/common.styles.d.ts +1 -0
- package/dist/components/ds-rating/styles/common.styles.js +14 -0
- package/dist/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist/components/ds-tooltip/ds-tooltip.d.ts +37 -23
- package/dist/components/ds-tooltip/ds-tooltip.js +179 -157
- package/dist/components/ds-tooltip/ds-tooltip.test.d.ts +8 -0
- package/dist/components/ds-tooltip/ds-tooltip.types.d.ts +5 -10
- package/dist/components/ds-tooltip/styles/common.styles.d.ts +0 -2
- package/dist/components/ds-tooltip/styles/common.styles.js +69 -102
- package/dist/components/index.d.ts +2 -1
- package/dist/index.js +4 -3
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +430 -0
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +313 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +132 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
- package/dist/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist/utils/cssWithTokens.js +1 -1
- package/dist/utils/htmlWithTokens.js +1 -1
- package/dist-react/components/ds-rating/ds-rating.d.ts +14 -0
- package/dist-react/components/ds-rating/ds-rating.js +73 -0
- package/dist-react/components/ds-rating/ds-rating.test.d.ts +8 -0
- package/dist-react/components/ds-rating/ds-rating.types.d.ts +6 -0
- package/dist-react/components/ds-rating/styles/common.styles.d.ts +1 -0
- package/dist-react/components/ds-rating/styles/common.styles.js +14 -0
- package/dist-react/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist-react/components/ds-tooltip/ds-tooltip.d.ts +37 -23
- package/dist-react/components/ds-tooltip/ds-tooltip.js +179 -157
- package/dist-react/components/ds-tooltip/ds-tooltip.test.d.ts +8 -0
- package/dist-react/components/ds-tooltip/ds-tooltip.types.d.ts +5 -10
- package/dist-react/components/ds-tooltip/styles/common.styles.d.ts +0 -2
- package/dist-react/components/ds-tooltip/styles/common.styles.js +69 -102
- package/dist-react/components/index.d.ts +2 -1
- package/dist-react/index.js +4 -3
- package/dist-react/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +430 -0
- package/dist-react/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +313 -0
- package/dist-react/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +132 -0
- package/dist-react/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
- package/dist-react/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist-react/utils/cssWithTokens.js +1 -1
- package/dist-react/utils/htmlWithTokens.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { flip as Z, shift as tt, offset as et, arrow as ot, size as it, computePosition as nt } from "../../../../../@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js";
|
|
2
|
+
import { createCoords as d, round as W, max as O, min as A, rectToClientRect as X } from "../../../../../@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js";
|
|
3
|
+
import { isElement as p, getDocumentElement as m, getComputedStyle as w, isHTMLElement as x, getWindow as b, isTopLayer as D, getParentNode as T, isLastTraversableNode as S, isTableElement as st, isContainingBlock as _, getContainingBlock as rt, getNodeName as N, isOverflowElement as H, getNodeScroll as E, getOverflowAncestors as ct, getFrameElement as M, isWebKit as P } from "../../../../../@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js";
|
|
4
|
+
function K(t) {
|
|
5
|
+
const e = w(t);
|
|
6
|
+
let i = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
|
|
7
|
+
const n = x(t), r = n ? t.offsetWidth : i, s = n ? t.offsetHeight : o, c = W(i) !== r || W(o) !== s;
|
|
8
|
+
return c && (i = r, o = s), {
|
|
9
|
+
width: i,
|
|
10
|
+
height: o,
|
|
11
|
+
$: c
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function j(t) {
|
|
15
|
+
return p(t) ? t : t.contextElement;
|
|
16
|
+
}
|
|
17
|
+
function R(t) {
|
|
18
|
+
const e = j(t);
|
|
19
|
+
if (!x(e))
|
|
20
|
+
return d(1);
|
|
21
|
+
const i = e.getBoundingClientRect(), {
|
|
22
|
+
width: o,
|
|
23
|
+
height: n,
|
|
24
|
+
$: r
|
|
25
|
+
} = K(e);
|
|
26
|
+
let s = (r ? W(i.width) : i.width) / o, c = (r ? W(i.height) : i.height) / n;
|
|
27
|
+
return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
|
|
28
|
+
x: s,
|
|
29
|
+
y: c
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const lt = /* @__PURE__ */ d(0);
|
|
33
|
+
function q(t) {
|
|
34
|
+
const e = b(t);
|
|
35
|
+
return !P() || !e.visualViewport ? lt : {
|
|
36
|
+
x: e.visualViewport.offsetLeft,
|
|
37
|
+
y: e.visualViewport.offsetTop
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function ft(t, e, i) {
|
|
41
|
+
return e === void 0 && (e = !1), !i || e && i !== b(t) ? !1 : e;
|
|
42
|
+
}
|
|
43
|
+
function v(t, e, i, o) {
|
|
44
|
+
e === void 0 && (e = !1), i === void 0 && (i = !1);
|
|
45
|
+
const n = t.getBoundingClientRect(), r = j(t);
|
|
46
|
+
let s = d(1);
|
|
47
|
+
e && (o ? p(o) && (s = R(o)) : s = R(t));
|
|
48
|
+
const c = ft(r, i, o) ? q(r) : d(0);
|
|
49
|
+
let l = (n.left + c.x) / s.x, f = (n.top + c.y) / s.y, u = n.width / s.x, h = n.height / s.y;
|
|
50
|
+
if (r) {
|
|
51
|
+
const g = b(r), a = o && p(o) ? b(o) : o;
|
|
52
|
+
let C = g, y = M(C);
|
|
53
|
+
for (; y && o && a !== C; ) {
|
|
54
|
+
const L = R(y), V = y.getBoundingClientRect(), $ = w(y), U = V.left + (y.clientLeft + parseFloat($.paddingLeft)) * L.x, Y = V.top + (y.clientTop + parseFloat($.paddingTop)) * L.y;
|
|
55
|
+
l *= L.x, f *= L.y, u *= L.x, h *= L.y, l += U, f += Y, C = b(y), y = M(C);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return X({
|
|
59
|
+
width: u,
|
|
60
|
+
height: h,
|
|
61
|
+
x: l,
|
|
62
|
+
y: f
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function F(t, e) {
|
|
66
|
+
const i = E(t).scrollLeft;
|
|
67
|
+
return e ? e.left + i : v(m(t)).left + i;
|
|
68
|
+
}
|
|
69
|
+
function G(t, e) {
|
|
70
|
+
const i = t.getBoundingClientRect(), o = i.left + e.scrollLeft - F(t, i), n = i.top + e.scrollTop;
|
|
71
|
+
return {
|
|
72
|
+
x: o,
|
|
73
|
+
y: n
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function ut(t) {
|
|
77
|
+
let {
|
|
78
|
+
elements: e,
|
|
79
|
+
rect: i,
|
|
80
|
+
offsetParent: o,
|
|
81
|
+
strategy: n
|
|
82
|
+
} = t;
|
|
83
|
+
const r = n === "fixed", s = m(o), c = e ? D(e.floating) : !1;
|
|
84
|
+
if (o === s || c && r)
|
|
85
|
+
return i;
|
|
86
|
+
let l = {
|
|
87
|
+
scrollLeft: 0,
|
|
88
|
+
scrollTop: 0
|
|
89
|
+
}, f = d(1);
|
|
90
|
+
const u = d(0), h = x(o);
|
|
91
|
+
if ((h || !h && !r) && ((N(o) !== "body" || H(s)) && (l = E(o)), x(o))) {
|
|
92
|
+
const a = v(o);
|
|
93
|
+
f = R(o), u.x = a.x + o.clientLeft, u.y = a.y + o.clientTop;
|
|
94
|
+
}
|
|
95
|
+
const g = s && !h && !r ? G(s, l) : d(0);
|
|
96
|
+
return {
|
|
97
|
+
width: i.width * f.x,
|
|
98
|
+
height: i.height * f.y,
|
|
99
|
+
x: i.x * f.x - l.scrollLeft * f.x + u.x + g.x,
|
|
100
|
+
y: i.y * f.y - l.scrollTop * f.y + u.y + g.y
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function ht(t) {
|
|
104
|
+
return Array.from(t.getClientRects());
|
|
105
|
+
}
|
|
106
|
+
function dt(t) {
|
|
107
|
+
const e = m(t), i = E(t), o = t.ownerDocument.body, n = O(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), r = O(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
|
|
108
|
+
let s = -i.scrollLeft + F(t);
|
|
109
|
+
const c = -i.scrollTop;
|
|
110
|
+
return w(o).direction === "rtl" && (s += O(e.clientWidth, o.clientWidth) - n), {
|
|
111
|
+
width: n,
|
|
112
|
+
height: r,
|
|
113
|
+
x: s,
|
|
114
|
+
y: c
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const I = 25;
|
|
118
|
+
function gt(t, e) {
|
|
119
|
+
const i = b(t), o = m(t), n = i.visualViewport;
|
|
120
|
+
let r = o.clientWidth, s = o.clientHeight, c = 0, l = 0;
|
|
121
|
+
if (n) {
|
|
122
|
+
r = n.width, s = n.height;
|
|
123
|
+
const u = P();
|
|
124
|
+
(!u || u && e === "fixed") && (c = n.offsetLeft, l = n.offsetTop);
|
|
125
|
+
}
|
|
126
|
+
const f = F(o);
|
|
127
|
+
if (f <= 0) {
|
|
128
|
+
const u = o.ownerDocument, h = u.body, g = getComputedStyle(h), a = u.compatMode === "CSS1Compat" && parseFloat(g.marginLeft) + parseFloat(g.marginRight) || 0, C = Math.abs(o.clientWidth - h.clientWidth - a);
|
|
129
|
+
C <= I && (r -= C);
|
|
130
|
+
} else f <= I && (r += f);
|
|
131
|
+
return {
|
|
132
|
+
width: r,
|
|
133
|
+
height: s,
|
|
134
|
+
x: c,
|
|
135
|
+
y: l
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const at = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
139
|
+
function pt(t, e) {
|
|
140
|
+
const i = v(t, !0, e === "fixed"), o = i.top + t.clientTop, n = i.left + t.clientLeft, r = x(t) ? R(t) : d(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, l = n * r.x, f = o * r.y;
|
|
141
|
+
return {
|
|
142
|
+
width: s,
|
|
143
|
+
height: c,
|
|
144
|
+
x: l,
|
|
145
|
+
y: f
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function k(t, e, i) {
|
|
149
|
+
let o;
|
|
150
|
+
if (e === "viewport")
|
|
151
|
+
o = gt(t, i);
|
|
152
|
+
else if (e === "document")
|
|
153
|
+
o = dt(m(t));
|
|
154
|
+
else if (p(e))
|
|
155
|
+
o = pt(e, i);
|
|
156
|
+
else {
|
|
157
|
+
const n = q(t);
|
|
158
|
+
o = {
|
|
159
|
+
x: e.x - n.x,
|
|
160
|
+
y: e.y - n.y,
|
|
161
|
+
width: e.width,
|
|
162
|
+
height: e.height
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return X(o);
|
|
166
|
+
}
|
|
167
|
+
function J(t, e) {
|
|
168
|
+
const i = T(t);
|
|
169
|
+
return i === e || !p(i) || S(i) ? !1 : w(i).position === "fixed" || J(i, e);
|
|
170
|
+
}
|
|
171
|
+
function wt(t, e) {
|
|
172
|
+
const i = e.get(t);
|
|
173
|
+
if (i)
|
|
174
|
+
return i;
|
|
175
|
+
let o = ct(t, []).filter((c) => p(c) && N(c) !== "body"), n = null;
|
|
176
|
+
const r = w(t).position === "fixed";
|
|
177
|
+
let s = r ? T(t) : t;
|
|
178
|
+
for (; p(s) && !S(s); ) {
|
|
179
|
+
const c = w(s), l = _(s);
|
|
180
|
+
!l && c.position === "fixed" && (n = null), (r ? !l && !n : !l && c.position === "static" && !!n && at.has(n.position) || H(s) && !l && J(t, s)) ? o = o.filter((u) => u !== s) : n = c, s = T(s);
|
|
181
|
+
}
|
|
182
|
+
return e.set(t, o), o;
|
|
183
|
+
}
|
|
184
|
+
function yt(t) {
|
|
185
|
+
let {
|
|
186
|
+
element: e,
|
|
187
|
+
boundary: i,
|
|
188
|
+
rootBoundary: o,
|
|
189
|
+
strategy: n
|
|
190
|
+
} = t;
|
|
191
|
+
const s = [...i === "clippingAncestors" ? D(e) ? [] : wt(e, this._c) : [].concat(i), o], c = s[0], l = s.reduce((f, u) => {
|
|
192
|
+
const h = k(e, u, n);
|
|
193
|
+
return f.top = O(h.top, f.top), f.right = A(h.right, f.right), f.bottom = A(h.bottom, f.bottom), f.left = O(h.left, f.left), f;
|
|
194
|
+
}, k(e, c, n));
|
|
195
|
+
return {
|
|
196
|
+
width: l.right - l.left,
|
|
197
|
+
height: l.bottom - l.top,
|
|
198
|
+
x: l.left,
|
|
199
|
+
y: l.top
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function xt(t) {
|
|
203
|
+
const {
|
|
204
|
+
width: e,
|
|
205
|
+
height: i
|
|
206
|
+
} = K(t);
|
|
207
|
+
return {
|
|
208
|
+
width: e,
|
|
209
|
+
height: i
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function mt(t, e, i) {
|
|
213
|
+
const o = x(e), n = m(e), r = i === "fixed", s = v(t, !0, r, e);
|
|
214
|
+
let c = {
|
|
215
|
+
scrollLeft: 0,
|
|
216
|
+
scrollTop: 0
|
|
217
|
+
};
|
|
218
|
+
const l = d(0);
|
|
219
|
+
function f() {
|
|
220
|
+
l.x = F(n);
|
|
221
|
+
}
|
|
222
|
+
if (o || !o && !r)
|
|
223
|
+
if ((N(e) !== "body" || H(n)) && (c = E(e)), o) {
|
|
224
|
+
const a = v(e, !0, r, e);
|
|
225
|
+
l.x = a.x + e.clientLeft, l.y = a.y + e.clientTop;
|
|
226
|
+
} else n && f();
|
|
227
|
+
r && !o && n && f();
|
|
228
|
+
const u = n && !o && !r ? G(n, c) : d(0), h = s.left + c.scrollLeft - l.x - u.x, g = s.top + c.scrollTop - l.y - u.y;
|
|
229
|
+
return {
|
|
230
|
+
x: h,
|
|
231
|
+
y: g,
|
|
232
|
+
width: s.width,
|
|
233
|
+
height: s.height
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function B(t) {
|
|
237
|
+
return w(t).position === "static";
|
|
238
|
+
}
|
|
239
|
+
function z(t, e) {
|
|
240
|
+
if (!x(t) || w(t).position === "fixed")
|
|
241
|
+
return null;
|
|
242
|
+
if (e)
|
|
243
|
+
return e(t);
|
|
244
|
+
let i = t.offsetParent;
|
|
245
|
+
return m(t) === i && (i = i.ownerDocument.body), i;
|
|
246
|
+
}
|
|
247
|
+
function Q(t, e) {
|
|
248
|
+
const i = b(t);
|
|
249
|
+
if (D(t))
|
|
250
|
+
return i;
|
|
251
|
+
if (!x(t)) {
|
|
252
|
+
let n = T(t);
|
|
253
|
+
for (; n && !S(n); ) {
|
|
254
|
+
if (p(n) && !B(n))
|
|
255
|
+
return n;
|
|
256
|
+
n = T(n);
|
|
257
|
+
}
|
|
258
|
+
return i;
|
|
259
|
+
}
|
|
260
|
+
let o = z(t, e);
|
|
261
|
+
for (; o && st(o) && B(o); )
|
|
262
|
+
o = z(o, e);
|
|
263
|
+
return o && S(o) && B(o) && !_(o) ? i : o || rt(t) || i;
|
|
264
|
+
}
|
|
265
|
+
const Ct = async function(t) {
|
|
266
|
+
const e = this.getOffsetParent || Q, i = this.getDimensions, o = await i(t.floating);
|
|
267
|
+
return {
|
|
268
|
+
reference: mt(t.reference, await e(t.floating), t.strategy),
|
|
269
|
+
floating: {
|
|
270
|
+
x: 0,
|
|
271
|
+
y: 0,
|
|
272
|
+
width: o.width,
|
|
273
|
+
height: o.height
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
function bt(t) {
|
|
278
|
+
return w(t).direction === "rtl";
|
|
279
|
+
}
|
|
280
|
+
const Lt = {
|
|
281
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: ut,
|
|
282
|
+
getDocumentElement: m,
|
|
283
|
+
getClippingRect: yt,
|
|
284
|
+
getOffsetParent: Q,
|
|
285
|
+
getElementRects: Ct,
|
|
286
|
+
getClientRects: ht,
|
|
287
|
+
getDimensions: xt,
|
|
288
|
+
getScale: R,
|
|
289
|
+
isElement: p,
|
|
290
|
+
isRTL: bt
|
|
291
|
+
}, vt = et, Wt = tt, St = Z, Et = it, Ft = ot, Bt = (t, e, i) => {
|
|
292
|
+
const o = /* @__PURE__ */ new Map(), n = {
|
|
293
|
+
platform: Lt,
|
|
294
|
+
...i
|
|
295
|
+
}, r = {
|
|
296
|
+
...n.platform,
|
|
297
|
+
_c: o
|
|
298
|
+
};
|
|
299
|
+
return nt(t, e, {
|
|
300
|
+
...n,
|
|
301
|
+
platform: r
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
export {
|
|
305
|
+
Ft as arrow,
|
|
306
|
+
Bt as computePosition,
|
|
307
|
+
St as flip,
|
|
308
|
+
ct as getOverflowAncestors,
|
|
309
|
+
vt as offset,
|
|
310
|
+
Lt as platform,
|
|
311
|
+
Wt as shift,
|
|
312
|
+
Et as size
|
|
313
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
function c() {
|
|
2
|
+
return typeof window < "u";
|
|
3
|
+
}
|
|
4
|
+
function a(e) {
|
|
5
|
+
return f(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
6
|
+
}
|
|
7
|
+
function s(e) {
|
|
8
|
+
var t;
|
|
9
|
+
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
10
|
+
}
|
|
11
|
+
function b(e) {
|
|
12
|
+
var t;
|
|
13
|
+
return (t = (f(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
|
|
14
|
+
}
|
|
15
|
+
function f(e) {
|
|
16
|
+
return c() ? e instanceof Node || e instanceof s(e).Node : !1;
|
|
17
|
+
}
|
|
18
|
+
function d(e) {
|
|
19
|
+
return c() ? e instanceof Element || e instanceof s(e).Element : !1;
|
|
20
|
+
}
|
|
21
|
+
function m(e) {
|
|
22
|
+
return c() ? e instanceof HTMLElement || e instanceof s(e).HTMLElement : !1;
|
|
23
|
+
}
|
|
24
|
+
function u(e) {
|
|
25
|
+
return !c() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof s(e).ShadowRoot;
|
|
26
|
+
}
|
|
27
|
+
const g = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
28
|
+
function p(e) {
|
|
29
|
+
const {
|
|
30
|
+
overflow: t,
|
|
31
|
+
overflowX: n,
|
|
32
|
+
overflowY: o,
|
|
33
|
+
display: r
|
|
34
|
+
} = y(e);
|
|
35
|
+
return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !g.has(r);
|
|
36
|
+
}
|
|
37
|
+
const N = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
38
|
+
function _(e) {
|
|
39
|
+
return N.has(a(e));
|
|
40
|
+
}
|
|
41
|
+
const v = [":popover-open", ":modal"];
|
|
42
|
+
function E(e) {
|
|
43
|
+
return v.some((t) => {
|
|
44
|
+
try {
|
|
45
|
+
return e.matches(t);
|
|
46
|
+
} catch {
|
|
47
|
+
return !1;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const T = ["transform", "translate", "scale", "rotate", "perspective"], L = ["transform", "translate", "scale", "rotate", "perspective", "filter"], D = ["paint", "layout", "strict", "content"];
|
|
52
|
+
function C(e) {
|
|
53
|
+
const t = k(), n = d(e) ? y(e) : e;
|
|
54
|
+
return T.some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || L.some((o) => (n.willChange || "").includes(o)) || D.some((o) => (n.contain || "").includes(o));
|
|
55
|
+
}
|
|
56
|
+
function A(e) {
|
|
57
|
+
let t = l(e);
|
|
58
|
+
for (; m(t) && !w(t); ) {
|
|
59
|
+
if (C(t))
|
|
60
|
+
return t;
|
|
61
|
+
if (E(t))
|
|
62
|
+
return null;
|
|
63
|
+
t = l(t);
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function k() {
|
|
68
|
+
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
69
|
+
}
|
|
70
|
+
const V = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
71
|
+
function w(e) {
|
|
72
|
+
return V.has(a(e));
|
|
73
|
+
}
|
|
74
|
+
function y(e) {
|
|
75
|
+
return s(e).getComputedStyle(e);
|
|
76
|
+
}
|
|
77
|
+
function B(e) {
|
|
78
|
+
return d(e) ? {
|
|
79
|
+
scrollLeft: e.scrollLeft,
|
|
80
|
+
scrollTop: e.scrollTop
|
|
81
|
+
} : {
|
|
82
|
+
scrollLeft: e.scrollX,
|
|
83
|
+
scrollTop: e.scrollY
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function l(e) {
|
|
87
|
+
if (a(e) === "html")
|
|
88
|
+
return e;
|
|
89
|
+
const t = (
|
|
90
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
91
|
+
e.assignedSlot || // DOM Element detected.
|
|
92
|
+
e.parentNode || // ShadowRoot detected.
|
|
93
|
+
u(e) && e.host || // Fallback.
|
|
94
|
+
b(e)
|
|
95
|
+
);
|
|
96
|
+
return u(t) ? t.host : t;
|
|
97
|
+
}
|
|
98
|
+
function h(e) {
|
|
99
|
+
const t = l(e);
|
|
100
|
+
return w(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : m(t) && p(t) ? t : h(t);
|
|
101
|
+
}
|
|
102
|
+
function O(e, t, n) {
|
|
103
|
+
var o;
|
|
104
|
+
t === void 0 && (t = []);
|
|
105
|
+
const r = h(e), S = r === ((o = e.ownerDocument) == null ? void 0 : o.body), i = s(r);
|
|
106
|
+
return S ? (R(i), t.concat(i, i.visualViewport || [], p(r) ? r : [], [])) : t.concat(r, O(r, []));
|
|
107
|
+
}
|
|
108
|
+
function R(e) {
|
|
109
|
+
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
y as getComputedStyle,
|
|
113
|
+
A as getContainingBlock,
|
|
114
|
+
b as getDocumentElement,
|
|
115
|
+
R as getFrameElement,
|
|
116
|
+
h as getNearestOverflowAncestor,
|
|
117
|
+
a as getNodeName,
|
|
118
|
+
B as getNodeScroll,
|
|
119
|
+
O as getOverflowAncestors,
|
|
120
|
+
l as getParentNode,
|
|
121
|
+
s as getWindow,
|
|
122
|
+
C as isContainingBlock,
|
|
123
|
+
d as isElement,
|
|
124
|
+
m as isHTMLElement,
|
|
125
|
+
w as isLastTraversableNode,
|
|
126
|
+
f as isNode,
|
|
127
|
+
p as isOverflowElement,
|
|
128
|
+
u as isShadowRoot,
|
|
129
|
+
_ as isTableElement,
|
|
130
|
+
E as isTopLayer,
|
|
131
|
+
k as isWebKit
|
|
132
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const m = Math.min, p = Math.max, j = Math.round, C = (t) => ({
|
|
2
|
+
x: t,
|
|
3
|
+
y: t
|
|
4
|
+
}), h = {
|
|
5
|
+
left: "right",
|
|
6
|
+
right: "left",
|
|
7
|
+
bottom: "top",
|
|
8
|
+
top: "bottom"
|
|
9
|
+
}, x = {
|
|
10
|
+
start: "end",
|
|
11
|
+
end: "start"
|
|
12
|
+
};
|
|
13
|
+
function L(t, e, n) {
|
|
14
|
+
return p(t, m(e, n));
|
|
15
|
+
}
|
|
16
|
+
function E(t, e) {
|
|
17
|
+
return typeof t == "function" ? t(e) : t;
|
|
18
|
+
}
|
|
19
|
+
function g(t) {
|
|
20
|
+
return t.split("-")[0];
|
|
21
|
+
}
|
|
22
|
+
function a(t) {
|
|
23
|
+
return t.split("-")[1];
|
|
24
|
+
}
|
|
25
|
+
function b(t) {
|
|
26
|
+
return t === "x" ? "y" : "x";
|
|
27
|
+
}
|
|
28
|
+
function d(t) {
|
|
29
|
+
return t === "y" ? "height" : "width";
|
|
30
|
+
}
|
|
31
|
+
const A = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
32
|
+
function P(t) {
|
|
33
|
+
return A.has(g(t)) ? "y" : "x";
|
|
34
|
+
}
|
|
35
|
+
function y(t) {
|
|
36
|
+
return b(P(t));
|
|
37
|
+
}
|
|
38
|
+
function R(t, e, n) {
|
|
39
|
+
n === void 0 && (n = !1);
|
|
40
|
+
const r = a(t), i = y(t), o = d(i);
|
|
41
|
+
let c = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
42
|
+
return e.reference[o] > e.floating[o] && (c = u(c)), [c, u(c)];
|
|
43
|
+
}
|
|
44
|
+
function T(t) {
|
|
45
|
+
const e = u(t);
|
|
46
|
+
return [s(t), e, s(e)];
|
|
47
|
+
}
|
|
48
|
+
function s(t) {
|
|
49
|
+
return t.replace(/start|end/g, (e) => x[e]);
|
|
50
|
+
}
|
|
51
|
+
const f = ["left", "right"], l = ["right", "left"], O = ["top", "bottom"], S = ["bottom", "top"];
|
|
52
|
+
function M(t, e, n) {
|
|
53
|
+
switch (t) {
|
|
54
|
+
case "top":
|
|
55
|
+
case "bottom":
|
|
56
|
+
return n ? e ? l : f : e ? f : l;
|
|
57
|
+
case "left":
|
|
58
|
+
case "right":
|
|
59
|
+
return e ? O : S;
|
|
60
|
+
default:
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function k(t, e, n, r) {
|
|
65
|
+
const i = a(t);
|
|
66
|
+
let o = M(g(t), n === "start", r);
|
|
67
|
+
return i && (o = o.map((c) => c + "-" + i), e && (o = o.concat(o.map(s)))), o;
|
|
68
|
+
}
|
|
69
|
+
function u(t) {
|
|
70
|
+
return t.replace(/left|right|bottom|top/g, (e) => h[e]);
|
|
71
|
+
}
|
|
72
|
+
function w(t) {
|
|
73
|
+
return {
|
|
74
|
+
top: 0,
|
|
75
|
+
right: 0,
|
|
76
|
+
bottom: 0,
|
|
77
|
+
left: 0,
|
|
78
|
+
...t
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function q(t) {
|
|
82
|
+
return typeof t != "number" ? w(t) : {
|
|
83
|
+
top: t,
|
|
84
|
+
right: t,
|
|
85
|
+
bottom: t,
|
|
86
|
+
left: t
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function z(t) {
|
|
90
|
+
const {
|
|
91
|
+
x: e,
|
|
92
|
+
y: n,
|
|
93
|
+
width: r,
|
|
94
|
+
height: i
|
|
95
|
+
} = t;
|
|
96
|
+
return {
|
|
97
|
+
width: r,
|
|
98
|
+
height: i,
|
|
99
|
+
top: n,
|
|
100
|
+
left: e,
|
|
101
|
+
right: e + r,
|
|
102
|
+
bottom: n + i,
|
|
103
|
+
x: e,
|
|
104
|
+
y: n
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
L as clamp,
|
|
109
|
+
C as createCoords,
|
|
110
|
+
E as evaluate,
|
|
111
|
+
w as expandPaddingObject,
|
|
112
|
+
a as getAlignment,
|
|
113
|
+
y as getAlignmentAxis,
|
|
114
|
+
R as getAlignmentSides,
|
|
115
|
+
d as getAxisLength,
|
|
116
|
+
T as getExpandedPlacements,
|
|
117
|
+
s as getOppositeAlignmentPlacement,
|
|
118
|
+
b as getOppositeAxis,
|
|
119
|
+
k as getOppositeAxisPlacements,
|
|
120
|
+
u as getOppositePlacement,
|
|
121
|
+
q as getPaddingObject,
|
|
122
|
+
g as getSide,
|
|
123
|
+
P as getSideAxis,
|
|
124
|
+
p as max,
|
|
125
|
+
m as min,
|
|
126
|
+
z as rectToClientRect,
|
|
127
|
+
j as round
|
|
128
|
+
};
|
|
@@ -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.
|
|
8
|
+
const c = `https://ds-assets.cupra.com/1.0.0-canary.15/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-
|
|
6
|
+
const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-15"), 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-
|
|
6
|
+
const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-15"), 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
|
+
};
|