@juspay/svelte-ui-components 2.136.9 → 2.136.11
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/FunnelChart/properties.d.ts +2 -1
- package/dist/Img/Img.svelte +119 -3
- package/dist/SplitInput/SplitInput.svelte +39 -1
- package/dist-wc/index.js +119 -51
- package/package.json +1 -1
|
@@ -57,7 +57,8 @@ export type OptionalFunnelChartProperties = {
|
|
|
57
57
|
aspectRatio?: number;
|
|
58
58
|
/**
|
|
59
59
|
* Upper bound (px) on the rendered chart height, so the aspect-ratio-derived height
|
|
60
|
-
* can't balloon on wide surfaces. Defaults to `
|
|
60
|
+
* can't balloon on wide surfaces. Defaults to `DEFAULT_CHART_MAX_HEIGHT` (420), the
|
|
61
|
+
* same cap every other chart in this library applies.
|
|
61
62
|
*/
|
|
62
63
|
maxHeight?: number;
|
|
63
64
|
/** Lower bound (px) on the rendered chart height (defaults to `0`). */
|
package/dist/Img/Img.svelte
CHANGED
|
@@ -37,6 +37,107 @@
|
|
|
37
37
|
transform: ((svg: string) => string) | null;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
// Root attributes that may be copied from fetched SVG markup onto the live
|
|
41
|
+
// <svg> host. The fetched document is remote, untrusted content — copying
|
|
42
|
+
// every attribute (the previous behaviour) let it plant executable `on*`
|
|
43
|
+
// handlers on an element in the host page, clobber the data-pw/testID test
|
|
44
|
+
// hooks, or override the component's CSS sizing contract with an inline
|
|
45
|
+
// style. An allowlist rather than an `on*` denylist is deliberate: a
|
|
46
|
+
// denylist misses vectors like `xlink:href="javascript:…"` and whatever
|
|
47
|
+
// attribute ships in browsers next. The names kept are what inlining
|
|
48
|
+
// actually needs — geometry/scaling, the namespace declarations exporters
|
|
49
|
+
// emit, the inheritable paint attributes that keep the icon's authored
|
|
50
|
+
// defaults while page CSS/currentColor themes it, and the accessibility
|
|
51
|
+
// metadata real icon sets ship (role, focusable, aria-*). `class` stays
|
|
52
|
+
// caller-owned via the `classes` prop, as before. Compared lowercased, so
|
|
53
|
+
// entries are lowercase (viewBox → 'viewbox') while the authored casing is
|
|
54
|
+
// preserved when the attribute is written to the host.
|
|
55
|
+
const SAFE_INLINE_ROOT_ATTRIBUTES: ReadonlySet<string> = new Set([
|
|
56
|
+
'xmlns',
|
|
57
|
+
'xmlns:xlink',
|
|
58
|
+
'viewbox',
|
|
59
|
+
'width',
|
|
60
|
+
'height',
|
|
61
|
+
'x',
|
|
62
|
+
'y',
|
|
63
|
+
'preserveaspectratio',
|
|
64
|
+
'fill',
|
|
65
|
+
'fill-opacity',
|
|
66
|
+
'fill-rule',
|
|
67
|
+
'stroke',
|
|
68
|
+
'stroke-width',
|
|
69
|
+
'stroke-opacity',
|
|
70
|
+
'stroke-linecap',
|
|
71
|
+
'stroke-linejoin',
|
|
72
|
+
'stroke-miterlimit',
|
|
73
|
+
'stroke-dasharray',
|
|
74
|
+
'stroke-dashoffset',
|
|
75
|
+
'clip-rule',
|
|
76
|
+
'color',
|
|
77
|
+
'opacity',
|
|
78
|
+
'overflow',
|
|
79
|
+
'role',
|
|
80
|
+
'focusable'
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
function isSafeInlineRootAttribute(lowerCaseName: string): boolean {
|
|
84
|
+
return SAFE_INLINE_ROOT_ATTRIBUTES.has(lowerCaseName) || lowerCaseName.startsWith('aria-');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Strips executable content from a fetched SVG's descendants.
|
|
89
|
+
*
|
|
90
|
+
* The root allowlist above only guards the root. Children are adopted into
|
|
91
|
+
* the live document wholesale, and an event-handler content attribute
|
|
92
|
+
* becomes a live handler the moment its element is adopted — so
|
|
93
|
+
* `<image onerror="…">` two levels down runs exactly like `onerror` on the
|
|
94
|
+
* root would. A root-only guard would look like a fix while leaving the same
|
|
95
|
+
* vector open one element deeper.
|
|
96
|
+
*
|
|
97
|
+
* A denylist rather than an allowlist here, deliberately: descendants
|
|
98
|
+
* legitimately carry the entire SVG geometry and paint vocabulary (`d`,
|
|
99
|
+
* `transform`, `gradientUnits`, …), so enumerating what is permitted would
|
|
100
|
+
* break real artwork. What is dangerous is narrow and well understood:
|
|
101
|
+
* scripting elements, `on*` handlers, and URL attributes pointing at
|
|
102
|
+
* `javascript:`.
|
|
103
|
+
*/
|
|
104
|
+
function sanitizeInlinedSubtree(root: SVGSVGElement): void {
|
|
105
|
+
for (const element of Array.from(root.querySelectorAll('script, foreignObject'))) {
|
|
106
|
+
element.remove();
|
|
107
|
+
}
|
|
108
|
+
for (const element of Array.from(root.querySelectorAll('*'))) {
|
|
109
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
110
|
+
const name = attribute.name.toLowerCase();
|
|
111
|
+
if (name.startsWith('on')) {
|
|
112
|
+
element.removeAttribute(attribute.name);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
// `href`, `xlink:href` and `src` accept a javascript: URL, which runs
|
|
116
|
+
// on activation of an <a> wrapper or on load of a nested resource.
|
|
117
|
+
const isUrlAttribute = name === 'href' || name === 'xlink:href' || name === 'src';
|
|
118
|
+
if (isUrlAttribute && /^\s*javascript:/i.test(attribute.value)) {
|
|
119
|
+
element.removeAttribute(attribute.name);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Root attribute names of the raw fetched markup, lowercased — or null when
|
|
126
|
+
// that markup does not parse as SVG on its own. Distinguishes what arrived
|
|
127
|
+
// over the network (untrusted, the allowlist applies) from what the caller's
|
|
128
|
+
// transformSvg hook added (caller intent, passes through).
|
|
129
|
+
function collectRootAttributeNames(markup: string): ReadonlySet<string> | null {
|
|
130
|
+
const parsed = new DOMParser().parseFromString(markup, 'image/svg+xml');
|
|
131
|
+
if (parsed.querySelector('parsererror') !== null) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const root = parsed.querySelector('svg');
|
|
135
|
+
if (root === null) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
return new Set(Array.from(root.attributes, (attribute) => attribute.name.toLowerCase()));
|
|
139
|
+
}
|
|
140
|
+
|
|
40
141
|
async function loadInlineSvg(
|
|
41
142
|
host: SVGSVGElement,
|
|
42
143
|
url: string,
|
|
@@ -50,7 +151,8 @@
|
|
|
50
151
|
return;
|
|
51
152
|
}
|
|
52
153
|
const rawSvg = await response.text();
|
|
53
|
-
const
|
|
154
|
+
const hasTransform = typeof transform === 'function';
|
|
155
|
+
const markup = hasTransform ? transform(rawSvg) : rawSvg;
|
|
54
156
|
const parsed = new DOMParser().parseFromString(markup, 'image/svg+xml');
|
|
55
157
|
if (parsed.querySelector('parsererror') !== null) {
|
|
56
158
|
failedInlineSrc = url;
|
|
@@ -70,12 +172,26 @@
|
|
|
70
172
|
while (host.firstChild !== null) {
|
|
71
173
|
host.removeChild(host.firstChild);
|
|
72
174
|
}
|
|
175
|
+
// With no transform the parsed root IS the fetched root, so every name
|
|
176
|
+
// is network-supplied and only the allowlist applies. With a transform,
|
|
177
|
+
// names absent from the raw payload were added by the caller's own hook
|
|
178
|
+
// and pass through; if the raw payload only parses after the transform,
|
|
179
|
+
// nothing can be attributed to the caller and the allowlist applies to
|
|
180
|
+
// everything.
|
|
181
|
+
const fetchedRootNames = hasTransform ? collectRootAttributeNames(rawSvg) : null;
|
|
73
182
|
for (const attribute of Array.from(sourceSvg.attributes)) {
|
|
74
|
-
|
|
183
|
+
const name = attribute.name.toLowerCase();
|
|
184
|
+
if (name === 'class') {
|
|
75
185
|
continue;
|
|
76
186
|
}
|
|
77
|
-
|
|
187
|
+
const addedByTransform = fetchedRootNames !== null && !fetchedRootNames.has(name);
|
|
188
|
+
if (isSafeInlineRootAttribute(name) || addedByTransform) {
|
|
189
|
+
host.setAttribute(attribute.name, attribute.value);
|
|
190
|
+
}
|
|
78
191
|
}
|
|
192
|
+
// Before adoption, not after: an event-handler attribute becomes a live
|
|
193
|
+
// handler as soon as its element enters the document.
|
|
194
|
+
sanitizeInlinedSubtree(sourceSvg);
|
|
79
195
|
while (sourceSvg.firstChild !== null) {
|
|
80
196
|
host.appendChild(sourceSvg.firstChild);
|
|
81
197
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { tick } from 'svelte';
|
|
2
3
|
import Input from '../Input/Input.svelte';
|
|
3
4
|
import type { FieldConfig, SplitInputProperties } from './properties';
|
|
4
5
|
|
|
@@ -37,6 +38,31 @@
|
|
|
37
38
|
return values.at(index) ?? '';
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Writes the resolved state back onto the DOM element.
|
|
43
|
+
*
|
|
44
|
+
* Needed because the element can hold a value the state never had. Typing
|
|
45
|
+
* into a filled field produces a two-character string in the DOM, and when
|
|
46
|
+
* the character we resolve out of it happens to equal what was already
|
|
47
|
+
* stored -- overtyping 2 with another 2 -- the assignment is a no-op, Svelte
|
|
48
|
+
* sees no change, and nothing re-renders. The field is then left displaying
|
|
49
|
+
* "22" indefinitely while the state says "2".
|
|
50
|
+
*/
|
|
51
|
+
async function syncFieldElement(index: number) {
|
|
52
|
+
// After the pending render, not before it: writing during the input handler
|
|
53
|
+
// is undone when Svelte flushes, and when the resolved value is unchanged
|
|
54
|
+
// there is no flush to piggyback on -- so the correction has to come last.
|
|
55
|
+
await tick();
|
|
56
|
+
const element = inputRefs.at(index)?.getInputRef();
|
|
57
|
+
if (element === null || typeof element === 'undefined') {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const resolved = getFieldValue(index);
|
|
61
|
+
if (element.value !== resolved) {
|
|
62
|
+
element.value = resolved;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
40
66
|
function commitValues() {
|
|
41
67
|
const filled = values.filter((v) => v.length > 0);
|
|
42
68
|
oninput?.([...values]);
|
|
@@ -104,7 +130,19 @@
|
|
|
104
130
|
} else {
|
|
105
131
|
// Overtyping an already-filled field: keep the newest character and
|
|
106
132
|
// advance, mirroring single-char entry.
|
|
107
|
-
|
|
133
|
+
//
|
|
134
|
+
// Which character is "newest" cannot be assumed to be the last one.
|
|
135
|
+
// The browser inserts at the caret, and where the caret sits after a
|
|
136
|
+
// click on a filled single-character field is platform-dependent:
|
|
137
|
+
// Chromium on macOS puts it after the character, Chromium on Linux
|
|
138
|
+
// before it. So typing 7 into a field holding 2 yields "27" on one and
|
|
139
|
+
// "72" on the other, and slice(-1) silently picks the *old* digit on
|
|
140
|
+
// Linux. Removing one occurrence of the previous value identifies the
|
|
141
|
+
// newly typed character wherever it landed.
|
|
142
|
+
const previous = getFieldValue(index);
|
|
143
|
+
const remainder = previous.length === 1 ? chars.replace(previous, '') : '';
|
|
144
|
+
values[index] = remainder.length > 0 ? remainder.slice(-1) : chars.slice(-1);
|
|
145
|
+
void syncFieldElement(index);
|
|
108
146
|
if (index < fieldCount - 1) {
|
|
109
147
|
focusField(index + 1);
|
|
110
148
|
}
|
package/dist-wc/index.js
CHANGED
|
@@ -3477,7 +3477,7 @@ function create_custom_element(e, t, n, i, a, o) {
|
|
|
3477
3477
|
}
|
|
3478
3478
|
//#endregion
|
|
3479
3479
|
//#region src/lib/Img/Img.svelte
|
|
3480
|
-
var
|
|
3480
|
+
var root_1$75 = /* @__PURE__ */ from_svg("<svg></svg>"), root_2$57 = /* @__PURE__ */ from_html("<img/>"), $$css$85 = {
|
|
3481
3481
|
hash: "svelte-13ogpty",
|
|
3482
3482
|
code: "img.svelte-13ogpty,\n svg.svelte-13ogpty {object-fit:var(--image-object-fit);height:var(--image-height, 24px);width:var(--image-width, 24px);padding:var(--image-padding, 0px);border-radius:var(--image-border-radius, 0px);margin:var(--image-margin, 0px);filter:var(--image-filter, none);background:var(--image-background);border:var(--image-border);transition:var(--image-transition);}img.svelte-13ogpty:hover,\n svg.svelte-13ogpty:hover {background:var(--image-hover-background, var(--image-background));border:var(--image-hover-border, var(--image-border));}"
|
|
3483
3483
|
};
|
|
@@ -3491,35 +3491,88 @@ function Img(e, t) {
|
|
|
3491
3491
|
function C() {
|
|
3492
3492
|
typeof a() == "string" && a().length > 0 && get(f) !== a() ? set(f, a()) : o()?.();
|
|
3493
3493
|
}
|
|
3494
|
-
|
|
3494
|
+
let k = new Set([
|
|
3495
|
+
"xmlns",
|
|
3496
|
+
"xmlns:xlink",
|
|
3497
|
+
"viewbox",
|
|
3498
|
+
"width",
|
|
3499
|
+
"height",
|
|
3500
|
+
"x",
|
|
3501
|
+
"y",
|
|
3502
|
+
"preserveaspectratio",
|
|
3503
|
+
"fill",
|
|
3504
|
+
"fill-opacity",
|
|
3505
|
+
"fill-rule",
|
|
3506
|
+
"stroke",
|
|
3507
|
+
"stroke-width",
|
|
3508
|
+
"stroke-opacity",
|
|
3509
|
+
"stroke-linecap",
|
|
3510
|
+
"stroke-linejoin",
|
|
3511
|
+
"stroke-miterlimit",
|
|
3512
|
+
"stroke-dasharray",
|
|
3513
|
+
"stroke-dashoffset",
|
|
3514
|
+
"clip-rule",
|
|
3515
|
+
"color",
|
|
3516
|
+
"opacity",
|
|
3517
|
+
"overflow",
|
|
3518
|
+
"role",
|
|
3519
|
+
"focusable"
|
|
3520
|
+
]);
|
|
3521
|
+
function R(e) {
|
|
3522
|
+
return k.has(e) || e.startsWith("aria-");
|
|
3523
|
+
}
|
|
3524
|
+
function G(e) {
|
|
3525
|
+
for (let t of Array.from(e.querySelectorAll("script, foreignObject"))) t.remove();
|
|
3526
|
+
for (let t of Array.from(e.querySelectorAll("*"))) for (let e of Array.from(t.attributes)) {
|
|
3527
|
+
let n = e.name.toLowerCase();
|
|
3528
|
+
if (n.startsWith("on")) {
|
|
3529
|
+
t.removeAttribute(e.name);
|
|
3530
|
+
continue;
|
|
3531
|
+
}
|
|
3532
|
+
(n === "href" || n === "xlink:href" || n === "src") && /^\s*javascript:/i.test(e.value) && t.removeAttribute(e.name);
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
function te(e) {
|
|
3536
|
+
let t = new DOMParser().parseFromString(e, "image/svg+xml");
|
|
3537
|
+
if (t.querySelector("parsererror") !== null) return null;
|
|
3538
|
+
let n = t.querySelector("svg");
|
|
3539
|
+
return n === null ? null : new Set(Array.from(n.attributes, (e) => e.name.toLowerCase()));
|
|
3540
|
+
}
|
|
3541
|
+
async function ne(e, t, n, i) {
|
|
3495
3542
|
try {
|
|
3496
3543
|
let a = await fetch(t, { signal: i });
|
|
3497
3544
|
if (!a.ok) {
|
|
3498
3545
|
set(p, t, !0);
|
|
3499
3546
|
return;
|
|
3500
3547
|
}
|
|
3501
|
-
let o = await a.text(), s = typeof n == "function" ? n(o) : o,
|
|
3502
|
-
if (
|
|
3548
|
+
let o = await a.text(), s = typeof n == "function", c = s ? n(o) : o, l = new DOMParser().parseFromString(c, "image/svg+xml");
|
|
3549
|
+
if (l.querySelector("parsererror") !== null) {
|
|
3503
3550
|
set(p, t, !0);
|
|
3504
3551
|
return;
|
|
3505
3552
|
}
|
|
3506
|
-
let
|
|
3507
|
-
if (
|
|
3553
|
+
let u = l.querySelector("svg");
|
|
3554
|
+
if (u === null) {
|
|
3508
3555
|
set(p, t, !0);
|
|
3509
3556
|
return;
|
|
3510
3557
|
}
|
|
3511
3558
|
if (i.aborted) return;
|
|
3512
3559
|
for (; e.firstChild !== null;) e.removeChild(e.firstChild);
|
|
3513
|
-
|
|
3514
|
-
for (
|
|
3560
|
+
let f = s ? te(o) : null;
|
|
3561
|
+
for (let t of Array.from(u.attributes)) {
|
|
3562
|
+
let n = t.name.toLowerCase();
|
|
3563
|
+
if (n === "class") continue;
|
|
3564
|
+
let i = f !== null && !f.has(n);
|
|
3565
|
+
(R(n) || i) && e.setAttribute(t.name, t.value);
|
|
3566
|
+
}
|
|
3567
|
+
for (G(u); u.firstChild !== null;) e.appendChild(u.firstChild);
|
|
3515
3568
|
} catch {
|
|
3516
3569
|
i.aborted || set(p, t, !0);
|
|
3517
3570
|
}
|
|
3518
3571
|
}
|
|
3519
|
-
function
|
|
3572
|
+
function re(e, t) {
|
|
3520
3573
|
let n = new AbortController();
|
|
3521
3574
|
function i(t) {
|
|
3522
|
-
n.abort(), n = new AbortController(),
|
|
3575
|
+
n.abort(), n = new AbortController(), ne(e, t.url, t.transform, n.signal);
|
|
3523
3576
|
}
|
|
3524
3577
|
return i(t), {
|
|
3525
3578
|
update(e) {
|
|
@@ -3530,7 +3583,7 @@ function Img(e, t) {
|
|
|
3530
3583
|
}
|
|
3531
3584
|
};
|
|
3532
3585
|
}
|
|
3533
|
-
var
|
|
3586
|
+
var be = {
|
|
3534
3587
|
get src() {
|
|
3535
3588
|
return n();
|
|
3536
3589
|
},
|
|
@@ -3579,23 +3632,23 @@ function Img(e, t) {
|
|
|
3579
3632
|
set testId(e) {
|
|
3580
3633
|
u(e), flushSync();
|
|
3581
3634
|
}
|
|
3582
|
-
},
|
|
3583
|
-
var t =
|
|
3584
|
-
action(t, (e, t) =>
|
|
3635
|
+
}, Me = comment(), Re = first_child(Me), Ue = (e) => {
|
|
3636
|
+
var t = root_1$75();
|
|
3637
|
+
action(t, (e, t) => re?.(e, t), () => ({
|
|
3585
3638
|
url: get(f),
|
|
3586
3639
|
transform: l() ?? null
|
|
3587
3640
|
})), template_effect(() => {
|
|
3588
3641
|
set_class(t, 0, clsx(s() ?? ""), "svelte-13ogpty"), set_attribute(t, "role", i().length > 0 ? "img" : null), set_attribute(t, "aria-label", i().length > 0 ? i() : null), set_attribute(t, "aria-hidden", i().length === 0 ? "true" : null), set_attribute(t, "data-pw", u()), set_attribute(t, "testID", u());
|
|
3589
3642
|
}), append(e, t);
|
|
3590
|
-
},
|
|
3591
|
-
var t =
|
|
3643
|
+
}, it = (e) => {
|
|
3644
|
+
var t = root_2$57();
|
|
3592
3645
|
template_effect(() => {
|
|
3593
3646
|
set_class(t, 1, clsx(s() ?? ""), "svelte-13ogpty"), set_attribute(t, "src", get(f)), set_attribute(t, "alt", i()), set_attribute(t, "data-pw", u()), set_attribute(t, "testid", u());
|
|
3594
3647
|
}), event("error", t, C), replay_events(t), append(e, t);
|
|
3595
3648
|
};
|
|
3596
|
-
return if_block(
|
|
3597
|
-
get(S) ? e(
|
|
3598
|
-
}), append(e,
|
|
3649
|
+
return if_block(Re, (e) => {
|
|
3650
|
+
get(S) ? e(Ue) : e(it, -1);
|
|
3651
|
+
}), append(e, Me), pop(be);
|
|
3599
3652
|
}
|
|
3600
3653
|
create_custom_element(Img, {
|
|
3601
3654
|
src: {},
|
|
@@ -7050,62 +7103,72 @@ function SplitInput(e, t) {
|
|
|
7050
7103
|
function R(e) {
|
|
7051
7104
|
return n().at(e) ?? "";
|
|
7052
7105
|
}
|
|
7053
|
-
function G() {
|
|
7106
|
+
async function G(e) {
|
|
7107
|
+
await tick();
|
|
7108
|
+
let t = get(k).at(e)?.getInputRef();
|
|
7109
|
+
if (t == null) return;
|
|
7110
|
+
let n = R(e);
|
|
7111
|
+
t.value !== n && (t.value = n);
|
|
7112
|
+
}
|
|
7113
|
+
function te() {
|
|
7054
7114
|
let e = n().filter((e) => e.length > 0);
|
|
7055
7115
|
p()?.([...n()]), f()?.([...n()]), e.length === get(S) && h()?.([...n()]);
|
|
7056
7116
|
}
|
|
7057
|
-
function
|
|
7117
|
+
function ne(e) {
|
|
7058
7118
|
e >= 0 && e < get(S) && get(k).at(e)?.focus();
|
|
7059
7119
|
}
|
|
7060
|
-
function
|
|
7120
|
+
function re(e, t) {
|
|
7061
7121
|
return (e.dataType ?? "text") === "tel" ? t.replace(/\D/g, "") : t.replace(/\s/g, "");
|
|
7062
7122
|
}
|
|
7063
|
-
function
|
|
7123
|
+
function be(e) {
|
|
7064
7124
|
let t = e.maxLength ?? 1e3;
|
|
7065
7125
|
return s() && t === 1 ? get(S) : t;
|
|
7066
7126
|
}
|
|
7067
|
-
function
|
|
7127
|
+
function Me(e, t) {
|
|
7068
7128
|
let i = get(C).at(e);
|
|
7069
7129
|
if (i === void 0) return;
|
|
7070
7130
|
let a = i.maxLength ?? 1e3;
|
|
7071
7131
|
if (s() && a === 1 && t.length > 1) {
|
|
7072
|
-
let a =
|
|
7132
|
+
let a = re(i, t);
|
|
7073
7133
|
if (a.length === 0) n(n()[e] = "", !0);
|
|
7074
7134
|
else if (e === 0 || a.length >= get(S)) {
|
|
7075
7135
|
for (let e = 0; e < Math.min(a.length, get(S)); e++) n(n()[e] = a.charAt(e), !0);
|
|
7076
|
-
|
|
7077
|
-
} else
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7136
|
+
ne(Math.min(a.length, get(S)) - 1);
|
|
7137
|
+
} else {
|
|
7138
|
+
let t = R(e), i = t.length === 1 ? a.replace(t, "") : "";
|
|
7139
|
+
n(n()[e] = i.length > 0 ? i.slice(-1) : a.slice(-1), !0), G(e), e < get(S) - 1 && ne(e + 1);
|
|
7140
|
+
}
|
|
7141
|
+
} else n(n()[e] = t, !0), s() && a === 1 && t.length > 0 && e < get(S) - 1 && ne(e + 1);
|
|
7142
|
+
te();
|
|
7083
7143
|
}
|
|
7084
7144
|
function Re(e, t) {
|
|
7145
|
+
e.key === "Backspace" ? R(t).length === 0 && t > 0 && (n(n()[t - 1] = "", !0), ne(t - 1), te()) : e.key === "ArrowLeft" && t > 0 ? ne(t - 1) : e.key === "ArrowRight" && t < get(S) - 1 ? ne(t + 1) : e.key === "Tab" && (e.shiftKey && t > 0 ? (e.preventDefault(), ne(t - 1)) : e.shiftKey === !1 && t < get(S) - 1 && (e.preventDefault(), ne(t + 1)));
|
|
7146
|
+
}
|
|
7147
|
+
function Ue(e, t) {
|
|
7085
7148
|
if (e.clipboardData === null) return;
|
|
7086
7149
|
e.preventDefault();
|
|
7087
7150
|
let i = e.clipboardData.getData("text").trim(), a = get(C).at(t);
|
|
7088
7151
|
if (s() && a !== void 0) {
|
|
7089
|
-
let e =
|
|
7152
|
+
let e = re(a, i);
|
|
7090
7153
|
for (let i = t; i < get(S); i++) {
|
|
7091
7154
|
let a = i - t;
|
|
7092
7155
|
if (a >= e.length) break;
|
|
7093
7156
|
n(n()[i] = e.charAt(a), !0);
|
|
7094
7157
|
}
|
|
7095
|
-
|
|
7158
|
+
ne(Math.min(t + e.length, get(S)) - 1);
|
|
7096
7159
|
} else n(n()[t] = i, !0);
|
|
7097
|
-
|
|
7160
|
+
te();
|
|
7098
7161
|
}
|
|
7099
|
-
function
|
|
7162
|
+
function it() {
|
|
7100
7163
|
for (let e = 0; e < get(S); e++) n(n()[e] = "", !0);
|
|
7101
|
-
p()?.([...n()]), f()?.([...n()]),
|
|
7164
|
+
p()?.([...n()]), f()?.([...n()]), ne(0);
|
|
7102
7165
|
}
|
|
7103
|
-
function
|
|
7104
|
-
|
|
7166
|
+
function at() {
|
|
7167
|
+
ne(0);
|
|
7105
7168
|
}
|
|
7106
|
-
var
|
|
7107
|
-
clear:
|
|
7108
|
-
focus:
|
|
7169
|
+
var ot = {
|
|
7170
|
+
clear: it,
|
|
7171
|
+
focus: at,
|
|
7109
7172
|
get values() {
|
|
7110
7173
|
return n();
|
|
7111
7174
|
},
|
|
@@ -7172,8 +7235,8 @@ function SplitInput(e, t) {
|
|
|
7172
7235
|
set oncomplete(e) {
|
|
7173
7236
|
h(e), flushSync();
|
|
7174
7237
|
}
|
|
7175
|
-
},
|
|
7176
|
-
return each(
|
|
7238
|
+
}, ct = root_3$41();
|
|
7239
|
+
return each(ct, 21, () => get(C), index, (e, t, n) => {
|
|
7177
7240
|
var i = root_2$46(), a = first_child(i), s = (e) => {
|
|
7178
7241
|
var t = root$72(), n = child(t, !0);
|
|
7179
7242
|
reset(t), template_effect(() => set_text(n, c())), append(e, t);
|
|
@@ -7183,7 +7246,7 @@ function SplitInput(e, t) {
|
|
|
7183
7246
|
});
|
|
7184
7247
|
var l = sibling(a, 2), u = child(l);
|
|
7185
7248
|
{
|
|
7186
|
-
let e = /* @__PURE__ */ user_derived(() => R(n)), i = /* @__PURE__ */ user_derived(() => get(t).dataType ?? "text"), a = /* @__PURE__ */ user_derived(() =>
|
|
7249
|
+
let e = /* @__PURE__ */ user_derived(() => R(n)), i = /* @__PURE__ */ user_derived(() => get(t).dataType ?? "text"), a = /* @__PURE__ */ user_derived(() => be(get(t))), s = /* @__PURE__ */ user_derived(() => get(t).validationPattern ?? null), c = /* @__PURE__ */ user_derived(() => get(t).validators ?? []), l = /* @__PURE__ */ user_derived(() => get(t).autoComplete ?? "on");
|
|
7187
7250
|
bind_this(Input(u, {
|
|
7188
7251
|
get value() {
|
|
7189
7252
|
return get(e);
|
|
@@ -7223,9 +7286,9 @@ function SplitInput(e, t) {
|
|
|
7223
7286
|
},
|
|
7224
7287
|
actionInput: !0,
|
|
7225
7288
|
classes: "field-group-input",
|
|
7226
|
-
onInput: (e) =>
|
|
7227
|
-
onKeyDown: (e) =>
|
|
7228
|
-
onPaste: (e) =>
|
|
7289
|
+
onInput: (e) => Me(n, e),
|
|
7290
|
+
onKeyDown: (e) => Re(e, n),
|
|
7291
|
+
onPaste: (e) => Ue(e, n)
|
|
7229
7292
|
}), (e, t) => get(k)[t] = e, (e) => get(k)?.[e], () => [n]);
|
|
7230
7293
|
}
|
|
7231
7294
|
var f = sibling(u, 2), p = (e) => {
|
|
@@ -7235,9 +7298,9 @@ function SplitInput(e, t) {
|
|
|
7235
7298
|
if_block(f, (e) => {
|
|
7236
7299
|
typeof get(t).label == "string" && e(p);
|
|
7237
7300
|
}), reset(l), append(e, i);
|
|
7238
|
-
}), reset(
|
|
7239
|
-
set_class(
|
|
7240
|
-
}), append(e,
|
|
7301
|
+
}), reset(ct), template_effect(() => {
|
|
7302
|
+
set_class(ct, 1, `field-group ${u() ?? "" ?? ""}`, "svelte-1gcz5cs"), set_attribute(ct, "data-pw", l()), set_attribute(ct, "testid", l());
|
|
7303
|
+
}), append(e, ct), pop(ot);
|
|
7241
7304
|
}
|
|
7242
7305
|
create_custom_element(SplitInput, {
|
|
7243
7306
|
values: {},
|
|
@@ -12713,6 +12776,11 @@ customElements.define("sui-choicebox", create_custom_element(Choicebox_wc, {
|
|
|
12713
12776
|
reflect: !0,
|
|
12714
12777
|
type: "Boolean"
|
|
12715
12778
|
},
|
|
12779
|
+
showIndicator: {
|
|
12780
|
+
attribute: "show-indicator",
|
|
12781
|
+
reflect: !0,
|
|
12782
|
+
type: "Boolean"
|
|
12783
|
+
},
|
|
12716
12784
|
testId: {
|
|
12717
12785
|
attribute: "test-id",
|
|
12718
12786
|
type: "String"
|