@times-design-system/components-wordpress 1.6.0 → 1.7.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.
@@ -23,6 +23,8 @@ $href = isset($attributes['href']) ? esc_url($attributes['href']) : '';
23
23
  $target = isset($attributes['target']) ? sanitize_text_field($attributes['target']) : '';
24
24
  $rel = isset($attributes['rel']) ? sanitize_text_field($attributes['rel']) : '';
25
25
  $type = isset($attributes['type']) ? sanitize_text_field($attributes['type']) : 'button';
26
+ $icon_left = isset($attributes['iconLeft']) ? sanitize_text_field($attributes['iconLeft']) : '';
27
+ $icon_right = isset($attributes['iconRight']) ? sanitize_text_field($attributes['iconRight']) : '';
26
28
  $aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
27
29
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
28
30
 
@@ -70,7 +72,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => 'tds-button-wrapper'])
70
72
  <?php echo wp_kses_post($data_attrs_html); ?>
71
73
  >
72
74
  <span class="tds-button__label-container">
75
+ <?php if ($icon_left) : ?>
76
+ <span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post($icon_left); ?></span>
77
+ <?php endif; ?>
73
78
  <span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
79
+ <?php if ($icon_right) : ?>
80
+ <span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post($icon_right); ?></span>
81
+ <?php endif; ?>
74
82
  </span>
75
83
  </a>
76
84
  <?php
@@ -84,7 +92,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => 'tds-button-wrapper'])
84
92
  <?php echo wp_kses_post($data_attrs_html); ?>
85
93
  >
86
94
  <span class="tds-button__label-container">
95
+ <?php if ($icon_left) : ?>
96
+ <span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post($icon_left); ?></span>
97
+ <?php endif; ?>
87
98
  <span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
99
+ <?php if ($icon_right) : ?>
100
+ <span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post($icon_right); ?></span>
101
+ <?php endif; ?>
88
102
  </span>
89
103
  </button>
90
104
  <?php
@@ -17,6 +17,8 @@ $intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent
17
17
  $size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
18
18
  $channel = isset($attributes['channel']) ? (bool) $attributes['channel'] : false;
19
19
  $toggle = isset($attributes['toggle']) ? (bool) $attributes['toggle'] : false;
20
+ $icon_left = isset($attributes['iconLeft']) ? sanitize_text_field($attributes['iconLeft']) : '';
21
+ $icon_right = isset($attributes['iconRight']) ? sanitize_text_field($attributes['iconRight']) : '';
20
22
  $aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
21
23
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
22
24
 
@@ -48,5 +50,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
48
50
  <?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
49
51
  <?php echo wp_kses_post($data_attrs_html); ?>
50
52
  >
51
- <span class="tds-chip__content"><?php echo wp_kses_post($content_text); ?></span>
53
+ <span class="tds-chip__content">
54
+ <?php if ($icon_left) : ?>
55
+ <span class="tds-chip__icon tds-chip__icon--left"><?php echo wp_kses_post($icon_left); ?></span>
56
+ <?php endif; ?>
57
+ <?php echo wp_kses_post($content_text); ?>
58
+ <?php if ($icon_right) : ?>
59
+ <span class="tds-chip__icon tds-chip__icon--right"><?php echo wp_kses_post($icon_right); ?></span>
60
+ <?php endif; ?>
61
+ </span>
52
62
  </button>
@@ -13,6 +13,7 @@
13
13
 
14
14
  require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
15
15
 
16
+ $content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
16
17
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
17
18
 
18
19
  // Sanitize and prepare data-* attributes
@@ -22,7 +23,7 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
22
23
  $data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
23
24
  }
24
25
 
25
- $wrapper_classes = [];
26
+ $wrapper_classes = ['tds-dialog-box'];
26
27
  if ($element_class_name) {
27
28
  $wrapper_classes[] = $element_class_name;
28
29
  }
@@ -30,7 +31,5 @@ $wrapper_attributes = get_block_wrapper_attributes(['class' => implode(' ', $wra
30
31
 
31
32
  ?>
32
33
  <div <?php echo wp_kses_post($wrapper_attributes); ?><?php echo wp_kses_post($data_attrs_html); ?>>
33
- <!-- TODO: Render DialogBox component here -->
34
- <!-- Use CSS custom properties from packages/tokens/data/resolved-hexes.json -->
35
- <!-- Apply BEM naming: tds-dialog-box--{modifier} -->
34
+ <?php echo wp_kses_post($content_text); ?>
36
35
  </div>
@@ -16,6 +16,8 @@ $label = isset($attributes['label']) ? sanitize_text_field($attributes['label'])
16
16
  $content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
17
17
  $intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
18
18
  $size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
19
+ $icon_left = isset($attributes['iconLeft']) ? sanitize_text_field($attributes['iconLeft']) : '';
20
+ $icon_right = isset($attributes['iconRight']) ? sanitize_text_field($attributes['iconRight']) : '';
19
21
  $aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
20
22
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
21
23
 
@@ -42,7 +44,15 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
42
44
  <?php echo wp_kses_post($data_attrs_html); ?>
43
45
  >
44
46
  <?php if ($label) : ?>
45
- <div class="tds-flag__label"><?php echo wp_kses_post($label); ?></div>
47
+ <div class="tds-flag__label">
48
+ <?php if ($icon_left) : ?>
49
+ <span class="tds-flag__icon tds-flag__icon--left"><?php echo wp_kses_post($icon_left); ?></span>
50
+ <?php endif; ?>
51
+ <?php echo wp_kses_post($label); ?>
52
+ <?php if ($icon_right) : ?>
53
+ <span class="tds-flag__icon tds-flag__icon--right"><?php echo wp_kses_post($icon_right); ?></span>
54
+ <?php endif; ?>
55
+ </div>
46
56
  <?php endif; ?>
47
57
  <div class="tds-flag__content"><?php echo wp_kses_post($content_text); ?></div>
48
58
  </div>
@@ -13,6 +13,7 @@
13
13
 
14
14
  require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
15
15
 
16
+ $content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
16
17
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
17
18
 
18
19
  // Sanitize and prepare data-* attributes
@@ -22,15 +23,13 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
22
23
  $data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
23
24
  }
24
25
 
25
- $wrapper_classes = [];
26
+ $wrapper_classes = ['tds-icon'];
26
27
  if ($element_class_name) {
27
28
  $wrapper_classes[] = $element_class_name;
28
29
  }
29
30
  $wrapper_attributes = get_block_wrapper_attributes(['class' => implode(' ', $wrapper_classes)]);
30
31
 
31
32
  ?>
32
- <div <?php echo wp_kses_post($wrapper_attributes); ?><?php echo wp_kses_post($data_attrs_html); ?>>
33
- <!-- TODO: Render Icon component here -->
34
- <!-- Use CSS custom properties from packages/tokens/data/resolved-hexes.json -->
35
- <!-- Apply BEM naming: tds-icon--{modifier} -->
36
- </div>
33
+ <span <?php echo wp_kses_post($wrapper_attributes); ?><?php echo wp_kses_post($data_attrs_html); ?>>
34
+ <?php echo wp_kses_post($content_text); ?>
35
+ </span>
@@ -13,6 +13,7 @@
13
13
 
14
14
  require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
15
15
 
16
+ $content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
16
17
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
17
18
 
18
19
  // Sanitize and prepare data-* attributes
@@ -22,7 +23,7 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
22
23
  $data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
23
24
  }
24
25
 
25
- $wrapper_classes = [];
26
+ $wrapper_classes = ['tds-input-helper-message'];
26
27
  if ($element_class_name) {
27
28
  $wrapper_classes[] = $element_class_name;
28
29
  }
@@ -30,7 +31,5 @@ $wrapper_attributes = get_block_wrapper_attributes(['class' => implode(' ', $wra
30
31
 
31
32
  ?>
32
33
  <div <?php echo wp_kses_post($wrapper_attributes); ?><?php echo wp_kses_post($data_attrs_html); ?>>
33
- <!-- TODO: Render InputHelperMessage component here -->
34
- <!-- Use CSS custom properties from packages/tokens/data/resolved-hexes.json -->
35
- <!-- Apply BEM naming: tds-input-helper-message--{modifier} -->
34
+ <?php echo wp_kses_post($content_text); ?>
36
35
  </div>
@@ -17,6 +17,8 @@ $content_text = isset($attributes['content']) ? wp_kses_post($attributes['conten
17
17
  $intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
18
18
  $sentiment = isset($attributes['sentiment']) ? sanitize_text_field($attributes['sentiment']) : '';
19
19
  $size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
20
+ $icon_left = isset($attributes['iconLeft']) ? sanitize_text_field($attributes['iconLeft']) : '';
21
+ $icon_right = isset($attributes['iconRight']) ? sanitize_text_field($attributes['iconRight']) : '';
20
22
  $inline = isset($attributes['inline']) ? (bool) $attributes['inline'] : true;
21
23
  $aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
22
24
  $target = isset($attributes['target']) ? sanitize_text_field($attributes['target']) : '_self';
@@ -52,5 +54,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
52
54
  <?php echo $rel ? 'rel="' . esc_attr($rel) . '"' : ''; ?>
53
55
  <?php echo wp_kses_post($data_attrs_html); ?>
54
56
  >
55
- <span class="tds-link__content"><?php echo wp_kses_post($content_text); ?></span>
57
+ <span class="tds-link__content">
58
+ <?php if ($icon_left) : ?>
59
+ <span class="tds-link__icon tds-link__icon--left"><?php echo wp_kses_post($icon_left); ?></span>
60
+ <?php endif; ?>
61
+ <?php echo wp_kses_post($content_text); ?>
62
+ <?php if ($icon_right) : ?>
63
+ <span class="tds-link__icon tds-link__icon--right"><?php echo wp_kses_post($icon_right); ?></span>
64
+ <?php endif; ?>
65
+ </span>
56
66
  </a>
@@ -13,6 +13,7 @@
13
13
 
14
14
  require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
15
15
 
16
+ $content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
16
17
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
17
18
 
18
19
  // Sanitize and prepare data-* attributes
@@ -22,7 +23,7 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
22
23
  $data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
23
24
  }
24
25
 
25
- $wrapper_classes = [];
26
+ $wrapper_classes = ['tds-tab'];
26
27
  if ($element_class_name) {
27
28
  $wrapper_classes[] = $element_class_name;
28
29
  }
@@ -30,7 +31,5 @@ $wrapper_attributes = get_block_wrapper_attributes(['class' => implode(' ', $wra
30
31
 
31
32
  ?>
32
33
  <div <?php echo wp_kses_post($wrapper_attributes); ?><?php echo wp_kses_post($data_attrs_html); ?>>
33
- <!-- TODO: Render Tab component here -->
34
- <!-- Use CSS custom properties from packages/tokens/data/resolved-hexes.json -->
35
- <!-- Apply BEM naming: tds-tab--{modifier} -->
34
+ <?php echo wp_kses_post($content_text); ?>
36
35
  </div>
@@ -13,6 +13,7 @@
13
13
 
14
14
  require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
15
15
 
16
+ $content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
16
17
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
17
18
 
18
19
  // Sanitize and prepare data-* attributes
@@ -22,7 +23,7 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
22
23
  $data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
23
24
  }
24
25
 
25
- $wrapper_classes = [];
26
+ $wrapper_classes = ['tds-tab-group'];
26
27
  if ($element_class_name) {
27
28
  $wrapper_classes[] = $element_class_name;
28
29
  }
@@ -30,7 +31,5 @@ $wrapper_attributes = get_block_wrapper_attributes(['class' => implode(' ', $wra
30
31
 
31
32
  ?>
32
33
  <div <?php echo wp_kses_post($wrapper_attributes); ?><?php echo wp_kses_post($data_attrs_html); ?>>
33
- <!-- TODO: Render TabGroup component here -->
34
- <!-- Use CSS custom properties from packages/tokens/data/resolved-hexes.json -->
35
- <!-- Apply BEM naming: tds-tab-group--{modifier} -->
34
+ <?php echo wp_kses_post($content_text); ?>
36
35
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@times-design-system/components-wordpress",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "description": "Times Design System Gutenberg blocks for WordPress Full Site Editing",
6
6
  "keywords": [
@@ -64,7 +64,7 @@
64
64
  "access": "public"
65
65
  },
66
66
  "dependencies": {
67
- "@times-design-system/theme-scss": "^2.5.1",
67
+ "@times-design-system/theme-scss": "^2.6.0",
68
68
  "@wordpress/block-editor": "^12.0.0",
69
69
  "@wordpress/blocks": "^12.0.0",
70
70
  "@wordpress/components": "^25.0.0",
@@ -93,5 +93,5 @@
93
93
  "typescript": "^5.0.0",
94
94
  "vitest": "^1.0.4"
95
95
  },
96
- "gitHead": "96aae79e15100c0ddf7ce0e9defa5283c2d35803"
96
+ "gitHead": "29e19963c74c5a18155ee4267704e0916f58c81c"
97
97
  }