@soleil-se/config-svelte 1.25.1 → 1.26.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
@@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file.
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
+ ## [1.26.0] - 2024-05-21
11
+
12
+ - Add possibility to customize content for radio buttons in a radio group.
13
+
10
14
  ## [1.25.1] - 2024-05-13
11
15
 
12
16
  - Now possible to set default value in `SelectField` with `value` prop.
@@ -55,7 +55,9 @@
55
55
  class:disabled={isDisabled(option, disabled)}
56
56
  for={`${id}_${index}`}
57
57
  >
58
- {option.label || option}
58
+ <slot name="option" {option}>
59
+ {option.label || option}
60
+ </slot>
59
61
  </label>
60
62
  {/each}
61
63
  <input {name} type="hidden" {value} />
@@ -70,6 +70,45 @@ onSave(() => values);
70
70
  </Panel>
71
71
  ```
72
72
 
73
+ ## Slots
74
+
75
+ ### Default
76
+
77
+ Default slot after radio group.
78
+
79
+ ```svelte
80
+ <RadioGroup name="radioGroup" legend="Radio group" {options} />
81
+ <p class="help-block">Some helpful text.</p>
82
+ </RadioGroup>
83
+ ```
84
+
85
+ ### Legend
86
+
87
+ Slot for content in the legend element.
88
+
89
+ ```svelte
90
+ <RadioGroup name="radioGroup" {options} />
91
+ <svelte:fragment slot="legend">
92
+ Custom <em>legend</em>
93
+ </svelte:fragment>
94
+ </RadioGroup>
95
+ ```
96
+
97
+ ### Label
98
+
99
+ Slot for content in each radio buttons label.
100
+ The provided option parameter contains the full option object corresponding to the specific radio button
101
+ as provided in the slots array to the RadioGroup.
102
+
103
+ ```svelte
104
+ <RadioGroup name="radioGroup" {options} />
105
+ <svelte:fragment slot="option" let:option>
106
+ <span>{option.label || option}</span>
107
+ <span>Custom <em>content</em></span>
108
+ </svelte:fragment>
109
+ </RadioGroup>
110
+ ```
111
+
73
112
  ## Default value
74
113
 
75
114
  Use the value attribute to set a default value:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleil-se/config-svelte",
3
- "version": "1.25.1",
3
+ "version": "1.26.0",
4
4
  "main": "./index.js",
5
5
  "module": "./index.js",
6
6
  "svelte": "./index.js",