@sveltia/ui 0.35.5 → 0.36.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/infobar.svelte +2 -2
- package/dist/components/button/button.svelte +1 -1
- package/dist/components/button/select-button-group.svelte +1 -1
- package/dist/components/button/split-button.svelte +3 -3
- package/dist/components/calendar/calendar.svelte +20 -23
- package/dist/components/dialog/dialog.svelte +4 -4
- package/dist/components/dialog/dialog.svelte.d.ts +1 -1
- package/dist/components/dialog/prompt-dialog.svelte.d.ts +1 -1
- package/dist/components/drawer/drawer.svelte +3 -3
- package/dist/components/grid/grid.svelte +1 -1
- package/dist/components/listbox/listbox.svelte +1 -1
- package/dist/components/menu/menu-button.svelte +1 -0
- package/dist/components/menu/menu-item-checkbox.svelte +1 -0
- package/dist/components/menu/menu-item-radio.svelte +1 -0
- package/dist/components/menu/menu-item.svelte +3 -2
- package/dist/components/menu/menu.svelte +1 -1
- package/dist/components/radio/radio-group.svelte +1 -1
- package/dist/components/resizable-pane/resizable-handle.svelte +6 -4
- package/dist/components/select/combobox.svelte +5 -5
- package/dist/components/select/select-tags.svelte +6 -7
- package/dist/components/slider/slider.svelte +6 -5
- package/dist/components/slider/slider.svelte.d.ts +1 -1
- package/dist/components/tabs/tab-list.svelte +1 -1
- package/dist/components/tabs/tab.svelte +1 -0
- package/dist/components/text-editor/code-editor.svelte +2 -2
- package/dist/components/text-editor/core.js +4 -0
- package/dist/components/text-editor/text-editor.svelte +2 -2
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte +2 -2
- package/dist/components/text-editor/toolbar/code-language-switcher.svelte +7 -3
- package/dist/components/text-editor/toolbar/format-text-button.svelte +2 -2
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +8 -8
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +2 -2
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +5 -5
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +6 -2
- package/dist/components/text-editor/transformers/hr.test.js +0 -2
- package/dist/components/text-field/number-input.svelte +3 -3
- package/dist/components/text-field/password-input.svelte +2 -2
- package/dist/components/text-field/search-bar.svelte +2 -2
- package/dist/components/text-field/secret-input.svelte +2 -2
- package/dist/components/text-field/text-input.svelte +6 -4
- package/dist/components/text-field/text-input.svelte.d.ts +1 -1
- package/dist/components/toast/toast.svelte +2 -0
- package/dist/components/util/app-shell.svelte +10 -9
- package/dist/index.d.ts +0 -3
- package/dist/index.js +1 -2
- package/dist/locales/en.yaml +66 -0
- package/dist/locales/ja.yaml +66 -0
- package/dist/services/group.svelte.d.ts +99 -2
- package/dist/services/group.svelte.js +46 -31
- package/dist/services/group.test.js +107 -36
- package/dist/services/i18n.d.ts +0 -11
- package/dist/services/i18n.js +15 -51
- package/dist/services/i18n.test.js +2 -90
- package/dist/services/popup.test.js +0 -4
- package/package.json +19 -17
- package/dist/locales/en.d.ts +0 -77
- package/dist/locales/en.js +0 -77
- package/dist/locales/ja.d.ts +0 -77
- package/dist/locales/ja.js +0 -77
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { _ } from '
|
|
2
|
+
import { _ } from '@sveltia/i18n';
|
|
3
3
|
import Button from '../button/button.svelte';
|
|
4
4
|
import Icon from '../icon/icon.svelte';
|
|
5
5
|
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
iconic
|
|
45
45
|
size="small"
|
|
46
46
|
variant="ghost"
|
|
47
|
-
aria-label={
|
|
47
|
+
aria-label={_('_sui.dismiss')}
|
|
48
48
|
onclick={() => {
|
|
49
49
|
show = false;
|
|
50
50
|
}}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
@see https://www.google.com/search?q=split+button&tbm=isch
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
|
-
import { _ } from '
|
|
9
|
+
import { _ } from '@sveltia/i18n';
|
|
10
10
|
import Icon from '../icon/icon.svelte';
|
|
11
11
|
import MenuButton from '../menu/menu-button.svelte';
|
|
12
12
|
import Button from './button.svelte';
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
{hidden}
|
|
56
56
|
aria-hidden={hidden}
|
|
57
57
|
aria-disabled={disabled}
|
|
58
|
-
aria-label={
|
|
58
|
+
aria-label={_('_sui.split_button.x_options', { values: { name: label } })}
|
|
59
59
|
>
|
|
60
60
|
<Button {...restProps} {hidden} {disabled} {label} {variant} {size}></Button>
|
|
61
61
|
<MenuButton
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
{disabled}
|
|
65
65
|
{variant}
|
|
66
66
|
{size}
|
|
67
|
-
aria-label={
|
|
67
|
+
aria-label={_('_sui.split_button.more_options')}
|
|
68
68
|
{popupPosition}
|
|
69
69
|
popupPositionBaseElement={wrapper}
|
|
70
70
|
{showPopupBackdrop}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
A calendar (date picker) widget.
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
|
-
import { _ } from '
|
|
7
|
-
import {
|
|
6
|
+
import { _, isRTL } from '@sveltia/i18n';
|
|
7
|
+
import { SvelteDate } from 'svelte/reactivity';
|
|
8
8
|
import Button from '../button/button.svelte';
|
|
9
9
|
import Divider from '../divider/divider.svelte';
|
|
10
10
|
import Spacer from '../divider/spacer.svelte';
|
|
@@ -26,26 +26,23 @@
|
|
|
26
26
|
/**
|
|
27
27
|
* @type {Props & Record<string, any>}
|
|
28
28
|
*/
|
|
29
|
-
let {
|
|
30
|
-
/* eslint-disable prefer-const */
|
|
31
|
-
value = $bindable(undefined),
|
|
32
|
-
/* eslint-enable prefer-const */
|
|
33
|
-
} = $props();
|
|
29
|
+
let { value = $bindable(undefined) } = $props();
|
|
34
30
|
|
|
35
31
|
const now = new Date();
|
|
36
32
|
|
|
37
33
|
const date = $derived(value ? new Date(value) : now);
|
|
38
34
|
const firstDayOfMonth = $derived(new Date(date.getUTCFullYear(), date.getUTCMonth(), 1));
|
|
35
|
+
// eslint-disable-next-line svelte/prefer-writable-derived
|
|
39
36
|
let firstDay = $state();
|
|
40
37
|
|
|
41
38
|
$effect(() => {
|
|
42
|
-
firstDay = new
|
|
39
|
+
firstDay = new SvelteDate(firstDayOfMonth);
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
const dayList = $derived.by(() => {
|
|
46
43
|
if (!firstDay) return [];
|
|
47
44
|
|
|
48
|
-
const cursor = new
|
|
45
|
+
const cursor = new SvelteDate(firstDay);
|
|
49
46
|
|
|
50
47
|
// Start from Sunday
|
|
51
48
|
cursor.setDate(1 - cursor.getUTCDay());
|
|
@@ -79,10 +76,10 @@
|
|
|
79
76
|
event.stopPropagation();
|
|
80
77
|
}}
|
|
81
78
|
>
|
|
82
|
-
<div role="group" aria-label={
|
|
79
|
+
<div role="group" aria-label={_('_sui.calendar.year')}>
|
|
83
80
|
<div role="none" class="header">
|
|
84
81
|
<Button
|
|
85
|
-
aria-label={
|
|
82
|
+
aria-label={_('_sui.calendar.previous_decade')}
|
|
86
83
|
onclick={() => {
|
|
87
84
|
//
|
|
88
85
|
}}
|
|
@@ -90,16 +87,16 @@
|
|
|
90
87
|
<Icon name="chevron_left" />
|
|
91
88
|
</Button>
|
|
92
89
|
<Button
|
|
93
|
-
aria-label={
|
|
90
|
+
aria-label={_('_sui.calendar.next_decade')}
|
|
94
91
|
onclick={() => {
|
|
95
92
|
//
|
|
96
93
|
}}
|
|
97
94
|
>
|
|
98
|
-
<Icon name={
|
|
95
|
+
<Icon name={isRTL() ? 'chevron_left' : 'chevron_right'} />
|
|
99
96
|
</Button>
|
|
100
97
|
</div>
|
|
101
98
|
<div role="none" class="grid">
|
|
102
|
-
{#each [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] as year}
|
|
99
|
+
{#each [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] as year (year)}
|
|
103
100
|
<div role="none">
|
|
104
101
|
<Button>202{year}</Button>
|
|
105
102
|
</div>
|
|
@@ -107,9 +104,9 @@
|
|
|
107
104
|
</div>
|
|
108
105
|
</div>
|
|
109
106
|
<Divider orientation="vertical" />
|
|
110
|
-
<div role="group" aria-label={
|
|
107
|
+
<div role="group" aria-label={_('_sui.calendar.month')}>
|
|
111
108
|
<div role="none" class="grid">
|
|
112
|
-
{#each MONTH_NAMES as monthName}
|
|
109
|
+
{#each MONTH_NAMES as monthName (monthName)}
|
|
113
110
|
<div role="none">
|
|
114
111
|
<Button>{monthName}</Button>
|
|
115
112
|
</div>
|
|
@@ -120,7 +117,7 @@
|
|
|
120
117
|
{/snippet}
|
|
121
118
|
</Button>
|
|
122
119
|
<Button
|
|
123
|
-
aria-label={
|
|
120
|
+
aria-label={_('_sui.calendar.previous_month')}
|
|
124
121
|
onclick={() => {
|
|
125
122
|
firstDay.setUTCMonth(firstDay.getUTCMonth() - 1);
|
|
126
123
|
firstDay = firstDay;
|
|
@@ -129,22 +126,22 @@
|
|
|
129
126
|
<Icon name="chevron_left" />
|
|
130
127
|
</Button>
|
|
131
128
|
<Button
|
|
132
|
-
aria-label={
|
|
129
|
+
aria-label={_('_sui.calendar.next_month')}
|
|
133
130
|
onclick={() => {
|
|
134
131
|
firstDay.setUTCMonth(firstDay.getUTCMonth() + 1);
|
|
135
132
|
firstDay = firstDay;
|
|
136
133
|
}}
|
|
137
134
|
>
|
|
138
|
-
<Icon name={
|
|
135
|
+
<Icon name={isRTL() ? 'chevron_left' : 'chevron_right'} />
|
|
139
136
|
</Button>
|
|
140
137
|
</div>
|
|
141
138
|
<div role="listbox" class="grid">
|
|
142
|
-
{#each dayList.slice(0, 7) as { day }}
|
|
139
|
+
{#each dayList.slice(0, 7) as { day } (day)}
|
|
143
140
|
<div role="none" class="weekday">
|
|
144
141
|
{day.toLocaleDateString('en', { weekday: 'narrow' })}
|
|
145
142
|
</div>
|
|
146
143
|
{/each}
|
|
147
|
-
{#each dayList as { day }}
|
|
144
|
+
{#each dayList as { day } (day)}
|
|
148
145
|
<div
|
|
149
146
|
role="none"
|
|
150
147
|
class:other-month={day.getUTCMonth() !== firstDay?.getUTCMonth()}
|
|
@@ -170,7 +167,7 @@
|
|
|
170
167
|
value = '';
|
|
171
168
|
}}
|
|
172
169
|
>
|
|
173
|
-
{
|
|
170
|
+
{_('_sui.clear')}
|
|
174
171
|
</Button>
|
|
175
172
|
<Spacer flex={true} />
|
|
176
173
|
<Button
|
|
@@ -178,7 +175,7 @@
|
|
|
178
175
|
[value] = now.toJSON().split('T');
|
|
179
176
|
}}
|
|
180
177
|
>
|
|
181
|
-
{
|
|
178
|
+
{_('_sui.calendar.today')}
|
|
182
179
|
</Button>
|
|
183
180
|
</div>
|
|
184
181
|
</div>
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import { _ } from '@sveltia/i18n';
|
|
8
9
|
import { sleep } from '@sveltia/utils/misc';
|
|
9
|
-
import { _ } from 'svelte-i18n';
|
|
10
10
|
import Button from '../button/button.svelte';
|
|
11
11
|
import Spacer from '../divider/spacer.svelte';
|
|
12
12
|
import Icon from '../icon/icon.svelte';
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
<Button
|
|
109
109
|
variant="ghost"
|
|
110
110
|
iconic
|
|
111
|
-
aria-label={
|
|
111
|
+
aria-label={_('_sui.close')}
|
|
112
112
|
aria-controls={id}
|
|
113
113
|
onclick={() => {
|
|
114
114
|
modal?.close('close');
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
{#if showOk}
|
|
140
140
|
<Button
|
|
141
141
|
variant="primary"
|
|
142
|
-
label={okLabel ||
|
|
142
|
+
label={okLabel || _('_sui.ok')}
|
|
143
143
|
keyShortcuts={okShortcuts}
|
|
144
144
|
disabled={okDisabled}
|
|
145
145
|
onclick={() => {
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
{#if showCancel}
|
|
151
151
|
<Button
|
|
152
152
|
variant="secondary"
|
|
153
|
-
label={cancelLabel ||
|
|
153
|
+
label={cancelLabel || _('_sui.cancel')}
|
|
154
154
|
keyShortcuts={cancelShortcuts}
|
|
155
155
|
disabled={cancelDisabled}
|
|
156
156
|
onclick={() => {
|
|
@@ -8,6 +8,6 @@ type Dialog = {
|
|
|
8
8
|
* @see https://w3c.github.io/aria/#dialog
|
|
9
9
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
10
10
|
*/
|
|
11
|
-
declare const Dialog: import("svelte").Component<ModalProps & DialogProps & Record<string, any>, {}, "
|
|
11
|
+
declare const Dialog: import("svelte").Component<ModalProps & DialogProps & Record<string, any>, {}, "value" | "open">;
|
|
12
12
|
import type { ModalProps } from '../../typedefs';
|
|
13
13
|
import type { DialogProps } from '../../typedefs';
|
|
@@ -27,7 +27,7 @@ declare const PromptDialog: import("svelte").Component<ModalProps & DialogProps
|
|
|
27
27
|
* Input slot content.
|
|
28
28
|
*/
|
|
29
29
|
input?: Snippet<[]> | undefined;
|
|
30
|
-
} & Record<string, any>, {}, "
|
|
30
|
+
} & Record<string, any>, {}, "value" | "open">;
|
|
31
31
|
type Props = {
|
|
32
32
|
/**
|
|
33
33
|
* Value entered on the textbox.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
-
import { _ } from '
|
|
8
|
+
import { _ } from '@sveltia/i18n';
|
|
9
9
|
import Button from '../button/button.svelte';
|
|
10
10
|
import Spacer from '../divider/spacer.svelte';
|
|
11
11
|
import Icon from '../icon/icon.svelte';
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
variant="ghost"
|
|
79
79
|
iconic
|
|
80
80
|
class="close"
|
|
81
|
-
aria-label={
|
|
81
|
+
aria-label={_('_sui.close')}
|
|
82
82
|
aria-controls={id}
|
|
83
83
|
onclick={() => {
|
|
84
84
|
modal?.close('close');
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
variant="ghost"
|
|
110
110
|
iconic
|
|
111
111
|
class="close"
|
|
112
|
-
aria-label={
|
|
112
|
+
aria-label={_('_sui.close')}
|
|
113
113
|
aria-controls={id}
|
|
114
114
|
onclick={() => {
|
|
115
115
|
modal?.close('close');
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
@see https://w3c.github.io/aria/#menuitem
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
|
+
import { isRTL } from '@sveltia/i18n';
|
|
7
8
|
import { onMount } from 'svelte';
|
|
8
|
-
import { isRTL } from '../../services/i18n.js';
|
|
9
9
|
import Button from '../button/button.svelte';
|
|
10
10
|
import Icon from '../icon/icon.svelte';
|
|
11
11
|
import Popup from '../util/popup.svelte';
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
{#snippet startIcon()}
|
|
117
117
|
{@render _startIcon?.()}
|
|
118
118
|
{/snippet}
|
|
119
|
+
<!-- eslint-disable-next-line svelte/no-useless-children-snippet -->
|
|
119
120
|
{#snippet children()}
|
|
120
121
|
<div role="none" class="content" class:label={!!label}>
|
|
121
122
|
{#if label}
|
|
@@ -129,7 +130,7 @@
|
|
|
129
130
|
{#if chevronIcon}
|
|
130
131
|
{@render chevronIcon()}
|
|
131
132
|
{:else}
|
|
132
|
-
<Icon name={
|
|
133
|
+
<Icon name={isRTL() ? 'chevron_left' : 'chevron_right'} />
|
|
133
134
|
{/if}
|
|
134
135
|
</span>
|
|
135
136
|
{/if}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import { isRTL } from '@sveltia/i18n';
|
|
8
9
|
import { getContext } from 'svelte';
|
|
9
|
-
import { isRTL } from '../../services/i18n.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @import { Snippet } from 'svelte';
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
let percentDelta = (pixelDelta / containerSize) * 100;
|
|
113
113
|
|
|
114
114
|
// In RTL with a horizontal layout, the visual direction is reversed
|
|
115
|
-
if (isHorizontal &&
|
|
115
|
+
if (isHorizontal && isRTL()) {
|
|
116
116
|
percentDelta = -percentDelta;
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -196,11 +196,13 @@
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
if (isHorizontal) {
|
|
199
|
+
const _isRTL = isRTL();
|
|
200
|
+
|
|
199
201
|
// In RTL, Left/Right directions are visually swapped
|
|
200
202
|
if (key === 'ArrowLeft') {
|
|
201
|
-
delta =
|
|
203
|
+
delta = _isRTL ? step : -step;
|
|
202
204
|
} else if (key === 'ArrowRight') {
|
|
203
|
-
delta =
|
|
205
|
+
delta = _isRTL ? -step : step;
|
|
204
206
|
} else {
|
|
205
207
|
return;
|
|
206
208
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
@todo Add DOM API compatibility.
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
|
-
import { _ } from '
|
|
9
|
+
import { _ } from '@sveltia/i18n';
|
|
10
10
|
import { getSelectedItemDetail } from '../../services/select.svelte.js';
|
|
11
11
|
import Button from '../button/button.svelte';
|
|
12
12
|
import Icon from '../icon/icon.svelte';
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
>
|
|
138
138
|
<div role="none" class="label">
|
|
139
139
|
<TruncatedText>
|
|
140
|
-
{value !== undefined ? label :
|
|
140
|
+
{value !== undefined ? label : _('_sui.combobox.select_an_option')}
|
|
141
141
|
</TruncatedText>
|
|
142
142
|
</div>
|
|
143
143
|
</div>
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
{hidden}
|
|
165
165
|
{disabled}
|
|
166
166
|
tabindex={!editable || readonly || disabled ? -1 : 0}
|
|
167
|
-
aria-label={isPopupOpen ?
|
|
167
|
+
aria-label={isPopupOpen ? _('_sui.collapse') : _('_sui.expand')}
|
|
168
168
|
aria-controls="{id}-popup"
|
|
169
169
|
aria-expanded={isPopupOpen}
|
|
170
170
|
onclick={(event) => {
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
{#if showFilter}
|
|
206
206
|
<SearchBar
|
|
207
207
|
flex
|
|
208
|
-
aria-label={
|
|
208
|
+
aria-label={_('_sui.combobox.filter_options')}
|
|
209
209
|
aria-controls="{id}-listbox"
|
|
210
210
|
bind:value={searchTerms}
|
|
211
211
|
onkeydown={(event) => {
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
</Listbox>
|
|
236
236
|
{#if !hasMatchingOptions}
|
|
237
237
|
<div role="alert" class="no-options">
|
|
238
|
-
{
|
|
238
|
+
{_('_sui.combobox.no_matching_options')}
|
|
239
239
|
</div>
|
|
240
240
|
{/if}
|
|
241
241
|
</div>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { _, isRTL } from '@sveltia/i18n';
|
|
2
3
|
import { tick } from 'svelte';
|
|
3
|
-
import { _ } from 'svelte-i18n';
|
|
4
4
|
import { flip } from 'svelte/animate';
|
|
5
|
-
import { isRTL } from '../../services/i18n.js';
|
|
6
5
|
import Button from '../button/button.svelte';
|
|
7
6
|
import Icon from '../icon/icon.svelte';
|
|
8
7
|
import Option from '../listbox/option.svelte';
|
|
@@ -60,8 +59,8 @@
|
|
|
60
59
|
|
|
61
60
|
/** @type {Map<any, { label: string, value: any, searchValue?: string }>} */
|
|
62
61
|
const optionMap = $derived(new Map(options.map((o) => [o.value, o])));
|
|
63
|
-
const prevKey = $derived(
|
|
64
|
-
const nextKey = $derived(
|
|
62
|
+
const prevKey = $derived(isRTL() ? 'ArrowRight' : 'ArrowLeft');
|
|
63
|
+
const nextKey = $derived(isRTL() ? 'ArrowLeft' : 'ArrowRight');
|
|
65
64
|
|
|
66
65
|
/**
|
|
67
66
|
* Reference to the wrapper element.
|
|
@@ -128,7 +127,7 @@
|
|
|
128
127
|
<span
|
|
129
128
|
role="listbox"
|
|
130
129
|
aria-multiselectable="true"
|
|
131
|
-
aria-label={
|
|
130
|
+
aria-label={_('_sui.select_tags.selected_options')}
|
|
132
131
|
>
|
|
133
132
|
{#each values as value, index (value)}
|
|
134
133
|
{@const option = optionMap.get(value)}
|
|
@@ -159,7 +158,7 @@
|
|
|
159
158
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
160
159
|
const inFirstHalf = event.clientX < rect.left + rect.width / 2;
|
|
161
160
|
|
|
162
|
-
dropIndex = inFirstHalf !==
|
|
161
|
+
dropIndex = inFirstHalf !== isRTL() ? index : index + 1;
|
|
163
162
|
}}
|
|
164
163
|
ondrop={async (event) => {
|
|
165
164
|
event.preventDefault();
|
|
@@ -217,7 +216,7 @@
|
|
|
217
216
|
iconic
|
|
218
217
|
size="small"
|
|
219
218
|
disabled={disabled || readonly}
|
|
220
|
-
aria-label={
|
|
219
|
+
aria-label={_('_sui.select_tags.remove_x', { values: { name: label } })}
|
|
221
220
|
onclick={() => {
|
|
222
221
|
values = values.filter((v) => v !== value);
|
|
223
222
|
onRemoveValue?.(new CustomEvent('RemoveValue', { detail: { value } }));
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/
|
|
9
9
|
-->
|
|
10
10
|
<script>
|
|
11
|
+
import { isRTL } from '@sveltia/i18n';
|
|
11
12
|
import { onMount } from 'svelte';
|
|
12
|
-
import { isRTL } from '../../services/i18n.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @import { Snippet } from 'svelte';
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
// Convert physical position to logical position (always LTR)
|
|
89
89
|
// In RTL, left side (physicalX=0) maps to max value (logicalX=barWidth)
|
|
90
90
|
// In LTR, left side (physicalX=0) maps to min value (logicalX=0)
|
|
91
|
-
const logicalX =
|
|
91
|
+
const logicalX = isRTL() ? barWidth - physicalX : physicalX;
|
|
92
92
|
|
|
93
93
|
if (logicalX < 0 || logicalX > barWidth) {
|
|
94
94
|
return;
|
|
@@ -132,9 +132,10 @@
|
|
|
132
132
|
|
|
133
133
|
const _value = multiThumb ? /** @type {[number, number]} */ (values)[valueIndex] : value;
|
|
134
134
|
let index = -1;
|
|
135
|
+
const _isRTL = isRTL();
|
|
135
136
|
// In RTL, ArrowLeft increases value, ArrowRight decreases value
|
|
136
|
-
const decreaseKeys =
|
|
137
|
-
const increaseKeys =
|
|
137
|
+
const decreaseKeys = _isRTL ? ['ArrowDown', 'ArrowRight'] : ['ArrowDown', 'ArrowLeft'];
|
|
138
|
+
const increaseKeys = _isRTL ? ['ArrowUp', 'ArrowLeft'] : ['ArrowUp', 'ArrowRight'];
|
|
138
139
|
|
|
139
140
|
if (decreaseKeys.includes(key)) {
|
|
140
141
|
if (_value > min) {
|
|
@@ -367,7 +368,7 @@
|
|
|
367
368
|
></div>
|
|
368
369
|
{/if}
|
|
369
370
|
{#if optionLabels.length}
|
|
370
|
-
{#each optionLabels as label, index}
|
|
371
|
+
{#each optionLabels as label, index (`${index}-${label}`)}
|
|
371
372
|
<span
|
|
372
373
|
role="none"
|
|
373
374
|
class="label"
|
|
@@ -83,7 +83,7 @@ declare const Slider: import("svelte").Component<{
|
|
|
83
83
|
values?: number[];
|
|
84
84
|
value?: number;
|
|
85
85
|
}) => void) | undefined;
|
|
86
|
-
} & Record<string, any>, {}, "
|
|
86
|
+
} & Record<string, any>, {}, "value" | "values">;
|
|
87
87
|
type Props = {
|
|
88
88
|
/**
|
|
89
89
|
* Current value.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
A code editor based on Lexical.
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
|
+
import { _ } from '@sveltia/i18n';
|
|
6
7
|
import { setContext, untrack } from 'svelte';
|
|
7
|
-
import { _ } from 'svelte-i18n';
|
|
8
8
|
import Alert from '../alert/alert.svelte';
|
|
9
9
|
import Toast from '../toast/toast.svelte';
|
|
10
10
|
import LexicalRoot from './lexical-root.svelte';
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
|
|
109
109
|
{#if editorStore.showConverterError}
|
|
110
110
|
<Toast bind:show={editorStore.showConverterError}>
|
|
111
|
-
<Alert status="error">{
|
|
111
|
+
<Alert status="error">{_('_sui.text_editor.converter_error')}</Alert>
|
|
112
112
|
</Toast>
|
|
113
113
|
{/if}
|
|
114
114
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
A rich text editor based on Lexical.
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
|
+
import { _ } from '@sveltia/i18n';
|
|
6
7
|
import { setContext, untrack } from 'svelte';
|
|
7
|
-
import { _ } from 'svelte-i18n';
|
|
8
8
|
import Alert from '../alert/alert.svelte';
|
|
9
9
|
import TextArea from '../text-field/text-area.svelte';
|
|
10
10
|
import Toast from '../toast/toast.svelte';
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
|
|
121
121
|
{#if editorStore.showConverterError}
|
|
122
122
|
<Toast bind:show={editorStore.showConverterError}>
|
|
123
|
-
<Alert status="error">{
|
|
123
|
+
<Alert status="error">{_('_sui.text_editor.converter_error')}</Alert>
|
|
124
124
|
</Toast>
|
|
125
125
|
{/if}
|
|
126
126
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { _ } from '
|
|
2
|
+
import { _ } from '@sveltia/i18n';
|
|
3
3
|
import CodeLanguageSwitcher from './code-language-switcher.svelte';
|
|
4
4
|
import ToolbarWrapper from './toolbar-wrapper.svelte';
|
|
5
5
|
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
} = $props();
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
|
-
<ToolbarWrapper disabled={disabled || readonly} aria-label={
|
|
26
|
+
<ToolbarWrapper disabled={disabled || readonly} aria-label={_('_sui.text_editor.code_editor')}>
|
|
27
27
|
<CodeLanguageSwitcher disabled={disabled || readonly} />
|
|
28
28
|
</ToolbarWrapper>
|