@penskemediacorp/larva-patterns 1.60.1-alpha.0 → 1.61.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.
@@ -0,0 +1,66 @@
1
+ [
2
+ {
3
+ "name": "email",
4
+ "label": "Email"
5
+ },
6
+ {
7
+ "name": "facebook",
8
+ "label": "Facebook"
9
+ },
10
+ {
11
+ "name": "facebook-circle",
12
+ "label": "Facebook"
13
+ },
14
+ {
15
+ "name": "flipboard",
16
+ "label": "Fliboard"
17
+ },
18
+ {
19
+ "name": "instagram",
20
+ "label": "Instagram"
21
+ },
22
+ {
23
+ "name": "linkedin",
24
+ "label": "LinkedIn"
25
+ },
26
+ {
27
+ "name": "mastodon",
28
+ "label": "Mastodon"
29
+ },
30
+ {
31
+ "name": "pinit",
32
+ "label": "Pinterest"
33
+ },
34
+ {
35
+ "name": "print",
36
+ "label": "Print"
37
+ },
38
+ {
39
+ "name": "reddit",
40
+ "label": "Reddit"
41
+ },
42
+ {
43
+ "name": "threads",
44
+ "label": "Threads"
45
+ },
46
+ {
47
+ "name": "tiktok",
48
+ "label": "Tiktok"
49
+ },
50
+ {
51
+ "name": "tumblr",
52
+ "label": "Tumblr"
53
+ },
54
+ {
55
+ "name": "twitch",
56
+ "label": "Twitch"
57
+ },
58
+ {
59
+ "name": "twitter",
60
+ "label": "X"
61
+ },
62
+ {
63
+ "name": "youtube",
64
+ "label": "YouTube"
65
+ }
66
+ ]
@@ -1,20 +1,24 @@
1
1
  {% if c_icon_url %}
2
- <a class="{{ c_icon_link_classes }}" href="{{ c_icon_url }}"
3
- {% if c_icon_rel_name %}
4
- rel="{{ c_icon_rel_name }}"
5
- {% endif %}
6
- {% if c_icon_target_attr %}
7
- target="{{ c_icon_target_attr }}"
8
- {% endif %}
9
- >
10
- <span class="lrv-a-screen-reader-only">{{ c_icon_link_screen_reader_text }}</span>
2
+ <a class="{{ c_icon_link_classes }}" href="{{ c_icon_url }}"
3
+ {% if c_icon_rel_name %}
4
+ rel="{{ c_icon_rel_name }}"
5
+ {% endif %}
6
+ {% if c_icon_target_attr %}
7
+ target="{{ c_icon_target_attr }}"
8
+ {% endif %}
9
+ {% if c_icon_screen_reader_title_attr %}
10
+ title="{{ c_icon_screen_reader_title_attr }}"
11
+ {% endif %}
12
+ >
13
+
14
+ <span class="lrv-a-screen-reader-only" data-label="c_icon_link_screen_reader_text">{{ c_icon_link_screen_reader_text }}</span>
11
15
  {% endif %}
12
16
 
13
17
  {% if c_icon_screen_reader_text %}
14
18
  {% if c_icon_screen_reader_tag_text %}
15
- <{{ c_icon_screen_reader_tag_text }} class="lrv-a-screen-reader-only" title="{{ c_icon_screen_reader_title_attr }}">{{ c_icon_screen_reader_text }}</{{ c_icon_screen_reader_tag_text }}>
19
+ <{{ c_icon_screen_reader_tag_text }} class="lrv-a-screen-reader-only" data-label="c_icon_screen_reader_text">{{ c_icon_screen_reader_text }}</{{ c_icon_screen_reader_tag_text }}>
16
20
  {% else %}
17
- <span class="lrv-a-screen-reader-only" title="{{ c_icon_screen_reader_title_attr }}">{{ c_icon_screen_reader_text }}</span>
21
+ <span class="lrv-a-screen-reader-only" data-label="c_icon_screen_reader_text">{{ c_icon_screen_reader_text }}</span>
18
22
  {% endif %}
19
23
  {% endif %}
20
24
 
@@ -30,5 +34,5 @@
30
34
  </svg>
31
35
 
32
36
  {% if c_icon_url %}
33
- </a>
37
+ </a>
34
38
  {% endif %}
@@ -32,19 +32,22 @@ c_tagline.c_tagline_text =
32
32
 
33
33
  o_social_list.o_social_list_classes += ' lrv-u-flex';
34
34
 
35
- const social = [ 'instagram', 'twitter', 'facebook', 'youtube' ];
35
+ const socialPlatforms = require( '../../utils/getSocialPlatforms' )( [ 'instagram', 'twitter', 'facebook', 'youtube' ] );
36
36
  const o_social_list_icons = [];
37
37
 
38
- for ( let i = 0; i < social.length; i++ ) {
38
+ socialPlatforms.forEach( ( { name, label } ) => {
39
39
  const c_icon = clonedeep( c_icon_prototype );
40
40
 
41
- c_icon.c_icon_name = social[ i ];
41
+ c_icon.c_icon_name = name;
42
42
  c_icon.c_icon_link_classes +=
43
43
  ' lrv-u-display-block lrv-u-border-radius-50p lrv-u-padding-a-025 lrv-u-color-grey lrv-u-background-color-white lrv-u-color-grey-dark:hover lrv-u-margin-r-1';
44
44
  c_icon.c_icon_url = '#';
45
+ c_icon.c_icon_screen_reader_text = label;
46
+ c_icon.c_icon_screen_reader_title_attr = label;
45
47
 
46
48
  o_social_list_icons.push( c_icon );
47
- }
49
+ } );
50
+
48
51
  o_social_list.o_social_list_icons = o_social_list_icons;
49
52
 
50
53
  module.exports = {
@@ -47,15 +47,17 @@ c_icon_twitter.c_icon_name = 'twitter';
47
47
  c_icon_twitter.c_icon_classes =
48
48
  'lrv-u-width-16 lrv-u-height-16 lrv-u-color-black';
49
49
  c_icon_twitter.c_icon_url = '#';
50
- c_icon_twitter.c_icon_screen_reader_text = 'Twitter Icon';
51
- c_icon_twitter.c_icon_screen_reader_title_attr = 'Twitter Icon';
50
+ c_icon_twitter.c_icon_link_screen_reader_text = 'X Icon';
51
+ c_icon_twitter.c_icon_screen_reader_text = false;
52
+ c_icon_twitter.c_icon_screen_reader_title_attr = 'X Icon';
52
53
  c_icon_twitter.c_icon_link_classes = 'lrv-u-flex';
53
54
 
54
55
  c_icon_mail.c_icon_name = 'envelope';
55
56
  c_icon_mail.c_icon_classes =
56
57
  'lrv-u-margin-l-075 lrv-u-width-16 lrv-u-height-16 lrv-u-color-black';
57
58
  c_icon_mail.c_icon_url = '#';
58
- c_icon_mail.c_icon_screen_reader_text = 'Email Icon';
59
+ c_icon_mail.c_icon_link_screen_reader_text = 'Email Icon';
60
+ c_icon_mail.c_icon_screen_reader_text = false;
59
61
  c_icon_mail.c_icon_screen_reader_title_attr = 'Email Icon';
60
62
  c_icon_mail.c_icon_link_classes = 'lrv-u-flex';
61
63
 
@@ -21,22 +21,24 @@ c_tagline.c_tagline_classes =
21
21
  c_tagline.c_tagline_text =
22
22
  'Get our latest stories in the feed of your favorite networks';
23
23
 
24
- const social = [ 'instagram', 'pinit', 'twitter', 'facebook', 'youtube' ];
24
+ const socialPlatforms = require( '../../utils/getSocialPlatforms' )();
25
25
 
26
26
  // Clear existing icons, update classes
27
27
  o_social_list.o_social_list_icons = [];
28
28
  o_social_list.o_social_list_classes =
29
29
  'lrv-a-unstyle-list lrv-u-flex lrv-u-align-items-center lrv-u-justify-content-center';
30
30
 
31
- for ( let i = 0; i < social.length; i++ ) {
31
+ socialPlatforms.forEach( ( { name, label } ) => {
32
32
  const c_icon = clonedeep( c_icon_prototype );
33
33
  c_icon.c_icon_url = '#';
34
- c_icon.c_icon_name = social[ i ];
34
+ c_icon.c_icon_name = name;
35
35
  c_icon.c_icon_link_classes +=
36
36
  ' lrv-u-display-block lrv-u-border-radius-50p lrv-u-color-grey lrv-u-margin-lr-050 lrv-u-padding-a-050 lrv-u-background-color-white lrv-u-color-grey-dark:hover';
37
+ c_icon.c_icon_screen_reader_text = label;
38
+ c_icon.c_icon_screen_reader_title_attr = label;
37
39
 
38
40
  o_social_list.o_social_list_icons.push( c_icon );
39
- }
41
+ } );
40
42
 
41
43
  module.exports = {
42
44
  footer_social_classes:
@@ -15,18 +15,22 @@ read_next.c_title.c_title_link_classes =
15
15
  'lrv-a-unstyle-link lrv-u-whitespace-nowrap lrv-a-font-body-m';
16
16
 
17
17
  const o_social_list = clonedeep( o_social_list_prototype );
18
- const social_icons = [ 'facebook-rs', 'twitter', 'email' ];
18
+
19
+ const socialPlatforms = require( '../../utils/getSocialPlatforms' )( [ 'facebook', 'twitter', 'email' ] );
20
+
19
21
  const social_list_icons = [];
20
22
  o_social_list.o_social_list_icons = [];
21
- for ( let i = 0; i < social_icons.length; i++ ) {
23
+ socialPlatforms.forEach( ( { name, label } ) => {
22
24
  const c_icon = clonedeep( c_icon_prototype );
23
- c_icon.c_icon_name = social_icons[ i ];
25
+ c_icon.c_icon_name = name;
24
26
  c_icon.c_icon_url = '#';
25
27
  c_icon.c_icon_link_classes +=
26
28
  'lrv-u-background-color-white lrv-u-border-radius-50p lrv-u-color-black lrv-u-color-brand-primary:hover lrv-u-display-block';
27
29
  c_icon.c_icon_rel_name = 'noopener noreferrer';
30
+ c_icon.c_icon_screen_reader_text = label;
31
+ c_icon.c_icon_screen_reader_title_attr = label;
28
32
  social_list_icons.push( c_icon );
29
- }
33
+ } );
30
34
  o_social_list.o_social_list_icons = social_list_icons;
31
35
 
32
36
  const header_sticky = clonedeep( header_sticky_prototype );
@@ -3,15 +3,10 @@ const clonedeep = require( 'lodash.clonedeep' );
3
3
  const c_icon = clonedeep(
4
4
  require( '../../components/c-icon/c-icon.prototype' )
5
5
  );
6
- const social_share_primary_items = [
7
- 'facebook',
8
- 'twitter',
9
- 'pinterest',
10
- 'tumblr',
11
- 'reddit',
12
- 'linkedin',
13
- 'print',
14
- ];
6
+
7
+ const socialPlatforms = require( '../../utils/getSocialPlatforms' )( [
8
+ 'facebook', 'twitter', 'pinit', 'tumblr', 'reddit', 'linkedin', 'print'
9
+ ] );
15
10
 
16
11
  const social_share_primary = [];
17
12
  const social_share_secondary = [];
@@ -22,11 +17,13 @@ c_icon_struct.c_icon_link_classes =
22
17
  c_icon_struct.c_icon_url = '#';
23
18
  c_icon_struct.c_icon_classes = 'lrv-u-width-16 lrv-u-height-16';
24
19
 
25
- for ( let i = 0; i < social_share_primary_items.length; i++ ) {
20
+ for ( let i = 0; i < socialPlatforms.length; i++ ) {
26
21
  const c_icon_social = clonedeep( c_icon_struct );
27
22
 
28
- c_icon_social.c_icon_rel_name = social_share_primary_items[ i ];
29
- c_icon_social.c_icon_name = social_share_primary_items[ i ];
23
+ c_icon_social.c_icon_rel_name = socialPlatforms[ i ].name;
24
+ c_icon_social.c_icon_name = socialPlatforms[ i ].name;
25
+ c_icon_social.c_icon_screen_reader_text = socialPlatforms[ i ].label;
26
+ c_icon_social.c_icon_screen_reader_title_attr = socialPlatforms[ i ].label;
30
27
 
31
28
  if ( 3 < i ) {
32
29
  social_share_primary.push( c_icon_social );
@@ -2,20 +2,22 @@ const clonedeep = require( 'lodash.clonedeep' );
2
2
 
3
3
  const c_icon_prototype = require( '../../components/c-icon/c-icon.prototype' );
4
4
 
5
- const social = [ 'instagram', 'pinit', 'twitter', 'facebook', 'youtube' ];
5
+ const socialPlatforms = require( '../../utils/getSocialPlatforms' )();
6
6
  const o_social_list_icons = [];
7
7
 
8
- for ( let i = 0; i < social.length; i++ ) {
8
+ socialPlatforms.forEach( ( { name, label } ) => {
9
9
  const c_icon = clonedeep( c_icon_prototype );
10
10
 
11
11
  c_icon.c_icon_url = '#';
12
- c_icon.c_icon_name = social[ i ];
12
+ c_icon.c_icon_name = name;
13
13
  c_icon.c_icon_link_classes +=
14
14
  ' lrv-u-display-block lrv-u-border-radius-50p lrv-u-color-grey lrv-u-margin-lr-050 lrv-u-padding-a-050 lrv-u-background-color-white lrv-u-color-grey-dark:hover';
15
15
  c_icon.c_icon_rel_name = 'noopener noreferrer';
16
+ c_icon.c_icon_screen_reader_text = label;
17
+ c_icon.c_icon_screen_reader_title_attr = label;
16
18
 
17
19
  o_social_list_icons.push( c_icon );
18
- }
20
+ } );
19
21
 
20
22
  module.exports = {
21
23
  o_social_list_classes: 'lrv-a-unstyle-list',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@penskemediacorp/larva-patterns",
3
- "version": "1.60.1-alpha.0",
3
+ "version": "1.61.0",
4
4
  "description": "Larva markup patterns.",
5
5
  "author": "laras126 <laras126@gmail.com>",
6
6
  "homepage": "https://github.com/Penske-Media-Corp/pmc-larva/tree/master/packages/patterns#readme",
@@ -20,10 +20,10 @@
20
20
  "url": "https://github.com/Penske-Media-Corp/pmc-larva/issues"
21
21
  },
22
22
  "dependencies": {
23
- "@penskemediacorp/larva-css": "^1.60.1-alpha.0",
24
- "@penskemediacorp/larva-js": "^1.60.1-alpha.0",
25
- "@penskemediacorp/larva-svg": "^1.60.1-alpha.0",
23
+ "@penskemediacorp/larva-css": "^1.61.0",
24
+ "@penskemediacorp/larva-js": "^1.61.0",
25
+ "@penskemediacorp/larva-svg": "^1.61.0",
26
26
  "lodash.clonedeep": "^4"
27
27
  },
28
- "gitHead": "dd87a592e9f55e1283f6509ecd75147fdab552db"
28
+ "gitHead": "157b46439385b2ce204de0cbb0ce1f1bee0d7a78"
29
29
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Helper function to get larva-patterns/_data array by property
3
+ *
4
+ * @param {String} filename JSON filenames in ../_data.
5
+ * @param {String} orderKey Object property name to sort/order by.
6
+ * @param {Array} orderValues Desired items from data file(s) (by orderKey property).
7
+ */
8
+ module.exports = function( filename, orderKey, orderValues ) {
9
+ const data = require( `../_data/${ filename }.json` );
10
+
11
+ if ( orderKey && orderValues ) {
12
+ const sortedData = [];
13
+
14
+ orderValues.forEach( ( orderValue ) => {
15
+ sortedData.push(
16
+ data.find( ( values ) => values[ orderKey ] === orderValue )
17
+ );
18
+ } );
19
+
20
+ return sortedData;
21
+ } else {
22
+ return data;
23
+ }
24
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Get social platform information
3
+ *
4
+ * @param {Array} platforms "name" property values of desired platforms (see ../_data/social-platforms.json).
5
+ */
6
+ module.exports = function( platforms ) {
7
+ return require( './getDataSet' )( 'social-platforms', 'name',
8
+ undefined === platforms ? [ 'instagram', 'pinit', 'twitter', 'facebook', 'youtube' ] : platforms
9
+ );
10
+ }