@sveltia/ui 0.7.5 → 0.8.1
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/alert/alert.svelte +4 -4
- package/package/components/alert/alert.svelte.d.ts +2 -2
- package/package/components/button/button.svelte +5 -3
- package/package/components/button/button.svelte.d.ts +6 -4
- package/package/components/button/select-button-group.svelte +9 -5
- package/package/components/button/select-button.svelte +5 -4
- package/package/components/button/select-button.svelte.d.ts +2 -0
- package/package/components/calendar/calendar.svelte +20 -14
- package/package/components/checkbox/checkbox-group.svelte +6 -5
- package/package/components/checkbox/checkbox.svelte +6 -4
- package/package/components/checkbox/checkbox.svelte.d.ts +2 -2
- package/package/components/dialog/alert-dialog.svelte +50 -0
- package/package/components/dialog/alert-dialog.svelte.d.ts +55 -0
- package/package/components/dialog/confirmation-dialog.svelte +55 -0
- package/package/components/dialog/confirmation-dialog.svelte.d.ts +57 -0
- package/package/components/dialog/dialog.svelte +165 -221
- package/package/components/dialog/dialog.svelte.d.ts +20 -12
- package/package/components/dialog/prompt-dialog.svelte +87 -0
- package/package/components/dialog/prompt-dialog.svelte.d.ts +72 -0
- package/package/components/disclosure/disclosure.svelte +3 -2
- package/package/components/divider/divider.svelte +1 -1
- package/package/components/divider/spacer.svelte +1 -12
- package/package/components/divider/spacer.svelte.d.ts +0 -2
- package/package/components/drawer/drawer.svelte +119 -209
- package/package/components/drawer/drawer.svelte.d.ts +13 -9
- package/package/components/grid/grid-body.svelte +51 -0
- package/package/components/grid/grid-body.svelte.d.ts +36 -0
- package/package/components/grid/grid-cell.svelte +22 -0
- package/package/components/grid/grid-cell.svelte.d.ts +34 -0
- package/package/components/grid/grid-col-header.svelte +22 -0
- package/package/components/grid/grid-col-header.svelte.d.ts +34 -0
- package/package/components/grid/grid-foot.svelte +27 -0
- package/package/components/grid/grid-foot.svelte.d.ts +34 -0
- package/package/components/grid/grid-head.svelte +27 -0
- package/package/components/grid/grid-head.svelte.d.ts +34 -0
- package/package/components/grid/grid-row-header.svelte +23 -0
- package/package/components/grid/grid-row-header.svelte.d.ts +34 -0
- package/package/components/grid/grid-row.svelte +37 -0
- package/package/components/grid/grid-row.svelte.d.ts +44 -0
- package/package/components/grid/grid.svelte +52 -0
- package/package/components/grid/grid.svelte.d.ts +42 -0
- package/package/components/icon/icon.svelte +6 -7
- package/package/components/icon/icon.svelte.d.ts +0 -2
- package/package/components/listbox/listbox.svelte +3 -3
- package/package/components/listbox/option-group.svelte +6 -5
- package/package/components/listbox/option.svelte +7 -28
- package/package/components/listbox/option.svelte.d.ts +2 -0
- package/package/components/menu/menu-button.svelte +26 -16
- package/package/components/menu/menu-button.svelte.d.ts +2 -2
- package/package/components/menu/menu-item-checkbox.svelte +5 -4
- package/package/components/menu/menu-item-checkbox.svelte.d.ts +2 -0
- package/package/components/menu/menu-item-group.svelte +4 -3
- package/package/components/menu/menu-item-radio.svelte +5 -4
- package/package/components/menu/menu-item-radio.svelte.d.ts +2 -0
- package/package/components/menu/menu-item.svelte +7 -5
- package/package/components/menu/menu-item.svelte.d.ts +4 -2
- package/package/components/menu/menu.svelte +1 -1
- package/package/components/radio/radio-group.svelte +5 -5
- package/package/components/radio/radio.svelte +5 -2
- package/package/components/radio/radio.svelte.d.ts +2 -0
- package/package/components/select/combobox.svelte +11 -9
- package/package/components/slider/slider.svelte +12 -5
- package/package/components/switch/switch.svelte +3 -2
- package/package/components/switch/switch.svelte.d.ts +2 -2
- package/package/components/table/table-body.svelte +31 -3
- package/package/components/table/table-body.svelte.d.ts +2 -0
- package/package/components/table/table-cell.svelte +3 -4
- package/package/components/table/table-cell.svelte.d.ts +1 -1
- package/package/components/table/table-col-header.svelte +1 -2
- package/package/components/table/table-foot.svelte +7 -3
- package/package/components/table/table-head.svelte +7 -3
- package/package/components/table/table-row-header.svelte +1 -2
- package/package/components/table/table-row.svelte +1 -14
- package/package/components/table/table-row.svelte.d.ts +0 -8
- package/package/components/table/table.svelte +5 -17
- package/package/components/table/table.svelte.d.ts +1 -7
- package/package/components/tabs/tab-list.svelte +7 -5
- package/package/components/tabs/tab-panel.svelte +1 -1
- package/package/components/tabs/tab.svelte +2 -1
- package/package/components/tabs/tab.svelte.d.ts +2 -0
- package/package/components/text-field/markdown-editor.svelte +30 -6
- package/package/components/text-field/markdown-editor.svelte.d.ts +2 -0
- package/package/components/text-field/number-input.svelte +36 -6
- package/package/components/text-field/number-input.svelte.d.ts +2 -0
- package/package/components/text-field/password-input.svelte +34 -8
- package/package/components/text-field/password-input.svelte.d.ts +2 -0
- package/package/components/text-field/search-bar.svelte +39 -11
- package/package/components/text-field/search-bar.svelte.d.ts +5 -0
- package/package/components/text-field/text-area.svelte +21 -2
- package/package/components/text-field/text-area.svelte.d.ts +2 -0
- package/package/components/text-field/text-input.svelte +22 -4
- package/package/components/text-field/text-input.svelte.d.ts +7 -2
- package/package/components/toast/toast.svelte +47 -17
- package/package/components/toast/toast.svelte.d.ts +7 -3
- package/package/components/toolbar/toolbar.svelte +3 -4
- package/package/components/util/app-shell.svelte +26 -27
- package/package/components/util/group.svelte +2 -2
- package/package/components/util/modal.svelte +220 -0
- package/package/components/util/modal.svelte.d.ts +83 -0
- package/package/components/util/popup.svelte +81 -127
- package/package/components/util/popup.svelte.d.ts +22 -18
- package/package/components/util/portal.svelte +1 -1
- package/package/index.d.ts +12 -0
- package/package/index.js +12 -0
- package/package/locales/en.d.ts +1 -0
- package/package/locales/en.js +1 -0
- package/package/locales/ja.d.ts +1 -0
- package/package/locales/ja.js +1 -0
- package/package/services/group.js +51 -13
- package/package/styles/core.scss +9 -26
- package/package/styles/variables.scss +12 -0
- package/package/typedef.d.ts +1 -0
- package/package/typedef.js +5 -0
- package/package.json +97 -1
|
@@ -6,15 +6,19 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* The `class` attribute on the wrapper element.
|
|
10
10
|
* @type {string}
|
|
11
11
|
*/
|
|
12
12
|
let className = '';
|
|
13
|
-
|
|
14
13
|
export { className as class };
|
|
15
14
|
</script>
|
|
16
15
|
|
|
17
|
-
<div
|
|
16
|
+
<div
|
|
17
|
+
role="rowgroup"
|
|
18
|
+
class="sui table-foot {className}"
|
|
19
|
+
aria-roledescription="table foot"
|
|
20
|
+
{...$$restProps}
|
|
21
|
+
>
|
|
18
22
|
<slot />
|
|
19
23
|
</div>
|
|
20
24
|
|
|
@@ -6,15 +6,19 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* The `class` attribute on the wrapper element.
|
|
10
10
|
* @type {string}
|
|
11
11
|
*/
|
|
12
12
|
let className = '';
|
|
13
|
-
|
|
14
13
|
export { className as class };
|
|
15
14
|
</script>
|
|
16
15
|
|
|
17
|
-
<div
|
|
16
|
+
<div
|
|
17
|
+
role="rowgroup"
|
|
18
|
+
class="sui table-head {className}"
|
|
19
|
+
aria-roledescription="table head"
|
|
20
|
+
{...$$restProps}
|
|
21
|
+
>
|
|
18
22
|
<slot />
|
|
19
23
|
</div>
|
|
20
24
|
|
|
@@ -11,22 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
let className = '';
|
|
13
13
|
export { className as class };
|
|
14
|
-
/**
|
|
15
|
-
* Whether to select the widget. An alias of the `aria-selected` attribute.
|
|
16
|
-
* @type {boolean}
|
|
17
|
-
*/
|
|
18
|
-
export let selected = false;
|
|
19
14
|
</script>
|
|
20
15
|
|
|
21
|
-
<div
|
|
22
|
-
class="sui table-row {className}"
|
|
23
|
-
role="row"
|
|
24
|
-
tabindex="0"
|
|
25
|
-
aria-selected={selected}
|
|
26
|
-
{...$$restProps}
|
|
27
|
-
on:click
|
|
28
|
-
on:select
|
|
29
|
-
>
|
|
16
|
+
<div role="row" class="sui table-row {className}" {...$$restProps}>
|
|
30
17
|
<slot />
|
|
31
18
|
</div>
|
|
32
19
|
|
|
@@ -9,11 +9,7 @@
|
|
|
9
9
|
export default class TableRow extends SvelteComponent<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
|
-
selected?: boolean;
|
|
13
12
|
}, {
|
|
14
|
-
click: MouseEvent;
|
|
15
|
-
select: Event;
|
|
16
|
-
} & {
|
|
17
13
|
[evt: string]: CustomEvent<any>;
|
|
18
14
|
}, {
|
|
19
15
|
default: {};
|
|
@@ -27,12 +23,8 @@ declare const __propDef: {
|
|
|
27
23
|
props: {
|
|
28
24
|
[x: string]: any;
|
|
29
25
|
class?: string;
|
|
30
|
-
selected?: boolean;
|
|
31
26
|
};
|
|
32
27
|
events: {
|
|
33
|
-
click: MouseEvent;
|
|
34
|
-
select: Event;
|
|
35
|
-
} & {
|
|
36
28
|
[evt: string]: CustomEvent<any>;
|
|
37
29
|
};
|
|
38
30
|
slots: {
|
|
@@ -2,37 +2,25 @@
|
|
|
2
2
|
@component
|
|
3
3
|
The equivalent of the HTML `<table>` element.
|
|
4
4
|
@see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
|
|
5
|
-
@see https://w3c.github.io/aria/#
|
|
5
|
+
@see https://w3c.github.io/aria/#table
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
-
import { activateGroup } from '../../services/group';
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
9
|
+
* The `class` attribute on the wrapper element.
|
|
12
10
|
* @type {string}
|
|
13
11
|
*/
|
|
14
12
|
let className = '';
|
|
15
|
-
|
|
16
13
|
export { className as class };
|
|
17
|
-
|
|
18
|
-
/** @type {HTMLElement?} */
|
|
19
|
-
export let element = undefined;
|
|
20
14
|
</script>
|
|
21
15
|
|
|
22
|
-
<div
|
|
23
|
-
role="grid"
|
|
24
|
-
class="sui table {className}"
|
|
25
|
-
{...$$restProps}
|
|
26
|
-
bind:this={element}
|
|
27
|
-
use:activateGroup
|
|
28
|
-
on:change
|
|
29
|
-
>
|
|
16
|
+
<div role="table" class="sui table {className}" {...$$restProps}>
|
|
30
17
|
<slot />
|
|
31
18
|
</div>
|
|
32
19
|
|
|
33
20
|
<style>.table {
|
|
34
21
|
display: table;
|
|
35
|
-
|
|
22
|
+
margin: var(--sui-focus-ring-width);
|
|
23
|
+
width: calc(100% - var(--sui-focus-ring-width) * 2);
|
|
36
24
|
}
|
|
37
25
|
.table:global(.data) {
|
|
38
26
|
border-collapse: collapse;
|
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* The equivalent of the HTML `<table>` element.
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
|
|
7
|
-
* @see https://w3c.github.io/aria/#
|
|
7
|
+
* @see https://w3c.github.io/aria/#table
|
|
8
8
|
*/
|
|
9
9
|
export default class Table extends SvelteComponent<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
|
-
element?: HTMLElement;
|
|
13
12
|
}, {
|
|
14
|
-
change: Event;
|
|
15
|
-
} & {
|
|
16
13
|
[evt: string]: CustomEvent<any>;
|
|
17
14
|
}, {
|
|
18
15
|
default: {};
|
|
@@ -26,11 +23,8 @@ declare const __propDef: {
|
|
|
26
23
|
props: {
|
|
27
24
|
[x: string]: any;
|
|
28
25
|
class?: string;
|
|
29
|
-
element?: HTMLElement | null;
|
|
30
26
|
};
|
|
31
27
|
events: {
|
|
32
|
-
change: Event;
|
|
33
|
-
} & {
|
|
34
28
|
[evt: string]: CustomEvent<any>;
|
|
35
29
|
};
|
|
36
30
|
slots: {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<div
|
|
39
|
-
class="sui tab-list {className}"
|
|
40
39
|
role="tablist"
|
|
40
|
+
class="sui tab-list {className}"
|
|
41
41
|
hidden={hidden || undefined}
|
|
42
42
|
aria-hidden={hidden}
|
|
43
43
|
aria-disabled={disabled}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
use:activateGroup
|
|
48
48
|
on:change
|
|
49
49
|
>
|
|
50
|
-
<div class="inner" inert={disabled}>
|
|
50
|
+
<div role="none" class="inner" inert={disabled}>
|
|
51
51
|
<slot />
|
|
52
52
|
</div>
|
|
53
53
|
</div>
|
|
@@ -55,11 +55,12 @@
|
|
|
55
55
|
<style>.tab-list {
|
|
56
56
|
display: flex;
|
|
57
57
|
align-items: center;
|
|
58
|
+
margin: var(--sui-focus-ring-width);
|
|
58
59
|
border-color: var(--sui-control-border-color);
|
|
59
60
|
}
|
|
60
61
|
.tab-list[aria-orientation=horizontal] {
|
|
61
|
-
gap:
|
|
62
|
-
margin:
|
|
62
|
+
gap: 8px;
|
|
63
|
+
margin-bottom: 32px;
|
|
63
64
|
border-width: 0 0 1px;
|
|
64
65
|
padding: 0 16px;
|
|
65
66
|
}
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
.tab-list[aria-orientation=vertical] {
|
|
70
71
|
gap: 8px;
|
|
71
72
|
flex-direction: column;
|
|
72
|
-
margin:
|
|
73
|
+
margin-right: 32px;
|
|
73
74
|
border-width: 0 1px 0 0;
|
|
74
75
|
padding: 8px 0;
|
|
75
76
|
width: 240px;
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
.tab-list :global(button) {
|
|
82
83
|
justify-content: flex-start;
|
|
83
84
|
border-color: transparent;
|
|
85
|
+
margin: 0 !important;
|
|
84
86
|
padding: 0;
|
|
85
87
|
border-radius: 0;
|
|
86
88
|
height: var(--sui-tab-medium-height);
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
33
|
<Button
|
|
34
|
-
class="sui tab {className}"
|
|
35
34
|
role="tab"
|
|
35
|
+
class="sui tab {className}"
|
|
36
36
|
{hidden}
|
|
37
37
|
{disabled}
|
|
38
38
|
aria-selected={selected}
|
|
39
39
|
{...$$restProps}
|
|
40
40
|
on:select
|
|
41
|
+
on:change
|
|
41
42
|
>
|
|
42
43
|
<slot name="start-icon" slot="start-icon" />
|
|
43
44
|
<slot />
|
|
@@ -14,6 +14,7 @@ export default class Tab extends SvelteComponent<{
|
|
|
14
14
|
selected?: boolean;
|
|
15
15
|
}, {
|
|
16
16
|
select: Event;
|
|
17
|
+
change: Event;
|
|
17
18
|
} & {
|
|
18
19
|
[evt: string]: CustomEvent<any>;
|
|
19
20
|
}, {
|
|
@@ -40,6 +41,7 @@ declare const __propDef: {
|
|
|
40
41
|
};
|
|
41
42
|
events: {
|
|
42
43
|
select: Event;
|
|
44
|
+
change: Event;
|
|
43
45
|
} & {
|
|
44
46
|
[evt: string]: CustomEvent<any>;
|
|
45
47
|
};
|
|
@@ -4,12 +4,18 @@
|
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
6
|
import { _ } from 'svelte-i18n';
|
|
7
|
+
import { getRandomId } from '../../services/util';
|
|
7
8
|
import Button from '../button/button.svelte';
|
|
8
9
|
import Divider from '../divider/divider.svelte';
|
|
9
10
|
import Icon from '../icon/icon.svelte';
|
|
10
11
|
import Toolbar from '../toolbar/toolbar.svelte';
|
|
11
12
|
import TextArea from './text-area.svelte';
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Make the text input container flexible.
|
|
16
|
+
* @type {boolean}
|
|
17
|
+
*/
|
|
18
|
+
export let flex = false;
|
|
13
19
|
/**
|
|
14
20
|
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
15
21
|
* @type {boolean | undefined}
|
|
@@ -41,6 +47,8 @@
|
|
|
41
47
|
*/
|
|
42
48
|
export let value = undefined;
|
|
43
49
|
|
|
50
|
+
const id = getRandomId('editor');
|
|
51
|
+
|
|
44
52
|
const defaultButtons = [
|
|
45
53
|
{ name: 'bold', label: $_('_sui.markdown_editor.bold'), icon: 'format_bold' },
|
|
46
54
|
{ name: 'italic', label: $_('_sui.markdown_editor.italic'), icon: 'format_italic' },
|
|
@@ -72,8 +80,8 @@
|
|
|
72
80
|
];
|
|
73
81
|
</script>
|
|
74
82
|
|
|
75
|
-
<div class="wrapper" hidden={hidden || undefined} {...$$restProps}>
|
|
76
|
-
<div class="inner">
|
|
83
|
+
<div role="none" class="wrapper" hidden={hidden || undefined} {...$$restProps}>
|
|
84
|
+
<div role="none" class="inner">
|
|
77
85
|
<Toolbar
|
|
78
86
|
disabled={disabled || readonly}
|
|
79
87
|
aria-label={$_('_sui.markdown_editor.markdown_editor')}
|
|
@@ -82,18 +90,29 @@
|
|
|
82
90
|
{#if separator}
|
|
83
91
|
<Divider />
|
|
84
92
|
{:else}
|
|
85
|
-
<Button iconic>
|
|
86
|
-
<Icon slot="start-icon" name={icon}
|
|
93
|
+
<Button iconic aria-label={label} aria-controls={id}>
|
|
94
|
+
<Icon slot="start-icon" name={icon} />
|
|
87
95
|
</Button>
|
|
88
96
|
{/if}
|
|
89
97
|
{/each}
|
|
90
98
|
</Toolbar>
|
|
91
|
-
<TextArea
|
|
99
|
+
<TextArea
|
|
100
|
+
{id}
|
|
101
|
+
autoResize={true}
|
|
102
|
+
bind:value
|
|
103
|
+
{flex}
|
|
104
|
+
{hidden}
|
|
105
|
+
{disabled}
|
|
106
|
+
{readonly}
|
|
107
|
+
{required}
|
|
108
|
+
{invalid}
|
|
109
|
+
/>
|
|
92
110
|
</div>
|
|
93
111
|
</div>
|
|
94
112
|
|
|
95
113
|
<style>.wrapper {
|
|
96
|
-
|
|
114
|
+
margin: var(--sui-focus-ring-width);
|
|
115
|
+
width: calc(100% - var(--sui-focus-ring-width) * 2);
|
|
97
116
|
}
|
|
98
117
|
.wrapper :global([role="toolbar"]) {
|
|
99
118
|
display: flex;
|
|
@@ -104,6 +123,7 @@
|
|
|
104
123
|
}
|
|
105
124
|
.wrapper :global([role="toolbar"]) :global(button) {
|
|
106
125
|
flex: none;
|
|
126
|
+
margin: 0 !important;
|
|
107
127
|
}
|
|
108
128
|
.wrapper :global([role="toolbar"]) + :global(div) {
|
|
109
129
|
width: 100%;
|
|
@@ -114,4 +134,8 @@
|
|
|
114
134
|
|
|
115
135
|
.inner {
|
|
116
136
|
display: contents;
|
|
137
|
+
}
|
|
138
|
+
.inner :global(.text-area) {
|
|
139
|
+
margin: 0 !important;
|
|
140
|
+
width: 100% !important;
|
|
117
141
|
}</style>
|
|
@@ -10,6 +10,7 @@ export default class MarkdownEditor extends SvelteComponent<{
|
|
|
10
10
|
value?: string;
|
|
11
11
|
hidden?: boolean;
|
|
12
12
|
readonly?: boolean;
|
|
13
|
+
flex?: boolean;
|
|
13
14
|
}, {
|
|
14
15
|
[evt: string]: CustomEvent<any>;
|
|
15
16
|
}, {}> {
|
|
@@ -27,6 +28,7 @@ declare const __propDef: {
|
|
|
27
28
|
value?: string | undefined;
|
|
28
29
|
hidden?: boolean | undefined;
|
|
29
30
|
readonly?: boolean;
|
|
31
|
+
flex?: boolean;
|
|
30
32
|
};
|
|
31
33
|
events: {
|
|
32
34
|
[evt: string]: CustomEvent<any>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import { _ } from 'svelte-i18n';
|
|
9
|
+
import { getRandomId } from '../../services/util';
|
|
9
10
|
import Button from '../button/button.svelte';
|
|
10
11
|
import Icon from '../icon/icon.svelte';
|
|
11
12
|
import TextInput from './text-input.svelte';
|
|
@@ -16,6 +17,11 @@
|
|
|
16
17
|
*/
|
|
17
18
|
let className = '';
|
|
18
19
|
export { className as class };
|
|
20
|
+
/**
|
|
21
|
+
* Make the text input container flexible.
|
|
22
|
+
* @type {boolean}
|
|
23
|
+
*/
|
|
24
|
+
export let flex = false;
|
|
19
25
|
/**
|
|
20
26
|
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
21
27
|
* @type {boolean | undefined}
|
|
@@ -61,6 +67,7 @@
|
|
|
61
67
|
*/
|
|
62
68
|
export let step = 1;
|
|
63
69
|
|
|
70
|
+
const id = getRandomId('input');
|
|
64
71
|
let edited = false;
|
|
65
72
|
|
|
66
73
|
$: maximumFractionDigits = String(step).split('.')[1]?.length || 0;
|
|
@@ -101,35 +108,43 @@
|
|
|
101
108
|
</script>
|
|
102
109
|
|
|
103
110
|
<div
|
|
111
|
+
role="none"
|
|
104
112
|
class="sui number-input {className}"
|
|
113
|
+
class:flex
|
|
105
114
|
class:disabled
|
|
106
115
|
class:readonly
|
|
107
116
|
hidden={hidden || undefined}
|
|
108
117
|
>
|
|
109
|
-
<div class="buttons">
|
|
118
|
+
<div role="none" class="buttons">
|
|
110
119
|
<Button
|
|
111
120
|
iconic
|
|
112
121
|
disabled={disabled || readonly || Number.isNaN(Number(value)) || isMax}
|
|
122
|
+
aria-label={$_('_sui.number_input.increase')}
|
|
123
|
+
aria-controls={id}
|
|
113
124
|
on:click={() => {
|
|
114
125
|
increase();
|
|
115
126
|
}}
|
|
116
127
|
>
|
|
117
|
-
<Icon slot="start-icon" name="expand_less"
|
|
128
|
+
<Icon slot="start-icon" name="expand_less" />
|
|
118
129
|
</Button>
|
|
119
130
|
<Button
|
|
120
131
|
iconic
|
|
121
132
|
disabled={disabled || readonly || Number.isNaN(Number(value)) || isMin}
|
|
133
|
+
aria-label={$_('_sui.number_input.decrease')}
|
|
134
|
+
aria-controls={id}
|
|
122
135
|
on:click={() => {
|
|
123
136
|
decrease();
|
|
124
137
|
}}
|
|
125
138
|
>
|
|
126
|
-
<Icon slot="start-icon" name="expand_more"
|
|
139
|
+
<Icon slot="start-icon" name="expand_more" />
|
|
127
140
|
</Button>
|
|
128
141
|
</div>
|
|
129
142
|
<TextInput
|
|
130
|
-
bind:this={component}
|
|
131
|
-
bind:value
|
|
132
143
|
role="spinbutton"
|
|
144
|
+
{id}
|
|
145
|
+
bind:value
|
|
146
|
+
spellcheck="false"
|
|
147
|
+
{flex}
|
|
133
148
|
{hidden}
|
|
134
149
|
{disabled}
|
|
135
150
|
{readonly}
|
|
@@ -140,6 +155,7 @@
|
|
|
140
155
|
aria-valuemax={max}
|
|
141
156
|
inputmode={maximumFractionDigits > 0 ? 'decimal' : 'numeric'}
|
|
142
157
|
{...$$restProps}
|
|
158
|
+
bind:this={component}
|
|
143
159
|
on:keydown={(event) => {
|
|
144
160
|
const { key, ctrlKey, metaKey, altKey, shiftKey } = event;
|
|
145
161
|
const hasModifier = shiftKey || altKey || ctrlKey || metaKey;
|
|
@@ -164,9 +180,16 @@
|
|
|
164
180
|
</div>
|
|
165
181
|
|
|
166
182
|
<style>.number-input {
|
|
167
|
-
width: 100%;
|
|
168
183
|
display: inline-flex;
|
|
169
184
|
align-items: center;
|
|
185
|
+
margin: var(--sui-focus-ring-width);
|
|
186
|
+
min-width: var(--sui-textbox-singleline-min-width);
|
|
187
|
+
}
|
|
188
|
+
.number-input.flex {
|
|
189
|
+
width: -moz-available;
|
|
190
|
+
width: -webkit-fill-available;
|
|
191
|
+
width: stretch;
|
|
192
|
+
min-width: 0;
|
|
170
193
|
}
|
|
171
194
|
.number-input :global(:not(:first-child) input) {
|
|
172
195
|
border-top-left-radius: 0;
|
|
@@ -182,6 +205,12 @@
|
|
|
182
205
|
.number-input:not(.disabled) :global(button[aria-disabled="true"]) :global(*) {
|
|
183
206
|
filter: grayscale(1) opacity(0.35);
|
|
184
207
|
}
|
|
208
|
+
.number-input :global(.text-input) {
|
|
209
|
+
flex: auto;
|
|
210
|
+
margin: 0 !important;
|
|
211
|
+
width: 0;
|
|
212
|
+
min-width: 0 !important;
|
|
213
|
+
}
|
|
185
214
|
|
|
186
215
|
.buttons {
|
|
187
216
|
display: flex;
|
|
@@ -191,6 +220,7 @@
|
|
|
191
220
|
}
|
|
192
221
|
.buttons :global(button) {
|
|
193
222
|
flex: none;
|
|
223
|
+
margin: 0 !important;
|
|
194
224
|
border-width: 1px;
|
|
195
225
|
border-color: var(--sui-textbox-border-color);
|
|
196
226
|
width: 100%;
|
|
@@ -18,6 +18,7 @@ export default class NumberInput extends SvelteComponent<{
|
|
|
18
18
|
value?: string;
|
|
19
19
|
hidden?: boolean;
|
|
20
20
|
readonly?: boolean;
|
|
21
|
+
flex?: boolean;
|
|
21
22
|
}, {
|
|
22
23
|
keypress: KeyboardEvent;
|
|
23
24
|
input: Event;
|
|
@@ -42,6 +43,7 @@ declare const __propDef: {
|
|
|
42
43
|
value?: string | undefined;
|
|
43
44
|
hidden?: boolean | undefined;
|
|
44
45
|
readonly?: boolean;
|
|
46
|
+
flex?: boolean;
|
|
45
47
|
};
|
|
46
48
|
events: {
|
|
47
49
|
keypress: KeyboardEvent;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
9
|
import { _ } from 'svelte-i18n';
|
|
10
|
+
import { getRandomId } from '../../services/util';
|
|
10
11
|
import Button from '../button/button.svelte';
|
|
11
12
|
import Icon from '../icon/icon.svelte';
|
|
12
13
|
import TextInput from './text-input.svelte';
|
|
@@ -17,6 +18,11 @@
|
|
|
17
18
|
*/
|
|
18
19
|
let className = '';
|
|
19
20
|
export { className as class };
|
|
21
|
+
/**
|
|
22
|
+
* Make the text input container flexible.
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export let flex = false;
|
|
20
26
|
/**
|
|
21
27
|
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
22
28
|
* @type {boolean | undefined}
|
|
@@ -48,6 +54,8 @@
|
|
|
48
54
|
*/
|
|
49
55
|
export let value = undefined;
|
|
50
56
|
|
|
57
|
+
const id = getRandomId('input');
|
|
58
|
+
|
|
51
59
|
/**
|
|
52
60
|
* @type {TextInput}
|
|
53
61
|
*/
|
|
@@ -62,21 +70,26 @@
|
|
|
62
70
|
</script>
|
|
63
71
|
|
|
64
72
|
<div
|
|
73
|
+
role="none"
|
|
65
74
|
class="sui password-input {className}"
|
|
75
|
+
class:flex
|
|
66
76
|
class:disabled
|
|
67
77
|
class:readonly
|
|
68
78
|
hidden={hidden || undefined}
|
|
69
79
|
>
|
|
70
80
|
<TextInput
|
|
71
|
-
|
|
81
|
+
{id}
|
|
72
82
|
bind:value
|
|
73
83
|
type="password"
|
|
84
|
+
spellcheck="false"
|
|
85
|
+
{flex}
|
|
74
86
|
{hidden}
|
|
75
87
|
{disabled}
|
|
76
88
|
{readonly}
|
|
77
89
|
{required}
|
|
78
90
|
{invalid}
|
|
79
91
|
{...$$restProps}
|
|
92
|
+
bind:this={inputComponent}
|
|
80
93
|
on:input
|
|
81
94
|
on:keypress
|
|
82
95
|
on:change
|
|
@@ -85,22 +98,35 @@
|
|
|
85
98
|
iconic
|
|
86
99
|
disabled={disabled || readonly}
|
|
87
100
|
pressed={passwordVisible}
|
|
101
|
+
aria-label={$_(
|
|
102
|
+
passwordVisible ? '_sui.password_input.hide_password' : '_sui.password_input.show_password',
|
|
103
|
+
)}
|
|
104
|
+
aria-controls={id}
|
|
88
105
|
on:click={() => {
|
|
89
106
|
passwordVisible = !passwordVisible;
|
|
90
107
|
}}
|
|
91
108
|
>
|
|
92
|
-
<Icon
|
|
93
|
-
slot="start-icon"
|
|
94
|
-
name={passwordVisible ? 'visibility_off' : 'visibility'}
|
|
95
|
-
label={$_('_sui.password_input.show_password')}
|
|
96
|
-
/>
|
|
109
|
+
<Icon slot="start-icon" name={passwordVisible ? 'visibility_off' : 'visibility'} />
|
|
97
110
|
</Button>
|
|
98
111
|
</div>
|
|
99
112
|
|
|
100
113
|
<style>.password-input {
|
|
101
|
-
width: 100%;
|
|
102
114
|
display: inline-flex;
|
|
103
115
|
align-items: center;
|
|
116
|
+
margin: var(--sui-focus-ring-width);
|
|
117
|
+
min-width: var(--sui-textbox-singleline-min-width);
|
|
118
|
+
}
|
|
119
|
+
.password-input.flex {
|
|
120
|
+
width: -moz-available;
|
|
121
|
+
width: -webkit-fill-available;
|
|
122
|
+
width: stretch;
|
|
123
|
+
min-width: 0;
|
|
124
|
+
}
|
|
125
|
+
.password-input :global(.text-input) {
|
|
126
|
+
flex: auto;
|
|
127
|
+
margin: 0 !important;
|
|
128
|
+
width: 0;
|
|
129
|
+
min-width: 0 !important;
|
|
104
130
|
}
|
|
105
131
|
.password-input :global(input) {
|
|
106
132
|
border-top-right-radius: 0;
|
|
@@ -108,7 +134,7 @@
|
|
|
108
134
|
}
|
|
109
135
|
.password-input :global(button) {
|
|
110
136
|
flex: none;
|
|
111
|
-
margin
|
|
137
|
+
margin: 0 0 0 -1px;
|
|
112
138
|
border-width: 1px;
|
|
113
139
|
border-color: var(--sui-textbox-border-color);
|
|
114
140
|
width: var(--sui-textbox-height);
|
|
@@ -16,6 +16,7 @@ export default class PasswordInput extends SvelteComponent<{
|
|
|
16
16
|
value?: string;
|
|
17
17
|
hidden?: boolean;
|
|
18
18
|
readonly?: boolean;
|
|
19
|
+
flex?: boolean;
|
|
19
20
|
}, {
|
|
20
21
|
input: Event;
|
|
21
22
|
keypress: KeyboardEvent;
|
|
@@ -38,6 +39,7 @@ declare const __propDef: {
|
|
|
38
39
|
value?: string | undefined;
|
|
39
40
|
hidden?: boolean | undefined;
|
|
40
41
|
readonly?: boolean;
|
|
42
|
+
flex?: boolean;
|
|
41
43
|
};
|
|
42
44
|
events: {
|
|
43
45
|
input: Event;
|