@sveltia/ui 0.41.3 → 0.42.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/alert/alert.svelte +39 -31
- package/dist/components/alert/alert.svelte.d.ts +8 -0
- package/dist/components/alert/infobar.svelte +58 -46
- package/dist/components/alert/infobar.svelte.d.ts +8 -0
- package/dist/components/bottom-navigation/bottom-navigation.svelte +21 -15
- package/dist/components/button/button-group.svelte +10 -6
- package/dist/components/button/button-group.svelte.d.ts +8 -0
- package/dist/components/button/button.svelte +274 -175
- package/dist/components/button/floating-action-button-wrapper.svelte +23 -18
- package/dist/components/button/select-button-group.svelte +60 -41
- package/dist/components/button/select-button-group.svelte.d.ts +8 -0
- package/dist/components/button/split-button.svelte +25 -18
- package/dist/components/calendar/calendar.svelte +103 -80
- package/dist/components/checkbox/checkbox-group.svelte +25 -19
- package/dist/components/checkbox/checkbox-group.svelte.d.ts +8 -0
- package/dist/components/checkbox/checkbox.svelte +93 -65
- package/dist/components/checkbox/checkbox.svelte.d.ts +2 -2
- package/dist/components/dialog/dialog.svelte +105 -87
- package/dist/components/dialog/prompt-dialog.svelte +5 -3
- package/dist/components/disclosure/disclosure.svelte +34 -21
- package/dist/components/divider/divider.svelte +21 -14
- package/dist/components/divider/divider.svelte.d.ts +8 -0
- package/dist/components/divider/spacer.svelte +13 -8
- package/dist/components/drawer/drawer.svelte +343 -190
- package/dist/components/grid/grid-body.svelte +16 -14
- package/dist/components/grid/grid-cell.svelte +5 -3
- package/dist/components/grid/grid-col-header.svelte +5 -3
- package/dist/components/grid/grid-foot.svelte +5 -3
- package/dist/components/grid/grid-head.svelte +5 -3
- package/dist/components/grid/grid-row-header.svelte +6 -4
- package/dist/components/grid/grid-row.svelte +6 -4
- package/dist/components/grid/grid.svelte +21 -12
- package/dist/components/grid/grid.svelte.d.ts +8 -0
- package/dist/components/icon/icon.svelte +7 -5
- package/dist/components/listbox/listbox.svelte +81 -61
- package/dist/components/listbox/listbox.svelte.d.ts +8 -0
- package/dist/components/listbox/option-group.svelte +15 -11
- package/dist/components/listbox/option.svelte +54 -39
- package/dist/components/menu/menu-item-group.svelte +5 -3
- package/dist/components/menu/menu-item.svelte +67 -51
- package/dist/components/menu/menu.svelte +24 -17
- package/dist/components/menu/menu.svelte.d.ts +8 -0
- package/dist/components/progressbar/progressbar.svelte +27 -15
- package/dist/components/progressbar/progressbar.svelte.d.ts +8 -0
- package/dist/components/radio/radio-group.svelte +43 -31
- package/dist/components/radio/radio-group.svelte.d.ts +8 -0
- package/dist/components/radio/radio.svelte +81 -63
- package/dist/components/resizable-pane/resizable-handle.svelte +63 -48
- package/dist/components/resizable-pane/resizable-handle.svelte.d.ts +8 -0
- package/dist/components/resizable-pane/resizable-pane-group.svelte +18 -14
- package/dist/components/select/combobox.svelte +139 -113
- package/dist/components/select/select-tags.svelte +73 -57
- package/dist/components/slider/slider.svelte +94 -74
- package/dist/components/switch/switch.svelte +118 -81
- package/dist/components/switch/switch.svelte.d.ts +8 -0
- package/dist/components/table/table-body.svelte +16 -14
- package/dist/components/table/table-cell.svelte +5 -3
- package/dist/components/table/table-col-header.svelte +5 -3
- package/dist/components/table/table-foot.svelte +5 -3
- package/dist/components/table/table-head.svelte +5 -3
- package/dist/components/table/table-row-header.svelte +6 -4
- package/dist/components/table/table-row.svelte +6 -4
- package/dist/components/table/table.svelte +21 -13
- package/dist/components/table/table.svelte.d.ts +8 -0
- package/dist/components/tabs/tab-box.svelte +9 -6
- package/dist/components/tabs/tab-list.svelte +94 -73
- package/dist/components/tabs/tab-list.svelte.d.ts +8 -0
- package/dist/components/tabs/tab-panel.svelte +11 -7
- package/dist/components/tabs/tab-panels.svelte +19 -14
- package/dist/components/text-editor/code-editor.svelte +10 -7
- package/dist/components/text-editor/core.js +3 -0
- package/dist/components/text-editor/lexical-root.svelte +221 -160
- package/dist/components/text-editor/text-editor.svelte +25 -18
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +2 -1
- package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +44 -37
- package/dist/components/text-field/number-input.svelte +87 -68
- package/dist/components/text-field/password-input.svelte +52 -42
- package/dist/components/text-field/search-bar.svelte +64 -53
- package/dist/components/text-field/secret-input.svelte +61 -46
- package/dist/components/text-field/text-area.svelte +80 -68
- package/dist/components/text-field/text-input.svelte +139 -107
- package/dist/components/toast/toast.svelte +104 -89
- package/dist/components/toolbar/toolbar.svelte +73 -54
- package/dist/components/toolbar/toolbar.svelte.d.ts +8 -0
- package/dist/components/typography/truncated-text.svelte +9 -7
- package/dist/components/util/app-shell.svelte +40 -493
- package/dist/components/util/empty-state.svelte +13 -11
- package/dist/components/util/group.svelte +8 -3
- package/dist/components/util/group.svelte.d.ts +8 -0
- package/dist/components/util/modal.svelte +59 -48
- package/dist/components/util/popup.svelte +87 -67
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -4
- package/dist/locales/en.yaml +50 -3
- package/dist/locales/ja.yaml +49 -2
- package/dist/services/i18n.d.ts +6 -0
- package/dist/services/i18n.js +19 -14
- package/dist/typedefs.d.ts +5 -1
- package/dist/typedefs.js +2 -1
- package/package.json +23 -23
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* `<GridCell>`. An alias of the `aria-multiselectable` attribute.
|
|
19
19
|
* @property {boolean} [clickToSelect] Whether to select a row by clicking on it.
|
|
20
20
|
* @property {HTMLElement} [element] A reference to the wrapper element.
|
|
21
|
+
* @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
|
|
21
22
|
* @property {Snippet} [children] Primary slot content.
|
|
22
23
|
* @property {(event: CustomEvent) => void} [onChange] Custom `Change` event handler.
|
|
23
24
|
*/
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
class: className,
|
|
32
33
|
multiple = false,
|
|
33
34
|
clickToSelect = true,
|
|
35
|
+
ariaLabel = undefined,
|
|
34
36
|
children,
|
|
35
37
|
onChange,
|
|
36
38
|
...restProps
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
role="grid"
|
|
45
47
|
class="sui grid {className}"
|
|
46
48
|
aria-multiselectable={multiple}
|
|
49
|
+
aria-label={ariaLabel}
|
|
47
50
|
onChange={(/** @type {CustomEvent} */ event) => {
|
|
48
51
|
onChange?.(event);
|
|
49
52
|
}}
|
|
@@ -52,15 +55,21 @@
|
|
|
52
55
|
{@render children?.()}
|
|
53
56
|
</div>
|
|
54
57
|
|
|
55
|
-
<style
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
<style lang="scss">
|
|
59
|
+
.grid {
|
|
60
|
+
display: table;
|
|
61
|
+
margin: var(--sui-focus-ring-width);
|
|
62
|
+
width: calc(100% - var(--sui-focus-ring-width) * 2);
|
|
63
|
+
|
|
64
|
+
&.data {
|
|
65
|
+
border-collapse: collapse;
|
|
66
|
+
|
|
67
|
+
:global {
|
|
68
|
+
:is(.grid-col-header, .grid-row-header, .grid-cell) {
|
|
69
|
+
border: 1px solid var(--sui-secondary-border-color);
|
|
70
|
+
padding: 8px 8px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -26,6 +26,10 @@ declare const Grid: import("svelte").Component<{
|
|
|
26
26
|
* A reference to the wrapper element.
|
|
27
27
|
*/
|
|
28
28
|
element?: HTMLElement | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The `aria-label` attribute on the wrapper element.
|
|
31
|
+
*/
|
|
32
|
+
ariaLabel?: string | undefined;
|
|
29
33
|
/**
|
|
30
34
|
* Primary slot content.
|
|
31
35
|
*/
|
|
@@ -53,6 +57,10 @@ type Props = {
|
|
|
53
57
|
* A reference to the wrapper element.
|
|
54
58
|
*/
|
|
55
59
|
element?: HTMLElement | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The `aria-label` attribute on the wrapper element.
|
|
62
|
+
*/
|
|
63
|
+
ariaLabel?: string | undefined;
|
|
56
64
|
/**
|
|
57
65
|
* Primary slot content.
|
|
58
66
|
*/
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
* @property {boolean} [multiple] Whether to allow selecting more than one `<Option>`. An alias of
|
|
30
30
|
* the `aria-multiselectable` attribute.
|
|
31
31
|
* @property {string} [searchTerms] Search terms to be used to filter the items.
|
|
32
|
+
* @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
|
|
32
33
|
* @property {Snippet} [children] Primary slot content.
|
|
33
34
|
* @property {(event: CustomEvent) => void} [onChange] Custom `Change` event handler.
|
|
34
35
|
* @property {(event: CustomEvent) => void} [onFilter] Custom `Filter` event handler.
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
invalid = false,
|
|
48
49
|
multiple = false,
|
|
49
50
|
searchTerms = '',
|
|
51
|
+
ariaLabel = undefined,
|
|
50
52
|
children,
|
|
51
53
|
onFilter,
|
|
52
54
|
...restProps
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
aria-required={required}
|
|
73
75
|
aria-invalid={invalid}
|
|
74
76
|
aria-multiselectable={multiple}
|
|
77
|
+
aria-label={ariaLabel}
|
|
75
78
|
onFilter={(/** @type {CustomEvent} */ event) => {
|
|
76
79
|
const {
|
|
77
80
|
detail: { matched, total },
|
|
@@ -87,65 +90,82 @@
|
|
|
87
90
|
</div>
|
|
88
91
|
</div>
|
|
89
92
|
|
|
90
|
-
<style>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
93
|
+
<style lang="scss">
|
|
94
|
+
[role='listbox'] {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
margin: var(--sui-focus-ring-width);
|
|
98
|
+
border-width: var(--sui-listbox-border-width, 1px);
|
|
99
|
+
border-style: var(--sui-listbox-border-style, solid);
|
|
100
|
+
border-color: var(--sui-listbox-border-width, var(--sui-secondary-border-color));
|
|
101
|
+
border-radius: var(--sui-listbox-border-radius, 4px);
|
|
102
|
+
padding: var(--sui-listbox-padding, 4px);
|
|
103
|
+
min-width: var(--sui-listbox-min-width, calc(var(--sui-option-height) * 5));
|
|
104
|
+
color: var(--sui-listbox-foreground-color);
|
|
105
|
+
background-color: var(--sui-listbox-background-color);
|
|
106
|
+
font-family: var(--sui-control-font-family);
|
|
107
|
+
font-size: var(--sui-control-font-size);
|
|
108
|
+
line-height: var(--sui-control-line-height);
|
|
109
|
+
|
|
110
|
+
@media (pointer: coarse) {
|
|
111
|
+
gap: 8px 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:global {
|
|
115
|
+
[role='separator'] {
|
|
116
|
+
margin: 4px 0;
|
|
117
|
+
background-color: var(--sui-control-border-color);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&[aria-invalid='true'] {
|
|
122
|
+
border-color: var(--sui-error-border-color);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.tabs {
|
|
126
|
+
padding: 0;
|
|
127
|
+
border-block-start-width: 0;
|
|
128
|
+
border-block-end-width: 0;
|
|
129
|
+
border-inline-end-width: 1px;
|
|
130
|
+
border-inline-start-width: 0;
|
|
131
|
+
border-color: var(--sui-control-border-color);
|
|
132
|
+
|
|
133
|
+
:global {
|
|
134
|
+
.option button {
|
|
135
|
+
justify-content: flex-start;
|
|
136
|
+
border-width: 0;
|
|
137
|
+
border-inline-end-width: 2px;
|
|
138
|
+
border-color: transparent;
|
|
139
|
+
padding: 0 12px;
|
|
140
|
+
border-start-end-radius: 0;
|
|
141
|
+
border-end-end-radius: 0;
|
|
142
|
+
height: var(--sui-tab-medium-height);
|
|
143
|
+
|
|
144
|
+
&[aria-selected='true'] {
|
|
145
|
+
border-color: var(--sui-primary-accent-color-light);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.icon {
|
|
149
|
+
display: none;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&.in-combobox:focus-visible {
|
|
156
|
+
outline-color: transparent;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&.filtered {
|
|
160
|
+
:global {
|
|
161
|
+
[role='separator'] {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.inner {
|
|
169
|
+
display: contents;
|
|
109
170
|
}
|
|
110
|
-
|
|
111
|
-
[role=listbox] :global([role=separator]) {
|
|
112
|
-
margin: 4px 0;
|
|
113
|
-
background-color: var(--sui-control-border-color);
|
|
114
|
-
}
|
|
115
|
-
[role=listbox][aria-invalid=true] {
|
|
116
|
-
border-color: var(--sui-error-border-color);
|
|
117
|
-
}
|
|
118
|
-
[role=listbox].tabs {
|
|
119
|
-
padding: 0;
|
|
120
|
-
border-block-start-width: 0;
|
|
121
|
-
border-block-end-width: 0;
|
|
122
|
-
border-inline-end-width: 1px;
|
|
123
|
-
border-inline-start-width: 0;
|
|
124
|
-
border-color: var(--sui-control-border-color);
|
|
125
|
-
}
|
|
126
|
-
[role=listbox].tabs :global(.option) :global(button) {
|
|
127
|
-
justify-content: flex-start;
|
|
128
|
-
border-width: 0;
|
|
129
|
-
border-inline-end-width: 2px;
|
|
130
|
-
border-color: transparent;
|
|
131
|
-
padding: 0 12px;
|
|
132
|
-
border-start-end-radius: 0;
|
|
133
|
-
border-end-end-radius: 0;
|
|
134
|
-
height: var(--sui-tab-medium-height);
|
|
135
|
-
}
|
|
136
|
-
[role=listbox].tabs :global(.option) :global(button[aria-selected=true]) {
|
|
137
|
-
border-color: var(--sui-primary-accent-color-light);
|
|
138
|
-
}
|
|
139
|
-
[role=listbox].tabs :global(.option) :global(button) :global(.icon) {
|
|
140
|
-
display: none;
|
|
141
|
-
}
|
|
142
|
-
[role=listbox].in-combobox:focus-visible {
|
|
143
|
-
outline-color: transparent;
|
|
144
|
-
}
|
|
145
|
-
[role=listbox].filtered :global([role=separator]) {
|
|
146
|
-
display: none;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.inner {
|
|
150
|
-
display: contents;
|
|
151
|
-
}</style>
|
|
171
|
+
</style>
|
|
@@ -48,6 +48,10 @@ declare const Listbox: import("svelte").Component<import("../../typedefs").Keybo
|
|
|
48
48
|
* Search terms to be used to filter the items.
|
|
49
49
|
*/
|
|
50
50
|
searchTerms?: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The `aria-label` attribute on the wrapper element.
|
|
53
|
+
*/
|
|
54
|
+
ariaLabel?: string | undefined;
|
|
51
55
|
/**
|
|
52
56
|
* Primary slot content.
|
|
53
57
|
*/
|
|
@@ -100,6 +104,10 @@ type Props = {
|
|
|
100
104
|
* Search terms to be used to filter the items.
|
|
101
105
|
*/
|
|
102
106
|
searchTerms?: string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The `aria-label` attribute on the wrapper element.
|
|
109
|
+
*/
|
|
110
|
+
ariaLabel?: string | undefined;
|
|
103
111
|
/**
|
|
104
112
|
* Primary slot content.
|
|
105
113
|
*/
|
|
@@ -62,16 +62,20 @@
|
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
|
|
65
|
-
<style
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
<style lang="scss">
|
|
66
|
+
.option-group {
|
|
67
|
+
&:not(:first-child) {
|
|
68
|
+
margin: 12px 0 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
68
71
|
|
|
69
|
-
.label {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
72
|
+
.label {
|
|
73
|
+
margin: 8px;
|
|
74
|
+
color: var(--sui-secondary-foreground-color);
|
|
75
|
+
font-size: var(--sui-font-size-small);
|
|
76
|
+
}
|
|
74
77
|
|
|
75
|
-
.inner {
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
+
.inner {
|
|
79
|
+
display: contents;
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -84,42 +84,57 @@
|
|
|
84
84
|
</Button>
|
|
85
85
|
</div>
|
|
86
86
|
|
|
87
|
-
<style
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
87
|
+
<style lang="scss">
|
|
88
|
+
.option {
|
|
89
|
+
display: contents;
|
|
90
|
+
|
|
91
|
+
&:focus-visible {
|
|
92
|
+
outline-width: 0 !important;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:global {
|
|
96
|
+
&.wrap button {
|
|
97
|
+
white-space: normal;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
button {
|
|
101
|
+
flex: none;
|
|
102
|
+
display: flex;
|
|
103
|
+
gap: 4px;
|
|
104
|
+
margin: 0 !important;
|
|
105
|
+
border-radius: var(--sui-option-border-radius);
|
|
106
|
+
padding: var(--sui-option-padding);
|
|
107
|
+
width: 100%;
|
|
108
|
+
height: auto;
|
|
109
|
+
min-height: var(--sui-option-height);
|
|
110
|
+
|
|
111
|
+
&:active {
|
|
112
|
+
background-color: var(--sui-active-background-color);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&[aria-selected='true'] {
|
|
116
|
+
.icon.check {
|
|
117
|
+
color: var(--sui-primary-accent-color-text);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
* {
|
|
122
|
+
flex: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.label {
|
|
126
|
+
flex: auto;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:is(.focused, button:hover) {
|
|
131
|
+
color: var(--sui-highlight-foreground-color);
|
|
132
|
+
background-color: var(--sui-hover-background-color);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.icon.check {
|
|
136
|
+
margin: -2px;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -154,54 +154,70 @@
|
|
|
154
154
|
{/if}
|
|
155
155
|
</div>
|
|
156
156
|
|
|
157
|
-
<style
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
157
|
+
<style lang="scss">
|
|
158
|
+
.menuitem {
|
|
159
|
+
position: relative;
|
|
160
|
+
|
|
161
|
+
:global {
|
|
162
|
+
button {
|
|
163
|
+
display: flex;
|
|
164
|
+
gap: var(--sui-menuitem-gap, 4px);
|
|
165
|
+
align-items: var(--sui-menuitem-align-items, center);
|
|
166
|
+
border-radius: var(--sui-menuitem-border-radius, var(--sui-option-border-radius, 4px));
|
|
167
|
+
margin: 0 !important;
|
|
168
|
+
padding: var(--sui-menuitem-padding, 0 16px);
|
|
169
|
+
width: 100%;
|
|
170
|
+
min-width: var(--sui-menuitem-min-width, 160px);
|
|
171
|
+
height: var(--sui-menuitem-height, var(--sui-option-height));
|
|
172
|
+
color: var(--sui-menuitem-foreground-color, var(--sui-control-foreground-color, inherit));
|
|
173
|
+
background-color: var(--sui-menuitem-background-color, transparent);
|
|
174
|
+
font-size: var(--sui-menuitem-font-size, var(--sui-option-font-size));
|
|
175
|
+
font-weight: var(
|
|
176
|
+
--sui-menuitem-font-weight,
|
|
177
|
+
var(--sui-option-font-weight, var(--sui-font-weight-normal, normal))
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
&[aria-checked='true'] {
|
|
181
|
+
.icon {
|
|
182
|
+
color: var(--sui-primary-accent-color-text);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&:hover {
|
|
187
|
+
color: var(--sui-highlight-foreground-color);
|
|
188
|
+
background-color: var(--sui-hover-background-color);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&:active {
|
|
192
|
+
background-color: var(--sui-active-background-color);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&:hover > [role='menu'] {
|
|
197
|
+
opacity: 1;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
& > [role='menu'] {
|
|
201
|
+
position: absolute;
|
|
202
|
+
inset-block-start: 2px;
|
|
203
|
+
inset-block-end: auto;
|
|
204
|
+
inset-inline-start: calc(100% + 4px);
|
|
205
|
+
inset-inline-end: auto;
|
|
206
|
+
|
|
207
|
+
&:hover {
|
|
208
|
+
opacity: 1;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.content {
|
|
215
|
+
flex: auto;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.icon-outer {
|
|
219
|
+
flex: none;
|
|
220
|
+
width: 24px;
|
|
221
|
+
height: 24px;
|
|
222
|
+
}
|
|
223
|
+
</style>
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* attribute.
|
|
19
19
|
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
20
20
|
* attribute.
|
|
21
|
+
* @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
|
|
21
22
|
* @property {Snippet} [children] Primary slot content.
|
|
22
23
|
* @property {(event: CustomEvent) => void} [onChange] Custom `Change` event handler.
|
|
23
24
|
*/
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
class: className,
|
|
31
32
|
hidden = false,
|
|
32
33
|
disabled = false,
|
|
34
|
+
ariaLabel = undefined,
|
|
33
35
|
children,
|
|
34
36
|
onChange,
|
|
35
37
|
...restProps
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
{hidden}
|
|
45
47
|
aria-hidden={hidden}
|
|
46
48
|
aria-disabled={disabled}
|
|
49
|
+
aria-label={ariaLabel}
|
|
47
50
|
onChange={(/** @type {CustomEvent} */ event) => {
|
|
48
51
|
onChange?.(event);
|
|
49
52
|
}}
|
|
@@ -52,22 +55,26 @@
|
|
|
52
55
|
{@render children?.()}
|
|
53
56
|
</div>
|
|
54
57
|
|
|
55
|
-
<style
|
|
56
|
-
display: flex;
|
|
57
|
-
flex-direction: column;
|
|
58
|
-
margin: 0;
|
|
59
|
-
border-width: var(--sui-menu-border-width, 1px);
|
|
60
|
-
border-style: var(--sui-menu-border-style, solid);
|
|
61
|
-
border-color: var(--sui-menu-border-width, var(--sui-secondary-border-color));
|
|
62
|
-
border-radius: var(--sui-menu-border-radius, 4px);
|
|
63
|
-
padding: var(--sui-menu-padding, 4px);
|
|
64
|
-
}
|
|
65
|
-
@media (pointer: coarse) {
|
|
58
|
+
<style lang="scss">
|
|
66
59
|
.menu {
|
|
67
|
-
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
margin: 0;
|
|
63
|
+
border-width: var(--sui-menu-border-width, 1px);
|
|
64
|
+
border-style: var(--sui-menu-border-style, solid);
|
|
65
|
+
border-color: var(--sui-menu-border-width, var(--sui-secondary-border-color));
|
|
66
|
+
border-radius: var(--sui-menu-border-radius, 4px);
|
|
67
|
+
padding: var(--sui-menu-padding, 4px);
|
|
68
|
+
|
|
69
|
+
@media (pointer: coarse) {
|
|
70
|
+
gap: 8px 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:global {
|
|
74
|
+
[role='separator'] {
|
|
75
|
+
margin: var(--sui-menu-divider-margin, 4px);
|
|
76
|
+
background-color: var(--sui-menu-divider-color, var(--sui-control-border-color));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
68
79
|
}
|
|
69
|
-
|
|
70
|
-
.menu :global([role=separator]) {
|
|
71
|
-
margin: var(--sui-menu-divider-margin, 4px);
|
|
72
|
-
background-color: var(--sui-menu-divider-color, var(--sui-control-border-color));
|
|
73
|
-
}</style>
|
|
80
|
+
</style>
|
|
@@ -23,6 +23,10 @@ declare const Menu: import("svelte").Component<{
|
|
|
23
23
|
* attribute.
|
|
24
24
|
*/
|
|
25
25
|
disabled?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The `aria-label` attribute on the wrapper element.
|
|
28
|
+
*/
|
|
29
|
+
ariaLabel?: string | undefined;
|
|
26
30
|
/**
|
|
27
31
|
* Primary slot content.
|
|
28
32
|
*/
|
|
@@ -47,6 +51,10 @@ type Props = {
|
|
|
47
51
|
* attribute.
|
|
48
52
|
*/
|
|
49
53
|
disabled?: boolean | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The `aria-label` attribute on the wrapper element.
|
|
56
|
+
*/
|
|
57
|
+
ariaLabel?: string | undefined;
|
|
50
58
|
/**
|
|
51
59
|
* Primary slot content.
|
|
52
60
|
*/
|