@eightshift/frontend-libs-tailwind 1.2.0 → 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 +8 -0
- 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/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/modal/assets/index.js +9 -7
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +3 -1
- package/blocks/init/src/Blocks/components/share/assets/index.js +5 -1
- package/blocks/init/src/Blocks/components/share/components/share-options.js +11 -2
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +4 -2
- package/blocks/init/src/Blocks/components/video/components/video-options.js +24 -3
- 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/featured-content/components/featured-content-options.js +29 -8
- 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/wrapper/components/wrapper-options.js +19 -4
- package/bun.lockb +0 -0
- package/package.json +15 -15
- package/schemas/block.json +16 -16
- package/schemas/component.json +18 -18
- package/scripts/components/block-inserter.js +4 -1
- package/scripts/components/link-section-editor.js +5 -1
- package/scripts/components/media-picker.js +12 -1
- 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 +2 -1
- 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
2
|
import { checkAttr, getAttrKey, getHiddenOptions, getOption } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import {
|
|
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';
|
|
@@ -113,7 +122,9 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
113
122
|
setAttributes({ [getAttrKey('wrapperBackground', attributes, manifest)]: undefined });
|
|
114
123
|
} else {
|
|
115
124
|
setAttributes({
|
|
116
|
-
[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)),
|
|
117
128
|
});
|
|
118
129
|
}
|
|
119
130
|
}}
|
|
@@ -126,7 +137,9 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
126
137
|
{backgroundType === 'solid' && (
|
|
127
138
|
<ColorPicker
|
|
128
139
|
colors={getColorOption('wrapperBackgroundSolid', manifest)}
|
|
129
|
-
onChange={(value) =>
|
|
140
|
+
onChange={(value) =>
|
|
141
|
+
setAttributes({ [getAttrKey('wrapperBackground', attributes, manifest)]: `solid-${value}` })
|
|
142
|
+
}
|
|
130
143
|
value={wrapperBackground?.replace('solid-', '')}
|
|
131
144
|
aria-label={__('Background color', '%g_textdomain%')}
|
|
132
145
|
hidden={hiddenOptions?.backgroundType}
|
|
@@ -165,7 +178,9 @@ export const WrapperOptions = ({ attributes, setAttributes }) => {
|
|
|
165
178
|
/>
|
|
166
179
|
<OptionSelect
|
|
167
180
|
value={wrapperGradientDirection}
|
|
168
|
-
onChange={(value) =>
|
|
181
|
+
onChange={(value) =>
|
|
182
|
+
setAttributes({ [getAttrKey('wrapperGradientDirection', attributes, manifest)]: value })
|
|
183
|
+
}
|
|
169
184
|
options={getOption('wrapperGradientDirection', attributes, manifest)}
|
|
170
185
|
wrapperProps={{
|
|
171
186
|
triggerIcon: <div className={rotationClassName[wrapperGradientDirection]}>{icons.arrowUpCircle}</div>,
|
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,32 +34,32 @@
|
|
|
34
34
|
"homepage": "https://github.com/infinum/eightshift-frontend-libs-tailwind#readme",
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@eightshift/ui-components": "^1.4.
|
|
38
|
-
"@stylistic/eslint-plugin-js": "^2.6.
|
|
39
|
-
"@stylistic/stylelint-plugin": "^3.0.
|
|
40
|
-
"@swc/core": "^1.7.
|
|
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
41
|
"@wordpress/api-fetch": "^7.5.0",
|
|
42
|
-
"@wordpress/block-editor": "^
|
|
42
|
+
"@wordpress/block-editor": "^14.0.0",
|
|
43
43
|
"@wordpress/dependency-extraction-webpack-plugin": "^5.9.0",
|
|
44
44
|
"@wordpress/dom-ready": "^4.5.0",
|
|
45
45
|
"@wordpress/server-side-render": "^5.5.0",
|
|
46
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
51
|
"eslint-plugin-prettier": "^5.2.1",
|
|
52
52
|
"file-loader": "^6.2.0",
|
|
53
53
|
"globals": "^15.9.0",
|
|
54
|
-
"husky": "^9.1.
|
|
54
|
+
"husky": "^9.1.5",
|
|
55
55
|
"lightningcss": "^1.26.0",
|
|
56
|
-
"mini-css-extract-plugin": "^2.9.
|
|
56
|
+
"mini-css-extract-plugin": "^2.9.1",
|
|
57
57
|
"postcss": "^8.4.41",
|
|
58
58
|
"postcss-loader": "^8.1.1",
|
|
59
59
|
"prettier": "^3.3.3",
|
|
60
|
-
"prettier-plugin-tailwindcss": "^0.6.
|
|
60
|
+
"prettier-plugin-tailwindcss": "^0.6.6",
|
|
61
61
|
"sonner": "^1.5.0",
|
|
62
|
-
"stylelint": "^16.8.
|
|
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",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"webpack-merge": "^6.0.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"embla-carousel": "^8.
|
|
72
|
+
"embla-carousel": "^8.2.0",
|
|
73
73
|
"fluid-tailwind": "^1.0.3",
|
|
74
|
-
"lint-staged": "^15.2.
|
|
74
|
+
"lint-staged": "^15.2.9",
|
|
75
75
|
"micromodal": "^0.4.10",
|
|
76
76
|
"ol": "^10.0.0",
|
|
77
|
-
"ol-mapbox-style": "^12.3.
|
|
78
|
-
"tailwindcss": "^3.4.
|
|
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 (
|
|
@@ -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.
|
|
@@ -43,7 +43,18 @@ const MediaButton = (props) => {
|
|
|
43
43
|
*
|
|
44
44
|
*/
|
|
45
45
|
export const MediaPicker = (props) => {
|
|
46
|
-
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;
|
|
47
58
|
|
|
48
59
|
if (hidden) {
|
|
49
60
|
return null;
|
|
@@ -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
|
};
|
|
@@ -10,7 +10,11 @@ import { useThemeOptions } from './use-theme-options';
|
|
|
10
10
|
|
|
11
11
|
export const EsThemeOptionsContext = createContext(null);
|
|
12
12
|
|
|
13
|
-
export const ThemeOptionsPage = ({
|
|
13
|
+
export const ThemeOptionsPage = ({
|
|
14
|
+
title = __('Theme options', 'eightshift-frontend-libs-tailwind'),
|
|
15
|
+
children,
|
|
16
|
+
settingName = 'eightshift-theme-options',
|
|
17
|
+
}) => {
|
|
14
18
|
const themeOptions = useThemeOptions(settingName);
|
|
15
19
|
const { isLoading, saveSettings } = themeOptions;
|
|
16
20
|
|
|
@@ -26,7 +30,9 @@ export const ThemeOptionsPage = ({ title = __('Theme options', 'eightshift-front
|
|
|
26
30
|
disabled={isLoading}
|
|
27
31
|
icon={isLoading ? icons.moreH : icons.save}
|
|
28
32
|
>
|
|
29
|
-
{isLoading
|
|
33
|
+
{isLoading
|
|
34
|
+
? __('Saving...', 'eightshift-frontend-libs-tailwind')
|
|
35
|
+
: __('Save', 'eightshift-frontend-libs-tailwind')}
|
|
30
36
|
</Button>
|
|
31
37
|
</HStack>
|
|
32
38
|
|
|
@@ -109,15 +109,20 @@ export const checkAttr = (key, attributes, manifest, undefinedAllowed = false) =
|
|
|
109
109
|
let tipOutput = '';
|
|
110
110
|
|
|
111
111
|
if ('components' in manifest) {
|
|
112
|
-
tipOutput =
|
|
112
|
+
tipOutput =
|
|
113
|
+
' If you are using additional components, check if you used the correct block/component prefix in your attribute name.';
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
// Bailout if key is missing.
|
|
116
117
|
if (typeof manifestKey === 'undefined') {
|
|
117
118
|
if ('blockName' in manifest) {
|
|
118
|
-
throw Error(
|
|
119
|
+
throw Error(
|
|
120
|
+
`${key} key does not exist in the ${manifest.blockName} block manifest. Please check your implementation.${tipOutput}`,
|
|
121
|
+
);
|
|
119
122
|
} else {
|
|
120
|
-
throw Error(
|
|
123
|
+
throw Error(
|
|
124
|
+
`${key} key does not exist in the ${manifest.componentName} component manifest. Please check your implementation.${tipOutput}`,
|
|
125
|
+
);
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
128
|
|
package/scripts/editor/editor.js
CHANGED
|
@@ -105,7 +105,13 @@ export const lockIfUndefined = (blockClientId, attributeKey, value) => {
|
|
|
105
105
|
*
|
|
106
106
|
*/
|
|
107
107
|
export const GutenbergBlock = (props) => {
|
|
108
|
-
const {
|
|
108
|
+
const {
|
|
109
|
+
options: OptionsComponent,
|
|
110
|
+
toolbar: ToolbarComponent,
|
|
111
|
+
editor: EditorComponent,
|
|
112
|
+
noOptionsContainer = false,
|
|
113
|
+
title,
|
|
114
|
+
} = props;
|
|
109
115
|
|
|
110
116
|
return (
|
|
111
117
|
<>
|
package/scripts/editor/fetch.js
CHANGED
|
@@ -83,7 +83,8 @@ export function fetchFromWpRest(endpoint, options = {}) {
|
|
|
83
83
|
|
|
84
84
|
return newData.map((item) => {
|
|
85
85
|
const rawLabel = !noUnescapeTitle ? unescapeHTML(processLabel(item)) : processLabel(item);
|
|
86
|
-
const truncatedLabel =
|
|
86
|
+
const truncatedLabel =
|
|
87
|
+
Number.isInteger(truncateTitle) && truncateTitle > 0 ? truncate(rawLabel, truncateTitle) : rawLabel;
|
|
87
88
|
|
|
88
89
|
return {
|
|
89
90
|
label: truncatedLabel,
|
package/scripts/editor/index.js
CHANGED
|
@@ -7,5 +7,12 @@ export * from './fetch';
|
|
|
7
7
|
export * from './options';
|
|
8
8
|
export * from './utility';
|
|
9
9
|
export * from './tailwindcss';
|
|
10
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
getAttributes,
|
|
12
|
+
getExample,
|
|
13
|
+
getFullBlockName,
|
|
14
|
+
getFullBlockNameVariation,
|
|
15
|
+
registerBlocks,
|
|
16
|
+
registerVariations,
|
|
17
|
+
} from './registration';
|
|
11
18
|
export { STORE_NAME, BUILD_VERSION, setStore, setStoreGlobalWindow, setConfigFlags } from './store';
|
|
@@ -46,7 +46,9 @@ export const getOption = (key, attributes, manifest, isColor = false) => {
|
|
|
46
46
|
const componentOptions = manifest?.options;
|
|
47
47
|
|
|
48
48
|
// Determine if this is component or block and provide the name, not used for anything important but only to output the error msg.
|
|
49
|
-
const name = Object.prototype.hasOwnProperty.call(manifest, 'blockName')
|
|
49
|
+
const name = Object.prototype.hasOwnProperty.call(manifest, 'blockName')
|
|
50
|
+
? manifest.blockName
|
|
51
|
+
: manifest.componentName;
|
|
50
52
|
|
|
51
53
|
// Bailout if componentOptions is missing.
|
|
52
54
|
if (typeof componentOptions === 'undefined') {
|