@hyvor/design 0.0.55 → 0.0.57
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/LICENSE +2 -2
- package/dist/components/FormControl/Caption.svelte +1 -1
- package/dist/components/FormControl/Caption.svelte.d.ts +1 -0
- package/dist/components/FormControl/InputGroup.svelte +1 -1
- package/dist/components/FormControl/InputGroup.svelte.d.ts +1 -0
- package/dist/components/FormControl/Validation.svelte +2 -1
- package/dist/components/FormControl/Validation.svelte.d.ts +3 -0
- package/dist/components/Internationalization/T.svelte +25 -19
- package/dist/components/Modal/Modal.svelte +17 -2
- package/dist/components/Modal/Modal.svelte.d.ts +2 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 HYVOR (hyvor.com)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script>import { IconCheckCircleFill, IconExclamationTriangleFill, IconInfoCircleFill } from "@hyvor/icons";
|
|
2
2
|
export let state = "error";
|
|
3
|
+
export let role = "alert";
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
|
-
<div class="validation {state}">
|
|
6
|
+
<div class="validation {state}" {role} {...$$restProps}>
|
|
6
7
|
<div class="icon">
|
|
7
8
|
|
|
8
9
|
{#if state === 'error'}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AriaRole } from "svelte/elements";
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
5
|
+
[x: string]: any;
|
|
4
6
|
state?: "error" | "success" | "warning" | undefined;
|
|
7
|
+
role?: AriaRole | undefined;
|
|
5
8
|
};
|
|
6
9
|
events: {
|
|
7
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -6,6 +6,12 @@ import { getMessage as getMessageBase } from "./t.js";
|
|
|
6
6
|
export let key;
|
|
7
7
|
export let params = {};
|
|
8
8
|
let hasComponentParams = false;
|
|
9
|
+
function getElementFunc(el) {
|
|
10
|
+
return (chunks) => {
|
|
11
|
+
const children = typeof chunks === "string" ? chunks : chunks.join("");
|
|
12
|
+
return `<${el}>${children}</${el}>`;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
9
15
|
function getParamsForBackend() {
|
|
10
16
|
let retParams = {};
|
|
11
17
|
for (let [key2, value] of Object.entries(params)) {
|
|
@@ -18,11 +24,7 @@ function getParamsForBackend() {
|
|
|
18
24
|
};
|
|
19
25
|
hasComponentParams = true;
|
|
20
26
|
} else if (value.hasOwnProperty("element")) {
|
|
21
|
-
newValue = (
|
|
22
|
-
const children = typeof chunks === "string" ? chunks : chunks.join("");
|
|
23
|
-
const el = value.element;
|
|
24
|
-
return `<${el}>${children}</${el}>`;
|
|
25
|
-
};
|
|
27
|
+
newValue = getElementFunc(value.element);
|
|
26
28
|
}
|
|
27
29
|
} else {
|
|
28
30
|
newValue = value;
|
|
@@ -36,20 +38,24 @@ function getParamsForFrontend() {
|
|
|
36
38
|
let retParams = {};
|
|
37
39
|
for (let [key2, value] of Object.entries(params)) {
|
|
38
40
|
let newValue;
|
|
39
|
-
if (typeof value === "object" && value !== null
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
if (typeof value === "object" && value !== null) {
|
|
42
|
+
if (value.hasOwnProperty("component")) {
|
|
43
|
+
const { component, props } = value;
|
|
44
|
+
newValue = (chunks) => {
|
|
45
|
+
const children = typeof chunks === "string" ? chunks : chunks.join("");
|
|
46
|
+
const id = key2 + "-" + Math.random().toString(36).substring(7) + "-" + Date.now().toString();
|
|
47
|
+
componentBindings.set(id, {
|
|
48
|
+
component,
|
|
49
|
+
props: {
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return '<span id="' + id + '">' + children + "</span>";
|
|
55
|
+
};
|
|
56
|
+
} else if (value.hasOwnProperty("element")) {
|
|
57
|
+
newValue = getElementFunc(value.element);
|
|
58
|
+
}
|
|
53
59
|
} else {
|
|
54
60
|
newValue = value;
|
|
55
61
|
}
|
|
@@ -8,9 +8,13 @@ import Loader from "../Loader/Loader.svelte";
|
|
|
8
8
|
export let show = false;
|
|
9
9
|
export let title = "";
|
|
10
10
|
export let size = "medium";
|
|
11
|
+
export let id = "modal";
|
|
12
|
+
export let role = "alertdialog";
|
|
11
13
|
export let closeOnOutsideClick = true;
|
|
12
14
|
export let closeOnEscape = true;
|
|
13
15
|
export let loading = false;
|
|
16
|
+
const titleId = id + "-title";
|
|
17
|
+
const descId = id + "-desc";
|
|
14
18
|
export let footer = null;
|
|
15
19
|
let wrapEl;
|
|
16
20
|
let innerEl;
|
|
@@ -53,11 +57,19 @@ $:
|
|
|
53
57
|
in:scale={{duration: 100, start: 0.9, opacity: 0.9}}
|
|
54
58
|
out:scale={{duration: 100, start: 0.9, opacity: 0.9}}
|
|
55
59
|
bind:this={innerEl}
|
|
60
|
+
|
|
61
|
+
role={role}
|
|
62
|
+
aria-modal="true"
|
|
63
|
+
aria-labelledby={titleId}
|
|
64
|
+
aria-describedby={descId}
|
|
56
65
|
>
|
|
57
66
|
|
|
58
67
|
<div class="header">
|
|
59
68
|
|
|
60
|
-
<div
|
|
69
|
+
<div
|
|
70
|
+
class="title"
|
|
71
|
+
id={titleId}
|
|
72
|
+
>
|
|
61
73
|
{#if $$slots.title}
|
|
62
74
|
<slot name="title" />
|
|
63
75
|
{:else}
|
|
@@ -76,7 +88,10 @@ $:
|
|
|
76
88
|
|
|
77
89
|
</div>
|
|
78
90
|
|
|
79
|
-
<div
|
|
91
|
+
<div
|
|
92
|
+
class="content"
|
|
93
|
+
id={descId}
|
|
94
|
+
>
|
|
80
95
|
<slot />
|
|
81
96
|
</div>
|
|
82
97
|
|
|
@@ -5,6 +5,8 @@ declare const __propDef: {
|
|
|
5
5
|
show?: boolean | undefined;
|
|
6
6
|
title?: string | undefined;
|
|
7
7
|
size?: "small" | "medium" | "large" | undefined;
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
role?: "dialog" | "alertdialog" | undefined;
|
|
8
10
|
closeOnOutsideClick?: boolean | undefined;
|
|
9
11
|
closeOnEscape?: boolean | undefined;
|
|
10
12
|
loading?: string | boolean | undefined;
|