@times-design-system/components-wordpress 1.6.0 → 1.8.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.
- package/dist/blocks/button/render.php +25 -1
- package/dist/blocks/chip/render.php +19 -1
- package/dist/blocks/chip/style.css +21 -0
- package/dist/blocks/dialog-box/render.php +3 -4
- package/dist/blocks/flag/render.php +20 -1
- package/dist/blocks/flag/style.css +21 -0
- package/dist/blocks/icon/block.json +17 -2
- package/dist/blocks/icon/render.php +31 -17
- package/dist/blocks/icon-button/block.json +14 -0
- package/dist/blocks/icon-button/render.php +4 -2
- package/dist/blocks/input-helper-message/render.php +3 -4
- package/dist/blocks/link/render.php +21 -1
- package/dist/blocks/tab/render.php +3 -4
- package/dist/blocks/tab-group/render.php +3 -4
- package/dist/icon-data.json +1989 -0
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/render-icon.php +183 -0
- package/package.json +6 -4
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
|
+
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
14
15
|
|
|
15
16
|
$label = isset($attributes['label']) ? sanitize_text_field($attributes['label']) : 'Button label';
|
|
16
17
|
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : 'primary';
|
|
@@ -23,6 +24,17 @@ $href = isset($attributes['href']) ? esc_url($attributes['href']) : '';
|
|
|
23
24
|
$target = isset($attributes['target']) ? sanitize_text_field($attributes['target']) : '';
|
|
24
25
|
$rel = isset($attributes['rel']) ? sanitize_text_field($attributes['rel']) : '';
|
|
25
26
|
$type = isset($attributes['type']) ? sanitize_text_field($attributes['type']) : 'button';
|
|
27
|
+
$icon_left = isset($attributes['iconLeft']) ? sanitize_text_field($attributes['iconLeft']) : '';
|
|
28
|
+
$icon_right = isset($attributes['iconRight']) ? sanitize_text_field($attributes['iconRight']) : '';
|
|
29
|
+
|
|
30
|
+
// Derive icon size from button size
|
|
31
|
+
$icon_size_map = [
|
|
32
|
+
'small' => 'small',
|
|
33
|
+
'medium' => 'medium',
|
|
34
|
+
'large' => 'large',
|
|
35
|
+
'xlarge' => 'large'
|
|
36
|
+
];
|
|
37
|
+
$icon_size = $icon_size_map[$size] ?? 'medium';
|
|
26
38
|
$aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
|
|
27
39
|
$element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
|
|
28
40
|
|
|
@@ -70,7 +82,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => 'tds-button-wrapper'])
|
|
|
70
82
|
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
71
83
|
>
|
|
72
84
|
<span class="tds-button__label-container">
|
|
73
|
-
|
|
85
|
+
<?php if ($icon_left) : ?>
|
|
86
|
+
<span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
|
|
87
|
+
<?php endif; ?>
|
|
88
|
+
<span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
|
|
89
|
+
<?php if ($icon_right) : ?>
|
|
90
|
+
<span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
|
|
91
|
+
<?php endif; ?>
|
|
74
92
|
</span>
|
|
75
93
|
</a>
|
|
76
94
|
<?php
|
|
@@ -84,7 +102,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => 'tds-button-wrapper'])
|
|
|
84
102
|
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
85
103
|
>
|
|
86
104
|
<span class="tds-button__label-container">
|
|
105
|
+
<?php if ($icon_left) : ?>
|
|
106
|
+
<span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
|
|
107
|
+
<?php endif; ?>
|
|
87
108
|
<span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
|
|
109
|
+
<?php if ($icon_right) : ?>
|
|
110
|
+
<span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
|
|
111
|
+
<?php endif; ?>
|
|
88
112
|
</span>
|
|
89
113
|
</button>
|
|
90
114
|
<?php
|
|
@@ -11,12 +11,22 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
|
+
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
14
15
|
|
|
15
16
|
$content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
|
|
16
17
|
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
|
|
17
18
|
$size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
|
|
18
19
|
$channel = isset($attributes['channel']) ? (bool) $attributes['channel'] : false;
|
|
19
20
|
$toggle = isset($attributes['toggle']) ? (bool) $attributes['toggle'] : false;
|
|
21
|
+
$icon_left = isset($attributes['iconLeft']) ? sanitize_text_field($attributes['iconLeft']) : '';
|
|
22
|
+
$icon_right = isset($attributes['iconRight']) ? sanitize_text_field($attributes['iconRight']) : '';
|
|
23
|
+
|
|
24
|
+
// Derive icon size from chip size
|
|
25
|
+
$icon_size_map = [
|
|
26
|
+
'small' => 'xsmall',
|
|
27
|
+
'large' => 'small'
|
|
28
|
+
];
|
|
29
|
+
$icon_size = $icon_size_map[$size] ?? 'xsmall';
|
|
20
30
|
$aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
|
|
21
31
|
$element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
|
|
22
32
|
|
|
@@ -48,5 +58,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
|
|
|
48
58
|
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
49
59
|
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
50
60
|
>
|
|
51
|
-
<span class="tds-chip__content"
|
|
61
|
+
<span class="tds-chip__content">
|
|
62
|
+
<?php if ($icon_left) : ?>
|
|
63
|
+
<span class="tds-chip__icon tds-chip__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
|
|
64
|
+
<?php endif; ?>
|
|
65
|
+
<?php echo wp_kses_post($content_text); ?>
|
|
66
|
+
<?php if ($icon_right) : ?>
|
|
67
|
+
<span class="tds-chip__icon tds-chip__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
|
|
68
|
+
<?php endif; ?>
|
|
69
|
+
</span>
|
|
52
70
|
</button>
|
|
@@ -85,3 +85,24 @@
|
|
|
85
85
|
align-items: center;
|
|
86
86
|
justify-content: center;
|
|
87
87
|
}
|
|
88
|
+
|
|
89
|
+
.tds-chip__icon {
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.tds-chip--size-small .tds-chip__icon {
|
|
96
|
+
width: 16px;
|
|
97
|
+
height: 16px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.tds-chip--size-large .tds-chip__icon {
|
|
101
|
+
width: 20px;
|
|
102
|
+
height: 20px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tds-chip__icon svg {
|
|
106
|
+
width: 100%;
|
|
107
|
+
height: 100%;
|
|
108
|
+
}
|
|
@@ -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
|
-
|
|
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>
|
|
@@ -11,11 +11,22 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
|
+
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
14
15
|
|
|
15
16
|
$label = isset($attributes['label']) ? sanitize_text_field($attributes['label']) : '';
|
|
16
17
|
$content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
|
|
17
18
|
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
|
|
18
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']) : '';
|
|
22
|
+
|
|
23
|
+
// Derive icon size from flag size
|
|
24
|
+
$icon_size_map = [
|
|
25
|
+
'small' => 'xsmall',
|
|
26
|
+
'medium' => 'small',
|
|
27
|
+
'large' => 'medium'
|
|
28
|
+
];
|
|
29
|
+
$icon_size = $icon_size_map[$size] ?? 'small';
|
|
19
30
|
$aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
|
|
20
31
|
$element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
|
|
21
32
|
|
|
@@ -42,7 +53,15 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
|
|
|
42
53
|
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
43
54
|
>
|
|
44
55
|
<?php if ($label) : ?>
|
|
45
|
-
<div class="tds-flag__label"
|
|
56
|
+
<div class="tds-flag__label">
|
|
57
|
+
<?php if ($icon_left) : ?>
|
|
58
|
+
<span class="tds-flag__icon tds-flag__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
|
|
59
|
+
<?php endif; ?>
|
|
60
|
+
<?php echo wp_kses_post($label); ?>
|
|
61
|
+
<?php if ($icon_right) : ?>
|
|
62
|
+
<span class="tds-flag__icon tds-flag__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
|
|
63
|
+
<?php endif; ?>
|
|
64
|
+
</div>
|
|
46
65
|
<?php endif; ?>
|
|
47
66
|
<div class="tds-flag__content"><?php echo wp_kses_post($content_text); ?></div>
|
|
48
67
|
</div>
|
|
@@ -52,3 +52,24 @@
|
|
|
52
52
|
display: inline-flex;
|
|
53
53
|
align-items: center;
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
.tds-flag__icon {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.tds-flag--size-small .tds-flag__icon {
|
|
63
|
+
width: 16px;
|
|
64
|
+
height: 16px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.tds-flag--size-large .tds-flag__icon {
|
|
68
|
+
width: 24px;
|
|
69
|
+
height: 24px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.tds-flag__icon svg {
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
}
|
|
@@ -14,9 +14,24 @@
|
|
|
14
14
|
},
|
|
15
15
|
"textdomain": "times-blocks",
|
|
16
16
|
"attributes": {
|
|
17
|
-
"
|
|
17
|
+
"iconName": {
|
|
18
18
|
"type": "string",
|
|
19
|
-
"default": ""
|
|
19
|
+
"default": "",
|
|
20
|
+
"description": "The name of the icon to display"
|
|
21
|
+
},
|
|
22
|
+
"size": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"enum": [
|
|
25
|
+
"2xsmall",
|
|
26
|
+
"xsmall",
|
|
27
|
+
"small",
|
|
28
|
+
"medium",
|
|
29
|
+
"large",
|
|
30
|
+
"xlarge",
|
|
31
|
+
"2xlarge"
|
|
32
|
+
],
|
|
33
|
+
"default": "medium",
|
|
34
|
+
"description": "Size of the icon"
|
|
20
35
|
},
|
|
21
36
|
"classes": {
|
|
22
37
|
"type": "string",
|
|
@@ -1,36 +1,50 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
/**
|
|
3
|
-
* Block
|
|
3
|
+
* Icon Block Render Callback
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Renders the Icon block with inline SVG content.
|
|
6
|
+
* Supports sizing parity with components-react Icon component.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
8
|
+
* @package TimesDesignSystem\ComponentsWordPress
|
|
9
|
+
* @var array $attributes Block attributes
|
|
10
|
+
* @var string $content Block content
|
|
11
|
+
* @var WP_Block $block Block instance
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
require_once __DIR__ . '/../../utils/
|
|
14
|
+
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
15
15
|
|
|
16
|
-
$
|
|
16
|
+
$icon_name = isset($attributes['iconName']) ? sanitize_text_field($attributes['iconName']) : '';
|
|
17
|
+
$size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : 'medium';
|
|
18
|
+
$classes = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
|
|
17
19
|
|
|
18
20
|
// Sanitize and prepare data-* attributes
|
|
21
|
+
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
19
22
|
$sanitized_data_attributes = tds_sanitize_data_attributes($attributes['dataAttributes'] ?? [], 'icon', $attributes);
|
|
20
23
|
$data_attrs_html = '';
|
|
21
24
|
foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
|
|
22
25
|
$data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
// Build wrapper classes
|
|
29
|
+
$wrapper_classes = ['tds-icon-wrapper'];
|
|
30
|
+
if ($classes) {
|
|
31
|
+
$wrapper_classes[] = $classes;
|
|
28
32
|
}
|
|
29
|
-
$
|
|
33
|
+
$wrapper_class = implode(' ', $wrapper_classes);
|
|
34
|
+
$wrapper_attrs = get_block_wrapper_attributes(['class' => $wrapper_class]);
|
|
30
35
|
|
|
36
|
+
// Render icon
|
|
37
|
+
$svg_content = tds_render_icon($icon_name, $size);
|
|
31
38
|
?>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
|
|
40
|
+
<div <?php echo wp_kses_post($wrapper_attrs); ?><?php echo wp_kses_post($data_attrs_html); ?>>
|
|
41
|
+
<?php if ($svg_content) : ?>
|
|
42
|
+
<div class="tds-icon">
|
|
43
|
+
<?php echo wp_kses_post($svg_content); ?>
|
|
44
|
+
</div>
|
|
45
|
+
<?php else : ?>
|
|
46
|
+
<div class="tds-icon tds-icon--error">
|
|
47
|
+
<span class="tds-icon__placeholder"><?php esc_html_e('Icon not found', 'times-design-system'); ?></span>
|
|
48
|
+
</div>
|
|
49
|
+
<?php endif; ?>
|
|
36
50
|
</div>
|
|
@@ -18,6 +18,20 @@
|
|
|
18
18
|
"type": "string",
|
|
19
19
|
"default": ""
|
|
20
20
|
},
|
|
21
|
+
"iconSize": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": [
|
|
24
|
+
"2xsmall",
|
|
25
|
+
"xsmall",
|
|
26
|
+
"small",
|
|
27
|
+
"medium",
|
|
28
|
+
"large",
|
|
29
|
+
"xlarge",
|
|
30
|
+
"2xlarge"
|
|
31
|
+
],
|
|
32
|
+
"default": "medium",
|
|
33
|
+
"description": "Size of the icon"
|
|
34
|
+
},
|
|
21
35
|
"round": {
|
|
22
36
|
"type": "boolean",
|
|
23
37
|
"default": false
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
|
+
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
14
15
|
|
|
15
16
|
$icon_name = isset($attributes['iconName']) ? sanitize_text_field($attributes['iconName']) : '';
|
|
17
|
+
$icon_size = isset($attributes['iconSize']) ? sanitize_text_field($attributes['iconSize']) : 'medium';
|
|
16
18
|
$round = isset($attributes['round']) ? (bool) $attributes['round'] : false;
|
|
17
19
|
$isLoading = isset($attributes['isLoading']) ? (bool) $attributes['isLoading'] : false;
|
|
18
20
|
$href = isset($attributes['href']) ? esc_url($attributes['href']) : '';
|
|
@@ -52,7 +54,7 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
|
|
|
52
54
|
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
53
55
|
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
54
56
|
>
|
|
55
|
-
<span class="tds-icon-button__icon"><?php echo wp_kses_post($icon_name); ?></span>
|
|
57
|
+
<span class="tds-icon-button__icon"><?php echo wp_kses_post(tds_render_icon($icon_name, $icon_size)); ?></span>
|
|
56
58
|
</a>
|
|
57
59
|
<?php else : ?>
|
|
58
60
|
<button
|
|
@@ -60,6 +62,6 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
|
|
|
60
62
|
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
61
63
|
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
62
64
|
>
|
|
63
|
-
<span class="tds-icon-button__icon"><?php echo wp_kses_post($icon_name); ?></span>
|
|
65
|
+
<span class="tds-icon-button__icon"><?php echo wp_kses_post(tds_render_icon($icon_name, $icon_size)); ?></span>
|
|
64
66
|
</button>
|
|
65
67
|
<?php endif; ?>
|
|
@@ -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
|
-
|
|
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>
|
|
@@ -11,12 +11,24 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
|
+
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
14
15
|
|
|
15
16
|
$href = isset($attributes['href']) ? esc_url($attributes['href']) : '';
|
|
16
17
|
$content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
|
|
17
18
|
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
|
|
18
19
|
$sentiment = isset($attributes['sentiment']) ? sanitize_text_field($attributes['sentiment']) : '';
|
|
19
20
|
$size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
|
|
21
|
+
$icon_left = isset($attributes['iconLeft']) ? sanitize_text_field($attributes['iconLeft']) : '';
|
|
22
|
+
$icon_right = isset($attributes['iconRight']) ? sanitize_text_field($attributes['iconRight']) : '';
|
|
23
|
+
|
|
24
|
+
// Derive icon size from link size
|
|
25
|
+
$icon_size_map = [
|
|
26
|
+
'xsmall' => 'xsmall',
|
|
27
|
+
'small' => 'xsmall',
|
|
28
|
+
'medium' => 'small',
|
|
29
|
+
'large' => 'medium'
|
|
30
|
+
];
|
|
31
|
+
$icon_size = $icon_size_map[$size] ?? 'small';
|
|
20
32
|
$inline = isset($attributes['inline']) ? (bool) $attributes['inline'] : true;
|
|
21
33
|
$aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
|
|
22
34
|
$target = isset($attributes['target']) ? sanitize_text_field($attributes['target']) : '_self';
|
|
@@ -52,5 +64,13 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
|
|
|
52
64
|
<?php echo $rel ? 'rel="' . esc_attr($rel) . '"' : ''; ?>
|
|
53
65
|
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
54
66
|
>
|
|
55
|
-
<span class="tds-link__content"
|
|
67
|
+
<span class="tds-link__content">
|
|
68
|
+
<?php if ($icon_left) : ?>
|
|
69
|
+
<span class="tds-link__icon tds-link__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
|
|
70
|
+
<?php endif; ?>
|
|
71
|
+
<?php echo wp_kses_post($content_text); ?>
|
|
72
|
+
<?php if ($icon_right) : ?>
|
|
73
|
+
<span class="tds-link__icon tds-link__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
|
|
74
|
+
<?php endif; ?>
|
|
75
|
+
</span>
|
|
56
76
|
</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
|
-
|
|
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
|
-
|
|
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>
|