govuk_publishing_components 43.0.1 → 43.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +39 -17
  3. data/app/assets/stylesheets/component_guide/application.scss +1 -1
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_cross-service-header.scss +3 -1
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +1 -1
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +3 -1
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +32 -3
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +1 -3
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -1
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +1 -1
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +1 -1
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +1 -1
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +1 -1
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -1
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +1 -1
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -1
  17. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -1
  18. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -4
  19. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +4 -0
  20. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +1 -1
  21. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +6 -3
  22. data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +7 -2
  23. data/lib/govuk_publishing_components/version.rb +1 -1
  24. data/node_modules/sortablejs/README.md +3 -2
  25. data/node_modules/sortablejs/Sortable.js +5 -4
  26. data/node_modules/sortablejs/Sortable.min.js +2 -2
  27. data/node_modules/sortablejs/modular/sortable.complete.esm.js +5 -4
  28. data/node_modules/sortablejs/modular/sortable.core.esm.js +5 -4
  29. data/node_modules/sortablejs/modular/sortable.esm.js +5 -4
  30. data/node_modules/sortablejs/package.json +3 -2
  31. data/node_modules/sortablejs/src/Animation.js +175 -0
  32. data/node_modules/sortablejs/src/BrowserInfo.js +12 -0
  33. data/node_modules/sortablejs/src/EventDispatcher.js +57 -0
  34. data/node_modules/sortablejs/src/PluginManager.js +94 -0
  35. data/node_modules/sortablejs/src/Sortable.js +2011 -0
  36. data/node_modules/sortablejs/src/utils.js +595 -0
  37. metadata +8 -2
@@ -0,0 +1,94 @@
1
+ let plugins = [];
2
+
3
+ const defaults = {
4
+ initializeByDefault: true
5
+ };
6
+
7
+ export default {
8
+ mount(plugin) {
9
+ // Set default static properties
10
+ for (let option in defaults) {
11
+ if (defaults.hasOwnProperty(option) && !(option in plugin)) {
12
+ plugin[option] = defaults[option];
13
+ }
14
+ }
15
+
16
+ plugins.forEach(p => {
17
+ if (p.pluginName === plugin.pluginName) {
18
+ throw (`Sortable: Cannot mount plugin ${ plugin.pluginName } more than once`);
19
+ }
20
+ });
21
+
22
+ plugins.push(plugin);
23
+ },
24
+ pluginEvent(eventName, sortable, evt) {
25
+ this.eventCanceled = false;
26
+ evt.cancel = () => {
27
+ this.eventCanceled = true;
28
+ };
29
+ const eventNameGlobal = eventName + 'Global';
30
+ plugins.forEach(plugin => {
31
+ if (!sortable[plugin.pluginName]) return;
32
+ // Fire global events if it exists in this sortable
33
+ if (
34
+ sortable[plugin.pluginName][eventNameGlobal]
35
+ ) {
36
+ sortable[plugin.pluginName][eventNameGlobal]({ sortable, ...evt });
37
+ }
38
+
39
+ // Only fire plugin event if plugin is enabled in this sortable,
40
+ // and plugin has event defined
41
+ if (
42
+ sortable.options[plugin.pluginName] &&
43
+ sortable[plugin.pluginName][eventName]
44
+ ) {
45
+ sortable[plugin.pluginName][eventName]({ sortable, ...evt });
46
+ }
47
+ });
48
+ },
49
+ initializePlugins(sortable, el, defaults, options) {
50
+ plugins.forEach(plugin => {
51
+ const pluginName = plugin.pluginName;
52
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
53
+
54
+ let initialized = new plugin(sortable, el, sortable.options);
55
+ initialized.sortable = sortable;
56
+ initialized.options = sortable.options;
57
+ sortable[pluginName] = initialized;
58
+
59
+ // Add default options from plugin
60
+ Object.assign(defaults, initialized.defaults);
61
+ });
62
+
63
+ for (let option in sortable.options) {
64
+ if (!sortable.options.hasOwnProperty(option)) continue;
65
+ let modified = this.modifyOption(sortable, option, sortable.options[option]);
66
+ if (typeof(modified) !== 'undefined') {
67
+ sortable.options[option] = modified;
68
+ }
69
+ }
70
+ },
71
+ getEventProperties(name, sortable) {
72
+ let eventProperties = {};
73
+ plugins.forEach(plugin => {
74
+ if (typeof(plugin.eventProperties) !== 'function') return;
75
+ Object.assign(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
76
+ });
77
+
78
+ return eventProperties;
79
+ },
80
+ modifyOption(sortable, name, value) {
81
+ let modifiedValue;
82
+ plugins.forEach(plugin => {
83
+ // Plugin must exist on the Sortable
84
+ if (!sortable[plugin.pluginName]) return;
85
+
86
+ // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
87
+ if (plugin.optionListeners && typeof(plugin.optionListeners[name]) === 'function') {
88
+ modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
89
+ }
90
+ });
91
+
92
+ return modifiedValue;
93
+ }
94
+ };