@eightshift/frontend-libs-tailwind 1.0.0 → 1.1.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/.husky/pre-commit +0 -0
- package/CHANGELOG.md +15 -1
- package/blocks/init/assets/fonts/fraunces-italic-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-italic-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-italic-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-italic-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-latin.woff2 +0 -0
- package/blocks/init/src/Blocks/assets/scripts/shared.js +1 -3
- package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +1 -1
- package/blocks/init/src/Blocks/assets/styles/fonts.css +90 -0
- package/blocks/init/src/Blocks/assets/styles/tailwind.css +1 -5
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +1 -0
- package/blocks/init/src/Blocks/components/button/components/button-editor.js +1 -5
- package/blocks/init/src/Blocks/components/button/components/button-options.js +2 -21
- package/blocks/init/src/Blocks/components/button/manifest.json +8 -8
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +1 -2
- package/blocks/init/src/Blocks/components/card/components/card-options.js +0 -1
- package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +1 -5
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +1 -7
- package/blocks/init/src/Blocks/components/image/components/image-options.js +3 -17
- package/blocks/init/src/Blocks/components/list/components/list-options.js +1 -3
- package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +1 -2
- package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +1 -0
- package/blocks/init/src/Blocks/components/modal/assets/index.js +7 -9
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +1 -3
- package/blocks/init/src/Blocks/components/paragraph/manifest.json +14 -16
- package/blocks/init/src/Blocks/components/post-header/post-header.php +1 -1
- package/blocks/init/src/Blocks/components/share/assets/index.js +1 -5
- package/blocks/init/src/Blocks/components/share/components/share-editor.js +7 -4
- package/blocks/init/src/Blocks/components/share/components/share-options.js +2 -11
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +2 -4
- package/blocks/init/src/Blocks/components/video/components/video-options.js +5 -27
- package/blocks/init/src/Blocks/custom/accordion/assets/index.js +1 -1
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +6 -1
- package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +3 -8
- package/blocks/init/src/Blocks/custom/column/components/column-editor.js +4 -1
- package/blocks/init/src/Blocks/custom/column/components/column-options.js +5 -12
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +2 -6
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +18 -30
- package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +5 -5
- package/blocks/init/src/Blocks/custom/group/components/group-editor.js +1 -3
- package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +1 -0
- package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +0 -1
- package/blocks/init/src/Blocks/custom/map/components/map-components.js +3 -3
- package/blocks/init/src/Blocks/custom/map/components/map-editor.js +2 -12
- package/blocks/init/src/Blocks/custom/map/components/map-options.js +10 -46
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +1 -0
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +1 -3
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +1 -1
- package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +4 -19
- package/blocks/init/src/Blocks/wrapper/wrapper.js +1 -4
- package/linters/base.config.mjs +1 -1
- package/linters/eslint.config.mjs +1 -2
- package/linters/stylelint.config.js +9 -13
- package/package.json +92 -92
- package/schemas/block.json +4 -0
- package/schemas/component.json +4 -0
- package/scripts/components/block-inserter.js +8 -14
- package/scripts/components/file-picker.js +42 -39
- package/scripts/components/index.js +1 -0
- package/scripts/components/link-section-editor.js +6 -2
- package/scripts/components/picker-placeholder.js +109 -0
- package/scripts/components/server-side-render.js +2 -4
- package/scripts/components/settings/settings.js +3 -14
- package/scripts/components/settings/use-theme-options.js +2 -2
- package/scripts/editor/attributes.js +3 -9
- package/scripts/editor/colors.js +43 -41
- package/scripts/editor/editor.js +9 -16
- package/scripts/editor/fetch.js +26 -19
- package/scripts/editor/hooks.js +1 -0
- package/scripts/editor/options.js +2 -4
- package/scripts/editor/registration.js +51 -128
- package/scripts/editor/tailwindcss.js +118 -37
- package/scripts/helpers/breakpoints.js +3 -8
- package/scripts/helpers/cookies.js +2 -1
- package/scripts/helpers/index.js +1 -7
- package/scripts/index.js +2 -0
- package/scripts/plugins/yoast-seo.js +2 -3
- package/linters/ignore-gitignored.mjs +0 -9
package/package.json
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
2
|
+
"name": "@eightshift/frontend-libs-tailwind",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Eightshift team",
|
|
7
|
+
"email": "team@eightshift.com",
|
|
8
|
+
"url": "https://eightshift.com/"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/infinum/eightshift-frontend-libs-tailwind.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"frontend",
|
|
16
|
+
"css",
|
|
17
|
+
"mixin",
|
|
18
|
+
"js",
|
|
19
|
+
"utility",
|
|
20
|
+
"module",
|
|
21
|
+
"WordPress",
|
|
22
|
+
"tailwind",
|
|
23
|
+
"TailwindCSS"
|
|
24
|
+
],
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/infinum/eightshift-frontend-libs-tailwind/issues"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"lintStyle": "stylelint **/*.css",
|
|
30
|
+
"lintJs": "npx eslint",
|
|
31
|
+
"lint": "npm run lintJs && npm run lintStyle",
|
|
32
|
+
"prepare": "husky"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/infinum/eightshift-frontend-libs-tailwind#readme",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@eightshift/ui-components": "^1.2.2",
|
|
38
|
+
"@stylistic/eslint-plugin-js": "^2.3.0",
|
|
39
|
+
"@stylistic/stylelint-plugin": "^2.1.2",
|
|
40
|
+
"@swc/core": "^1.6.13",
|
|
41
|
+
"@wordpress/api-fetch": "^7.2.0",
|
|
42
|
+
"@wordpress/block-editor": "^13.2.0",
|
|
43
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^5.9.0",
|
|
44
|
+
"@wordpress/dom-ready": "^4.2.0",
|
|
45
|
+
"@wordpress/server-side-render": "^5.2.0",
|
|
46
|
+
"browserslist": "^4.23.1",
|
|
47
|
+
"css-loader": "^7.1.2",
|
|
48
|
+
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
49
|
+
"eslint": "^9.6.0",
|
|
50
|
+
"eslint-config-prettier": "^9.1.0",
|
|
51
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
52
|
+
"file-loader": "^6.2.0",
|
|
53
|
+
"globals": "^15.8.0",
|
|
54
|
+
"husky": "^9.0.11",
|
|
55
|
+
"lightningcss": "^1.25.1",
|
|
56
|
+
"mini-css-extract-plugin": "^2.9.0",
|
|
57
|
+
"postcss": "^8.4.39",
|
|
58
|
+
"postcss-loader": "^8.1.1",
|
|
59
|
+
"prettier": "^3.3.2",
|
|
60
|
+
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
61
|
+
"sonner": "^1.5.0",
|
|
62
|
+
"stylelint": "^16.6.1",
|
|
63
|
+
"stylelint-config-standard": "^36.0.1",
|
|
64
|
+
"swc-loader": "^0.2.6",
|
|
65
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
66
|
+
"webpack": "^5.92.1",
|
|
67
|
+
"webpack-cli": "^5.1.4",
|
|
68
|
+
"webpack-manifest-plugin": "^5.0.0",
|
|
69
|
+
"webpack-merge": "^6.0.1"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"embla-carousel": "^8.1.6",
|
|
73
|
+
"fluid-tailwind": "^1.0.2",
|
|
74
|
+
"lint-staged": "^15.2.7",
|
|
75
|
+
"micromodal": "^0.4.10",
|
|
76
|
+
"ol": "^9.2.4",
|
|
77
|
+
"ol-mapbox-style": "^12.3.4",
|
|
78
|
+
"tailwindcss": "^3.4.4",
|
|
79
|
+
"tailwindcss-animate": "^1.0.7"
|
|
80
|
+
},
|
|
81
|
+
"sideEffects": false,
|
|
82
|
+
"lint-staged": {
|
|
83
|
+
"*.css": [
|
|
84
|
+
"npm run lintStyle"
|
|
85
|
+
],
|
|
86
|
+
"*.js": [
|
|
87
|
+
"npm run lintJs"
|
|
88
|
+
],
|
|
89
|
+
"*.php": [
|
|
90
|
+
"composer test"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
}
|
package/schemas/block.json
CHANGED
package/schemas/component.json
CHANGED
|
@@ -15,6 +15,7 @@ import { clsx } from '@eightshift/ui-components/utilities';
|
|
|
15
15
|
* @param {boolean} [props.small] - If `true`, the button's size is reduced, perfect for added visual separation in hierarchical InnerBlocks.
|
|
16
16
|
* @param {string} [props.className] - Additional classes to add to the control base.
|
|
17
17
|
* @param {boolean} [props.prioritizePatterns] - Whether to show patterns before blocks in the inserter.
|
|
18
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
18
19
|
*
|
|
19
20
|
* @returns {JSX.Element} The BlockInserter component.
|
|
20
21
|
*
|
|
@@ -24,13 +25,11 @@ import { clsx } from '@eightshift/ui-components/utilities';
|
|
|
24
25
|
* @preserve
|
|
25
26
|
*/
|
|
26
27
|
export const BlockInserter = (props) => {
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
prioritizePatterns = false,
|
|
33
|
-
} = props;
|
|
28
|
+
const { clientId, label, small = false, className, prioritizePatterns = false, hidden } = props;
|
|
29
|
+
|
|
30
|
+
if (hidden) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
34
33
|
|
|
35
34
|
return (
|
|
36
35
|
<Inserter
|
|
@@ -40,12 +39,7 @@ export const BlockInserter = (props) => {
|
|
|
40
39
|
isAppender
|
|
41
40
|
isQuick
|
|
42
41
|
renderToggle={(appenderProps) => {
|
|
43
|
-
const {
|
|
44
|
-
onToggle,
|
|
45
|
-
disabled,
|
|
46
|
-
hasSingleBlockType,
|
|
47
|
-
blockTitle,
|
|
48
|
-
} = appenderProps;
|
|
42
|
+
const { onToggle, disabled, hasSingleBlockType, blockTitle } = appenderProps;
|
|
49
43
|
|
|
50
44
|
let labelText = label;
|
|
51
45
|
|
|
@@ -63,7 +57,7 @@ export const BlockInserter = (props) => {
|
|
|
63
57
|
>
|
|
64
58
|
{labelText}
|
|
65
59
|
</Button>
|
|
66
|
-
)
|
|
60
|
+
);
|
|
67
61
|
}}
|
|
68
62
|
/>
|
|
69
63
|
);
|
|
@@ -43,19 +43,19 @@ export const ManageFileButton = (props) => {
|
|
|
43
43
|
const strings = {
|
|
44
44
|
file: {
|
|
45
45
|
buttonTooltip: {
|
|
46
|
-
browse: __('Select a file from Media library', '
|
|
47
|
-
upload: __('Upload a file', '
|
|
48
|
-
replace: __('Replace file', '
|
|
46
|
+
browse: __('Select a file from Media library', 'eightshift-frontend-libs-tailwind'),
|
|
47
|
+
upload: __('Upload a file', 'eightshift-frontend-libs-tailwind'),
|
|
48
|
+
replace: __('Replace file', 'eightshift-frontend-libs-tailwind'),
|
|
49
49
|
},
|
|
50
50
|
buttonLabel: {
|
|
51
|
-
browse: __('Select', '
|
|
52
|
-
upload: __('Upload', '
|
|
53
|
-
replace: __('Replace', '
|
|
51
|
+
browse: __('Select', 'eightshift-frontend-libs-tailwind'),
|
|
52
|
+
upload: __('Upload', 'eightshift-frontend-libs-tailwind'),
|
|
53
|
+
replace: __('Replace', 'eightshift-frontend-libs-tailwind'),
|
|
54
54
|
},
|
|
55
55
|
modalTitle: {
|
|
56
|
-
browse: __('Select a file', '
|
|
57
|
-
upload: __('Upload a file', '
|
|
58
|
-
replace: __('Select a new file', '
|
|
56
|
+
browse: __('Select a file', 'eightshift-frontend-libs-tailwind'),
|
|
57
|
+
upload: __('Upload a file', 'eightshift-frontend-libs-tailwind'),
|
|
58
|
+
replace: __('Select a new file', 'eightshift-frontend-libs-tailwind'),
|
|
59
59
|
},
|
|
60
60
|
buttonIcon: {
|
|
61
61
|
browse: icons.itemSelect,
|
|
@@ -65,50 +65,50 @@ export const ManageFileButton = (props) => {
|
|
|
65
65
|
},
|
|
66
66
|
video: {
|
|
67
67
|
buttonTooltip: {
|
|
68
|
-
browse: __('Select a video from Media library', '
|
|
69
|
-
upload: __('Upload a video', '
|
|
70
|
-
replace: __('Replace video', '
|
|
68
|
+
browse: __('Select a video from Media library', 'eightshift-frontend-libs-tailwind'),
|
|
69
|
+
upload: __('Upload a video', 'eightshift-frontend-libs-tailwind'),
|
|
70
|
+
replace: __('Replace video', 'eightshift-frontend-libs-tailwind'),
|
|
71
71
|
},
|
|
72
72
|
modalTitle: {
|
|
73
|
-
browse: __('Select a video', '
|
|
74
|
-
upload: __('Upload a video', '
|
|
75
|
-
replace: __('Select a new video', '
|
|
73
|
+
browse: __('Select a video', 'eightshift-frontend-libs-tailwind'),
|
|
74
|
+
upload: __('Upload a video', 'eightshift-frontend-libs-tailwind'),
|
|
75
|
+
replace: __('Select a new video', 'eightshift-frontend-libs-tailwind'),
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
78
|
image: {
|
|
79
79
|
buttonTooltip: {
|
|
80
|
-
browse: __('Select an image from Media library', '
|
|
81
|
-
upload: __('Upload an image', '
|
|
82
|
-
replace: __('Replace image', '
|
|
80
|
+
browse: __('Select an image from Media library', 'eightshift-frontend-libs-tailwind'),
|
|
81
|
+
upload: __('Upload an image', 'eightshift-frontend-libs-tailwind'),
|
|
82
|
+
replace: __('Replace image', 'eightshift-frontend-libs-tailwind'),
|
|
83
83
|
},
|
|
84
84
|
modalTitle: {
|
|
85
|
-
browse: __('Select an image', '
|
|
86
|
-
upload: __('Upload an image', '
|
|
87
|
-
replace: __('Select a new image', '
|
|
85
|
+
browse: __('Select an image', 'eightshift-frontend-libs-tailwind'),
|
|
86
|
+
upload: __('Upload an image', 'eightshift-frontend-libs-tailwind'),
|
|
87
|
+
replace: __('Select a new image', 'eightshift-frontend-libs-tailwind'),
|
|
88
88
|
},
|
|
89
89
|
},
|
|
90
90
|
subtitle: {
|
|
91
91
|
buttonTooltip: {
|
|
92
|
-
browse: __('Select a subtitle file', '
|
|
93
|
-
upload: __('Upload a subtitle file', '
|
|
94
|
-
replace: __('Replace subtitle file', '
|
|
92
|
+
browse: __('Select a subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
93
|
+
upload: __('Upload a subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
94
|
+
replace: __('Replace subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
95
95
|
},
|
|
96
96
|
modalTitle: {
|
|
97
|
-
browse: __('Select a subtitle file', '
|
|
98
|
-
upload: __('Upload a subtitle file', '
|
|
99
|
-
replace: __('Select a new subtitle file', '
|
|
97
|
+
browse: __('Select a subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
98
|
+
upload: __('Upload a subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
99
|
+
replace: __('Select a new subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
102
|
geoJson: {
|
|
103
103
|
buttonTooltip: {
|
|
104
|
-
browse: __('Select a GeoJSON file', '
|
|
105
|
-
upload: __('Upload a GeoJSON file', '
|
|
106
|
-
replace: __('Replace GeoJSON file', '
|
|
104
|
+
browse: __('Select a GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
105
|
+
upload: __('Upload a GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
106
|
+
replace: __('Replace GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
107
107
|
},
|
|
108
108
|
modalTitle: {
|
|
109
|
-
browse: __('Select a GeoJSON file', '
|
|
110
|
-
upload: __('Upload a GeoJSON file', '
|
|
111
|
-
replace: __('Select a new GeoJSON file', '
|
|
109
|
+
browse: __('Select a GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
110
|
+
upload: __('Upload a GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
111
|
+
replace: __('Select a new GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
custom: {
|
|
@@ -184,11 +184,11 @@ export const FileSelector = (props) => {
|
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
const removeTooltips = {
|
|
187
|
-
file: __('Remove file', '
|
|
188
|
-
image: __('Remove image', '
|
|
189
|
-
video: __('Remove video', '
|
|
190
|
-
subtitle: __('Remove subtitle file', '
|
|
191
|
-
geoJson: __('Remove GeoJSON file', '
|
|
187
|
+
file: __('Remove file', 'eightshift-frontend-libs-tailwind'),
|
|
188
|
+
image: __('Remove image', 'eightshift-frontend-libs-tailwind'),
|
|
189
|
+
video: __('Remove video', 'eightshift-frontend-libs-tailwind'),
|
|
190
|
+
subtitle: __('Remove subtitle file', 'eightshift-frontend-libs-tailwind'),
|
|
191
|
+
geoJson: __('Remove GeoJSON file', 'eightshift-frontend-libs-tailwind'),
|
|
192
192
|
custom: labels?.removeTooltip,
|
|
193
193
|
};
|
|
194
194
|
|
|
@@ -206,7 +206,10 @@ export const FileSelector = (props) => {
|
|
|
206
206
|
icon={fileIcons[kind] ?? icons.file}
|
|
207
207
|
fileName={fileName}
|
|
208
208
|
>
|
|
209
|
-
<HStack
|
|
209
|
+
<HStack
|
|
210
|
+
noWrap
|
|
211
|
+
className='es-uic-pl-1'
|
|
212
|
+
>
|
|
210
213
|
<ManageFileButton {...commonManageFileButtonProps} />
|
|
211
214
|
{!noUpload && (
|
|
212
215
|
<ManageFileButton
|
|
@@ -3,4 +3,5 @@ export { LinkSectionEditor } from './link-section-editor';
|
|
|
3
3
|
export { ManageFileButton, FileSelector } from './file-picker';
|
|
4
4
|
export { MediaPicker } from './media-picker';
|
|
5
5
|
export { ServerSideRender } from './server-side-render';
|
|
6
|
+
export { PickerPlaceholder } from './picker-placeholder';
|
|
6
7
|
export { ThemeOptionsPage, EsThemeOptionsContext } from './settings/settings';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
1
|
import { useCallback } from 'react';
|
|
3
2
|
import { __ } from '@wordpress/i18n';
|
|
4
3
|
import { RichText } from '@wordpress/block-editor';
|
|
@@ -78,6 +77,7 @@ export const LinkSectionEditor = (props) => {
|
|
|
78
77
|
(index = -1) => {
|
|
79
78
|
if (index < 0) {
|
|
80
79
|
onChange([...links, defaultSection]);
|
|
80
|
+
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -95,6 +95,7 @@ export const LinkSectionEditor = (props) => {
|
|
|
95
95
|
updateItem(itemIndex, {
|
|
96
96
|
items: [defaultLink, ...items],
|
|
97
97
|
});
|
|
98
|
+
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
const before = items.slice(0, index + 1);
|
|
@@ -254,7 +255,10 @@ export const LinkSectionEditor = (props) => {
|
|
|
254
255
|
<>
|
|
255
256
|
{links.map(({ items, header }, index) => {
|
|
256
257
|
return (
|
|
257
|
-
<div
|
|
258
|
+
<div
|
|
259
|
+
className={classNames?.sectionContainer}
|
|
260
|
+
key={index}
|
|
261
|
+
>
|
|
258
262
|
<RichText
|
|
259
263
|
placeholder={__('Section', 'eightshift-frontend-libs')}
|
|
260
264
|
value={header}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { RichLabel, Button } from '@eightshift/ui-components';
|
|
3
|
+
import { icons, blockIcons, BlockIcon } from '@eightshift/ui-components/icons';
|
|
4
|
+
import { dispatch } from '@wordpress/data';
|
|
5
|
+
import { createBlock } from '@wordpress/blocks';
|
|
6
|
+
import { BlockInserter } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A placeholder that allows picking from a list of presets.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {Object} props - Component props.
|
|
13
|
+
* @param {string|JSX.Element} [props.title] - Block name. Overrides manifest value (if provided).
|
|
14
|
+
* @param {Array} [props.presets] - Presets to show the user.
|
|
15
|
+
* @param {string} props.presets.name - Preset name.
|
|
16
|
+
* @param {string} props.presets.icon - Icon name. (See `icons` object in `@eightshift/ui-components/icons`).
|
|
17
|
+
* @param {array} [props.presets.blocks] - Inner blocks to be added by the preset.
|
|
18
|
+
* @param {object} [props.presets.attributes] - Attributes to set to the current block.
|
|
19
|
+
* @param {string|JSX.Element} [props.blockIcon] - Block icon to show next to the title. Can either be a string (icon/block icon name - block icons have precedence), or a JSX element.
|
|
20
|
+
* @param {string} props.clientId - Client ID of the block.
|
|
21
|
+
* @param {object} [props.manifest] - Block/component manifest (if you don't want to provide title, presets, and block icon manually).
|
|
22
|
+
* @param {boolean|JSX.Element} [props.inserter] - `true` if you want to show the default inserter, or a custom element.
|
|
23
|
+
* @param {string} [props.presetsHeading] - Heading for the presets section.
|
|
24
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
25
|
+
*
|
|
26
|
+
* @returns {JSX.Element} The PickerPlaceholder component.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <PickerPlaceholder presets={presets} title='My block' />
|
|
30
|
+
*
|
|
31
|
+
* @preserve
|
|
32
|
+
*/
|
|
33
|
+
export const PickerPlaceholder = (props) => {
|
|
34
|
+
const {
|
|
35
|
+
title: rawTitle,
|
|
36
|
+
presets: rawPresets,
|
|
37
|
+
blockIcon: rawBlockIcon,
|
|
38
|
+
onChange,
|
|
39
|
+
clientId,
|
|
40
|
+
manifest,
|
|
41
|
+
inserter,
|
|
42
|
+
presetsHeading = __('Select a preset', 'eightshift-frontend-libs-tailwind'),
|
|
43
|
+
hidden,
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
46
|
+
const title = rawTitle ?? manifest?.title;
|
|
47
|
+
const blockIcon = rawBlockIcon ?? manifest?.icon?.src;
|
|
48
|
+
const presets = rawPresets ?? manifest?.layoutPresets;
|
|
49
|
+
|
|
50
|
+
let icon = blockIcon ?? icons.componentGeneric;
|
|
51
|
+
|
|
52
|
+
if (blockIcon in blockIcons) {
|
|
53
|
+
icon = <BlockIcon iconName={blockIcon} />;
|
|
54
|
+
} else if (blockIcon in icons) {
|
|
55
|
+
icon = icons[blockIcon];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (hidden) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div className='es-uic-font-sans es-uic-border-gray-200 es-uic-mx-auto es-uic-grid es-uic-max-w-72 es-uic-grid-cols-2 es-uic-gap-1.5 es-uic-rounded-lg es-uic-border es-uic-p-3 es-uic-text-xs es-uic-shadow-lg'>
|
|
64
|
+
<RichLabel
|
|
65
|
+
icon={icon}
|
|
66
|
+
label={title}
|
|
67
|
+
className='col-span-2 mb-2 select-none font-medium !text-gray-400'
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<span className='es-uic-col-span-2 es-uic-select-none es-uic-justify-self-center'>{presetsHeading}</span>
|
|
71
|
+
|
|
72
|
+
{presets.map(({ name, icon, blocks: blockData, attributes: attrsToSet }, index) => {
|
|
73
|
+
return (
|
|
74
|
+
<Button
|
|
75
|
+
key={index}
|
|
76
|
+
onPress={async () => {
|
|
77
|
+
const blocksToInsert = blockData.map(({ name: blockName, attributes: blockAttrs }) => createBlock(blockName, blockAttrs));
|
|
78
|
+
|
|
79
|
+
onChange(attrsToSet);
|
|
80
|
+
|
|
81
|
+
await dispatch('core/block-editor').insertBlocks(blocksToInsert, 0, clientId);
|
|
82
|
+
}}
|
|
83
|
+
icon={icons?.[icon]}
|
|
84
|
+
size='large'
|
|
85
|
+
>
|
|
86
|
+
{name}
|
|
87
|
+
</Button>
|
|
88
|
+
);
|
|
89
|
+
})}
|
|
90
|
+
|
|
91
|
+
{inserter && (
|
|
92
|
+
<>
|
|
93
|
+
<span className='es-uic-col-span-2 es-uic-select-none es-uic-justify-self-center'>{__('or', 'fe-libs-tailwind')}</span>
|
|
94
|
+
|
|
95
|
+
<div className='es-uic-col-span-2 es-uic-justify-self-center'>
|
|
96
|
+
{inserter}
|
|
97
|
+
|
|
98
|
+
{inserter === true && (
|
|
99
|
+
<BlockInserter
|
|
100
|
+
label
|
|
101
|
+
clientId={clientId}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
104
|
+
</div>
|
|
105
|
+
</>
|
|
106
|
+
)}
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
@@ -23,15 +23,13 @@ import { clsx } from '@eightshift/ui-components/utilities';
|
|
|
23
23
|
*/
|
|
24
24
|
export const ServerSideRender = (props) => {
|
|
25
25
|
const { block, attributes, className, ...rest } = props;
|
|
26
|
+
|
|
26
27
|
return (
|
|
27
28
|
<GutenbergSsr
|
|
28
29
|
{...rest}
|
|
29
30
|
block={block}
|
|
30
31
|
attributes={attributes}
|
|
31
|
-
className={clsx(
|
|
32
|
-
'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',
|
|
33
|
-
className,
|
|
34
|
-
)}
|
|
32
|
+
className={clsx('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', className)}
|
|
35
33
|
/>
|
|
36
34
|
);
|
|
37
35
|
};
|
|
@@ -10,23 +10,14 @@ import { useThemeOptions } from './use-theme-options';
|
|
|
10
10
|
|
|
11
11
|
export const EsThemeOptionsContext = createContext(null);
|
|
12
12
|
|
|
13
|
-
export const ThemeOptionsPage = ({
|
|
14
|
-
title = __('Theme options', '%g_textdomain%'),
|
|
15
|
-
children,
|
|
16
|
-
settingName = 'eightshift-theme-options',
|
|
17
|
-
}) => {
|
|
13
|
+
export const ThemeOptionsPage = ({ title = __('Theme options', 'eightshift-frontend-libs-tailwind'), children, settingName = 'eightshift-theme-options' }) => {
|
|
18
14
|
const themeOptions = useThemeOptions(settingName);
|
|
19
15
|
const { isLoading, saveSettings } = themeOptions;
|
|
20
16
|
|
|
21
17
|
return (
|
|
22
18
|
<EsThemeOptionsContext.Provider value={themeOptions}>
|
|
23
19
|
<Toaster richColors />
|
|
24
|
-
<div
|
|
25
|
-
className={clsx(
|
|
26
|
-
'es-uic-space-y-4',
|
|
27
|
-
isLoading && 'es-uic-pointer-events-none es-uic-opacity-60'
|
|
28
|
-
)}
|
|
29
|
-
>
|
|
20
|
+
<div className={clsx('es-uic-space-y-4', isLoading && 'es-uic-pointer-events-none es-uic-opacity-60')}>
|
|
30
21
|
<HStack className='es-uic-justify-between'>
|
|
31
22
|
<h1>{title}</h1>
|
|
32
23
|
|
|
@@ -35,9 +26,7 @@ export const ThemeOptionsPage = ({
|
|
|
35
26
|
disabled={isLoading}
|
|
36
27
|
icon={isLoading ? icons.moreH : icons.save}
|
|
37
28
|
>
|
|
38
|
-
{isLoading
|
|
39
|
-
? __('Saving...', '%g_textdomain%')
|
|
40
|
-
: __('Save', '%g_textdomain%')}
|
|
29
|
+
{isLoading ? __('Saving...', 'eightshift-frontend-libs-tailwind') : __('Save', 'eightshift-frontend-libs-tailwind')}
|
|
41
30
|
</Button>
|
|
42
31
|
</HStack>
|
|
43
32
|
|
|
@@ -25,9 +25,9 @@ export const useThemeOptions = (settingName) => {
|
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
toast.success(__('Saved successfully', '
|
|
28
|
+
toast.success(__('Saved successfully', 'eightshift-frontend-libs-tailwind'));
|
|
29
29
|
} catch (error) {
|
|
30
|
-
toast.error(__('Something went wrong while saving', '
|
|
30
|
+
toast.error(__('Something went wrong while saving', 'eightshift-frontend-libs-tailwind'), {
|
|
31
31
|
description: error.message,
|
|
32
32
|
});
|
|
33
33
|
} finally {
|