@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.
Files changed (116) hide show
  1. package/es/CompetenceGoals/CompetenceGoalsDialog.js +15 -24
  2. package/es/CompetenceGoals/index.js +1 -4
  3. package/es/Filter/FilterButtons.js +10 -11
  4. package/es/Filter/FilterList.js +82 -152
  5. package/es/Filter/FilterListPhone.js +180 -272
  6. package/es/Filter/ToggleItem.js +6 -25
  7. package/es/Frontpage/FrontpageAllSubjects.js +8 -9
  8. package/es/Frontpage/FrontpageSearch.js +3 -4
  9. package/es/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
  10. package/es/Masthead/Masthead.js +65 -41
  11. package/es/Masthead/MastheadSearchModal.js +4 -5
  12. package/es/Masthead/SkipToMainContent.js +24 -0
  13. package/es/Masthead/index.js +2 -1
  14. package/es/SearchTypeResult/PopupFilter.js +8 -9
  15. package/es/SearchTypeResult/SearchFilterContent.js +3 -4
  16. package/es/SectionHeading/SectionHeading.js +24 -17
  17. package/es/Subject/index.js +0 -1
  18. package/es/User/UserInfo.js +11 -3
  19. package/es/all.css +1 -1
  20. package/es/index-javascript.js +1 -4
  21. package/es/index.js +5 -2
  22. package/es/locale/messages-en.js +1 -0
  23. package/es/locale/messages-nb.js +1 -0
  24. package/es/locale/messages-nn.js +1 -0
  25. package/es/locale/messages-se.js +1 -0
  26. package/es/locale/messages-sma.js +1 -0
  27. package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +19 -0
  28. package/lib/CompetenceGoals/CompetenceGoalsDialog.js +13 -25
  29. package/lib/CompetenceGoals/index.d.ts +1 -0
  30. package/lib/CompetenceGoals/index.js +1 -33
  31. package/lib/Filter/FilterButtons.js +9 -9
  32. package/lib/Filter/FilterList.d.ts +25 -0
  33. package/lib/Filter/FilterList.js +85 -155
  34. package/lib/Filter/FilterListPhone.d.ts +32 -0
  35. package/lib/Filter/FilterListPhone.js +176 -270
  36. package/lib/Filter/ToggleItem.d.ts +15 -0
  37. package/lib/Filter/ToggleItem.js +6 -32
  38. package/lib/Filter/filterClasses.d.ts +2 -0
  39. package/lib/Filter/index.d.ts +12 -0
  40. package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
  41. package/lib/Frontpage/FrontpageSearch.js +2 -3
  42. package/lib/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
  43. package/lib/Masthead/Masthead.d.ts +4 -8
  44. package/lib/Masthead/Masthead.js +65 -49
  45. package/lib/Masthead/MastheadSearchModal.js +3 -4
  46. package/lib/Masthead/SkipToMainContent.d.ts +6 -0
  47. package/lib/Masthead/SkipToMainContent.js +38 -0
  48. package/lib/Masthead/index.d.ts +2 -1
  49. package/lib/Masthead/index.js +10 -0
  50. package/lib/SearchTypeResult/PopupFilter.js +7 -7
  51. package/lib/SearchTypeResult/SearchFilterContent.js +2 -2
  52. package/lib/SectionHeading/SectionHeading.d.ts +1 -13
  53. package/lib/SectionHeading/SectionHeading.js +23 -19
  54. package/lib/Subject/index.d.ts +0 -1
  55. package/lib/Subject/index.js +0 -8
  56. package/lib/User/UserInfo.js +11 -3
  57. package/lib/all.css +1 -1
  58. package/lib/index-javascript.js +1 -63
  59. package/lib/index.d.ts +5 -2
  60. package/lib/index.js +48 -7
  61. package/lib/locale/messages-en.d.ts +1 -0
  62. package/lib/locale/messages-en.js +1 -0
  63. package/lib/locale/messages-nb.d.ts +1 -0
  64. package/lib/locale/messages-nb.js +1 -0
  65. package/lib/locale/messages-nn.d.ts +1 -0
  66. package/lib/locale/messages-nn.js +1 -0
  67. package/lib/locale/messages-se.d.ts +1 -0
  68. package/lib/locale/messages-se.js +1 -0
  69. package/lib/locale/messages-sma.d.ts +1 -0
  70. package/lib/locale/messages-sma.js +1 -0
  71. package/package.json +12 -12
  72. package/src/CompetenceGoals/{CompetenceGoalsDialog.jsx → CompetenceGoalsDialog.tsx} +34 -27
  73. package/src/CompetenceGoals/index.ts +1 -0
  74. package/src/Filter/FilterButtons.tsx +0 -1
  75. package/src/Filter/FilterList.tsx +135 -0
  76. package/src/Filter/FilterListPhone.tsx +275 -0
  77. package/src/Filter/ToggleItem.tsx +58 -0
  78. package/src/Filter/{filterClasses.js → filterClasses.ts} +0 -0
  79. package/src/Filter/{index.js → index.ts} +0 -0
  80. package/src/Frontpage/FrontpageAllSubjects.tsx +0 -1
  81. package/src/Frontpage/FrontpageSearch.tsx +0 -1
  82. package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +0 -1
  83. package/src/Masthead/Masthead.tsx +85 -45
  84. package/src/Masthead/MastheadSearchModal.tsx +0 -1
  85. package/src/Masthead/SkipToMainContent.tsx +48 -0
  86. package/src/Masthead/index.ts +2 -1
  87. package/src/SearchTypeResult/PopupFilter.tsx +0 -1
  88. package/src/SearchTypeResult/SearchFilterContent.tsx +0 -1
  89. package/src/SectionHeading/SectionHeading.tsx +29 -16
  90. package/src/Subject/index.ts +0 -1
  91. package/src/User/UserInfo.tsx +4 -4
  92. package/src/index-javascript.js +0 -10
  93. package/src/index.ts +7 -2
  94. package/src/locale/messages-en.ts +1 -0
  95. package/src/locale/messages-nb.ts +1 -0
  96. package/src/locale/messages-nn.ts +1 -0
  97. package/src/locale/messages-se.ts +1 -0
  98. package/src/locale/messages-sma.ts +1 -0
  99. package/src/main.scss +0 -3
  100. package/es/CompetenceGoals/CompetenceGoalList.js +0 -58
  101. package/es/CompetenceGoals/CompetenceGoals.js +0 -159
  102. package/es/Subject/SubjectFilter.js +0 -42
  103. package/lib/CompetenceGoals/CompetenceGoalList.js +0 -78
  104. package/lib/CompetenceGoals/CompetenceGoals.js +0 -184
  105. package/lib/Subject/SubjectFilter.d.ts +0 -27
  106. package/lib/Subject/SubjectFilter.js +0 -58
  107. package/src/CompetenceGoals/CompetenceGoalList.jsx +0 -51
  108. package/src/CompetenceGoals/CompetenceGoals.jsx +0 -152
  109. package/src/CompetenceGoals/component.competence-goals.scss +0 -161
  110. package/src/CompetenceGoals/index.js +0 -6
  111. package/src/Filter/FilterList.jsx +0 -167
  112. package/src/Filter/FilterListPhone.jsx +0 -329
  113. package/src/Filter/ToggleItem.jsx +0 -71
  114. package/src/Masthead/component.masthead.scss +0 -146
  115. package/src/SectionHeading/component.section-heading.scss +0 -17
  116. package/src/Subject/SubjectFilter.tsx +0 -48
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ 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); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -7,8 +9,6 @@ exports["default"] = void 0;
7
9
 
8
10
  var _react = _interopRequireWildcard(require("react"));
9
11
 
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
12
  var _common = require("@ndla/icons/common");
13
13
 
14
14
  var _filterClasses = require("./filterClasses");
@@ -23,182 +23,112 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
23
23
 
24
24
  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; }
25
25
 
26
- 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); }
27
-
28
26
  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); }
29
27
 
30
28
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
31
29
 
32
30
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
31
 
34
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
-
36
32
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
37
33
 
38
34
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
39
35
 
40
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
41
-
42
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43
-
44
- 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); } }
45
-
46
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
47
-
48
- 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); }
49
-
50
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
51
-
52
- 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); }; }
53
-
54
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
36
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
55
37
 
56
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
38
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
57
39
 
58
- 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; } }
59
-
60
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
61
-
62
- var FilterList = /*#__PURE__*/function (_Component) {
63
- _inherits(FilterList, _Component);
64
-
65
- var _super = _createSuper(FilterList);
66
-
67
- function FilterList(props) {
68
- var _this;
40
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
69
41
 
70
- _classCallCheck(this, FilterList);
42
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
71
43
 
72
- _this = _super.call(this, props);
73
- _this.state = {
74
- visibleCount: props.defaultVisibleCount
75
- };
76
- return _this;
44
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
45
+
46
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
47
+
48
+ var FilterList = function FilterList(_ref) {
49
+ var _ref$modifiers = _ref.modifiers,
50
+ modifiers = _ref$modifiers === void 0 ? '' : _ref$modifiers,
51
+ _ref$preid = _ref.preid,
52
+ preid = _ref$preid === void 0 ? '' : _ref$preid,
53
+ _ref$label = _ref.label,
54
+ label = _ref$label === void 0 ? 'FILTER:' : _ref$label,
55
+ labelNotVisible = _ref.labelNotVisible,
56
+ options = _ref.options,
57
+ _ref$values = _ref.values,
58
+ values = _ref$values === void 0 ? [] : _ref$values,
59
+ _onChange = _ref.onChange,
60
+ defaultVisibleCount = _ref.defaultVisibleCount,
61
+ showLabel = _ref.showLabel,
62
+ hideLabel = _ref.hideLabel,
63
+ alignedGroup = _ref.alignedGroup,
64
+ collapseMobile = _ref.collapseMobile,
65
+ noFilterSelectedLabel = _ref.noFilterSelectedLabel;
66
+
67
+ var _useState = (0, _react.useState)(defaultVisibleCount),
68
+ _useState2 = _slicedToArray(_useState, 2),
69
+ visibleCount = _useState2[0],
70
+ setVisibleCount = _useState2[1];
71
+
72
+ var showAll = defaultVisibleCount === undefined || options.length <= defaultVisibleCount;
73
+ var labelModifiers = [];
74
+
75
+ if (labelNotVisible) {
76
+ labelModifiers.push('hidden');
77
77
  }
78
78
 
79
- _createClass(FilterList, [{
80
- key: "render",
81
- value: function render() {
82
- var _this2 = this;
83
-
84
- var _this$props = this.props,
85
- modifiers = _this$props.modifiers,
86
- preid = _this$props.preid,
87
- label = _this$props.label,
88
- labelNotVisible = _this$props.labelNotVisible,
89
- options = _this$props.options,
90
- values = _this$props.values,
91
- _onChange = _this$props.onChange,
92
- defaultVisibleCount = _this$props.defaultVisibleCount,
93
- showLabel = _this$props.showLabel,
94
- hideLabel = _this$props.hideLabel,
95
- alignedGroup = _this$props.alignedGroup,
96
- collapseMobile = _this$props.collapseMobile;
97
- var showAll = defaultVisibleCount === null || options.length <= defaultVisibleCount;
98
- var labelModifiers = [];
99
-
100
- if (labelNotVisible) {
101
- labelModifiers.push('hidden');
102
- }
79
+ return (0, _core.jsx)("section", (0, _filterClasses.classes)('list', modifiers), label && (0, _core.jsx)("h1", (0, _filterClasses.classes)('label', labelModifiers), label), noFilterSelectedLabel && options.length === 0 && (0, _core.jsx)("span", (0, _filterClasses.classes)('no-filter-selected'), noFilterSelectedLabel), (0, _core.jsx)("ul", (0, _filterClasses.classes)('item-wrapper', {
80
+ 'aligned-grouping': !!alignedGroup,
81
+ 'collapse-mobile': !!collapseMobile
82
+ }), options.map(function (option, index) {
83
+ var itemModifiers = [];
84
+ var checked = values.some(function (value) {
85
+ return value === option.value;
86
+ });
87
+
88
+ if (!showAll && !checked && index + 1 > (visibleCount !== null && visibleCount !== void 0 ? visibleCount : 0)) {
89
+ itemModifiers.push('hidden');
90
+ }
103
91
 
104
- return (0, _core.jsx)("section", (0, _filterClasses.classes)('list', modifiers), label && (0, _core.jsx)("h1", (0, _filterClasses.classes)('label', labelModifiers), label), this.props.noFilterSelectedLabel && options.length === 0 && (0, _core.jsx)("span", (0, _filterClasses.classes)('no-filter-selected'), this.props.noFilterSelectedLabel), (0, _core.jsx)("ul", (0, _filterClasses.classes)('item-wrapper', {
105
- 'aligned-grouping': alignedGroup,
106
- 'collapse-mobile': collapseMobile
107
- }), options.map(function (option, index) {
108
- var itemModifiers = [];
109
- var checked = values.some(function (value) {
110
- return value === option.value;
111
- });
112
-
113
- if (!showAll && !checked && index + 1 > _this2.state.visibleCount) {
114
- itemModifiers.push('hidden');
115
- }
92
+ var disabled = option.noResults || option.hits === 0;
116
93
 
117
- var disabled = option.noResults || option.hits === 0;
94
+ if (disabled) {
95
+ itemModifiers.push('no-results');
96
+ }
118
97
 
119
- if (disabled) {
120
- itemModifiers.push('no-results');
98
+ return (0, _core.jsx)(_ToggleItem["default"], {
99
+ modifiers: itemModifiers,
100
+ id: preid + option.value,
101
+ key: option.value,
102
+ value: option.value,
103
+ disabled: disabled,
104
+ tabIndex: disabled ? -1 : 0,
105
+ checked: checked,
106
+ label: option.title,
107
+ onChange: function onChange(event) {
108
+ var newValues = null;
109
+
110
+ if (event.currentTarget.checked) {
111
+ newValues = [].concat(_toConsumableArray(values), [option.value]);
112
+ } else {
113
+ newValues = values.filter(function (value) {
114
+ return value !== option.value;
115
+ });
121
116
  }
122
117
 
123
- return (0, _core.jsx)(_ToggleItem["default"], {
124
- modifiers: itemModifiers,
125
- id: preid + option.value,
126
- key: option.value,
127
- value: option.value,
128
- disabled: disabled,
129
- tabIndex: disabled ? -1 : 0,
130
- checked: checked,
131
- icon: option.icon,
132
- label: option.title,
133
- onChange: function onChange(event) {
134
- var newValues = null;
135
-
136
- if (event.currentTarget.checked) {
137
- newValues = [].concat(_toConsumableArray(values), [option.value]);
138
- } else {
139
- newValues = values.filter(function (value) {
140
- return value !== option.value;
141
- });
142
- }
143
-
144
- if (_onChange) {
145
- _onChange(newValues, option.value);
146
- }
147
- }
148
- });
149
- })), !showAll && (0, _core.jsx)("button", _extends({}, (0, _filterClasses.classes)('expand'), {
150
- type: "button",
151
- onClick: function onClick() {
152
- _this2.setState(function (prevState) {
153
- if (prevState.visibleCount === defaultVisibleCount) {
154
- return {
155
- visibleCount: options.length
156
- };
157
- }
158
-
159
- return {
160
- visibleCount: defaultVisibleCount
161
- };
162
- });
118
+ if (_onChange) {
119
+ _onChange(newValues, option.value);
163
120
  }
164
- }), this.state.visibleCount === defaultVisibleCount ? (0, _core.jsx)(_react.Fragment, null, (0, _core.jsx)("span", null, showLabel), " ", (0, _core.jsx)(_common.ChevronDown, null)) : (0, _core.jsx)(_react.Fragment, null, (0, _core.jsx)("span", null, hideLabel), " ", (0, _core.jsx)(_common.ChevronUp, null))));
121
+ }
122
+ });
123
+ })), !showAll && (0, _core.jsx)("button", _extends({}, (0, _filterClasses.classes)('expand'), {
124
+ type: "button",
125
+ onClick: function onClick() {
126
+ setVisibleCount(function (prev) {
127
+ return prev === defaultVisibleCount ? options.length : defaultVisibleCount;
128
+ });
165
129
  }
166
- }]);
167
-
168
- return FilterList;
169
- }(_react.Component);
170
-
171
- var valueShape = _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]);
172
-
173
- FilterList.propTypes = {
174
- children: _propTypes["default"].node,
175
- label: _propTypes["default"].string,
176
- preid: _propTypes["default"].string,
177
- labelNotVisible: _propTypes["default"].bool,
178
- modifiers: _propTypes["default"].string,
179
- onChange: _propTypes["default"].func,
180
- // isRequired
181
- options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
182
- title: _propTypes["default"].string.isRequired,
183
- value: valueShape.isRequired,
184
- hits: _propTypes["default"].number,
185
- icon: _propTypes["default"].func,
186
- noResults: _propTypes["default"].bool
187
- })).isRequired,
188
- values: _propTypes["default"].arrayOf(valueShape),
189
- defaultVisibleCount: _propTypes["default"].number,
190
- showLabel: _propTypes["default"].string,
191
- noFilterSelectedLabel: _propTypes["default"].string,
192
- hideLabel: _propTypes["default"].string,
193
- alignedGroup: _propTypes["default"].bool,
194
- collapseMobile: _propTypes["default"].bool
195
- };
196
- FilterList.defaultProps = {
197
- label: 'FILTER:',
198
- preid: '',
199
- modifiers: '',
200
- values: [],
201
- defaultVisibleCount: null
130
+ }), visibleCount === defaultVisibleCount ? (0, _core.jsx)(_react["default"].Fragment, null, (0, _core.jsx)("span", null, showLabel), " ", (0, _core.jsx)(_common.ChevronDown, null)) : (0, _core.jsx)(_react["default"].Fragment, null, (0, _core.jsx)("span", null, hideLabel), " ", (0, _core.jsx)(_common.ChevronUp, null))));
202
131
  };
132
+
203
133
  var _default = FilterList;
204
134
  exports["default"] = _default;
@@ -0,0 +1,32 @@
1
+ /// <reference types="react" />
2
+ interface Option {
3
+ title: string;
4
+ value: string;
5
+ noResults?: boolean;
6
+ disabled?: boolean;
7
+ }
8
+ interface Props {
9
+ preid: string;
10
+ label?: string;
11
+ labelNotVisible?: boolean;
12
+ modifiers?: string;
13
+ onChange: (values: string[], value: string) => void;
14
+ options: Option[] | Option[][];
15
+ values?: string[];
16
+ defaultVisibleCount?: number;
17
+ showLabel?: string;
18
+ hideLabel?: string;
19
+ alignedGroup?: boolean;
20
+ collapseMobile?: boolean;
21
+ activeFiltersNarrow?: boolean;
22
+ messages: {
23
+ useFilter: string;
24
+ openFilter: string;
25
+ closeFilter: string;
26
+ };
27
+ viewMode?: 'inlineDesktop' | 'allModal';
28
+ isGroupedOptions?: boolean;
29
+ showActiveFiltersOnSmallScreen?: boolean;
30
+ }
31
+ declare const FilterListPhone: ({ preid, label, labelNotVisible, modifiers, onChange, options, values, defaultVisibleCount, showLabel, hideLabel, alignedGroup, collapseMobile, activeFiltersNarrow, messages, viewMode, isGroupedOptions, showActiveFiltersOnSmallScreen, }: Props) => JSX.Element;
32
+ export default FilterListPhone;