@eightshift/frontend-libs-tailwind 1.1.1 → 1.3.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/.prettierrc +1 -1
- package/CHANGELOG.md +16 -1
- package/blocks/init/assets/scripts/application-admin.js +1 -1
- package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +5 -1
- package/blocks/init/src/Blocks/assets/scripts/shared.js +3 -1
- package/blocks/init/src/Blocks/assets/styles/application-blocks.css +1 -0
- package/blocks/init/src/Blocks/components/button/button.php +6 -0
- package/blocks/init/src/Blocks/components/button/components/button-options.js +20 -2
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +2 -1
- package/blocks/init/src/Blocks/components/icon/icon.php +3 -1
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +7 -1
- package/blocks/init/src/Blocks/components/image/components/image-options.js +17 -3
- package/blocks/init/src/Blocks/components/list/components/list-options.js +3 -1
- package/blocks/init/src/Blocks/components/list/manifest.json +1 -1
- package/blocks/init/src/Blocks/components/modal/assets/index.js +9 -7
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +1 -1
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +3 -1
- package/blocks/init/src/Blocks/components/share/assets/index.js +6 -2
- package/blocks/init/src/Blocks/components/share/components/share-options.js +11 -2
- package/blocks/init/src/Blocks/components/share/share.php +7 -4
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +5 -3
- package/blocks/init/src/Blocks/components/video/components/video-options.js +25 -4
- package/blocks/init/src/Blocks/components/video/manifest.json +5 -1
- package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +8 -2
- package/blocks/init/src/Blocks/custom/column/components/column-options.js +12 -4
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +6 -2
- package/blocks/init/src/Blocks/custom/columns/manifest.json +63 -37
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +29 -8
- package/blocks/init/src/Blocks/custom/image/manifest.json +4 -76
- package/blocks/init/src/Blocks/custom/map/components/map-editor.js +12 -2
- package/blocks/init/src/Blocks/custom/map/components/map-options.js +40 -11
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +3 -1
- package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +5 -3
- package/blocks/init/src/Blocks/custom/video/manifest.json +0 -76
- package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +38 -7
- package/blocks/init/src/Blocks/wrapper/manifest.json +4 -1
- package/bun.lockb +0 -0
- package/package.json +27 -27
- package/schemas/block.json +16 -16
- package/schemas/component.json +18 -18
- package/scripts/components/block-inserter.js +4 -1
- package/scripts/components/file-picker.js +31 -17
- package/scripts/components/link-section-editor.js +5 -1
- package/scripts/components/media-picker.js +36 -11
- package/scripts/components/picker-placeholder.js +6 -2
- package/scripts/components/server-side-render.js +4 -1
- package/scripts/components/settings/settings.js +8 -2
- package/scripts/editor/attributes.js +8 -3
- package/scripts/editor/editor.js +7 -1
- package/scripts/editor/fetch.js +3 -2
- package/scripts/editor/index.js +8 -1
- package/scripts/editor/options.js +3 -1
- package/scripts/editor/registration.js +87 -17
- package/scripts/editor/tailwindcss.js +96 -58
- package/scripts/helpers/index.js +7 -1
- package/scripts/index.js +15 -2
- package/webpack/base.mjs +3 -1
- package/webpack/helpers.mjs +13 -3
- package/webpack/project.mjs +8 -2
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { checkAttr, getAttrKey, getOption } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import {
|
|
2
|
+
import { checkAttr, getAttrKey, getHiddenOptions, getOption } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
+
import {
|
|
4
|
+
BaseControl,
|
|
5
|
+
ButtonGroup,
|
|
6
|
+
ColorPicker,
|
|
7
|
+
ContainerPanel,
|
|
8
|
+
OptionSelect,
|
|
9
|
+
Spacer,
|
|
10
|
+
Responsive,
|
|
11
|
+
InputField,
|
|
12
|
+
} from '@eightshift/ui-components';
|
|
4
13
|
import { icons } from '@eightshift/ui-components/icons';
|
|
5
14
|
import { clsx } from '@eightshift/ui-components/utilities';
|
|
6
15
|
import { getResponsiveData } from '@eightshift/frontend-libs-tailwind/scripts/helpers/breakpoints';
|
|
@@ -30,7 +39,11 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
30
39
|
|
|
31
40
|
const wrapperId = checkAttr('wrapperId', attributes, manifest);
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
const wrapperDisabledOptions = checkAttr('wrapperDisabledOptions', attributes, manifest);
|
|
43
|
+
|
|
44
|
+
const hiddenOptions = getHiddenOptions(wrapperDisabledOptions);
|
|
45
|
+
|
|
46
|
+
if (wrapperNoControls || wrapperDisabledOptions === 'all') {
|
|
34
47
|
return null;
|
|
35
48
|
}
|
|
36
49
|
|
|
@@ -79,7 +92,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
79
92
|
icon={icons.containerWidth}
|
|
80
93
|
label={__('Width', '%g_textdomain%')}
|
|
81
94
|
options={getOption('wrapperContentWidth', attributes, manifest)}
|
|
82
|
-
hidden={wrapperNoWidthControls}
|
|
95
|
+
hidden={wrapperNoWidthControls || hiddenOptions?.width}
|
|
83
96
|
noModeSelect
|
|
84
97
|
inline
|
|
85
98
|
{...responsiveData}
|
|
@@ -97,6 +110,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
97
110
|
<BaseControl
|
|
98
111
|
icon={icons.backgroundType}
|
|
99
112
|
label={__('Background', '%g_textdomain%')}
|
|
113
|
+
hidden={hiddenOptions?.background}
|
|
100
114
|
inline
|
|
101
115
|
>
|
|
102
116
|
<ButtonGroup>
|
|
@@ -108,21 +122,27 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
108
122
|
setAttributes({ [getAttrKey('wrapperBackground', attributes, manifest)]: undefined });
|
|
109
123
|
} else {
|
|
110
124
|
setAttributes({
|
|
111
|
-
[getAttrKey('wrapperBackground', attributes, manifest)]: Object.keys(
|
|
125
|
+
[getAttrKey('wrapperBackground', attributes, manifest)]: Object.keys(
|
|
126
|
+
manifest.tailwind.options.wrapperBackground.twClasses,
|
|
127
|
+
).find((key) => key.startsWith(value)),
|
|
112
128
|
});
|
|
113
129
|
}
|
|
114
130
|
}}
|
|
115
131
|
aria-label={__('Background type', '%g_textdomain%')}
|
|
116
132
|
type='menu'
|
|
133
|
+
hidden={hiddenOptions?.backgroundType}
|
|
117
134
|
noItemIcon
|
|
118
135
|
/>
|
|
119
136
|
|
|
120
137
|
{backgroundType === 'solid' && (
|
|
121
138
|
<ColorPicker
|
|
122
139
|
colors={getColorOption('wrapperBackgroundSolid', manifest)}
|
|
123
|
-
onChange={(value) =>
|
|
140
|
+
onChange={(value) =>
|
|
141
|
+
setAttributes({ [getAttrKey('wrapperBackground', attributes, manifest)]: `solid-${value}` })
|
|
142
|
+
}
|
|
124
143
|
value={wrapperBackground?.replace('solid-', '')}
|
|
125
144
|
aria-label={__('Background color', '%g_textdomain%')}
|
|
145
|
+
hidden={hiddenOptions?.backgroundType}
|
|
126
146
|
/>
|
|
127
147
|
)}
|
|
128
148
|
{backgroundType === 'gradient' && (
|
|
@@ -152,17 +172,21 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
152
172
|
),
|
|
153
173
|
}}
|
|
154
174
|
aria-label={__('Gradient style', '%g_textdomain%')}
|
|
175
|
+
hidden={hiddenOptions?.backgroundType}
|
|
155
176
|
noTriggerLabel
|
|
156
177
|
type='menu'
|
|
157
178
|
/>
|
|
158
179
|
<OptionSelect
|
|
159
180
|
value={wrapperGradientDirection}
|
|
160
|
-
onChange={(value) =>
|
|
181
|
+
onChange={(value) =>
|
|
182
|
+
setAttributes({ [getAttrKey('wrapperGradientDirection', attributes, manifest)]: value })
|
|
183
|
+
}
|
|
161
184
|
options={getOption('wrapperGradientDirection', attributes, manifest)}
|
|
162
185
|
wrapperProps={{
|
|
163
186
|
triggerIcon: <div className={rotationClassName[wrapperGradientDirection]}>{icons.arrowUpCircle}</div>,
|
|
164
187
|
}}
|
|
165
188
|
aria-label={__('Gradient angle', '%g_textdomain%')}
|
|
189
|
+
hidden={hiddenOptions?.backgroundType}
|
|
166
190
|
noTriggerLabel
|
|
167
191
|
type='menu'
|
|
168
192
|
/>
|
|
@@ -179,6 +203,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
179
203
|
options={getOption('wrapperBorderRadius', attributes, manifest)}
|
|
180
204
|
aria-label={__('Rounded corners', '%g_textdomain%')}
|
|
181
205
|
type='menu'
|
|
206
|
+
hidden={hiddenOptions?.roundedCorners}
|
|
182
207
|
inline
|
|
183
208
|
/>
|
|
184
209
|
|
|
@@ -199,6 +224,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
199
224
|
icon={icons.spacingTop}
|
|
200
225
|
label={__('Top margin', '%g_textdomain%')}
|
|
201
226
|
options={getOption('wrapperSpacing', attributes, manifest)}
|
|
227
|
+
hidden={hiddenOptions?.marginTop}
|
|
202
228
|
noModeSelect
|
|
203
229
|
inline
|
|
204
230
|
{...responsiveData}
|
|
@@ -223,6 +249,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
223
249
|
icon={icons.spacingBottom}
|
|
224
250
|
label={__('Bottom margin', '%g_textdomain%')}
|
|
225
251
|
options={getOption('wrapperSpacing', attributes, manifest)}
|
|
252
|
+
hidden={hiddenOptions?.marginBottom}
|
|
226
253
|
noModeSelect
|
|
227
254
|
inline
|
|
228
255
|
{...responsiveData}
|
|
@@ -249,6 +276,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
249
276
|
icon={icons.spacingTopIn}
|
|
250
277
|
label={__('Top padding', '%g_textdomain%')}
|
|
251
278
|
options={getOption('wrapperSpacing', attributes, manifest)}
|
|
279
|
+
hidden={hiddenOptions?.paddingTop}
|
|
252
280
|
noModeSelect
|
|
253
281
|
inline
|
|
254
282
|
{...responsiveData}
|
|
@@ -273,6 +301,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
273
301
|
icon={icons.spacingBottomIn}
|
|
274
302
|
label={__('Bottom padding', '%g_textdomain%')}
|
|
275
303
|
options={getOption('wrapperSpacing', attributes, manifest)}
|
|
304
|
+
hidden={hiddenOptions?.paddingBottom}
|
|
276
305
|
noModeSelect
|
|
277
306
|
inline
|
|
278
307
|
{...responsiveData}
|
|
@@ -304,6 +333,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
304
333
|
icon={icons.visibility}
|
|
305
334
|
label={__('Visibility', '%g_textdomain%')}
|
|
306
335
|
options={getOption('wrapperHide', attributes, manifest)}
|
|
336
|
+
hidden={hiddenOptions?.hide}
|
|
307
337
|
noModeSelect
|
|
308
338
|
inline
|
|
309
339
|
{...responsiveData}
|
|
@@ -327,6 +357,7 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
327
357
|
value={wrapperId}
|
|
328
358
|
onChange={(value) => setAttributes({ [getAttrKey('wrapperId', attributes, manifest)]: value })}
|
|
329
359
|
className='es-uic-font-mono'
|
|
360
|
+
hidden={hiddenOptions?.id}
|
|
330
361
|
/>
|
|
331
362
|
</ContainerPanel>
|
|
332
363
|
);
|
|
@@ -96,6 +96,9 @@
|
|
|
96
96
|
},
|
|
97
97
|
"wrapperId": {
|
|
98
98
|
"type": "string"
|
|
99
|
+
},
|
|
100
|
+
"wrapperDisabledOptions": {
|
|
101
|
+
"type": "string"
|
|
99
102
|
}
|
|
100
103
|
},
|
|
101
104
|
"options": {
|
|
@@ -350,7 +353,7 @@
|
|
|
350
353
|
},
|
|
351
354
|
"wrapperGradientDirection": {
|
|
352
355
|
"twClasses": {
|
|
353
|
-
"to-t": "bg-gradient-to-
|
|
356
|
+
"to-t": "bg-gradient-to-t",
|
|
354
357
|
"to-tr": "bg-gradient-to-tr",
|
|
355
358
|
"to-r": "bg-gradient-to-r",
|
|
356
359
|
"to-br": "bg-gradient-to-br",
|
package/bun.lockb
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eightshift/frontend-libs-tailwind",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Eightshift team",
|
|
@@ -34,48 +34,48 @@
|
|
|
34
34
|
"homepage": "https://github.com/infinum/eightshift-frontend-libs-tailwind#readme",
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@eightshift/ui-components": "^1.
|
|
38
|
-
"@stylistic/eslint-plugin-js": "^2.
|
|
39
|
-
"@stylistic/stylelint-plugin": "^
|
|
40
|
-
"@swc/core": "^1.
|
|
41
|
-
"@wordpress/api-fetch": "^7.
|
|
42
|
-
"@wordpress/block-editor": "^
|
|
37
|
+
"@eightshift/ui-components": "^1.4.7",
|
|
38
|
+
"@stylistic/eslint-plugin-js": "^2.6.4",
|
|
39
|
+
"@stylistic/stylelint-plugin": "^3.0.1",
|
|
40
|
+
"@swc/core": "^1.7.14",
|
|
41
|
+
"@wordpress/api-fetch": "^7.5.0",
|
|
42
|
+
"@wordpress/block-editor": "^14.0.0",
|
|
43
43
|
"@wordpress/dependency-extraction-webpack-plugin": "^5.9.0",
|
|
44
|
-
"@wordpress/dom-ready": "^4.
|
|
45
|
-
"@wordpress/server-side-render": "^5.
|
|
46
|
-
"browserslist": "^4.23.
|
|
44
|
+
"@wordpress/dom-ready": "^4.5.0",
|
|
45
|
+
"@wordpress/server-side-render": "^5.5.0",
|
|
46
|
+
"browserslist": "^4.23.3",
|
|
47
47
|
"css-loader": "^7.1.2",
|
|
48
48
|
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
49
|
-
"eslint": "^9.
|
|
49
|
+
"eslint": "^9.9.0",
|
|
50
50
|
"eslint-config-prettier": "^9.1.0",
|
|
51
|
-
"eslint-plugin-prettier": "^5.1
|
|
51
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
52
52
|
"file-loader": "^6.2.0",
|
|
53
|
-
"globals": "^15.
|
|
54
|
-
"husky": "^9.
|
|
55
|
-
"lightningcss": "^1.
|
|
56
|
-
"mini-css-extract-plugin": "^2.9.
|
|
57
|
-
"postcss": "^8.4.
|
|
53
|
+
"globals": "^15.9.0",
|
|
54
|
+
"husky": "^9.1.5",
|
|
55
|
+
"lightningcss": "^1.26.0",
|
|
56
|
+
"mini-css-extract-plugin": "^2.9.1",
|
|
57
|
+
"postcss": "^8.4.41",
|
|
58
58
|
"postcss-loader": "^8.1.1",
|
|
59
|
-
"prettier": "^3.3.
|
|
60
|
-
"prettier-plugin-tailwindcss": "^0.6.
|
|
59
|
+
"prettier": "^3.3.3",
|
|
60
|
+
"prettier-plugin-tailwindcss": "^0.6.6",
|
|
61
61
|
"sonner": "^1.5.0",
|
|
62
|
-
"stylelint": "^16.
|
|
62
|
+
"stylelint": "^16.8.2",
|
|
63
63
|
"stylelint-config-standard": "^36.0.1",
|
|
64
64
|
"swc-loader": "^0.2.6",
|
|
65
65
|
"terser-webpack-plugin": "^5.3.10",
|
|
66
|
-
"webpack": "^5.
|
|
66
|
+
"webpack": "^5.93.0",
|
|
67
67
|
"webpack-cli": "^5.1.4",
|
|
68
68
|
"webpack-manifest-plugin": "^5.0.0",
|
|
69
69
|
"webpack-merge": "^6.0.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"embla-carousel": "^8.
|
|
73
|
-
"fluid-tailwind": "^1.0.
|
|
74
|
-
"lint-staged": "^15.2.
|
|
72
|
+
"embla-carousel": "^8.2.0",
|
|
73
|
+
"fluid-tailwind": "^1.0.3",
|
|
74
|
+
"lint-staged": "^15.2.9",
|
|
75
75
|
"micromodal": "^0.4.10",
|
|
76
|
-
"ol": "^
|
|
77
|
-
"ol-mapbox-style": "^12.3.
|
|
78
|
-
"tailwindcss": "^3.4.
|
|
76
|
+
"ol": "^10.0.0",
|
|
77
|
+
"ol-mapbox-style": "^12.3.5",
|
|
78
|
+
"tailwindcss": "^3.4.10",
|
|
79
79
|
"tailwindcss-animate": "^1.0.7"
|
|
80
80
|
},
|
|
81
81
|
"sideEffects": false,
|
package/schemas/block.json
CHANGED
|
@@ -188,12 +188,12 @@
|
|
|
188
188
|
"description": "Base classes for the main part of the block.",
|
|
189
189
|
"properties": {
|
|
190
190
|
"twClasses": {
|
|
191
|
-
"type": "string",
|
|
192
|
-
"description": "Classnames to apply."
|
|
191
|
+
"type": ["string", "array"],
|
|
192
|
+
"description": "Classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
193
193
|
},
|
|
194
194
|
"twClassesEditor": {
|
|
195
|
-
"type": "string",
|
|
196
|
-
"description": "Editor-specific classnames to apply. Overrides 'twClasses'"
|
|
195
|
+
"type": ["string", "array"],
|
|
196
|
+
"description": "Editor-specific classnames to apply. Overrides 'twClasses' An array of classnames (strings) can also be provided for improved manifest readability."
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
199
|
"minProperties": 1
|
|
@@ -242,12 +242,12 @@
|
|
|
242
242
|
}
|
|
243
243
|
},
|
|
244
244
|
"twClasses": {
|
|
245
|
-
"type": "string",
|
|
246
|
-
"description": "Classnames to apply if all conditions match. Key is the attribute value, value is the classnames to apply."
|
|
245
|
+
"type": ["string", "array"],
|
|
246
|
+
"description": "Classnames to apply if all conditions match. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
247
247
|
},
|
|
248
248
|
"twClassesEditor": {
|
|
249
|
-
"type": "string",
|
|
250
|
-
"description": "Editor-specific classnames to apply if all conditions match. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply."
|
|
249
|
+
"type": ["string", "array"],
|
|
250
|
+
"description": "Editor-specific classnames to apply if all conditions match. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
251
251
|
}
|
|
252
252
|
},
|
|
253
253
|
"required": [
|
|
@@ -270,12 +270,12 @@
|
|
|
270
270
|
"type": "object",
|
|
271
271
|
"properties": {
|
|
272
272
|
"twClasses": {
|
|
273
|
-
"type": "string",
|
|
274
|
-
"description": "Classnames to apply."
|
|
273
|
+
"type": ["string", "array"],
|
|
274
|
+
"description": "Classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
275
275
|
},
|
|
276
276
|
"twClassesEditor": {
|
|
277
|
-
"type": "string",
|
|
278
|
-
"description": "Editor-specific classnames to apply. Overrides 'twClasses'."
|
|
277
|
+
"type": ["string", "array"],
|
|
278
|
+
"description": "Editor-specific classnames to apply. Overrides 'twClasses'. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
},
|
|
@@ -284,16 +284,16 @@
|
|
|
284
284
|
"properties": {
|
|
285
285
|
"twClasses": {
|
|
286
286
|
"type": "object",
|
|
287
|
-
"description": "Classnames to apply. Key is the attribute value, value is the classnames to apply.",
|
|
287
|
+
"description": "Classnames to apply. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability.",
|
|
288
288
|
"additionalProperties": {
|
|
289
|
-
"type": "string"
|
|
289
|
+
"type": ["string", "array"]
|
|
290
290
|
}
|
|
291
291
|
},
|
|
292
292
|
"twClassesEditor": {
|
|
293
293
|
"type": "object",
|
|
294
|
-
"description": "Editor-specific classnames to apply. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply.",
|
|
294
|
+
"description": "Editor-specific classnames to apply. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability.",
|
|
295
295
|
"additionalProperties": {
|
|
296
|
-
"type": "string"
|
|
296
|
+
"type": ["string", "array"]
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
299
|
"part": {
|
package/schemas/component.json
CHANGED
|
@@ -126,12 +126,12 @@
|
|
|
126
126
|
"description": "Base classes for the main part of the component.",
|
|
127
127
|
"properties": {
|
|
128
128
|
"twClasses": {
|
|
129
|
-
"type": "string",
|
|
130
|
-
"description": "Classnames to apply."
|
|
129
|
+
"type": ["string", "array"],
|
|
130
|
+
"description": "Classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
131
131
|
},
|
|
132
132
|
"twClassesEditor": {
|
|
133
|
-
"type": "string",
|
|
134
|
-
"description": "Editor-specific classnames to apply. Overrides 'twClasses'"
|
|
133
|
+
"type": ["string", "array"],
|
|
134
|
+
"description": "Editor-specific classnames to apply. Overrides 'twClasses'. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
"minProperties": 1
|
|
@@ -180,12 +180,12 @@
|
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
"twClasses": {
|
|
183
|
-
"type": "string",
|
|
184
|
-
"description": "Classnames to apply if all conditions match. Key is the attribute value, value is the classnames to apply."
|
|
183
|
+
"type": ["string", "array"],
|
|
184
|
+
"description": "Classnames to apply if all conditions match. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
185
185
|
},
|
|
186
186
|
"twClassesEditor": {
|
|
187
|
-
"type": "string",
|
|
188
|
-
"description": "Editor-specific classnames to apply if all conditions match. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply."
|
|
187
|
+
"type": ["string", "array"],
|
|
188
|
+
"description": "Editor-specific classnames to apply if all conditions match. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
"required": [
|
|
@@ -208,12 +208,12 @@
|
|
|
208
208
|
"type": "object",
|
|
209
209
|
"properties": {
|
|
210
210
|
"twClasses": {
|
|
211
|
-
"type": "string",
|
|
212
|
-
"description": "Classnames to apply."
|
|
211
|
+
"type": ["string", "array"],
|
|
212
|
+
"description": "Classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
213
213
|
},
|
|
214
214
|
"twClassesEditor": {
|
|
215
|
-
"type": "string",
|
|
216
|
-
"description": "Editor-specific classnames to apply. Overrides 'twClasses'."
|
|
215
|
+
"type": ["string", "array"],
|
|
216
|
+
"description": "Editor-specific classnames to apply. Overrides 'twClasses'. An array of classnames (strings) can also be provided for improved manifest readability."
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
},
|
|
@@ -222,21 +222,21 @@
|
|
|
222
222
|
"properties": {
|
|
223
223
|
"twClasses": {
|
|
224
224
|
"type": "object",
|
|
225
|
-
"description": "Classnames to apply. Key is the attribute value, value is the classnames to apply.",
|
|
225
|
+
"description": "Classnames to apply. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability.",
|
|
226
226
|
"additionalProperties": {
|
|
227
|
-
"type": "string"
|
|
227
|
+
"type": ["string", "array"]
|
|
228
228
|
}
|
|
229
229
|
},
|
|
230
230
|
"twClassesEditor": {
|
|
231
231
|
"type": "object",
|
|
232
|
-
"description": "Editor-specific classnames to apply. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply.",
|
|
232
|
+
"description": "Editor-specific classnames to apply. Overrides 'twClasses'. Key is the attribute value, value is the classnames to apply. An array of classnames (strings) can also be provided for improved manifest readability.",
|
|
233
233
|
"additionalProperties": {
|
|
234
|
-
"type": "string"
|
|
234
|
+
"type": ["string", "array"]
|
|
235
235
|
}
|
|
236
236
|
},
|
|
237
237
|
"part": {
|
|
238
|
-
"type": "string",
|
|
239
|
-
"description": "Part to assign the class output to. If not specified, the classes are added to the base class."
|
|
238
|
+
"type": ["string", "array"],
|
|
239
|
+
"description": "Part to assign the class output to. If not specified, the classes are added to the base class. You can also specify an array of parts to apply the classes to."
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -44,7 +44,10 @@ export const BlockInserter = (props) => {
|
|
|
44
44
|
let labelText = label;
|
|
45
45
|
|
|
46
46
|
if (label === true) {
|
|
47
|
-
labelText = sprintf(
|
|
47
|
+
labelText = sprintf(
|
|
48
|
+
__('Add %s', 'eightshift-frontend-libs'),
|
|
49
|
+
hasSingleBlockType ? blockTitle : __('a block', 'eightshift-frontend-libs'),
|
|
50
|
+
);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
return (
|
|
@@ -9,18 +9,18 @@ import { icons } from '@eightshift/ui-components/icons';
|
|
|
9
9
|
*
|
|
10
10
|
* @component
|
|
11
11
|
* @param {Object} props - Component props.
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
12
|
+
* @param {ManageFileButtonType} [props.type] - The type of the button (browse, upload, replace).
|
|
13
|
+
* @param {Function} props.onChange - Function that handles the change event.
|
|
14
|
+
* @param {string} [props.currentId] - ID of the currently selected item. Used for the 'replace' type, to mark the currently selected item.
|
|
15
|
+
* @param {boolean} [props.compact] - Whether the button is compact (icon-only).
|
|
16
|
+
* @param {string[]} props.allowedTypes - Determines types of files which are allowed to be uploaded.
|
|
17
|
+
* @param {ManageFileButtonKind} [props.kind] - The kind of file to manage. Controls labels and icons on the buttons.
|
|
18
|
+
* @param {Object} [props.labels] - Custom UI labels for the buttons. Applies only if `kind` is set to `custom`.
|
|
19
19
|
*
|
|
20
20
|
* @returns {JSX.Element} The ManageFileButton component.
|
|
21
21
|
*
|
|
22
22
|
* @typedef {'browse' | 'upload' | 'replace'} ManageFileButtonType
|
|
23
|
-
* @typedef {'file' | 'image' | 'video' | 'subtitle' | 'geoJson' | 'custom'} ManageFileButtonKind
|
|
23
|
+
* @typedef {'file' | 'image' | 'video' | 'subtitle' | 'geoJson' | 'lottie' | 'custom'} ManageFileButtonKind
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* <ManageFileButton />
|
|
@@ -111,6 +111,18 @@ export const ManageFileButton = (props) => {
|
|
|
111
111
|
replace: __('Select a new GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
|
+
lottie: {
|
|
115
|
+
buttonTooltip: {
|
|
116
|
+
browse: __('Select a Lottie animation', 'eightshift-frontend-libs-tailwind'),
|
|
117
|
+
upload: __('Upload a Lottie animation', 'eightshift-frontend-libs-tailwind'),
|
|
118
|
+
replace: __('Replace Lottie animation', 'eightshift-frontend-libs-tailwind'),
|
|
119
|
+
},
|
|
120
|
+
modalTitle: {
|
|
121
|
+
browse: __('Select a Lottie animation', 'eightshift-frontend-libs-tailwind'),
|
|
122
|
+
upload: __('Upload a Lottie animation', 'eightshift-frontend-libs-tailwind'),
|
|
123
|
+
replace: __('Select a new Lottie animation', 'eightshift-frontend-libs-tailwind'),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
114
126
|
custom: {
|
|
115
127
|
buttonTooltip: labels?.buttonTooltip,
|
|
116
128
|
buttonLabel: labels?.buttonLabel,
|
|
@@ -151,18 +163,18 @@ export const ManageFileButton = (props) => {
|
|
|
151
163
|
*
|
|
152
164
|
* @component
|
|
153
165
|
* @param {Object} props - Component props.
|
|
154
|
-
* @
|
|
155
|
-
* @
|
|
156
|
-
* @
|
|
157
|
-
* @
|
|
158
|
-
* @
|
|
159
|
-
* @
|
|
160
|
-
* @
|
|
161
|
-
* @
|
|
166
|
+
* @param {Function} props.onChange - The function that handles the change event.
|
|
167
|
+
* @param {string} props.fileId - ID of the currently selected file. Used to mark the currently selected item when replacing the file.
|
|
168
|
+
* @param {string} props.fileName - URL of the currently selected image.
|
|
169
|
+
* @param {boolean} [props.noDelete] - If `true`, the delete button will be hidden.
|
|
170
|
+
* @param {boolean} [props.noUpload] - If `true`, the upload button will be hidden.
|
|
171
|
+
* @param {string[]} props.allowedTypes - Determines types of files which are allowed to be uploaded.
|
|
172
|
+
* @param {FileKind} [props.kind] - The kind of file to manage.
|
|
173
|
+
* @param {Object} [props.labels] - Custom UI labels for the buttons. Applies only if `kind` is set to `custom`.
|
|
162
174
|
*
|
|
163
175
|
* @returns {JSX.Element} The FileSelector component.
|
|
164
176
|
*
|
|
165
|
-
* @typedef {'file' | 'image' | 'video' | 'subtitle' | 'geoJson' | 'custom'} FileKind
|
|
177
|
+
* @typedef {'file' | 'image' | 'video' | 'subtitle' | 'geoJson' | 'lottie' | 'custom'} FileKind
|
|
166
178
|
*
|
|
167
179
|
* @example
|
|
168
180
|
* <FileSelector
|
|
@@ -189,6 +201,7 @@ export const FileSelector = (props) => {
|
|
|
189
201
|
video: __('Remove video', 'eightshift-frontend-libs-tailwind'),
|
|
190
202
|
subtitle: __('Remove subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
191
203
|
geoJson: __('Remove GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
204
|
+
lottie: __('Remove Lottie animation', 'eightshift-frontend-libs-tailwind'),
|
|
192
205
|
custom: labels?.removeTooltip,
|
|
193
206
|
};
|
|
194
207
|
|
|
@@ -197,6 +210,7 @@ export const FileSelector = (props) => {
|
|
|
197
210
|
video: icons.videoFile,
|
|
198
211
|
subtitle: icons.closedCaptions,
|
|
199
212
|
geoJson: icons.fileMetadata,
|
|
213
|
+
lottie: icons.animationFile,
|
|
200
214
|
custom: labels?.removeIcon,
|
|
201
215
|
};
|
|
202
216
|
|
|
@@ -236,7 +236,11 @@ export const LinkSectionEditor = (props) => {
|
|
|
236
236
|
setTimeout(() => {
|
|
237
237
|
target.parentElement.nextElementSibling?.querySelector('[contenteditable="true"]')?.focus();
|
|
238
238
|
}, 25);
|
|
239
|
-
} else if (
|
|
239
|
+
} else if (
|
|
240
|
+
code === 'Backspace' &&
|
|
241
|
+
header === '' &&
|
|
242
|
+
(items?.length < 1 || items?.every(({ text }) => text === ''))
|
|
243
|
+
) {
|
|
240
244
|
event.preventDefault();
|
|
241
245
|
|
|
242
246
|
// Jump to end of previous input.
|
|
@@ -2,14 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { Button, HStack, ImagePlaceholder } from '@eightshift/ui-components';
|
|
4
4
|
import { icons } from '@eightshift/ui-components/icons';
|
|
5
|
-
import { ManageFileButton } from '
|
|
5
|
+
import { ManageFileButton } from './file-picker';
|
|
6
6
|
|
|
7
7
|
const MediaButton = (props) => {
|
|
8
8
|
return (
|
|
9
9
|
<ManageFileButton
|
|
10
10
|
{...props}
|
|
11
11
|
kind='image'
|
|
12
|
-
allowedTypes={['image']}
|
|
13
12
|
/>
|
|
14
13
|
);
|
|
15
14
|
};
|
|
@@ -19,13 +18,16 @@ const MediaButton = (props) => {
|
|
|
19
18
|
*
|
|
20
19
|
* @component
|
|
21
20
|
* @param {Object} props - Component props.
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
24
|
-
* @
|
|
25
|
-
* @
|
|
26
|
-
* @
|
|
27
|
-
* @
|
|
21
|
+
* @param {Function} props.onChange - The function that handles the change event.
|
|
22
|
+
* @param {string} props.imageId - ID of the currently selected image. Used to mark the currently selected item when replacing the image.
|
|
23
|
+
* @param {string} props.imageAlt - Alt text of the currently selected image.
|
|
24
|
+
* @param {string} props.imageUrl - URL of the currently selected image.
|
|
25
|
+
* @param {boolean} [props.noDelete] - If `true`, the delete button will be hidden.
|
|
26
|
+
* @param {boolean} [props.noUpload] - If `true`, the upload button will be hidden.
|
|
28
27
|
* @param {ImagePlaceholderImageMode} [props.imageMode='cover'] - Determines inner image display mode.
|
|
28
|
+
* @param {boolean} [props.hidden] - If `true`, the component will be hidden.
|
|
29
|
+
* @param {string[]} [props.allowedTypes=['image']] - Determines types of files which are allowed to be uploaded.
|
|
30
|
+
* @param {string} [props.className] - Classes to add to the button wrapper.
|
|
29
31
|
*
|
|
30
32
|
* @returns {JSX.Element} The MediaPicker component.
|
|
31
33
|
*
|
|
@@ -41,10 +43,28 @@ const MediaButton = (props) => {
|
|
|
41
43
|
*
|
|
42
44
|
*/
|
|
43
45
|
export const MediaPicker = (props) => {
|
|
44
|
-
const {
|
|
46
|
+
const {
|
|
47
|
+
onChange,
|
|
48
|
+
imageId,
|
|
49
|
+
imageAlt,
|
|
50
|
+
imageUrl,
|
|
51
|
+
noDelete,
|
|
52
|
+
noUpload,
|
|
53
|
+
imageMode,
|
|
54
|
+
hidden,
|
|
55
|
+
allowedTypes = ['image'],
|
|
56
|
+
className,
|
|
57
|
+
} = props;
|
|
58
|
+
|
|
59
|
+
if (hidden) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
45
62
|
|
|
46
63
|
return (
|
|
47
|
-
<HStack
|
|
64
|
+
<HStack
|
|
65
|
+
className={className}
|
|
66
|
+
noWrap
|
|
67
|
+
>
|
|
48
68
|
<ImagePlaceholder
|
|
49
69
|
url={imageUrl}
|
|
50
70
|
alt={imageAlt}
|
|
@@ -53,11 +73,15 @@ export const MediaPicker = (props) => {
|
|
|
53
73
|
|
|
54
74
|
{!imageUrl && (
|
|
55
75
|
<>
|
|
56
|
-
<MediaButton
|
|
76
|
+
<MediaButton
|
|
77
|
+
onChange={onChange}
|
|
78
|
+
allowedTypes={allowedTypes}
|
|
79
|
+
/>
|
|
57
80
|
{!noUpload && (
|
|
58
81
|
<MediaButton
|
|
59
82
|
onChange={onChange}
|
|
60
83
|
type='upload'
|
|
84
|
+
allowedTypes={allowedTypes}
|
|
61
85
|
compact
|
|
62
86
|
/>
|
|
63
87
|
)}
|
|
@@ -70,6 +94,7 @@ export const MediaPicker = (props) => {
|
|
|
70
94
|
type='replace'
|
|
71
95
|
onChange={onChange}
|
|
72
96
|
imageId={imageId}
|
|
97
|
+
allowedTypes={allowedTypes}
|
|
73
98
|
/>
|
|
74
99
|
{!noDelete && (
|
|
75
100
|
<Button
|
|
@@ -74,7 +74,9 @@ export const PickerPlaceholder = (props) => {
|
|
|
74
74
|
<Button
|
|
75
75
|
key={index}
|
|
76
76
|
onPress={async () => {
|
|
77
|
-
const blocksToInsert = blockData.map(({ name: blockName, attributes: blockAttrs }) =>
|
|
77
|
+
const blocksToInsert = blockData.map(({ name: blockName, attributes: blockAttrs }) =>
|
|
78
|
+
createBlock(blockName, blockAttrs),
|
|
79
|
+
);
|
|
78
80
|
|
|
79
81
|
onChange(attrsToSet);
|
|
80
82
|
|
|
@@ -90,7 +92,9 @@ export const PickerPlaceholder = (props) => {
|
|
|
90
92
|
|
|
91
93
|
{inserter && (
|
|
92
94
|
<>
|
|
93
|
-
<span className='es-uic-col-span-2 es-uic-select-none es-uic-justify-self-center'>
|
|
95
|
+
<span className='es-uic-col-span-2 es-uic-select-none es-uic-justify-self-center'>
|
|
96
|
+
{__('or', 'fe-libs-tailwind')}
|
|
97
|
+
</span>
|
|
94
98
|
|
|
95
99
|
<div className='es-uic-col-span-2 es-uic-justify-self-center'>
|
|
96
100
|
{inserter}
|
|
@@ -29,7 +29,10 @@ export const ServerSideRender = (props) => {
|
|
|
29
29
|
{...rest}
|
|
30
30
|
block={block}
|
|
31
31
|
attributes={attributes}
|
|
32
|
-
className={clsx(
|
|
32
|
+
className={clsx(
|
|
33
|
+
'es-uic-pointer-events-none es-uic-rounded-lg es-uic-border es-uic-border-dotted es-uic-border-gray-300 es-uic-p-2 es-uic-flow-root',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
33
36
|
/>
|
|
34
37
|
);
|
|
35
38
|
};
|