@times-design-system/components-wordpress 1.10.0 → 1.12.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.
@@ -0,0 +1,80 @@
1
+ # Times Design System Block Style Handles
2
+
3
+ Auto-generated mapping of blocks to WordPress style handles.
4
+
5
+ **Generated:** 2026-08-11T11:13:19.444Z
6
+
7
+ ## Style Handle Registration
8
+
9
+ Each block has a unique style handle for conditional CSS loading in WordPress.
10
+
11
+ ### Handles by Block
12
+
13
+ | Block | Handle | CSS File |
14
+ |-------|--------|----------|
15
+ | `ad-container` | `tds-ad-container-style` | `blocks/ad-container/style.css` |
16
+ | `button` | `tds-button-style` | `blocks/button/style.css` |
17
+ | `chip` | `tds-chip-style` | `blocks/chip/style.css` |
18
+ | `dialog-box` | `tds-dialog-box-style` | `blocks/dialog-box/style.css` |
19
+ | `divider` | `tds-divider-style` | `blocks/divider/style.css` |
20
+ | `icon` | `tds-icon-style` | `blocks/icon/style.css` |
21
+ | `icon-button` | `tds-icon-button-style` | `blocks/icon-button/style.css` |
22
+ | `input` | `tds-input-style` | `blocks/input/style.css` |
23
+ | `input-helper-message` | `tds-input-helper-message-style` | `blocks/input-helper-message/style.css` |
24
+ | `link` | `tds-link-style` | `blocks/link/style.css` |
25
+ | `tab` | `tds-tab-style` | `blocks/tab/style.css` |
26
+ | `tab-group` | `tds-tab-group-style` | `blocks/tab-group/style.css` |
27
+ | `tag` | `tds-tag-style` | `blocks/tag/style.css` |
28
+ | `text` | `tds-text-style` | `blocks/text/style.css` |
29
+ | `toast` | `tds-toast-style` | `blocks/toast/style.css` |
30
+
31
+ ## PHP Registration
32
+
33
+ In `plugin.php`, these handles are registered via `wp_register_style()`:
34
+
35
+ ```php
36
+ function tds_register_block_styles() {
37
+ $plugin_dir = plugin_dir_url( __FILE__ );
38
+ $blocks = array(
39
+ 'ad-container' => 'tds-ad-container-style',
40
+ 'button' => 'tds-button-style',
41
+ 'chip' => 'tds-chip-style',
42
+ 'dialog-box' => 'tds-dialog-box-style',
43
+ 'divider' => 'tds-divider-style',
44
+ 'icon' => 'tds-icon-style',
45
+ 'icon-button' => 'tds-icon-button-style',
46
+ 'input' => 'tds-input-style',
47
+ 'input-helper-message' => 'tds-input-helper-message-style',
48
+ 'link' => 'tds-link-style',
49
+ 'tab' => 'tds-tab-style',
50
+ 'tab-group' => 'tds-tab-group-style',
51
+ 'tag' => 'tds-tag-style',
52
+ 'text' => 'tds-text-style',
53
+ 'toast' => 'tds-toast-style',
54
+ );
55
+
56
+ foreach ( $blocks as $block_name => $handle ) {
57
+ wp_register_style(
58
+ $handle,
59
+ $plugin_dir . 'blocks/' . $block_name . '/style.css',
60
+ array(),
61
+ tds_get_asset_version( 'blocks/' . $block_name . '/style.css' )
62
+ );
63
+ }
64
+ }
65
+ add_action( 'init', 'tds_register_block_styles', 9 );
66
+ ```
67
+
68
+ ## block.json Reference
69
+
70
+ Each block's `block.json` file includes its style handle:
71
+
72
+ ```json
73
+ {
74
+ "name": "tds/button",
75
+ "style": "tds-button-style",
76
+ ...
77
+ }
78
+ ```
79
+
80
+ This enables WordPress to conditionally load CSS only when the block is used on a page.
@@ -18,7 +18,10 @@
18
18
  "type": {
19
19
  "type": "string",
20
20
  "default": "inline",
21
- "enum": ["header", "inline"]
21
+ "enum": [
22
+ "header",
23
+ "inline"
24
+ ]
22
25
  },
23
26
  "slotID": {
24
27
  "type": "string",
@@ -36,6 +39,7 @@
36
39
  }
37
40
  },
38
41
  "example": {},
42
+ "style": "tds-ad-container-style",
39
43
  "script": "times-design-system",
40
44
  "editorScript": "times-design-system"
41
45
  }
@@ -25,19 +25,31 @@
25
25
  },
26
26
  "intent": {
27
27
  "type": "string",
28
- "enum": ["primary", "secondary", "negative"],
28
+ "enum": [
29
+ "primary",
30
+ "secondary",
31
+ "negative"
32
+ ],
29
33
  "default": "primary",
30
34
  "description": "Visual style variant"
31
35
  },
32
36
  "size": {
33
37
  "type": "string",
34
- "enum": ["small", "medium", "large", "xlarge"],
38
+ "enum": [
39
+ "small",
40
+ "medium",
41
+ "large",
42
+ "xlarge"
43
+ ],
35
44
  "default": "large",
36
45
  "description": "Controls the overall dimensions of the button"
37
46
  },
38
47
  "behaviour": {
39
48
  "type": "string",
40
- "enum": ["hug", "full"],
49
+ "enum": [
50
+ "hug",
51
+ "full"
52
+ ],
41
53
  "default": "hug",
42
54
  "description": "Controls the width behaviour"
43
55
  },
@@ -62,7 +74,12 @@
62
74
  },
63
75
  "target": {
64
76
  "type": "string",
65
- "enum": ["_blank", "_self", "_parent", "_top"],
77
+ "enum": [
78
+ "_blank",
79
+ "_self",
80
+ "_parent",
81
+ "_top"
82
+ ],
66
83
  "description": "Optional target attribute for links"
67
84
  },
68
85
  "rel": {
@@ -71,7 +88,11 @@
71
88
  },
72
89
  "type": {
73
90
  "type": "string",
74
- "enum": ["button", "submit", "reset"],
91
+ "enum": [
92
+ "button",
93
+ "submit",
94
+ "reset"
95
+ ],
75
96
  "default": "button",
76
97
  "description": "Button type"
77
98
  },
@@ -105,19 +126,40 @@
105
126
  },
106
127
  "editorScript": "times-design-system",
107
128
  "script": "times-design-system",
129
+ "style": "tds-button-style",
108
130
  "preview": {
109
131
  "combinations": [
110
- { "label": "Primary", "intent": "primary", "size": "medium" },
111
- { "label": "Primary Small", "intent": "primary", "size": "small" },
132
+ {
133
+ "label": "Primary",
134
+ "intent": "primary",
135
+ "size": "medium"
136
+ },
137
+ {
138
+ "label": "Primary Small",
139
+ "intent": "primary",
140
+ "size": "small"
141
+ },
112
142
  {
113
143
  "label": "Primary Small",
114
144
  "intent": "primary",
115
145
  "size": "small",
116
146
  "iconRight": "filled_arrow_right"
117
147
  },
118
- { "label": "Primary Large", "intent": "primary", "size": "large" },
119
- { "label": "Secondary", "intent": "secondary", "size": "medium" },
120
- { "label": "Negative", "intent": "negative", "size": "medium" },
148
+ {
149
+ "label": "Primary Large",
150
+ "intent": "primary",
151
+ "size": "large"
152
+ },
153
+ {
154
+ "label": "Secondary",
155
+ "intent": "secondary",
156
+ "size": "medium"
157
+ },
158
+ {
159
+ "label": "Negative",
160
+ "intent": "negative",
161
+ "size": "medium"
162
+ },
121
163
  {
122
164
  "label": "Disabled",
123
165
  "disabled": true,
@@ -21,12 +21,18 @@
21
21
  "intent": {
22
22
  "type": "string",
23
23
  "default": "primary",
24
- "enum": ["primary", "secondary"]
24
+ "enum": [
25
+ "primary",
26
+ "secondary"
27
+ ]
25
28
  },
26
29
  "size": {
27
30
  "type": "string",
28
31
  "default": "small",
29
- "enum": ["small", "large"]
32
+ "enum": [
33
+ "small",
34
+ "large"
35
+ ]
30
36
  },
31
37
  "channel": {
32
38
  "type": "boolean",
@@ -67,14 +73,31 @@
67
73
  }
68
74
  },
69
75
  "example": {},
76
+ "style": "tds-chip-style",
70
77
  "script": "times-design-system",
71
78
  "editorScript": "times-design-system",
72
79
  "preview": {
73
80
  "combinations": [
74
- { "content": "Primary Small", "intent": "primary", "size": "small" },
75
- { "content": "Primary Large", "intent": "primary", "size": "large" },
76
- { "content": "Secondary", "intent": "secondary", "size": "small" },
77
- { "content": "Channel", "channel": true, "size": "small" },
81
+ {
82
+ "content": "Primary Small",
83
+ "intent": "primary",
84
+ "size": "small"
85
+ },
86
+ {
87
+ "content": "Primary Large",
88
+ "intent": "primary",
89
+ "size": "large"
90
+ },
91
+ {
92
+ "content": "Secondary",
93
+ "intent": "secondary",
94
+ "size": "small"
95
+ },
96
+ {
97
+ "content": "Channel",
98
+ "channel": true,
99
+ "size": "small"
100
+ },
78
101
  {
79
102
  "content": "Toggle",
80
103
  "intent": "primary",
@@ -30,6 +30,7 @@
30
30
  }
31
31
  },
32
32
  "render": "file:./render.php",
33
+ "style": "tds-dialog-box-style",
33
34
  "editorScript": "times-design-system",
34
35
  "script": "times-design-system"
35
36
  }
@@ -11,7 +11,10 @@
11
11
  "spacing": {
12
12
  "margin": true
13
13
  },
14
- "align": ["wide", "full"]
14
+ "align": [
15
+ "wide",
16
+ "full"
17
+ ]
15
18
  },
16
19
  "render": "file:./render.php",
17
20
  "attributes": {
@@ -39,6 +42,7 @@
39
42
  }
40
43
  },
41
44
  "example": {},
45
+ "style": "tds-divider-style",
42
46
  "script": "times-design-system",
43
47
  "editorScript": "times-design-system"
44
48
  }
@@ -47,13 +47,29 @@
47
47
  "render": "file:./render.php",
48
48
  "editorScript": "times-design-system",
49
49
  "script": "times-design-system",
50
+ "style": "tds-icon-style",
50
51
  "preview": {
51
52
  "combinations": [
52
- { "iconName": "filled_circle", "size": "small" },
53
- { "iconName": "filled_circle", "size": "medium" },
54
- { "iconName": "filled_circle", "size": "large" },
55
- { "iconName": "outlined_check", "size": "medium" },
56
- { "iconName": "filled_arrow_right", "size": "medium" }
53
+ {
54
+ "iconName": "filled_circle",
55
+ "size": "small"
56
+ },
57
+ {
58
+ "iconName": "filled_circle",
59
+ "size": "medium"
60
+ },
61
+ {
62
+ "iconName": "filled_circle",
63
+ "size": "large"
64
+ },
65
+ {
66
+ "iconName": "outlined_check",
67
+ "size": "medium"
68
+ },
69
+ {
70
+ "iconName": "filled_arrow_right",
71
+ "size": "medium"
72
+ }
57
73
  ]
58
74
  }
59
75
  }
@@ -19,19 +19,16 @@
19
19
  "default": "",
20
20
  "description": "Icon name with variant prefix (e.g., 'filled_accessibility', 'outlined_accessibility')"
21
21
  },
22
- "iconSize": {
22
+ "size": {
23
23
  "type": "string",
24
24
  "enum": [
25
- "2xsmall",
26
- "xsmall",
27
25
  "small",
28
26
  "medium",
29
27
  "large",
30
- "xlarge",
31
- "2xlarge"
28
+ "xlarge"
32
29
  ],
33
30
  "default": "medium",
34
- "description": "Size of the icon"
31
+ "description": "Controls the overall dimensions of the icon button"
35
32
  },
36
33
  "round": {
37
34
  "type": "boolean",
@@ -39,7 +36,11 @@
39
36
  },
40
37
  "intent": {
41
38
  "type": "string",
42
- "enum": ["primary", "secondary", "negative"],
39
+ "enum": [
40
+ "primary",
41
+ "secondary",
42
+ "negative"
43
+ ],
43
44
  "default": "primary",
44
45
  "description": "Visual style variant matching button intents"
45
46
  },
@@ -55,7 +56,12 @@
55
56
  "target": {
56
57
  "type": "string",
57
58
  "default": "_self",
58
- "enum": ["_self", "_blank", "_parent", "_top"]
59
+ "enum": [
60
+ "_self",
61
+ "_blank",
62
+ "_parent",
63
+ "_top"
64
+ ]
59
65
  },
60
66
  "rel": {
61
67
  "type": "string",
@@ -83,35 +89,52 @@
83
89
  },
84
90
  "preview": {
85
91
  "combinations": [
86
- { "iconName": "filled_add", "iconSize": "medium", "intent": "primary" },
87
- { "iconName": "filled_add", "iconSize": "medium", "intent": "secondary" },
88
- { "iconName": "filled_add", "iconSize": "medium", "intent": "negative" },
92
+ {
93
+ "iconName": "filled_add",
94
+ "size": "large",
95
+ "intent": "primary"
96
+ },
97
+ {
98
+ "iconName": "filled_add",
99
+ "size": "large",
100
+ "intent": "secondary"
101
+ },
102
+ {
103
+ "iconName": "filled_add",
104
+ "size": "large",
105
+ "intent": "negative"
106
+ },
89
107
  {
90
108
  "iconName": "filled_search",
91
- "iconSize": "medium",
109
+ "size": "large",
110
+ "intent": "primary"
111
+ },
112
+ {
113
+ "iconName": "filled_close",
114
+ "size": "small",
92
115
  "intent": "primary"
93
116
  },
94
- { "iconName": "filled_close", "iconSize": "small", "intent": "primary" },
95
117
  {
96
118
  "iconName": "filled_settings",
97
- "iconSize": "large",
119
+ "size": "xlarge",
98
120
  "intent": "primary"
99
121
  },
100
122
  {
101
123
  "iconName": "filled_add",
102
- "iconSize": "medium",
124
+ "size": "large",
103
125
  "intent": "primary",
104
126
  "round": true
105
127
  },
106
128
  {
107
129
  "iconName": "filled_add",
108
- "iconSize": "medium",
130
+ "size": "large",
109
131
  "intent": "primary",
110
132
  "onClick": "handleIconButtonClick"
111
133
  }
112
134
  ]
113
135
  },
114
136
  "example": {},
137
+ "style": "tds-icon-button-style",
115
138
  "script": "times-design-system",
116
139
  "editorScript": "times-design-system"
117
140
  }
@@ -14,7 +14,7 @@ require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
14
14
  require_once __DIR__ . '/../../utils/render-icon.php';
15
15
 
16
16
  $icon_name = isset($attributes['iconName']) ? sanitize_text_field($attributes['iconName']) : 'filled_check';
17
- $icon_size = isset($attributes['iconSize']) ? sanitize_text_field($attributes['iconSize']) : 'medium';
17
+ $size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : 'medium';
18
18
  $intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : 'primary';
19
19
  $round = isset($attributes['round']) ? (bool) $attributes['round'] : false;
20
20
  $isLoading = isset($attributes['isLoading']) ? (bool) $attributes['isLoading'] : false;
@@ -34,7 +34,7 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
34
34
 
35
35
  $classes = ['tds-icon-button'];
36
36
  $classes[] = 'tds-button--intent-' . $intent;
37
- $classes[] = 'tds-icon-button--size-' . $icon_size;
37
+ $classes[] = 'tds-icon-button--size-' . $size;
38
38
  if ($round) {
39
39
  $classes[] = 'tds-icon-button--is-rounded';
40
40
  }
@@ -25,7 +25,14 @@
25
25
  "type": {
26
26
  "type": "string",
27
27
  "default": "text",
28
- "enum": ["text", "email", "password", "number", "tel", "url"]
28
+ "enum": [
29
+ "text",
30
+ "email",
31
+ "password",
32
+ "number",
33
+ "tel",
34
+ "url"
35
+ ]
29
36
  },
30
37
  "disabled": {
31
38
  "type": "boolean",
@@ -55,6 +62,7 @@
55
62
  }
56
63
  },
57
64
  "example": {},
65
+ "style": "tds-input-style",
58
66
  "script": "times-design-system",
59
67
  "editorScript": "times-design-system"
60
68
  }
@@ -30,6 +30,7 @@
30
30
  }
31
31
  },
32
32
  "render": "file:./render.php",
33
+ "style": "tds-input-helper-message-style",
33
34
  "editorScript": "times-design-system",
34
35
  "script": "times-design-system"
35
36
  }
@@ -25,18 +25,30 @@
25
25
  "intent": {
26
26
  "type": "string",
27
27
  "default": "primary",
28
- "enum": ["primary", "secondary", "danger"],
28
+ "enum": [
29
+ "primary",
30
+ "secondary",
31
+ "danger"
32
+ ],
29
33
  "description": "Link color and style variant"
30
34
  },
31
35
  "sentiment": {
32
36
  "type": "string",
33
37
  "default": "brand",
34
- "enum": ["brand", "utility"]
38
+ "enum": [
39
+ "brand",
40
+ "utility"
41
+ ]
35
42
  },
36
43
  "size": {
37
44
  "type": "string",
38
45
  "default": "medium",
39
- "enum": ["xsmall", "small", "medium", "large"],
46
+ "enum": [
47
+ "xsmall",
48
+ "small",
49
+ "medium",
50
+ "large"
51
+ ],
40
52
  "description": "Link size variant"
41
53
  },
42
54
  "iconLeft": {
@@ -60,7 +72,12 @@
60
72
  "target": {
61
73
  "type": "string",
62
74
  "default": "_self",
63
- "enum": ["_self", "_blank", "_parent", "_top"]
75
+ "enum": [
76
+ "_self",
77
+ "_blank",
78
+ "_parent",
79
+ "_top"
80
+ ]
64
81
  },
65
82
  "rel": {
66
83
  "type": "string",
@@ -88,6 +105,7 @@
88
105
  }
89
106
  },
90
107
  "example": {},
108
+ "style": "tds-link-style",
91
109
  "script": "times-design-system",
92
110
  "editorScript": "times-design-system",
93
111
  "preview": {
@@ -124,9 +142,21 @@
124
142
  "intent": "danger",
125
143
  "size": "medium"
126
144
  },
127
- { "content": "XSmall", "href": "#", "size": "xsmall" },
128
- { "content": "Small", "href": "#", "size": "small" },
129
- { "content": "Large", "href": "#", "size": "large" },
145
+ {
146
+ "content": "XSmall",
147
+ "href": "#",
148
+ "size": "xsmall"
149
+ },
150
+ {
151
+ "content": "Small",
152
+ "href": "#",
153
+ "size": "small"
154
+ },
155
+ {
156
+ "content": "Large",
157
+ "href": "#",
158
+ "size": "large"
159
+ },
130
160
  {
131
161
  "content": "Brand",
132
162
  "href": "#",
@@ -30,6 +30,7 @@
30
30
  }
31
31
  },
32
32
  "render": "file:./render.php",
33
+ "style": "tds-tab-style",
33
34
  "editorScript": "times-design-system",
34
35
  "script": "times-design-system"
35
36
  }
@@ -30,6 +30,7 @@
30
30
  }
31
31
  },
32
32
  "render": "file:./render.php",
33
+ "style": "tds-tab-group-style",
33
34
  "editorScript": "times-design-system",
34
35
  "script": "times-design-system"
35
36
  }
@@ -21,12 +21,20 @@
21
21
  "intent": {
22
22
  "type": "string",
23
23
  "default": "secondary",
24
- "enum": ["primary", "secondary", "tertiary"]
24
+ "enum": [
25
+ "primary",
26
+ "secondary",
27
+ "tertiary"
28
+ ]
25
29
  },
26
30
  "size": {
27
31
  "type": "string",
28
32
  "default": "medium",
29
- "enum": ["small", "medium", "large"]
33
+ "enum": [
34
+ "small",
35
+ "medium",
36
+ "large"
37
+ ]
30
38
  },
31
39
  "callout": {
32
40
  "type": "boolean",
@@ -64,13 +72,26 @@
64
72
  }
65
73
  },
66
74
  "example": {},
75
+ "style": "tds-tag-style",
67
76
  "script": "times-design-system",
68
77
  "editorScript": "times-design-system",
69
78
  "preview": {
70
79
  "combinations": [
71
- { "label": "Primary", "intent": "primary", "size": "small" },
72
- { "label": "Secondary", "intent": "secondary", "size": "medium" },
73
- { "label": "Tertiary", "intent": "tertiary", "size": "large" },
80
+ {
81
+ "label": "Primary",
82
+ "intent": "primary",
83
+ "size": "small"
84
+ },
85
+ {
86
+ "label": "Secondary",
87
+ "intent": "secondary",
88
+ "size": "medium"
89
+ },
90
+ {
91
+ "label": "Tertiary",
92
+ "intent": "tertiary",
93
+ "size": "large"
94
+ },
74
95
  {
75
96
  "label": "Callout",
76
97
  "intent": "primary",
@@ -18,7 +18,15 @@
18
18
  "as": {
19
19
  "type": "string",
20
20
  "default": "p",
21
- "enum": ["p", "span", "h1", "h2", "h3", "h4", "h5"]
21
+ "enum": [
22
+ "p",
23
+ "span",
24
+ "h1",
25
+ "h2",
26
+ "h3",
27
+ "h4",
28
+ "h5"
29
+ ]
22
30
  },
23
31
  "typographyStyle": {
24
32
  "type": "string",
@@ -40,6 +48,7 @@
40
48
  }
41
49
  },
42
50
  "example": {},
51
+ "style": "tds-text-style",
43
52
  "script": "times-design-system",
44
53
  "editorScript": "times-design-system"
45
54
  }