@wovenui/components 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +284 -2
- package/dist/components.json +4204 -0
- package/dist/llms-full.txt +2839 -0
- package/dist/wovenui-kit.css +5002 -0
- package/dist/wovenui-kit.css.map +1 -0
- package/dist/wovenui-kit.iife.js +532 -0
- package/dist/wovenui-kit.js +529 -0
- package/dist/wovenui-kit.min.css +2 -0
- package/dist/wovenui-kit.min.css.map +1 -0
- package/package.json +268 -4
- package/src/_close.scss +45 -0
- package/src/_helpers.scss +11 -0
- package/src/_kit.scss +124 -0
- package/src/_shared.scss +10 -0
- package/src/components/_accordion.scss +132 -0
- package/src/components/_alert.scss +161 -0
- package/src/components/_autocomplete.scss +129 -0
- package/src/components/_avatar-group.scss +80 -0
- package/src/components/_avatar.scss +134 -0
- package/src/components/_badge.scss +91 -0
- package/src/components/_breadcrumb.scss +115 -0
- package/src/components/_btn-group.scss +113 -0
- package/src/components/_button.scss +301 -0
- package/src/components/_card.scss +120 -0
- package/src/components/_checkbox.scss +168 -0
- package/src/components/_code-block.scss +78 -0
- package/src/components/_confirm-modal.scss +75 -0
- package/src/components/_data-table.scss +79 -0
- package/src/components/_desc-list.scss +180 -0
- package/src/components/_divider.scss +66 -0
- package/src/components/_dot.scss +115 -0
- package/src/components/_drawer.scss +200 -0
- package/src/components/_dropdown.scss +182 -0
- package/src/components/_empty-state.scss +146 -0
- package/src/components/_field-group.scss +68 -0
- package/src/components/_field-message.scss +75 -0
- package/src/components/_field.scss +127 -0
- package/src/components/_form-actions.scss +58 -0
- package/src/components/_info-row.scss +69 -0
- package/src/components/_input-group.scss +87 -0
- package/src/components/_input.scss +278 -0
- package/src/components/_list.scss +76 -0
- package/src/components/_modal.scss +168 -0
- package/src/components/_page-header.scss +85 -0
- package/src/components/_pagination.scss +138 -0
- package/src/components/_panel.scss +69 -0
- package/src/components/_popover.scss +154 -0
- package/src/components/_progress-circle.scss +123 -0
- package/src/components/_progress.scss +122 -0
- package/src/components/_radio.scss +162 -0
- package/src/components/_segmented.scss +183 -0
- package/src/components/_select.scss +154 -0
- package/src/components/_sidebar.scss +300 -0
- package/src/components/_skeleton.scss +90 -0
- package/src/components/_spinner.scss +84 -0
- package/src/components/_stat.scss +92 -0
- package/src/components/_table.scss +460 -0
- package/src/components/_tabs.scss +327 -0
- package/src/components/_tag.scss +143 -0
- package/src/components/_text.scss +42 -0
- package/src/components/_textarea.scss +57 -0
- package/src/components/_timeline.scss +196 -0
- package/src/components/_title.scss +41 -0
- package/src/components/_toast.scss +221 -0
- package/src/components/_toggle.scss +171 -0
- package/src/components/_toolbar.scss +74 -0
- package/src/components/_topbar.scss +204 -0
- package/src/entries/accordion.scss +4 -0
- package/src/entries/alert.scss +4 -0
- package/src/entries/autocomplete.scss +4 -0
- package/src/entries/avatar-group.scss +4 -0
- package/src/entries/avatar.scss +4 -0
- package/src/entries/badge.scss +4 -0
- package/src/entries/breadcrumb.scss +4 -0
- package/src/entries/btn-group.scss +4 -0
- package/src/entries/button.scss +4 -0
- package/src/entries/card.scss +4 -0
- package/src/entries/checkbox.scss +4 -0
- package/src/entries/code-block.scss +4 -0
- package/src/entries/confirm-modal.scss +4 -0
- package/src/entries/data-table.scss +4 -0
- package/src/entries/desc-list.scss +4 -0
- package/src/entries/divider.scss +4 -0
- package/src/entries/dot.scss +4 -0
- package/src/entries/drawer.scss +4 -0
- package/src/entries/dropdown.scss +4 -0
- package/src/entries/empty-state.scss +4 -0
- package/src/entries/field-group.scss +4 -0
- package/src/entries/field-message.scss +4 -0
- package/src/entries/field.scss +4 -0
- package/src/entries/form-actions.scss +4 -0
- package/src/entries/info-row.scss +4 -0
- package/src/entries/input-group.scss +4 -0
- package/src/entries/input.scss +4 -0
- package/src/entries/list.scss +4 -0
- package/src/entries/modal.scss +4 -0
- package/src/entries/page-header.scss +4 -0
- package/src/entries/pagination.scss +4 -0
- package/src/entries/panel.scss +4 -0
- package/src/entries/popover.scss +4 -0
- package/src/entries/progress-circle.scss +4 -0
- package/src/entries/progress.scss +4 -0
- package/src/entries/radio.scss +4 -0
- package/src/entries/segmented.scss +4 -0
- package/src/entries/select.scss +4 -0
- package/src/entries/sidebar.scss +4 -0
- package/src/entries/skeleton.scss +4 -0
- package/src/entries/spinner.scss +4 -0
- package/src/entries/stat.scss +4 -0
- package/src/entries/table.scss +4 -0
- package/src/entries/tabs.scss +4 -0
- package/src/entries/tag.scss +4 -0
- package/src/entries/text.scss +4 -0
- package/src/entries/textarea.scss +4 -0
- package/src/entries/timeline.scss +4 -0
- package/src/entries/title.scss +4 -0
- package/src/entries/toast.scss +4 -0
- package/src/entries/toggle.scss +4 -0
- package/src/entries/toolbar.scss +4 -0
- package/src/entries/topbar.scss +4 -0
- package/src/index.scss +7 -0
- package/src/js/autocomplete.js +86 -0
- package/src/js/data-table.js +141 -0
- package/src/js/index.js +34 -0
- package/src/js/input-clear.js +25 -0
- package/src/js/package.json +3 -0
- package/src/js/tabs.js +73 -0
- package/src/js/toast.js +161 -0
- package/src/js/util.js +21 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
////
|
|
2
|
+
//// @component wu-pagination
|
|
3
|
+
//// Page navigation made of button links, with optional total count and page size select.
|
|
4
|
+
////
|
|
5
|
+
//// Use a `nav` with an `aria-label`, and give an arrow-only previous or next link an `aria-label`. Mark the current link with `aria-current="page"`.
|
|
6
|
+
////
|
|
7
|
+
//// Put a `wu-pagination-total` and a `wu-pagination-size` label holding a `wu-select` beside the list.
|
|
8
|
+
////
|
|
9
|
+
//// @since 1.0.0
|
|
10
|
+
//// @needs button
|
|
11
|
+
//// @js none
|
|
12
|
+
//// @example html
|
|
13
|
+
//// <nav class="wu-pagination" aria-label="Pagination">
|
|
14
|
+
//// <ul class="wu-pagination-list">
|
|
15
|
+
//// <li><a class="wu-btn wu-pagination-prev" href="/orders?page=1" aria-label="Previous page"></a></li>
|
|
16
|
+
//// <li><a class="wu-btn" href="/orders?page=1">1</a></li>
|
|
17
|
+
//// <li><a class="wu-btn" href="/orders?page=2" aria-current="page">2</a></li>
|
|
18
|
+
//// <li><span class="wu-pagination-ellipsis">…</span></li>
|
|
19
|
+
//// <li><a class="wu-btn" href="/orders?page=9">9</a></li>
|
|
20
|
+
//// <li><a class="wu-btn wu-pagination-next" href="/orders?page=3" aria-label="Next page"></a></li>
|
|
21
|
+
//// </ul>
|
|
22
|
+
//// <span class="wu-pagination-total">Showing 11 to 20 of 86</span>
|
|
23
|
+
//// </nav>
|
|
24
|
+
//// @modifier sm | lg - Smaller or larger buttons and ellipsis @since 1.0.0
|
|
25
|
+
//// @part wu-pagination-list - List that holds the page links @since 1.0.0
|
|
26
|
+
//// @part wu-pagination-ellipsis - Gap marker between page numbers @since 1.0.0
|
|
27
|
+
//// @part wu-pagination-prev - On a link: draws a back arrow that follows the reading direction @since 1.0.0
|
|
28
|
+
//// @part wu-pagination-next - On a link: draws a forward arrow that follows the reading direction @since 1.0.0
|
|
29
|
+
//// @part wu-pagination-total - Muted total count text @since 1.0.0
|
|
30
|
+
//// @part wu-pagination-size - Label that holds a `wu-select` for the page size @since 1.0.0
|
|
31
|
+
//// @state aria-current="page" - The current page: solid brand fill @since 1.0.0
|
|
32
|
+
////
|
|
33
|
+
|
|
34
|
+
@use "@wovenui/core/mixins" as woven;
|
|
35
|
+
|
|
36
|
+
.wu-pagination {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-wrap: wrap;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: woven.token(space-2) woven.token(space-4);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.wu-pagination-list {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: woven.token(space-1);
|
|
48
|
+
margin: 0;
|
|
49
|
+
padding: 0;
|
|
50
|
+
list-style: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.wu-pagination .wu-btn {
|
|
54
|
+
min-width: woven.token(control-height-md);
|
|
55
|
+
padding-inline: woven.token(space-3);
|
|
56
|
+
font-variant-numeric: tabular-nums;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.wu-pagination .wu-btn[aria-current="page"] {
|
|
60
|
+
border-color: woven.token(brand);
|
|
61
|
+
background: woven.token(brand);
|
|
62
|
+
color: woven.token(text-on-brand);
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
border-color: woven.token(brand-hover);
|
|
66
|
+
background: woven.token(brand-hover);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.wu-pagination-ellipsis {
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
min-width: woven.token(control-height-md);
|
|
75
|
+
color: woven.token(text-muted);
|
|
76
|
+
font-size: woven.token(font-size-sm);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.wu-pagination.sm {
|
|
80
|
+
.wu-btn,
|
|
81
|
+
.wu-pagination-ellipsis {
|
|
82
|
+
min-width: woven.token(control-height-sm);
|
|
83
|
+
min-height: woven.token(control-height-sm);
|
|
84
|
+
padding-inline: woven.token(space-2);
|
|
85
|
+
font-size: woven.token(font-size-xs);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.wu-pagination.lg {
|
|
90
|
+
.wu-btn,
|
|
91
|
+
.wu-pagination-ellipsis {
|
|
92
|
+
min-width: woven.token(control-height-lg);
|
|
93
|
+
min-height: woven.token(control-height-lg);
|
|
94
|
+
font-size: woven.token(font-size-md);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Arrow: one corner shape, turned to point back or forward in the reading direction
|
|
99
|
+
.wu-pagination-prev::before,
|
|
100
|
+
.wu-pagination-next::after {
|
|
101
|
+
content: "";
|
|
102
|
+
flex: none;
|
|
103
|
+
width: 0.45em;
|
|
104
|
+
height: 0.45em;
|
|
105
|
+
border-bottom: woven.token(border-width-2) solid currentcolor;
|
|
106
|
+
border-left: woven.token(border-width-2) solid currentcolor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Points left (previous in LTR, next in RTL), then right; nudged away from the tip to look centered
|
|
110
|
+
.wu-pagination-prev::before,
|
|
111
|
+
.wu-pagination-next:dir(rtl)::after {
|
|
112
|
+
rotate: 45deg;
|
|
113
|
+
translate: 0.1em 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.wu-pagination-next::after,
|
|
117
|
+
.wu-pagination-prev:dir(rtl)::before {
|
|
118
|
+
rotate: -135deg;
|
|
119
|
+
translate: -0.1em 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.wu-pagination-total,
|
|
123
|
+
.wu-pagination-size {
|
|
124
|
+
color: woven.token(text-muted);
|
|
125
|
+
font-size: woven.token(font-size-sm);
|
|
126
|
+
font-variant-numeric: tabular-nums;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.wu-pagination-size {
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: woven.token(space-2);
|
|
134
|
+
|
|
135
|
+
> .wu-select {
|
|
136
|
+
inline-size: auto;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
////
|
|
2
|
+
//// @component wu-panel
|
|
3
|
+
//// Flat bordered region for grouped settings or data.
|
|
4
|
+
////
|
|
5
|
+
//// The card is the raised surface; the panel stays flat with a border.
|
|
6
|
+
////
|
|
7
|
+
//// @since 1.0.0
|
|
8
|
+
//// @needs none
|
|
9
|
+
//// @js none
|
|
10
|
+
//// @example html
|
|
11
|
+
//// <section class="wu-panel">
|
|
12
|
+
//// <header class="wu-panel-header">
|
|
13
|
+
//// <h2 class="wu-panel-title">Notifications</h2>
|
|
14
|
+
//// <button class="wu-btn sm" type="button">Edit</button>
|
|
15
|
+
//// </header>
|
|
16
|
+
//// <div class="wu-panel-body">Email me about new comments.</div>
|
|
17
|
+
//// <footer class="wu-panel-footer">
|
|
18
|
+
//// <button class="wu-btn brand" type="button">Save</button>
|
|
19
|
+
//// </footer>
|
|
20
|
+
//// </section>
|
|
21
|
+
//// @part wu-panel-header - Top row with a tinted background and bottom border @since 1.0.0
|
|
22
|
+
//// @part wu-panel-title - Panel heading @since 1.0.0
|
|
23
|
+
//// @part wu-panel-body - Content area @since 1.0.0
|
|
24
|
+
//// @part wu-panel-footer - Bottom row for actions, aligned to the inline end @since 1.0.0
|
|
25
|
+
//// @variable --wu-panel--Padding [1rem] - Inline padding of the header and footer, and padding of the body @since 1.0.0
|
|
26
|
+
////
|
|
27
|
+
|
|
28
|
+
@use "@wovenui/core/mixins" as woven;
|
|
29
|
+
|
|
30
|
+
.wu-panel {
|
|
31
|
+
border: woven.token(border-width-1) solid woven.token(border-regular);
|
|
32
|
+
border-radius: woven.token(radius-md);
|
|
33
|
+
background: woven.token(bg-surface);
|
|
34
|
+
color: woven.token(text-regular);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.wu-panel-header,
|
|
38
|
+
.wu-panel-footer {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-wrap: wrap;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: woven.token(space-2);
|
|
43
|
+
padding-block: woven.token(space-3);
|
|
44
|
+
padding-inline: var(--wu-panel--Padding, #{woven.token(space-4)});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.wu-panel-header {
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
border-block-end: woven.token(border-width-1) solid woven.token(border-regular);
|
|
50
|
+
border-start-start-radius: calc(#{woven.token(radius-md)} - #{woven.token(border-width-1)});
|
|
51
|
+
border-start-end-radius: calc(#{woven.token(radius-md)} - #{woven.token(border-width-1)});
|
|
52
|
+
background: woven.token(bg-alternate);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.wu-panel-title {
|
|
56
|
+
margin: 0;
|
|
57
|
+
font-size: woven.token(font-size-sm);
|
|
58
|
+
font-weight: woven.token(font-weight-semibold);
|
|
59
|
+
line-height: woven.token(line-height-tight);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.wu-panel-body {
|
|
63
|
+
padding: var(--wu-panel--Padding, #{woven.token(space-4)});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.wu-panel-footer {
|
|
67
|
+
justify-content: flex-end;
|
|
68
|
+
border-block-start: woven.token(border-width-1) solid woven.token(border-regular);
|
|
69
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
////
|
|
2
|
+
//// @component wu-popover
|
|
3
|
+
//// Small floating panel built on the native `popover` attribute.
|
|
4
|
+
////
|
|
5
|
+
//// Esc and click outside close it. `commandfor` with `command="toggle-popover"` works as the trigger too.
|
|
6
|
+
////
|
|
7
|
+
//// Opens under its trigger where anchor positioning exists, and flips when there is no room. Elsewhere it is centered in the viewport. It has no arrow.
|
|
8
|
+
////
|
|
9
|
+
//// Placement follows the popover own direction, so it is right in an RTL section of an LTR page.
|
|
10
|
+
////
|
|
11
|
+
//// @since 1.0.0
|
|
12
|
+
//// @needs none
|
|
13
|
+
//// @js none
|
|
14
|
+
//// @example html
|
|
15
|
+
//// <button class="wu-btn" type="button" popovertarget="p1">Details</button>
|
|
16
|
+
//// <div class="wu-popover" id="p1" popover>
|
|
17
|
+
//// <h3 class="wu-popover-title">Title</h3>
|
|
18
|
+
//// <p>Short content.</p>
|
|
19
|
+
//// </div>
|
|
20
|
+
//// @example html
|
|
21
|
+
//// <button class="wu-btn" type="button" popovertarget="p2">Delete</button>
|
|
22
|
+
//// <div class="wu-popover" id="p2" popover>
|
|
23
|
+
//// <p>Delete this item?</p>
|
|
24
|
+
//// <div class="wu-popover-actions">
|
|
25
|
+
//// <button class="wu-btn sm" type="button" popovertarget="p2" popovertargetaction="hide">Cancel</button>
|
|
26
|
+
//// <button class="wu-btn danger sm" type="button" popovertarget="p2" popovertargetaction="hide">Delete</button>
|
|
27
|
+
//// </div>
|
|
28
|
+
//// </div>
|
|
29
|
+
//// @modifier animated - Fades and scales the popover in and out, growing away from the trigger, when the user allows motion; `wu-animated` on an ancestor does the same @since 1.0.0
|
|
30
|
+
//// @part wu-popover-title - Popover heading @since 1.0.0
|
|
31
|
+
//// @part wu-popover-actions - Button row at the inline end, for an inline confirm @since 1.0.0
|
|
32
|
+
//// @variable --wu-popover--MaxWidth [20rem] - Largest popover width @since 1.0.0
|
|
33
|
+
//// @state :popover-open - Fully visible during the animated transition @since 1.0.0
|
|
34
|
+
////
|
|
35
|
+
|
|
36
|
+
@use "@wovenui/core/mixins" as woven;
|
|
37
|
+
|
|
38
|
+
.wu-popover {
|
|
39
|
+
inset: 0;
|
|
40
|
+
inline-size: fit-content;
|
|
41
|
+
block-size: fit-content;
|
|
42
|
+
max-inline-size: var(--wu-popover--MaxWidth, 20rem);
|
|
43
|
+
margin: auto;
|
|
44
|
+
padding-block: woven.token(space-3);
|
|
45
|
+
padding-inline: woven.token(space-4);
|
|
46
|
+
border: woven.token(border-width-1) solid woven.token(border-regular);
|
|
47
|
+
border-radius: woven.token(radius-md);
|
|
48
|
+
background: woven.token(bg-raised);
|
|
49
|
+
color: woven.token(text-regular);
|
|
50
|
+
font-size: woven.token(font-size-sm);
|
|
51
|
+
line-height: woven.token(line-height-normal);
|
|
52
|
+
box-shadow: woven.token(shadow-lg);
|
|
53
|
+
z-index: woven.token(z-popover);
|
|
54
|
+
|
|
55
|
+
> :first-child {
|
|
56
|
+
margin-block-start: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
> :last-child {
|
|
60
|
+
margin-block-end: 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.wu-popover-title {
|
|
65
|
+
margin-block: 0 woven.token(space-1);
|
|
66
|
+
font-size: woven.token(font-size-sm);
|
|
67
|
+
font-weight: woven.token(font-weight-semibold);
|
|
68
|
+
line-height: woven.token(line-height-tight);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Buttons at the inline end, as in a dialog footer
|
|
72
|
+
.wu-popover-actions {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-wrap: wrap;
|
|
75
|
+
justify-content: flex-end;
|
|
76
|
+
gap: woven.token(space-2);
|
|
77
|
+
margin-block-start: woven.token(space-3);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Centered on the trigger; when that overflows, tries above (flip-block), then edge-aligned placements below and above
|
|
81
|
+
@position-try --wu-popover-below-start {
|
|
82
|
+
inset-inline: auto;
|
|
83
|
+
inset-inline-start: anchor(self-start);
|
|
84
|
+
justify-self: normal;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@position-try --wu-popover-below-end {
|
|
88
|
+
inset-inline: auto;
|
|
89
|
+
inset-inline-end: anchor(self-end);
|
|
90
|
+
justify-self: normal;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@supports (anchor-name: --x) {
|
|
94
|
+
.wu-popover {
|
|
95
|
+
position-anchor: auto;
|
|
96
|
+
inset: auto;
|
|
97
|
+
margin: 0;
|
|
98
|
+
margin-block: woven.token(space-2);
|
|
99
|
+
inline-size: max-content;
|
|
100
|
+
max-inline-size: min(var(--wu-popover--MaxWidth, 20rem), calc(100vw - 1rem));
|
|
101
|
+
inset-block-start: anchor(end);
|
|
102
|
+
|
|
103
|
+
// A viewport-clipped box centered on the trigger: safe centering keeps it on screen in every engine
|
|
104
|
+
inset-inline: max(0px, calc(2 * anchor(center) - 100%));
|
|
105
|
+
justify-self: center;
|
|
106
|
+
position-try-fallbacks:
|
|
107
|
+
flip-block,
|
|
108
|
+
--wu-popover-below-start,
|
|
109
|
+
--wu-popover-below-end,
|
|
110
|
+
--wu-popover-below-start flip-block,
|
|
111
|
+
--wu-popover-below-end flip-block;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Opt-in motion: the panel fades and scales in and out. Anchored, it also grows away from the trigger
|
|
116
|
+
// through the trigger-side margin, which flip-block mirrors when the panel opens above.
|
|
117
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
118
|
+
.wu-popover.animated,
|
|
119
|
+
.wu-animated .wu-popover {
|
|
120
|
+
opacity: 0;
|
|
121
|
+
scale: 0.96;
|
|
122
|
+
transition:
|
|
123
|
+
opacity woven.token(duration-150) woven.token(ease-out),
|
|
124
|
+
scale woven.token(duration-150) woven.token(ease-out),
|
|
125
|
+
margin woven.token(duration-150) woven.token(ease-out),
|
|
126
|
+
display woven.token(duration-150) allow-discrete,
|
|
127
|
+
overlay woven.token(duration-150) allow-discrete;
|
|
128
|
+
|
|
129
|
+
&:popover-open {
|
|
130
|
+
opacity: 1;
|
|
131
|
+
scale: 1;
|
|
132
|
+
|
|
133
|
+
@starting-style {
|
|
134
|
+
opacity: 0;
|
|
135
|
+
scale: 0.96;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@supports (anchor-name: --x) {
|
|
141
|
+
.wu-popover.animated,
|
|
142
|
+
.wu-animated .wu-popover {
|
|
143
|
+
margin-block-start: woven.token(space-1);
|
|
144
|
+
|
|
145
|
+
&:popover-open {
|
|
146
|
+
margin-block-start: woven.token(space-2);
|
|
147
|
+
|
|
148
|
+
@starting-style {
|
|
149
|
+
margin-block-start: woven.token(space-1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
////
|
|
2
|
+
//// @component wu-progress-circle
|
|
3
|
+
//// Circular progress ring that shows a percentage.
|
|
4
|
+
////
|
|
5
|
+
//// It is not a native element, so name the role and value: `role="progressbar"` with `aria-label`, `aria-valuenow`, `aria-valuemin` and `aria-valuemax`.
|
|
6
|
+
////
|
|
7
|
+
//// The value is a percentage from 0 to 100, set with `--wu-progress-circle--Value`. The ring color is `currentcolor`, so roles and `color` set it.
|
|
8
|
+
////
|
|
9
|
+
//// @since 1.0.0
|
|
10
|
+
//// @needs none
|
|
11
|
+
//// @js none
|
|
12
|
+
//// @example html
|
|
13
|
+
//// <div class="wu-progress-circle" role="progressbar" aria-label="Upload" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100" style="--wu-progress-circle--Value: 72">
|
|
14
|
+
//// <span class="wu-progress-circle-label">72%</span>
|
|
15
|
+
//// </div>
|
|
16
|
+
//// @example html
|
|
17
|
+
//// <div class="wu-progress-circle success lg animated" role="progressbar" aria-label="Storage" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="--wu-progress-circle--Value: 40">
|
|
18
|
+
//// <span class="wu-progress-circle-label">40%</span>
|
|
19
|
+
//// </div>
|
|
20
|
+
//// @modifier success | danger | warning | info - Role color for the ring @since 1.0.0
|
|
21
|
+
//// @modifier sm | lg - Smaller (2.5rem) or larger (6rem) ring with a thinner or thicker band @since 1.0.0
|
|
22
|
+
//// @modifier animated - The ring eases to each new value when the user allows motion; `wu-animated` on an ancestor does the same @since 1.0.0
|
|
23
|
+
//// @part wu-progress-circle-label - Text centered in the ring @since 1.0.0
|
|
24
|
+
//// @variable --wu-progress-circle--Value [0] - Percentage from 0 to 100; a registered property, so it can transition @since 1.0.0
|
|
25
|
+
//// @variable --wu-progress-circle--Size [4rem] - Width and height of the ring @since 1.0.0
|
|
26
|
+
//// @variable --wu-progress-circle--Thickness [0.5rem] - Width of the ring band @since 1.0.0
|
|
27
|
+
////
|
|
28
|
+
|
|
29
|
+
@use "@wovenui/core/mixins" as woven;
|
|
30
|
+
|
|
31
|
+
$roles: "success", "danger", "warning", "info";
|
|
32
|
+
|
|
33
|
+
// Ring mask: transparent center, opaque band of the given thickness
|
|
34
|
+
@function ring($space) {
|
|
35
|
+
$t: var(--wu-progress-circle--Thickness, #{woven.token($space)});
|
|
36
|
+
@return radial-gradient(farthest-side, transparent calc(100% - #{$t} - 0.5px), #000 calc(100% - #{$t}));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@property --wu-progress-circle--Value {
|
|
40
|
+
syntax: "<number>";
|
|
41
|
+
inherits: true;
|
|
42
|
+
initial-value: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Ring color is currentcolor; roles and `color` set it
|
|
46
|
+
.wu-progress-circle {
|
|
47
|
+
position: relative;
|
|
48
|
+
display: inline-grid;
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
place-items: center;
|
|
51
|
+
width: var(--wu-progress-circle--Size, #{woven.token(space-16)});
|
|
52
|
+
height: var(--wu-progress-circle--Size, #{woven.token(space-16)});
|
|
53
|
+
color: woven.token(brand);
|
|
54
|
+
font-size: woven.token(font-size-sm);
|
|
55
|
+
font-variant-numeric: tabular-nums;
|
|
56
|
+
font-weight: woven.token(font-weight-semibold);
|
|
57
|
+
line-height: 1;
|
|
58
|
+
vertical-align: middle;
|
|
59
|
+
|
|
60
|
+
// Conic fill over the track, masked to a ring
|
|
61
|
+
&::before {
|
|
62
|
+
content: "";
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset: 0;
|
|
65
|
+
border-radius: woven.token(radius-full);
|
|
66
|
+
background: conic-gradient(currentcolor calc(var(--wu-progress-circle--Value, 0) * 1%), transparent 0) woven.token(border-regular);
|
|
67
|
+
mask: ring(space-2);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.wu-progress-circle-label {
|
|
72
|
+
position: relative;
|
|
73
|
+
color: woven.token(text-regular);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@each $role in $roles {
|
|
77
|
+
.wu-progress-circle.#{$role} {
|
|
78
|
+
color: woven.token($role);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.wu-progress-circle.sm {
|
|
83
|
+
width: var(--wu-progress-circle--Size, #{woven.token(space-10)});
|
|
84
|
+
height: var(--wu-progress-circle--Size, #{woven.token(space-10)});
|
|
85
|
+
font-size: woven.token(font-size-xs);
|
|
86
|
+
|
|
87
|
+
&::before {
|
|
88
|
+
mask: ring(space-1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.wu-progress-circle.lg {
|
|
93
|
+
width: var(--wu-progress-circle--Size, #{woven.token(space-24)});
|
|
94
|
+
height: var(--wu-progress-circle--Size, #{woven.token(space-24)});
|
|
95
|
+
font-size: woven.token(font-size-lg);
|
|
96
|
+
|
|
97
|
+
&::before {
|
|
98
|
+
mask: ring(space-3);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (forced-colors: active) {
|
|
103
|
+
.wu-progress-circle {
|
|
104
|
+
color: Highlight;
|
|
105
|
+
forced-color-adjust: none;
|
|
106
|
+
|
|
107
|
+
&::before {
|
|
108
|
+
background-color: GrayText;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.wu-progress-circle-label {
|
|
113
|
+
color: CanvasText;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Opt-in motion: the ring eases to each new value
|
|
118
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
119
|
+
.wu-progress-circle.animated,
|
|
120
|
+
.wu-animated .wu-progress-circle {
|
|
121
|
+
transition: --wu-progress-circle--Value woven.token(duration-500) woven.token(ease-out);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
////
|
|
2
|
+
//// @component wu-progress
|
|
3
|
+
//// Horizontal progress bar on the native `progress` element.
|
|
4
|
+
////
|
|
5
|
+
//// Without a `value` attribute it is indeterminate and shows a sliding segment. Label it with a `label` element or `aria-label`.
|
|
6
|
+
////
|
|
7
|
+
//// The fill uses `currentcolor`, so roles and `color` set it.
|
|
8
|
+
////
|
|
9
|
+
//// @since 1.0.0
|
|
10
|
+
//// @needs none
|
|
11
|
+
//// @js none
|
|
12
|
+
//// @example html
|
|
13
|
+
//// <label class="wu-progress-label" for="upload"><span>Uploading</span><span>72%</span></label>
|
|
14
|
+
//// <progress class="wu-progress" id="upload" value="72" max="100"></progress>
|
|
15
|
+
//// @example html
|
|
16
|
+
//// <progress class="wu-progress success sm" value="40" max="100" aria-label="Storage used"></progress>
|
|
17
|
+
//// <progress class="wu-progress lg" aria-label="Loading"></progress>
|
|
18
|
+
//// @modifier success | danger | warning | info - Role color for the fill @since 1.0.0
|
|
19
|
+
//// @modifier sm | lg - Thinner (0.25rem) or thicker (0.75rem) bar @since 1.0.0
|
|
20
|
+
//// @part wu-progress-label - Row above the bar for a title and a value @since 1.0.0
|
|
21
|
+
//// @variable --wu-progress--Height [0.5rem] - Bar height @since 1.0.0
|
|
22
|
+
//// @state :indeterminate - No value: a segment slides across the track @since 1.0.0
|
|
23
|
+
////
|
|
24
|
+
|
|
25
|
+
@use "@wovenui/core/mixins" as woven;
|
|
26
|
+
|
|
27
|
+
$roles: "success", "danger", "warning", "info";
|
|
28
|
+
|
|
29
|
+
.wu-progress {
|
|
30
|
+
display: block;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: var(--wu-progress--Height, #{woven.token(space-2)});
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
border: 0;
|
|
35
|
+
border-radius: woven.token(radius-full);
|
|
36
|
+
background-color: woven.token(border-regular);
|
|
37
|
+
color: woven.token(brand);
|
|
38
|
+
vertical-align: middle;
|
|
39
|
+
appearance: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.wu-progress::-webkit-progress-bar {
|
|
43
|
+
border-radius: inherit;
|
|
44
|
+
background: transparent;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.wu-progress::-webkit-progress-value {
|
|
48
|
+
border-radius: inherit;
|
|
49
|
+
background: currentcolor;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.wu-progress::-moz-progress-bar {
|
|
53
|
+
border-radius: inherit;
|
|
54
|
+
background: currentcolor;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Indeterminate: a sliding segment on the track; the static frame keeps it centered
|
|
58
|
+
.wu-progress:indeterminate {
|
|
59
|
+
background-image: linear-gradient(currentcolor, currentcolor);
|
|
60
|
+
background-position: 50% 0;
|
|
61
|
+
background-repeat: no-repeat;
|
|
62
|
+
background-size: 40% 100%;
|
|
63
|
+
animation: wu-progress-slide 1.5s ease-in-out infinite;
|
|
64
|
+
|
|
65
|
+
// The slide follows the reading direction
|
|
66
|
+
&:dir(rtl) {
|
|
67
|
+
animation-direction: reverse;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.wu-progress:indeterminate::-webkit-progress-value {
|
|
72
|
+
background: transparent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.wu-progress:indeterminate::-moz-progress-bar {
|
|
76
|
+
background: transparent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@each $role in $roles {
|
|
80
|
+
.wu-progress.#{$role} {
|
|
81
|
+
color: woven.token($role);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.wu-progress.sm {
|
|
86
|
+
height: var(--wu-progress--Height, #{woven.token(space-1)});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.wu-progress.lg {
|
|
90
|
+
height: var(--wu-progress--Height, #{woven.token(space-3)});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// <label class="wu-progress-label" for="id"><span>Uploading</span><span>72%</span></label>
|
|
94
|
+
.wu-progress-label {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: baseline;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
gap: woven.token(space-2);
|
|
99
|
+
margin-block-end: woven.token(space-1);
|
|
100
|
+
color: woven.token(text-muted);
|
|
101
|
+
font-size: woven.token(font-size-sm);
|
|
102
|
+
font-variant-numeric: tabular-nums;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@media (forced-colors: active) {
|
|
106
|
+
.wu-progress {
|
|
107
|
+
border: woven.token(border-width-1) solid CanvasText;
|
|
108
|
+
background-color: Canvas;
|
|
109
|
+
color: Highlight;
|
|
110
|
+
forced-color-adjust: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@keyframes wu-progress-slide {
|
|
115
|
+
from {
|
|
116
|
+
background-position: -70% 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
to {
|
|
120
|
+
background-position: 170% 0;
|
|
121
|
+
}
|
|
122
|
+
}
|