@soleil-se/config-svelte 1.18.2 → 1.20.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/.eslintrc.js +4 -0
- package/.prettierrc.js +1 -0
- package/.stylelintrc.js +3 -0
- package/CHANGELOG.md +8 -0
- package/components/CustomList/internal/SortableItem.svelte +1 -1
- package/components/Modal/Component.svelte +22 -19
- package/components/Modal/README.md +29 -6
- package/components/RadioGroup/Component.svelte +5 -5
- package/components/TextList/internal/Item.svelte +5 -5
- package/package.json +14 -5
package/.eslintrc.js
ADDED
package/.prettierrc.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@soleil/eslint-config-sitevision/svelte.prettier');
|
package/.stylelintrc.js
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.20.0] - 2023-09-25
|
|
9
|
+
|
|
10
|
+
- Add footer slot in [Modal](./components/Modal).
|
|
11
|
+
|
|
12
|
+
## [1.19.0] - 2023-05-17
|
|
13
|
+
|
|
14
|
+
- Add Svelte 4 support.
|
|
15
|
+
|
|
8
16
|
## [1.18.2] - 2023-05-17
|
|
9
17
|
|
|
10
18
|
- Add attribute `data-a11y-dialog-ignore-focus-trap` to select2 based dropdown content to remedy focus management.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<!-- This is handled by the click event on the edit button -->
|
|
21
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
21
|
+
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
|
|
22
22
|
<div class="list-component__item" on:dblclick={editItem} on:click>
|
|
23
23
|
{#if icon}
|
|
24
24
|
<i class="sv-list-icon {icon}" aria-hidden="true" />
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
/* eslint svelte/no-unused-svelte-ignore: "off" */
|
|
3
|
+
|
|
2
4
|
import validate from '@soleil-se/config-validate';
|
|
3
5
|
import { onMount, createEventDispatcher } from 'svelte';
|
|
4
6
|
import A11yDialog from 'a11y-dialog';
|
|
@@ -75,9 +77,7 @@
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
$:
|
|
79
|
-
toggle(open);
|
|
80
|
-
}
|
|
80
|
+
$: toggle(open);
|
|
81
81
|
|
|
82
82
|
function close() {
|
|
83
83
|
open = false;
|
|
@@ -133,25 +133,24 @@
|
|
|
133
133
|
<svelte:window on:keydown={handleEscape} />
|
|
134
134
|
<div
|
|
135
135
|
bind:this={element}
|
|
136
|
+
{id}
|
|
137
|
+
style:--duration="{duration}ms"
|
|
136
138
|
class="modal"
|
|
137
|
-
class:visible
|
|
138
139
|
class:transition
|
|
139
|
-
|
|
140
|
-
aria-labelledby={titleId}
|
|
140
|
+
class:visible
|
|
141
141
|
aria-hidden="true"
|
|
142
|
-
|
|
142
|
+
aria-labelledby={titleId}
|
|
143
143
|
>
|
|
144
|
-
<!-- This is handled by the keydown event on svelte:window-->
|
|
145
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
144
|
+
<!-- This is handled by the keydown event on svelte:window -->
|
|
145
|
+
<!-- svelte-ignore a11y-no-static-element-interactions a11y-click-events-have-key-events -->
|
|
146
146
|
<div class="overlay" on:click={close} />
|
|
147
147
|
<div class="modal-dialog" role="document">
|
|
148
148
|
<div class="modal-content">
|
|
149
149
|
<div class="modal-header">
|
|
150
|
-
<button
|
|
150
|
+
<button class="close" aria-label="Stäng" type="button" on:click={close}>
|
|
151
151
|
<span aria-hidden="true">×</span>
|
|
152
152
|
<spanc class="sr-only">{i18n('close')}</spanc>
|
|
153
153
|
</button>
|
|
154
|
-
<h1 id={titleId} class="modal-title">{title}</h1>
|
|
155
154
|
</div>
|
|
156
155
|
<div class="modal-body">
|
|
157
156
|
{#if renderContent}
|
|
@@ -159,10 +158,17 @@
|
|
|
159
158
|
{/if}
|
|
160
159
|
</div>
|
|
161
160
|
<div class="modal-footer">
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
<slot name="footer">
|
|
162
|
+
<button class="btn btn-default" type="button" on:click={close}>{i18n('cancel')}</button>
|
|
163
|
+
<button
|
|
164
|
+
bind:this={saveButtonElement}
|
|
165
|
+
class="btn btn-primary"
|
|
166
|
+
type="button"
|
|
167
|
+
on:click={save}
|
|
168
|
+
>
|
|
169
|
+
{i18n('save')}
|
|
170
|
+
</button>
|
|
171
|
+
</slot>
|
|
166
172
|
</div>
|
|
167
173
|
</div>
|
|
168
174
|
</div>
|
|
@@ -172,10 +178,7 @@
|
|
|
172
178
|
.modal,
|
|
173
179
|
.overlay {
|
|
174
180
|
position: fixed;
|
|
175
|
-
|
|
176
|
-
right: 0;
|
|
177
|
-
bottom: 0;
|
|
178
|
-
left: 0;
|
|
181
|
+
inset: 0;
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
.modal {
|
|
@@ -32,12 +32,12 @@ export let element; // Modal DOM element.
|
|
|
32
32
|
<script>
|
|
33
33
|
import { Panel, Modal, InputField, NodeSelector } from '@soleil-se/svelte-config';
|
|
34
34
|
|
|
35
|
-
let
|
|
35
|
+
let open = false;
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<Panel>
|
|
39
|
-
<button class="btn btn-primary" on:click={() => (
|
|
40
|
-
<Modal title="Edit" bind:open
|
|
39
|
+
<button class="btn btn-primary" on:click={() => (open = true)}>Modal</button>
|
|
40
|
+
<Modal title="Edit" bind:open>
|
|
41
41
|
<InputField name="textModal" label="Text in modal" />
|
|
42
42
|
<NodeSelector name="pageModal" label="Page in modal" />
|
|
43
43
|
</Modal>
|
|
@@ -55,12 +55,14 @@ Advanced configs are **not** recommended.
|
|
|
55
55
|
|
|
56
56
|
export let values;
|
|
57
57
|
|
|
58
|
+
let open = false;
|
|
59
|
+
|
|
58
60
|
onSave(() => values);
|
|
59
61
|
</script>
|
|
60
62
|
|
|
61
63
|
<Panel>
|
|
62
|
-
<button class="btn btn-primary" on:click={() => (
|
|
63
|
-
<Modal title="Edit" bind:open
|
|
64
|
+
<button class="btn btn-primary" on:click={() => (open = true)}>Modal</button>
|
|
65
|
+
<Modal title="Edit" bind:open>
|
|
64
66
|
<InputField name="textModal" bind:value={values.textModal} label="Text in modal" />
|
|
65
67
|
<NodeSelector name="pageModal" bind:value={values.nodeModal} label="Page in modal" />
|
|
66
68
|
</Modal>
|
|
@@ -72,8 +74,29 @@ Advanced configs are **not** recommended.
|
|
|
72
74
|
* `--modal-width` - Width of modal, default is 600px.
|
|
73
75
|
|
|
74
76
|
```svelte
|
|
75
|
-
<Modal title="Edit" bind:open
|
|
77
|
+
<Modal title="Edit" bind:open --modal-width="800px">
|
|
76
78
|
<InputField name="textModal" label="Text in modal" />
|
|
77
79
|
<NodeSelector name="pageModal" label="Page in modal" />
|
|
78
80
|
</Modal>
|
|
79
81
|
```
|
|
82
|
+
|
|
83
|
+
### Slots
|
|
84
|
+
|
|
85
|
+
* `default` - Modal content.
|
|
86
|
+
* `footer` - Modal footer.
|
|
87
|
+
|
|
88
|
+
```svelte
|
|
89
|
+
<script>
|
|
90
|
+
import { Modal } from '@soleil-se/svelte-config';
|
|
91
|
+
|
|
92
|
+
let open = false;
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<Modal title="More info" bind:open>
|
|
96
|
+
<p>Content in default slot.</p>
|
|
97
|
+
|
|
98
|
+
<svelte:fragment slot="footer">
|
|
99
|
+
<button class="btn btn-primary" type="button" on:click={() => (open = false)}>OK</button>
|
|
100
|
+
</svelte:fragment>
|
|
101
|
+
</Modal>
|
|
102
|
+
```
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
{#each options as option, index}
|
|
38
38
|
<input
|
|
39
39
|
id={`${id}_${index}`}
|
|
40
|
-
|
|
41
|
-
value={option.value || option}
|
|
40
|
+
class="sr-only"
|
|
42
41
|
checked={option.value || option}
|
|
43
42
|
disabled={isDisabled(option)}
|
|
44
43
|
type="radio"
|
|
45
|
-
|
|
44
|
+
value={option.value || option}
|
|
45
|
+
bind:group={value}
|
|
46
46
|
on:change={onChange}
|
|
47
47
|
/>
|
|
48
|
-
<label
|
|
48
|
+
<label class="radio-inline" class:disabled={isDisabled(option)} for={`${id}_${index}`}>
|
|
49
49
|
{option.label || option}
|
|
50
50
|
</label>
|
|
51
51
|
{/each}
|
|
52
|
-
<input type="hidden" {value}
|
|
52
|
+
<input {name} type="hidden" {value} />
|
|
53
53
|
</fieldset>
|
|
54
54
|
|
|
55
55
|
<style lang="scss">
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
<div class="form-group">
|
|
59
59
|
<div class="input-group">
|
|
60
60
|
<input
|
|
61
|
+
bind:this={inputElement}
|
|
61
62
|
{id}
|
|
62
|
-
bind:value
|
|
63
|
-
type="text"
|
|
64
63
|
class="form-control"
|
|
64
|
+
type="text"
|
|
65
|
+
bind:value
|
|
65
66
|
on:keypress={handleKeypress}
|
|
66
|
-
bind:this={inputElement}
|
|
67
67
|
/>
|
|
68
68
|
|
|
69
69
|
<span class="input-group-btn">
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
79
79
|
{:else}
|
|
80
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
80
81
|
<div on:dblclick={editItem}>
|
|
81
82
|
<span class="item-name">{value}</span>
|
|
82
83
|
<div class="list-component__item-actions">
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
padding: 0;
|
|
108
109
|
background: none;
|
|
109
110
|
border: none;
|
|
110
|
-
|
|
111
|
+
appearance: none;
|
|
111
112
|
appearance: none;
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -115,5 +116,4 @@
|
|
|
115
116
|
display: inline-block;
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
|
|
119
119
|
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soleil-se/config-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"svelte": "./index.js",
|
|
@@ -9,16 +9,25 @@
|
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"@sitevision/api": "*",
|
|
12
|
-
"svelte": "^3.46.0"
|
|
12
|
+
"svelte": "^3.46.0 || ^4.0.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"
|
|
15
|
+
"@soleil-se/eslint-config": "^5.1.0",
|
|
16
|
+
"@soleil-se/stylelint-config": "^3.0.0",
|
|
17
|
+
"eslint": "^8.43.0",
|
|
18
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
19
|
+
"eslint-config-prettier": "^8.8.0",
|
|
20
|
+
"eslint-plugin-import": "^2.27.5",
|
|
21
|
+
"eslint-plugin-svelte": "^2.31.1",
|
|
22
|
+
"stylelint": "^15.9.0",
|
|
23
|
+
"svelte": "^4.0.0",
|
|
24
|
+
"svelte-preprocess": "^5.0.4"
|
|
16
25
|
},
|
|
17
26
|
"dependencies": {
|
|
18
27
|
"@soleil-se/config-validate": "^1.1.2",
|
|
19
|
-
"a11y-dialog": "7.
|
|
28
|
+
"a11y-dialog": "7.5.2",
|
|
20
29
|
"focus-visible": "^5.2.0",
|
|
21
|
-
"svelte-dnd-action": "^0.9.
|
|
30
|
+
"svelte-dnd-action": "^0.9.22"
|
|
22
31
|
},
|
|
23
32
|
"homepage": "https://docs.soleil.se/packages/config-svelte",
|
|
24
33
|
"description": "A collection of Svelte components and utilities for WebApp, RESTApp and Widget configurations.",
|