@reuters-graphics/graphics-components 0.0.8 → 0.0.11

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.
@@ -14,7 +14,15 @@
14
14
  export let minFrameWidth = 320;
15
15
  export let maxFrameWidth = 1200;
16
16
 
17
- let activeEmbed = embeds[0];
17
+ const getDefaultEmbed = () => {
18
+ if (typeof window === 'undefined') return embeds[0];
19
+ const lastActiveEmbed = window.localStorage.getItem('framer-active-embed');
20
+ if (!lastActiveEmbed) return embeds[0];
21
+ if (embeds.indexOf(lastActiveEmbed) > -1) return lastActiveEmbed;
22
+ return embeds[0];
23
+ };
24
+
25
+ let activeEmbed = getDefaultEmbed();
18
26
 
19
27
  $: embedTitles = getUniqNames(embeds);
20
28
 
@@ -60,12 +68,18 @@
60
68
  </div>
61
69
  <Typeahead
62
70
  label="Select an embed"
63
- value="{embedTitles[0]}"
71
+ value="{embedTitles[embeds.indexOf(activeEmbed)]}"
64
72
  extract="{(d) => embedTitles[d.index]}"
65
73
  data="{embeds.map((embed, index) => ({ index, embed }))}"
66
74
  placeholder="{'Search'}"
67
75
  showDropdownOnFocus="{true}"
68
76
  on:select="{({ detail }) => {
77
+ if (typeof window !== 'undefined') {
78
+ window.localStorage.setItem(
79
+ 'framer-active-embed',
80
+ detail.original.embed
81
+ );
82
+ }
69
83
  activeEmbed = detail.original.embed;
70
84
  }}"
71
85
  />
@@ -272,7 +272,7 @@ ul {
272
272
  position: absolute;
273
273
  top: 100%;
274
274
  left: 0;
275
- width: calc(100% - 2px);
275
+ width: 100%;
276
276
  padding: 0;
277
277
  margin: 0;
278
278
  list-style: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "0.0.8",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",