@times-design-system/components-wordpress 1.2.2-alpha.0 → 1.2.2-alpha.10
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/BLOCK_CREATION_CHECKLIST.md +132 -19
- package/README.md +10 -4
- package/SCSS_VARIABLES_REFERENCE.md +316 -0
- package/STYLING_SYNC_GUIDE.md +306 -0
- package/TRANSFORMATION_GUIDE.md +286 -13
- package/dist/blocks/ad-container/block.json +1 -0
- package/dist/blocks/ad-container/render.php +27 -0
- package/dist/blocks/ad-container/style.css +23 -20
- package/dist/blocks/button/block.json +1 -0
- package/dist/blocks/button/render.php +71 -0
- package/dist/blocks/button/style-resolved.css +153 -0
- package/dist/blocks/button/style.css +138 -18
- package/dist/blocks/chip/block.json +1 -0
- package/dist/blocks/chip/render.php +40 -0
- package/dist/blocks/chip/style.css +68 -29
- package/dist/blocks/divider/block.json +1 -0
- package/dist/blocks/divider/render.php +31 -0
- package/dist/blocks/divider/style.css +25 -13
- package/dist/blocks/flag/block.json +1 -0
- package/dist/blocks/flag/render.php +34 -0
- package/dist/blocks/flag/style.css +39 -30
- package/dist/blocks/icon-button/block.json +1 -0
- package/dist/blocks/icon-button/render.php +46 -0
- package/dist/blocks/icon-button/style.css +21 -22
- package/dist/blocks/input/block.json +1 -0
- package/dist/blocks/input/render.php +39 -0
- package/dist/blocks/input/style.css +40 -17
- package/dist/blocks/link/block.json +1 -0
- package/dist/blocks/link/render.php +44 -0
- package/dist/blocks/link/style.css +87 -34
- package/dist/blocks/text/block.json +1 -0
- package/dist/blocks/text/render.php +26 -0
- package/dist/blocks/text/style.css +5 -18
- package/dist/blocks/toast/block.json +1 -0
- package/dist/blocks/toast/render.php +37 -0
- package/dist/blocks/toast/style.css +50 -34
- package/dist/index.cjs +20 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/blocks/ad-container/block.json +1 -0
- package/src/blocks/ad-container/render.php +27 -0
- package/src/blocks/ad-container/style.css +23 -20
- package/src/blocks/button/block.json +1 -0
- package/src/blocks/button/render.php +71 -0
- package/src/blocks/button/style-resolved.css +153 -0
- package/src/blocks/button/style.css +138 -18
- package/src/blocks/chip/block.json +1 -0
- package/src/blocks/chip/render.php +40 -0
- package/src/blocks/chip/style.css +68 -29
- package/src/blocks/divider/block.json +1 -0
- package/src/blocks/divider/render.php +31 -0
- package/src/blocks/divider/style.css +25 -13
- package/src/blocks/flag/block.json +1 -0
- package/src/blocks/flag/render.php +34 -0
- package/src/blocks/flag/style.css +39 -30
- package/src/blocks/icon-button/block.json +1 -0
- package/src/blocks/icon-button/render.php +46 -0
- package/src/blocks/icon-button/style.css +21 -22
- package/src/blocks/input/block.json +1 -0
- package/src/blocks/input/render.php +39 -0
- package/src/blocks/input/style.css +40 -17
- package/src/blocks/link/block.json +1 -0
- package/src/blocks/link/render.php +44 -0
- package/src/blocks/link/style.css +87 -34
- package/src/blocks/text/block.json +1 -0
- package/src/blocks/text/render.php +26 -0
- package/src/blocks/text/style.css +5 -18
- package/src/blocks/toast/block.json +1 -0
- package/src/blocks/toast/render.php +37 -0
- package/src/blocks/toast/style.css +50 -34
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
/* Divider Block Styles */
|
|
1
|
+
/* Divider Block Frontend Styles */
|
|
2
|
+
/* Using resolved design token values for self-contained styling */
|
|
3
|
+
|
|
2
4
|
.tds-divider {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
box-sizing: content-box;
|
|
6
|
+
border: 0;
|
|
7
|
+
border-top: 1px;
|
|
8
|
+
border-style: solid;
|
|
9
|
+
border-color: #999999;
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
height: 0;
|
|
12
|
+
width: 100%;
|
|
6
13
|
}
|
|
7
14
|
|
|
8
|
-
.tds-divider--dashed {
|
|
9
|
-
border-
|
|
10
|
-
background-color: transparent;
|
|
15
|
+
.tds-divider.tds-divider--dashed {
|
|
16
|
+
border-style: dashed;
|
|
11
17
|
}
|
|
12
18
|
|
|
19
|
+
/* Vertical */
|
|
13
20
|
.tds-divider--vertical {
|
|
14
|
-
width:
|
|
15
|
-
height:
|
|
16
|
-
|
|
21
|
+
width: 0;
|
|
22
|
+
height: 100%;
|
|
23
|
+
align-self: stretch;
|
|
24
|
+
border-top: none;
|
|
25
|
+
border-left: 1px;
|
|
26
|
+
border-style: solid;
|
|
17
27
|
}
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
/* Padding — gutter spacing around the line */
|
|
30
|
+
.tds-divider--horizontal.tds-divider--padding {
|
|
31
|
+
margin-block: 24px;
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
.tds-divider--vertical.tds-divider--padding {
|
|
24
|
-
margin:
|
|
35
|
+
margin-inline: 24px;
|
|
36
|
+
margin-block: 0;
|
|
25
37
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Flag Block Render Callback
|
|
4
|
+
*
|
|
5
|
+
* Renders the Flag block on the frontend.
|
|
6
|
+
*
|
|
7
|
+
* @package TimesDesignSystem\ComponentsWordPress
|
|
8
|
+
* @var array $attributes Block attributes
|
|
9
|
+
* @var string $content Block content
|
|
10
|
+
* @var WP_Block $block Block instance
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
$label = isset($attributes['label']) ? sanitize_text_field($attributes['label']) : '';
|
|
14
|
+
$content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
|
|
15
|
+
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
|
|
16
|
+
$size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
|
|
17
|
+
$aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
|
|
18
|
+
|
|
19
|
+
$classes = ['tds-flag'];
|
|
20
|
+
$classes[] = 'tds-flag--intent-' . $intent;
|
|
21
|
+
$classes[] = 'tds-flag--size-' . $size;
|
|
22
|
+
|
|
23
|
+
$wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)]);
|
|
24
|
+
?>
|
|
25
|
+
|
|
26
|
+
<div
|
|
27
|
+
<?php echo wp_kses_post($wrapper_attrs); ?>
|
|
28
|
+
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
29
|
+
>
|
|
30
|
+
<?php if ($label) : ?>
|
|
31
|
+
<div class="tds-flag__label"><?php echo wp_kses_post($label); ?></div>
|
|
32
|
+
<?php endif; ?>
|
|
33
|
+
<div class="tds-flag__content"><?php echo wp_kses_post($content_text); ?></div>
|
|
34
|
+
</div>
|
|
@@ -1,45 +1,54 @@
|
|
|
1
|
-
/* Flag Block Styles */
|
|
1
|
+
/* Flag Block Frontend Styles */
|
|
2
|
+
/* Using resolved design token values for self-contained styling */
|
|
3
|
+
|
|
2
4
|
.tds-flag {
|
|
5
|
+
--tds-flag-bg: #000000;
|
|
6
|
+
--tds-flag-fg: #f2f2f2;
|
|
7
|
+
--tds-flag-icon: var(--flag-fg);
|
|
8
|
+
--tds-flag-border: transparent;
|
|
9
|
+
|
|
3
10
|
display: inline-flex;
|
|
4
11
|
align-items: center;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
justify-content: center;
|
|
13
|
+
gap: 4px;
|
|
14
|
+
min-height: 19px;
|
|
15
|
+
min-width: 42px;
|
|
16
|
+
padding: 0 2px;
|
|
17
|
+
border-radius: 2px;
|
|
18
|
+
border: 1px solid var(--tds-flag-border);
|
|
19
|
+
background-color: var(--tds-flag-bg);
|
|
20
|
+
color: var(--tds-flag-fg);
|
|
21
|
+
font-family: Roboto;
|
|
22
|
+
font-size: 1.4rem;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
line-height: 1.125;
|
|
25
|
+
text-transform: uppercase;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
box-sizing: border-box;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
.tds-flag--
|
|
24
|
-
|
|
25
|
-
color: var(--color-text-on-positive);
|
|
30
|
+
.tds-flag--size-small {
|
|
31
|
+
font-size: 1.2rem;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
.tds-flag--
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
.tds-flag--intent-secondary {
|
|
35
|
+
--tds-flag-bg: transparent;
|
|
36
|
+
--tds-flag-fg: #1a1a1a;
|
|
37
|
+
--tds-flag-icon: var(--tds-flag-fg);
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
.tds-flag--
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
.tds-flag--intent-callout {
|
|
41
|
+
--tds-flag-bg: #b20908;
|
|
42
|
+
--tds-flag-fg: #ffffff;
|
|
43
|
+
--tds-flag-icon: var(--tds-flag-fg);
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
.tds-flag__label {
|
|
39
|
-
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
.tds-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
.tds-flag__content {
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
align-items: center;
|
|
45
54
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Icon Button Block Render Callback
|
|
4
|
+
*
|
|
5
|
+
* Renders the Icon Button block on the frontend.
|
|
6
|
+
*
|
|
7
|
+
* @package TimesDesignSystem\ComponentsWordPress
|
|
8
|
+
* @var array $attributes Block attributes
|
|
9
|
+
* @var string $content Block content
|
|
10
|
+
* @var WP_Block $block Block instance
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
$icon_name = isset($attributes['iconName']) ? sanitize_text_field($attributes['iconName']) : '';
|
|
14
|
+
$round = isset($attributes['round']) ? (bool) $attributes['round'] : false;
|
|
15
|
+
$href = isset($attributes['href']) ? esc_url($attributes['href']) : '';
|
|
16
|
+
$target = isset($attributes['target']) ? sanitize_text_field($attributes['target']) : '';
|
|
17
|
+
$rel = isset($attributes['rel']) ? sanitize_text_field($attributes['rel']) : '';
|
|
18
|
+
$aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
|
|
19
|
+
|
|
20
|
+
$classes = ['tds-icon-button'];
|
|
21
|
+
if ($round) {
|
|
22
|
+
$classes[] = 'tds-icon-button--round';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
$element_tag = $href ? 'a' : 'button';
|
|
26
|
+
$wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)]);
|
|
27
|
+
?>
|
|
28
|
+
|
|
29
|
+
<?php if ($element_tag === 'a') : ?>
|
|
30
|
+
<a
|
|
31
|
+
<?php echo wp_kses_post($wrapper_attrs); ?>
|
|
32
|
+
href="<?php echo esc_attr($href); ?>"
|
|
33
|
+
<?php echo $target ? 'target="' . esc_attr($target) . '"' : ''; ?>
|
|
34
|
+
<?php echo $rel ? 'rel="' . esc_attr($rel) . '"' : ''; ?>
|
|
35
|
+
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
36
|
+
>
|
|
37
|
+
<span class="tds-icon-button__icon"><?php echo wp_kses_post($icon_name); ?></span>
|
|
38
|
+
</a>
|
|
39
|
+
<?php else : ?>
|
|
40
|
+
<button
|
|
41
|
+
<?php echo wp_kses_post($wrapper_attrs); ?>
|
|
42
|
+
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
43
|
+
>
|
|
44
|
+
<span class="tds-icon-button__icon"><?php echo wp_kses_post($icon_name); ?></span>
|
|
45
|
+
</button>
|
|
46
|
+
<?php endif; ?>
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
/* Icon Button Styles */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
width:
|
|
7
|
-
height:
|
|
8
|
-
|
|
9
|
-
border-radius: var(--border-radius-s);
|
|
10
|
-
background-color: var(--color-fill-secondary);
|
|
11
|
-
color: var(--color-text-primary);
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
transition: all 0.2s ease-in-out;
|
|
14
|
-
text-decoration: none;
|
|
1
|
+
/* Icon Button Block Frontend Styles */
|
|
2
|
+
/* Using resolved design token values for self-contained styling */
|
|
3
|
+
/* Icon buttons inherit base button styles for colors, intents, etc. */
|
|
4
|
+
|
|
5
|
+
.tds-icon-button--size-small {
|
|
6
|
+
width: 32px;
|
|
7
|
+
height: 32px;
|
|
8
|
+
padding: 6px;
|
|
15
9
|
}
|
|
16
10
|
|
|
17
|
-
.tds-icon-button
|
|
18
|
-
|
|
11
|
+
.tds-icon-button--size-medium {
|
|
12
|
+
width: 48px;
|
|
13
|
+
height: 48px;
|
|
14
|
+
padding: 12px;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
|
-
.tds-icon-button
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
.tds-icon-button--size-large {
|
|
18
|
+
width: 64px;
|
|
19
|
+
height: 64px;
|
|
20
|
+
padding: 16px;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
.tds-icon-button--round {
|
|
27
|
-
border-radius:
|
|
23
|
+
.tds-icon-button--round.tds-button {
|
|
24
|
+
border-radius: 9999px;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
.tds-icon-button__icon {
|
|
31
|
-
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
32
31
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Input Block Render Callback
|
|
4
|
+
*
|
|
5
|
+
* Renders the Input block on the frontend.
|
|
6
|
+
*
|
|
7
|
+
* @package TimesDesignSystem\ComponentsWordPress
|
|
8
|
+
* @var array $attributes Block attributes
|
|
9
|
+
* @var string $content Block content
|
|
10
|
+
* @var WP_Block $block Block instance
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
$label = isset($attributes['label']) ? sanitize_text_field($attributes['label']) : '';
|
|
14
|
+
$placeholder = isset($attributes['placeholder']) ? sanitize_text_field($attributes['placeholder']) : '';
|
|
15
|
+
$type = isset($attributes['type']) ? sanitize_text_field($attributes['type']) : 'text';
|
|
16
|
+
$disabled = isset($attributes['disabled']) ? (bool) $attributes['disabled'] : false;
|
|
17
|
+
$required = isset($attributes['required']) ? (bool) $attributes['required'] : false;
|
|
18
|
+
$name = isset($attributes['name']) ? sanitize_text_field($attributes['name']) : '';
|
|
19
|
+
$id = isset($attributes['id']) ? sanitize_text_field($attributes['id']) : '';
|
|
20
|
+
|
|
21
|
+
$wrapper_attrs = get_block_wrapper_attributes();
|
|
22
|
+
?>
|
|
23
|
+
|
|
24
|
+
<div <?php echo wp_kses_post($wrapper_attrs); ?>>
|
|
25
|
+
<?php if ($label) : ?>
|
|
26
|
+
<label for="<?php echo esc_attr($id); ?>" class="tds-input__label">
|
|
27
|
+
<?php echo wp_kses_post($label); ?>
|
|
28
|
+
</label>
|
|
29
|
+
<?php endif; ?>
|
|
30
|
+
<input
|
|
31
|
+
type="<?php echo esc_attr($type); ?>"
|
|
32
|
+
<?php echo $placeholder ? 'placeholder="' . esc_attr($placeholder) . '"' : ''; ?>
|
|
33
|
+
<?php echo $disabled ? 'disabled' : ''; ?>
|
|
34
|
+
<?php echo $required ? 'required' : ''; ?>
|
|
35
|
+
<?php echo $name ? 'name="' . esc_attr($name) . '"' : ''; ?>
|
|
36
|
+
<?php echo $id ? 'id="' . esc_attr($id) . '"' : ''; ?>
|
|
37
|
+
class="tds-input"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
@@ -1,30 +1,53 @@
|
|
|
1
|
-
/* Input Block Styles */
|
|
1
|
+
/* Input Block Frontend Styles */
|
|
2
|
+
/* Using resolved design token values for self-contained styling */
|
|
3
|
+
|
|
4
|
+
.tds-input-wrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Label styles */
|
|
11
|
+
.tds-input__label {
|
|
12
|
+
color: #1a1a1a;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 4px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Input field styles */
|
|
2
19
|
.tds-input {
|
|
3
|
-
display: block;
|
|
4
20
|
width: 100%;
|
|
5
|
-
padding:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
21
|
+
padding: 8px 12px;
|
|
22
|
+
color: #1a1a1a;
|
|
23
|
+
background-color: #ffffff;
|
|
24
|
+
border: 1px solid #999999;
|
|
25
|
+
border-radius: 0;
|
|
26
|
+
transition: all 0.2s ease-in-out;
|
|
27
|
+
box-sizing: border-box;
|
|
11
28
|
}
|
|
12
29
|
|
|
30
|
+
/* Input focus state */
|
|
13
31
|
.tds-input:focus {
|
|
14
32
|
outline: none;
|
|
15
|
-
border-color:
|
|
16
|
-
box-shadow: 0 0 0 2px
|
|
33
|
+
border-color: #0f4aa2;
|
|
34
|
+
box-shadow: 0 0 0 2px rgba(15, 74, 162, 0.1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Input hover state */
|
|
38
|
+
.tds-input:hover:not(:disabled) {
|
|
39
|
+
border-color: #0f4aa2;
|
|
17
40
|
}
|
|
18
41
|
|
|
42
|
+
/* Input disabled state */
|
|
19
43
|
.tds-input:disabled {
|
|
20
|
-
background-color:
|
|
21
|
-
color:
|
|
44
|
+
background-color: #f2f2f2;
|
|
45
|
+
color: #999999;
|
|
46
|
+
border-color: #cccccc;
|
|
22
47
|
cursor: not-allowed;
|
|
23
48
|
}
|
|
24
49
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
font-weight: 600;
|
|
29
|
-
color: var(--color-text-primary);
|
|
50
|
+
/* Input placeholder */
|
|
51
|
+
.tds-input::placeholder {
|
|
52
|
+
color: #666666;
|
|
30
53
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Link Block Render Callback
|
|
4
|
+
*
|
|
5
|
+
* Renders the Link block on the frontend.
|
|
6
|
+
*
|
|
7
|
+
* @package TimesDesignSystem\ComponentsWordPress
|
|
8
|
+
* @var array $attributes Block attributes
|
|
9
|
+
* @var string $content Block content
|
|
10
|
+
* @var WP_Block $block Block instance
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
$href = isset($attributes['href']) ? esc_url($attributes['href']) : '';
|
|
14
|
+
$content_text = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
|
|
15
|
+
$intent = isset($attributes['intent']) ? sanitize_text_field($attributes['intent']) : '';
|
|
16
|
+
$sentiment = isset($attributes['sentiment']) ? sanitize_text_field($attributes['sentiment']) : '';
|
|
17
|
+
$size = isset($attributes['size']) ? sanitize_text_field($attributes['size']) : '';
|
|
18
|
+
$state = isset($attributes['state']) ? sanitize_text_field($attributes['state']) : '';
|
|
19
|
+
$inline = isset($attributes['inline']) ? (bool) $attributes['inline'] : true;
|
|
20
|
+
$aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
|
|
21
|
+
$target = isset($attributes['target']) ? sanitize_text_field($attributes['target']) : '_self';
|
|
22
|
+
$rel = isset($attributes['rel']) ? sanitize_text_field($attributes['rel']) : '';
|
|
23
|
+
|
|
24
|
+
$classes = ['tds-link'];
|
|
25
|
+
$classes[] = 'tds-link--intent-' . $intent;
|
|
26
|
+
$classes[] = 'tds-link--sentiment-' . $sentiment;
|
|
27
|
+
$classes[] = 'tds-link--size-' . $size;
|
|
28
|
+
$classes[] = 'tds-link--state-' . $state;
|
|
29
|
+
if (!$inline) {
|
|
30
|
+
$classes[] = 'tds-link--block';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
$wrapper_attrs = get_block_wrapper_attributes(['class' => implode(' ', $classes)]);
|
|
34
|
+
?>
|
|
35
|
+
|
|
36
|
+
<a
|
|
37
|
+
<?php echo wp_kses_post($wrapper_attrs); ?>
|
|
38
|
+
href="<?php echo esc_attr($href); ?>"
|
|
39
|
+
<?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
|
|
40
|
+
<?php echo ($target !== '_self') ? 'target="' . esc_attr($target) . '"' : ''; ?>
|
|
41
|
+
<?php echo $rel ? 'rel="' . esc_attr($rel) . '"' : ''; ?>
|
|
42
|
+
>
|
|
43
|
+
<span class="tds-link__content"><?php echo wp_kses_post($content_text); ?></span>
|
|
44
|
+
</a>
|
|
@@ -1,66 +1,119 @@
|
|
|
1
|
-
/* Link Block Styles */
|
|
1
|
+
/* Link Block Frontend Styles */
|
|
2
|
+
/* These styles mirror the React Link component styles */
|
|
3
|
+
|
|
2
4
|
.tds-link {
|
|
5
|
+
--tds-link-color-default: #286c96;
|
|
6
|
+
--tds-link-color-hover: #286c96;
|
|
7
|
+
--tds-link-color-pressed: #286c96;
|
|
8
|
+
--tds-link-color-visited: #286c96;
|
|
9
|
+
--tds-link-color-disabled: #bfbfbf;
|
|
10
|
+
--tds-link-underline-default: #286c96;
|
|
11
|
+
--tds-link-underline-hover: #286c96;
|
|
12
|
+
--tds-link-underline-pressed: #286c96;
|
|
13
|
+
--tds-link-underline-visited: #286c96;
|
|
14
|
+
--tds-link-focus-ring: #737373;
|
|
15
|
+
--tds-link-icon-size: 20px;
|
|
16
|
+
|
|
17
|
+
position: relative;
|
|
3
18
|
display: inline-flex;
|
|
4
19
|
align-items: center;
|
|
5
|
-
gap:
|
|
6
|
-
|
|
20
|
+
gap: 4px;
|
|
21
|
+
color: var(--tds-link-color-default);
|
|
7
22
|
cursor: pointer;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
font-family: Roboto;
|
|
24
|
+
font-size: 1.6rem;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
line-height: 1.5;
|
|
27
|
+
text-decoration: underline;
|
|
28
|
+
text-decoration-color: var(--tds-link-underline-default);
|
|
29
|
+
text-decoration-skip-ink: auto;
|
|
30
|
+
text-underline-offset: 4px;
|
|
31
|
+
text-decoration-thickness: 2px;
|
|
32
|
+
transition: color 0.36s cubic-bezier(0.22, 1, 0.36, 1), text-decoration-color 0.36s cubic-bezier(0.22, 1, 0.36, 1), text-decoration-thickness 0.36s cubic-bezier(0.22, 1, 0.36, 1);
|
|
13
33
|
}
|
|
14
34
|
|
|
15
35
|
.tds-link--intent-secondary {
|
|
16
|
-
color: var(--
|
|
36
|
+
--tds-link-color-default: var(--interactive-link-secondary-text-default, #1a191a);
|
|
37
|
+
--tds-link-color-hover: var(--interactive-link-secondary-text-hover, #1a191a);
|
|
38
|
+
--tds-link-color-pressed: var(--interactive-link-secondary-text-pressed, #1a191a);
|
|
39
|
+
--tds-link-color-visited: var(--interactive-link-secondary-text-visited, var(--interactive-link-secondary-text-default, #1a191a));
|
|
40
|
+
--tds-link-underline-default: var(--interactive-link-secondary-underline-default, var(--tds-link-color-default));
|
|
41
|
+
--tds-link-underline-hover: var(--interactive-link-secondary-underline-hover, var(--tds-link-color-hover));
|
|
42
|
+
--tds-link-underline-pressed: var(--interactive-link-secondary-underline-pressed, var(--tds-link-color-pressed));
|
|
43
|
+
--tds-link-underline-visited: var(--interactive-link-secondary-underline-visited, var(--tds-link-color-visited));
|
|
17
44
|
}
|
|
18
45
|
|
|
19
|
-
.tds-link--
|
|
20
|
-
|
|
46
|
+
.tds-link--sentiment-brand {
|
|
47
|
+
font-family: var(--fontFamily020);
|
|
21
48
|
}
|
|
22
49
|
|
|
23
|
-
.tds-link--sentiment-
|
|
24
|
-
font-
|
|
50
|
+
.tds-link--sentiment-utility {
|
|
51
|
+
font-family: var(--fontFamily040);
|
|
52
|
+
font-weight: var(--fontWeight070);
|
|
25
53
|
}
|
|
26
54
|
|
|
27
|
-
.tds-link--
|
|
28
|
-
font-
|
|
29
|
-
|
|
55
|
+
.tds-link--size-xsmall {
|
|
56
|
+
font-size: 1.2rem;
|
|
57
|
+
gap: 4px;
|
|
58
|
+
--tds-link-icon-size: 16px;
|
|
30
59
|
}
|
|
31
60
|
|
|
32
61
|
.tds-link--size-small {
|
|
33
|
-
font-size:
|
|
62
|
+
font-size: 1.4rem;
|
|
63
|
+
gap: 4px;
|
|
64
|
+
--tds-link-icon-size: 16px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.tds-link--size-medium {
|
|
68
|
+
font-size: 1.6rem;
|
|
69
|
+
gap: 6px;
|
|
70
|
+
--tds-link-icon-size: 20px;
|
|
34
71
|
}
|
|
35
72
|
|
|
36
73
|
.tds-link--size-large {
|
|
37
|
-
font-size:
|
|
74
|
+
font-size: 1.8rem;
|
|
75
|
+
gap: 8px;
|
|
76
|
+
--tds-link-icon-size: 24px;
|
|
38
77
|
}
|
|
39
78
|
|
|
40
|
-
.tds-
|
|
41
|
-
|
|
79
|
+
.tds-link__content {
|
|
80
|
+
white-space: nowrap;
|
|
42
81
|
}
|
|
43
82
|
|
|
44
|
-
.tds-link--
|
|
45
|
-
color: var(--
|
|
83
|
+
.tds-link:hover:not(.tds-link--is-disabled) {
|
|
84
|
+
color: var(--tds-link-color-hover);
|
|
85
|
+
text-decoration-color: var(--tds-link-underline-hover);
|
|
86
|
+
text-decoration-thickness: var(--spacing-02);
|
|
46
87
|
}
|
|
47
88
|
|
|
48
|
-
.tds-link--
|
|
49
|
-
|
|
50
|
-
|
|
89
|
+
.tds-link:active:not(.tds-link--is-disabled) {
|
|
90
|
+
color: var(--tds-link-color-pressed);
|
|
91
|
+
text-decoration-color: var(--tds-link-underline-pressed);
|
|
51
92
|
}
|
|
52
93
|
|
|
53
|
-
.tds-link--
|
|
54
|
-
|
|
55
|
-
|
|
94
|
+
.tds-link:visited:not(.tds-link--is-disabled) {
|
|
95
|
+
color: var(--tds-link-color-visited);
|
|
96
|
+
text-decoration-color: var(--tds-link-underline-visited);
|
|
56
97
|
}
|
|
57
98
|
|
|
58
|
-
.tds-link--
|
|
59
|
-
|
|
60
|
-
|
|
99
|
+
.tds-link:focus-visible:not(.tds-link--is-disabled) {
|
|
100
|
+
outline: none;
|
|
101
|
+
color: var(--tds-link-color-default);
|
|
102
|
+
text-decoration-color: var(--tds-link-underline-default);
|
|
61
103
|
}
|
|
62
104
|
|
|
63
|
-
.tds-
|
|
64
|
-
|
|
65
|
-
|
|
105
|
+
.tds-link:focus-visible:not(.tds-link--is-disabled)::after {
|
|
106
|
+
content: '';
|
|
107
|
+
position: absolute;
|
|
108
|
+
inset: -4px;
|
|
109
|
+
border: 2px solid #737373;
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.tds-link.tds-link--is-disabled,
|
|
114
|
+
.tds-link[aria-disabled='true'] {
|
|
115
|
+
color: var(--tds-link-color-disabled);
|
|
116
|
+
text-decoration-color: var(--tds-link-color-disabled);
|
|
117
|
+
cursor: not-allowed;
|
|
118
|
+
pointer-events: none;
|
|
66
119
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Text Block Render Callback
|
|
4
|
+
*
|
|
5
|
+
* Renders the Text typography block on the frontend.
|
|
6
|
+
*
|
|
7
|
+
* @package TimesDesignSystem\ComponentsWordPress
|
|
8
|
+
* @var array $attributes Block attributes
|
|
9
|
+
* @var string $content Block content
|
|
10
|
+
* @var WP_Block $block Block instance
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
$as = isset($attributes['as']) ? sanitize_text_field($attributes['as']) : 'p';
|
|
14
|
+
$typography_style = isset($attributes['typographyStyle']) ? sanitize_text_field($attributes['typographyStyle']) : '';
|
|
15
|
+
$text_content = isset($attributes['content']) ? wp_kses_post($attributes['content']) : '';
|
|
16
|
+
|
|
17
|
+
$tag_name = in_array($as, ['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5'], true) ? $as : 'p';
|
|
18
|
+
$class_name = 'tds-text';
|
|
19
|
+
if ($typography_style) {
|
|
20
|
+
$class_name .= ' tds-text--' . sanitize_html_class($typography_style);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
$wrapper_attrs = get_block_wrapper_attributes(['class' => $class_name]);
|
|
24
|
+
?>
|
|
25
|
+
|
|
26
|
+
<?php echo wp_sprintf('<%s %s>%s</%s>', $tag_name, wp_kses_post($wrapper_attrs), wp_kses_post($text_content), $tag_name); ?>
|