@times-design-system/components-wordpress 1.9.0 → 1.11.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/blocks/ad-container/block.json +1 -0
- package/dist/blocks/ad-container/style.css +1 -30
- package/dist/blocks/ad-container/style.scss +70 -0
- package/dist/blocks/button/block.json +68 -1
- package/dist/blocks/button/init.js +45 -0
- package/dist/blocks/button/render.php +2 -0
- package/dist/blocks/button/style.css +1 -203
- package/dist/blocks/button/style.scss +204 -0
- package/dist/blocks/chip/ONCLICK_USAGE.md +263 -0
- package/dist/blocks/chip/block.json +23 -3
- package/dist/blocks/chip/init.js +60 -0
- package/dist/blocks/chip/render.php +7 -2
- package/dist/blocks/chip/style.css +1 -108
- package/dist/blocks/chip/style.scss +213 -0
- package/dist/blocks/dialog-box/block.json +1 -0
- package/dist/blocks/dialog-box/style.css +1 -23
- package/dist/blocks/dialog-box/style.scss +113 -0
- package/dist/blocks/divider/block.json +1 -0
- package/dist/blocks/divider/style.css +1 -37
- package/dist/blocks/divider/style.scss +40 -0
- package/dist/blocks/icon/block.json +11 -1
- package/dist/blocks/icon/style.css +1 -23
- package/dist/blocks/icon/style.scss +10 -0
- package/dist/blocks/icon-button/block.json +42 -0
- package/dist/blocks/icon-button/init.js +56 -0
- package/dist/blocks/icon-button/render.php +5 -0
- package/dist/blocks/icon-button/style.css +1 -66
- package/dist/blocks/icon-button/style.scss +189 -0
- package/dist/blocks/input/block.json +1 -0
- package/dist/blocks/input/style.css +1 -67
- package/dist/blocks/input/style.scss +72 -0
- package/dist/blocks/input-helper-message/block.json +1 -0
- package/dist/blocks/input-helper-message/style.css +1 -23
- package/dist/blocks/input-helper-message/style.scss +45 -0
- package/dist/blocks/link/block.json +87 -3
- package/dist/blocks/link/init.js +54 -0
- package/dist/blocks/link/render.php +22 -12
- package/dist/blocks/link/style.css +1 -221
- package/dist/blocks/link/style.scss +163 -0
- package/dist/blocks/tab/block.json +1 -0
- package/dist/blocks/tab/style.css +1 -152
- package/dist/blocks/tab/style.scss +159 -0
- package/dist/blocks/tab-group/block.json +1 -0
- package/dist/blocks/tab-group/style.css +1 -23
- package/dist/blocks/tab-group/style.scss +32 -0
- package/dist/blocks/{flag → tag}/block.json +47 -14
- package/dist/blocks/{flag → tag}/edit.js +9 -20
- package/dist/blocks/{flag → tag}/index.js +2 -2
- package/dist/blocks/{flag → tag}/render.php +24 -19
- package/dist/blocks/tag/save.js +23 -0
- package/dist/blocks/{chip → tag}/style-editor.css +2 -2
- package/dist/blocks/tag/style.css +1 -0
- package/dist/blocks/tag/style.scss +115 -0
- package/dist/blocks/text/block.json +1 -0
- package/dist/blocks/text/style.css +1 -7
- package/dist/blocks/text/style.scss +11 -0
- package/dist/blocks/toast/block.json +1 -0
- package/dist/blocks/toast/style.css +1 -68
- package/dist/blocks/toast/style.scss +67 -0
- package/dist/blocks/utils/render-icon.php +72 -5
- package/dist/icon-data.json +1 -1
- package/dist/index.cjs +421 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +421 -54
- package/dist/index.js.map +1 -1
- package/dist/plugin.php +42 -0
- package/dist/utils/render-icon.php +11 -2
- package/package.json +6 -4
- package/plugin.php +42 -0
- package/dist/blocks/flag/save.js +0 -25
- package/dist/blocks/flag/style-editor.css +0 -5
- package/dist/blocks/flag/style.css +0 -72
|
@@ -1,68 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/* Using design tokens for self-contained styling */
|
|
3
|
-
|
|
4
|
-
.tds-toast {
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: var(--spacing-07);
|
|
8
|
-
width: 373px;
|
|
9
|
-
min-height: var(--spacing-18);
|
|
10
|
-
padding: var(--spacing-07) var(--spacing-09);
|
|
11
|
-
border-radius: 4px;
|
|
12
|
-
background: var(--tds-toast-fill);
|
|
13
|
-
color: var(--tds-toast-text);
|
|
14
|
-
box-shadow: 0 16px 24px 0 rgb(0 0 0 / 8%);
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.tds-toast__icon {
|
|
19
|
-
display: inline-flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
flex: 0 0 auto;
|
|
23
|
-
color: var(--tds-toast-text);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.tds-toast__label {
|
|
27
|
-
flex: 1 1 auto;
|
|
28
|
-
min-width: 0;
|
|
29
|
-
font-family: var(--fontFamily040, sans-serif);
|
|
30
|
-
font-size: var(--fontSize030, 1rem);
|
|
31
|
-
line-height: var(--fontLineHeight040, 1.5);
|
|
32
|
-
font-weight: var(--fontWeight040, 400);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.tds-toast__link {
|
|
36
|
-
flex: 0 0 auto;
|
|
37
|
-
font-family: var(--fontFamily040, sans-serif);
|
|
38
|
-
font-size: var(--fontSize030, 1rem);
|
|
39
|
-
line-height: var(--fontLineHeight040, 1.5);
|
|
40
|
-
font-weight: var(--fontWeight070, 700);
|
|
41
|
-
text-decoration: underline;
|
|
42
|
-
color: var(--tds-toast-link);
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.tds-toast--intent-success {
|
|
47
|
-
--tds-toast-fill: var(--toast-fill-success, #22724f);
|
|
48
|
-
--tds-toast-text: var(--toast-text-success, #ffffff);
|
|
49
|
-
--tds-toast-link: var(--toast-link-success-default, #ffffff);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.tds-toast--intent-info {
|
|
53
|
-
--tds-toast-fill: var(--toast-fill-info, #0a3472);
|
|
54
|
-
--tds-toast-text: var(--toast-text-info, #ffffff);
|
|
55
|
-
--tds-toast-link: var(--toast-link-info-default, #ffffff);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.tds-toast--intent-warning {
|
|
59
|
-
--tds-toast-fill: var(--toast-fill-warning, #e49307);
|
|
60
|
-
--tds-toast-text: var(--toast-text-warning, #000000);
|
|
61
|
-
--tds-toast-link: var(--toast-link-warning-default, #000000);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.tds-toast--intent-error {
|
|
65
|
-
--tds-toast-fill: var(--toast-fill-error, #cb0705);
|
|
66
|
-
--tds-toast-text: var(--toast-text-error, #ffffff);
|
|
67
|
-
--tds-toast-link: var(--toast-link-error-default, #ffffff);
|
|
68
|
-
}
|
|
1
|
+
.tds-grid{display:grid;grid-template-columns:repeat(4, 1fr);grid-gap:24px;margin-inline:20px;max-width:100%}@media(min-width: 720px){.tds-grid{grid-template-columns:repeat(12, 1fr);grid-gap:32px;margin-inline:24px;max-width:720px}}@media(min-width: 976px){.tds-grid{max-width:976px}}@media(min-width: 1096px){.tds-grid{max-width:1096px}}.tds-grid.tds-grid--full-width{max-width:100%}:root{--font-size0025: 0.5rem;--font-size005: 0.625rem;--font-size010: 0.75rem;--font-size020: 0.875rem;--font-size025: 0.9375rem;--font-size030: 1rem;--font-size035: 1.0625rem;--font-size040: 1.125rem;--font-size045: 1.1875rem;--font-size050: 1.25rem;--font-size060: 1.375rem;--font-size070: 1.5rem;--font-size080: 1.75rem;--font-size090: 2rem;--font-size095: 2.125rem;--font-size100: 2.25rem;--font-size105: 2.875rem;--font-size110: 2rem;--font-size120: 2.75rem;--font-size125: 2.8125rem;--font-size130: 3rem;--font-size140: 2.5rem;--font-size150: 4rem;--font-size155: 4.375rem;--font-size160: 5rem}@media(min-width: 440px){:root{--font-size090: 3rem;--font-size100: 2.5rem}}@media(min-width: 1024px){:root{--font-size100: 2.875rem}}@media(min-width: 1440px){:root{--font-size090: 3.25rem;--font-size100: 3.5rem;--font-size110: 2.5rem;--font-size140: 3.5rem}}.tds-toast{display:inline-flex;align-items:center;gap:12px;width:373px;min-height:48px;padding:12px 16px;border-radius:4px;background:var(--tds-toast-fill);color:var(--tds-toast-text);box-shadow:0px 16px 24px 0px rgba(0, 0, 0, 0.08);box-sizing:border-box}.tds-toast__icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--tds-toast-text)}.tds-toast__label{flex:1 1 auto;min-width:0;font:400 var(--font-size030)/1.5 Times Roboto}.tds-toast__link{flex:0 0 auto;font:700 var(--font-size030)/1.5 Times Roboto;text-decoration:underline;color:var(--tds-toast-link);cursor:pointer}.tds-toast--intent-success{--tds-toast-fill: #298458;--tds-toast-text: #ffffff;--tds-toast-link: #ffffff}.tds-toast--intent-info{--tds-toast-fill: #0f4aa2;--tds-toast-text: #ffffff;--tds-toast-link: #ffffff}.tds-toast--intent-warning{--tds-toast-fill: #e49307;--tds-toast-text: #1a1a1a;--tds-toast-link: #1a1a1a}.tds-toast--intent-error{--tds-toast-fill: #b20908;--tds-toast-text: #ffffff;--tds-toast-link: #ffffff}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* Toast Block Frontend Styles */
|
|
2
|
+
/* Uses SCSS variables from @times-design-system/theme-scss */
|
|
3
|
+
/* Using design tokens for self-contained styling */
|
|
4
|
+
|
|
5
|
+
@import '@times-design-system/theme-scss/src/palettes/core-light.scss';
|
|
6
|
+
@import '@times-design-system/theme-scss/src/tds-layout.scss';
|
|
7
|
+
@import '@times-design-system/theme-scss/src/tds-typography.scss';
|
|
8
|
+
|
|
9
|
+
.tds-toast {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: $spacing-07;
|
|
13
|
+
width: 373px;
|
|
14
|
+
min-height: $spacing-18;
|
|
15
|
+
padding: $spacing-07 $spacing-09;
|
|
16
|
+
border-radius: $border-radius-100;
|
|
17
|
+
background: var(--tds-toast-fill);
|
|
18
|
+
color: var(--tds-toast-text);
|
|
19
|
+
box-shadow: #{$shadow-elevation-down-level-3};
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tds-toast__icon {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
flex: 0 0 auto;
|
|
28
|
+
color: var(--tds-toast-text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.tds-toast__label {
|
|
32
|
+
flex: 1 1 auto;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
@include utility-body-regular-medium;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.tds-toast__link {
|
|
38
|
+
flex: 0 0 auto;
|
|
39
|
+
@include utility-body-bold-medium;
|
|
40
|
+
text-decoration: underline;
|
|
41
|
+
color: var(--tds-toast-link);
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.tds-toast--intent-success {
|
|
46
|
+
--tds-toast-fill: #{$messaging-border-success};
|
|
47
|
+
--tds-toast-text: #{$surface-level-1};
|
|
48
|
+
--tds-toast-link: #{$surface-level-1};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.tds-toast--intent-info {
|
|
52
|
+
--tds-toast-fill: #{$messaging-border-info};
|
|
53
|
+
--tds-toast-text: #{$surface-level-1};
|
|
54
|
+
--tds-toast-link: #{$surface-level-1};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.tds-toast--intent-warning {
|
|
58
|
+
--tds-toast-fill: #{$messaging-border-warning};
|
|
59
|
+
--tds-toast-text: #{$text-primary};
|
|
60
|
+
--tds-toast-link: #{$text-primary};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tds-toast--intent-error {
|
|
64
|
+
--tds-toast-fill: #{$messaging-border-error};
|
|
65
|
+
--tds-toast-text: #{$surface-level-1};
|
|
66
|
+
--tds-toast-link: #{$surface-level-1};
|
|
67
|
+
}
|
|
@@ -7,12 +7,60 @@
|
|
|
7
7
|
* @package TimesDesignSystem\ComponentsWordPress
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
if (!function_exists('tds_resolve_icon_size')) {
|
|
11
|
+
/**
|
|
12
|
+
* Size map matching React Icon component
|
|
13
|
+
* Maps named sizes to pixel dimensions
|
|
14
|
+
*/
|
|
15
|
+
$icon_size_map = [
|
|
16
|
+
'2xsmall' => ['width' => 12, 'height' => 12],
|
|
17
|
+
'xsmall' => ['width' => 16, 'height' => 16],
|
|
18
|
+
'small' => ['width' => 20, 'height' => 20],
|
|
19
|
+
'medium' => ['width' => 24, 'height' => 24],
|
|
20
|
+
'large' => ['width' => 28, 'height' => 28],
|
|
21
|
+
'xlarge' => ['width' => 32, 'height' => 32],
|
|
22
|
+
'2xlarge' => ['width' => 40, 'height' => 40],
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Resolve size to width and height dimensions
|
|
27
|
+
*
|
|
28
|
+
* @param mixed $size Named size string ('small', 'medium', etc) or numeric pixel value
|
|
29
|
+
* @return array Array with 'width' and 'height' keys
|
|
30
|
+
*/
|
|
31
|
+
function tds_resolve_icon_size($size) {
|
|
32
|
+
$size_map = [
|
|
33
|
+
'2xsmall' => ['width' => 12, 'height' => 12],
|
|
34
|
+
'xsmall' => ['width' => 16, 'height' => 16],
|
|
35
|
+
'small' => ['width' => 20, 'height' => 20],
|
|
36
|
+
'medium' => ['width' => 24, 'height' => 24],
|
|
37
|
+
'large' => ['width' => 28, 'height' => 28],
|
|
38
|
+
'xlarge' => ['width' => 32, 'height' => 32],
|
|
39
|
+
'2xlarge' => ['width' => 40, 'height' => 40],
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
if (is_numeric($size)) {
|
|
43
|
+
// Numeric size: return as both width and height
|
|
44
|
+
$pixels = (int) $size;
|
|
45
|
+
return ['width' => $pixels, 'height' => $pixels];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Named size: look up in size map
|
|
49
|
+
if (isset($size_map[$size])) {
|
|
50
|
+
return $size_map[$size];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Default to medium if unrecognized
|
|
54
|
+
return $size_map['medium'];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
10
58
|
if (!function_exists('tds_render_icon')) {
|
|
11
59
|
/**
|
|
12
60
|
* Render an icon by name with size and variant support
|
|
13
61
|
*
|
|
14
62
|
* @param string $icon Icon identifier (e.g., 'filled_search', 'outline_close')
|
|
15
|
-
* @param
|
|
63
|
+
* @param mixed $size Icon size: named string ('small', 'medium', 'large') or numeric pixels
|
|
16
64
|
* @return string SVG markup for the icon
|
|
17
65
|
*/
|
|
18
66
|
function tds_render_icon($icon, $size = 'medium') {
|
|
@@ -22,17 +70,36 @@ if (!function_exists('tds_render_icon')) {
|
|
|
22
70
|
|
|
23
71
|
// Sanitize icon name
|
|
24
72
|
$icon = sanitize_text_field($icon);
|
|
25
|
-
|
|
73
|
+
|
|
74
|
+
// Resolve size to dimensions
|
|
75
|
+
$dimensions = tds_resolve_icon_size($size);
|
|
76
|
+
$width = $dimensions['width'];
|
|
77
|
+
$height = $dimensions['height'];
|
|
26
78
|
|
|
27
79
|
// Build SVG class list
|
|
28
|
-
$classes = ['tds-icon'
|
|
80
|
+
$classes = ['tds-icon'];
|
|
81
|
+
// Add size class if it's a named size
|
|
82
|
+
$size_map = [
|
|
83
|
+
'2xsmall' => true,
|
|
84
|
+
'xsmall' => true,
|
|
85
|
+
'small' => true,
|
|
86
|
+
'medium' => true,
|
|
87
|
+
'large' => true,
|
|
88
|
+
'xlarge' => true,
|
|
89
|
+
'2xlarge' => true,
|
|
90
|
+
];
|
|
91
|
+
if (is_string($size) && isset($size_map[$size])) {
|
|
92
|
+
$classes[] = 'tds-icon--' . sanitize_text_field($size);
|
|
93
|
+
}
|
|
29
94
|
|
|
30
|
-
// Return SVG
|
|
95
|
+
// Return SVG with width/height attributes
|
|
31
96
|
// In production, this would use an actual icon library
|
|
32
97
|
// For static preview purposes, return a simple SVG placeholder
|
|
33
98
|
return sprintf(
|
|
34
|
-
'<svg class="%s" aria-hidden="true"><use href="#icon-%s"></use></svg>',
|
|
99
|
+
'<svg class="%s" width="%d" height="%d" aria-hidden="true"><use href="#icon-%s"></use></svg>',
|
|
35
100
|
esc_attr(implode(' ', $classes)),
|
|
101
|
+
(int) $width,
|
|
102
|
+
(int) $height,
|
|
36
103
|
esc_attr($icon)
|
|
37
104
|
);
|
|
38
105
|
}
|