@times-design-system/components-wordpress 1.14.0 → 1.16.1-alpha.1

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.
Files changed (81) hide show
  1. package/dist/STYLE_HANDLES.md +3 -1
  2. package/dist/blocks/ad-container/block.json +5 -0
  3. package/dist/blocks/ad-container/render.php +10 -1
  4. package/dist/blocks/ad-container/style.css +1 -1
  5. package/dist/blocks/ad-container/style.scss +3 -2
  6. package/dist/blocks/button/block.json +5 -0
  7. package/dist/blocks/button/render.php +12 -2
  8. package/dist/blocks/button/style.css +1 -1
  9. package/dist/blocks/button/style.scss +33 -33
  10. package/dist/blocks/chip/block.json +15 -0
  11. package/dist/blocks/chip/render.php +54 -21
  12. package/dist/blocks/chip/style.css +1 -1
  13. package/dist/blocks/chip/style.scss +136 -76
  14. package/dist/blocks/dialog-box/block.json +5 -0
  15. package/dist/blocks/dialog-box/render.php +9 -1
  16. package/dist/blocks/dialog-box/style.css +1 -1
  17. package/dist/blocks/dialog-box/style.scss +6 -5
  18. package/dist/blocks/divider/block.json +21 -1
  19. package/dist/blocks/divider/render.php +9 -1
  20. package/dist/blocks/divider/style.css +1 -1
  21. package/dist/blocks/divider/style.scss +4 -3
  22. package/dist/blocks/icon/block.json +5 -0
  23. package/dist/blocks/icon/render.php +10 -12
  24. package/dist/blocks/icon/style.css +1 -1
  25. package/dist/blocks/icon/style.scss +4 -0
  26. package/dist/blocks/icon-button/block.json +5 -0
  27. package/dist/blocks/icon-button/render.php +14 -4
  28. package/dist/blocks/icon-button/style.css +1 -1
  29. package/dist/blocks/icon-button/style.scss +33 -32
  30. package/dist/blocks/input/block.json +5 -0
  31. package/dist/blocks/input/render.php +10 -1
  32. package/dist/blocks/input/style.css +1 -1
  33. package/dist/blocks/input/style.scss +14 -13
  34. package/dist/blocks/input-helper-message/block.json +5 -0
  35. package/dist/blocks/input-helper-message/render.php +9 -1
  36. package/dist/blocks/input-helper-message/style.css +1 -1
  37. package/dist/blocks/input-helper-message/style.scss +6 -5
  38. package/dist/blocks/label/block.json +68 -0
  39. package/dist/blocks/label/edit.js +79 -0
  40. package/dist/blocks/label/index.js +11 -0
  41. package/dist/blocks/label/render.php +56 -0
  42. package/dist/blocks/label/save.js +21 -0
  43. package/dist/blocks/label/style.css +1 -0
  44. package/dist/blocks/label/style.scss +39 -0
  45. package/dist/blocks/link/block.json +5 -0
  46. package/dist/blocks/link/render.php +3 -1
  47. package/dist/blocks/link/style.css +1 -1
  48. package/dist/blocks/link/style.scss +19 -18
  49. package/dist/blocks/tab/block.json +5 -0
  50. package/dist/blocks/tab/render.php +9 -1
  51. package/dist/blocks/tab/style.css +1 -1
  52. package/dist/blocks/tab/style.scss +16 -15
  53. package/dist/blocks/tab-group/block.json +5 -0
  54. package/dist/blocks/tab-group/render.php +9 -1
  55. package/dist/blocks/tab-group/style.css +1 -1
  56. package/dist/blocks/tab-group/style.scss +2 -1
  57. package/dist/blocks/tag/block.json +5 -0
  58. package/dist/blocks/tag/render.php +10 -1
  59. package/dist/blocks/tag/style.css +1 -1
  60. package/dist/blocks/tag/style.scss +23 -25
  61. package/dist/blocks/text/block.json +5 -0
  62. package/dist/blocks/text/render.php +9 -1
  63. package/dist/blocks/toast/block.json +5 -0
  64. package/dist/blocks/toast/render.php +10 -1
  65. package/dist/blocks/toast/style.css +1 -1
  66. package/dist/blocks/toast/style.scss +13 -12
  67. package/dist/icon-data.json +1 -1
  68. package/dist/index.cjs +485 -177
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.css +1 -1
  71. package/dist/index.css.map +1 -1
  72. package/dist/index.js +485 -177
  73. package/dist/index.js.map +1 -1
  74. package/dist/plugin.php +1 -0
  75. package/dist/style-handles.json +5 -0
  76. package/dist/utils/render-icon.php +3 -0
  77. package/dist/utils/sanitize-aria-attributes.php +109 -0
  78. package/package.json +4 -4
  79. package/plugin.php +1 -0
  80. package/dist/blocks/utils/render-icon.php +0 -106
  81. package/dist/blocks/utils/sanitize-data-attributes.php +0 -37
@@ -2,22 +2,23 @@
2
2
  /* Uses SCSS variables from @times-design-system/theme-scss */
3
3
  /* Icon buttons inherit base button styles for colors, intents, etc. */
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
 
8
9
  /* Icon button base styling - applies button variables and states */
9
10
  .tds-icon-button {
10
- @include theme-value('--tds-button-bg', 'interactive-primary-fill-default');
11
- @include theme-value('--tds-button-fg', 'interactive-primary-text-default');
11
+ --tds-button-bg: var(--interactive-primary-fill-default);
12
+ --tds-button-fg: var(--interactive-primary-text-default);
12
13
  --tds-button-border: transparent;
13
- @include theme-value('--tds-button-bg-hover', 'interactive-primary-fill-hover');
14
- @include theme-value('--tds-button-fg-hover', 'interactive-primary-text-hover');
14
+ --tds-button-bg-hover: var(--interactive-primary-fill-hover);
15
+ --tds-button-fg-hover: var(--interactive-primary-text-hover);
15
16
  --tds-button-border-hover: transparent;
16
- @include theme-value('--tds-button-bg-pressed', 'interactive-primary-fill-pressed');
17
- @include theme-value('--tds-button-fg-pressed', 'interactive-primary-text-pressed');
17
+ --tds-button-bg-pressed: var(--interactive-primary-fill-pressed);
18
+ --tds-button-fg-pressed: var(--interactive-primary-text-pressed);
18
19
  --tds-button-border-pressed: transparent;
19
20
  --tds-button-border-focus: transparent;
20
- @include theme-value('--tds-button-focus-ring', 'text-tertiary');
21
+ --tds-button-focus-ring: var(--text-tertiary);
21
22
 
22
23
  position: relative;
23
24
  display: flex;
@@ -88,40 +89,40 @@
88
89
 
89
90
  /* Intent variants - shared with button block */
90
91
  .tds-button--intent-primary {
91
- @include theme-value('--tds-button-bg', 'interactive-primary-fill-default');
92
- @include theme-value('--tds-button-fg', 'interactive-primary-text-default');
92
+ --tds-button-bg: var(--interactive-primary-fill-default);
93
+ --tds-button-fg: var(--interactive-primary-text-default);
93
94
  --tds-button-border: transparent;
94
- @include theme-value('--tds-button-bg-hover', 'interactive-primary-fill-hover');
95
- @include theme-value('--tds-button-fg-hover', 'interactive-primary-text-hover');
95
+ --tds-button-bg-hover: var(--interactive-primary-fill-hover);
96
+ --tds-button-fg-hover: var(--interactive-primary-text-hover);
96
97
  --tds-button-border-hover: transparent;
97
- @include theme-value('--tds-button-bg-pressed', 'interactive-primary-fill-pressed');
98
- @include theme-value('--tds-button-fg-pressed', 'interactive-primary-text-pressed');
98
+ --tds-button-bg-pressed: var(--interactive-primary-fill-pressed);
99
+ --tds-button-fg-pressed: var(--interactive-primary-text-pressed);
99
100
  --tds-button-border-pressed: transparent;
100
101
  }
101
102
 
102
103
  .tds-button--intent-secondary {
103
- @include theme-value('--tds-button-bg', 'interactive-secondary-fill-default');
104
- @include theme-value('--tds-button-fg', 'interactive-secondary-text-default');
105
- @include theme-value('--tds-button-border', 'interactive-secondary-border-default');
106
- @include theme-value('--tds-button-bg-hover', 'interactive-secondary-fill-hover');
107
- @include theme-value('--tds-button-fg-hover', 'interactive-secondary-text-hover');
108
- @include theme-value('--tds-button-border-hover', 'interactive-secondary-border-hover');
109
- @include theme-value('--tds-button-bg-pressed', 'interactive-secondary-fill-pressed');
110
- @include theme-value('--tds-button-fg-pressed', 'interactive-secondary-text-pressed');
111
- @include theme-value('--tds-button-border-pressed', 'interactive-secondary-border-pressed');
112
- @include theme-value('--tds-button-border-focus', 'interactive-secondary-border-default');
104
+ --tds-button-bg: var(--interactive-secondary-fill-default);
105
+ --tds-button-fg: var(--interactive-secondary-text-default);
106
+ --tds-button-border: var(--interactive-secondary-border-default);
107
+ --tds-button-bg-hover: var(--interactive-secondary-fill-hover);
108
+ --tds-button-fg-hover: var(--interactive-secondary-text-hover);
109
+ --tds-button-border-hover: var(--interactive-secondary-border-hover);
110
+ --tds-button-bg-pressed: var(--interactive-secondary-fill-pressed);
111
+ --tds-button-fg-pressed: var(--interactive-secondary-text-pressed);
112
+ --tds-button-border-pressed: var(--interactive-secondary-border-pressed);
113
+ --tds-button-border-focus: var(--interactive-secondary-border-default);
113
114
  }
114
115
 
115
116
  .tds-button--intent-negative {
116
- @include theme-value('--tds-button-bg', 'interactive-negative-fill-default');
117
- @include theme-value('--tds-button-fg', 'interactive-negative-text-default');
118
- @include theme-value('--tds-button-border', 'interactive-negative-border-default');
119
- @include theme-value('--tds-button-bg-hover', 'interactive-negative-fill-hover');
120
- @include theme-value('--tds-button-fg-hover', 'interactive-negative-text-hover');
121
- @include theme-value('--tds-button-border-hover', 'interactive-negative-border-hover');
122
- @include theme-value('--tds-button-bg-pressed', 'interactive-negative-fill-pressed');
123
- @include theme-value('--tds-button-fg-pressed', 'interactive-negative-text-pressed');
124
- @include theme-value('--tds-button-border-pressed', 'interactive-negative-border-pressed');
117
+ --tds-button-bg: var(--interactive-negative-fill-default);
118
+ --tds-button-fg: var(--interactive-negative-text-default);
119
+ --tds-button-border: var(--interactive-negative-border-default);
120
+ --tds-button-bg-hover: var(--interactive-negative-fill-hover);
121
+ --tds-button-fg-hover: var(--interactive-negative-text-hover);
122
+ --tds-button-border-hover: var(--interactive-negative-border-hover);
123
+ --tds-button-bg-pressed: var(--interactive-negative-fill-pressed);
124
+ --tds-button-fg-pressed: var(--interactive-negative-text-pressed);
125
+ --tds-button-border-pressed: var(--interactive-negative-border-pressed);
125
126
  }
126
127
 
127
128
  /* Icon button specific sizing */
@@ -59,6 +59,11 @@
59
59
  "type": "object",
60
60
  "default": {},
61
61
  "description": "Custom data-* attributes for extensibility (allowlisted server-side)"
62
+ },
63
+ "ariaAttributes": {
64
+ "type": "object",
65
+ "default": {},
66
+ "description": "Custom aria-* attributes for extensibility (allowlisted server-side)"
62
67
  }
63
68
  },
64
69
  "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']) ? sanitize_text_field($attributes['label']) : '';
16
17
  $placeholder = isset($attributes['placeholder']) ? sanitize_text_field($attributes['placeholder']) : '';
@@ -28,6 +29,13 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
28
29
  $data_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
29
30
  }
30
31
 
32
+ // Sanitize and prepare aria-* attributes
33
+ $sanitized_aria_attributes = tds_sanitize_aria_attributes($attributes['ariaAttributes'] ?? [], 'input', $attributes);
34
+ $aria_attrs_html = '';
35
+ foreach ($sanitized_aria_attributes as $attr_name => $attr_value) {
36
+ $aria_attrs_html .= ' ' . esc_attr($attr_name) . '="' . esc_attr($attr_value) . '"';
37
+ }
38
+
31
39
  $input_classes = ['tds-input'];
32
40
  if ($element_class_name) {
33
41
  $input_classes[] = $element_class_name;
@@ -50,6 +58,7 @@ $wrapper_attrs = get_block_wrapper_attributes();
50
58
  <?php echo $name ? 'name="' . esc_attr($name) . '"' : ''; ?>
51
59
  <?php echo $id ? 'id="' . esc_attr($id) . '"' : ''; ?>
52
60
  class="<?php echo esc_attr(implode(' ', $input_classes)); ?>"
53
- <?php echo wp_kses_post($data_attrs_html); ?>
61
+ <?php echo $aria_attrs_html; ?>
62
+ <?php echo $data_attrs_html; ?>
54
63
  />
55
64
  </div>