@ndla/ui 17.0.0 → 18.0.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.
Files changed (58) hide show
  1. package/es/Article/ArticleFavoritesButton.js +4 -3
  2. package/es/MyNdla/Resource/Folder.js +6 -6
  3. package/es/MyNdla/index.js +1 -2
  4. package/es/Resource/ListResource.js +6 -6
  5. package/es/TagSelector/SuggestionInput.js +111 -56
  6. package/es/TagSelector/Suggestions.js +19 -15
  7. package/es/TagSelector/TagSelector.js +8 -7
  8. package/es/TreeStructure/FolderItem.js +5 -5
  9. package/es/index.js +1 -1
  10. package/es/locale/messages-en.js +8 -1
  11. package/es/locale/messages-nb.js +9 -2
  12. package/es/locale/messages-nn.js +10 -3
  13. package/es/locale/messages-se.js +9 -2
  14. package/es/locale/messages-sma.js +9 -2
  15. package/lib/Article/ArticleFavoritesButton.js +4 -3
  16. package/lib/MyNdla/Resource/Folder.js +6 -6
  17. package/lib/MyNdla/index.d.ts +1 -2
  18. package/lib/MyNdla/index.js +0 -8
  19. package/lib/Resource/ListResource.js +6 -6
  20. package/lib/TagSelector/SuggestionInput.js +111 -57
  21. package/lib/TagSelector/Suggestions.js +26 -23
  22. package/lib/TagSelector/TagSelector.js +8 -7
  23. package/lib/TreeStructure/FolderItem.js +5 -5
  24. package/lib/index.d.ts +1 -1
  25. package/lib/index.js +0 -7
  26. package/lib/locale/messages-en.d.ts +7 -0
  27. package/lib/locale/messages-en.js +8 -1
  28. package/lib/locale/messages-nb.d.ts +7 -0
  29. package/lib/locale/messages-nb.js +9 -2
  30. package/lib/locale/messages-nn.d.ts +7 -0
  31. package/lib/locale/messages-nn.js +10 -3
  32. package/lib/locale/messages-se.d.ts +7 -0
  33. package/lib/locale/messages-se.js +9 -2
  34. package/lib/locale/messages-sma.d.ts +7 -0
  35. package/lib/locale/messages-sma.js +9 -2
  36. package/package.json +5 -5
  37. package/src/Article/ArticleFavoritesButton.tsx +4 -3
  38. package/src/MyNdla/Resource/Folder.tsx +1 -1
  39. package/src/MyNdla/index.ts +1 -2
  40. package/src/Resource/ListResource.tsx +1 -1
  41. package/src/TagSelector/SuggestionInput.tsx +90 -24
  42. package/src/TagSelector/Suggestions.tsx +14 -0
  43. package/src/TagSelector/TagSelector.tsx +6 -4
  44. package/src/TreeStructure/FolderItem.tsx +5 -2
  45. package/src/index.ts +1 -1
  46. package/src/locale/messages-en.ts +9 -1
  47. package/src/locale/messages-nb.ts +9 -2
  48. package/src/locale/messages-nn.ts +10 -3
  49. package/src/locale/messages-se.ts +9 -2
  50. package/src/locale/messages-sma.ts +9 -2
  51. package/es/MyNdla/Navigation/VerticalNavigation.js +0 -51
  52. package/es/MyNdla/Navigation/index.js +0 -2
  53. package/lib/MyNdla/Navigation/VerticalNavigation.d.ts +0 -10
  54. package/lib/MyNdla/Navigation/VerticalNavigation.js +0 -61
  55. package/lib/MyNdla/Navigation/index.d.ts +0 -2
  56. package/lib/MyNdla/Navigation/index.js +0 -15
  57. package/src/MyNdla/Navigation/VerticalNavigation.tsx +0 -93
  58. package/src/MyNdla/Navigation/index.ts +0 -2
@@ -64,6 +64,8 @@ declare const messages: {
64
64
  newFolderUnder: string;
65
65
  myAccount: string;
66
66
  favourites: string;
67
+ addToFavourites: string;
68
+ alreadyFavourited: string;
67
69
  help: string;
68
70
  more: string;
69
71
  listView: string;
@@ -124,6 +126,10 @@ declare const messages: {
124
126
  help: string;
125
127
  };
126
128
  treeStructure: {
129
+ folderChildOptions: {
130
+ edit: string;
131
+ delete: string;
132
+ };
127
133
  createFolder: string;
128
134
  newFolder: {
129
135
  placeholder: string;
@@ -131,6 +137,7 @@ declare const messages: {
131
137
  };
132
138
  };
133
139
  tagSelector: {
140
+ label: string;
134
141
  placeholder: string;
135
142
  removeTag: string;
136
143
  hideAllTags: string;
@@ -29,15 +29,20 @@ var titleTemplate = ' - NDLA';
29
29
 
30
30
  var messages = _objectSpread(_objectSpread({
31
31
  treeStructure: {
32
+ folderChildOptions: {
33
+ edit: 'Endre mappenamn',
34
+ "delete": 'Slett'
35
+ },
32
36
  createFolder: 'Lag mappe',
33
37
  newFolder: {
34
- placeholder: 'Skriv navn på mappe',
38
+ placeholder: 'Skriv namn på mappe',
35
39
  defaultName: 'Ny mappe'
36
40
  }
37
41
  },
38
42
  tagSelector: {
39
- placeholder: 'Tilknytt tag',
40
- removeTag: 'Ta vekk tilknytninga til {{name}}',
43
+ label: 'Legg til tag',
44
+ placeholder: 'Skriv tag namn',
45
+ removeTag: 'Ta vekk {{name}}',
41
46
  hideAllTags: 'Skjul alle tagger',
42
47
  showAllTags: 'Vis alle tagger'
43
48
  },
@@ -951,6 +956,8 @@ var messages = _objectSpread(_objectSpread({
951
956
  newFolderUnder: 'Lag ny mappe under {{folderName}}',
952
957
  myAccount: 'Min konto',
953
958
  favourites: 'Favorittar',
959
+ addToFavourites: 'Legg til i mine favorittar',
960
+ alreadyFavourited: 'Allereie lagt til i mine favorittar',
954
961
  help: 'Hjelp',
955
962
  more: 'Fleire val',
956
963
  listView: 'Listevisning',
@@ -64,6 +64,8 @@ declare const messages: {
64
64
  newFolderUnder: string;
65
65
  myAccount: string;
66
66
  favourites: string;
67
+ addToFavourites: string;
68
+ alreadyFavourited: string;
67
69
  help: string;
68
70
  more: string;
69
71
  listView: string;
@@ -124,6 +126,10 @@ declare const messages: {
124
126
  help: string;
125
127
  };
126
128
  treeStructure: {
129
+ folderChildOptions: {
130
+ edit: string;
131
+ delete: string;
132
+ };
127
133
  createFolder: string;
128
134
  newFolder: {
129
135
  placeholder: string;
@@ -131,6 +137,7 @@ declare const messages: {
131
137
  };
132
138
  };
133
139
  tagSelector: {
140
+ label: string;
134
141
  placeholder: string;
135
142
  removeTag: string;
136
143
  hideAllTags: string;
@@ -29,6 +29,10 @@ var titleTemplate = ' - NDLA';
29
29
 
30
30
  var messages = _objectSpread(_objectSpread({
31
31
  treeStructure: {
32
+ folderChildOptions: {
33
+ edit: 'Endre mappenavn',
34
+ "delete": 'Slett'
35
+ },
32
36
  createFolder: 'Lag mappe',
33
37
  newFolder: {
34
38
  placeholder: 'Skriv navn på mappe',
@@ -36,8 +40,9 @@ var messages = _objectSpread(_objectSpread({
36
40
  }
37
41
  },
38
42
  tagSelector: {
39
- placeholder: 'Legg til tag',
40
- removeTag: 'Ta vekk tilknytninga til {{name}}',
43
+ label: 'Legg til tag',
44
+ placeholder: 'Skriv tag navn',
45
+ removeTag: 'Ta vekk {{name}}',
41
46
  hideAllTags: 'Skjul alla tags',
42
47
  showAllTags: 'Vis alla tags'
43
48
  },
@@ -951,6 +956,8 @@ var messages = _objectSpread(_objectSpread({
951
956
  newFolderUnder: 'Lag ny mappe under {{folderName}}',
952
957
  myAccount: 'Min konto',
953
958
  favourites: 'Favoritter',
959
+ addToFavourites: 'Legg til i mine favoritter',
960
+ alreadyFavourited: 'Allerede lagt til i mine favoritter',
954
961
  help: 'Hjelp',
955
962
  more: 'Flere valg',
956
963
  listView: 'Listevisning',
@@ -64,6 +64,8 @@ declare const messages: {
64
64
  newFolderUnder: string;
65
65
  myAccount: string;
66
66
  favourites: string;
67
+ addToFavourites: string;
68
+ alreadyFavourited: string;
67
69
  help: string;
68
70
  more: string;
69
71
  listView: string;
@@ -124,6 +126,10 @@ declare const messages: {
124
126
  help: string;
125
127
  };
126
128
  treeStructure: {
129
+ folderChildOptions: {
130
+ edit: string;
131
+ delete: string;
132
+ };
127
133
  createFolder: string;
128
134
  newFolder: {
129
135
  placeholder: string;
@@ -131,6 +137,7 @@ declare const messages: {
131
137
  };
132
138
  };
133
139
  tagSelector: {
140
+ label: string;
134
141
  placeholder: string;
135
142
  removeTag: string;
136
143
  hideAllTags: string;
@@ -29,6 +29,10 @@ var titleTemplate = ' - NDLA';
29
29
 
30
30
  var messages = _objectSpread(_objectSpread({
31
31
  treeStructure: {
32
+ folderChildOptions: {
33
+ edit: 'Endre mappenavn',
34
+ "delete": 'Slett'
35
+ },
32
36
  createFolder: 'Lag mappe',
33
37
  newFolder: {
34
38
  placeholder: 'Skriv navn på mappe',
@@ -36,8 +40,9 @@ var messages = _objectSpread(_objectSpread({
36
40
  }
37
41
  },
38
42
  tagSelector: {
39
- placeholder: 'Tilknytt tag',
40
- removeTag: 'Ta vekk tilknytning til {{name}}',
43
+ label: 'Legg til tag',
44
+ placeholder: 'Skriv tag navn',
45
+ removeTag: 'Ta vekk {{name}}',
41
46
  hideAllTags: 'Skjul alle tagger',
42
47
  showAllTags: 'Vis alle tagger'
43
48
  },
@@ -951,6 +956,8 @@ var messages = _objectSpread(_objectSpread({
951
956
  newFolderUnder: 'Lag ny mappe under {{folderName}}',
952
957
  myAccount: 'Min konto',
953
958
  favourites: 'Favoritter',
959
+ addToFavourites: 'Legg til i mine favoritter',
960
+ alreadyFavourited: 'Allerede lagt til i mine favoritter',
954
961
  help: 'Hjelp',
955
962
  more: 'Flere valg',
956
963
  listView: 'Listevisning',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "17.0.0",
3
+ "version": "18.0.0",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,15 +31,15 @@
31
31
  "types"
32
32
  ],
33
33
  "dependencies": {
34
- "@ndla/button": "^2.5.1",
34
+ "@ndla/button": "^2.6.0",
35
35
  "@ndla/carousel": "^1.2.11",
36
36
  "@ndla/core": "^2.3.0",
37
37
  "@ndla/hooks": "^1.1.4",
38
38
  "@ndla/icons": "^1.10.0",
39
39
  "@ndla/licenses": "^5.0.2",
40
40
  "@ndla/modal": "^1.2.12",
41
- "@ndla/notion": "^3.1.16",
42
- "@ndla/safelink": "^2.0.7",
41
+ "@ndla/notion": "^3.1.17",
42
+ "@ndla/safelink": "^2.0.8",
43
43
  "@ndla/switch": "^0.1.7",
44
44
  "@ndla/tabs": "^1.1.10",
45
45
  "@ndla/tooltip": "^2.1.2",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "224c9c0d69875fa7d84a591cfbf15b6df340adc5"
84
+ "gitHead": "917673dcc652e2cbc9106b8b4c30cd393c00cff5"
85
85
  }
@@ -23,14 +23,15 @@ export const ArticleFavoritesButton = ({ isFavorite, onToggleAddToFavorites, art
23
23
  const removeFromFavoritesLabel = t('myNdla.resource.addToMyNdla');
24
24
  const addToFavoritesLabel = t('myNdla.resource.addedToMyNdla');
25
25
  return (
26
- <Tooltip tooltip={isFavorite ? removeFromFavoritesLabel : addToFavoritesLabel}>
26
+ <Tooltip tooltip={isFavorite ? addToFavoritesLabel : removeFromFavoritesLabel}>
27
27
  <IconButtonDualStates
28
- ariaLabelActive={addToFavoritesLabel}
29
- ariaLabelInActive={removeFromFavoritesLabel}
28
+ ariaLabelActive={t('myNdla.addToFavourites')}
29
+ ariaLabelInActive={t('myNdla.alreadyFavourited')}
30
30
  activeIcon={<Heart />}
31
31
  inactiveIcon={<HeartOutline />}
32
32
  active={isFavorite}
33
33
  size="small"
34
+ ghostPill
34
35
  onClick={() => onToggleAddToFavorites(articleId, !isFavorite)}
35
36
  />
36
37
  </Tooltip>
@@ -59,7 +59,7 @@ const FolderWrapper = styled(SafeLink)`
59
59
  display: flex;
60
60
  align-items: center;
61
61
  padding: ${spacing.small};
62
- border: 1px solid ${colors.brand.light};
62
+ border: 1px solid ${colors.brand.neutral7};
63
63
  border-radius: 2px;
64
64
  box-shadow: none;
65
65
  text-decoration: none;
@@ -1,4 +1,3 @@
1
1
  import Folder from './Resource/Folder';
2
2
  import FolderInput from './Resource/FolderInput';
3
- import { VerticalNavigation } from './Navigation';
4
- export { VerticalNavigation, Folder, FolderInput };
3
+ export { Folder, FolderInput };
@@ -47,7 +47,7 @@ const ResourceWrapper = styled(SafeLink)`
47
47
  text-decoration: none;
48
48
  box-shadow: none;
49
49
  padding: ${spacing.small};
50
- border: 1px solid ${colors.brand.light};
50
+ border: 1px solid ${colors.brand.neutral7};
51
51
  border-radius: 2px;
52
52
  color: ${colors.brand.greyDark};
53
53
  gap: 0 ${spacing.small};
@@ -19,6 +19,39 @@ import { uuid } from '@ndla/util';
19
19
  import Suggestions from './Suggestions';
20
20
  import type { TagType } from './TagSelector';
21
21
 
22
+ const SuggestionTextWrapper = styled.div`
23
+ ${fonts.sizes(18)};
24
+ position: absolute;
25
+ display: flex;
26
+ flex-grow: 1;
27
+ left: 0;
28
+ right: 0;
29
+ overflow: hidden;
30
+ max-height: ${spacing.large};
31
+ padding: 8.333px;
32
+ padding-right: ${spacing.large};
33
+ span {
34
+ color: ${colors.brand.grey};
35
+ white-space: nowrap;
36
+ overflow: hidden !important;
37
+ text-overflow: ellipsis;
38
+ &:first-of-type {
39
+ color: transparent;
40
+ }
41
+ }
42
+ `;
43
+
44
+ const SuggestionText = ({ value, suggestionValue }: { value: string; suggestionValue: string }) => (
45
+ <SuggestionTextWrapper>
46
+ {!!value && (
47
+ <>
48
+ <span>{value}</span>
49
+ <span>{suggestionValue.substring(value.length)}</span>
50
+ </>
51
+ )}
52
+ </SuggestionTextWrapper>
53
+ );
54
+
22
55
  const Cross = styled(CrossRaw)`
23
56
  margin-left: ${spacing.xxsmall};
24
57
  `;
@@ -31,15 +64,18 @@ const StyledInput = styled.input`
31
64
  flex-grow: 1;
32
65
  border: 0;
33
66
  outline: none;
34
- background: transparent;
35
67
  ${fonts.sizes(18)};
68
+ z-index: 1;
69
+ position: relative;
70
+ background: transparent;
36
71
  `;
72
+
37
73
  const StyledInputWrapper = styled.div`
38
74
  display: flex;
39
75
  flex-wrap: wrap;
40
76
  gap: ${spacing.xsmall};
41
77
  padding: ${spacing.small};
42
- border: 1px solid ${colors.brand.greyLighter};
78
+ border: 1px solid ${colors.brand.neutral7};
43
79
  transition: border-color ${animations.durations.normal} ease;
44
80
  border-radius: ${misc.borderRadius};
45
81
  &:focus-within {
@@ -50,6 +86,12 @@ const StyledInputWrapper = styled.div`
50
86
  const CombinedInputAndDropdownWrapper = styled.div`
51
87
  display: flex;
52
88
  flex-grow: 1;
89
+ position: relative;
90
+ `;
91
+
92
+ const StyledTagButton = styled(Button)<{ enableTagButtonAnimation: boolean }>`
93
+ ${({ enableTagButtonAnimation }) =>
94
+ enableTagButtonAnimation ? animations.fadeInScaled(animations.durations.slow) : ''}
53
95
  `;
54
96
 
55
97
  interface SuggestionInputProps {
@@ -90,6 +132,7 @@ const SuggestionInput = ({
90
132
  const inputRef = useRef<HTMLInputElement>(null);
91
133
  const containerRef = useRef<HTMLDivElement>(null);
92
134
  const suggestionIdRef = useRef<string>(uuid());
135
+ const initalTags = useRef<string[]>(addedTags.map(({ id }) => id));
93
136
 
94
137
  useEffect(() => {
95
138
  setCurrentHighlightedIndex(0);
@@ -122,7 +165,8 @@ const SuggestionInput = ({
122
165
  <SuggestionInputContainer ref={containerRef}>
123
166
  <StyledInputWrapper>
124
167
  {addedTags.map(({ id, name }) => (
125
- <Button
168
+ <StyledTagButton
169
+ enableTagButtonAnimation={!initalTags.current.includes(id)}
126
170
  aria-label={t('tagSelector.removeTag', { name })}
127
171
  onClick={() => onToggleTag(id)}
128
172
  light
@@ -132,9 +176,12 @@ const SuggestionInput = ({
132
176
  {prefix}
133
177
  {name}
134
178
  <Cross />
135
- </Button>
179
+ </StyledTagButton>
136
180
  ))}
137
181
  <CombinedInputAndDropdownWrapper>
182
+ {suggestions[currentHighlightedIndex] && (
183
+ <SuggestionText value={value} suggestionValue={suggestions[currentHighlightedIndex].name} />
184
+ )}
138
185
  <StyledInput
139
186
  placeholder={t('tagSelector.placeholder')}
140
187
  value={value}
@@ -157,38 +204,57 @@ const SuggestionInput = ({
157
204
  }}
158
205
  ref={inputRef}
159
206
  onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {
207
+ if (!['Enter', ' ', 'Tab', 'ArrowDown', 'ArrowUp', 'Backspace'].includes(e.key)) {
208
+ return;
209
+ }
210
+ const trimmedValue = value.replace(/\s/g, '');
160
211
  if (e.key === 'Escape') {
161
212
  setExpanded(false);
162
213
  e.preventDefault();
163
- } else if (e.key === 'Enter' || e.key === 'Tab') {
164
- if (value !== '' || expanded) {
165
- if (suggestions.length > 0) {
166
- if (!hasBeenAdded(suggestions[currentHighlightedIndex].id)) {
167
- onToggleTag(suggestions[currentHighlightedIndex].id);
168
- }
169
- setInputValue('');
170
- if (e.key === 'Enter') {
171
- e.preventDefault();
172
- }
173
- } else {
174
- onCreateTag(value);
175
- setInputValue('');
176
- e.preventDefault();
177
- }
178
- } else if (e.key === 'Enter') {
179
- e.preventDefault();
180
- }
181
- } else if (e.key === 'ArrowUp') {
214
+ return;
215
+ }
216
+ if (e.key === 'Backspace' && trimmedValue === '' && addedTags.length) {
217
+ // Remove the added last tag
218
+ onToggleTag(addedTags[addedTags.length - 1].id);
219
+ return;
220
+ }
221
+ if (e.key === 'ArrowUp') {
182
222
  setCurrentHighlightedIndex(
183
223
  currentHighlightedIndex - 1 < 0 ? suggestions.length - 1 : currentHighlightedIndex - 1,
184
224
  );
185
225
  e.preventDefault();
186
- } else if (e.key === 'ArrowDown') {
226
+ return;
227
+ }
228
+ if (e.key === 'ArrowDown') {
187
229
  setCurrentHighlightedIndex(
188
230
  currentHighlightedIndex + 1 >= suggestions.length ? 0 : currentHighlightedIndex + 1,
189
231
  );
190
232
  e.preventDefault();
233
+ return;
234
+ }
235
+ if (trimmedValue === '' && !expanded) {
236
+ if (e.key === 'Enter' || e.key === ' ') {
237
+ e.preventDefault();
238
+ }
239
+ return;
240
+ }
241
+ if (e.key === 'Enter' || e.key === 'Tab' || e.key === ' ') {
242
+ if (suggestions.length > 0) {
243
+ if (!hasBeenAdded(suggestions[currentHighlightedIndex].id)) {
244
+ onToggleTag(suggestions[currentHighlightedIndex].id);
245
+ } else if (trimmedValue.length < suggestions[currentHighlightedIndex].name.length) {
246
+ onCreateTag(trimmedValue);
247
+ e.preventDefault();
248
+ }
249
+ setInputValue('');
250
+ e.preventDefault();
251
+ return;
252
+ }
253
+ onCreateTag(trimmedValue);
254
+ setInputValue('');
255
+ e.preventDefault();
191
256
  }
257
+ return;
192
258
  }}
193
259
  />
194
260
  <Tooltip tooltip={expanded ? t('tagSelector.hideAllTags') : t('tagSelector.showAllTags')}>
@@ -8,6 +8,7 @@
8
8
 
9
9
  import React from 'react';
10
10
  import styled from '@emotion/styled';
11
+ import { css } from '@emotion/core';
11
12
  import { Check } from '@ndla/icons/editor';
12
13
  import { spacing, colors, misc, animations, fonts, shadows } from '@ndla/core';
13
14
  import Button from '@ndla/button';
@@ -60,6 +61,7 @@ interface SuggestionButtonProps {
60
61
  const SuggestionButton = styled(Button)<SuggestionButtonProps>`
61
62
  display: flex;
62
63
  justify-content: space-between;
64
+ align-items: center;
63
65
  ${fonts.sizes(18)};
64
66
  transition: ${misc.transition.default};
65
67
  font-weight: 400;
@@ -72,6 +74,18 @@ const SuggestionButton = styled(Button)<SuggestionButtonProps>`
72
74
  }
73
75
  }
74
76
  }
77
+ ${({ isHighlighted }) =>
78
+ isHighlighted
79
+ ? css`
80
+ background: ${colors.brand.lighter};
81
+ &:disabled {
82
+ background: ${colors.brand.greyLighter};
83
+ svg {
84
+ fill: ${colors.brand.grey};
85
+ }
86
+ }
87
+ `
88
+ : ''}
75
89
  `;
76
90
 
77
91
  interface Props {
@@ -33,10 +33,12 @@ interface Props {
33
33
  prefix?: string;
34
34
  }
35
35
 
36
- const sortedTags = (tags: TagType[], selectedTags: string[]): TagType[] =>
37
- tags
38
- .filter(({ id }) => selectedTags.some((idSelected) => idSelected === id))
39
- .sort((a, b) => a.name.localeCompare(b.name, 'nb'));
36
+ const sortedTags = (tags: TagType[], selectedTags: string[]): TagType[] => {
37
+ const returnTags = selectedTags
38
+ .map((selectedId) => tags.find(({ id }) => selectedId === id))
39
+ .filter((notUndefined) => notUndefined) as unknown as TagType[];
40
+ return returnTags;
41
+ };
40
42
 
41
43
  const getSuggestions = (tags: TagType[], inputValue: string): TagType[] => {
42
44
  if (inputValue === '') {
@@ -42,7 +42,8 @@ const WrapperForFolderChild = styled.div<{ marked: boolean }>`
42
42
  right: ${spacing.xsmall};
43
43
  opacity: ${({ marked }) => (marked ? 1 : 0.25)};
44
44
  &:hover,
45
- &:focus {
45
+ &:focus,
46
+ &:focus-within {
46
47
  opacity: 1;
47
48
  }
48
49
  `;
@@ -170,7 +171,9 @@ const FolderItem = ({
170
171
  {name}
171
172
  </FolderName>
172
173
  {folderChild && (
173
- <WrapperForFolderChild marked={marked}>{folderChild(id, marked ? 0 : -1)}</WrapperForFolderChild>
174
+ <WrapperForFolderChild marked={marked}>
175
+ {folderChild(id, marked || id === focusedFolderId ? 0 : -1)}
176
+ </WrapperForFolderChild>
174
177
  )}
175
178
  </>
176
179
  )}
package/src/index.ts CHANGED
@@ -236,7 +236,7 @@ export { Notion, ConceptNotion } from './Notion';
236
236
  export type { NotionVisualElementType, ConceptNotionType } from './Notion';
237
237
 
238
238
  export { BannerCard } from './BannerCard';
239
- export { VerticalNavigation, Folder, FolderInput } from './MyNdla';
239
+ export { Folder, FolderInput } from './MyNdla';
240
240
  export { ListResource, BlockResource } from './Resource';
241
241
  export type { ListResourceProps } from './Resource';
242
242
  export type { TagType } from './TagSelector';
@@ -15,6 +15,10 @@ const titleTemplate = ' - NDLA';
15
15
 
16
16
  const messages = {
17
17
  treeStructure: {
18
+ folderChildOptions: {
19
+ edit: 'Edit foldername',
20
+ delete: 'Delete',
21
+ },
18
22
  createFolder: 'Create folder',
19
23
  newFolder: {
20
24
  placeholder: 'Add foldername',
@@ -22,7 +26,8 @@ const messages = {
22
26
  },
23
27
  },
24
28
  tagSelector: {
25
- placeholder: 'Add to tag',
29
+ label: 'Add tag',
30
+ placeholder: 'Enter tag name',
26
31
  removeTag: 'Remove tag {{name}}',
27
32
  hideAllTags: 'Hide all tags',
28
33
  showAllTags: 'Show all tags',
@@ -989,6 +994,8 @@ const messages = {
989
994
  newFolderUnder: 'Create new folder under {{folderName}}',
990
995
  myAccount: 'My account',
991
996
  favourites: 'Favourites',
997
+ addToFavourites: 'Add to my favourites',
998
+ alreadyFavourited: 'Already in my favourites',
992
999
  help: 'Help',
993
1000
  more: 'More options',
994
1001
  listView: 'List view',
@@ -1007,6 +1014,7 @@ const messages = {
1007
1014
  terms: 'terms of use',
1008
1015
  feide: 'We have retrieved this information from Feide',
1009
1016
  newFavourite: 'Recently favourited',
1017
+
1010
1018
  storageInfo: {
1011
1019
  title: 'How to save your favourite resources from NDLA',
1012
1020
  text: 'When you wish to save a resource, you can do so by clicking the heart on the top right corner of the page. You will then get an option to store the resource in a folder',
@@ -15,6 +15,10 @@ const titleTemplate = ' - NDLA';
15
15
 
16
16
  const messages = {
17
17
  treeStructure: {
18
+ folderChildOptions: {
19
+ edit: 'Endre mappenavn',
20
+ delete: 'Slett',
21
+ },
18
22
  createFolder: 'Lag mappe',
19
23
  newFolder: {
20
24
  placeholder: 'Skriv navn på mappe',
@@ -22,8 +26,9 @@ const messages = {
22
26
  },
23
27
  },
24
28
  tagSelector: {
25
- placeholder: 'Tilknytt tag',
26
- removeTag: 'Ta vekk tilknytning til {{name}}',
29
+ label: 'Legg til tag',
30
+ placeholder: 'Skriv tag navn',
31
+ removeTag: 'Ta vekk {{name}}',
27
32
  hideAllTags: 'Skjul alle tagger',
28
33
  showAllTags: 'Vis alle tagger',
29
34
  },
@@ -987,6 +992,8 @@ const messages = {
987
992
  newFolderUnder: 'Lag ny mappe under {{folderName}}',
988
993
  myAccount: 'Min konto',
989
994
  favourites: 'Favoritter',
995
+ addToFavourites: 'Legg til i mine favoritter',
996
+ alreadyFavourited: 'Allerede lagt til i mine favoritter',
990
997
  help: 'Hjelp',
991
998
  more: 'Flere valg',
992
999
  listView: 'Listevisning',
@@ -15,15 +15,20 @@ const titleTemplate = ' - NDLA';
15
15
 
16
16
  const messages = {
17
17
  treeStructure: {
18
+ folderChildOptions: {
19
+ edit: 'Endre mappenamn',
20
+ delete: 'Slett',
21
+ },
18
22
  createFolder: 'Lag mappe',
19
23
  newFolder: {
20
- placeholder: 'Skriv navn på mappe',
24
+ placeholder: 'Skriv namn på mappe',
21
25
  defaultName: 'Ny mappe',
22
26
  },
23
27
  },
24
28
  tagSelector: {
25
- placeholder: 'Tilknytt tag',
26
- removeTag: 'Ta vekk tilknytninga til {{name}}',
29
+ label: 'Legg til tag',
30
+ placeholder: 'Skriv tag namn',
31
+ removeTag: 'Ta vekk {{name}}',
27
32
  hideAllTags: 'Skjul alle tagger',
28
33
  showAllTags: 'Vis alle tagger',
29
34
  },
@@ -988,6 +993,8 @@ const messages = {
988
993
  newFolderUnder: 'Lag ny mappe under {{folderName}}',
989
994
  myAccount: 'Min konto',
990
995
  favourites: 'Favorittar',
996
+ addToFavourites: 'Legg til i mine favorittar',
997
+ alreadyFavourited: 'Allereie lagt til i mine favorittar',
991
998
  help: 'Hjelp',
992
999
  more: 'Fleire val',
993
1000
  listView: 'Listevisning',
@@ -15,6 +15,10 @@ const titleTemplate = ' - NDLA';
15
15
 
16
16
  const messages = {
17
17
  treeStructure: {
18
+ folderChildOptions: {
19
+ edit: 'Endre mappenavn',
20
+ delete: 'Slett',
21
+ },
18
22
  createFolder: 'Lag mappe',
19
23
  newFolder: {
20
24
  placeholder: 'Skriv navn på mappe',
@@ -22,8 +26,9 @@ const messages = {
22
26
  },
23
27
  },
24
28
  tagSelector: {
25
- placeholder: 'Legg til tag',
26
- removeTag: 'Ta vekk tilknytninga til {{name}}',
29
+ label: 'Legg til tag',
30
+ placeholder: 'Skriv tag navn',
31
+ removeTag: 'Ta vekk {{name}}',
27
32
  hideAllTags: 'Skjul alla tags',
28
33
  showAllTags: 'Vis alla tags',
29
34
  },
@@ -987,6 +992,8 @@ const messages = {
987
992
  newFolderUnder: 'Lag ny mappe under {{folderName}}',
988
993
  myAccount: 'Min konto',
989
994
  favourites: 'Favoritter',
995
+ addToFavourites: 'Legg til i mine favoritter',
996
+ alreadyFavourited: 'Allerede lagt til i mine favoritter',
990
997
  help: 'Hjelp',
991
998
  more: 'Flere valg',
992
999
  listView: 'Listevisning',