@times-design-system/components-wordpress 1.14.0 → 1.16.1-alpha.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/STYLE_HANDLES.md +3 -1
- package/dist/blocks/ad-container/block.json +5 -0
- package/dist/blocks/ad-container/render.php +10 -1
- package/dist/blocks/ad-container/style.css +1 -1
- package/dist/blocks/ad-container/style.scss +3 -2
- package/dist/blocks/button/block.json +5 -0
- package/dist/blocks/button/render.php +12 -2
- package/dist/blocks/button/style.css +1 -1
- package/dist/blocks/button/style.scss +33 -33
- package/dist/blocks/chip/block.json +15 -0
- package/dist/blocks/chip/render.php +54 -21
- package/dist/blocks/chip/style.css +1 -1
- package/dist/blocks/chip/style.scss +136 -76
- package/dist/blocks/dialog-box/block.json +5 -0
- package/dist/blocks/dialog-box/render.php +9 -1
- package/dist/blocks/dialog-box/style.css +1 -1
- package/dist/blocks/dialog-box/style.scss +6 -5
- package/dist/blocks/divider/block.json +21 -1
- package/dist/blocks/divider/render.php +9 -1
- package/dist/blocks/divider/style.css +1 -1
- package/dist/blocks/divider/style.scss +4 -3
- package/dist/blocks/icon/block.json +5 -0
- package/dist/blocks/icon/render.php +10 -12
- package/dist/blocks/icon/style.css +1 -1
- package/dist/blocks/icon/style.scss +4 -0
- package/dist/blocks/icon-button/block.json +5 -0
- package/dist/blocks/icon-button/render.php +14 -4
- package/dist/blocks/icon-button/style.css +1 -1
- package/dist/blocks/icon-button/style.scss +33 -32
- package/dist/blocks/input/block.json +5 -0
- package/dist/blocks/input/render.php +10 -1
- package/dist/blocks/input/style.css +1 -1
- package/dist/blocks/input/style.scss +14 -13
- package/dist/blocks/input-helper-message/block.json +5 -0
- package/dist/blocks/input-helper-message/render.php +9 -1
- package/dist/blocks/input-helper-message/style.css +1 -1
- package/dist/blocks/input-helper-message/style.scss +6 -5
- package/dist/blocks/label/block.json +68 -0
- package/dist/blocks/label/edit.js +79 -0
- package/dist/blocks/label/index.js +11 -0
- package/dist/blocks/label/render.php +56 -0
- package/dist/blocks/label/save.js +21 -0
- package/dist/blocks/label/style.css +1 -0
- package/dist/blocks/label/style.scss +39 -0
- package/dist/blocks/link/block.json +5 -0
- package/dist/blocks/link/render.php +3 -1
- package/dist/blocks/link/style.css +1 -1
- package/dist/blocks/link/style.scss +19 -18
- package/dist/blocks/tab/block.json +5 -0
- package/dist/blocks/tab/render.php +9 -1
- package/dist/blocks/tab/style.css +1 -1
- package/dist/blocks/tab/style.scss +16 -15
- package/dist/blocks/tab-group/block.json +5 -0
- package/dist/blocks/tab-group/render.php +9 -1
- package/dist/blocks/tab-group/style.css +1 -1
- package/dist/blocks/tab-group/style.scss +2 -1
- package/dist/blocks/tag/block.json +5 -0
- package/dist/blocks/tag/render.php +10 -1
- package/dist/blocks/tag/style.css +1 -1
- package/dist/blocks/tag/style.scss +23 -25
- package/dist/blocks/text/block.json +5 -0
- package/dist/blocks/text/render.php +9 -1
- package/dist/blocks/toast/block.json +5 -0
- package/dist/blocks/toast/render.php +10 -1
- package/dist/blocks/toast/style.css +1 -1
- package/dist/blocks/toast/style.scss +13 -12
- package/dist/icon-data.json +1 -1
- package/dist/index.cjs +485 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +485 -177
- package/dist/index.js.map +1 -1
- package/dist/plugin.php +1 -0
- package/dist/style-handles.json +5 -0
- package/dist/utils/render-icon.php +3 -0
- package/dist/utils/sanitize-aria-attributes.php +109 -0
- package/package.json +4 -4
- package/plugin.php +1 -0
- package/dist/blocks/utils/render-icon.php +0 -106
- package/dist/blocks/utils/sanitize-data-attributes.php +0 -37
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/* Uses SCSS variables from @times-design-system/theme-scss */
|
|
3
3
|
/* Maintains styling parity with React Tag component */
|
|
4
4
|
|
|
5
|
+
@import '@times-design-system/theme-scss/src/theme-classes.scss';
|
|
5
6
|
@import '@times-design-system/theme-scss/src/theme-apply.scss';
|
|
6
7
|
@import '@times-design-system/theme-scss/src/tds-layout.scss';
|
|
7
8
|
@import '@times-design-system/theme-scss/src/tds-typography.scss';
|
|
8
9
|
|
|
9
10
|
.tds-tag {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
--tds-tag-bg: var(--tag-primary-fill);
|
|
12
|
+
--tds-tag-fg: var(--tag-primary-text);
|
|
12
13
|
|
|
13
14
|
display: inline-flex;
|
|
14
15
|
align-items: center;
|
|
@@ -20,7 +21,6 @@
|
|
|
20
21
|
border-radius: $border-radius-50;
|
|
21
22
|
background-color: var(--tds-tag-bg);
|
|
22
23
|
color: var(--tds-tag-fg);
|
|
23
|
-
@include utility-label-small;
|
|
24
24
|
text-transform: uppercase;
|
|
25
25
|
white-space: nowrap;
|
|
26
26
|
box-sizing: border-box;
|
|
@@ -28,72 +28,70 @@
|
|
|
28
28
|
|
|
29
29
|
.tds-tag--size-small {
|
|
30
30
|
padding: $spacing-01 $spacing-04;
|
|
31
|
-
@include utility-label-xsmall;
|
|
32
31
|
gap: $spacing-01;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
.tds-tag--size-large {
|
|
36
34
|
padding: $spacing-05;
|
|
37
|
-
@include utility-label-medium;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
/* Intent variants */
|
|
41
38
|
.tds-tag--intent-primary {
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
--tds-tag-bg: var(--tag-primary-fill);
|
|
40
|
+
--tds-tag-fg: var(--tag-primary-text);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
.tds-tag--intent-secondary {
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
--tds-tag-bg: var(--tag-secondary-fill);
|
|
45
|
+
--tds-tag-fg: var(--tag-secondary-text);
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
.tds-tag--intent-tertiary {
|
|
52
49
|
--tds-tag-bg: transparent;
|
|
53
|
-
|
|
50
|
+
--tds-tag-fg: var(--tag-tertiary-text);
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
/* Callout modifier - overrides intent colors */
|
|
57
54
|
.tds-tag--callout {
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
--tds-tag-bg: var(--tag-callout-primary-fill);
|
|
56
|
+
--tds-tag-fg: var(--tag-callout-primary-text);
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
.tds-tag--intent-secondary.tds-tag--callout {
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
--tds-tag-bg: var(--tag-callout-secondary-fill);
|
|
61
|
+
--tds-tag-fg: var(--tag-callout-secondary-text);
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
.tds-tag--intent-tertiary.tds-tag--callout {
|
|
68
65
|
--tds-tag-bg: transparent;
|
|
69
|
-
|
|
66
|
+
--tds-tag-fg: var(--tag-callout-tertiary-text);
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
/* Channel modifier - overrides intent and callout colors */
|
|
73
70
|
.tds-tag--channel {
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
--tds-tag-bg: var(--surface-channel-400);
|
|
72
|
+
--tds-tag-fg: var(--text-inverse);
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
.tds-tag--intent-secondary.tds-tag--channel {
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
--tds-tag-bg: var(--surface-channel-100);
|
|
77
|
+
--tds-tag-fg: var(--text-channel-primary);
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
.tds-tag--intent-tertiary.tds-tag--channel {
|
|
84
81
|
--tds-tag-bg: transparent;
|
|
85
|
-
|
|
82
|
+
--tds-tag-fg: var(--text-channel-primary);
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
/* Label and icon styling */
|
|
89
86
|
.tds-tag__label {
|
|
90
|
-
|
|
91
|
-
align-items: center;
|
|
92
|
-
padding: 0 $spacing-01;
|
|
87
|
+
@include utility-label-small;
|
|
93
88
|
}
|
|
94
89
|
|
|
90
|
+
.tds-tag--size-small .tds-tag__label {
|
|
91
|
+
@include utility-label-xsmall;
|
|
92
|
+
}
|
|
95
93
|
.tds-tag--size-large .tds-tag__label {
|
|
96
|
-
|
|
94
|
+
@include utility-label-medium;
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
.tds-tag__icon {
|
|
@@ -45,6 +45,11 @@
|
|
|
45
45
|
"type": "object",
|
|
46
46
|
"default": {},
|
|
47
47
|
"description": "Custom data-* attributes for extensibility (allowlisted server-side)"
|
|
48
|
+
},
|
|
49
|
+
"ariaAttributes": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"default": {},
|
|
52
|
+
"description": "Custom aria-* attributes for extensibility (allowlisted server-side)"
|
|
48
53
|
}
|
|
49
54
|
},
|
|
50
55
|
"example": {},
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
|
+
require_once __DIR__ . '/../../utils/sanitize-aria-attributes.php';
|
|
14
15
|
|
|
15
16
|
$as = isset($attributes['as']) ? sanitize_text_field($attributes['as']) : 'p';
|
|
16
17
|
$typography_style = isset($attributes['typographyStyle']) ? sanitize_text_field($attributes['typographyStyle']) : '';
|
|
@@ -24,6 +25,13 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
|
|
|
24
25
|
$data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
// Sanitize and prepare aria-* attributes
|
|
29
|
+
$sanitized_aria_attributes = tds_sanitize_aria_attributes($attributes['ariaAttributes'] ?? [], 'text', $attributes);
|
|
30
|
+
$aria_attrs_html = '';
|
|
31
|
+
foreach ($sanitized_aria_attributes as $attr_name => $attr_value) {
|
|
32
|
+
$aria_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
$tag_name = in_array($as, ['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5'], true) ? $as : 'p';
|
|
28
36
|
$class_name = 'tds-text';
|
|
29
37
|
if ($typography_style) {
|
|
@@ -36,4 +44,4 @@ if ($element_class_name) {
|
|
|
36
44
|
$wrapper_attrs = get_block_wrapper_attributes(['class' => $class_name]);
|
|
37
45
|
?>
|
|
38
46
|
|
|
39
|
-
<?php echo wp_sprintf('<%s %s%s>%s</%s>', $tag_name, wp_kses_post($wrapper_attrs),
|
|
47
|
+
<?php echo wp_sprintf('<%s %s%s%s>%s</%s>', $tag_name, wp_kses_post($wrapper_attrs), $aria_attrs_html, $data_attrs_html, wp_kses_post($text_content), $tag_name); ?>
|
|
@@ -49,6 +49,11 @@
|
|
|
49
49
|
"type": "object",
|
|
50
50
|
"default": {},
|
|
51
51
|
"description": "Custom data-* attributes for extensibility (allowlisted server-side)"
|
|
52
|
+
},
|
|
53
|
+
"ariaAttributes": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"default": {},
|
|
56
|
+
"description": "Custom aria-* attributes for extensibility (allowlisted server-side)"
|
|
52
57
|
}
|
|
53
58
|
},
|
|
54
59
|
"example": {},
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
|
+
require_once __DIR__ . '/../../utils/sanitize-aria-attributes.php';
|
|
14
15
|
|
|
15
16
|
$label = isset($attributes['label']) ? wp_kses_post($attributes['label']) : '';
|
|
16
17
|
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
|
|
@@ -26,6 +27,13 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
|
|
|
26
27
|
$data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
// Sanitize and prepare aria-* attributes
|
|
31
|
+
$sanitized_aria_attributes = tds_sanitize_aria_attributes($attributes['ariaAttributes'] ?? [], 'toast', $attributes);
|
|
32
|
+
$aria_attrs_html = '';
|
|
33
|
+
foreach ($sanitized_aria_attributes as $attr_name => $attr_value) {
|
|
34
|
+
$aria_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
$classes = ['tds-toast'];
|
|
30
38
|
$classes[] = 'tds-toast--intent-' . $intent;
|
|
31
39
|
if ($element_class_name) {
|
|
@@ -40,7 +48,8 @@ $wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)
|
|
|
40
48
|
role="status"
|
|
41
49
|
aria-live="polite"
|
|
42
50
|
<?php echo $timeout ? 'data-timeout="' . esc_attr($timeout) . '"' : ''; ?>
|
|
43
|
-
<?php echo
|
|
51
|
+
<?php echo $aria_attrs_html; ?>
|
|
52
|
+
<?php echo $data_attrs_html; ?>
|
|
44
53
|
>
|
|
45
54
|
<div class="tds-toast__content">
|
|
46
55
|
<div class="tds-toast__label"><?php echo wp_kses_post($label); ?></div>
|