@sveltia/ui 0.6.6 → 0.7.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/package/components/button/button.svelte +109 -75
- package/package/components/button/button.svelte.d.ts +45 -18
- package/package/components/button/select-button-group.svelte +51 -30
- package/package/components/button/select-button-group.svelte.d.ts +12 -8
- package/package/components/button/select-button.svelte +50 -2
- package/package/components/button/select-button.svelte.d.ts +16 -0
- package/package/components/calendar/calendar.svelte +5 -3
- package/package/components/checkbox/checkbox-group.svelte +28 -10
- package/package/components/checkbox/checkbox-group.svelte.d.ts +4 -2
- package/package/components/checkbox/checkbox.svelte +114 -71
- package/package/components/checkbox/checkbox.svelte.d.ts +13 -7
- package/package/components/dialog/dialog.svelte +36 -16
- package/package/components/dialog/dialog.svelte.d.ts +0 -4
- package/package/components/disclosure/disclosure.svelte +48 -21
- package/package/components/disclosure/disclosure.svelte.d.ts +19 -0
- package/package/components/divider/divider.svelte +14 -6
- package/package/components/divider/divider.svelte.d.ts +3 -1
- package/package/components/divider/spacer.svelte +17 -5
- package/package/components/divider/spacer.svelte.d.ts +2 -0
- package/package/components/drawer/drawer.svelte +12 -5
- package/package/components/listbox/listbox.svelte +55 -20
- package/package/components/listbox/listbox.svelte.d.ts +12 -13
- package/package/components/listbox/option-group.svelte +22 -5
- package/package/components/listbox/option-group.svelte.d.ts +4 -0
- package/package/components/listbox/option.svelte +41 -14
- package/package/components/listbox/option.svelte.d.ts +9 -3
- package/package/components/menu/menu-button.svelte +51 -5
- package/package/components/menu/menu-button.svelte.d.ts +15 -0
- package/package/components/menu/menu-item-checkbox.svelte +41 -2
- package/package/components/menu/menu-item-checkbox.svelte.d.ts +14 -0
- package/package/components/menu/menu-item-group.svelte +26 -9
- package/package/components/menu/menu-item-group.svelte.d.ts +4 -2
- package/package/components/menu/menu-item-radio.svelte +47 -3
- package/package/components/menu/menu-item-radio.svelte.d.ts +14 -0
- package/package/components/menu/menu-item.svelte +48 -21
- package/package/components/menu/menu-item.svelte.d.ts +10 -4
- package/package/components/menu/menu.svelte +17 -9
- package/package/components/menu/menu.svelte.d.ts +8 -8
- package/package/components/radio/radio-group.svelte +50 -11
- package/package/components/radio/radio-group.svelte.d.ts +13 -5
- package/package/components/radio/radio.svelte +76 -45
- package/package/components/radio/radio.svelte.d.ts +11 -5
- package/package/components/select/combobox.svelte +58 -28
- package/package/components/select/combobox.svelte.d.ts +8 -2
- package/package/components/select/select.svelte +31 -6
- package/package/components/select/select.svelte.d.ts +10 -2
- package/package/components/slider/slider.svelte +158 -70
- package/package/components/slider/slider.svelte.d.ts +12 -4
- package/package/components/switch/switch.svelte +71 -29
- package/package/components/switch/switch.svelte.d.ts +11 -3
- package/package/components/table/table-row-header.svelte +1 -0
- package/package/components/table/table-row.svelte +16 -3
- package/package/components/table/table-row.svelte.d.ts +4 -0
- package/package/components/table/table.svelte +2 -1
- package/package/components/table/table.svelte.d.ts +4 -0
- package/package/components/tabs/tab-list.svelte +33 -16
- package/package/components/tabs/tab-list.svelte.d.ts +8 -18
- package/package/components/tabs/tab-panel.svelte +1 -2
- package/package/components/tabs/tab.svelte +25 -3
- package/package/components/tabs/tab.svelte.d.ts +10 -0
- package/package/components/text-field/markdown-editor.svelte +54 -22
- package/package/components/text-field/markdown-editor.svelte.d.ts +11 -1
- package/package/components/text-field/number-input.svelte +66 -15
- package/package/components/text-field/number-input.svelte.d.ts +13 -5
- package/package/components/text-field/password-input.svelte +42 -9
- package/package/components/text-field/password-input.svelte.d.ts +11 -1
- package/package/components/text-field/search-bar.svelte +67 -17
- package/package/components/text-field/search-bar.svelte.d.ts +26 -1
- package/package/components/text-field/text-area.svelte +55 -21
- package/package/components/text-field/text-area.svelte.d.ts +12 -19
- package/package/components/text-field/text-input.svelte +71 -46
- package/package/components/text-field/text-input.svelte.d.ts +34 -14
- package/package/components/toast/toast.svelte +119 -0
- package/package/components/toast/toast.svelte.d.ts +36 -0
- package/package/components/toolbar/toolbar.svelte +33 -10
- package/package/components/toolbar/toolbar.svelte.d.ts +7 -1
- package/package/components/util/app-shell.svelte +133 -69
- package/package/components/util/group.svelte +21 -6
- package/package/components/util/group.svelte.d.ts +4 -2
- package/package/components/util/popup.svelte +62 -10
- package/package/components/util/popup.svelte.d.ts +13 -3
- package/package/components/util/portal.svelte +1 -1
- package/package/components/util/portal.svelte.d.ts +2 -0
- package/package/index.d.ts +2 -0
- package/package/index.js +4 -3
- package/package/{components/util → services}/events.d.ts +1 -1
- package/package/{components/util → services}/events.js +3 -2
- package/package/services/group.d.ts +1 -0
- package/package/{components/util → services}/group.js +15 -13
- package/package/{components/util → services}/util.d.ts +1 -1
- package/package/{components/util → services}/util.js +2 -2
- package/package/styles/core.scss +36 -7
- package/package/styles/variables.scss +98 -62
- package/package.json +37 -29
- package/package/components/util/group.d.ts +0 -1
- /package/package/{components/util → services}/popup.d.ts +0 -0
- /package/package/{components/util → services}/popup.js +0 -0
|
@@ -7,65 +7,84 @@
|
|
|
7
7
|
<svelte:options accessors={true} />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
|
-
import { activateKeyShortcuts } from '
|
|
10
|
+
import { activateKeyShortcuts } from '../../services/events';
|
|
11
11
|
import Popup from '../util/popup.svelte';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Reference to the `<button>` element.
|
|
15
|
+
* @type {HTMLButtonElement | undefined}
|
|
16
|
+
*/
|
|
17
|
+
export let element = undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The `class` attribute on the `<button>` element.
|
|
15
20
|
* @type {string}
|
|
16
21
|
*/
|
|
17
22
|
let className = '';
|
|
18
|
-
|
|
19
23
|
export { className as class };
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Reference to the button element.
|
|
23
|
-
* @type {HTMLButtonElement?}
|
|
24
|
-
*/
|
|
25
|
-
export let element = undefined;
|
|
26
|
-
|
|
27
24
|
/**
|
|
28
|
-
* The `type` attribute on the button element.
|
|
29
|
-
* @type {
|
|
25
|
+
* The `type` attribute on the `<button>` element.
|
|
26
|
+
* @type {'button' | 'submit' | 'reset'}
|
|
30
27
|
*/
|
|
31
28
|
export let type = 'button';
|
|
32
|
-
|
|
33
29
|
/**
|
|
34
|
-
* The `role` attribute on the button element.
|
|
30
|
+
* The `role` attribute on the `<button>` element.
|
|
35
31
|
* @type {string}
|
|
36
32
|
*/
|
|
37
33
|
export let role = 'button';
|
|
38
|
-
|
|
39
34
|
/**
|
|
40
|
-
* The
|
|
41
|
-
* @type {
|
|
35
|
+
* The `name` attribute on the `<button>` element.
|
|
36
|
+
* @type {string | undefined}
|
|
42
37
|
*/
|
|
43
|
-
export let
|
|
44
|
-
|
|
38
|
+
export let name = undefined;
|
|
45
39
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @type {
|
|
40
|
+
* The `value` attribute on the `<button>` element.
|
|
41
|
+
* @type {string | undefined}
|
|
48
42
|
*/
|
|
49
|
-
export let
|
|
50
|
-
|
|
43
|
+
export let value = undefined;
|
|
51
44
|
/**
|
|
52
|
-
* Whether the
|
|
45
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
46
|
+
* @type {boolean | undefined}
|
|
47
|
+
*/
|
|
48
|
+
export let hidden = undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
53
51
|
* @type {boolean}
|
|
54
52
|
*/
|
|
55
53
|
export let disabled = false;
|
|
56
|
-
|
|
57
54
|
/**
|
|
58
|
-
*
|
|
59
|
-
* @type {
|
|
55
|
+
* Whether to mark the widget pressed. An alias of the `aria-pressed` attribute.
|
|
56
|
+
* @type {boolean | 'mixed' | undefined}
|
|
60
57
|
*/
|
|
61
58
|
export let pressed = undefined;
|
|
62
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Keyboard shortcuts. An alias of the `aria-keyshortcuts` attribute. Accepts the special `Accel`
|
|
61
|
+
* key, which will be replaced with `Control` or `Meta` depending on the user’s operating system.
|
|
62
|
+
* @type {string | undefined}
|
|
63
|
+
*/
|
|
64
|
+
export let keyShortcuts = undefined;
|
|
63
65
|
/**
|
|
64
66
|
* Text label displayed on the button.
|
|
65
67
|
* @type {string}
|
|
66
68
|
*/
|
|
67
69
|
export let label = '';
|
|
68
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The style variant of the button.
|
|
72
|
+
* @type {'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined}
|
|
73
|
+
*/
|
|
74
|
+
export let variant = undefined;
|
|
75
|
+
/**
|
|
76
|
+
* The size of the button.
|
|
77
|
+
* @type {'small' | 'medium' | 'large' | undefined}
|
|
78
|
+
*/
|
|
79
|
+
export let size = 'medium';
|
|
80
|
+
/**
|
|
81
|
+
* Whether to only show an icon on the button and trim the padding.
|
|
82
|
+
*/
|
|
83
|
+
export let iconic = false;
|
|
84
|
+
/**
|
|
85
|
+
* Whether to make the button rounded.
|
|
86
|
+
*/
|
|
87
|
+
export let pill = false;
|
|
69
88
|
/**
|
|
70
89
|
* Where to show the dropdown menu.
|
|
71
90
|
* @type {PopupPosition}
|
|
@@ -73,25 +92,28 @@
|
|
|
73
92
|
export let popupPosition = 'bottom-left';
|
|
74
93
|
|
|
75
94
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @type {
|
|
95
|
+
* Reference to the `Popup` component.
|
|
96
|
+
* @type {Popup | undefined}
|
|
78
97
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/** @type {?Popup} */
|
|
82
|
-
let popupComponent;
|
|
98
|
+
let popupComponent = undefined;
|
|
83
99
|
</script>
|
|
84
100
|
|
|
85
101
|
<button
|
|
102
|
+
class="sui button {variant ?? ''} {size} {className}"
|
|
103
|
+
class:iconic
|
|
104
|
+
class:pill
|
|
86
105
|
{type}
|
|
106
|
+
{name}
|
|
107
|
+
{value}
|
|
108
|
+
hidden={hidden || undefined}
|
|
109
|
+
disabled={disabled || undefined}
|
|
87
110
|
{role}
|
|
88
|
-
hidden={hidden
|
|
89
|
-
disabled={disabled
|
|
90
|
-
class="sui button {size} {className}"
|
|
91
|
-
aria-hidden={hidden ? true : undefined}
|
|
92
|
-
aria-disabled={disabled ? true : undefined}
|
|
111
|
+
aria-hidden={hidden}
|
|
112
|
+
aria-disabled={disabled}
|
|
93
113
|
aria-pressed={pressed}
|
|
94
114
|
{...$$restProps}
|
|
115
|
+
bind:this={element}
|
|
116
|
+
use:activateKeyShortcuts={keyShortcuts}
|
|
95
117
|
on:mouseenter
|
|
96
118
|
on:mouseleave
|
|
97
119
|
on:click
|
|
@@ -102,8 +124,7 @@
|
|
|
102
124
|
on:keydown
|
|
103
125
|
on:keyup
|
|
104
126
|
on:keypress
|
|
105
|
-
|
|
106
|
-
bind:this={element}
|
|
127
|
+
on:select
|
|
107
128
|
>
|
|
108
129
|
<slot name="start-icon" />
|
|
109
130
|
{#if label}
|
|
@@ -114,7 +135,7 @@
|
|
|
114
135
|
</button>
|
|
115
136
|
|
|
116
137
|
{#if $$slots.popup}
|
|
117
|
-
<Popup anchor={element} position={popupPosition} bind:this={popupComponent}>
|
|
138
|
+
<Popup anchor={element} position={popupPosition} touchOptimized={true} bind:this={popupComponent}>
|
|
118
139
|
<slot name="popup" />
|
|
119
140
|
</Popup>
|
|
120
141
|
{/if}
|
|
@@ -148,87 +169,100 @@ button:global(:not(:disabled):focus-visible) {
|
|
|
148
169
|
button[hidden] {
|
|
149
170
|
display: none !important;
|
|
150
171
|
}
|
|
151
|
-
button[disabled] {
|
|
152
|
-
opacity: 0.4;
|
|
153
|
-
cursor: default;
|
|
154
|
-
pointer-events: none;
|
|
155
|
-
}
|
|
156
172
|
button:global(.primary), button:global(.secondary), button:global(.tertiary), button:global(.ghost) {
|
|
157
173
|
justify-content: center;
|
|
158
174
|
border-width: 1px;
|
|
159
|
-
border-radius: var(--sui-button-medium-border-radius);
|
|
160
|
-
padding: var(--sui-button-medium-padding, 0 8px);
|
|
161
|
-
height: var(--sui-button-medium-height);
|
|
162
175
|
}
|
|
163
176
|
button:global(.primary) :global(.label:only-child), button:global(.secondary) :global(.label:only-child), button:global(.tertiary) :global(.label:only-child), button:global(.ghost) :global(.label:only-child) {
|
|
164
177
|
padding: 0 4px;
|
|
165
178
|
}
|
|
166
179
|
button:global(.primary) {
|
|
167
|
-
border-color: var(--sui-
|
|
168
|
-
color: var(--sui-primary-accent-color-
|
|
180
|
+
border-color: var(--sui-primary-accent-color);
|
|
181
|
+
color: var(--sui-primary-accent-color-inverted);
|
|
169
182
|
background-color: var(--sui-primary-accent-color);
|
|
170
183
|
}
|
|
171
184
|
button:global(.primary):hover, button:global(.primary):focus-visible, button:global(.primary)[aria-expanded=true] {
|
|
172
|
-
background-color: var(--sui-primary-accent-color-
|
|
185
|
+
background-color: var(--sui-primary-accent-color-light);
|
|
173
186
|
}
|
|
174
187
|
button:global(.primary):active {
|
|
175
|
-
background-color: var(--sui-primary-accent-color-
|
|
188
|
+
background-color: var(--sui-primary-accent-color-dark);
|
|
176
189
|
}
|
|
177
190
|
button:global(.secondary) {
|
|
178
191
|
border-color: var(--sui-primary-accent-color);
|
|
179
|
-
color: var(--sui-primary-accent-color-
|
|
180
|
-
background-color: var(--sui-
|
|
192
|
+
color: var(--sui-primary-accent-color-text);
|
|
193
|
+
background-color: var(--sui-button-background-color);
|
|
181
194
|
}
|
|
182
195
|
button:global(.secondary):hover, button:global(.secondary):focus-visible, button:global(.secondary)[aria-expanded=true] {
|
|
183
|
-
background-color: var(--sui-
|
|
196
|
+
background-color: var(--sui-hover-background-color);
|
|
197
|
+
}
|
|
198
|
+
button:global(.secondary):active {
|
|
199
|
+
background-color: var(--sui-active-background-color);
|
|
184
200
|
}
|
|
185
201
|
button:global(.secondary)[aria-pressed=true] {
|
|
186
202
|
background-color: var(--sui-primary-accent-color);
|
|
187
203
|
}
|
|
188
204
|
button:global(.tertiary) {
|
|
189
|
-
border-color: var(--sui-
|
|
205
|
+
border-color: var(--sui-button-border-color);
|
|
190
206
|
color: var(--sui-highlight-foreground-color);
|
|
191
|
-
background-color: var(--sui-
|
|
207
|
+
background-color: var(--sui-button-background-color);
|
|
192
208
|
}
|
|
193
209
|
button:global(.tertiary):hover, button:global(.tertiary):focus-visible, button:global(.tertiary)[aria-expanded=true] {
|
|
194
|
-
background-color: var(--sui-
|
|
210
|
+
background-color: var(--sui-hover-background-color);
|
|
211
|
+
}
|
|
212
|
+
button:global(.tertiary):active {
|
|
213
|
+
background-color: var(--sui-active-background-color);
|
|
195
214
|
}
|
|
196
215
|
button:global(.tertiary)[aria-pressed=true] {
|
|
197
|
-
background-color: var(--sui-
|
|
216
|
+
background-color: var(--sui-selected-background-color);
|
|
198
217
|
}
|
|
199
218
|
button:global(.ghost):hover, button:global(.ghost):focus-visible, button:global(.ghost)[aria-expanded=true] {
|
|
200
|
-
background-color: var(--sui-
|
|
219
|
+
background-color: var(--sui-hover-background-color);
|
|
220
|
+
}
|
|
221
|
+
button:global(.ghost):active {
|
|
222
|
+
background-color: var(--sui-active-background-color);
|
|
201
223
|
}
|
|
202
224
|
button:global(.ghost)[aria-pressed=true] {
|
|
203
|
-
background-color: var(--sui-
|
|
225
|
+
background-color: var(--sui-selected-background-color);
|
|
204
226
|
}
|
|
205
|
-
button:global(.
|
|
206
|
-
|
|
227
|
+
button:global(.link) {
|
|
228
|
+
outline: 0;
|
|
229
|
+
color: var(--sui-primary-accent-color-text);
|
|
207
230
|
}
|
|
208
|
-
button:global(.
|
|
209
|
-
|
|
231
|
+
button:global(.link):hover, button:global(.link):focus, button:global(.link):active {
|
|
232
|
+
text-decoration: underline;
|
|
210
233
|
}
|
|
211
234
|
button:global(.small) {
|
|
212
|
-
|
|
235
|
+
border-radius: var(--sui-button-small-border-radius);
|
|
236
|
+
padding: var(--sui-button-small-padding);
|
|
213
237
|
height: var(--sui-button-small-height);
|
|
214
238
|
font-size: var(--sui-font-size-small);
|
|
215
239
|
}
|
|
216
240
|
button:global(.small) :global(.icon) {
|
|
217
241
|
font-size: var(--sui-font-size-large);
|
|
218
242
|
}
|
|
219
|
-
button:global(.
|
|
220
|
-
border-radius: var(--sui-button-medium-
|
|
221
|
-
padding: var(--sui-button-medium-
|
|
243
|
+
button:global(.medium) {
|
|
244
|
+
border-radius: var(--sui-button-medium-border-radius);
|
|
245
|
+
padding: var(--sui-button-medium-padding);
|
|
246
|
+
height: var(--sui-button-medium-height);
|
|
222
247
|
}
|
|
223
|
-
button:global(.
|
|
224
|
-
|
|
248
|
+
button:global(.large) {
|
|
249
|
+
border-radius: var(--sui-button-large-border-radius);
|
|
250
|
+
padding: var(--sui-button-large-padding);
|
|
251
|
+
height: var(--sui-button-large-height);
|
|
252
|
+
font-size: var(--sui-font-size-large);
|
|
253
|
+
}
|
|
254
|
+
button:global(.pill) {
|
|
255
|
+
border-radius: 80px;
|
|
256
|
+
padding: var(--sui-button-medium-pill-padding, 0 12px);
|
|
225
257
|
}
|
|
226
258
|
button:global(.iconic) {
|
|
227
259
|
justify-content: center;
|
|
228
260
|
padding: 0;
|
|
229
|
-
border-radius: 4px;
|
|
230
261
|
aspect-ratio: 1/1;
|
|
231
262
|
}
|
|
263
|
+
button:global(.danger) {
|
|
264
|
+
background-color: var(--sui-error-background-color);
|
|
265
|
+
}
|
|
232
266
|
button :global(.label) {
|
|
233
267
|
padding: 0 4px;
|
|
234
268
|
}</style>
|
|
@@ -9,16 +9,21 @@
|
|
|
9
9
|
export default class Button extends SvelteComponent<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
|
+
name?: string;
|
|
12
13
|
label?: string;
|
|
13
14
|
type?: "reset" | "submit" | "button";
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
size?: "small" | "medium" | "large";
|
|
17
|
+
value?: string;
|
|
16
18
|
hidden?: boolean;
|
|
17
19
|
element?: HTMLButtonElement;
|
|
18
20
|
role?: string;
|
|
19
|
-
pressed?: boolean | "
|
|
20
|
-
popupPosition?: PopupPosition;
|
|
21
|
+
pressed?: boolean | "mixed";
|
|
21
22
|
keyShortcuts?: string;
|
|
23
|
+
variant?: "link" | "primary" | "secondary" | "tertiary" | "ghost";
|
|
24
|
+
iconic?: boolean;
|
|
25
|
+
pill?: boolean;
|
|
26
|
+
popupPosition?: PopupPosition;
|
|
22
27
|
}, {
|
|
23
28
|
mouseenter: MouseEvent;
|
|
24
29
|
mouseleave: MouseEvent;
|
|
@@ -30,6 +35,7 @@ export default class Button extends SvelteComponent<{
|
|
|
30
35
|
keydown: KeyboardEvent;
|
|
31
36
|
keyup: KeyboardEvent;
|
|
32
37
|
keypress: KeyboardEvent;
|
|
38
|
+
select: Event;
|
|
33
39
|
} & {
|
|
34
40
|
[evt: string]: CustomEvent<any>;
|
|
35
41
|
}, {
|
|
@@ -38,21 +44,24 @@ export default class Button extends SvelteComponent<{
|
|
|
38
44
|
'end-icon': {};
|
|
39
45
|
popup: {};
|
|
40
46
|
}> {
|
|
41
|
-
/**accessor*/
|
|
42
|
-
set class(arg: string);
|
|
43
|
-
get class(): string;
|
|
44
47
|
/**accessor*/
|
|
45
48
|
set element(arg: HTMLButtonElement);
|
|
46
49
|
get element(): HTMLButtonElement;
|
|
47
50
|
/**accessor*/
|
|
51
|
+
set class(arg: string);
|
|
52
|
+
get class(): string;
|
|
53
|
+
/**accessor*/
|
|
48
54
|
set type(arg: "reset" | "submit" | "button");
|
|
49
55
|
get type(): "reset" | "submit" | "button";
|
|
50
56
|
/**accessor*/
|
|
51
57
|
set role(arg: string);
|
|
52
58
|
get role(): string;
|
|
53
59
|
/**accessor*/
|
|
54
|
-
set
|
|
55
|
-
get
|
|
60
|
+
set name(arg: string);
|
|
61
|
+
get name(): string;
|
|
62
|
+
/**accessor*/
|
|
63
|
+
set value(arg: string);
|
|
64
|
+
get value(): string;
|
|
56
65
|
/**accessor*/
|
|
57
66
|
set hidden(arg: boolean);
|
|
58
67
|
get hidden(): boolean;
|
|
@@ -60,17 +69,29 @@ export default class Button extends SvelteComponent<{
|
|
|
60
69
|
set disabled(arg: boolean);
|
|
61
70
|
get disabled(): boolean;
|
|
62
71
|
/**accessor*/
|
|
63
|
-
set pressed(arg: boolean | "
|
|
64
|
-
get pressed(): boolean | "
|
|
72
|
+
set pressed(arg: boolean | "mixed");
|
|
73
|
+
get pressed(): boolean | "mixed";
|
|
74
|
+
/**accessor*/
|
|
75
|
+
set keyShortcuts(arg: string);
|
|
76
|
+
get keyShortcuts(): string;
|
|
65
77
|
/**accessor*/
|
|
66
78
|
set label(arg: string);
|
|
67
79
|
get label(): string;
|
|
68
80
|
/**accessor*/
|
|
81
|
+
set variant(arg: "link" | "primary" | "secondary" | "tertiary" | "ghost");
|
|
82
|
+
get variant(): "link" | "primary" | "secondary" | "tertiary" | "ghost";
|
|
83
|
+
/**accessor*/
|
|
84
|
+
set size(arg: "small" | "medium" | "large");
|
|
85
|
+
get size(): "small" | "medium" | "large";
|
|
86
|
+
/**accessor*/
|
|
87
|
+
set iconic(arg: boolean);
|
|
88
|
+
get iconic(): boolean;
|
|
89
|
+
/**accessor*/
|
|
90
|
+
set pill(arg: boolean);
|
|
91
|
+
get pill(): boolean;
|
|
92
|
+
/**accessor*/
|
|
69
93
|
set popupPosition(arg: PopupPosition);
|
|
70
94
|
get popupPosition(): PopupPosition;
|
|
71
|
-
/**accessor*/
|
|
72
|
-
set keyShortcuts(arg: string);
|
|
73
|
-
get keyShortcuts(): string;
|
|
74
95
|
}
|
|
75
96
|
export type ButtonProps = typeof __propDef.props;
|
|
76
97
|
export type ButtonEvents = typeof __propDef.events;
|
|
@@ -80,16 +101,21 @@ declare const __propDef: {
|
|
|
80
101
|
props: {
|
|
81
102
|
[x: string]: any;
|
|
82
103
|
class?: string;
|
|
104
|
+
name?: string | undefined;
|
|
83
105
|
label?: string;
|
|
84
|
-
type?:
|
|
106
|
+
type?: 'button' | 'submit' | 'reset';
|
|
85
107
|
disabled?: boolean;
|
|
86
|
-
size?:
|
|
87
|
-
|
|
88
|
-
|
|
108
|
+
size?: 'small' | 'medium' | 'large' | undefined;
|
|
109
|
+
value?: string | undefined;
|
|
110
|
+
hidden?: boolean | undefined;
|
|
111
|
+
element?: HTMLButtonElement | undefined;
|
|
89
112
|
role?: string;
|
|
90
|
-
pressed?:
|
|
113
|
+
pressed?: boolean | 'mixed' | undefined;
|
|
114
|
+
keyShortcuts?: string | undefined;
|
|
115
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined;
|
|
116
|
+
iconic?: boolean;
|
|
117
|
+
pill?: boolean;
|
|
91
118
|
popupPosition?: PopupPosition;
|
|
92
|
-
keyShortcuts?: string;
|
|
93
119
|
};
|
|
94
120
|
events: {
|
|
95
121
|
mouseenter: MouseEvent;
|
|
@@ -102,6 +128,7 @@ declare const __propDef: {
|
|
|
102
128
|
keydown: KeyboardEvent;
|
|
103
129
|
keyup: KeyboardEvent;
|
|
104
130
|
keypress: KeyboardEvent;
|
|
131
|
+
select: Event;
|
|
105
132
|
} & {
|
|
106
133
|
[evt: string]: CustomEvent<any>;
|
|
107
134
|
};
|
|
@@ -5,47 +5,58 @@
|
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
-
import {
|
|
9
|
-
import { activateGroup } from '../util/group';
|
|
8
|
+
import { activateGroup } from '../../services/group';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* The `class` attribute on the wrapper element.
|
|
13
12
|
* @type {string}
|
|
14
13
|
*/
|
|
15
14
|
let className = '';
|
|
16
|
-
|
|
17
15
|
export { className as class };
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Whether to hide the widget.
|
|
18
|
+
* @type {boolean | undefined}
|
|
19
|
+
*/
|
|
20
|
+
export let hidden = undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
21
25
|
export let disabled = false;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Whether to disable the widget. An alias of the `aria-readonly` attribute.
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export let readonly = false;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to disable the widget. An alias of the `aria-required` attribute.
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
*/
|
|
35
|
+
export let required = false;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to disable the widget. An alias of the `aria-invalid` attribute.
|
|
38
|
+
* @type {boolean}
|
|
39
|
+
*/
|
|
40
|
+
export let invalid = false;
|
|
31
41
|
</script>
|
|
32
42
|
|
|
33
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
34
43
|
<div
|
|
35
44
|
class="sui select-button-group {className}"
|
|
45
|
+
hidden={hidden || undefined}
|
|
36
46
|
tabindex="-1"
|
|
37
47
|
role="radiogroup"
|
|
38
|
-
aria-
|
|
39
|
-
aria-disabled={disabled
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}}
|
|
48
|
+
aria-hidden={hidden}
|
|
49
|
+
aria-disabled={disabled}
|
|
50
|
+
aria-readonly={readonly}
|
|
51
|
+
aria-required={required}
|
|
52
|
+
aria-invalid={invalid}
|
|
53
|
+
{...$$restProps}
|
|
46
54
|
use:activateGroup
|
|
55
|
+
on:change
|
|
47
56
|
>
|
|
48
|
-
<
|
|
57
|
+
<div class="inner" inert={disabled}>
|
|
58
|
+
<slot />
|
|
59
|
+
</div>
|
|
49
60
|
</div>
|
|
50
61
|
|
|
51
62
|
<style>.select-button-group {
|
|
@@ -56,19 +67,29 @@
|
|
|
56
67
|
outline-width: 0 !important;
|
|
57
68
|
}
|
|
58
69
|
.select-button-group :global(button) {
|
|
59
|
-
border-radius: 0;
|
|
70
|
+
border-radius: 0 !important;
|
|
60
71
|
color: var(--sui-primary-foreground-color);
|
|
61
72
|
}
|
|
62
73
|
.select-button-group :global(button):first-child {
|
|
63
|
-
border-radius: 4px 0 0 4px;
|
|
74
|
+
border-radius: 4px 0 0 4px !important;
|
|
64
75
|
}
|
|
65
76
|
.select-button-group :global(button):not(:first-child) {
|
|
66
77
|
border-left-width: 0;
|
|
67
78
|
}
|
|
68
79
|
.select-button-group :global(button):last-child {
|
|
69
|
-
border-radius: 0 4px 4px 0;
|
|
80
|
+
border-radius: 0 4px 4px 0 !important;
|
|
70
81
|
}
|
|
71
82
|
.select-button-group :global(button[aria-checked="true"]) {
|
|
72
83
|
color: var(--sui-highlight-foreground-color);
|
|
73
|
-
background-color: var(--sui-
|
|
84
|
+
background-color: var(--sui-selected-background-color);
|
|
85
|
+
}
|
|
86
|
+
.select-button-group[aria-disabled=false] :global(button[aria-disabled="true"]) {
|
|
87
|
+
filter: grayscale(0) opacity(1);
|
|
88
|
+
}
|
|
89
|
+
.select-button-group[aria-disabled=false] :global(button[aria-disabled="true"]) :global(*) {
|
|
90
|
+
filter: grayscale(1) opacity(0.35);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.inner {
|
|
94
|
+
display: contents;
|
|
74
95
|
}</style>
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
8
8
|
*/
|
|
9
9
|
export default class SelectButtonGroup extends SvelteComponent<{
|
|
10
|
+
[x: string]: any;
|
|
10
11
|
class?: string;
|
|
12
|
+
invalid?: boolean;
|
|
11
13
|
disabled?: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
required?: boolean;
|
|
15
|
+
hidden?: boolean;
|
|
16
|
+
readonly?: boolean;
|
|
15
17
|
}, {
|
|
16
|
-
change:
|
|
18
|
+
change: Event;
|
|
17
19
|
} & {
|
|
18
20
|
[evt: string]: CustomEvent<any>;
|
|
19
21
|
}, {
|
|
@@ -26,14 +28,16 @@ export type SelectButtonGroupSlots = typeof __propDef.slots;
|
|
|
26
28
|
import { SvelteComponent } from "svelte";
|
|
27
29
|
declare const __propDef: {
|
|
28
30
|
props: {
|
|
31
|
+
[x: string]: any;
|
|
29
32
|
class?: string;
|
|
33
|
+
invalid?: boolean;
|
|
30
34
|
disabled?: boolean;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
required?: boolean;
|
|
36
|
+
hidden?: boolean | undefined;
|
|
37
|
+
readonly?: boolean;
|
|
34
38
|
};
|
|
35
39
|
events: {
|
|
36
|
-
change:
|
|
40
|
+
change: Event;
|
|
37
41
|
} & {
|
|
38
42
|
[evt: string]: CustomEvent<any>;
|
|
39
43
|
};
|
|
@@ -12,18 +12,66 @@
|
|
|
12
12
|
* @type {string}
|
|
13
13
|
*/
|
|
14
14
|
let className = '';
|
|
15
|
-
|
|
16
15
|
export { className as class };
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The `value` attribute on the `<button>` element.
|
|
18
|
+
* @type {string | undefined}
|
|
19
|
+
*/
|
|
20
|
+
export let value = undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to select the widget. An alias of the `aria-checked` attribute.
|
|
23
|
+
* Because the UI is a button, we expose `selected` instead of `checked`.
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
*/
|
|
18
26
|
export let selected = false;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
29
|
+
* @type {boolean | undefined}
|
|
30
|
+
*/
|
|
31
|
+
export let hidden = undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
*/
|
|
36
|
+
export let disabled = false;
|
|
37
|
+
/**
|
|
38
|
+
* Text label displayed on the button.
|
|
39
|
+
* @type {string}
|
|
40
|
+
*/
|
|
41
|
+
export let label = '';
|
|
42
|
+
/**
|
|
43
|
+
* The style variant of the button.
|
|
44
|
+
* @type {'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined}
|
|
45
|
+
*/
|
|
46
|
+
export let variant = undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The size of the button.
|
|
49
|
+
* @type {'small' | 'medium' | 'large'}
|
|
50
|
+
*/
|
|
51
|
+
export let size = 'medium';
|
|
52
|
+
/**
|
|
53
|
+
* Whether to only show an icon on the button and trim the padding.
|
|
54
|
+
*/
|
|
55
|
+
export let iconic = false;
|
|
19
56
|
</script>
|
|
20
57
|
|
|
21
58
|
<Button
|
|
22
59
|
class="sui select-button {className}"
|
|
60
|
+
{value}
|
|
61
|
+
{hidden}
|
|
62
|
+
{disabled}
|
|
63
|
+
{label}
|
|
64
|
+
{variant}
|
|
65
|
+
{size}
|
|
66
|
+
{iconic}
|
|
23
67
|
role="radio"
|
|
24
68
|
aria-checked={selected}
|
|
25
69
|
{...$$restProps}
|
|
26
70
|
on:click
|
|
71
|
+
on:click={() => {
|
|
72
|
+
selected = !selected;
|
|
73
|
+
}}
|
|
74
|
+
on:select
|
|
27
75
|
>
|
|
28
76
|
<slot name="start-icon" slot="start-icon" />
|
|
29
77
|
<slot />
|