@sveltia/ui 0.2.2 → 0.2.4
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/composite/calendar.svelte +4 -1
- package/package/components/composite/calendar.svelte.d.ts +1 -1
- package/package/components/composite/checkbox-group.svelte +2 -3
- package/package/components/composite/combobox.svelte +9 -6
- package/package/components/composite/combobox.svelte.d.ts +4 -4
- package/package/components/composite/disclosure.svelte +2 -2
- package/package/components/composite/grid.svelte +2 -2
- package/package/components/composite/grid.svelte.d.ts +1 -1
- package/package/components/composite/listbox.svelte +2 -2
- package/package/components/composite/listbox.svelte.d.ts +1 -1
- package/package/components/composite/menu-item-group.svelte +1 -1
- package/package/components/composite/menu.svelte +2 -2
- package/package/components/composite/menu.svelte.d.ts +1 -1
- package/package/components/composite/radio-button-group.svelte +2 -2
- package/package/components/composite/radio-button-group.svelte.d.ts +1 -1
- package/package/components/composite/select-button-group.svelte +2 -2
- package/package/components/composite/select-button-group.svelte.d.ts +1 -1
- package/package/components/composite/select.svelte +2 -2
- package/package/components/composite/select.svelte.d.ts +1 -1
- package/package/components/composite/tab-list.svelte +2 -2
- package/package/components/composite/tab-list.svelte.d.ts +1 -1
- package/package/components/core/button.svelte +9 -10
- package/package/components/core/button.svelte.d.ts +9 -9
- package/package/components/core/checkbox.svelte +7 -7
- package/package/components/core/checkbox.svelte.d.ts +1 -1
- package/package/components/core/dialog.svelte +13 -3
- package/package/components/core/dialog.svelte.d.ts +2 -2
- package/package/components/core/drawer.svelte +12 -2
- package/package/components/core/grid-cell.svelte +1 -2
- package/package/components/core/group.svelte +1 -1
- package/package/components/core/icon.svelte +1 -1
- package/package/components/core/menu-button.svelte +2 -2
- package/package/components/core/menu-button.svelte.d.ts +2 -2
- package/package/components/core/menu-item-checkbox.svelte +1 -1
- package/package/components/core/menu-item-radio.svelte +1 -1
- package/package/components/core/number-input.svelte +8 -2
- package/package/components/core/number-input.svelte.d.ts +1 -1
- package/package/components/core/option.svelte +1 -1
- package/package/components/core/password-input.svelte +2 -2
- package/package/components/core/password-input.svelte.d.ts +1 -1
- package/package/components/core/radio-button.svelte +5 -5
- package/package/components/core/radio-button.svelte.d.ts +1 -1
- package/package/components/core/row-group.svelte +1 -2
- package/package/components/core/row.svelte +1 -2
- package/package/components/core/search-bar.svelte +2 -2
- package/package/components/core/select-button.svelte +1 -1
- package/package/components/core/separator.svelte +2 -1
- package/package/components/core/separator.svelte.d.ts +2 -2
- package/package/components/core/slider.svelte +25 -3
- package/package/components/core/spacer.svelte +2 -2
- package/package/components/core/switch.svelte +1 -1
- package/package/components/core/tab-panel.svelte +1 -2
- package/package/components/core/tab.svelte +1 -1
- package/package/components/core/text-area.svelte +53 -16
- package/package/components/core/text-area.svelte.d.ts +2 -2
- package/package/components/core/text-input.svelte +4 -4
- package/package/components/core/text-input.svelte.d.ts +5 -5
- package/package/components/core/toolbar.svelte +1 -2
- package/package/components/editor/markdown.svelte +1 -1
- package/package/components/editor/markdown.svelte.d.ts +1 -1
- package/package/components/helpers/group.d.ts +1 -37
- package/package/components/helpers/group.js +23 -18
- package/package/components/helpers/popup.d.ts +1 -2
- package/package/components/helpers/popup.js +8 -7
- package/package/components/helpers/util.js +6 -0
- package/package/components/util/app-shell.svelte +7 -1
- package/package/components/util/misc.js +0 -2
- package/package/components/util/popup.svelte +14 -4
- package/package/components/util/popup.svelte.d.ts +10 -10
- package/package/components/util/portal.svelte +1 -1
- package/package/index.d.ts +4 -1
- package/package/index.js +45 -0
- package/package/typedef.d.ts +1 -0
- package/package/typedef.js +4 -0
- package/package.json +15 -17
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import Separator from '../core/separator.svelte';
|
|
6
6
|
import Spacer from '../core/spacer.svelte';
|
|
7
7
|
|
|
8
|
-
/** @type {
|
|
8
|
+
/** @type {string?} */
|
|
9
9
|
export let value = undefined;
|
|
10
10
|
|
|
11
11
|
const dayList = [];
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
$: firstDayOfMonth = new Date(date.getUTCFullYear(), date.getUTCMonth(), 1);
|
|
17
17
|
$: firstDay = new Date(firstDayOfMonth);
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
19
22
|
const getWeeks = () => {
|
|
20
23
|
const cursor = new Date(firstDay);
|
|
21
24
|
|
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
<script>
|
|
6
6
|
/**
|
|
7
7
|
* CSS class name on the button.
|
|
8
|
-
* @type {
|
|
8
|
+
* @type {string}
|
|
9
9
|
*/
|
|
10
|
-
// eslint-disable-next-line padding-line-between-statements
|
|
11
10
|
let className = '';
|
|
12
11
|
|
|
13
12
|
export { className as class };
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* The `aria-label` attribute on the button element.
|
|
17
|
-
* @type {
|
|
16
|
+
* @type {string}
|
|
18
17
|
*/
|
|
19
18
|
export let ariaLabel = '';
|
|
20
19
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* CSS class name on the button.
|
|
19
|
-
* @type {
|
|
19
|
+
* @type {string}
|
|
20
20
|
*/
|
|
21
21
|
let className = '';
|
|
22
22
|
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Selected option’s value.
|
|
42
|
-
* @type {(
|
|
42
|
+
* @type {(string | number | undefined)}
|
|
43
43
|
*/
|
|
44
44
|
export let value = undefined;
|
|
45
45
|
|
|
46
46
|
const dispatch = createEventDispatcher();
|
|
47
47
|
const id = getRandomId('combobox');
|
|
48
48
|
let comboboxElement;
|
|
49
|
-
/** @type {
|
|
49
|
+
/** @type {TextInput?} */
|
|
50
50
|
let inputComponent;
|
|
51
|
-
/** @type {
|
|
51
|
+
/** @type {Popup?} */
|
|
52
52
|
let popupComponent;
|
|
53
53
|
let isPopupOpen = writable(false);
|
|
54
54
|
</script>
|
|
@@ -117,8 +117,11 @@
|
|
|
117
117
|
bind:this={popupComponent}
|
|
118
118
|
>
|
|
119
119
|
<Listbox
|
|
120
|
-
on:click={(
|
|
121
|
-
if (target.matches('[role="option"]')) {
|
|
120
|
+
on:click={(event) => {
|
|
121
|
+
if (/** @type {HTMLElement} */ (event.target).matches('[role="option"]')) {
|
|
122
|
+
// eslint-disable-next-line prefer-destructuring
|
|
123
|
+
const target = /** @type {HTMLButtonElement?} */ (event.target);
|
|
124
|
+
|
|
122
125
|
// @todo support more types
|
|
123
126
|
value = target.dataset.type === 'number' ? Number(target.value) : target.value;
|
|
124
127
|
label = target.querySelector('.label')?.textContent || target.value;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
export default class Combobox extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
label?: string;
|
|
11
|
-
position?:
|
|
11
|
+
position?: PopupPosition;
|
|
12
12
|
class?: string;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
-
value?: string;
|
|
14
|
+
value?: string | number;
|
|
15
15
|
readOnly?: boolean;
|
|
16
16
|
}, {
|
|
17
17
|
change: CustomEvent<any>;
|
|
@@ -29,10 +29,10 @@ declare const __propDef: {
|
|
|
29
29
|
props: {
|
|
30
30
|
[x: string]: any;
|
|
31
31
|
label?: string;
|
|
32
|
-
position?:
|
|
32
|
+
position?: PopupPosition;
|
|
33
33
|
class?: string;
|
|
34
34
|
disabled?: boolean;
|
|
35
|
-
value?: (string | undefined);
|
|
35
|
+
value?: (string | number | undefined);
|
|
36
36
|
readOnly?: boolean;
|
|
37
37
|
};
|
|
38
38
|
events: {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
15
|
let className = '';
|
|
16
16
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<Icon name="expand_more" />
|
|
37
37
|
{label}
|
|
38
38
|
</Button>
|
|
39
|
-
<div class="content" id="{id}-content" hidden={!expanded ?
|
|
39
|
+
<div class="content" id="{id}-content" hidden={!expanded ? true : undefined}>
|
|
40
40
|
<slot />
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* CSS class name on the button.
|
|
6
|
-
* @type {
|
|
6
|
+
* @type {string}
|
|
7
7
|
*/
|
|
8
8
|
let className = '';
|
|
9
9
|
|
|
10
10
|
export { className as class };
|
|
11
11
|
|
|
12
|
-
/** @type {
|
|
12
|
+
/** @type {HTMLElement?} */
|
|
13
13
|
export let element = undefined;
|
|
14
14
|
</script>
|
|
15
15
|
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
15
|
let className = '';
|
|
16
16
|
|
|
17
17
|
export { className as class };
|
|
18
18
|
|
|
19
|
-
/** @type {
|
|
19
|
+
/** @type {HTMLElement?} */
|
|
20
20
|
export let element = undefined;
|
|
21
21
|
|
|
22
22
|
export let multiple = false;
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
15
|
let className = '';
|
|
16
16
|
|
|
17
17
|
export { className as class };
|
|
18
18
|
|
|
19
|
-
/** @type {
|
|
19
|
+
/** @type {HTMLElement?} */
|
|
20
20
|
export let element = undefined;
|
|
21
21
|
</script>
|
|
22
22
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* CSS class name on the button.
|
|
12
|
-
* @type {
|
|
12
|
+
* @type {string}
|
|
13
13
|
*/
|
|
14
14
|
let className = '';
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
/** @type {('horizontal'|'vertical')} */
|
|
19
19
|
export let orientation = 'horizontal';
|
|
20
20
|
|
|
21
|
-
/** @type {
|
|
21
|
+
/** @type {HTMLElement?} */
|
|
22
22
|
export let element = undefined;
|
|
23
23
|
</script>
|
|
24
24
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
15
|
let className = '';
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
const dispatch = createEventDispatcher();
|
|
24
24
|
|
|
25
|
-
/** @type {
|
|
25
|
+
/** @type {HTMLElement?} */
|
|
26
26
|
export let element = undefined;
|
|
27
27
|
|
|
28
28
|
$: {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* CSS class name on the button.
|
|
10
|
-
* @type {
|
|
10
|
+
* @type {string}
|
|
11
11
|
*/
|
|
12
12
|
let className = '';
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Selected option’s value.
|
|
20
|
-
* @type {
|
|
20
|
+
* @type {string?}
|
|
21
21
|
*/
|
|
22
22
|
export let value = undefined;
|
|
23
23
|
</script>
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
15
|
let className = '';
|
|
16
16
|
|
|
17
17
|
export { className as class };
|
|
18
18
|
|
|
19
|
-
/** @type {
|
|
19
|
+
/** @type {HTMLElement?} */
|
|
20
20
|
export let element = undefined;
|
|
21
21
|
|
|
22
22
|
/** @type {('horizontal'|'vertical')} */
|
|
@@ -10,16 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
|
-
// eslint-disable-next-line padding-line-between-statements
|
|
16
15
|
let className = '';
|
|
17
16
|
|
|
18
17
|
export { className as class };
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Reference to the button element.
|
|
22
|
-
* @type {
|
|
21
|
+
* @type {HTMLButtonElement?}
|
|
23
22
|
*/
|
|
24
23
|
export let element = undefined;
|
|
25
24
|
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* The `role` attribute on the button element.
|
|
34
|
-
* @type {
|
|
33
|
+
* @type {string}
|
|
35
34
|
*/
|
|
36
35
|
export let role = 'button';
|
|
37
36
|
|
|
@@ -43,25 +42,25 @@
|
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* Whether the button is hidden.
|
|
46
|
-
* @type {
|
|
45
|
+
* @type {boolean}
|
|
47
46
|
*/
|
|
48
47
|
export let hidden = false;
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
50
|
* Whether the button is disabled.
|
|
52
|
-
* @type {
|
|
51
|
+
* @type {boolean}
|
|
53
52
|
*/
|
|
54
53
|
export let disabled = false;
|
|
55
54
|
|
|
56
55
|
/**
|
|
57
56
|
* The `aria-pressed` attribute on the button element.
|
|
58
|
-
* @type {(
|
|
57
|
+
* @type {(boolean | 'false' | 'mixed' | 'true' | undefined)}
|
|
59
58
|
*/
|
|
60
59
|
export let pressed = undefined;
|
|
61
60
|
|
|
62
61
|
/**
|
|
63
62
|
* Text label displayed on the button.
|
|
64
|
-
* @type {
|
|
63
|
+
* @type {string}
|
|
65
64
|
*/
|
|
66
65
|
export let label = '';
|
|
67
66
|
|
|
@@ -78,8 +77,8 @@
|
|
|
78
77
|
<button
|
|
79
78
|
{type}
|
|
80
79
|
{role}
|
|
81
|
-
hidden={hidden ?
|
|
82
|
-
disabled={disabled ?
|
|
80
|
+
hidden={hidden ? true : undefined}
|
|
81
|
+
disabled={disabled ? true : undefined}
|
|
83
82
|
class="sui button {size} {className}"
|
|
84
83
|
aria-hidden={hidden ? true : undefined}
|
|
85
84
|
aria-disabled={disabled ? true : undefined}
|
|
@@ -15,8 +15,8 @@ export default class Button extends SvelteComponentTyped<{
|
|
|
15
15
|
size?: "small" | "medium" | "large";
|
|
16
16
|
hidden?: boolean;
|
|
17
17
|
disabled?: boolean;
|
|
18
|
-
pressed?:
|
|
19
|
-
popupPosition?:
|
|
18
|
+
pressed?: boolean | "true" | "false" | "mixed";
|
|
19
|
+
popupPosition?: PopupPosition;
|
|
20
20
|
}, {
|
|
21
21
|
mouseenter: MouseEvent;
|
|
22
22
|
mouseleave: MouseEvent;
|
|
@@ -58,14 +58,14 @@ export default class Button extends SvelteComponentTyped<{
|
|
|
58
58
|
set disabled(arg: boolean);
|
|
59
59
|
get disabled(): boolean;
|
|
60
60
|
/**accessor*/
|
|
61
|
-
set pressed(arg:
|
|
62
|
-
get pressed():
|
|
61
|
+
set pressed(arg: boolean | "true" | "false" | "mixed");
|
|
62
|
+
get pressed(): boolean | "true" | "false" | "mixed";
|
|
63
63
|
/**accessor*/
|
|
64
64
|
set label(arg: string);
|
|
65
65
|
get label(): string;
|
|
66
66
|
/**accessor*/
|
|
67
|
-
set popupPosition(arg:
|
|
68
|
-
get popupPosition():
|
|
67
|
+
set popupPosition(arg: PopupPosition);
|
|
68
|
+
get popupPosition(): PopupPosition;
|
|
69
69
|
}
|
|
70
70
|
export type ButtonProps = typeof __propDef.props;
|
|
71
71
|
export type ButtonEvents = typeof __propDef.events;
|
|
@@ -76,14 +76,14 @@ declare const __propDef: {
|
|
|
76
76
|
[x: string]: any;
|
|
77
77
|
label?: string;
|
|
78
78
|
class?: string;
|
|
79
|
-
element?:
|
|
79
|
+
element?: HTMLButtonElement | null;
|
|
80
80
|
type?: ('button' | 'submit' | 'reset');
|
|
81
81
|
role?: string;
|
|
82
82
|
size?: ('small' | 'medium' | 'large');
|
|
83
83
|
hidden?: boolean;
|
|
84
84
|
disabled?: boolean;
|
|
85
|
-
pressed?: (boolean |
|
|
86
|
-
popupPosition?:
|
|
85
|
+
pressed?: (boolean | 'false' | 'mixed' | 'true' | undefined);
|
|
86
|
+
popupPosition?: PopupPosition;
|
|
87
87
|
};
|
|
88
88
|
events: {
|
|
89
89
|
mouseenter: MouseEvent;
|
|
@@ -11,25 +11,25 @@
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* CSS class name on the button.
|
|
14
|
-
* @type {
|
|
14
|
+
* @type {string}
|
|
15
15
|
*/
|
|
16
16
|
let className = '';
|
|
17
17
|
|
|
18
18
|
export { className as class };
|
|
19
19
|
|
|
20
|
-
/** @type {
|
|
20
|
+
/** @type {string} */
|
|
21
21
|
export let name = '';
|
|
22
22
|
|
|
23
|
-
/** @type {
|
|
23
|
+
/** @type {string?} */
|
|
24
24
|
export let value = undefined;
|
|
25
25
|
|
|
26
|
-
/** @type {(
|
|
26
|
+
/** @type {(boolean | string | undefined)} */
|
|
27
27
|
export let checked = false;
|
|
28
28
|
|
|
29
|
-
/** @type {
|
|
29
|
+
/** @type {boolean} */
|
|
30
30
|
export let indeterminate = false;
|
|
31
31
|
|
|
32
|
-
/** @type {
|
|
32
|
+
/** @type {boolean} */
|
|
33
33
|
export let disabled = false;
|
|
34
34
|
|
|
35
35
|
const dispatch = createEventDispatcher();
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
class:indeterminate
|
|
50
50
|
class:disabled
|
|
51
51
|
on:click|preventDefault|stopPropagation={(event) => {
|
|
52
|
-
if (!event.target.matches('button')) {
|
|
52
|
+
if (!(/** @type {HTMLElement} */ (event.target).matches('button'))) {
|
|
53
53
|
button.element.click();
|
|
54
54
|
}
|
|
55
55
|
}}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* CSS class name on the button.
|
|
15
|
-
* @type {
|
|
15
|
+
* @type {string}
|
|
16
16
|
*/
|
|
17
17
|
let className = '';
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Width of the dialog.
|
|
27
|
-
* @type {('small'|'medium'|'large')}
|
|
27
|
+
* @type {('small' | 'medium' | 'large' | 'x-large')}
|
|
28
28
|
*/
|
|
29
29
|
export let size = 'medium';
|
|
30
30
|
|
|
@@ -54,6 +54,9 @@
|
|
|
54
54
|
let showDialog = false;
|
|
55
55
|
let showContent = false;
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
57
60
|
const openDialog = async () => {
|
|
58
61
|
(document.querySelector('.sui.app-shell') || document.body).appendChild(dialog);
|
|
59
62
|
showContent = true;
|
|
@@ -69,6 +72,9 @@
|
|
|
69
72
|
});
|
|
70
73
|
};
|
|
71
74
|
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
72
78
|
const closeDialog = async () => {
|
|
73
79
|
showDialog = false;
|
|
74
80
|
|
|
@@ -91,6 +97,9 @@
|
|
|
91
97
|
dialog?.remove();
|
|
92
98
|
};
|
|
93
99
|
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
94
103
|
const toggleDialog = () => {
|
|
95
104
|
if (dialog) {
|
|
96
105
|
if (open) {
|
|
@@ -102,6 +111,7 @@
|
|
|
102
111
|
};
|
|
103
112
|
|
|
104
113
|
// Call the function only when the `open` prop is changed
|
|
114
|
+
// @ts-ignore
|
|
105
115
|
$: toggleDialog(open);
|
|
106
116
|
|
|
107
117
|
onMount(() => {
|
|
@@ -121,7 +131,7 @@
|
|
|
121
131
|
class="sui dialog {className} {size}"
|
|
122
132
|
class:open={showDialog}
|
|
123
133
|
on:click={({ target }) => {
|
|
124
|
-
if (closeOnBackdropClick && target?.matches('dialog')) {
|
|
134
|
+
if (closeOnBackdropClick && /** @type {HTMLElement?} */ (target)?.matches('dialog')) {
|
|
125
135
|
dialog.returnValue = 'cancel';
|
|
126
136
|
open = false;
|
|
127
137
|
}
|
|
@@ -9,7 +9,7 @@ export default class Dialog extends SvelteComponentTyped<{
|
|
|
9
9
|
title?: string;
|
|
10
10
|
open?: boolean;
|
|
11
11
|
class?: string;
|
|
12
|
-
size?: "small" | "medium" | "large";
|
|
12
|
+
size?: "small" | "medium" | "large" | "x-large";
|
|
13
13
|
modal?: boolean;
|
|
14
14
|
showCancel?: boolean;
|
|
15
15
|
showOk?: boolean;
|
|
@@ -43,7 +43,7 @@ declare const __propDef: {
|
|
|
43
43
|
title?: string;
|
|
44
44
|
open?: boolean;
|
|
45
45
|
class?: string;
|
|
46
|
-
size?: ('small' | 'medium' | 'large');
|
|
46
|
+
size?: ('small' | 'medium' | 'large' | 'x-large');
|
|
47
47
|
modal?: boolean;
|
|
48
48
|
showCancel?: boolean;
|
|
49
49
|
showOk?: boolean;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* CSS class name on the button.
|
|
15
|
-
* @type {
|
|
15
|
+
* @type {string}
|
|
16
16
|
*/
|
|
17
17
|
let className = '';
|
|
18
18
|
|
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
|
|
62
62
|
$: orientation = position === 'right' || position === 'left' ? 'vertical' : 'horizontal';
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
64
67
|
const openDialog = async () => {
|
|
65
68
|
(document.querySelector('.sui.app-shell') || document.body).appendChild(dialog);
|
|
66
69
|
showContent = true;
|
|
@@ -71,6 +74,9 @@
|
|
|
71
74
|
});
|
|
72
75
|
};
|
|
73
76
|
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
74
80
|
const closeDialog = async () => {
|
|
75
81
|
showDialog = false;
|
|
76
82
|
|
|
@@ -93,6 +99,9 @@
|
|
|
93
99
|
dialog?.remove();
|
|
94
100
|
};
|
|
95
101
|
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
96
105
|
const toggleDialog = () => {
|
|
97
106
|
if (dialog) {
|
|
98
107
|
if (open) {
|
|
@@ -104,6 +113,7 @@
|
|
|
104
113
|
};
|
|
105
114
|
|
|
106
115
|
// Call the function only when the `open` prop is changed
|
|
116
|
+
// @ts-ignore
|
|
107
117
|
$: toggleDialog(open);
|
|
108
118
|
|
|
109
119
|
onMount(() => {
|
|
@@ -123,7 +133,7 @@
|
|
|
123
133
|
class="sui dialog {className} {size} {position} {orientation}"
|
|
124
134
|
class:open={showDialog}
|
|
125
135
|
on:click={({ target }) => {
|
|
126
|
-
if (closeOnBackdropClick && target?.matches('dialog')) {
|
|
136
|
+
if (closeOnBackdropClick && /** @type {HTMLElement?} */ (target)?.matches('dialog')) {
|
|
127
137
|
dialog.returnValue = 'cancel';
|
|
128
138
|
open = false;
|
|
129
139
|
}
|