@threadlabs/looma 0.23.6 → 0.23.8
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-badge/ui-badge.html +34 -3
- package/components/ui-disclosure/ui-disclosure.html +71 -19
- package/components/ui-disclosure/ui-disclosure.js +50 -4
- package/components/ui-nav-item/ui-nav-item.html +16 -11
- package/components/ui-sidebar/ui-sidebar.html +36 -7
- package/components/ui-sidebar/ui-sidebar.js +6 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/styles/ui-badge.css +31 -0
- package/styles/ui-disclosure.css +65 -17
- package/styles/ui-nav-item.css +14 -11
- package/styles/ui-sidebar.css +34 -6
- package/tokens.css +15 -0
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +1 -1
- package/vanilla/UiDisclosure.d.ts +2 -0
- package/vanilla/UiDisclosure.js +33 -18
- package/vanilla/UiNavItem.js +42 -18
- package/vanilla/UiSidebar.js +19 -16
- package/vue/UiBadge.d.ts +3 -3
- package/vue/UiBadge.vue +38 -6
- package/vue/UiDisclosure.d.ts +24 -4
- package/vue/UiDisclosure.vue +130 -22
- package/vue/UiNavItem.d.ts +8 -4
- package/vue/UiNavItem.vue +17 -12
- package/vue/UiSection.d.ts +1 -1
- package/vue/UiSidebar.vue +42 -8
- package/vue/chunks/UiBadge.js +5 -4
- package/vue/chunks/UiDisclosure.js +70 -14
- package/vue/chunks/UiNavItem.js +14 -10
- package/vue/chunks/UiSidebar.js +12 -7
- package/vue/components.css +235 -123
package/package.json
CHANGED
package/styles/ui-badge.css
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
syntax: "*";
|
|
4
4
|
inherits: false;
|
|
5
5
|
}
|
|
6
|
+
@property --ui-badge-square-size {
|
|
7
|
+
syntax: "*";
|
|
8
|
+
inherits: false;
|
|
9
|
+
}
|
|
6
10
|
@property --ui-badge-dot-size {
|
|
7
11
|
syntax: "*";
|
|
8
12
|
inherits: false;
|
|
@@ -207,6 +211,31 @@
|
|
|
207
211
|
--_badge-text: var(--ui-info-subtle-text, var(--ui-info-solid));
|
|
208
212
|
}
|
|
209
213
|
|
|
214
|
+
/* An icon mark keeps the existing tone recipe and follows the global spacing and radius. */
|
|
215
|
+
:scope[data-ui-badge-state~="shape=square"] {
|
|
216
|
+
--_badge-square-size: var(--ui-badge-square-size, calc(var(--ui-space-4) * 2));
|
|
217
|
+
display: inline-flex;
|
|
218
|
+
box-sizing: border-box;
|
|
219
|
+
flex: none;
|
|
220
|
+
inline-size: var(--_badge-square-size);
|
|
221
|
+
block-size: var(--_badge-square-size);
|
|
222
|
+
min-inline-size: var(--_badge-square-size);
|
|
223
|
+
min-block-size: var(--_badge-square-size);
|
|
224
|
+
padding: 0;
|
|
225
|
+
border-radius: var(--ui-radius-md);
|
|
226
|
+
text-box-trim: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
:scope[data-ui-badge-state~="shape=square"][data-ui-badge-state~="size=xs"] {
|
|
230
|
+
--_badge-square-size: var(--ui-badge-square-size, calc(var(--ui-space-3) * 2));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
:scope[data-ui-badge-state~="shape=square"] .label {
|
|
234
|
+
display: inline-flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
}
|
|
238
|
+
|
|
210
239
|
/* A dot uses the badge's tone recipe; only its silhouette and visible label change. */
|
|
211
240
|
:scope[data-ui-badge-state~="shape=dot"] {
|
|
212
241
|
position: relative;
|
|
@@ -299,6 +328,8 @@
|
|
|
299
328
|
/* A solid colour fills with the ink. Its text is the page surface, mixed at 0% only so that it too is
|
|
300
329
|
invalid while the hook is unset. */
|
|
301
330
|
|
|
331
|
+
/* An icon mark keeps the existing tone recipe and follows the global spacing and radius. */
|
|
332
|
+
|
|
302
333
|
/* A dot uses the badge's tone recipe; only its silhouette and visible label change. */
|
|
303
334
|
|
|
304
335
|
/* The clipped point needs an inset surface over an outer border-colour shape: a native border
|
package/styles/ui-disclosure.css
CHANGED
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.trigger {
|
|
46
|
-
display:
|
|
47
|
-
grid-template-columns: minmax(0, 1fr) auto;
|
|
46
|
+
display: flex;
|
|
48
47
|
gap: var(--ui-space-3);
|
|
49
48
|
align-items: center;
|
|
50
49
|
inline-size: 100%;
|
|
@@ -74,19 +73,40 @@
|
|
|
74
73
|
cursor: not-allowed;
|
|
75
74
|
}
|
|
76
75
|
|
|
76
|
+
.summary {
|
|
77
|
+
flex: 1;
|
|
78
|
+
min-inline-size: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.leading,
|
|
82
|
+
.indicator {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
flex: none;
|
|
87
|
+
}
|
|
88
|
+
.leading:empty {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
91
|
+
.indicator {
|
|
92
|
+
transition: transform var(--ui-motion-feedback) var(--ui-motion-feedback-ease);
|
|
93
|
+
}
|
|
94
|
+
:scope[data-ui-disclosure-state~="internalOpen"] .indicator {
|
|
95
|
+
transform: rotate(180deg);
|
|
96
|
+
}
|
|
97
|
+
|
|
77
98
|
.chevron {
|
|
78
99
|
inline-size: 0.5rem;
|
|
79
100
|
block-size: 0.5rem;
|
|
80
101
|
border-inline-end: 2px solid currentColor;
|
|
81
102
|
border-block-end: 2px solid currentColor;
|
|
82
103
|
transform: rotate(45deg) translate(-1px, -1px);
|
|
83
|
-
transition: transform var(--ui-motion-fast) var(--ui-motion-ease);
|
|
84
104
|
}
|
|
85
105
|
|
|
86
106
|
.panel {
|
|
87
107
|
display: grid;
|
|
88
108
|
grid-template-rows: 0fr;
|
|
89
|
-
transition: grid-template-rows var(--ui-motion-
|
|
109
|
+
transition: grid-template-rows var(--ui-motion-reveal) var(--ui-motion-reveal-ease), content-visibility var(--ui-motion-reveal) allow-discrete;
|
|
90
110
|
}
|
|
91
111
|
|
|
92
112
|
.panel-inner {
|
|
@@ -101,22 +121,20 @@
|
|
|
101
121
|
:scope[data-ui-disclosure-state~="internalOpen"] .panel-inner {
|
|
102
122
|
padding-block: 0 var(--ui-space-3);
|
|
103
123
|
}
|
|
104
|
-
:scope[data-ui-disclosure-state~="internalOpen"] .chevron {
|
|
105
|
-
transform: rotate(225deg) translate(-1px, -1px);
|
|
106
|
-
}
|
|
107
124
|
|
|
108
125
|
/* A bounded accordion owns one flexible body, so its trigger never scrolls away. The
|
|
109
126
|
* normal content-sized layout and its animation remain unchanged when fill is omitted. */
|
|
110
127
|
:scope[data-ui-disclosure-state~="fill"] {
|
|
111
128
|
display: flex;
|
|
112
129
|
flex-direction: column;
|
|
113
|
-
flex:
|
|
114
|
-
min-block-size:
|
|
130
|
+
flex: 0 0 var(--_ui-disclosure-heading-size, var(--_trigger-min-block-size));
|
|
131
|
+
min-block-size: calc(var(--_ui-disclosure-heading-size, var(--_trigger-min-block-size)) + var(--ui-border-width));
|
|
132
|
+
transition: flex-grow var(--ui-motion-layout) var(--ui-motion-layout-ease);
|
|
115
133
|
border-block-end: 0;
|
|
116
134
|
border-block-start: var(--ui-border-width) solid var(--ui-border-divider);
|
|
117
135
|
}
|
|
118
136
|
:scope[data-ui-disclosure-state~="fill"][data-ui-disclosure-state~="internalOpen"] {
|
|
119
|
-
flex: 1;
|
|
137
|
+
flex-grow: 1;
|
|
120
138
|
}
|
|
121
139
|
:scope[data-ui-disclosure-state~="fill"] .heading {
|
|
122
140
|
flex: none;
|
|
@@ -125,14 +143,8 @@
|
|
|
125
143
|
border-radius: 0;
|
|
126
144
|
}
|
|
127
145
|
:scope[data-ui-disclosure-state~="fill"] .panel {
|
|
128
|
-
display: flex;
|
|
129
146
|
flex: 1;
|
|
130
147
|
min-block-size: 0;
|
|
131
|
-
transition: none;
|
|
132
|
-
}
|
|
133
|
-
:scope[data-ui-disclosure-state~="fill"] .panel[hidden] {
|
|
134
|
-
flex: none;
|
|
135
|
-
block-size: 0;
|
|
136
148
|
}
|
|
137
149
|
:scope[data-ui-disclosure-state~="fill"] .panel-inner {
|
|
138
150
|
display: flex;
|
|
@@ -142,9 +154,43 @@
|
|
|
142
154
|
padding: 0;
|
|
143
155
|
}
|
|
144
156
|
|
|
157
|
+
:scope[data-ui-disclosure-state~="variant=navigation"] .trigger {
|
|
158
|
+
gap: var(--ui-nav-gap);
|
|
159
|
+
padding-inline: var(--ui-nav-padding-inline);
|
|
160
|
+
min-block-size: var(--ui-nav-min-block-size);
|
|
161
|
+
padding-block: var(--ui-nav-padding-block);
|
|
162
|
+
border-radius: var(--ui-selection-radius);
|
|
163
|
+
font-size: var(--ui-font-size-md);
|
|
164
|
+
font-weight: var(--ui-font-normal);
|
|
165
|
+
color: var(--ui-text-secondary);
|
|
166
|
+
}
|
|
167
|
+
:scope[data-ui-disclosure-state~="variant=navigation"][data-ui-disclosure-state~="density=compact"] .trigger {
|
|
168
|
+
padding-inline: var(--ui-nav-compact-padding-inline);
|
|
169
|
+
padding-block: var(--ui-nav-compact-padding-block);
|
|
170
|
+
min-block-size: var(--ui-nav-compact-min-block-size);
|
|
171
|
+
font-size: var(--ui-font-size-sm);
|
|
172
|
+
}
|
|
173
|
+
:scope[data-ui-disclosure-state~="variant=navigation"] .trigger:hover:not(:disabled) {
|
|
174
|
+
background: var(--ui-nav-hover-surface);
|
|
175
|
+
color: var(--ui-text-primary);
|
|
176
|
+
}
|
|
177
|
+
:scope[data-ui-disclosure-state~="variant=navigation"][data-ui-disclosure-state~="internalOpen"] .trigger {
|
|
178
|
+
color: var(--ui-selection-text);
|
|
179
|
+
}
|
|
180
|
+
:scope[data-ui-disclosure-state~="variant=navigation"] :is(.leading, .indicator) {
|
|
181
|
+
inline-size: var(--ui-nav-icon-size);
|
|
182
|
+
font-size: var(--ui-nav-icon-size);
|
|
183
|
+
}
|
|
184
|
+
@media (pointer: coarse) {
|
|
185
|
+
:scope[data-ui-disclosure-state~="variant=navigation"][data-ui-disclosure-state~="density=compact"] .trigger {
|
|
186
|
+
min-block-size: var(--ui-control-min-block-size);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
145
190
|
@media (prefers-reduced-motion: reduce) {
|
|
191
|
+
:scope[data-ui-disclosure-state~="fill"],
|
|
146
192
|
.panel,
|
|
147
|
-
.
|
|
193
|
+
.indicator {
|
|
148
194
|
transition: none;
|
|
149
195
|
}
|
|
150
196
|
}
|
|
@@ -164,6 +210,8 @@
|
|
|
164
210
|
|
|
165
211
|
/* A bounded accordion owns one flexible body, so its trigger never scrolls away. The
|
|
166
212
|
* normal content-sized layout and its animation remain unchanged when fill is omitted. */
|
|
213
|
+
@media (pointer: coarse) {
|
|
214
|
+
}
|
|
167
215
|
|
|
168
216
|
@media (prefers-reduced-motion: reduce) {
|
|
169
217
|
}
|
package/styles/ui-nav-item.css
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
box-sizing: border-box;
|
|
30
30
|
display: flex;
|
|
31
31
|
align-items: center;
|
|
32
|
-
gap: var(--ui-
|
|
32
|
+
gap: var(--ui-nav-gap);
|
|
33
33
|
inline-size: var(--ui-nav-item-inline-size, 100%);
|
|
34
34
|
min-inline-size: 0;
|
|
35
|
-
min-block-size: var(--ui-
|
|
35
|
+
min-block-size: var(--ui-nav-min-block-size);
|
|
36
36
|
margin: 0;
|
|
37
|
-
padding-block: var(--ui-
|
|
38
|
-
padding-inline: var(--ui-
|
|
37
|
+
padding-block: var(--ui-nav-padding-block);
|
|
38
|
+
padding-inline: var(--ui-nav-padding-inline);
|
|
39
39
|
border: 0;
|
|
40
40
|
border-radius: var(--ui-selection-radius);
|
|
41
41
|
background: transparent;
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
:scope:hover:not([aria-current]) {
|
|
53
|
-
background: var(--ui-
|
|
53
|
+
background: var(--ui-nav-hover-surface);
|
|
54
54
|
color: var(--ui-text-primary);
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -99,12 +99,15 @@
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.leading
|
|
102
|
+
.leading,
|
|
103
|
+
.trailing {
|
|
103
104
|
display: inline-flex;
|
|
104
105
|
flex: none;
|
|
105
106
|
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
inline-size: var(--ui-nav-icon-size);
|
|
106
109
|
color: inherit;
|
|
107
|
-
font-size: var(--ui-
|
|
110
|
+
font-size: var(--ui-nav-icon-size);
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
.content {
|
|
@@ -137,11 +140,10 @@
|
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
:scope[data-ui-nav-item-state~="density=compact"] {
|
|
140
|
-
min-block-size: var(--ui-
|
|
141
|
-
padding-block: var(--ui-
|
|
142
|
-
padding-inline: var(--ui-
|
|
143
|
+
min-block-size: var(--ui-nav-compact-min-block-size);
|
|
144
|
+
padding-block: var(--ui-nav-compact-padding-block);
|
|
145
|
+
padding-inline: var(--ui-nav-compact-padding-inline);
|
|
143
146
|
}
|
|
144
|
-
:scope[data-ui-nav-item-state~="density=compact"] .leading,
|
|
145
147
|
:scope[data-ui-nav-item-state~="density=compact"] .label {
|
|
146
148
|
font-size: var(--ui-font-size-sm);
|
|
147
149
|
}
|
|
@@ -154,6 +156,7 @@
|
|
|
154
156
|
|
|
155
157
|
/* An unused region takes no space. */
|
|
156
158
|
.leading:empty,
|
|
159
|
+
.trailing:empty,
|
|
157
160
|
.description:empty {
|
|
158
161
|
display: none;
|
|
159
162
|
}
|
package/styles/ui-sidebar.css
CHANGED
|
@@ -15,12 +15,17 @@
|
|
|
15
15
|
syntax: "*";
|
|
16
16
|
inherits: false;
|
|
17
17
|
}
|
|
18
|
+
@property --ui-sidebar-collapsed-width {
|
|
19
|
+
syntax: "*";
|
|
20
|
+
inherits: false;
|
|
21
|
+
}
|
|
18
22
|
@scope ([data-component~="ui-sidebar"]) to ([data-component], [data-slotted]) {
|
|
19
23
|
/* This component's hooks style the element they are set on, and never a nested one. */
|
|
20
24
|
|
|
21
25
|
:scope {
|
|
22
26
|
/* Hooks do not inherit, so the parts below read them from the root. */
|
|
23
27
|
--_ui-sidebar-backdrop: var(--ui-sidebar-backdrop);
|
|
28
|
+
--_ui-sidebar-expanded-width: var(--_sidebar-width, var(--ui-sidebar-width, 280px));
|
|
24
29
|
|
|
25
30
|
position: relative;
|
|
26
31
|
box-sizing: border-box;
|
|
@@ -32,6 +37,7 @@
|
|
|
32
37
|
min-block-size: 0;
|
|
33
38
|
background: var(--ui-sidebar-surface, var(--ui-surface-default));
|
|
34
39
|
border-inline-end: var(--ui-border-width) solid var(--ui-sidebar-border, var(--ui-border-divider));
|
|
40
|
+
transition: inline-size var(--ui-motion-layout) var(--ui-motion-layout-ease), visibility var(--ui-motion-layout);
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
:scope[data-ui-sidebar-state~="side=end"] {
|
|
@@ -41,10 +47,17 @@
|
|
|
41
47
|
|
|
42
48
|
/* The panel's content scrolls, and each edge that hides content fades: the scroll fade every
|
|
43
49
|
Looma scroller uses (see ui-scroll-area). */
|
|
44
|
-
.
|
|
50
|
+
.viewport {
|
|
45
51
|
flex: 1;
|
|
46
52
|
min-block-size: 0;
|
|
53
|
+
overflow: clip;
|
|
54
|
+
}
|
|
55
|
+
.content {
|
|
56
|
+
block-size: 100%;
|
|
57
|
+
inline-size: calc(var(--_ui-sidebar-expanded-width) - var(--ui-border-width));
|
|
58
|
+
min-block-size: 0;
|
|
47
59
|
overflow: auto;
|
|
60
|
+
transition: transform var(--ui-motion-layout) var(--ui-motion-layout-ease);
|
|
48
61
|
--_ui-scroll-fade-direction: to bottom;
|
|
49
62
|
--_ui-scroll-fade-size: var(--ui-scroll-fade-size, 24px);
|
|
50
63
|
mask-image: linear-gradient(
|
|
@@ -65,7 +78,17 @@
|
|
|
65
78
|
|
|
66
79
|
/* Collapsed while docked. */
|
|
67
80
|
:scope[data-ui-sidebar-state~="internalCollapsed"]:not([popover]) {
|
|
68
|
-
|
|
81
|
+
inline-size: var(--ui-sidebar-collapsed-width, 0px);
|
|
82
|
+
visibility: hidden;
|
|
83
|
+
}
|
|
84
|
+
:scope[data-ui-sidebar-state~="resizing"] {
|
|
85
|
+
transition: none;
|
|
86
|
+
}
|
|
87
|
+
:scope[data-ui-sidebar-state~="internalCollapsed"]:not([popover]) .content {
|
|
88
|
+
transform: translateX(-100%);
|
|
89
|
+
}
|
|
90
|
+
:scope[data-ui-sidebar-state~="side=end"][data-ui-sidebar-state~="internalCollapsed"]:not([popover]) .content {
|
|
91
|
+
transform: translateX(100%);
|
|
69
92
|
}
|
|
70
93
|
|
|
71
94
|
.resizer {
|
|
@@ -144,9 +167,9 @@
|
|
|
144
167
|
box-shadow: var(--ui-elevation-overlay, var(--ui-shadow-lg));
|
|
145
168
|
transform: translateX(0);
|
|
146
169
|
transition:
|
|
147
|
-
transform var(--ui-motion-
|
|
148
|
-
display var(--ui-motion-
|
|
149
|
-
overlay var(--ui-motion-
|
|
170
|
+
transform var(--ui-motion-reveal) var(--ui-motion-reveal-ease),
|
|
171
|
+
display var(--ui-motion-reveal) allow-discrete,
|
|
172
|
+
overlay var(--ui-motion-reveal) allow-discrete;
|
|
150
173
|
}
|
|
151
174
|
|
|
152
175
|
/* The author display above would otherwise override the UA rule that hides a closed popover. */
|
|
@@ -176,9 +199,14 @@
|
|
|
176
199
|
:scope[popover]::backdrop {
|
|
177
200
|
background: var(--_ui-sidebar-backdrop, rgb(0 0 0 / 0.32));
|
|
178
201
|
}
|
|
202
|
+
:scope[popover] .content {
|
|
203
|
+
inline-size: 100%;
|
|
204
|
+
}
|
|
179
205
|
|
|
180
206
|
@media (prefers-reduced-motion: reduce) {
|
|
181
|
-
:scope
|
|
207
|
+
:scope,
|
|
208
|
+
:scope[popover],
|
|
209
|
+
.content {
|
|
182
210
|
transition: none;
|
|
183
211
|
}
|
|
184
212
|
}
|
package/tokens.css
CHANGED
|
@@ -128,6 +128,12 @@
|
|
|
128
128
|
--ui-pressed: inset 0 1px 2px rgb(0 0 0 / 0.12);
|
|
129
129
|
|
|
130
130
|
--ui-motion-base: calc(var(--ui-motion-fast) * 1.5);
|
|
131
|
+
--ui-motion-feedback: var(--ui-motion-fast);
|
|
132
|
+
--ui-motion-reveal: var(--ui-motion-base);
|
|
133
|
+
--ui-motion-layout: calc(var(--ui-motion-base) * 1.5);
|
|
134
|
+
--ui-motion-feedback-ease: var(--ui-motion-ease);
|
|
135
|
+
--ui-motion-reveal-ease: var(--ui-motion-ease-out);
|
|
136
|
+
--ui-motion-layout-ease: var(--ui-motion-ease-out);
|
|
131
137
|
/* Fast start, gentle settle: for reveals that should feel immediate. */
|
|
132
138
|
--ui-motion-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
133
139
|
|
|
@@ -180,6 +186,15 @@
|
|
|
180
186
|
--ui-selection-surface: color-mix(in oklab, var(--ui-accent) 6%, var(--ui-surface));
|
|
181
187
|
--ui-selection-text: var(--ui-accent-subtle-text);
|
|
182
188
|
--ui-selection-radius: var(--ui-radius-md);
|
|
189
|
+
--ui-nav-icon-size: var(--ui-font-size-md);
|
|
190
|
+
--ui-nav-gap: var(--ui-space-3);
|
|
191
|
+
--ui-nav-padding-inline: var(--ui-space-3);
|
|
192
|
+
--ui-nav-padding-block: var(--ui-space-2);
|
|
193
|
+
--ui-nav-min-block-size: var(--ui-control-size);
|
|
194
|
+
--ui-nav-compact-padding-inline: var(--ui-space-2);
|
|
195
|
+
--ui-nav-compact-padding-block: var(--ui-space-1);
|
|
196
|
+
--ui-nav-compact-min-block-size: var(--ui-control-size-sm);
|
|
197
|
+
--ui-nav-hover-surface: var(--ui-surface-hover);
|
|
183
198
|
|
|
184
199
|
--ui-accent-soft: var(--ui-accent-subtle);
|
|
185
200
|
--ui-accent-contrast: var(--ui-on-accent);
|
package/vanilla/UiBadge.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface UiBadgeElement extends HTMLSpanElement {
|
|
|
6
6
|
removeEventListener<K extends keyof UiBadgeEventMap>(type: K, listener: (this: UiBadgeElement, event: UiBadgeEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
7
7
|
}
|
|
8
8
|
export interface UiBadgeProps {
|
|
9
|
-
shape?: "pill" | "tag" | "dot" | null;
|
|
9
|
+
shape?: "pill" | "tag" | "dot" | "square" | null;
|
|
10
10
|
size?: "xs" | "md" | null;
|
|
11
11
|
tone?: "neutral" | "accent" | "info" | "success" | "warning" | "danger" | null;
|
|
12
12
|
variant?: "solid" | "subtle" | "outline" | null;
|
package/vanilla/UiBadge.js
CHANGED
|
@@ -28,7 +28,7 @@ export function createUiBadge(options = {}) {
|
|
|
28
28
|
}
|
|
29
29
|
element.append(element0);
|
|
30
30
|
manageGeneratedProps(element, [
|
|
31
|
-
{ name: "shape", attribute: "data-shape", value: componentProps["shape"], default: "pill", type: ["pill","tag","dot"], required: false },
|
|
31
|
+
{ name: "shape", attribute: "data-shape", value: componentProps["shape"], default: "pill", type: ["pill","tag","dot","square"], required: false },
|
|
32
32
|
{ name: "size", attribute: "data-size", value: componentProps["size"], default: "md", type: ["xs","md"], required: false },
|
|
33
33
|
{ name: "tone", attribute: "data-tone", value: componentProps["tone"], default: "neutral", type: ["neutral","accent","info","success","warning","danger"], required: false },
|
|
34
34
|
{ name: "variant", attribute: "data-variant", value: componentProps["variant"], default: "subtle", type: ["solid","subtle","outline"], required: false },
|
|
@@ -14,7 +14,9 @@ export interface UiDisclosureProps {
|
|
|
14
14
|
headingLevel?: number | null;
|
|
15
15
|
name?: string | null;
|
|
16
16
|
open?: boolean | null;
|
|
17
|
+
requiredOpen?: boolean | null;
|
|
17
18
|
summary?: string | null;
|
|
19
|
+
variant?: "plain" | "navigation" | null;
|
|
18
20
|
attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
|
|
19
21
|
children?: readonly (string | Node)[];
|
|
20
22
|
slots?: Readonly<Record<string, readonly (string | Node)[]>>;
|
package/vanilla/UiDisclosure.js
CHANGED
|
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
|
|
|
3
3
|
import * as controller from "../components/ui-disclosure/ui-disclosure.js";
|
|
4
4
|
import "../styles/ui-disclosure.css";
|
|
5
5
|
|
|
6
|
-
const definition = {...{"contract":{"tag":"ui-disclosure","props":{"density":{"type":{"kind":"terminal","name":"keyword"},"values":["comfortable","compact"],"required":false,"target":{"attribute":"density"},"default":"comfortable"},"disabled":{"type":"boolean","required":false,"target":{"attribute":"disabled"},"default":false},"fill":{"type":"boolean","required":false,"target":{"attribute":"fill"},"default":false},"headingLevel":{"type":{"kind":"terminal","name":"integer"},"required":false,"target":{"attribute":"headinglevel"},"default":0},"name":{"type":"string","required":false,"target":{"attribute":"name"},"default":""},"open":{"type":"boolean","required":false,"target":{"attribute":"open"},"default":false},"summary":{"type":"string","required":false,"target":{"attribute":"summary"},"default":"Details"}}},"template":{"kind":"element","name":"div","attributes":[],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"heading"},{"kind":"attribute","name":"role","expression":"headingRole","expressionPlan":{"source":"headingRole","ast":{"kind":"id","name":"headingRole"},"dependencies":["headingRole"]}},{"kind":"attribute","name":"aria-level","expression":"headingAriaLevel","expressionPlan":{"source":"headingAriaLevel","ast":{"kind":"id","name":"headingAriaLevel"},"dependencies":["headingAriaLevel"]}}],"children":[{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"trigger"},{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"aria-controls","expression":"contentId","expressionPlan":{"source":"contentId","ast":{"kind":"id","name":"contentId"},"dependencies":["contentId"]}},{"kind":"attribute","name":"aria-expanded","expression":"internalOpen","expressionPlan":{"source":"internalOpen","ast":{"kind":"id","name":"internalOpen"},"dependencies":["internalOpen"]}},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"summary"}],"children":[{"kind":"slot","fallback":[{"kind":"element","name":"template","attributes":[{"kind":"directive","name":"value","expression":"summary","expressionPlan":{"source":"summary","ast":{"kind":"id","name":"summary"},"dependencies":["summary"]}}],"children":[]}],"name":"summary"}]},{"kind":"
|
|
6
|
+
const definition = {...{"contract":{"tag":"ui-disclosure","props":{"density":{"type":{"kind":"terminal","name":"keyword"},"values":["comfortable","compact"],"required":false,"target":{"attribute":"density"},"default":"comfortable"},"disabled":{"type":"boolean","required":false,"target":{"attribute":"disabled"},"default":false},"fill":{"type":"boolean","required":false,"target":{"attribute":"fill"},"default":false},"headingLevel":{"type":{"kind":"terminal","name":"integer"},"required":false,"target":{"attribute":"headinglevel"},"default":0},"name":{"type":"string","required":false,"target":{"attribute":"name"},"default":""},"open":{"type":"boolean","required":false,"target":{"attribute":"open"},"default":false},"requiredOpen":{"type":"boolean","required":false,"target":{"attribute":"requiredopen"},"default":false},"summary":{"type":"string","required":false,"target":{"attribute":"summary"},"default":"Details"},"variant":{"type":{"kind":"terminal","name":"keyword"},"values":["plain","navigation"],"required":false,"target":{"attribute":"variant"},"default":"plain"}}},"template":{"kind":"element","name":"div","attributes":[],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"heading"},{"kind":"attribute","name":"role","expression":"headingRole","expressionPlan":{"source":"headingRole","ast":{"kind":"id","name":"headingRole"},"dependencies":["headingRole"]}},{"kind":"attribute","name":"aria-level","expression":"headingAriaLevel","expressionPlan":{"source":"headingAriaLevel","ast":{"kind":"id","name":"headingAriaLevel"},"dependencies":["headingAriaLevel"]}}],"children":[{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"trigger"},{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"aria-controls","expression":"contentId","expressionPlan":{"source":"contentId","ast":{"kind":"id","name":"contentId"},"dependencies":["contentId"]}},{"kind":"attribute","name":"aria-expanded","expression":"internalOpen","expressionPlan":{"source":"internalOpen","ast":{"kind":"id","name":"internalOpen"},"dependencies":["internalOpen"]}},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"summary"}],"children":[{"kind":"slot","fallback":[{"kind":"element","name":"template","attributes":[{"kind":"directive","name":"value","expression":"summary","expressionPlan":{"source":"summary","ast":{"kind":"id","name":"summary"},"dependencies":["summary"]}}],"children":[]}],"name":"summary"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[{"kind":"slot","fallback":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"chevron"}],"children":[]}],"name":"indicator"}]}],"ref":"trigger"}],"ref":"heading"},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"panel"},{"kind":"attribute","name":"id","expression":"contentId","expressionPlan":{"source":"contentId","ast":{"kind":"id","name":"contentId"},"dependencies":["contentId"]}}],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"panel-inner"}],"children":[{"kind":"slot"}]}],"ref":"panel"}]},"declarations":[{"kind":"state","name":"internalOpen","type":"boolean","value":"false","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"contentId","type":"string","value":"","expression":{"source":"\"\"","ast":{"kind":"literal","value":""},"dependencies":[]}},{"kind":"state","name":"headingRole","type":"keyword"},{"kind":"state","name":"headingAriaLevel","type":"integer"},{"kind":"event","name":"open","type":"object","shape":{"kind":"object","fields":[{"name":"open","type":{"kind":"terminal","name":"boolean"},"optional":false},{"name":"reason","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["action","programmatic","light-dismiss","escape"]},"optional":false},{"name":"trigger","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["keyboard","pointer","programmatic"]},"optional":false}],"open":false},"bubbles":true,"composed":true,"cancelable":false},{"kind":"event","name":"close","type":"object","shape":{"kind":"object","fields":[{"name":"open","type":{"kind":"terminal","name":"boolean"},"optional":false},{"name":"reason","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["action","programmatic","light-dismiss","escape"]},"optional":false},{"name":"trigger","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["keyboard","pointer","programmatic"]},"optional":false}],"open":false},"bubbles":true,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"div","choices":["div"]}},source:{file:import.meta.url},css:""};
|
|
7
7
|
|
|
8
8
|
export function createUiDisclosure(options = {}) {
|
|
9
9
|
const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
@@ -23,49 +23,64 @@ export function createUiDisclosure(options = {}) {
|
|
|
23
23
|
if (value0 === true) element1.setAttribute("disabled", "");
|
|
24
24
|
else element1.removeAttribute("disabled");
|
|
25
25
|
const element2 = document.createElement("span");
|
|
26
|
-
element2.setAttribute("class", "
|
|
26
|
+
element2.setAttribute("class", "leading");
|
|
27
|
+
if (slots["leading"] ?? [].length > 0) {
|
|
28
|
+
for (const child of slots["leading"] ?? []) {
|
|
29
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
30
|
+
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
31
|
+
projected.push([node, "leading"]);
|
|
32
|
+
element2.append(node);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
}
|
|
36
|
+
element1.append(element2);
|
|
37
|
+
const element3 = document.createElement("span");
|
|
38
|
+
element3.setAttribute("class", "summary");
|
|
27
39
|
if (slots["summary"] ?? [].length > 0) {
|
|
28
40
|
for (const child of slots["summary"] ?? []) {
|
|
29
41
|
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
30
42
|
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
31
43
|
projected.push([node, "summary"]);
|
|
32
|
-
|
|
44
|
+
element3.append(node);
|
|
33
45
|
}
|
|
34
46
|
} else {
|
|
35
|
-
const
|
|
36
|
-
|
|
47
|
+
const element4 = document.createElement("template");
|
|
48
|
+
element3.append(element4);
|
|
37
49
|
}
|
|
38
|
-
element1.append(
|
|
50
|
+
element1.append(element3);
|
|
51
|
+
const element5 = document.createElement("span");
|
|
52
|
+
element5.setAttribute("class", "indicator");
|
|
53
|
+
element5.setAttribute("aria-hidden", "true");
|
|
39
54
|
if (slots["indicator"] ?? [].length > 0) {
|
|
40
55
|
for (const child of slots["indicator"] ?? []) {
|
|
41
56
|
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
42
57
|
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
43
58
|
projected.push([node, "indicator"]);
|
|
44
|
-
|
|
59
|
+
element5.append(node);
|
|
45
60
|
}
|
|
46
61
|
} else {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
element1.append(element4);
|
|
62
|
+
const element6 = document.createElement("span");
|
|
63
|
+
element6.setAttribute("class", "chevron");
|
|
64
|
+
element5.append(element6);
|
|
51
65
|
}
|
|
66
|
+
element1.append(element5);
|
|
52
67
|
element0.append(element1);
|
|
53
68
|
element.append(element0);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
69
|
+
const element7 = document.createElement("div");
|
|
70
|
+
element7.setAttribute("class", "panel");
|
|
71
|
+
const element8 = document.createElement("div");
|
|
72
|
+
element8.setAttribute("class", "panel-inner");
|
|
58
73
|
if (children.length > 0) {
|
|
59
74
|
for (const child of children) {
|
|
60
75
|
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
61
76
|
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
62
77
|
projected.push([node, ""]);
|
|
63
|
-
|
|
78
|
+
element8.append(node);
|
|
64
79
|
}
|
|
65
80
|
} else {
|
|
66
81
|
}
|
|
67
|
-
|
|
68
|
-
element.append(
|
|
82
|
+
element7.append(element8);
|
|
83
|
+
element.append(element7);
|
|
69
84
|
manageComponentLifecycle(element, definition, { props: componentProps, projected,
|
|
70
85
|
controller,
|
|
71
86
|
});
|