@soleil-se/config-svelte 1.9.0 → 1.10.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/CHANGELOG.md CHANGED
@@ -5,170 +5,117 @@ 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.9.0] - 2021-12-06
8
+ ## [1.10.0] - 2022-03-07
9
9
 
10
- ### Added
10
+ - Added `multiple` prop for [CustomSelector](./components/CustomSelector).
11
+ - First value is always selected in [RadioGroup](./components/RadioGroup) if nothing is selected.
11
12
 
12
- - [CustomSelector](./components/CustomSelector)
13
+ ## [1.9.0] - 2021-12-06
13
14
 
14
- ## [1.8.4] - 2021-12-03
15
+ - Added [CustomSelector](./components/CustomSelector)
15
16
 
16
- ### Fixed
17
+ ## [1.8.4] - 2021-12-03
17
18
 
18
- - Removable prop was not working on NodeSelector
19
+ - Removable prop was not working on NodeSelector.
19
20
 
20
21
  ## [1.8.3] - 2021-12-01
21
22
 
22
- ### Fixed
23
-
24
23
  - Remove hidden input for LinkSelector to fix bug with trashed / removed pages and files introduced in Sitevision 9.1.
25
24
 
26
25
  ## [1.8.2] - 2021-11-26
27
26
 
28
- ### Fixed
29
-
30
27
  - Use nullish coalescing when determining option value in SelectField.
31
28
 
32
29
  ## [1.8.1] - 2021-11-19
33
30
 
34
- ### Fixed
35
-
36
31
  - Empty mounting point of app since hydration is disabled.
37
32
 
38
33
  ## [1.8.0] - 2021-11-18
39
34
 
40
- ### Changed
41
-
42
35
  - Improvements for passing server data to the app.
43
36
  - Remove `hydrate` option since we're never using SSR in config apps.
44
-
45
- ### Fixed
46
-
47
37
  - Properly target div with id `app_root` when rendering app.
48
38
 
49
39
  ## [1.7.0] - 2021-09-24
50
40
 
51
- ### Added
52
-
53
- - `sortable` prop for `ListSelector`.
41
+ - Added `sortable` prop for `ListSelector`.
54
42
 
55
43
  ## [1.6.0] - 2021-08-25
56
44
 
57
- ### Added
58
-
59
- - I18n utility.
60
- - Translations for components with translatable text.
45
+ - Added I18n utility.
46
+ - Added Translations for components with translatable text.
61
47
  - Spread rest props on input element in InputField.
62
48
  - Docs with links to readme for each component.
63
49
 
64
50
  ## [1.5.2] - 2021-08-18
65
51
 
66
- ### Fixed
67
-
68
52
  - DropdownSelector values was not saved properly when set multiple times.
69
53
 
70
54
  ## [1.5.1] - 2021-08-12
71
55
 
72
- ### Fixed
73
-
74
56
  - Initialization when rerendering or conditionally render DropdownSelectors.
75
57
 
76
58
  ## [1.5.0] - 2021-06-29
77
59
 
78
- ### Added
79
-
80
- - TagSelector component
60
+ - Added TagSelector component
81
61
 
82
62
  ## [1.4.0] - 2021-05-19
83
63
 
84
- ### Changed
85
-
86
64
  - TextList component rewrite.
87
65
  - Remove CheckboxGroup value workaround as it's not needed.
88
-
89
- ### Fixed
90
-
91
- - Type shorthand for ListSelector.
66
+ - Added type shorthand for ListSelector.
92
67
  - Was possible to circumvent alt-text requirement in ImageSelector
93
68
 
94
69
  ## [1.3.1] - 2021-04-29
95
70
 
96
- ### Fixed
97
-
98
71
  - Default value for LinkSelector type is not set.
99
72
  - ImageSelector does not clear alt-text from image archive.
100
73
 
101
74
  ## [1.3.0] - 2021-04-28
102
75
 
103
- ### Added
104
-
105
- - Type shorthands for DropdownSelector, NodeSelector and ListSelector.
76
+ - Added type shorthands for DropdownSelector, NodeSelector and ListSelector.
106
77
  - ImageSelector component.
107
-
108
- ### Fixed
109
-
110
- - Scroll problems.
78
+ - Fixed scroll problems.
111
79
 
112
80
  ## [1.2.1] - 2021-04-09
113
81
 
114
- ### Fixed
115
-
116
82
  - Mail and tel values in LinkSelector are prefixed with `mailto:` and `tel:`.
117
83
 
118
84
  ## [1.2.0] - 2021-03-30
119
85
 
120
- ### Added
121
-
122
86
  - Mail and tel types to LinkSelector.
123
87
  - Value in NumberSpinner is now left aligned.
124
-
125
- ### Fixed
126
-
127
- - Unable to clear value in LinkSelector.
88
+ - Fixed unable to clear value in LinkSelector.
128
89
 
129
90
  ## [1.1.2] - 2021-03-11
130
91
 
131
- ### Fixed
132
-
133
92
  - Unable to remove last item in TextList.
134
93
  - TextList is not validated when `required` prop is used
135
94
 
136
95
  ## [1.1.1] - 2021-02-02
137
96
 
138
- ### Fixed
139
-
140
- - Missing docs NumberSpinner.
97
+ - Added docs NumberSpinner.
141
98
 
142
99
  ## [1.1.0] - 2021-01-29
143
100
 
144
- ### Added
145
-
146
- - `suffix` prop to NumberSpinner.
101
+ - Added `suffix` prop to NumberSpinner.
147
102
 
148
103
  ## [1.0.4] - 2021-01-15
149
104
 
150
- ### Fixed
151
-
152
- - ListSelector inifity loop.
105
+ - Fix ListSelector inifity loop.
153
106
 
154
107
  ## [1.0.3] - 2021-01-11
155
108
 
156
- ### Fixed
157
-
158
109
  - Remove debug output.
159
110
 
160
111
  ## [1.0.2] - 2021-01-11
161
112
 
162
- ### Fixed
163
-
164
113
  - Array destructuring not working in TextList for IE11.
165
114
  - RadioGroup value not working in IE11.
166
115
  - Added missing polyfills for IE11 in docs and demo.
167
116
 
168
117
  ## [1.0.1] - 2020-12-08
169
118
 
170
- ### Fixed
171
-
172
119
  - Selectable props in NodeSelector, ListSelector and DropdownSelector now also accepts a string.
173
120
  - Margin on CheckboxGroup and RadioGroup controls.
174
121
 
@@ -13,9 +13,11 @@
13
13
  export let placeholder;
14
14
  export let required = false;
15
15
  export let disabled = false;
16
- export let value = '';
16
+ export let multiple = false;
17
+ export let value = multiple ? [] : '';
17
18
 
18
19
  value = name ? values[name] ?? value : value;
20
+ // value = value === Object(value) ? value.value : value;
19
21
 
20
22
  let className = '';
21
23
  export { className as class };
@@ -27,9 +29,8 @@
27
29
  dispatch('input', value);
28
30
  dispatch('change', value);
29
31
  });
30
- if (!value) {
31
- jQuery(el).val(null).trigger('change');
32
- }
32
+
33
+ jQuery(el).val(value).trigger('change');
33
34
  });
34
35
  </script>
35
36
 
@@ -44,10 +45,10 @@
44
45
  <label for={id} class="control-label {required ? 'control-label--required' : ''}">{label}</label>
45
46
  <select
46
47
  {id}
47
- {name}
48
48
  {required}
49
49
  {disabled}
50
- {value}
50
+ {multiple}
51
+ name={!multiple ? name : undefined}
51
52
  data-component="custom-selector"
52
53
  data-removable
53
54
  data-searchable={searchable ? '' : undefined}
@@ -60,4 +61,27 @@
60
61
  {/each}
61
62
  </select>
62
63
  <slot />
64
+ {#if multiple}
65
+ <select {name} {value} multiple hidden>
66
+ {#each options as option}
67
+ <option value={option.value ?? option} />
68
+ {/each}
69
+ </select>
70
+ {/if}
63
71
  </div>
72
+
73
+ <style>
74
+ div :global(.select2-container-multi .select2-search-choice-close) {
75
+ top: 3px;
76
+ }
77
+
78
+ div :global(.select2-container-multi ul.select2-choices) {
79
+ border: 1px solid #ccc;
80
+ box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
81
+ }
82
+
83
+ div :global(.select2-container-multi .select2-choices .select2-search-choice) {
84
+ padding: 4px 5px 4px 18px;
85
+ margin-top: 4px;
86
+ }
87
+ </style>
@@ -25,6 +25,7 @@ export let searchable = false;
25
25
  export let placeholder;
26
26
  export let required = false;
27
27
  export let disabled = false;
28
+ export let multiple = false;
28
29
  export let value = '';
29
30
  ```
30
31
 
@@ -7,10 +7,10 @@
7
7
 
8
8
  export let id = generateId();
9
9
  export let name;
10
- export let options;
10
+ export let options = [];
11
11
  export let legend;
12
12
  export let disabled = false;
13
- export let value = '';
13
+ export let value = options[0]?.value ?? options[0] ?? '';
14
14
  value = name ? values[name] ?? value : value;
15
15
 
16
16
  $: isDisabled = (option) => {
@@ -54,8 +54,8 @@
54
54
  <style lang="scss">
55
55
  legend {
56
56
  margin-bottom: 7px;
57
- font-weight: bold;
58
57
  font-size: 14px;
58
+ font-weight: bold;
59
59
  border-bottom: 0;
60
60
  }
61
61
 
@@ -74,13 +74,13 @@
74
74
  width: 16px;
75
75
  height: 16px;
76
76
  margin-right: 5px;
77
+ content: '';
77
78
  border: 1px solid #cacece;
78
79
  border-radius: 50%;
79
- content: '';
80
80
  }
81
81
 
82
82
  :global(.focus-visible) + &::before {
83
- box-shadow: 0 0 0 0.2rem rgba(66, 139, 202, 0.4);
83
+ box-shadow: 0 0 0 0.2rem rgb(66 139 202 / 40%);
84
84
  }
85
85
 
86
86
  input:checked + &::before {
@@ -94,9 +94,9 @@
94
94
  left: 5px;
95
95
  width: 6px;
96
96
  height: 6px;
97
+ content: '';
97
98
  background-color: white;
98
99
  border-radius: 50%;
99
- content: '';
100
100
  }
101
101
 
102
102
  &.disabled {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleil-se/config-svelte",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "main": "./index.js",
5
5
  "module": "./index.js",
6
6
  "svelte": "./index.js",