@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.
Files changed (74) hide show
  1. package/dist/blocks/ad-container/block.json +1 -0
  2. package/dist/blocks/ad-container/style.css +1 -30
  3. package/dist/blocks/ad-container/style.scss +70 -0
  4. package/dist/blocks/button/block.json +68 -1
  5. package/dist/blocks/button/init.js +45 -0
  6. package/dist/blocks/button/render.php +2 -0
  7. package/dist/blocks/button/style.css +1 -203
  8. package/dist/blocks/button/style.scss +204 -0
  9. package/dist/blocks/chip/ONCLICK_USAGE.md +263 -0
  10. package/dist/blocks/chip/block.json +23 -3
  11. package/dist/blocks/chip/init.js +60 -0
  12. package/dist/blocks/chip/render.php +7 -2
  13. package/dist/blocks/chip/style.css +1 -108
  14. package/dist/blocks/chip/style.scss +213 -0
  15. package/dist/blocks/dialog-box/block.json +1 -0
  16. package/dist/blocks/dialog-box/style.css +1 -23
  17. package/dist/blocks/dialog-box/style.scss +113 -0
  18. package/dist/blocks/divider/block.json +1 -0
  19. package/dist/blocks/divider/style.css +1 -37
  20. package/dist/blocks/divider/style.scss +40 -0
  21. package/dist/blocks/icon/block.json +11 -1
  22. package/dist/blocks/icon/style.css +1 -23
  23. package/dist/blocks/icon/style.scss +10 -0
  24. package/dist/blocks/icon-button/block.json +42 -0
  25. package/dist/blocks/icon-button/init.js +56 -0
  26. package/dist/blocks/icon-button/render.php +5 -0
  27. package/dist/blocks/icon-button/style.css +1 -66
  28. package/dist/blocks/icon-button/style.scss +189 -0
  29. package/dist/blocks/input/block.json +1 -0
  30. package/dist/blocks/input/style.css +1 -67
  31. package/dist/blocks/input/style.scss +72 -0
  32. package/dist/blocks/input-helper-message/block.json +1 -0
  33. package/dist/blocks/input-helper-message/style.css +1 -23
  34. package/dist/blocks/input-helper-message/style.scss +45 -0
  35. package/dist/blocks/link/block.json +87 -3
  36. package/dist/blocks/link/init.js +54 -0
  37. package/dist/blocks/link/render.php +22 -12
  38. package/dist/blocks/link/style.css +1 -221
  39. package/dist/blocks/link/style.scss +163 -0
  40. package/dist/blocks/tab/block.json +1 -0
  41. package/dist/blocks/tab/style.css +1 -152
  42. package/dist/blocks/tab/style.scss +159 -0
  43. package/dist/blocks/tab-group/block.json +1 -0
  44. package/dist/blocks/tab-group/style.css +1 -23
  45. package/dist/blocks/tab-group/style.scss +32 -0
  46. package/dist/blocks/{flag → tag}/block.json +47 -14
  47. package/dist/blocks/{flag → tag}/edit.js +9 -20
  48. package/dist/blocks/{flag → tag}/index.js +2 -2
  49. package/dist/blocks/{flag → tag}/render.php +24 -19
  50. package/dist/blocks/tag/save.js +23 -0
  51. package/dist/blocks/{chip → tag}/style-editor.css +2 -2
  52. package/dist/blocks/tag/style.css +1 -0
  53. package/dist/blocks/tag/style.scss +115 -0
  54. package/dist/blocks/text/block.json +1 -0
  55. package/dist/blocks/text/style.css +1 -7
  56. package/dist/blocks/text/style.scss +11 -0
  57. package/dist/blocks/toast/block.json +1 -0
  58. package/dist/blocks/toast/style.css +1 -68
  59. package/dist/blocks/toast/style.scss +67 -0
  60. package/dist/blocks/utils/render-icon.php +72 -5
  61. package/dist/icon-data.json +1 -1
  62. package/dist/index.cjs +421 -54
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.css +1 -1
  65. package/dist/index.css.map +1 -1
  66. package/dist/index.js +421 -54
  67. package/dist/index.js.map +1 -1
  68. package/dist/plugin.php +42 -0
  69. package/dist/utils/render-icon.php +11 -2
  70. package/package.json +6 -4
  71. package/plugin.php +42 -0
  72. package/dist/blocks/flag/save.js +0 -25
  73. package/dist/blocks/flag/style-editor.css +0 -5
  74. package/dist/blocks/flag/style.css +0 -72
@@ -36,6 +36,7 @@
36
36
  }
37
37
  },
38
38
  "example": {},
39
+ "style": "file:./style.css",
39
40
  "script": "times-design-system",
40
41
  "editorScript": "times-design-system"
41
42
  }
@@ -1,30 +1 @@
1
- /* Ad Container Block Frontend Styles */
2
- /* Using resolved design token values for self-contained styling */
3
-
4
- .tds-ad-container {
5
- clear: both;
6
- width: 100%;
7
- min-height: 283px;
8
- margin: 18px 0;
9
- box-sizing: content-box;
10
- padding: 0 0 8px;
11
- border-bottom: 2px solid rgb(78, 78, 78);
12
- }
13
-
14
- @media (min-width: 768px) and (max-width: 1023px) {
15
- .tds-ad-container {
16
- min-height: 123px;
17
- }
18
- }
19
-
20
- .tds-ad-container--header {
21
- display: flex;
22
- padding-block: 8px 8px;
23
- margin-left: 0 !important;
24
- margin-right: 0 !important;
25
- max-width: 100%;
26
- border-width: 0 0 2px;
27
- border-style: solid;
28
- border-color: #dbdbdb;
29
- flex-direction: column;
30
- }
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-ad-container{clear:both;width:100%;min-height:283px;margin:18px 0;box-sizing:content-box;padding:0 0 8px;border-bottom:2px solid #4e4e4e}@media(min-width: 768px)and (max-width: 1023px){.tds-ad-container{min-height:123px}}.tds-ad-container .ad-label{border-bottom:2px solid #4e4e4e;color:#ccc;flex:1 1 100%;font:500 var(--font-size020)/1.125 Times Roboto;letter-spacing:.6px;margin:0 0 8px;padding:0 0 4px;text-align:center;text-transform:uppercase;display:block}.tds-ad-container__header{display:flex;padding-block:8px 8px;margin-left:0 !important;margin-right:0 !important;max-width:100%;border-width:0 0 2px;border-style:solid;border-color:#ccc;flex-direction:column}.tds-ad-container__header-wrapper{min-height:50px;align-items:center;flex:1 1 0%;display:flex;flex-direction:column;justify-content:center;margin-bottom:0}@media(min-width: 768px){.tds-ad-container__header-wrapper{min-height:90px}}@media(min-width: 1024px){.tds-ad-container__header-wrapper{min-height:250px}}
@@ -0,0 +1,70 @@
1
+ /* Ad Container Block Frontend Styles */
2
+ /* Uses SCSS variables from @times-design-system/theme-scss */
3
+ /* Using resolved design token values 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-ad-container {
10
+ clear: both;
11
+ width: 100%;
12
+ min-height: 283px;
13
+ margin: $spacing-10 0;
14
+ box-sizing: content-box;
15
+ padding: 0 0 $spacing-05;
16
+ border-bottom: $spacing-01 solid rgb(78, 78, 78);
17
+ }
18
+
19
+ @media (min-width: 768px) and (max-width: 1023px) {
20
+ .tds-ad-container {
21
+ min-height: 123px;
22
+ }
23
+ }
24
+
25
+ .tds-ad-container .ad-label {
26
+ border-bottom: $spacing-01 solid rgb(78, 78, 78);
27
+ color: rgb(204, 204, 204);
28
+ flex: 1 1 100%;
29
+ @include utility-label-small;
30
+ letter-spacing: 0.6px;
31
+ margin: 0 0 $spacing-05;
32
+ padding: 0 0 $spacing-03;
33
+ text-align: center;
34
+ text-transform: uppercase;
35
+ display: block;
36
+ }
37
+
38
+ .tds-ad-container__header {
39
+ display: flex;
40
+ padding-block: $spacing-05 $spacing-05;
41
+ margin-left: 0 !important;
42
+ margin-right: 0 !important;
43
+ max-width: 100%;
44
+ border-width: 0 0 $spacing-01;
45
+ border-style: solid;
46
+ border-color: $border-secondary;
47
+ flex-direction: column;
48
+ }
49
+
50
+ .tds-ad-container__header-wrapper {
51
+ min-height: 50px;
52
+ align-items: center;
53
+ flex: 1 1 0%;
54
+ display: flex;
55
+ flex-direction: column;
56
+ justify-content: center;
57
+ margin-bottom: 0;
58
+ }
59
+
60
+ @media (min-width: 768px) {
61
+ .tds-ad-container__header-wrapper {
62
+ min-height: 90px;
63
+ }
64
+ }
65
+
66
+ @media (min-width: 1024px) {
67
+ .tds-ad-container__header-wrapper {
68
+ min-height: 250px;
69
+ }
70
+ }
@@ -96,8 +96,75 @@
96
96
  "type": "object",
97
97
  "default": {},
98
98
  "description": "Custom data-* attributes for extensibility (allowlisted server-side)"
99
+ },
100
+ "onClick": {
101
+ "type": "string",
102
+ "default": "",
103
+ "description": "Name of JavaScript function to call on click (e.g., 'myFunction'). Function receives click event and button element context."
99
104
  }
100
105
  },
101
106
  "editorScript": "times-design-system",
102
- "script": "times-design-system"
107
+ "script": "times-design-system",
108
+ "style": "file:./style.css",
109
+ "preview": {
110
+ "combinations": [
111
+ { "label": "Primary", "intent": "primary", "size": "medium" },
112
+ { "label": "Primary Small", "intent": "primary", "size": "small" },
113
+ {
114
+ "label": "Primary Small",
115
+ "intent": "primary",
116
+ "size": "small",
117
+ "iconRight": "filled_arrow_right"
118
+ },
119
+ { "label": "Primary Large", "intent": "primary", "size": "large" },
120
+ { "label": "Secondary", "intent": "secondary", "size": "medium" },
121
+ { "label": "Negative", "intent": "negative", "size": "medium" },
122
+ {
123
+ "label": "Disabled",
124
+ "disabled": true,
125
+ "intent": "primary",
126
+ "size": "medium"
127
+ },
128
+ {
129
+ "label": "Loading",
130
+ "isLoading": true,
131
+ "intent": "primary",
132
+ "size": "medium"
133
+ },
134
+ {
135
+ "label": "Rounded",
136
+ "isRounded": true,
137
+ "intent": "primary",
138
+ "size": "medium"
139
+ },
140
+ {
141
+ "label": "Icon Left",
142
+ "iconLeft": "filled_circle",
143
+ "intent": "primary"
144
+ },
145
+ {
146
+ "label": "Icon Right",
147
+ "iconRight": "filled_circle",
148
+ "intent": "primary"
149
+ },
150
+ {
151
+ "label": "Full Width",
152
+ "behaviour": "full",
153
+ "intent": "primary",
154
+ "size": "large"
155
+ },
156
+ {
157
+ "label": "Full Width",
158
+ "behaviour": "full",
159
+ "intent": "primary",
160
+ "iconRight": "filled_search"
161
+ },
162
+ {
163
+ "label": "With onClick",
164
+ "intent": "primary",
165
+ "size": "medium",
166
+ "onClick": "handleButtonClick"
167
+ }
168
+ ]
169
+ }
103
170
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Button Block Click Handler
3
+ *
4
+ * Initializes click handlers for button blocks with onClick attribute.
5
+ * Calls custom onClick callback when button is clicked.
6
+ *
7
+ * @package TimesDesignSystem\ComponentsWordPress
8
+ */
9
+
10
+ (function initButtonClickHandlers() {
11
+ /**
12
+ * Initialize click handlers for all button blocks
13
+ */
14
+ function setupButtonHandlers() {
15
+ const buttons = document.querySelectorAll('.tds-button');
16
+
17
+ if (buttons.length === 0) {
18
+ console.warn('[TDS Button] No buttons found on page');
19
+ return;
20
+ }
21
+
22
+ buttons.forEach((button, index) => {
23
+ button.addEventListener('click', function handleButtonClick(e) {
24
+ const functionName = this.getAttribute('data-onclick');
25
+
26
+ if (
27
+ functionName &&
28
+ window[functionName] &&
29
+ typeof window[functionName] === 'function'
30
+ ) {
31
+ window[functionName].call(this, e);
32
+ } else if (functionName) {
33
+ console.warn(`[TDS Button] Function not found: ${functionName}`);
34
+ }
35
+ });
36
+ });
37
+ }
38
+
39
+ // Initialize on DOM ready
40
+ if (document.readyState === 'loading') {
41
+ document.addEventListener('DOMContentLoaded', setupButtonHandlers);
42
+ } else {
43
+ setupButtonHandlers();
44
+ }
45
+ })();
@@ -36,6 +36,7 @@ $icon_size_map = [
36
36
  ];
37
37
  $icon_size = $icon_size_map[$size] ?? 'medium';
38
38
  $aria_label = isset($attributes['ariaLabel']) ? sanitize_text_field($attributes['ariaLabel']) : '';
39
+ $on_click = isset($attributes['onClick']) ? sanitize_text_field($attributes['onClick']) : '';
39
40
  $element_class_name = isset($attributes['classes']) ? sanitize_text_field($attributes['classes']) : '';
40
41
 
41
42
  // Sanitize and prepare data-* attributes
@@ -97,6 +98,7 @@ if ($element_tag === 'a') {
97
98
  <?php echo $disabled ? 'disabled' : ''; ?>
98
99
  type="<?php echo esc_attr($type); ?>"
99
100
  <?php echo $aria_label ? 'aria-label="' . esc_attr($aria_label) . '"' : ''; ?>
101
+ <?php echo $on_click ? 'data-onclick="' . esc_attr($on_click) . '"' : ''; ?>
100
102
  <?php echo wp_kses_post($data_attrs_html); ?>
101
103
  >
102
104
  <?php if ($icon_left) : ?>
@@ -1,203 +1 @@
1
- /* Button Block Frontend Styles */
2
- /* These styles mirror the React Button component styles */
3
- /* Using resolved design token values for self-contained styling */
4
-
5
- .tds-button {
6
- --tds-button-bg: #005c8a;
7
- --tds-button-fg: #ffffff;
8
- --tds-button-border: transparent;
9
- --tds-button-bg-hover: #004e75;
10
- --tds-button-fg-hover: #ffffff;
11
- --tds-button-border-hover: transparent;
12
- --tds-button-bg-pressed: #00496e;
13
- --tds-button-fg-pressed: #ffffff;
14
- --tds-button-border-pressed: transparent;
15
- --tds-button-border-focus: transparent;
16
- --tds-button-focus-ring: #737373;
17
- --tds-button-label-inline-padding: 8px;
18
-
19
- position: relative;
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- gap: 4px;
24
- border-radius: 0;
25
- border: 1px solid var(--tds-button-border);
26
- background-color: var(--tds-button-bg);
27
- color: var(--tds-button-fg);
28
- font-family: Roboto;
29
- font-weight: 500;
30
- line-height: 1;
31
- cursor: pointer;
32
- text-decoration: none;
33
- white-space: nowrap;
34
- transition: 0.15s ease;
35
- }
36
-
37
- .tds-button:hover:not(:disabled) {
38
- background-color: var(--tds-button-bg-hover);
39
- border-color: var(--tds-button-border-hover);
40
- color: var(--tds-button-fg-hover);
41
- }
42
-
43
- .tds-button:active:not(:disabled) {
44
- background-color: var(--tds-button-bg-pressed);
45
- border-color: var(--tds-button-border-pressed);
46
- color: var(--tds-button-fg-pressed);
47
- }
48
-
49
- .tds-button:focus-visible {
50
- outline: none;
51
- background-color: var(--tds-button-bg-hover);
52
- border-color: var(--tds-button-border-focus);
53
- color: var(--tds-button-fg-hover);
54
- }
55
-
56
- .tds-button:focus-visible::after {
57
- content: '';
58
- position: absolute;
59
- inset: -4px;
60
- border: 2px solid #737373;
61
- pointer-events: none;
62
- }
63
-
64
- .tds-button--loading {
65
- cursor: wait;
66
- gap: 0;
67
- }
68
-
69
- .tds-button--is-rounded {
70
- border-radius: 9999px;
71
- }
72
-
73
- .tds-button--intent-primary {
74
- --tds-button-bg: #005c8a;
75
- --tds-button-fg: #ffffff;
76
- --tds-button-border: transparent;
77
- --tds-button-bg-hover: #004e75;
78
- --tds-button-fg-hover: #ffffff;
79
- --tds-button-border-hover: transparent;
80
- --tds-button-bg-pressed: #00496e;
81
- --tds-button-fg-pressed: #ffffff;
82
- --tds-button-border-pressed: transparent;
83
- }
84
-
85
- .tds-button--intent-secondary {
86
- --tds-button-bg: #ffffff;
87
- --tds-button-fg: #1a1a1a;
88
- --tds-button-border: #8c8c8c;
89
- --tds-button-bg-hover: #d9d9d9;
90
- --tds-button-fg-hover: #161616;
91
- --tds-button-border-hover: #777777;
92
- --tds-button-bg-pressed: #cccccc;
93
- --tds-button-fg-pressed: #151515;
94
- --tds-button-border-pressed: #707070;
95
- --tds-button-border-focus: #8c8c8c;
96
- }
97
-
98
- .tds-button--intent-negative {
99
- --tds-button-bg: #ffffff;
100
- --tds-button-fg: #cb0705;
101
- --tds-button-border: #cb0705;
102
- --tds-button-bg-hover: #d9d9d9;
103
- --tds-button-fg-hover: #ad0604;
104
- --tds-button-border-hover: #ad0604;
105
- --tds-button-bg-pressed: #cccccc;
106
- --tds-button-fg-pressed: #a20604;
107
- --tds-button-border-pressed: #a20604;
108
- }
109
-
110
- .tds-button--size-small {
111
- min-height: 40px;
112
- padding: 0 12px;
113
- min-width: 80px;
114
- --tds-button-label-inline-padding: 4px;
115
- font-size: 0.875rem; /* utility.button.small */
116
- }
117
-
118
- .tds-button--size-medium {
119
- min-height: 48px;
120
- min-width: 100px;
121
- padding: 0 16px;
122
- --tds-button-label-inline-padding: 8px;
123
- font-size: 1rem; /* utility.button.medium */
124
- }
125
-
126
- .tds-button--size-large {
127
- min-height: 56px;
128
- min-width: 130px;
129
- padding: 0 24px;
130
- --tds-button-label-inline-padding: 8px;
131
- font-size: 1rem; /* utility.button.medium - mapped from large */
132
- }
133
-
134
- .tds-button--size-xlarge {
135
- min-height: 64px;
136
- min-width: 130px;
137
- padding: 0 24px;
138
- --tds-button-label-inline-padding: 8px;
139
- font-size: 1.125rem; /* utility.button.large - mapped from xlarge */
140
- }
141
-
142
- .tds-button--behaviour-hug {
143
- width: fit-content;
144
- }
145
-
146
- .tds-button--behaviour-full {
147
- width: 100%;
148
- }
149
-
150
- .tds-button__label-container {
151
- padding: 0 var(--tds-button-label-inline-padding);
152
- }
153
-
154
- .tds-button__icon,
155
- .tds-button__spinner {
156
- display: inline-flex;
157
- align-items: center;
158
- justify-content: center;
159
- }
160
-
161
- .tds-button--size-small .tds-button__icon,
162
- .tds-button--size-small .tds-button__spinner {
163
- width: 20px;
164
- height: 20px;
165
- }
166
-
167
- .tds-button--size-medium .tds-button__icon,
168
- .tds-button--size-medium .tds-button__spinner {
169
- width: 24px;
170
- height: 24px;
171
- }
172
-
173
- .tds-button--size-large .tds-button__icon,
174
- .tds-button--size-large .tds-button__spinner {
175
- width: 28px;
176
- height: 28px;
177
- }
178
-
179
- .tds-button--size-xlarge .tds-button__icon,
180
- .tds-button--size-xlarge .tds-button__spinner {
181
- width: 28px;
182
- height: 28px;
183
- }
184
-
185
- .tds-button__icon svg {
186
- width: 100%;
187
- height: 100%;
188
- }
189
-
190
- .tds-button__spinner svg {
191
- animation: tds-button-spin 1.8s linear infinite;
192
- }
193
-
194
- @keyframes tds-button-spin {
195
- 0% {
196
- transform: rotate(0deg);
197
- transform-origin: center;
198
- }
199
- 100% {
200
- transform: rotate(360deg);
201
- transform-origin: center;
202
- }
203
- }
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-button{--tds-button-bg: #005c8a;--tds-button-fg: #ffffff;--tds-button-border: transparent;--tds-button-bg-hover: #004e75;--tds-button-fg-hover: #ffffff;--tds-button-border-hover: transparent;--tds-button-bg-pressed: #00496e;--tds-button-fg-pressed: #ffffff;--tds-button-border-pressed: transparent;--tds-button-border-focus: transparent;--tds-button-focus-ring: #737373;--tds-button-label-inline-padding: 8px;position:relative;display:flex;align-items:center;justify-content:center;gap:4px;border-radius:0;border:1px solid var(--tds-button-border);background-color:var(--tds-button-bg);color:var(--tds-button-fg);cursor:pointer;text-decoration:none;white-space:nowrap;transition:.15s ease}.tds-button:hover:not(:disabled){background-color:var(--tds-button-bg-hover);border-color:var(--tds-button-border-hover);color:var(--tds-button-fg-hover)}.tds-button:active:not(:disabled){background-color:var(--tds-button-bg-pressed);border-color:var(--tds-button-border-pressed);color:var(--tds-button-fg-pressed)}.tds-button:focus-visible{outline:none;background-color:var(--tds-button-bg-hover);border-color:var(--tds-button-border-focus);color:var(--tds-button-fg-hover)}.tds-button:focus-visible::after{content:"";position:absolute;inset:calc(4px*-1);border:2px solid var(--tds-button-focus-ring);pointer-events:none}.tds-button--loading{cursor:wait;gap:0}.tds-button--is-rounded{border-radius:9999px}.tds-button--intent-primary{--tds-button-bg: #005c8a;--tds-button-fg: #ffffff;--tds-button-border: transparent;--tds-button-bg-hover: #004e75;--tds-button-fg-hover: #ffffff;--tds-button-border-hover: transparent;--tds-button-bg-pressed: #00496e;--tds-button-fg-pressed: #ffffff;--tds-button-border-pressed: transparent}.tds-button--intent-secondary{--tds-button-bg: #ffffff;--tds-button-fg: #1a1a1a;--tds-button-border: #8c8c8c;--tds-button-bg-hover: #d9d9d9;--tds-button-fg-hover: #161616;--tds-button-border-hover: #777777;--tds-button-bg-pressed: #cccccc;--tds-button-fg-pressed: #151515;--tds-button-border-pressed: #707070;--tds-button-border-focus: #8c8c8c}.tds-button--intent-negative{--tds-button-bg: #ffffff;--tds-button-fg: #cb0705;--tds-button-border: #cb0705;--tds-button-bg-hover: #d9d9d9;--tds-button-fg-hover: #ad0604;--tds-button-border-hover: #ad0604;--tds-button-bg-pressed: #cccccc;--tds-button-fg-pressed: #a20604;--tds-button-border-pressed: #a20604}.tds-button--size-small{min-height:40px;padding:0 12px;min-width:80px;--tds-button-label-inline-padding: 4px;font:500 var(--font-size020)/1 Times Roboto}.tds-button--size-medium{min-height:48px;min-width:100px;padding:0 16px;--tds-button-label-inline-padding: 8px;font:500 var(--font-size030)/1 Times Roboto}.tds-button--size-large{min-height:56px;min-width:130px;padding:0 24px;--tds-button-label-inline-padding: 8px;font:500 var(--font-size030)/1 Times Roboto}.tds-button--size-xlarge{min-height:64px;min-width:130px;padding:0 24px;--tds-button-label-inline-padding: 8px;font:500 var(--font-size090)/1 Times Roboto}.tds-button--behaviour-hug{width:fit-content}.tds-button--behaviour-full{width:100%}.tds-button__label-container{padding:0 var(--tds-button-label-inline-padding)}.tds-button__icon,.tds-button__spinner{display:inline-flex;align-items:center;justify-content:center}.tds-button--size-small .tds-button__icon,.tds-button--size-small .tds-button__spinner{width:20px;height:20px}.tds-button--size-medium .tds-button__icon,.tds-button--size-medium .tds-button__spinner{width:24px;height:24px}.tds-button--size-large .tds-button__icon,.tds-button--size-large .tds-button__spinner{width:28px;height:28px}.tds-button--size-xlarge .tds-button__icon,.tds-button--size-xlarge .tds-button__spinner{width:28px;height:28px}.tds-button__icon svg{width:100%;height:100%}.tds-button__spinner svg{animation:tds-button-spin 1.8s linear infinite}@keyframes tds-button-spin{0%{transform:rotate(0deg);transform-origin:center}100%{transform:rotate(360deg);transform-origin:center}}
@@ -0,0 +1,204 @@
1
+ /* Button Block Frontend Styles */
2
+ /* These styles use SCSS variables from @times-design-system/theme-scss */
3
+ /* Maintains styling parity with React Button component */
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-button {
10
+ --tds-button-bg: #{$interactive-primary-fill-default};
11
+ --tds-button-fg: #{$interactive-primary-text-default};
12
+ --tds-button-border: transparent;
13
+ --tds-button-bg-hover: #{$interactive-primary-fill-hover};
14
+ --tds-button-fg-hover: #{$interactive-primary-text-hover};
15
+ --tds-button-border-hover: transparent;
16
+ --tds-button-bg-pressed: #{$interactive-primary-fill-pressed};
17
+ --tds-button-fg-pressed: #{$interactive-primary-text-pressed};
18
+ --tds-button-border-pressed: transparent;
19
+ --tds-button-border-focus: transparent;
20
+ --tds-button-focus-ring: #{$text-tertiary};
21
+ --tds-button-label-inline-padding: #{$spacing-05};
22
+
23
+ position: relative;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ gap: $spacing-03;
28
+ border-radius: 0;
29
+ border: 1px solid var(--tds-button-border);
30
+ background-color: var(--tds-button-bg);
31
+ color: var(--tds-button-fg);
32
+ cursor: pointer;
33
+ text-decoration: none;
34
+ white-space: nowrap;
35
+ transition: 0.15s ease;
36
+ }
37
+
38
+ .tds-button:hover:not(:disabled) {
39
+ background-color: var(--tds-button-bg-hover);
40
+ border-color: var(--tds-button-border-hover);
41
+ color: var(--tds-button-fg-hover);
42
+ }
43
+
44
+ .tds-button:active:not(:disabled) {
45
+ background-color: var(--tds-button-bg-pressed);
46
+ border-color: var(--tds-button-border-pressed);
47
+ color: var(--tds-button-fg-pressed);
48
+ }
49
+
50
+ .tds-button:focus-visible {
51
+ outline: none;
52
+ background-color: var(--tds-button-bg-hover);
53
+ border-color: var(--tds-button-border-focus);
54
+ color: var(--tds-button-fg-hover);
55
+ }
56
+
57
+ .tds-button:focus-visible::after {
58
+ content: '';
59
+ position: absolute;
60
+ inset: calc(#{$spacing-03} * -1);
61
+ border: $spacing-01 solid var(--tds-button-focus-ring);
62
+ pointer-events: none;
63
+ }
64
+
65
+ .tds-button--loading {
66
+ cursor: wait;
67
+ gap: 0;
68
+ }
69
+
70
+ .tds-button--is-rounded {
71
+ border-radius: $border-radius-full;
72
+ }
73
+
74
+ .tds-button--intent-primary {
75
+ --tds-button-bg: #{$interactive-primary-fill-default};
76
+ --tds-button-fg: #{$interactive-primary-text-default};
77
+ --tds-button-border: transparent;
78
+ --tds-button-bg-hover: #{$interactive-primary-fill-hover};
79
+ --tds-button-fg-hover: #{$interactive-primary-text-hover};
80
+ --tds-button-border-hover: transparent;
81
+ --tds-button-bg-pressed: #{$interactive-primary-fill-pressed};
82
+ --tds-button-fg-pressed: #{$interactive-primary-text-pressed};
83
+ --tds-button-border-pressed: transparent;
84
+ }
85
+
86
+ .tds-button--intent-secondary {
87
+ --tds-button-bg: #{$interactive-secondary-fill-default};
88
+ --tds-button-fg: #{$interactive-secondary-text-default};
89
+ --tds-button-border: #{$interactive-secondary-border-default};
90
+ --tds-button-bg-hover: #{$interactive-secondary-fill-hover};
91
+ --tds-button-fg-hover: #{$interactive-secondary-text-hover};
92
+ --tds-button-border-hover: #{$interactive-secondary-border-hover};
93
+ --tds-button-bg-pressed: #{$interactive-secondary-fill-pressed};
94
+ --tds-button-fg-pressed: #{$interactive-secondary-text-pressed};
95
+ --tds-button-border-pressed: #{$interactive-secondary-border-pressed};
96
+ --tds-button-border-focus: #{$interactive-secondary-border-default};
97
+ }
98
+
99
+ .tds-button--intent-negative {
100
+ --tds-button-bg: #{$interactive-negative-fill-default};
101
+ --tds-button-fg: #{$interactive-negative-text-default};
102
+ --tds-button-border: #{$interactive-negative-border-default};
103
+ --tds-button-bg-hover: #{$interactive-negative-fill-hover};
104
+ --tds-button-fg-hover: #{$interactive-negative-text-hover};
105
+ --tds-button-border-hover: #{$interactive-negative-border-hover};
106
+ --tds-button-bg-pressed: #{$interactive-negative-fill-pressed};
107
+ --tds-button-fg-pressed: #{$interactive-negative-text-pressed};
108
+ --tds-button-border-pressed: #{$interactive-negative-border-pressed};
109
+ }
110
+
111
+ .tds-button--size-small {
112
+ min-height: $spacing-17;
113
+ padding: 0 $spacing-07;
114
+ min-width: $spacing-21;
115
+ --tds-button-label-inline-padding: #{$spacing-03};
116
+ @include utility-button-small;
117
+ }
118
+
119
+ .tds-button--size-medium {
120
+ min-height: $spacing-18;
121
+ min-width: 100px;
122
+ padding: 0 $spacing-09;
123
+ --tds-button-label-inline-padding: #{$spacing-05};
124
+ @include utility-button-medium;
125
+ }
126
+
127
+ .tds-button--size-large {
128
+ min-height: $spacing-19;
129
+ min-width: 130px;
130
+ padding: 0 $spacing-13;
131
+ --tds-button-label-inline-padding: #{$spacing-05};
132
+ @include utility-button-medium;
133
+ }
134
+
135
+ .tds-button--size-xlarge {
136
+ min-height: $spacing-20;
137
+ min-width: 130px;
138
+ padding: 0 $spacing-13;
139
+ --tds-button-label-inline-padding: #{$spacing-05};
140
+ @include utility-button-large;
141
+ }
142
+
143
+ .tds-button--behaviour-hug {
144
+ width: fit-content;
145
+ }
146
+
147
+ .tds-button--behaviour-full {
148
+ width: 100%;
149
+ }
150
+
151
+ .tds-button__label-container {
152
+ padding: 0 var(--tds-button-label-inline-padding);
153
+ }
154
+
155
+ .tds-button__icon,
156
+ .tds-button__spinner {
157
+ display: inline-flex;
158
+ align-items: center;
159
+ justify-content: center;
160
+ }
161
+
162
+ .tds-button--size-small .tds-button__icon,
163
+ .tds-button--size-small .tds-button__spinner {
164
+ width: $spacing-11;
165
+ height: $spacing-11;
166
+ }
167
+
168
+ .tds-button--size-medium .tds-button__icon,
169
+ .tds-button--size-medium .tds-button__spinner {
170
+ width: $spacing-13;
171
+ height: $spacing-13;
172
+ }
173
+
174
+ .tds-button--size-large .tds-button__icon,
175
+ .tds-button--size-large .tds-button__spinner {
176
+ width: $spacing-14;
177
+ height: $spacing-14;
178
+ }
179
+
180
+ .tds-button--size-xlarge .tds-button__icon,
181
+ .tds-button--size-xlarge .tds-button__spinner {
182
+ width: $spacing-14;
183
+ height: $spacing-14;
184
+ }
185
+
186
+ .tds-button__icon svg {
187
+ width: 100%;
188
+ height: 100%;
189
+ }
190
+
191
+ .tds-button__spinner svg {
192
+ animation: tds-button-spin 1.8s linear infinite;
193
+ }
194
+
195
+ @keyframes tds-button-spin {
196
+ 0% {
197
+ transform: rotate(0deg);
198
+ transform-origin: center;
199
+ }
200
+ 100% {
201
+ transform: rotate(360deg);
202
+ transform-origin: center;
203
+ }
204
+ }