@times-design-system/components-wordpress 1.8.1-alpha.0 → 1.8.1-alpha.3
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/README.md +41 -0
- package/dist/blocks/ad-container/block.json +3 -1
- package/dist/blocks/button/block.json +3 -4
- package/dist/blocks/button/edit.js +15 -21
- package/dist/blocks/button/render.php +40 -43
- package/dist/blocks/button/save.js +13 -19
- package/dist/blocks/button/style.css +8 -25
- package/dist/blocks/chip/block.json +3 -1
- package/dist/blocks/chip/render.php +1 -1
- package/dist/blocks/chip/style.css +3 -3
- package/dist/blocks/dialog-box/block.json +2 -1
- package/dist/blocks/divider/block.json +3 -1
- package/dist/blocks/flag/block.json +3 -1
- package/dist/blocks/flag/style.css +19 -22
- package/dist/blocks/icon/block.json +2 -1
- package/dist/blocks/icon-button/block.json +3 -1
- package/dist/blocks/icon-button/render.php +3 -2
- package/dist/blocks/icon-button/style.css +9 -8
- package/dist/blocks/input/block.json +3 -1
- package/dist/blocks/input/style.css +31 -17
- package/dist/blocks/input-helper-message/block.json +2 -1
- package/dist/blocks/link/block.json +3 -1
- package/dist/blocks/link/style.css +123 -21
- package/dist/blocks/tab/block.json +2 -1
- package/dist/blocks/tab/style.css +146 -17
- package/dist/blocks/tab-group/block.json +2 -1
- package/dist/blocks/text/block.json +3 -1
- package/dist/blocks/toast/block.json +3 -1
- package/dist/blocks/toast/style.css +32 -31
- package/dist/blocks/utils/render-icon.php +39 -0
- package/dist/blocks/utils/sanitize-data-attributes.php +37 -0
- package/dist/icon-data.json +1 -1
- package/dist/index.cjs +975 -263
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +976 -264
- package/dist/index.js.map +1 -1
- package/dist/plugin.php +162 -12
- package/package.json +9 -6
- package/plugin.php +162 -12
- package/dist/blocks/button/style-editor.css +0 -15
package/README.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
WordPress Gutenberg blocks built from Times Design System components. Provides Full Site Editing (FSE) compatible blocks for React-based design tokens and SCSS styling.
|
|
4
4
|
|
|
5
|
+
## ⚠️ CRITICAL: CSS Bundling Requirement
|
|
6
|
+
|
|
7
|
+
**All block CSS files must be imported in `src/index.js` for styles to be bundled and deployed.** Without these imports, styles will not appear in WordPress.
|
|
8
|
+
|
|
9
|
+
When adding a new block:
|
|
10
|
+
|
|
11
|
+
1. Create `src/blocks/{blockName}/style.css`
|
|
12
|
+
2. **Add to `src/index.js`**: `import './blocks/{blockName}/style.css';`
|
|
13
|
+
3. Run `npm run build` (includes CSS import validation)
|
|
14
|
+
|
|
15
|
+
See [STYLING_BUNDLING_GUIDE.md](./STYLING_BUNDLING_GUIDE.md) for full details on CSS bundling, troubleshooting, and deployment.
|
|
16
|
+
|
|
17
|
+
## 🚀 Quick Start (Local Testing)
|
|
18
|
+
|
|
19
|
+
Test blocks locally with Docker in 3 minutes:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Build plugin (includes CSS import validation)
|
|
23
|
+
npm run build
|
|
24
|
+
|
|
25
|
+
# Start WordPress
|
|
26
|
+
cd ../..
|
|
27
|
+
make wp-start
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then visit **http://localhost:8080** and activate the plugin in WordPress Admin.
|
|
31
|
+
|
|
32
|
+
📖 **Full guide**: See [WORDPRESS_SETUP.md](../../WORDPRESS_SETUP.md) for complete testing, development, and deployment instructions.
|
|
33
|
+
|
|
34
|
+
## 📚 Documentation
|
|
35
|
+
|
|
36
|
+
### Component Transformation
|
|
37
|
+
|
|
38
|
+
- [BLOCK_TRANSFORMATION_GUIDE.md](./BLOCK_TRANSFORMATION_GUIDE.md) — **READ THIS** for adding or updating blocks. Comprehensive guide covering markup parity, typography mapping, accessibility, and common pitfalls.
|
|
39
|
+
- [BUTTON_BLOCK_COMPARISON.md](./BUTTON_BLOCK_COMPARISON.md) — Detailed case study of Button Block transformation, showing React vs WordPress side-by-side, changes made, and verification steps.
|
|
40
|
+
|
|
41
|
+
### Operations & Maintenance
|
|
42
|
+
|
|
43
|
+
- [DEPLOYMENT_AND_MAINTENANCE.md](./DEPLOYMENT_AND_MAINTENANCE.md) — Step-by-step deployment, troubleshooting, adding new blocks, and CI/CD integration.
|
|
44
|
+
- [STYLING_BUNDLING_GUIDE.md](./STYLING_BUNDLING_GUIDE.md) — Technical reference for CSS bundling architecture and debugging style issues.
|
|
45
|
+
|
|
5
46
|
## Overview
|
|
6
47
|
|
|
7
48
|
This package transforms `@times-design-system/components-react` components into WordPress Gutenberg blocks:
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"size": {
|
|
33
33
|
"type": "string",
|
|
34
|
-
"enum": ["small", "medium", "large"],
|
|
34
|
+
"enum": ["small", "medium", "large", "xlarge"],
|
|
35
35
|
"default": "large",
|
|
36
36
|
"description": "Controls the overall dimensions of the button"
|
|
37
37
|
},
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
"description": "Custom data-* attributes for extensibility (allowlisted server-side)"
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
|
-
"editorScript": "
|
|
102
|
-
"
|
|
103
|
-
"style": "file:./style.css"
|
|
101
|
+
"editorScript": "times-design-system",
|
|
102
|
+
"script": "times-design-system"
|
|
104
103
|
}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
import { RichText } from '@wordpress/block-editor';
|
|
9
9
|
import { buildButtonClass } from '../../utils/classBuilder.js';
|
|
10
|
-
import './style-editor.css';
|
|
11
10
|
|
|
12
11
|
export default function Edit({ attributes, setAttributes }) {
|
|
13
12
|
const {
|
|
@@ -29,10 +28,6 @@ export default function Edit({ attributes, setAttributes }) {
|
|
|
29
28
|
dataAttributes
|
|
30
29
|
} = attributes;
|
|
31
30
|
|
|
32
|
-
const blockProps = useBlockProps({
|
|
33
|
-
className: 'tds-button-wrapper'
|
|
34
|
-
});
|
|
35
|
-
|
|
36
31
|
const buttonClass = buildButtonClass({
|
|
37
32
|
intent,
|
|
38
33
|
size,
|
|
@@ -44,21 +39,19 @@ export default function Edit({ attributes, setAttributes }) {
|
|
|
44
39
|
|
|
45
40
|
return (
|
|
46
41
|
<>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
>
|
|
57
|
-
<span className="tds-button__label
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</Element>
|
|
61
|
-
</div>
|
|
42
|
+
<Element
|
|
43
|
+
className={buttonClass}
|
|
44
|
+
disabled={!href && disabled}
|
|
45
|
+
href={href}
|
|
46
|
+
target={target}
|
|
47
|
+
rel={rel}
|
|
48
|
+
type={!href ? type : undefined}
|
|
49
|
+
aria-label={ariaLabel}
|
|
50
|
+
>
|
|
51
|
+
<span className="tds-button__label-container">
|
|
52
|
+
<span className="tds-button__label">{label}</span>
|
|
53
|
+
</span>
|
|
54
|
+
</Element>
|
|
62
55
|
|
|
63
56
|
<InspectorControls>
|
|
64
57
|
<PanelBody title="Button Settings">
|
|
@@ -86,7 +79,8 @@ export default function Edit({ attributes, setAttributes }) {
|
|
|
86
79
|
options={[
|
|
87
80
|
{ label: 'Small', value: 'small' },
|
|
88
81
|
{ label: 'Medium', value: 'medium' },
|
|
89
|
-
{ label: 'Large', value: 'large' }
|
|
82
|
+
{ label: 'Large', value: 'large' },
|
|
83
|
+
{ label: 'XLarge', value: 'xlarge' }
|
|
90
84
|
]}
|
|
91
85
|
onChange={(value) => setAttributes({ size: value })}
|
|
92
86
|
/>
|
|
@@ -51,7 +51,7 @@ $classes[] = 'tds-button--intent-' . $intent;
|
|
|
51
51
|
$classes[] = 'tds-button--size-' . $size;
|
|
52
52
|
$classes[] = 'tds-button--behaviour-' . $behaviour;
|
|
53
53
|
if ($isRounded) {
|
|
54
|
-
$classes[] = 'tds-button--rounded';
|
|
54
|
+
$classes[] = 'tds-button--is-rounded';
|
|
55
55
|
}
|
|
56
56
|
if ($isLoading) {
|
|
57
57
|
$classes[] = 'tds-button--loading';
|
|
@@ -66,52 +66,49 @@ if ($element_class_name) {
|
|
|
66
66
|
|
|
67
67
|
$button_class = implode(' ', $classes);
|
|
68
68
|
$element_tag = $href ? 'a' : 'button';
|
|
69
|
-
$wrapper_attrs = get_block_wrapper_attributes(['class' => 'tds-button-wrapper']);
|
|
70
69
|
?>
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
<?php
|
|
72
|
+
if ($element_tag === 'a') {
|
|
73
|
+
?>
|
|
74
|
+
<a
|
|
75
|
+
class="<?php echo esc_attr($button_class); ?>"
|
|
76
|
+
href="<?php echo esc_attr($href); ?>"
|
|
77
|
+
<?php echo $target ? 'target="' . esc_attr($target) . '"' : ''; ?>
|
|
78
|
+
<?php echo $rel ? 'rel="' . esc_attr($rel) . '"' : ''; ?>
|
|
79
|
+
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
80
|
+
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
81
|
+
>
|
|
82
|
+
<span class="tds-button__label-container">
|
|
83
|
+
<?php if ($icon_left) : ?>
|
|
84
|
+
<span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
|
|
85
|
+
<?php endif; ?>
|
|
86
|
+
<span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
|
|
87
|
+
<?php if ($icon_right) : ?>
|
|
88
|
+
<span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
|
|
89
|
+
<?php endif; ?>
|
|
90
|
+
</span>
|
|
91
|
+
</a>
|
|
73
92
|
<?php
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<span class="tds-button__label-container">
|
|
85
|
-
<?php if ($icon_left) : ?>
|
|
93
|
+
} else {
|
|
94
|
+
?>
|
|
95
|
+
<button
|
|
96
|
+
class="<?php echo esc_attr($button_class); ?>"
|
|
97
|
+
<?php echo $disabled ? 'disabled' : ''; ?>
|
|
98
|
+
type="<?php echo esc_attr($type); ?>"
|
|
99
|
+
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
100
|
+
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
101
|
+
>
|
|
102
|
+
<?php if ($icon_left) : ?>
|
|
86
103
|
<span class="tds-button__icon tds-button__icon--left"><?php echo wp_kses_post(tds_render_icon($icon_left, $icon_size)); ?></span>
|
|
87
104
|
<?php endif; ?>
|
|
88
|
-
<span class="tds-button__label"
|
|
105
|
+
<span class="tds-button__label-container">
|
|
106
|
+
<span class="tds-button__label"><?php echo wp_kses_post($label); ?></span>
|
|
107
|
+
</span>
|
|
89
108
|
<?php if ($icon_right) : ?>
|
|
90
109
|
<span class="tds-button__icon tds-button__icon--right"><?php echo wp_kses_post(tds_render_icon($icon_right, $icon_size)); ?></span>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
?>
|
|
97
|
-
<button
|
|
98
|
-
class="<?php echo esc_attr($button_class); ?>"
|
|
99
|
-
<?php echo $disabled ? 'disabled' : ''; ?>
|
|
100
|
-
type="<?php echo esc_attr($type); ?>"
|
|
101
|
-
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
102
|
-
<?php echo wp_kses_post($data_attrs_html); ?>
|
|
103
|
-
>
|
|
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; ?>
|
|
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; ?>
|
|
112
|
-
</span>
|
|
113
|
-
</button>
|
|
114
|
-
<?php
|
|
115
|
-
}
|
|
116
|
-
?>
|
|
117
|
-
</div>
|
|
110
|
+
<?php endif; ?>
|
|
111
|
+
</button>
|
|
112
|
+
<?php
|
|
113
|
+
}
|
|
114
|
+
?>
|
|
@@ -18,10 +18,6 @@ export default function Save({ attributes }) {
|
|
|
18
18
|
ariaLabel
|
|
19
19
|
} = attributes;
|
|
20
20
|
|
|
21
|
-
const blockProps = useBlockProps.save({
|
|
22
|
-
className: 'tds-button-wrapper'
|
|
23
|
-
});
|
|
24
|
-
|
|
25
21
|
const buttonClass = buildButtonClass({
|
|
26
22
|
intent,
|
|
27
23
|
size,
|
|
@@ -33,20 +29,18 @@ export default function Save({ attributes }) {
|
|
|
33
29
|
const Element = href ? 'a' : 'button';
|
|
34
30
|
|
|
35
31
|
return (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
<span className="tds-button__label
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</Element>
|
|
50
|
-
</div>
|
|
32
|
+
<Element
|
|
33
|
+
className={buttonClass}
|
|
34
|
+
disabled={!href && disabled}
|
|
35
|
+
href={href}
|
|
36
|
+
target={target}
|
|
37
|
+
rel={rel}
|
|
38
|
+
type={!href ? type : undefined}
|
|
39
|
+
aria-label={ariaLabel}
|
|
40
|
+
>
|
|
41
|
+
<span className="tds-button__label-container">
|
|
42
|
+
<span className="tds-button__label">{label}</span>
|
|
43
|
+
</span>
|
|
44
|
+
</Element>
|
|
51
45
|
);
|
|
52
46
|
}
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
gap: 0;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.tds-button--rounded {
|
|
69
|
+
.tds-button--is-rounded {
|
|
70
70
|
border-radius: 9999px;
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -108,35 +108,35 @@
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.tds-button--size-small {
|
|
111
|
-
min-height:
|
|
111
|
+
min-height: 40px;
|
|
112
112
|
padding: 0 12px;
|
|
113
113
|
min-width: 80px;
|
|
114
|
-
font-size: 1.4rem;
|
|
115
114
|
--tds-button-label-inline-padding: 4px;
|
|
115
|
+
font-size: 0.875rem; /* utility.button.small */
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
.tds-button--size-medium {
|
|
119
119
|
min-height: 48px;
|
|
120
120
|
min-width: 100px;
|
|
121
121
|
padding: 0 16px;
|
|
122
|
-
font-size: 1.6rem;
|
|
123
122
|
--tds-button-label-inline-padding: 8px;
|
|
123
|
+
font-size: 1rem; /* utility.button.medium */
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.tds-button--size-large {
|
|
127
|
-
min-height:
|
|
127
|
+
min-height: 56px;
|
|
128
128
|
min-width: 130px;
|
|
129
129
|
padding: 0 24px;
|
|
130
|
-
font-size: 1.8rem;
|
|
131
130
|
--tds-button-label-inline-padding: 8px;
|
|
131
|
+
font-size: 1rem; /* utility.button.medium - mapped from large */
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.tds-button--size-xlarge {
|
|
135
|
-
min-height:
|
|
135
|
+
min-height: 64px;
|
|
136
136
|
min-width: 130px;
|
|
137
137
|
padding: 0 24px;
|
|
138
|
-
font-size: 1.8rem;
|
|
139
138
|
--tds-button-label-inline-padding: 8px;
|
|
139
|
+
font-size: 1.125rem; /* utility.button.large - mapped from xlarge */
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.tds-button--behaviour-hug {
|
|
@@ -147,27 +147,10 @@
|
|
|
147
147
|
width: 100%;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.tds-button-wrapper {
|
|
151
|
-
display: inline-block;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
150
|
.tds-button__label-container {
|
|
155
|
-
display: inline-flex;
|
|
156
|
-
align-items: center;
|
|
157
|
-
justify-content: center;
|
|
158
|
-
flex: 0 0 auto;
|
|
159
|
-
width: fit-content;
|
|
160
151
|
padding: 0 var(--tds-button-label-inline-padding);
|
|
161
152
|
}
|
|
162
153
|
|
|
163
|
-
.tds-button__label {
|
|
164
|
-
display: inline-flex;
|
|
165
|
-
align-items: center;
|
|
166
|
-
justify-content: center;
|
|
167
|
-
flex: 0 0 auto;
|
|
168
|
-
width: fit-content;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
154
|
.tds-button__icon,
|
|
172
155
|
.tds-button__spinner {
|
|
173
156
|
display: inline-flex;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
14
|
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
15
15
|
|
|
16
|
-
$content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
|
|
16
|
+
$content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : 'Chip content';
|
|
17
17
|
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
|
|
18
18
|
$size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
|
|
19
19
|
$channel = isset($attributes['channel']) ? (bool) $attributes['channel'] : false;
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.tds-chip--size-small {
|
|
72
|
-
min-height:
|
|
72
|
+
min-height: 36px;
|
|
73
73
|
padding: 0 12px;
|
|
74
|
-
font-size:
|
|
74
|
+
font-size: 0.875rem; /* utility.button.small */
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
.tds-chip--size-large {
|
|
78
78
|
min-height: 48px;
|
|
79
79
|
padding: 0 16px;
|
|
80
|
-
font-size: 1.
|
|
80
|
+
font-size: 1.125rem; /* utility.button.large */
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.tds-chip__content {
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
/* Flag Block Frontend Styles */
|
|
2
|
-
/* Using
|
|
1
|
+
/* Flag Block Frontend Styles (Tag Component) */
|
|
2
|
+
/* Using design tokens for self-contained styling */
|
|
3
3
|
|
|
4
4
|
.tds-flag {
|
|
5
|
-
--tds-
|
|
6
|
-
--tds-
|
|
7
|
-
--tds-flag-icon: var(--flag-fg);
|
|
8
|
-
--tds-flag-border: transparent;
|
|
5
|
+
--tds-tag-bg: var(--tag-primary-fill, #000000);
|
|
6
|
+
--tds-tag-fg: var(--tag-primary-text, #f2f2f2);
|
|
9
7
|
|
|
10
8
|
display: inline-flex;
|
|
11
9
|
align-items: center;
|
|
12
10
|
justify-content: center;
|
|
13
|
-
gap:
|
|
11
|
+
gap: var(--spacing-03);
|
|
14
12
|
min-height: 19px;
|
|
15
13
|
min-width: 42px;
|
|
16
|
-
padding:
|
|
17
|
-
border-radius:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
font-
|
|
22
|
-
font-
|
|
23
|
-
font-weight: 500;
|
|
14
|
+
padding: var(--spacing-03) var(--spacing-04);
|
|
15
|
+
border-radius: var(--border-radius-50);
|
|
16
|
+
background-color: var(--tds-tag-bg);
|
|
17
|
+
color: var(--tds-tag-fg);
|
|
18
|
+
font-family: var(--fontFamily040, sans-serif);
|
|
19
|
+
font-size: var(--fontSize020, 14px);
|
|
20
|
+
font-weight: var(--fontWeight050, 500);
|
|
24
21
|
line-height: 1.125;
|
|
25
22
|
text-transform: uppercase;
|
|
26
23
|
white-space: nowrap;
|
|
@@ -28,19 +25,19 @@
|
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
.tds-flag--size-small {
|
|
31
|
-
|
|
28
|
+
padding: var(--spacing-01) var(--spacing-04);
|
|
29
|
+
font-size: var(--fontSize010, 12px);
|
|
30
|
+
gap: var(--spacing-01);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
.tds-flag--intent-secondary {
|
|
35
|
-
--tds-
|
|
36
|
-
--tds-
|
|
37
|
-
--tds-flag-icon: var(--tds-flag-fg);
|
|
34
|
+
--tds-tag-bg: transparent;
|
|
35
|
+
--tds-tag-fg: var(--text-primary, #1a1a1a);
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
.tds-flag--intent-callout {
|
|
41
|
-
--tds-
|
|
42
|
-
--tds-
|
|
43
|
-
--tds-flag-icon: var(--tds-flag-fg);
|
|
39
|
+
--tds-tag-bg: var(--tag-callout-primary-fill, #b20908);
|
|
40
|
+
--tds-tag-fg: var(--tag-callout-primary-text, #ffffff);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
.tds-flag__label {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
require_once __DIR__ . '/../../utils/sanitize-data-attributes.php';
|
|
14
14
|
require_once __DIR__ . '/../../utils/render-icon.php';
|
|
15
15
|
|
|
16
|
-
$icon_name = isset($attributes['iconName']) ? sanitize_text_field($attributes['iconName']) : '';
|
|
16
|
+
$icon_name = isset($attributes['iconName']) ? sanitize_text_field($attributes['iconName']) : 'filled_check';
|
|
17
17
|
$icon_size = isset($attributes['iconSize']) ? sanitize_text_field($attributes['iconSize']) : 'medium';
|
|
18
18
|
$round = isset($attributes['round']) ? (bool) $attributes['round'] : false;
|
|
19
19
|
$isLoading = isset($attributes['isLoading']) ? (bool) $attributes['isLoading'] : false;
|
|
@@ -31,8 +31,9 @@ foreach ($sanitized_data_attributes as $attr_name => $attr_value) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
$classes = ['tds-icon-button'];
|
|
34
|
+
$classes[] = 'tds-icon-button--size-' . $icon_size;
|
|
34
35
|
if ($round) {
|
|
35
|
-
$classes[] = 'tds-icon-button--
|
|
36
|
+
$classes[] = 'tds-icon-button--is-rounded';
|
|
36
37
|
}
|
|
37
38
|
if ($isLoading) {
|
|
38
39
|
$classes[] = 'tds-icon-button--loading';
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
.tds-icon-button--size-small,
|
|
6
6
|
.tds-icon-button--size-medium,
|
|
7
|
-
.tds-icon-button--size-large
|
|
7
|
+
.tds-icon-button--size-large,
|
|
8
|
+
.tds-icon-button--size-xlarge {
|
|
8
9
|
padding: 0;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
.tds-icon-button--size-small {
|
|
12
|
-
width:
|
|
13
|
-
height:
|
|
13
|
+
width: 40px;
|
|
14
|
+
height: 40px;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.tds-icon-button--size-medium {
|
|
@@ -19,16 +20,16 @@
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
.tds-icon-button--size-large {
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
23
|
+
width: 56px;
|
|
24
|
+
height: 56px;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.tds-icon-button--size-xlarge {
|
|
27
|
-
width:
|
|
28
|
-
height:
|
|
28
|
+
width: 64px;
|
|
29
|
+
height: 64px;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
.tds-icon-button--
|
|
32
|
+
.tds-icon-button--is-rounded.tds-button {
|
|
32
33
|
border-radius: 9999px;
|
|
33
34
|
}
|
|
34
35
|
|