@forsakringskassan/docs-live-example 1.4.4 → 1.4.5

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.
Files changed (3) hide show
  1. package/README.md +56 -1
  2. package/dist/main.css +14 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -52,7 +52,7 @@ Vi rekommenderar att använda `LiveExample` som suffix på alla live-exempel.
52
52
 
53
53
  Följande boilerplate kan användas:
54
54
 
55
- ```vue
55
+ ```vue static
56
56
  <template>
57
57
  <live-example :components :template :livedata>
58
58
  <!-- Example configuration -->
@@ -136,6 +136,61 @@ Det går också med fördel att använda `createElement` (se beskrivning längre
136
136
  },
137
137
  ```
138
138
 
139
+ Resultatet:
140
+
141
+ ```vue live-example
142
+ <template>
143
+ <live-example :template>
144
+ <div>
145
+ <label for="config-element"> Element </label>
146
+ <select id="config-element" v-model="tagName">
147
+ <option value="div">div</option>
148
+ <option value="p">p</option>
149
+ <option value="em">em</option>
150
+ </select>
151
+ </div>
152
+ <div>
153
+ <label>
154
+ <input
155
+ type="checkbox"
156
+ v-model="placeholderText"
157
+ :value="true"
158
+ />
159
+ Use placeholder text
160
+ </label>
161
+ </div>
162
+ </live-example>
163
+ </template>
164
+
165
+ <script lang="ts">
166
+ import { defineComponent } from "vue";
167
+ import {
168
+ LiveExample,
169
+ createElement,
170
+ } from "@forsakringskassan/docs-live-example";
171
+
172
+ export default defineComponent({
173
+ name: "AwesomeComponentLiveExample",
174
+ components: { LiveExample },
175
+ data() {
176
+ return {
177
+ tagName: "div",
178
+ placeholderText: false,
179
+ };
180
+ },
181
+ computed: {
182
+ template(): string {
183
+ const { tagName, placeholderText } = this;
184
+ const message = placeholderText
185
+ ? "Lorem ipsum dolor sit amet"
186
+ : "Hello World!";
187
+ return createElement(tagName, message);
188
+ },
189
+ },
190
+ });
191
+ </script>
192
+ ```
193
+
139
194
  ## `createElement`
140
195
 
141
196
  A helper function to render the markup for the live example.
package/dist/main.css CHANGED
@@ -9,14 +9,26 @@
9
9
 
10
10
  :root {
11
11
  --live-example-space: 1.5rem;
12
+ --live-example-controls-width: 17rem;
13
+ }
14
+
15
+ .code-preview {
16
+ container-type: inline-size;
17
+ container-name: example-container;
12
18
  }
13
19
 
14
20
  .live-example__container {
15
21
  border: var(--f-border-width-small) solid #ddddde;
16
22
  border-radius: 4px;
17
23
  display: grid;
18
- grid-template-columns: 1fr auto;
19
- grid-template-areas: "example controls" "code code";
24
+ grid-template-columns: 1fr;
25
+ grid-template-areas: "example" "controls" "code";
26
+ }
27
+ @container example-container (width >= 43.0379746835rem) {
28
+ .live-example__container {
29
+ grid-template-columns: 1fr var(--live-example-controls-width);
30
+ grid-template-areas: "example controls" "code code";
31
+ }
20
32
  }
21
33
  .live-example__example {
22
34
  grid-area: example;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/docs-live-example",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Components used for live examples",
5
5
  "keywords": [
6
6
  "documentation"