@times-design-system/components-wordpress 1.12.1 → 1.13.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Auto-generated mapping of blocks to WordPress style handles.
4
4
 
5
- **Generated:** 2026-08-11T16:13:07.058Z
5
+ **Generated:** 2026-08-11T17:56:36.693Z
6
6
 
7
7
  ## Style Handle Registration
8
8
 
@@ -80,15 +80,15 @@ if ($element_tag === 'a') {
80
80
  <?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
81
81
  <?php echo wp_kses_post($data_attrs_html); ?>
82
82
  >
83
+ <?php if ($icon_left) : ?>
84
+ <span class="tds-button__icon tds-button__icon--left"><?php echo tds_kses_svg(tds_render_icon($icon_left, $icon_size)); ?></span>
85
+ <?php endif; ?>
83
86
  <span class="tds-button__label-container">
84
- <?php if ($icon_left) : ?>
85
- <span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
86
- <?php endif; ?>
87
- <span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
88
- <?php if ($icon_right) : ?>
89
- <span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
90
- <?php endif; ?>
87
+ <span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
91
88
  </span>
89
+ <?php if ($icon_right) : ?>
90
+ <span class="tds-button__icon tds-button__icon--right"><?php echo tds_kses_svg(tds_render_icon($icon_right, $icon_size)); ?></span>
91
+ <?php endif; ?>
92
92
  </a>
93
93
  <?php
94
94
  } else {
@@ -102,13 +102,13 @@ if ($element_tag === 'a') {
102
102
  <?php echo wp_kses_post($data_attrs_html); ?>
103
103
  >
104
104
  <?php if ($icon_left) : ?>
105
- <span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
105
+ <span class="tds-button__icon tds-button__icon--left"><?php echo tds_kses_svg(tds_render_icon($icon_left, $icon_size)); ?></span>
106
106
  <?php endif; ?>
107
107
  <span class="tds-button__label-container">
108
108
  <span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
109
109
  </span>
110
110
  <?php if ($icon_right) : ?>
111
- <span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
111
+ <span class="tds-button__icon tds-button__icon--right"><?php echo tds_kses_svg(tds_render_icon($icon_right, $icon_size)); ?></span>
112
112
  <?php endif; ?>
113
113
  </button>
114
114
  <?php
@@ -65,11 +65,11 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
65
65
  >
66
66
  <span class="tds-chip__content">
67
67
  <?php if ($icon_left) : ?>
68
- <span class="tds-chip__icon tds-chip__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
68
+ <span class="tds-chip__icon tds-chip__icon--left"><?php echo tds_kses_svg(tds_render_icon($icon_left, $icon_size)); ?></span>
69
69
  <?php endif; ?>
70
70
  <span class="tds-chip__label"><?php echo wp_kses_post($content_text); ?></span>
71
71
  <?php if ($icon_right) : ?>
72
- <span class="tds-chip__icon tds-chip__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
72
+ <span class="tds-chip__icon tds-chip__icon--right"><?php echo tds_kses_svg(tds_render_icon($icon_right, $icon_size)); ?></span>
73
73
  <?php endif; ?>
74
74
  </span>
75
75
  </button>
@@ -59,7 +59,7 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
59
59
  <?php echo $on_click ? 'data-onclick="' . esc_attr($on_click) . '"' : ''; ?>
60
60
  <?php echo wp_kses_post($data_attrs_html); ?>
61
61
  >
62
- <span class="tds-icon-button__icon"><?php echo wp_kses_post(tds_render_icon($icon_name, $icon_size)); ?></span>
62
+ <span class="tds-icon-button__icon"><?php echo tds_kses_svg(tds_render_icon($icon_name, $icon_size)); ?></span>
63
63
  </a>
64
64
  <?php else : ?>
65
65
  <button
@@ -68,6 +68,6 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
68
68
  <?php echo $on_click ? 'data-onclick="' . esc_attr($on_click) . '"' : ''; ?>
69
69
  <?php echo wp_kses_post($data_attrs_html); ?>
70
70
  >
71
- <span class="tds-icon-button__icon"><?php echo wp_kses_post(tds_render_icon($icon_name, $icon_size)); ?></span>
71
+ <span class="tds-icon-button__icon"><?php echo tds_kses_svg(tds_render_icon($icon_name, $icon_size)); ?></span>
72
72
  </button>
73
73
  <?php endif; ?>
@@ -75,12 +75,12 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
75
75
  <?php echo wp_kses_post($data_attrs_html); ?>
76
76
  >
77
77
  <?php if ($icon_left) : ?>
78
- <span class="tds-link__icon tds-link__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
78
+ <span class="tds-link__icon tds-link__icon--left"><?php echo tds_kses_svg(tds_render_icon($icon_left, $icon_size)); ?></span>
79
79
  <?php endif; ?>
80
80
  <span class="tds-link__label">
81
81
  <?php echo wp_kses_post($content_text); ?>
82
82
  </span>
83
83
  <?php if ($icon_right) : ?>
84
- <span class="tds-link__icon tds-link__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
84
+ <span class="tds-link__icon tds-link__icon--right"><?php echo tds_kses_svg(tds_render_icon($icon_right, $icon_size)); ?></span>
85
85
  <?php endif; ?>
86
86
  </a>
@@ -59,7 +59,7 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
59
59
  <?php echo wp_kses_post($data_attrs_html); ?>
60
60
  >
61
61
  <?php if ($icon_left) : ?>
62
- <span class="tds-tag__icon tds-tag__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
62
+ <span class="tds-tag__icon tds-tag__icon--left"><?php echo tds_kses_svg(tds_render_icon($icon_left, $icon_size)); ?></span>
63
63
  <?php endif; ?>
64
64
  <?php if ($label) : ?>
65
65
  <div class="tds-tag__label">
@@ -67,6 +67,6 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
67
67
  </div>
68
68
  <?php endif; ?>
69
69
  <?php if ($icon_right) : ?>
70
- <span class="tds-tag__icon tds-tag__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
70
+ <span class="tds-tag__icon tds-tag__icon--right"><?php echo tds_kses_svg(tds_render_icon($icon_right, $icon_size)); ?></span>
71
71
  <?php endif; ?>
72
72
  </div>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_metadata": {
3
- "generatedAt": "2026-08-11T16:12:59.011Z",
3
+ "generatedAt": "2026-08-11T17:56:27.502Z",
4
4
  "sizeMap": {
5
5
  "2xsmall": {
6
6
  "width": 12,
@@ -213,6 +213,133 @@ function tds_render_icon_wrapper($icon_name, $size_name = 'medium', $position =
213
213
  return sprintf(
214
214
  '<span class="%s">%s</span>',
215
215
  esc_attr($wrapper_class),
216
- wp_kses_post($svg)
216
+ tds_kses_svg($svg)
217
217
  );
218
218
  }
219
+
220
+ /**
221
+ * Sanitize SVG content safely for output in HTML
222
+ *
223
+ * WordPress's wp_kses_post() strips SVG tags by default.
224
+ * This function allows SVG tags and common attributes while maintaining security.
225
+ *
226
+ * @param string $svg SVG HTML string to sanitize
227
+ * @return string Sanitized SVG safe for output
228
+ */
229
+ function tds_kses_svg($svg) {
230
+ if (empty($svg)) {
231
+ return '';
232
+ }
233
+
234
+ $allowed_tags = array(
235
+ 'svg' => array(
236
+ 'xmlns' => true,
237
+ 'viewBox' => true,
238
+ 'width' => true,
239
+ 'height' => true,
240
+ 'class' => true,
241
+ 'style' => true,
242
+ 'aria-hidden' => true,
243
+ 'role' => true,
244
+ 'data-*' => true,
245
+ ),
246
+ 'g' => array(
247
+ 'class' => true,
248
+ 'id' => true,
249
+ 'style' => true,
250
+ 'fill' => true,
251
+ 'stroke' => true,
252
+ 'transform' => true,
253
+ ),
254
+ 'path' => array(
255
+ 'class' => true,
256
+ 'id' => true,
257
+ 'd' => true,
258
+ 'fill' => true,
259
+ 'stroke' => true,
260
+ 'stroke-width' => true,
261
+ 'stroke-linecap' => true,
262
+ 'stroke-linejoin' => true,
263
+ 'style' => true,
264
+ 'transform' => true,
265
+ 'data-*' => true,
266
+ ),
267
+ 'circle' => array(
268
+ 'class' => true,
269
+ 'cx' => true,
270
+ 'cy' => true,
271
+ 'r' => true,
272
+ 'fill' => true,
273
+ 'stroke' => true,
274
+ 'style' => true,
275
+ ),
276
+ 'rect' => array(
277
+ 'class' => true,
278
+ 'x' => true,
279
+ 'y' => true,
280
+ 'width' => true,
281
+ 'height' => true,
282
+ 'fill' => true,
283
+ 'stroke' => true,
284
+ 'style' => true,
285
+ 'rx' => true,
286
+ 'ry' => true,
287
+ ),
288
+ 'polygon' => array(
289
+ 'class' => true,
290
+ 'points' => true,
291
+ 'fill' => true,
292
+ 'stroke' => true,
293
+ 'style' => true,
294
+ ),
295
+ 'polyline' => array(
296
+ 'class' => true,
297
+ 'points' => true,
298
+ 'fill' => true,
299
+ 'stroke' => true,
300
+ 'style' => true,
301
+ ),
302
+ 'line' => array(
303
+ 'class' => true,
304
+ 'x1' => true,
305
+ 'y1' => true,
306
+ 'x2' => true,
307
+ 'y2' => true,
308
+ 'stroke' => true,
309
+ 'stroke-width' => true,
310
+ 'style' => true,
311
+ ),
312
+ 'text' => array(
313
+ 'class' => true,
314
+ 'x' => true,
315
+ 'y' => true,
316
+ 'fill' => true,
317
+ 'style' => true,
318
+ 'text-anchor' => true,
319
+ ),
320
+ 'tspan' => array(
321
+ 'class' => true,
322
+ 'x' => true,
323
+ 'y' => true,
324
+ 'dx' => true,
325
+ 'dy' => true,
326
+ 'fill' => true,
327
+ 'style' => true,
328
+ ),
329
+ 'defs' => array(),
330
+ 'style' => array(
331
+ 'type' => true,
332
+ ),
333
+ 'use' => array(
334
+ 'href' => true,
335
+ 'xlink:href' => true,
336
+ 'x' => true,
337
+ 'y' => true,
338
+ 'width' => true,
339
+ 'height' => true,
340
+ 'class' => true,
341
+ ),
342
+ );
343
+
344
+ return wp_kses($svg, $allowed_tags);
345
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@times-design-system/components-wordpress",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "type": "module",
5
5
  "description": "Times Design System Gutenberg blocks for WordPress Full Site Editing",
6
6
  "keywords": [
@@ -101,5 +101,5 @@
101
101
  "typescript": "^5.0.0",
102
102
  "vitest": "^1.0.4"
103
103
  },
104
- "gitHead": "9e5bbc79ba162448c3ba5e3434533e50645d9b2c"
104
+ "gitHead": "f9727178862bd195ed3d45505e1f4be0b61df26e"
105
105
  }