@hyvor/design 0.0.55 → 0.0.56

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.
@@ -1,7 +1,7 @@
1
1
  <script>export let bold = false;
2
2
  </script>
3
3
 
4
- <div class="caption" class:bold>
4
+ <div class="caption" class:bold {...$$restProps}>
5
5
  <slot />
6
6
  </div>
7
7
 
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  bold?: boolean | undefined;
5
6
  };
6
7
  events: {
@@ -8,7 +8,7 @@ gap = typeof gap === "number" ? gap : gaps[gap];
8
8
  </script>
9
9
 
10
10
 
11
- <div class="checkbox-group" style:gap={gap + "px"}>
11
+ <div class="checkbox-group" style:gap={gap + "px"} {...$$restProps}>
12
12
  <slot />
13
13
  </div>
14
14
 
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  gap?: number | "small" | "medium" | "large" | undefined;
5
6
  };
6
7
  events: {
@@ -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 = (chunks) => {
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 && value.hasOwnProperty("component")) {
40
- const { component, props } = value;
41
- newValue = (chunks) => {
42
- const children = typeof chunks === "string" ? chunks : chunks.join("");
43
- const id = key2 + "-" + Math.random().toString(36).substring(7) + "-" + Date.now().toString();
44
- componentBindings.set(id, {
45
- component,
46
- props: {
47
- ...props,
48
- children
49
- }
50
- });
51
- return '<span id="' + id + '">' + children + "</span>";
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "scripts": {