@threadlabs/looma 0.52.5 → 0.52.6
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/components/ui-notice-stripe/ui-notice-stripe.html +109 -0
- package/components/ui-notice-stripe/ui-notice-stripe.js +13 -0
- package/dist/index.js +28 -27
- package/docs/catalog.json +248 -1
- package/docs/examples/ui-notice-stripe/examples/02-service-notice.behavior.js +7 -0
- package/package.json +1 -1
- package/styles/ui-notice-stripe.css +172 -0
- package/vanilla/UiNoticeStripe.d.ts +26 -0
- package/vanilla/UiNoticeStripe.js +89 -0
- package/vanilla/index.js +1 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<link rel="component" href="../ui-icon-button/ui-icon-button.html">
|
|
2
|
+
<link rel="component" href="../ui-icon/ui-icon.html">
|
|
3
|
+
<template component="ui-notice-stripe" module="./ui-notice-stripe.js">
|
|
4
|
+
<defs>
|
|
5
|
+
<prop name="tone" type="keyword" values="neutral, info, success, warning, danger" default="info"
|
|
6
|
+
>Semantic message tone. Danger uses alert semantics; other tones use a polite status.</prop>
|
|
7
|
+
<prop name="dismissible" type="boolean" default="false"
|
|
8
|
+
>Show a close control that requests dismissal. The consumer owns removing or hiding the stripe.</prop>
|
|
9
|
+
<prop name="dismissLabel" type="string" default="Dismiss notification"
|
|
10
|
+
>Accessible name of the close control, including translated or message-specific wording.</prop>
|
|
11
|
+
<event name="dismiss" type="object">
|
|
12
|
+
<prop name="reason" required type="keyword" values="action"></prop>
|
|
13
|
+
<prop name="trigger" required type="keyword" values="keyboard, pointer, programmatic"></prop>
|
|
14
|
+
</event>
|
|
15
|
+
</defs>
|
|
16
|
+
<div from:role="{ neutral: 'status', info: 'status', success: 'status', warning: 'status', danger: 'alert' }[$tone]">
|
|
17
|
+
<div class="content">
|
|
18
|
+
<div class="message"><slot></slot></div>
|
|
19
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
20
|
+
</div>
|
|
21
|
+
<ui-icon-button $if="$dismissible" class="dismiss" size="sm" variant="ghost" from:label="$dismissLabel">
|
|
22
|
+
<ui-icon name="x"></ui-icon>
|
|
23
|
+
</ui-icon-button>
|
|
24
|
+
</div>
|
|
25
|
+
<style>
|
|
26
|
+
:host {
|
|
27
|
+
--_ui-notice-stripe-surface: var(--ui-info-soft);
|
|
28
|
+
--_ui-notice-stripe-border: var(--ui-info-soft-border);
|
|
29
|
+
--_ui-surface-text: var(--ui-info-subtle-text);
|
|
30
|
+
display: flex !important;
|
|
31
|
+
align-items: center !important;
|
|
32
|
+
gap: var(--ui-space-2) !important;
|
|
33
|
+
box-sizing: border-box !important;
|
|
34
|
+
inline-size: 100%;
|
|
35
|
+
min-inline-size: 0;
|
|
36
|
+
min-block-size: 44px;
|
|
37
|
+
margin: 0 !important;
|
|
38
|
+
padding: var(--ui-space-1) var(--ui-space-3) !important;
|
|
39
|
+
border: 0;
|
|
40
|
+
border-block-end: var(--ui-border-width) solid var(--_ui-notice-stripe-border);
|
|
41
|
+
border-radius: 0;
|
|
42
|
+
background: var(--_ui-notice-stripe-surface);
|
|
43
|
+
color: var(--_ui-surface-text);
|
|
44
|
+
font-family: var(--ui-font-family-sans);
|
|
45
|
+
font-size: var(--ui-font-size-sm);
|
|
46
|
+
font-weight: var(--ui-font-normal);
|
|
47
|
+
line-height: var(--ui-line-height-md);
|
|
48
|
+
}
|
|
49
|
+
:host([tone="neutral"]) {
|
|
50
|
+
--_ui-notice-stripe-surface: var(--ui-surface-muted);
|
|
51
|
+
--_ui-notice-stripe-border: var(--ui-border-strong);
|
|
52
|
+
--_ui-surface-text: var(--ui-text-primary);
|
|
53
|
+
}
|
|
54
|
+
:host([tone="success"]) {
|
|
55
|
+
--_ui-notice-stripe-surface: var(--ui-success-soft);
|
|
56
|
+
--_ui-notice-stripe-border: var(--ui-success-soft-border);
|
|
57
|
+
--_ui-surface-text: var(--ui-success-subtle-text);
|
|
58
|
+
}
|
|
59
|
+
:host([tone="warning"]) {
|
|
60
|
+
--_ui-notice-stripe-surface: var(--ui-warning-soft);
|
|
61
|
+
--_ui-notice-stripe-border: var(--ui-warning-soft-border);
|
|
62
|
+
--_ui-surface-text: var(--ui-warning-subtle-text);
|
|
63
|
+
}
|
|
64
|
+
:host([tone="danger"]) {
|
|
65
|
+
--_ui-notice-stripe-surface: var(--ui-danger-soft);
|
|
66
|
+
--_ui-notice-stripe-border: var(--ui-danger-soft-border);
|
|
67
|
+
--_ui-surface-text: var(--ui-danger-subtle-text);
|
|
68
|
+
}
|
|
69
|
+
.content {
|
|
70
|
+
display: flex !important;
|
|
71
|
+
flex: 1;
|
|
72
|
+
flex-wrap: wrap !important;
|
|
73
|
+
align-items: center !important;
|
|
74
|
+
gap: var(--ui-space-1) var(--ui-space-3) !important;
|
|
75
|
+
min-inline-size: 0;
|
|
76
|
+
}
|
|
77
|
+
.message {
|
|
78
|
+
flex: 1 1 16rem;
|
|
79
|
+
min-inline-size: 0;
|
|
80
|
+
overflow-wrap: anywhere;
|
|
81
|
+
}
|
|
82
|
+
.actions {
|
|
83
|
+
display: flex !important;
|
|
84
|
+
flex-wrap: wrap !important;
|
|
85
|
+
align-items: center !important;
|
|
86
|
+
justify-content: flex-end !important;
|
|
87
|
+
gap: var(--ui-space-2) !important;
|
|
88
|
+
min-inline-size: 0;
|
|
89
|
+
max-inline-size: 100%;
|
|
90
|
+
overflow-wrap: anywhere;
|
|
91
|
+
margin-inline-start: auto !important;
|
|
92
|
+
}
|
|
93
|
+
.actions:empty {
|
|
94
|
+
display: none !important;
|
|
95
|
+
}
|
|
96
|
+
.dismiss {
|
|
97
|
+
flex: none;
|
|
98
|
+
}
|
|
99
|
+
.message :slotted(a),
|
|
100
|
+
.actions :slotted(a) {
|
|
101
|
+
color: inherit;
|
|
102
|
+
text-decoration: underline;
|
|
103
|
+
text-underline-offset: 0.18em;
|
|
104
|
+
}
|
|
105
|
+
:host[hidden] {
|
|
106
|
+
display: none !important;
|
|
107
|
+
}
|
|
108
|
+
</style>
|
|
109
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { trackTrigger } from "../shared/trigger.js";
|
|
2
|
+
|
|
3
|
+
/** Report dismissal intent without changing the consumer-owned visibility or message. */
|
|
4
|
+
export function connect(host) {
|
|
5
|
+
const [takeTrigger, stopTrigger] = trackTrigger(host);
|
|
6
|
+
const dismiss = (event) => {
|
|
7
|
+
const control = event.target.closest?.(".dismiss");
|
|
8
|
+
if (!control || control.parentElement !== host.element || !host.props.dismissible.value || event.defaultPrevented) return;
|
|
9
|
+
host.dispatch("dismiss", { reason: "action", trigger: takeTrigger() });
|
|
10
|
+
};
|
|
11
|
+
host.element.addEventListener("click", dismiss);
|
|
12
|
+
return () => { stopTrigger(); host.element.removeEventListener("click", dismiss); };
|
|
13
|
+
}
|