@r2digisolutions/components 0.21.24 → 0.21.26
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.
|
@@ -44,7 +44,13 @@
|
|
|
44
44
|
lg: 'px-5 py-5 sm:px-6 sm:py-6'
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
function handleKeydown(e: KeyboardEvent) {
|
|
48
|
+
if (!onclick) return;
|
|
49
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
onclick(e as unknown as MouseEvent);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
48
54
|
</script>
|
|
49
55
|
|
|
50
56
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
@@ -60,10 +66,8 @@
|
|
|
60
66
|
]}
|
|
61
67
|
role={onclick ? 'button' : undefined}
|
|
62
68
|
tabindex={onclick ? 0 : undefined}
|
|
63
|
-
{onclick}
|
|
64
|
-
onkeydown={onclick
|
|
65
|
-
? (e) => e.key === 'Enter' && onclick?.(e as unknown as MouseEvent)
|
|
66
|
-
: undefined}
|
|
69
|
+
onclick={onclick}
|
|
70
|
+
onkeydown={onclick ? handleKeydown : undefined}
|
|
67
71
|
>
|
|
68
72
|
{#if header}
|
|
69
73
|
<div
|
|
@@ -97,7 +97,16 @@
|
|
|
97
97
|
return rules.some((rule) => {
|
|
98
98
|
if (rule.startsWith('.')) return name.endsWith(rule);
|
|
99
99
|
if (rule.endsWith('/*')) return type.startsWith(rule.slice(0, -1));
|
|
100
|
-
|
|
100
|
+
if (type && type === rule) return true;
|
|
101
|
+
// image/png → also match *.png when browser leaves type empty
|
|
102
|
+
const slash = rule.lastIndexOf('/');
|
|
103
|
+
if (slash > 0) {
|
|
104
|
+
const subtype = rule.slice(slash + 1);
|
|
105
|
+
if (subtype && subtype !== '*' && name.endsWith(`.${subtype}`)) return true;
|
|
106
|
+
if (subtype === 'jpeg' && name.endsWith('.jpg')) return true;
|
|
107
|
+
if (subtype === 'svg+xml' && name.endsWith('.svg')) return true;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
101
110
|
});
|
|
102
111
|
}
|
|
103
112
|
|