@marianmeres/stuic 1.48.0 → 1.50.0
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/DismissibleMessage/DismissibleMessage.svelte +12 -3
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +2 -2
- package/dist/components/Thc/Thc.svelte +3 -1
- package/dist/components/Thc/Thc.svelte.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script context="module">import { slide } from "svelte/transition";
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
|
-
import { Thc, X } from "../../index.js";
|
|
3
|
+
import { Thc, X, isTHCNotEmpty } from "../../index.js";
|
|
4
|
+
import { tick } from "svelte";
|
|
4
5
|
const themes = {
|
|
5
6
|
primary: "bg-stuic-primary/10 text-stuic-primary dark:bg-stuic-primary dark:text-white/90",
|
|
6
7
|
secondary: "bg-stuic-secondary/10 text-stuic-secondary dark:bg-stuic-secondary dark:text-white/90",
|
|
@@ -53,11 +54,19 @@ export let classContent = "";
|
|
|
53
54
|
export let classDismiss = "";
|
|
54
55
|
export let duration = 150;
|
|
55
56
|
export let message;
|
|
56
|
-
export let onDismiss = () => message =
|
|
57
|
+
export let onDismiss = () => message = "";
|
|
57
58
|
export let theme = "primary";
|
|
59
|
+
let show = false;
|
|
60
|
+
$:
|
|
61
|
+
if (isTHCNotEmpty(message)) {
|
|
62
|
+
requestAnimationFrame(() => show = true);
|
|
63
|
+
} else {
|
|
64
|
+
show = false;
|
|
65
|
+
}
|
|
58
66
|
</script>
|
|
59
67
|
|
|
60
|
-
{#if message}
|
|
68
|
+
<!-- {#if isNotEmpty(message)} -->
|
|
69
|
+
{#if show}
|
|
61
70
|
<div
|
|
62
71
|
class={twMerge(
|
|
63
72
|
DismissibleMessageConfig.preset.box,
|
|
@@ -18,8 +18,8 @@ declare const __propDef: {
|
|
|
18
18
|
classContent?: string | undefined;
|
|
19
19
|
classDismiss?: string | undefined;
|
|
20
20
|
duration?: number | undefined;
|
|
21
|
-
message: THC
|
|
22
|
-
onDismiss?: (() => void) | null | undefined;
|
|
21
|
+
message: THC;
|
|
22
|
+
onDismiss?: false | (() => void) | null | undefined;
|
|
23
23
|
theme?: "primary" | TW_COLORS | "secondary" | undefined;
|
|
24
24
|
};
|
|
25
25
|
events: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<script context="module"
|
|
1
|
+
<script context="module">const _is = (m) => typeof m === "string" && m;
|
|
2
|
+
export const isTHCNotEmpty = (m) => _is(m) || _is(m?.text) || _is(m?.html) || m?.component;
|
|
3
|
+
</script>
|
|
2
4
|
|
|
3
5
|
<script>export let forceAsHtml = false;
|
|
4
6
|
export let thc;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { createNotificationsStore, NOTIFICATION_EVENT, type NotiticationsCreateS
|
|
|
18
18
|
export { default as Notifications, NotificationsConfig, } from './components/Notifications/Notifications.svelte';
|
|
19
19
|
export { default as Popover } from './components/Popover/Popover.svelte';
|
|
20
20
|
export { default as Switch, SwitchConfig } from './components/Switch/Switch.svelte';
|
|
21
|
-
export { default as Thc, type THC } from './components/Thc/Thc.svelte';
|
|
21
|
+
export { default as Thc, type THC, isTHCNotEmpty } from './components/Thc/Thc.svelte';
|
|
22
22
|
export { default as X } from './components/X/X.svelte';
|
|
23
23
|
export { focusTrap } from './actions/focus-trap.js';
|
|
24
24
|
export { onOutside } from './actions/on-outside.js';
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { default as Notifications, NotificationsConfig, } from './components/Not
|
|
|
31
31
|
export { default as Popover } from './components/Popover/Popover.svelte';
|
|
32
32
|
//
|
|
33
33
|
export { default as Switch, SwitchConfig } from './components/Switch/Switch.svelte';
|
|
34
|
-
export { default as Thc } from './components/Thc/Thc.svelte';
|
|
34
|
+
export { default as Thc, isTHCNotEmpty } from './components/Thc/Thc.svelte';
|
|
35
35
|
//
|
|
36
36
|
export { default as X } from './components/X/X.svelte';
|
|
37
37
|
// actions
|