govuk_publishing_components 17.14.0 → 17.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +6 -0
  3. data/app/views/govuk_publishing_components/components/_document_list.html.erb +7 -3
  4. data/app/views/govuk_publishing_components/components/docs/document_list.yml +21 -0
  5. data/lib/govuk_publishing_components/version.rb +1 -1
  6. data/node_modules/accessible-autocomplete/package.json +1 -1
  7. data/node_modules/eslint-utils/index.js +295 -10
  8. data/node_modules/eslint-utils/index.js.map +1 -1
  9. data/node_modules/eslint-utils/index.mjs +288 -7
  10. data/node_modules/eslint-utils/index.mjs.map +1 -1
  11. data/node_modules/eslint-utils/package.json +29 -25
  12. data/node_modules/eslint-visitor-keys/package.json +1 -0
  13. data/node_modules/standard/node_modules/ajv/README.md +18 -3
  14. data/node_modules/standard/node_modules/ajv/dist/ajv.bundle.js +15 -15
  15. data/node_modules/standard/node_modules/ajv/dist/ajv.min.js +2 -2
  16. data/node_modules/standard/node_modules/ajv/dist/ajv.min.js.map +1 -1
  17. data/node_modules/standard/node_modules/ajv/lib/dot/definitions.def +3 -1
  18. data/node_modules/standard/node_modules/ajv/lib/dotjs/allOf.js +1 -1
  19. data/node_modules/standard/node_modules/ajv/lib/dotjs/anyOf.js +1 -1
  20. data/node_modules/standard/node_modules/ajv/lib/dotjs/contains.js +1 -1
  21. data/node_modules/standard/node_modules/ajv/lib/dotjs/dependencies.js +1 -1
  22. data/node_modules/standard/node_modules/ajv/lib/dotjs/if.js +2 -2
  23. data/node_modules/standard/node_modules/ajv/lib/dotjs/items.js +3 -3
  24. data/node_modules/standard/node_modules/ajv/lib/dotjs/not.js +1 -1
  25. data/node_modules/standard/node_modules/ajv/lib/dotjs/oneOf.js +1 -1
  26. data/node_modules/standard/node_modules/ajv/lib/dotjs/properties.js +2 -2
  27. data/node_modules/standard/node_modules/ajv/lib/dotjs/propertyNames.js +1 -1
  28. data/node_modules/standard/node_modules/ajv/lib/dotjs/required.js +1 -1
  29. data/node_modules/standard/node_modules/ajv/package.json +11 -11
  30. data/node_modules/standard/package.json +1 -1
  31. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fae6c310eb63c511c044be1ee8cb28802b3c3d1d767d7e1878b03c819888483
4
- data.tar.gz: 69ad960abde6fa565fe63c5a9e8bb2db1d82bd0b474d0403da0354923fbfa020
3
+ metadata.gz: 9efc12b3a7bac033538c37f639b3d445b7143048cef4cb79f023dcc0f2c73327
4
+ data.tar.gz: 8764534227e500e355d10106fa48207ef289eccb96ecb685167b7f8d1bdc2649
5
5
  SHA512:
6
- metadata.gz: '09bbfe08788bac9d3add154ac0baae7de48a581e4923fa99442f4ac24de638d000aa85654a230bbb01c758661de30ad63af8b937ebfac8d684fb86bfc76f97dd'
7
- data.tar.gz: eab47a1574c05fb21142babbd6c51d898cc8a8809a67d05be617dbe7575a43729462f9f904e3067303693acf2dddf45ffcf3fe4703fbe4b520f8ed332ea29a2d
6
+ metadata.gz: '06985cc2887f08e4689f82bf2611ca5a5697d80e81ca0bdbd4a39c7937806218a9d4d5a9837cb1f5a01f8bcf74989d9f49380cdc3f1a5f67fcac528bd7afb672'
7
+ data.tar.gz: 5f1956bf05209b2f62a3df019606d6ed44515da8a2d5fd731882dd2297bb235e51e78881ea0d326bb5755c127003921136d07e4eb239633aa88d545d9cb28745
@@ -24,6 +24,12 @@
24
24
  display: inline-block;
25
25
  }
26
26
 
27
+ .gem-c-document-list--no-underline {
28
+ .gem-c-document-list__item-title {
29
+ text-decoration: none;
30
+ }
31
+ }
32
+
27
33
  .gem-c-document-list__item-title--context {
28
34
  margin-right: govuk-spacing(2);
29
35
 
@@ -1,9 +1,13 @@
1
1
  <%
2
2
  items ||= []
3
+
4
+ classes = "gem-c-document-list"
5
+ classes << " gem-c-document-list--top-margin" if local_assigns[:margin_top]
6
+ classes << " gem-c-document-list--bottom-margin" if local_assigns[:margin_bottom]
7
+ classes << " gem-c-document-list--no-underline" if local_assigns[:remove_underline]
8
+
3
9
  within_multitype_list ||= false
4
10
  within_multitype_list_class = " gem-c-document-list__multi-list" if within_multitype_list
5
- margin_top_class = " gem-c-document-list--top-margin" if local_assigns[:margin_top]
6
- margin_bottom_class = " gem-c-document-list--bottom-margin" if local_assigns[:margin_bottom]
7
11
  title_with_context_class = " gem-c-document-list__item-title--context"
8
12
 
9
13
  brand ||= false
@@ -11,7 +15,7 @@
11
15
  %>
12
16
  <% if items.any? %>
13
17
  <% unless within_multitype_list %>
14
- <ol class="gem-c-document-list<%= margin_bottom_class %><%= margin_top_class %>">
18
+ <ol class="<%= classes %>">
15
19
  <% end %>
16
20
  <% items.each do |item| %>
17
21
  <% highlight_class = " gem-c-document-list__item--highlight" if item[:highlight] %>
@@ -156,6 +156,27 @@ examples:
156
156
  public_updated_at: 2017-07-19 15:01:48
157
157
  document_type: 'Statistical data set'
158
158
  subtext: 'First published during the 1996 Conservative Government'
159
+ without_underline:
160
+ description: The current search design does not include underlines on links and has been tested without underlines. Other uses will require further user testing.
161
+ data:
162
+ remove_underline: true
163
+ items:
164
+ - link:
165
+ text: 'Department for Education – Statistics at DfE'
166
+ path: '/government/organisations/department-for-education/about/statistics'
167
+ description: 'The Department for Education publishes official statistics on education and children.'
168
+ metadata:
169
+ public_updated_at: 2017-07-19 15:01:48
170
+ document_type: 'Corporate information'
171
+ subtext: 'First published during the 2007 Labour Government'
172
+ - link:
173
+ text: 'State-funded school inspections and outcomes: management information'
174
+ path: '/government/organisations/department-for-education/about/statistics'
175
+ description: 'Management information published monthly and a one-off publication of inspections and outcomes from 2005 to 2015.'
176
+ metadata:
177
+ public_updated_at: 2017-07-19 15:01:48
178
+ document_type: 'Statistical data set'
179
+ subtext: 'First published during the 1996 Conservative Government'
159
180
  highlighted_result:
160
181
  description: Highlight one or more of the items in the list. This is used on finders to provide a 'top result' for a search. The `highlight_text` parameter is optional.
161
182
  data:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '17.14.0'.freeze
2
+ VERSION = '17.15.0'.freeze
3
3
  end
@@ -49,7 +49,7 @@
49
49
  "/"
50
50
  ],
51
51
  "_resolved": "git://github.com/alphagov/accessible-autocomplete.git#3523dd9fffc70cbd9f6f555f75863c33a709f49e",
52
- "_shasum": "79f5e7901599aa4ed0f96da79e43f9958232ba9d",
52
+ "_shasum": "e90b620884c34d12eeb583d4639556727b4bb978",
53
53
  "_shrinkwrap": null,
54
54
  "_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
55
55
  "_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
@@ -3,6 +3,10 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
7
+
8
+ var evk = _interopDefault(require('eslint-visitor-keys'));
9
+
6
10
  /**
7
11
  * Get the innermost scope which contains a given location.
8
12
  * @param {Scope} initialScope The initial scope to search.
@@ -742,12 +746,291 @@ function getFunctionNameWithKind(node) {
742
746
  return tokens.join(" ")
743
747
  }
744
748
 
749
+ const typeConversionBinaryOps = Object.freeze(
750
+ new Set([
751
+ "==",
752
+ "!=",
753
+ "<",
754
+ "<=",
755
+ ">",
756
+ ">=",
757
+ "<<",
758
+ ">>",
759
+ ">>>",
760
+ "+",
761
+ "-",
762
+ "*",
763
+ "/",
764
+ "%",
765
+ "|",
766
+ "^",
767
+ "&",
768
+ "in",
769
+ ])
770
+ );
771
+ const typeConversionUnaryOps = Object.freeze(new Set(["-", "+", "!", "~"]));
772
+ const visitor = Object.freeze(
773
+ Object.assign(Object.create(null), {
774
+ $visit(node, options, visitorKeys) {
775
+ const { type } = node;
776
+
777
+ if (typeof this[type] === "function") {
778
+ return this[type](node, options, visitorKeys)
779
+ }
780
+
781
+ return this.$visitChildren(node, options, visitorKeys)
782
+ },
783
+
784
+ $visitChildren(node, options, visitorKeys) {
785
+ const { type } = node;
786
+
787
+ for (const key of visitorKeys[type] || evk.getKeys(node)) {
788
+ const value = node[key];
789
+
790
+ if (Array.isArray(value)) {
791
+ for (const element of value) {
792
+ if (
793
+ element &&
794
+ this.$visit(element, options, visitorKeys)
795
+ ) {
796
+ return true
797
+ }
798
+ }
799
+ } else if (value && this.$visit(value, options, visitorKeys)) {
800
+ return true
801
+ }
802
+ }
803
+
804
+ return false
805
+ },
806
+
807
+ ArrowFunctionExpression() {
808
+ return false
809
+ },
810
+ AssignmentExpression() {
811
+ return true
812
+ },
813
+ AwaitExpression() {
814
+ return true
815
+ },
816
+ BinaryExpression(node, options, visitorKeys) {
817
+ if (
818
+ options.considerImplicitTypeConversion &&
819
+ typeConversionBinaryOps.has(node.operator) &&
820
+ (node.left.type !== "Literal" || node.right.type !== "Literal")
821
+ ) {
822
+ return true
823
+ }
824
+ return this.$visitChildren(node, options, visitorKeys)
825
+ },
826
+ CallExpression() {
827
+ return true
828
+ },
829
+ FunctionExpression() {
830
+ return false
831
+ },
832
+ ImportExpression() {
833
+ return true
834
+ },
835
+ MemberExpression(node, options, visitorKeys) {
836
+ if (options.considerGetters) {
837
+ return true
838
+ }
839
+ if (
840
+ options.considerImplicitTypeConversion &&
841
+ node.computed &&
842
+ node.property.type !== "Literal"
843
+ ) {
844
+ return true
845
+ }
846
+ return this.$visitChildren(node, options, visitorKeys)
847
+ },
848
+ MethodDefinition(node, options, visitorKeys) {
849
+ if (
850
+ options.considerImplicitTypeConversion &&
851
+ node.computed &&
852
+ node.key.type !== "Literal"
853
+ ) {
854
+ return true
855
+ }
856
+ return this.$visitChildren(node, options, visitorKeys)
857
+ },
858
+ NewExpression() {
859
+ return true
860
+ },
861
+ Property(node, options, visitorKeys) {
862
+ if (
863
+ options.considerImplicitTypeConversion &&
864
+ node.computed &&
865
+ node.key.type !== "Literal"
866
+ ) {
867
+ return true
868
+ }
869
+ return this.$visitChildren(node, options, visitorKeys)
870
+ },
871
+ UnaryExpression(node, options, visitorKeys) {
872
+ if (node.operator === "delete") {
873
+ return true
874
+ }
875
+ if (
876
+ options.considerImplicitTypeConversion &&
877
+ typeConversionUnaryOps.has(node.operator) &&
878
+ node.argument.type !== "Literal"
879
+ ) {
880
+ return true
881
+ }
882
+ return this.$visitChildren(node, options, visitorKeys)
883
+ },
884
+ UpdateExpression() {
885
+ return true
886
+ },
887
+ YieldExpression() {
888
+ return true
889
+ },
890
+ })
891
+ );
892
+
893
+ /**
894
+ * Check whether a given node has any side effect or not.
895
+ * @param {Node} node The node to get.
896
+ * @param {SourceCode} sourceCode The source code object.
897
+ * @param {object} [options] The option object.
898
+ * @param {boolean} [options.considerGetters=false] If `true` then it considers member accesses as the node which has side effects.
899
+ * @param {boolean} [options.considerImplicitTypeConversion=false] If `true` then it considers implicit type conversion as the node which has side effects.
900
+ * @param {object} [options.visitorKeys=evk.KEYS] The keys to traverse nodes. Use `context.getSourceCode().visitorKeys`.
901
+ * @returns {boolean} `true` if the node has a certain side effect.
902
+ */
903
+ function hasSideEffect(
904
+ node,
905
+ sourceCode,
906
+ { considerGetters = false, considerImplicitTypeConversion = false } = {}
907
+ ) {
908
+ return visitor.$visit(
909
+ node,
910
+ { considerGetters, considerImplicitTypeConversion },
911
+ sourceCode.visitorKeys || evk.KEYS
912
+ )
913
+ }
914
+
915
+ /**
916
+ * Get the left parenthesis of the parent node syntax if it exists.
917
+ * E.g., `if (a) {}` then the `(`.
918
+ * @param {Node} node The AST node to check.
919
+ * @param {SourceCode} sourceCode The source code object to get tokens.
920
+ * @returns {Token|null} The left parenthesis of the parent node syntax
921
+ */
922
+ function getParentSyntaxParen(node, sourceCode) {
923
+ const parent = node.parent;
924
+
925
+ switch (parent.type) {
926
+ case "CallExpression":
927
+ case "NewExpression":
928
+ if (parent.arguments.length === 1 && parent.arguments[0] === node) {
929
+ return sourceCode.getTokenAfter(
930
+ parent.callee,
931
+ isOpeningParenToken
932
+ )
933
+ }
934
+ return null
935
+
936
+ case "DoWhileStatement":
937
+ if (parent.test === node) {
938
+ return sourceCode.getTokenAfter(
939
+ parent.body,
940
+ isOpeningParenToken
941
+ )
942
+ }
943
+ return null
944
+
945
+ case "IfStatement":
946
+ case "WhileStatement":
947
+ if (parent.test === node) {
948
+ return sourceCode.getFirstToken(parent, 1)
949
+ }
950
+ return null
951
+
952
+ case "ImportExpression":
953
+ if (parent.source === node) {
954
+ return sourceCode.getFirstToken(parent, 1)
955
+ }
956
+ return null
957
+
958
+ case "SwitchStatement":
959
+ if (parent.discriminant === node) {
960
+ return sourceCode.getFirstToken(parent, 1)
961
+ }
962
+ return null
963
+
964
+ case "WithStatement":
965
+ if (parent.object === node) {
966
+ return sourceCode.getFirstToken(parent, 1)
967
+ }
968
+ return null
969
+
970
+ default:
971
+ return null
972
+ }
973
+ }
974
+
975
+ /**
976
+ * Check whether a given node is parenthesized or not.
977
+ * @param {number} times The number of parantheses.
978
+ * @param {Node} node The AST node to check.
979
+ * @param {SourceCode} sourceCode The source code object to get tokens.
980
+ * @returns {boolean} `true` if the node is parenthesized the given times.
981
+ */
982
+ /**
983
+ * Check whether a given node is parenthesized or not.
984
+ * @param {Node} node The AST node to check.
985
+ * @param {SourceCode} sourceCode The source code object to get tokens.
986
+ * @returns {boolean} `true` if the node is parenthesized.
987
+ */
988
+ function isParenthesized(
989
+ timesOrNode,
990
+ nodeOrSourceCode,
991
+ optionalSourceCode
992
+ ) {
993
+ let times, node, sourceCode, maybeLeftParen, maybeRightParen;
994
+ if (typeof timesOrNode === "number") {
995
+ times = timesOrNode | 0;
996
+ node = nodeOrSourceCode;
997
+ sourceCode = optionalSourceCode;
998
+ if (!(times >= 1)) {
999
+ throw new TypeError("'times' should be a positive integer.")
1000
+ }
1001
+ } else {
1002
+ times = 1;
1003
+ node = timesOrNode;
1004
+ sourceCode = nodeOrSourceCode;
1005
+ }
1006
+
1007
+ if (node == null) {
1008
+ return false
1009
+ }
1010
+
1011
+ maybeLeftParen = maybeRightParen = node;
1012
+ do {
1013
+ maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen);
1014
+ maybeRightParen = sourceCode.getTokenAfter(maybeRightParen);
1015
+ } while (
1016
+ maybeLeftParen != null &&
1017
+ maybeRightParen != null &&
1018
+ isOpeningParenToken(maybeLeftParen) &&
1019
+ isClosingParenToken(maybeRightParen) &&
1020
+ // Avoid false positive such as `if (a) {}`
1021
+ maybeLeftParen !== getParentSyntaxParen(node, sourceCode) &&
1022
+ --times > 0
1023
+ )
1024
+
1025
+ return times === 0
1026
+ }
1027
+
745
1028
  /**
746
1029
  * @author Toru Nagashima <https://github.com/mysticatea>
747
1030
  * See LICENSE file in root directory for full license.
748
1031
  */
749
1032
 
750
- const placeholder = /\$(?:[$&`']|[1-9][0-9]?)/g;
1033
+ const placeholder = /\$(?:[$&`']|[1-9][0-9]?)/gu;
751
1034
 
752
1035
  /** @type {WeakMap<PatternMatcher, {pattern:RegExp,escaped:boolean}>} */
753
1036
  const internal = new WeakMap();
@@ -814,7 +1097,6 @@ function replaceS(matcher, str, replacement) {
814
1097
  return chunks.join("")
815
1098
  }
816
1099
 
817
- //eslint-disable-next-line valid-jsdoc
818
1100
  /**
819
1101
  * Replace a given string by a given matcher.
820
1102
  * @param {PatternMatcher} matcher The pattern matcher.
@@ -890,7 +1172,6 @@ class PatternMatcher {
890
1172
  return !ret.done
891
1173
  }
892
1174
 
893
- //eslint-disable-next-line valid-jsdoc
894
1175
  /**
895
1176
  * Replace a given string.
896
1177
  * @param {string} str The string to be replaced.
@@ -904,8 +1185,8 @@ class PatternMatcher {
904
1185
  }
905
1186
  }
906
1187
 
907
- const SENTINEL_TYPE = /^(?:.+?Statement|.+?Declaration|(?:Array|ArrowFunction|Assignment|Call|Class|Function|Member|New|Object)Expression|AssignmentPattern|Program|VariableDeclarator)$/;
908
- const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/;
1188
+ const SENTINEL_TYPE = /^(?:.+?Statement|.+?Declaration|(?:Array|ArrowFunction|Assignment|Call|Class|Function|Member|New|Object)Expression|AssignmentPattern|Program|VariableDeclarator)$/u;
1189
+ const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u;
909
1190
  const has = Function.call.bind(Object.hasOwnProperty);
910
1191
 
911
1192
  const READ = Symbol("read");
@@ -1126,7 +1407,7 @@ class ReferenceTracker {
1126
1407
  * @param {object} traceMap The trace map.
1127
1408
  * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
1128
1409
  */
1129
- //eslint-disable-next-line complexity, require-jsdoc
1410
+ //eslint-disable-next-line complexity
1130
1411
  *_iteratePropertyReferences(rootNode, path, traceMap) {
1131
1412
  let node = rootNode;
1132
1413
  while (!SENTINEL_TYPE.test(node.parent.type)) {
@@ -1342,6 +1623,7 @@ var index = {
1342
1623
  getPropertyName,
1343
1624
  getStaticValue,
1344
1625
  getStringIfConstant,
1626
+ hasSideEffect,
1345
1627
  isArrowToken,
1346
1628
  isClosingBraceToken,
1347
1629
  isClosingBracketToken,
@@ -1363,16 +1645,20 @@ var index = {
1363
1645
  isOpeningBraceToken,
1364
1646
  isOpeningBracketToken,
1365
1647
  isOpeningParenToken,
1648
+ isParenthesized,
1366
1649
  isSemicolonToken,
1367
1650
  PatternMatcher,
1368
1651
  READ,
1369
1652
  ReferenceTracker,
1370
1653
  };
1371
1654
 
1372
- exports.default = index;
1373
1655
  exports.CALL = CALL;
1374
1656
  exports.CONSTRUCT = CONSTRUCT;
1375
1657
  exports.ESM = ESM;
1658
+ exports.PatternMatcher = PatternMatcher;
1659
+ exports.READ = READ;
1660
+ exports.ReferenceTracker = ReferenceTracker;
1661
+ exports.default = index;
1376
1662
  exports.findVariable = findVariable;
1377
1663
  exports.getFunctionHeadLocation = getFunctionHeadLocation;
1378
1664
  exports.getFunctionNameWithKind = getFunctionNameWithKind;
@@ -1380,6 +1666,7 @@ exports.getInnermostScope = getInnermostScope;
1380
1666
  exports.getPropertyName = getPropertyName;
1381
1667
  exports.getStaticValue = getStaticValue;
1382
1668
  exports.getStringIfConstant = getStringIfConstant;
1669
+ exports.hasSideEffect = hasSideEffect;
1383
1670
  exports.isArrowToken = isArrowToken;
1384
1671
  exports.isClosingBraceToken = isClosingBraceToken;
1385
1672
  exports.isClosingBracketToken = isClosingBracketToken;
@@ -1401,8 +1688,6 @@ exports.isNotSemicolonToken = isNotSemicolonToken;
1401
1688
  exports.isOpeningBraceToken = isOpeningBraceToken;
1402
1689
  exports.isOpeningBracketToken = isOpeningBracketToken;
1403
1690
  exports.isOpeningParenToken = isOpeningParenToken;
1691
+ exports.isParenthesized = isParenthesized;
1404
1692
  exports.isSemicolonToken = isSemicolonToken;
1405
- exports.PatternMatcher = PatternMatcher;
1406
- exports.READ = READ;
1407
- exports.ReferenceTracker = ReferenceTracker;
1408
1693
  //# sourceMappingURL=index.js.map