@times-design-system/components-wordpress 1.5.2 → 1.6.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 (175) hide show
  1. package/dist/blocks/ad-container/block.json +10 -0
  2. package/dist/blocks/ad-container/edit.js +17 -1
  3. package/dist/blocks/ad-container/render.php +14 -0
  4. package/dist/blocks/button/block.json +19 -5
  5. package/dist/blocks/button/edit.js +33 -15
  6. package/dist/blocks/button/render.php +24 -2
  7. package/dist/blocks/button/style.css +63 -0
  8. package/dist/blocks/chip/block.json +12 -7
  9. package/dist/blocks/chip/edit.js +20 -17
  10. package/dist/blocks/chip/render.php +14 -2
  11. package/dist/blocks/dialog-box/block.json +10 -0
  12. package/dist/blocks/dialog-box/edit.js +17 -0
  13. package/dist/blocks/dialog-box/render.php +16 -4
  14. package/dist/blocks/divider/block.json +10 -0
  15. package/dist/blocks/divider/edit.js +18 -2
  16. package/dist/blocks/divider/render.php +14 -1
  17. package/dist/blocks/flag/block.json +10 -0
  18. package/dist/blocks/flag/edit.js +27 -2
  19. package/dist/blocks/flag/render.php +14 -0
  20. package/dist/blocks/icon/block.json +10 -0
  21. package/dist/blocks/icon/edit.js +17 -0
  22. package/dist/blocks/icon/render.php +16 -4
  23. package/dist/blocks/icon-button/block.json +15 -0
  24. package/dist/blocks/icon-button/edit.js +33 -1
  25. package/dist/blocks/icon-button/render.php +19 -0
  26. package/dist/blocks/icon-button/style.css +37 -3
  27. package/dist/blocks/input/block.json +10 -0
  28. package/dist/blocks/input/edit.js +27 -1
  29. package/dist/blocks/input/render.php +17 -1
  30. package/dist/blocks/input-helper-message/block.json +10 -0
  31. package/dist/blocks/input-helper-message/edit.js +17 -0
  32. package/dist/blocks/input-helper-message/render.php +16 -4
  33. package/dist/blocks/link/block.json +12 -7
  34. package/dist/blocks/link/edit.js +21 -18
  35. package/dist/blocks/link/render.php +14 -2
  36. package/dist/blocks/tab/block.json +10 -0
  37. package/dist/blocks/tab/edit.js +17 -0
  38. package/dist/blocks/tab/render.php +16 -4
  39. package/dist/blocks/tab-group/block.json +10 -0
  40. package/dist/blocks/tab-group/edit.js +17 -0
  41. package/dist/blocks/tab-group/render.php +16 -4
  42. package/dist/blocks/text/block.json +10 -0
  43. package/dist/blocks/text/edit.js +18 -2
  44. package/dist/blocks/text/render.php +14 -1
  45. package/dist/blocks/toast/block.json +10 -0
  46. package/dist/blocks/toast/edit.js +18 -1
  47. package/dist/blocks/toast/render.php +14 -0
  48. package/dist/index.cjs +389 -148
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.js +389 -148
  51. package/dist/index.js.map +1 -1
  52. package/dist/utils/DATA_ATTRIBUTES_USAGE.md +377 -0
  53. package/dist/utils/sanitize-data-attributes.php +109 -0
  54. package/package.json +9 -3
  55. package/BLOCK_CREATION_CHECKLIST.md +0 -385
  56. package/BUILD.md +0 -411
  57. package/CHANGELOG.md +0 -81
  58. package/SCSS_VARIABLES_REFERENCE.md +0 -316
  59. package/STYLING_SYNC_GUIDE.md +0 -306
  60. package/TESTING.md +0 -152
  61. package/TRANSFORMATION_GUIDE.md +0 -908
  62. package/dist/blocks/button/style-resolved.css +0 -153
  63. package/lib/wordpress.js +0 -7
  64. package/rollup.config.js +0 -75
  65. package/scripts/build-plugin.cjs +0 -121
  66. package/scripts/create-block.sh +0 -141
  67. package/scripts/create-wordpress-block-tests.cjs +0 -438
  68. package/scripts/create-wordpress-block.cjs +0 -681
  69. package/src/blocks/ad-container/block.json +0 -29
  70. package/src/blocks/ad-container/edit.js +0 -42
  71. package/src/blocks/ad-container/index.js +0 -10
  72. package/src/blocks/ad-container/render.php +0 -27
  73. package/src/blocks/ad-container/save.js +0 -16
  74. package/src/blocks/ad-container/style-editor.css +0 -4
  75. package/src/blocks/ad-container/style.css +0 -30
  76. package/src/blocks/button/block.json +0 -90
  77. package/src/blocks/button/edit.js +0 -187
  78. package/src/blocks/button/index.js +0 -11
  79. package/src/blocks/button/render.php +0 -71
  80. package/src/blocks/button/save.js +0 -52
  81. package/src/blocks/button/style-editor.css +0 -15
  82. package/src/blocks/button/style-resolved.css +0 -153
  83. package/src/blocks/button/style.css +0 -157
  84. package/src/blocks/chip/block.json +0 -58
  85. package/src/blocks/chip/edit.js +0 -113
  86. package/src/blocks/chip/index.js +0 -10
  87. package/src/blocks/chip/render.php +0 -40
  88. package/src/blocks/chip/save.js +0 -36
  89. package/src/blocks/chip/style-editor.css +0 -5
  90. package/src/blocks/chip/style.css +0 -87
  91. package/src/blocks/dialog-box/block.json +0 -24
  92. package/src/blocks/dialog-box/edit.js +0 -41
  93. package/src/blocks/dialog-box/index.js +0 -17
  94. package/src/blocks/dialog-box/render.php +0 -24
  95. package/src/blocks/dialog-box/save.js +0 -23
  96. package/src/blocks/dialog-box/style.css +0 -23
  97. package/src/blocks/divider/block.json +0 -32
  98. package/src/blocks/divider/edit.js +0 -42
  99. package/src/blocks/divider/index.js +0 -10
  100. package/src/blocks/divider/render.php +0 -31
  101. package/src/blocks/divider/save.js +0 -18
  102. package/src/blocks/divider/style-editor.css +0 -4
  103. package/src/blocks/divider/style.css +0 -37
  104. package/src/blocks/flag/block.json +0 -49
  105. package/src/blocks/flag/edit.js +0 -82
  106. package/src/blocks/flag/index.js +0 -10
  107. package/src/blocks/flag/render.php +0 -34
  108. package/src/blocks/flag/save.js +0 -25
  109. package/src/blocks/flag/style-editor.css +0 -5
  110. package/src/blocks/flag/style.css +0 -54
  111. package/src/blocks/icon/block.json +0 -24
  112. package/src/blocks/icon/edit.js +0 -41
  113. package/src/blocks/icon/index.js +0 -17
  114. package/src/blocks/icon/render.php +0 -24
  115. package/src/blocks/icon/save.js +0 -23
  116. package/src/blocks/icon/style.css +0 -23
  117. package/src/blocks/icon-button/block.json +0 -44
  118. package/src/blocks/icon-button/edit.js +0 -82
  119. package/src/blocks/icon-button/index.js +0 -10
  120. package/src/blocks/icon-button/render.php +0 -46
  121. package/src/blocks/icon-button/save.js +0 -29
  122. package/src/blocks/icon-button/style-editor.css +0 -5
  123. package/src/blocks/icon-button/style.css +0 -31
  124. package/src/blocks/input/block.json +0 -48
  125. package/src/blocks/input/edit.js +0 -78
  126. package/src/blocks/input/index.js +0 -10
  127. package/src/blocks/input/render.php +0 -39
  128. package/src/blocks/input/save.js +0 -27
  129. package/src/blocks/input/style-editor.css +0 -8
  130. package/src/blocks/input/style.css +0 -53
  131. package/src/blocks/input-helper-message/block.json +0 -24
  132. package/src/blocks/input-helper-message/edit.js +0 -42
  133. package/src/blocks/input-helper-message/index.js +0 -17
  134. package/src/blocks/input-helper-message/render.php +0 -24
  135. package/src/blocks/input-helper-message/save.js +0 -23
  136. package/src/blocks/input-helper-message/style.css +0 -23
  137. package/src/blocks/link/block.json +0 -72
  138. package/src/blocks/link/edit.js +0 -151
  139. package/src/blocks/link/index.js +0 -10
  140. package/src/blocks/link/render.php +0 -44
  141. package/src/blocks/link/save.js +0 -46
  142. package/src/blocks/link/style-editor.css +0 -5
  143. package/src/blocks/link/style.css +0 -119
  144. package/src/blocks/tab/block.json +0 -24
  145. package/src/blocks/tab/edit.js +0 -41
  146. package/src/blocks/tab/index.js +0 -17
  147. package/src/blocks/tab/render.php +0 -24
  148. package/src/blocks/tab/save.js +0 -23
  149. package/src/blocks/tab/style.css +0 -23
  150. package/src/blocks/tab-group/block.json +0 -24
  151. package/src/blocks/tab-group/edit.js +0 -41
  152. package/src/blocks/tab-group/index.js +0 -17
  153. package/src/blocks/tab-group/render.php +0 -24
  154. package/src/blocks/tab-group/save.js +0 -23
  155. package/src/blocks/tab-group/style.css +0 -23
  156. package/src/blocks/text/block.json +0 -33
  157. package/src/blocks/text/edit.js +0 -56
  158. package/src/blocks/text/index.js +0 -10
  159. package/src/blocks/text/render.php +0 -26
  160. package/src/blocks/text/save.js +0 -18
  161. package/src/blocks/text/style-editor.css +0 -4
  162. package/src/blocks/text/style.css +0 -7
  163. package/src/blocks/toast/block.json +0 -40
  164. package/src/blocks/toast/edit.js +0 -85
  165. package/src/blocks/toast/index.js +0 -10
  166. package/src/blocks/toast/render.php +0 -37
  167. package/src/blocks/toast/save.js +0 -29
  168. package/src/blocks/toast/style-editor.css +0 -4
  169. package/src/blocks/toast/style.css +0 -67
  170. package/src/index.js +0 -16
  171. package/src/utils/classBuilder.js +0 -53
  172. package/tsconfig.json +0 -116
  173. package/vitest.config.js +0 -28
  174. package/vitest.config.ts +0 -28
  175. package/vitest.setup.ts +0 -129
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Block Rendering: Icon
4
- *
5
- * Server-side rendering for the Icon block.
6
- * Reference: packages/components-react/src/Icon/
7
- *
8
- * @param array $attributes Block attributes
9
- * @param string $content Saved block content
10
- * @param WP_Block $block The block instance
11
- * @return string Rendered HTML
12
- */
13
-
14
- $wrapper_attributes = get_block_wrapper_attributes();
15
-
16
- // TODO: Render the Icon component
17
- // Extract attributes and render appropriate HTML with BEM classes
18
-
19
- ?>
20
- <div <?php echo wp_kses_post( $wrapper_attributes ); ?>>
21
- <!-- TODO: Render Icon component here -->
22
- <!-- Use CSS custom properties from packages/tokens/data/resolved-hexes.json -->
23
- <!-- Apply BEM naming: tds-icon--{modifier} -->
24
- </div>
@@ -1,23 +0,0 @@
1
- /**
2
- * Block Save Component: Icon
3
- *
4
- * Renders the static output saved to the database.
5
- * Reference: packages/components-react/src/Icon/
6
- */
7
-
8
- import { useBlockProps } from '@wordpress/block-editor';
9
-
10
- export function save(props) {
11
- const { attributes } = props;
12
- const blockProps = useBlockProps.save();
13
-
14
- // TODO: Render the actual Icon component with attributes
15
- // This output is saved to the database and displayed on the frontend
16
-
17
- return (
18
- <div {...blockProps}>
19
- {/* TODO: Render Icon component */}
20
- {attributes.content && <p>{attributes.content}</p>}
21
- </div>
22
- );
23
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * Styles for Icon Block
3
- *
4
- * Reference: packages/components-react/src/Icon/
5
- * Token Reference: packages/tokens/data/resolved-hexes.json
6
- *
7
- * TODO: Adapt styles from React component
8
- * - Copy relevant CSS from React component
9
- * - Map CSS custom properties to resolved hex values
10
- * - Use BEM naming: .tds-icon--{modifier}
11
- */
12
-
13
- .tds-icon {
14
- /* TODO: Add component styles here */
15
- }
16
-
17
- .tds-icon--focus {
18
- /* TODO: Add focus state styles */
19
- }
20
-
21
- .tds-icon--disabled {
22
- /* TODO: Add disabled state styles */
23
- }
@@ -1,44 +0,0 @@
1
- {
2
- "$schema": "https://schemas.wp.org/trunk/block.json",
3
- "apiVersion": 3,
4
- "name": "tds/icon-button",
5
- "title": "Icon Button",
6
- "category": "common",
7
- "description": "Button component displaying only an icon",
8
- "icon": "button",
9
- "supports": {
10
- "html": false,
11
- "spacing": {
12
- "margin": true
13
- }
14
- },
15
- "render": "file:./render.php",
16
- "attributes": {
17
- "iconName": {
18
- "type": "string",
19
- "default": ""
20
- },
21
- "round": {
22
- "type": "boolean",
23
- "default": false
24
- },
25
- "href": {
26
- "type": "string",
27
- "default": ""
28
- },
29
- "target": {
30
- "type": "string",
31
- "default": "_self",
32
- "enum": ["_self", "_blank", "_parent", "_top"]
33
- },
34
- "rel": {
35
- "type": "string",
36
- "default": ""
37
- },
38
- "ariaLabel": {
39
- "type": "string",
40
- "default": ""
41
- }
42
- },
43
- "example": {}
44
- }
@@ -1,82 +0,0 @@
1
- import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
2
- import {
3
- PanelBody,
4
- TextControl,
5
- SelectControl,
6
- ToggleControl
7
- } from '@wordpress/components';
8
-
9
- const edit = ({ attributes, setAttributes }) => {
10
- const { iconName, round, href, target, rel, ariaLabel } = attributes;
11
- const blockProps = useBlockProps();
12
-
13
- const buildClass = () => {
14
- const classes = ['tds-icon-button'];
15
- if (round) classes.push('tds-icon-button--round');
16
- return classes.join(' ');
17
- };
18
-
19
- const Element = href ? 'a' : 'button';
20
-
21
- return (
22
- <>
23
- <InspectorControls>
24
- <PanelBody title="Icon Button Settings">
25
- <TextControl
26
- label="Icon Name"
27
- value={iconName}
28
- onChange={(val) => setAttributes({ iconName: val })}
29
- placeholder="e.g., arrow-right"
30
- />
31
- <ToggleControl
32
- label="Round"
33
- checked={round}
34
- onChange={(val) => setAttributes({ round: val })}
35
- />
36
- <TextControl
37
- label="URL (Leave empty for button)"
38
- value={href}
39
- onChange={(val) => setAttributes({ href: val })}
40
- />
41
- {href && (
42
- <>
43
- <SelectControl
44
- label="Target"
45
- value={target}
46
- options={[
47
- { label: 'Same window', value: '_self' },
48
- { label: 'New window', value: '_blank' },
49
- { label: 'Parent', value: '_parent' },
50
- { label: 'Top', value: '_top' }
51
- ]}
52
- onChange={(val) => setAttributes({ target: val })}
53
- />
54
- <TextControl
55
- label="Rel"
56
- value={rel}
57
- onChange={(val) => setAttributes({ rel: val })}
58
- />
59
- </>
60
- )}
61
- <TextControl
62
- label="Aria Label"
63
- value={ariaLabel}
64
- onChange={(val) => setAttributes({ ariaLabel: val })}
65
- />
66
- </PanelBody>
67
- </InspectorControls>
68
- <Element
69
- {...blockProps}
70
- className={buildClass()}
71
- href={href || undefined}
72
- target={href ? target : undefined}
73
- rel={href && rel ? rel : undefined}
74
- aria-label={ariaLabel}
75
- >
76
- <span className="tds-icon-button__icon">{iconName}</span>
77
- </Element>
78
- </>
79
- );
80
- };
81
-
82
- export default edit;
@@ -1,10 +0,0 @@
1
- import { registerBlockType } from '@wordpress/blocks';
2
- import metadata from './block.json';
3
- import edit from './edit';
4
- import save from './save';
5
-
6
- registerBlockType(metadata.name, {
7
- ...metadata,
8
- edit,
9
- save
10
- });
@@ -1,46 +0,0 @@
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,29 +0,0 @@
1
- import { useBlockProps } from '@wordpress/block-editor';
2
-
3
- const save = ({ attributes }) => {
4
- const { iconName, round, href, target, rel, ariaLabel } = attributes;
5
- const blockProps = useBlockProps.save();
6
-
7
- const buildClass = () => {
8
- const classes = ['tds-icon-button'];
9
- if (round) classes.push('tds-icon-button--round');
10
- return classes.join(' ');
11
- };
12
-
13
- const Element = href ? 'a' : 'button';
14
-
15
- return (
16
- <Element
17
- {...blockProps}
18
- className={buildClass()}
19
- href={href || undefined}
20
- target={href ? target : undefined}
21
- rel={href && rel ? rel : undefined}
22
- aria-label={ariaLabel}
23
- >
24
- <span className="tds-icon-button__icon">{iconName}</span>
25
- </Element>
26
- );
27
- };
28
-
29
- export default save;
@@ -1,5 +0,0 @@
1
- /* Icon Button Editor Styles */
2
- .wp-block-times-icon-button {
3
- display: inline-block;
4
- margin: var(--spacing-s);
5
- }
@@ -1,31 +0,0 @@
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;
9
- }
10
-
11
- .tds-icon-button--size-medium {
12
- width: 48px;
13
- height: 48px;
14
- padding: 12px;
15
- }
16
-
17
- .tds-icon-button--size-large {
18
- width: 64px;
19
- height: 64px;
20
- padding: 16px;
21
- }
22
-
23
- .tds-icon-button--round.tds-button {
24
- border-radius: 9999px;
25
- }
26
-
27
- .tds-icon-button__icon {
28
- display: inline-flex;
29
- align-items: center;
30
- justify-content: center;
31
- }
@@ -1,48 +0,0 @@
1
- {
2
- "$schema": "https://schemas.wp.org/trunk/block.json",
3
- "apiVersion": 3,
4
- "name": "tds/input",
5
- "title": "Input",
6
- "category": "common",
7
- "description": "Form input field component",
8
- "icon": "text",
9
- "supports": {
10
- "html": false,
11
- "spacing": {
12
- "margin": true
13
- }
14
- },
15
- "render": "file:./render.php",
16
- "attributes": {
17
- "label": {
18
- "type": "string",
19
- "default": ""
20
- },
21
- "placeholder": {
22
- "type": "string",
23
- "default": ""
24
- },
25
- "type": {
26
- "type": "string",
27
- "default": "text",
28
- "enum": ["text", "email", "password", "number", "tel", "url"]
29
- },
30
- "disabled": {
31
- "type": "boolean",
32
- "default": false
33
- },
34
- "required": {
35
- "type": "boolean",
36
- "default": false
37
- },
38
- "name": {
39
- "type": "string",
40
- "default": ""
41
- },
42
- "id": {
43
- "type": "string",
44
- "default": ""
45
- }
46
- },
47
- "example": {}
48
- }
@@ -1,78 +0,0 @@
1
- import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
2
- import {
3
- PanelBody,
4
- TextControl,
5
- SelectControl,
6
- ToggleControl
7
- } from '@wordpress/components';
8
-
9
- const edit = ({ attributes, setAttributes }) => {
10
- const { label, placeholder, type, disabled, required, name, id } = attributes;
11
- const blockProps = useBlockProps();
12
-
13
- return (
14
- <>
15
- <InspectorControls>
16
- <PanelBody title="Input Settings">
17
- <TextControl
18
- label="Label"
19
- value={label}
20
- onChange={(val) => setAttributes({ label: val })}
21
- />
22
- <TextControl
23
- label="Placeholder"
24
- value={placeholder}
25
- onChange={(val) => setAttributes({ placeholder: val })}
26
- />
27
- <SelectControl
28
- label="Type"
29
- value={type}
30
- options={[
31
- { label: 'Text', value: 'text' },
32
- { label: 'Email', value: 'email' },
33
- { label: 'Password', value: 'password' },
34
- { label: 'Number', value: 'number' },
35
- { label: 'Tel', value: 'tel' },
36
- { label: 'URL', value: 'url' }
37
- ]}
38
- onChange={(val) => setAttributes({ type: val })}
39
- />
40
- <TextControl
41
- label="Name"
42
- value={name}
43
- onChange={(val) => setAttributes({ name: val })}
44
- />
45
- <TextControl
46
- label="ID"
47
- value={id}
48
- onChange={(val) => setAttributes({ id: val })}
49
- />
50
- <ToggleControl
51
- label="Required"
52
- checked={required}
53
- onChange={(val) => setAttributes({ required: val })}
54
- />
55
- <ToggleControl
56
- label="Disabled"
57
- checked={disabled}
58
- onChange={(val) => setAttributes({ disabled: val })}
59
- />
60
- </PanelBody>
61
- </InspectorControls>
62
- <div {...blockProps}>
63
- {label && <label className="tds-input__label">{label}</label>}
64
- <input
65
- type={type}
66
- placeholder={placeholder}
67
- disabled={disabled}
68
- required={required}
69
- name={name}
70
- id={id}
71
- className="tds-input"
72
- />
73
- </div>
74
- </>
75
- );
76
- };
77
-
78
- export default edit;
@@ -1,10 +0,0 @@
1
- import { registerBlockType } from '@wordpress/blocks';
2
- import metadata from './block.json';
3
- import edit from './edit';
4
- import save from './save';
5
-
6
- registerBlockType(metadata.name, {
7
- ...metadata,
8
- edit,
9
- save
10
- });
@@ -1,39 +0,0 @@
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,27 +0,0 @@
1
- import { useBlockProps } from '@wordpress/block-editor';
2
-
3
- const save = ({ attributes }) => {
4
- const { label, placeholder, type, disabled, required, name, id } = attributes;
5
- const blockProps = useBlockProps.save();
6
-
7
- return (
8
- <div {...blockProps}>
9
- {label && (
10
- <label htmlFor={id} className="tds-input__label">
11
- {label}
12
- </label>
13
- )}
14
- <input
15
- type={type}
16
- placeholder={placeholder}
17
- disabled={disabled}
18
- required={required}
19
- name={name}
20
- id={id}
21
- className="tds-input"
22
- />
23
- </div>
24
- );
25
- };
26
-
27
- export default save;
@@ -1,8 +0,0 @@
1
- /* Input Editor Styles */
2
- .wp-block-times-input {
3
- margin: var(--spacing-m) 0;
4
- }
5
-
6
- .wp-block-times-input .tds-input {
7
- opacity: 0.7;
8
- }
@@ -1,53 +0,0 @@
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 */
19
- .tds-input {
20
- width: 100%;
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;
28
- }
29
-
30
- /* Input focus state */
31
- .tds-input:focus {
32
- outline: none;
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;
40
- }
41
-
42
- /* Input disabled state */
43
- .tds-input:disabled {
44
- background-color: #f2f2f2;
45
- color: #999999;
46
- border-color: #cccccc;
47
- cursor: not-allowed;
48
- }
49
-
50
- /* Input placeholder */
51
- .tds-input::placeholder {
52
- color: #666666;
53
- }
@@ -1,24 +0,0 @@
1
- {
2
- "$schema": "https://schemas.wp.org/trunk/block.json",
3
- "apiVersion": 3,
4
- "name": "tds/input-helper-message",
5
- "title": "Times Design System - InputHelperMessage",
6
- "category": "common",
7
- "description": "WordPress block for Times Design System InputHelperMessage component",
8
- "icon": "block-default",
9
- "supports": {
10
- "html": false,
11
- "multiple": true,
12
- "reusable": true,
13
- "customClassName": true
14
- },
15
- "textdomain": "times-blocks",
16
- "attributes": {
17
- "content": {
18
- "type": "string",
19
- "default": ""
20
- }
21
- },
22
- "render": "file:./render.php",
23
- "editorScript": "file:./index.js"
24
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * Block Editor Component: InputHelperMessage
3
- *
4
- * Renders the editor UI for the InputHelperMessage block in Gutenberg.
5
- * Reference: packages/components-react/src/InputHelperMessage/
6
- */
7
-
8
- import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
9
- import { PanelBody, TextControl } from '@wordpress/components';
10
-
11
- export function edit(props) {
12
- const { attributes, setAttributes } = props;
13
- const blockProps = useBlockProps();
14
-
15
- // TODO: Implement editor UI based on component props
16
- // - Add inspector controls for attributes
17
- // - Render preview of component in editor
18
- // - Handle attribute changes via setAttributes()
19
-
20
- return (
21
- <>
22
- <InspectorControls>
23
- <PanelBody title="InputHelperMessage Settings" initialOpen={true}>
24
- <TextControl
25
- label="Content"
26
- value={attributes.content || ''}
27
- onChange={(content) => setAttributes({ content })}
28
- placeholder="Enter content..."
29
- />
30
- {/* TODO: Add more controls based on component variants */}
31
- </PanelBody>
32
- </InspectorControls>
33
- <div {...blockProps}>
34
- <p>📝 InputHelperMessage block editor</p>
35
- <p style={{ fontSize: '12px', color: '#666' }}>
36
- TODO: Render the InputHelperMessage component here with current
37
- attributes
38
- </p>
39
- </div>
40
- </>
41
- );
42
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * WordPress Block Loader: InputHelperMessage
3
- *
4
- * Reference: packages/components-react/src/InputHelperMessage/
5
- * TODO: Update attributes in block.json based on component props
6
- */
7
-
8
- import { registerBlockType } from '@wordpress/blocks';
9
- import { edit as Edit } from './edit';
10
- import { save as Save } from './save';
11
- import blockConfig from './block.json';
12
-
13
- registerBlockType(blockConfig.name, {
14
- ...blockConfig,
15
- edit: Edit,
16
- save: Save
17
- });