@ndla/ui 24.2.0 → 25.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.
- package/es/CompetenceGoals/CompetenceGoalsDialog.js +15 -24
- package/es/CompetenceGoals/index.js +1 -4
- package/es/Filter/FilterButtons.js +10 -11
- package/es/Filter/FilterList.js +82 -152
- package/es/Filter/FilterListPhone.js +180 -272
- package/es/Filter/ToggleItem.js +6 -25
- package/es/Frontpage/FrontpageAllSubjects.js +8 -9
- package/es/Frontpage/FrontpageSearch.js +3 -4
- package/es/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
- package/es/Masthead/Masthead.js +65 -41
- package/es/Masthead/MastheadSearchModal.js +4 -5
- package/es/Masthead/SkipToMainContent.js +24 -0
- package/es/Masthead/index.js +2 -1
- package/es/SearchTypeResult/PopupFilter.js +8 -9
- package/es/SearchTypeResult/SearchFilterContent.js +3 -4
- package/es/SectionHeading/SectionHeading.js +24 -17
- package/es/Subject/index.js +0 -1
- package/es/User/UserInfo.js +11 -3
- package/es/all.css +1 -1
- package/es/index-javascript.js +1 -4
- package/es/index.js +5 -2
- package/es/locale/messages-en.js +1 -0
- package/es/locale/messages-nb.js +1 -0
- package/es/locale/messages-nn.js +1 -0
- package/es/locale/messages-se.js +1 -0
- package/es/locale/messages-sma.js +1 -0
- package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +19 -0
- package/lib/CompetenceGoals/CompetenceGoalsDialog.js +13 -25
- package/lib/CompetenceGoals/index.d.ts +1 -0
- package/lib/CompetenceGoals/index.js +1 -33
- package/lib/Filter/FilterButtons.js +9 -9
- package/lib/Filter/FilterList.d.ts +25 -0
- package/lib/Filter/FilterList.js +85 -155
- package/lib/Filter/FilterListPhone.d.ts +32 -0
- package/lib/Filter/FilterListPhone.js +176 -270
- package/lib/Filter/ToggleItem.d.ts +15 -0
- package/lib/Filter/ToggleItem.js +6 -32
- package/lib/Filter/filterClasses.d.ts +2 -0
- package/lib/Filter/index.d.ts +12 -0
- package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
- package/lib/Frontpage/FrontpageSearch.js +2 -3
- package/lib/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
- package/lib/Masthead/Masthead.d.ts +4 -8
- package/lib/Masthead/Masthead.js +65 -49
- package/lib/Masthead/MastheadSearchModal.js +3 -4
- package/lib/Masthead/SkipToMainContent.d.ts +6 -0
- package/lib/Masthead/SkipToMainContent.js +38 -0
- package/lib/Masthead/index.d.ts +2 -1
- package/lib/Masthead/index.js +10 -0
- package/lib/SearchTypeResult/PopupFilter.js +7 -7
- package/lib/SearchTypeResult/SearchFilterContent.js +2 -2
- package/lib/SectionHeading/SectionHeading.d.ts +1 -13
- package/lib/SectionHeading/SectionHeading.js +23 -19
- package/lib/Subject/index.d.ts +0 -1
- package/lib/Subject/index.js +0 -8
- package/lib/User/UserInfo.js +11 -3
- package/lib/all.css +1 -1
- package/lib/index-javascript.js +1 -63
- package/lib/index.d.ts +5 -2
- package/lib/index.js +48 -7
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +1 -0
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +1 -0
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +1 -0
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +1 -0
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +1 -0
- package/package.json +12 -12
- package/src/CompetenceGoals/{CompetenceGoalsDialog.jsx → CompetenceGoalsDialog.tsx} +34 -27
- package/src/CompetenceGoals/index.ts +1 -0
- package/src/Filter/FilterButtons.tsx +0 -1
- package/src/Filter/FilterList.tsx +135 -0
- package/src/Filter/FilterListPhone.tsx +275 -0
- package/src/Filter/ToggleItem.tsx +58 -0
- package/src/Filter/{filterClasses.js → filterClasses.ts} +0 -0
- package/src/Filter/{index.js → index.ts} +0 -0
- package/src/Frontpage/FrontpageAllSubjects.tsx +0 -1
- package/src/Frontpage/FrontpageSearch.tsx +0 -1
- package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +0 -1
- package/src/Masthead/Masthead.tsx +85 -45
- package/src/Masthead/MastheadSearchModal.tsx +0 -1
- package/src/Masthead/SkipToMainContent.tsx +48 -0
- package/src/Masthead/index.ts +2 -1
- package/src/SearchTypeResult/PopupFilter.tsx +0 -1
- package/src/SearchTypeResult/SearchFilterContent.tsx +0 -1
- package/src/SectionHeading/SectionHeading.tsx +29 -16
- package/src/Subject/index.ts +0 -1
- package/src/User/UserInfo.tsx +4 -4
- package/src/index-javascript.js +0 -10
- package/src/index.ts +7 -2
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/src/locale/messages-sma.ts +1 -0
- package/src/main.scss +0 -3
- package/es/CompetenceGoals/CompetenceGoalList.js +0 -58
- package/es/CompetenceGoals/CompetenceGoals.js +0 -159
- package/es/Subject/SubjectFilter.js +0 -42
- package/lib/CompetenceGoals/CompetenceGoalList.js +0 -78
- package/lib/CompetenceGoals/CompetenceGoals.js +0 -184
- package/lib/Subject/SubjectFilter.d.ts +0 -27
- package/lib/Subject/SubjectFilter.js +0 -58
- package/src/CompetenceGoals/CompetenceGoalList.jsx +0 -51
- package/src/CompetenceGoals/CompetenceGoals.jsx +0 -152
- package/src/CompetenceGoals/component.competence-goals.scss +0 -161
- package/src/CompetenceGoals/index.js +0 -6
- package/src/Filter/FilterList.jsx +0 -167
- package/src/Filter/FilterListPhone.jsx +0 -329
- package/src/Filter/ToggleItem.jsx +0 -71
- package/src/Masthead/component.masthead.scss +0 -146
- package/src/SectionHeading/component.section-heading.scss +0 -17
- package/src/Subject/SubjectFilter.tsx +0 -48
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.classes = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
13
|
-
|
|
14
|
-
var _common = require("@ndla/icons/common");
|
|
15
|
-
|
|
16
|
-
var _reactI18next = require("react-i18next");
|
|
17
|
-
|
|
18
|
-
var _Filter = require("../Filter");
|
|
19
|
-
|
|
20
|
-
var _CompetenceGoalList = _interopRequireDefault(require("./CompetenceGoalList"));
|
|
21
|
-
|
|
22
|
-
var _core = require("@emotion/core");
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
30
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
31
|
-
|
|
32
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
33
|
-
|
|
34
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
|
-
|
|
36
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
37
|
-
|
|
38
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
39
|
-
|
|
40
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
41
|
-
|
|
42
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
|
-
|
|
44
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
45
|
-
|
|
46
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
47
|
-
|
|
48
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
-
|
|
50
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
51
|
-
|
|
52
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
|
-
|
|
54
|
-
var classes = new _reactBemHelper["default"]({
|
|
55
|
-
name: 'competence-goals',
|
|
56
|
-
prefix: 'c-'
|
|
57
|
-
});
|
|
58
|
-
exports.classes = classes;
|
|
59
|
-
|
|
60
|
-
var CompetenceGoals = /*#__PURE__*/function (_Component) {
|
|
61
|
-
_inherits(CompetenceGoals, _Component);
|
|
62
|
-
|
|
63
|
-
var _super = _createSuper(CompetenceGoals);
|
|
64
|
-
|
|
65
|
-
function CompetenceGoals(props) {
|
|
66
|
-
var _this;
|
|
67
|
-
|
|
68
|
-
_classCallCheck(this, CompetenceGoals);
|
|
69
|
-
|
|
70
|
-
_this = _super.call(this, props);
|
|
71
|
-
_this.state = {
|
|
72
|
-
expanded: null
|
|
73
|
-
};
|
|
74
|
-
return _this;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
_createClass(CompetenceGoals, [{
|
|
78
|
-
key: "render",
|
|
79
|
-
value: function render() {
|
|
80
|
-
var _this2 = this;
|
|
81
|
-
|
|
82
|
-
var _this$props = this.props,
|
|
83
|
-
messages = _this$props.messages,
|
|
84
|
-
headingId = _this$props.headingId,
|
|
85
|
-
topics = _this$props.topics,
|
|
86
|
-
id = _this$props.id,
|
|
87
|
-
menu = _this$props.menu,
|
|
88
|
-
search = _this$props.search,
|
|
89
|
-
subjectName = _this$props.subjectName,
|
|
90
|
-
filterOptions = _this$props.filterOptions,
|
|
91
|
-
filterValues = _this$props.filterValues,
|
|
92
|
-
onFilterClick = _this$props.onFilterClick,
|
|
93
|
-
description = _this$props.description,
|
|
94
|
-
t = _this$props.t;
|
|
95
|
-
return (0, _core.jsx)("div", classes('', {
|
|
96
|
-
menu: menu,
|
|
97
|
-
search: search
|
|
98
|
-
}), !menu && !search ? (0, _core.jsx)(_react.Fragment, null, (0, _core.jsx)("h1", {
|
|
99
|
-
id: headingId
|
|
100
|
-
}, messages.heading), (0, _core.jsx)("hr", null), (0, _core.jsx)("p", null, description), (0, _core.jsx)("p", null, messages.listDescription), (0, _core.jsx)("div", classes('topic'), (0, _core.jsx)(_CompetenceGoalList["default"], {
|
|
101
|
-
goals: topics[0].items
|
|
102
|
-
}))) : (0, _core.jsx)(_react.Fragment, null, (0, _core.jsx)("h1", classes('subject-heading'), subjectName), (0, _core.jsx)("h2", _extends({
|
|
103
|
-
id: headingId
|
|
104
|
-
}, classes('heading')), messages.heading), (0, _core.jsx)("p", classes('description'), messages.listDescription), filterOptions && filterOptions.length > 0 && (0, _core.jsx)(_react.Fragment, null, (0, _core.jsx)(_Filter.FilterListPhone, {
|
|
105
|
-
preid: "competence",
|
|
106
|
-
label: "Filtrer kompetansem\xE5l",
|
|
107
|
-
options: filterOptions,
|
|
108
|
-
alignedGroup: true,
|
|
109
|
-
values: filterValues,
|
|
110
|
-
onChange: onFilterClick,
|
|
111
|
-
messages: {
|
|
112
|
-
openFilter: t('competenceGoals.openCompentenceGoalsFilter'),
|
|
113
|
-
useFilter: t('competenceGoals.useCompentenceGoalsFilter'),
|
|
114
|
-
closeFilter: t('competenceGoals.closeCompentenceGoalsFilter')
|
|
115
|
-
}
|
|
116
|
-
})), topics.map(function (topic) {
|
|
117
|
-
return (0, _core.jsx)("div", _extends({}, classes('topic', {
|
|
118
|
-
expandable: true,
|
|
119
|
-
expanded: _this2.state.expanded === topic.heading
|
|
120
|
-
}), {
|
|
121
|
-
key: topic.heading
|
|
122
|
-
}), (0, _core.jsx)("h3", classes('topic-heading'), (0, _core.jsx)("button", _extends({}, classes('topic-heading-button'), {
|
|
123
|
-
type: "button",
|
|
124
|
-
"aria-expanded": _this2.state.expanded === topic.heading,
|
|
125
|
-
"aria-controls": id,
|
|
126
|
-
onClick: function onClick() {
|
|
127
|
-
_this2.setState(function (prevState) {
|
|
128
|
-
var expanded = null;
|
|
129
|
-
|
|
130
|
-
if (prevState.expanded !== topic.heading) {
|
|
131
|
-
expanded = topic.heading;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
expanded: expanded
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}), _this2.state.expanded === topic.heading ? (0, _core.jsx)(_common.ChevronDown, null) : (0, _core.jsx)(_common.ChevronRight, null), topic.heading)), (0, _core.jsx)(_CompetenceGoalList["default"], {
|
|
140
|
-
id: id,
|
|
141
|
-
"aria-hidden": _this2.state.expanded !== topic.heading,
|
|
142
|
-
goals: topic.items
|
|
143
|
-
}));
|
|
144
|
-
})));
|
|
145
|
-
}
|
|
146
|
-
}]);
|
|
147
|
-
|
|
148
|
-
return CompetenceGoals;
|
|
149
|
-
}(_react.Component);
|
|
150
|
-
|
|
151
|
-
CompetenceGoals.propTypes = {
|
|
152
|
-
id: _propTypes["default"].string,
|
|
153
|
-
headingId: _propTypes["default"].string,
|
|
154
|
-
menu: _propTypes["default"].bool,
|
|
155
|
-
search: _propTypes["default"].bool,
|
|
156
|
-
description: _propTypes["default"].string.isRequired,
|
|
157
|
-
messages: _propTypes["default"].shape({
|
|
158
|
-
heading: _propTypes["default"].string.isRequired,
|
|
159
|
-
listDescription: _propTypes["default"].string.isRequired
|
|
160
|
-
}).isRequired,
|
|
161
|
-
subjectName: _propTypes["default"].string,
|
|
162
|
-
filterOptions: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
163
|
-
title: _propTypes["default"].string.isRequired,
|
|
164
|
-
value: _propTypes["default"].string.isRequired
|
|
165
|
-
})),
|
|
166
|
-
filterValues: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
167
|
-
onFilterClick: _propTypes["default"].func.isRequired,
|
|
168
|
-
topics: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
169
|
-
heading: _propTypes["default"].string,
|
|
170
|
-
items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
171
|
-
text: _propTypes["default"].string.isRequired,
|
|
172
|
-
url: _propTypes["default"].string
|
|
173
|
-
}))
|
|
174
|
-
}))
|
|
175
|
-
};
|
|
176
|
-
CompetenceGoals.defaultProps = {
|
|
177
|
-
headingId: null,
|
|
178
|
-
menu: false,
|
|
179
|
-
search: false
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
var _default = (0, _reactI18next.withTranslation)()(CompetenceGoals);
|
|
183
|
-
|
|
184
|
-
exports["default"] = _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
interface Props {
|
|
4
|
-
label: string;
|
|
5
|
-
onChange: (evt: ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
-
options: {
|
|
7
|
-
value: string | number;
|
|
8
|
-
title: string;
|
|
9
|
-
}[];
|
|
10
|
-
values: (string | number)[];
|
|
11
|
-
}
|
|
12
|
-
declare const SubjectFilter: {
|
|
13
|
-
({ label, options, values, onChange }: Props): JSX.Element;
|
|
14
|
-
propTypes: {
|
|
15
|
-
label: PropTypes.Validator<string>;
|
|
16
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
options: PropTypes.Validator<(PropTypes.InferProps<{
|
|
18
|
-
value: PropTypes.Validator<string | number>;
|
|
19
|
-
title: PropTypes.Validator<string>;
|
|
20
|
-
}> | null | undefined)[]>;
|
|
21
|
-
values: PropTypes.Requireable<(string | number | null | undefined)[]>;
|
|
22
|
-
};
|
|
23
|
-
defaultProps: {
|
|
24
|
-
values: never[];
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export default SubjectFilter;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _FilterList = _interopRequireDefault(require("../Filter/FilterList"));
|
|
15
|
-
|
|
16
|
-
var _core = require("@emotion/core");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
var searchFilterClasses = (0, _reactBemHelper["default"])({
|
|
22
|
-
prefix: 'c-',
|
|
23
|
-
name: 'filter',
|
|
24
|
-
outputIsString: true
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
var valueShape = _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]);
|
|
28
|
-
|
|
29
|
-
var SubjectFilter = function SubjectFilter(_ref) {
|
|
30
|
-
var label = _ref.label,
|
|
31
|
-
options = _ref.options,
|
|
32
|
-
values = _ref.values,
|
|
33
|
-
onChange = _ref.onChange;
|
|
34
|
-
return (0, _core.jsx)("div", {
|
|
35
|
-
className: searchFilterClasses('', ['subject', 'background'])
|
|
36
|
-
}, (0, _core.jsx)(_FilterList["default"], {
|
|
37
|
-
onChange: onChange,
|
|
38
|
-
labelNotVisible: true,
|
|
39
|
-
options: options,
|
|
40
|
-
label: label,
|
|
41
|
-
values: values
|
|
42
|
-
}));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
SubjectFilter.propTypes = {
|
|
46
|
-
label: _propTypes["default"].string.isRequired,
|
|
47
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
48
|
-
options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
49
|
-
value: valueShape.isRequired,
|
|
50
|
-
title: _propTypes["default"].string.isRequired
|
|
51
|
-
})).isRequired,
|
|
52
|
-
values: _propTypes["default"].arrayOf(valueShape)
|
|
53
|
-
};
|
|
54
|
-
SubjectFilter.defaultProps = {
|
|
55
|
-
values: []
|
|
56
|
-
};
|
|
57
|
-
var _default = SubjectFilter;
|
|
58
|
-
exports["default"] = _default;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import { mq, breakpoints, fonts, spacing } from '@ndla/core';
|
|
5
|
-
import SafeLink from '@ndla/safelink';
|
|
6
|
-
import { classes } from './CompetenceGoals';
|
|
7
|
-
import { CompetenceGoalShape } from '../shapes';
|
|
8
|
-
|
|
9
|
-
export const CompetenceGoalListHeading = styled('p')`
|
|
10
|
-
font-weight: ${fonts.weight.semibold};
|
|
11
|
-
margin-bottom: ${spacing.small};
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
const StyledListItem = styled('li')`
|
|
15
|
-
line-height: ${spacing.normal};
|
|
16
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
17
|
-
${fonts.sizes(16, 1.5)};
|
|
18
|
-
}
|
|
19
|
-
&:last-child {
|
|
20
|
-
margin-bottom: 0;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export const CompetenceGoal = ({ goal }) => {
|
|
25
|
-
const content = goal.url ? <SafeLink to={goal.url}>{goal.name}</SafeLink> : goal.name;
|
|
26
|
-
|
|
27
|
-
return <StyledListItem {...classes('topic-item')}>{content}</StyledListItem>;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
CompetenceGoal.propTypes = {
|
|
31
|
-
goal: CompetenceGoalShape,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const StyledList = styled('ul')`
|
|
35
|
-
margin: 0 0 ${spacing.large} ${spacing.normal};
|
|
36
|
-
padding: 0;
|
|
37
|
-
max-width: 650px;
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
export const CompetenceGoalList = ({ goals, ...rest }) => (
|
|
41
|
-
<StyledList {...classes('topic-list')} {...rest}>
|
|
42
|
-
{goals.map((goal) => (
|
|
43
|
-
<CompetenceGoal key={goal.id} goal={goal} />
|
|
44
|
-
))}
|
|
45
|
-
</StyledList>
|
|
46
|
-
);
|
|
47
|
-
CompetenceGoalList.propTypes = {
|
|
48
|
-
goals: PropTypes.arrayOf(CompetenceGoalShape).isRequired,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default CompetenceGoalList;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React, { Component, Fragment } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import BEMHelper from 'react-bem-helper';
|
|
4
|
-
import { ChevronRight, ChevronDown } from '@ndla/icons/common';
|
|
5
|
-
import { withTranslation } from 'react-i18next';
|
|
6
|
-
import { FilterListPhone } from '../Filter';
|
|
7
|
-
import CompetenceGoalList from './CompetenceGoalList';
|
|
8
|
-
|
|
9
|
-
export const classes = new BEMHelper({
|
|
10
|
-
name: 'competence-goals',
|
|
11
|
-
prefix: 'c-',
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
class CompetenceGoals extends Component {
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
this.state = {
|
|
18
|
-
expanded: null,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
render() {
|
|
23
|
-
const {
|
|
24
|
-
messages,
|
|
25
|
-
headingId,
|
|
26
|
-
topics,
|
|
27
|
-
id,
|
|
28
|
-
menu,
|
|
29
|
-
search,
|
|
30
|
-
subjectName,
|
|
31
|
-
filterOptions,
|
|
32
|
-
filterValues,
|
|
33
|
-
onFilterClick,
|
|
34
|
-
description,
|
|
35
|
-
t,
|
|
36
|
-
} = this.props;
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div {...classes('', { menu, search })}>
|
|
40
|
-
{!menu && !search ? (
|
|
41
|
-
<Fragment>
|
|
42
|
-
<h1 id={headingId}>{messages.heading}</h1>
|
|
43
|
-
<hr />
|
|
44
|
-
<p>{description}</p>
|
|
45
|
-
<p>{messages.listDescription}</p>
|
|
46
|
-
<div {...classes('topic')}>
|
|
47
|
-
<CompetenceGoalList goals={topics[0].items} />
|
|
48
|
-
</div>
|
|
49
|
-
</Fragment>
|
|
50
|
-
) : (
|
|
51
|
-
<Fragment>
|
|
52
|
-
<h1 {...classes('subject-heading')}>{subjectName}</h1>
|
|
53
|
-
<h2 id={headingId} {...classes('heading')}>
|
|
54
|
-
{messages.heading}
|
|
55
|
-
</h2>
|
|
56
|
-
<p {...classes('description')}>{messages.listDescription}</p>
|
|
57
|
-
{filterOptions && filterOptions.length > 0 && (
|
|
58
|
-
<Fragment>
|
|
59
|
-
<FilterListPhone
|
|
60
|
-
preid="competence"
|
|
61
|
-
label="Filtrer kompetansemål"
|
|
62
|
-
options={filterOptions}
|
|
63
|
-
alignedGroup
|
|
64
|
-
values={filterValues}
|
|
65
|
-
onChange={onFilterClick}
|
|
66
|
-
messages={{
|
|
67
|
-
openFilter: t('competenceGoals.openCompentenceGoalsFilter'),
|
|
68
|
-
useFilter: t('competenceGoals.useCompentenceGoalsFilter'),
|
|
69
|
-
closeFilter: t('competenceGoals.closeCompentenceGoalsFilter'),
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
</Fragment>
|
|
73
|
-
)}
|
|
74
|
-
{topics.map((topic) => (
|
|
75
|
-
<div
|
|
76
|
-
{...classes('topic', {
|
|
77
|
-
expandable: true,
|
|
78
|
-
expanded: this.state.expanded === topic.heading,
|
|
79
|
-
})}
|
|
80
|
-
key={topic.heading}>
|
|
81
|
-
<h3 {...classes('topic-heading')}>
|
|
82
|
-
<button
|
|
83
|
-
{...classes('topic-heading-button')}
|
|
84
|
-
type="button"
|
|
85
|
-
aria-expanded={this.state.expanded === topic.heading}
|
|
86
|
-
aria-controls={id}
|
|
87
|
-
onClick={() => {
|
|
88
|
-
this.setState((prevState) => {
|
|
89
|
-
let expanded = null;
|
|
90
|
-
if (prevState.expanded !== topic.heading) {
|
|
91
|
-
expanded = topic.heading;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
expanded,
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
}}>
|
|
99
|
-
{this.state.expanded === topic.heading ? <ChevronDown /> : <ChevronRight />}
|
|
100
|
-
{topic.heading}
|
|
101
|
-
</button>
|
|
102
|
-
</h3>
|
|
103
|
-
|
|
104
|
-
<CompetenceGoalList id={id} aria-hidden={this.state.expanded !== topic.heading} goals={topic.items} />
|
|
105
|
-
</div>
|
|
106
|
-
))}
|
|
107
|
-
</Fragment>
|
|
108
|
-
)}
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
CompetenceGoals.propTypes = {
|
|
115
|
-
id: PropTypes.string,
|
|
116
|
-
headingId: PropTypes.string,
|
|
117
|
-
menu: PropTypes.bool,
|
|
118
|
-
search: PropTypes.bool,
|
|
119
|
-
description: PropTypes.string.isRequired,
|
|
120
|
-
messages: PropTypes.shape({
|
|
121
|
-
heading: PropTypes.string.isRequired,
|
|
122
|
-
listDescription: PropTypes.string.isRequired,
|
|
123
|
-
}).isRequired,
|
|
124
|
-
subjectName: PropTypes.string,
|
|
125
|
-
filterOptions: PropTypes.arrayOf(
|
|
126
|
-
PropTypes.shape({
|
|
127
|
-
title: PropTypes.string.isRequired,
|
|
128
|
-
value: PropTypes.string.isRequired,
|
|
129
|
-
}),
|
|
130
|
-
),
|
|
131
|
-
filterValues: PropTypes.arrayOf(PropTypes.string),
|
|
132
|
-
onFilterClick: PropTypes.func.isRequired,
|
|
133
|
-
topics: PropTypes.arrayOf(
|
|
134
|
-
PropTypes.shape({
|
|
135
|
-
heading: PropTypes.string,
|
|
136
|
-
items: PropTypes.arrayOf(
|
|
137
|
-
PropTypes.shape({
|
|
138
|
-
text: PropTypes.string.isRequired,
|
|
139
|
-
url: PropTypes.string,
|
|
140
|
-
}),
|
|
141
|
-
),
|
|
142
|
-
}),
|
|
143
|
-
),
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
CompetenceGoals.defaultProps = {
|
|
147
|
-
headingId: null,
|
|
148
|
-
menu: false,
|
|
149
|
-
search: false,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export default withTranslation()(CompetenceGoals);
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
.c-competence-goals {
|
|
2
|
-
height: 100%;
|
|
3
|
-
max-width: 960px;
|
|
4
|
-
width: 100%;
|
|
5
|
-
margin: 0 auto;
|
|
6
|
-
padding: 32px;
|
|
7
|
-
|
|
8
|
-
@include mq(mobile) {
|
|
9
|
-
padding: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&__dialog-wrapper {
|
|
13
|
-
@include mq(tablet) {
|
|
14
|
-
padding-left: $spacing;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&__heading {
|
|
19
|
-
margin-top: 0;
|
|
20
|
-
@include font-size(20px, 32px);
|
|
21
|
-
|
|
22
|
-
@include mq(tablet) {
|
|
23
|
-
@include font-size(22px, 32px);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&__subject-heading {
|
|
28
|
-
@include font-size(20px, 32px);
|
|
29
|
-
margin: 0 0 $spacing 0;
|
|
30
|
-
color: $brand-color;
|
|
31
|
-
|
|
32
|
-
@include mq(desktop) {
|
|
33
|
-
display: none;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&__description {
|
|
38
|
-
margin-bottom: $spacing;
|
|
39
|
-
@include mq($until: tablet) {
|
|
40
|
-
@include font-size(16px, 20px);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.c-filter {
|
|
45
|
-
position: relative;
|
|
46
|
-
|
|
47
|
-
&__list {
|
|
48
|
-
padding-top: $spacing--small;
|
|
49
|
-
border-top: 0;
|
|
50
|
-
margin-bottom: $spacing--small;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&__item {
|
|
54
|
-
margin-bottom: $spacing--small;
|
|
55
|
-
margin-left: 0;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&__label {
|
|
59
|
-
@include visually-hidden();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&__topic {
|
|
64
|
-
margin-bottom: $spacing;
|
|
65
|
-
padding-top: $spacing;
|
|
66
|
-
|
|
67
|
-
@include mq(tabletWide) {
|
|
68
|
-
padding-top: $spacing--small;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&--expandable {
|
|
72
|
-
margin-bottom: $spacing--small;
|
|
73
|
-
max-height: 35px;
|
|
74
|
-
transition: max-height 0.3s ease-in-out;
|
|
75
|
-
|
|
76
|
-
.c-competence-goals {
|
|
77
|
-
&__topic-list {
|
|
78
|
-
opacity: 0;
|
|
79
|
-
transition: opacity 0.1s ease-in-out 0.1s;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&--expanded {
|
|
85
|
-
max-height: 4000px;
|
|
86
|
-
.c-competence-goals {
|
|
87
|
-
&__topic-list {
|
|
88
|
-
opacity: 1;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&__topic-heading {
|
|
95
|
-
margin: 0 0 $spacing 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&__topic-heading-button,
|
|
99
|
-
&__topic-heading {
|
|
100
|
-
color: $brand-color;
|
|
101
|
-
@include inuit-font-size(18px, 23px);
|
|
102
|
-
font-weight: $font-weight-semibold;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&__topic-heading-button {
|
|
106
|
-
background: none;
|
|
107
|
-
border: none;
|
|
108
|
-
margin: 0 0 0 -4px;
|
|
109
|
-
position: relative;
|
|
110
|
-
padding: $spacing--small/2 $spacing--small/2 0;
|
|
111
|
-
cursor: pointer;
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
|
|
115
|
-
@include mq(desktop) {
|
|
116
|
-
margin: 0;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.c-icon {
|
|
120
|
-
@include mq(desktop) {
|
|
121
|
-
position: absolute;
|
|
122
|
-
left: -21px;
|
|
123
|
-
top: 9px;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&--menu,
|
|
129
|
-
&--search {
|
|
130
|
-
padding: $spacing--small $spacing $spacing--small $spacing--small;
|
|
131
|
-
@include mq($until: mobileWide) {
|
|
132
|
-
padding: 0;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
.c-competence-goals {
|
|
136
|
-
&__heading {
|
|
137
|
-
text-transform: uppercase;
|
|
138
|
-
color: $primary-color;
|
|
139
|
-
font-weight: $font-weight-semibold;
|
|
140
|
-
@include font-size(16px, 20px);
|
|
141
|
-
}
|
|
142
|
-
&__topic--expandable {
|
|
143
|
-
padding-left: ($spacing--small + 10px);
|
|
144
|
-
.c-competence-goals__topic-list {
|
|
145
|
-
font-weight: $font-weight-normal;
|
|
146
|
-
padding-left: ($spacing--small + 12px);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
@include mq($until: desktop) {
|
|
151
|
-
&--menu,
|
|
152
|
-
&--search {
|
|
153
|
-
.c-competence-goals {
|
|
154
|
-
&__topic--expandable {
|
|
155
|
-
padding-left: 0;
|
|
156
|
-
margin-left: -4px;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import CompetenceGoals from './CompetenceGoals';
|
|
2
|
-
|
|
3
|
-
export { default as CompetenceGoalsDialog } from './CompetenceGoalsDialog';
|
|
4
|
-
export { default as CompetenceGoalList, CompetenceGoal, CompetenceGoalListHeading } from './CompetenceGoalList';
|
|
5
|
-
|
|
6
|
-
export default CompetenceGoals;
|