@eightshift/frontend-libs-tailwind 2.4.0 → 3.0.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/CHANGELOG.md +12 -0
- package/bun.lock +201 -179
- package/package.json +19 -19
- package/scripts/components/block-inserter.js +2 -3
- package/scripts/components/file-picker.js +19 -10
- package/scripts/components/link-section-editor.js +3 -3
- package/scripts/components/media-picker.js +1 -13
- package/scripts/components/picker-placeholder.js +10 -11
- package/scripts/components/settings/settings.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eightshift/frontend-libs-tailwind",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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,42 +34,42 @@
|
|
|
34
34
|
"homepage": "https://github.com/infinum/eightshift-frontend-libs-tailwind#readme",
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@stylistic/eslint-plugin": "^5.
|
|
38
|
-
"@stylistic/stylelint-plugin": "^
|
|
39
|
-
"@swc/core": "^1.15.
|
|
40
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
37
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
38
|
+
"@stylistic/stylelint-plugin": "^5.0.1",
|
|
39
|
+
"@swc/core": "^1.15.18",
|
|
40
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.41.0",
|
|
41
41
|
"browserslist": "^4.28.1",
|
|
42
42
|
"css-loader": "^7.1.4",
|
|
43
|
-
"css-minimizer-webpack-plugin": "^
|
|
44
|
-
"eslint": "^
|
|
43
|
+
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
44
|
+
"eslint": "^10.0.3",
|
|
45
45
|
"eslint-config-prettier": "^10.1.8",
|
|
46
46
|
"eslint-plugin-prettier": "^5.5.5",
|
|
47
|
-
"globals": "^
|
|
47
|
+
"globals": "^17.4.0",
|
|
48
48
|
"husky": "^9.1.7",
|
|
49
|
-
"lightningcss": "^1.
|
|
50
|
-
"mini-css-extract-plugin": "^2.10.
|
|
51
|
-
"postcss": "^8.5.
|
|
49
|
+
"lightningcss": "^1.32.0",
|
|
50
|
+
"mini-css-extract-plugin": "^2.10.1",
|
|
51
|
+
"postcss": "^8.5.8",
|
|
52
52
|
"postcss-loader": "^8.2.1",
|
|
53
53
|
"prettier": "^3.8.1",
|
|
54
54
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
55
55
|
"sonner": "^2.0.7",
|
|
56
|
-
"stylelint": "^
|
|
57
|
-
"stylelint-config-standard": "^
|
|
56
|
+
"stylelint": "^17.4.0",
|
|
57
|
+
"stylelint-config-standard": "^40.0.0",
|
|
58
58
|
"swc-loader": "^0.2.7",
|
|
59
|
-
"terser-webpack-plugin": "^5.
|
|
60
|
-
"webpack": "^5.105.
|
|
61
|
-
"webpack-cli": "^
|
|
59
|
+
"terser-webpack-plugin": "^5.4.0",
|
|
60
|
+
"webpack": "^5.105.4",
|
|
61
|
+
"webpack-cli": "^7.0.2",
|
|
62
62
|
"webpack-manifest-plugin": "^6.0.1",
|
|
63
63
|
"webpack-merge": "^6.0.1",
|
|
64
64
|
"eslint-plugin-react": "^7.37.5",
|
|
65
65
|
"eslint-plugin-react-hooks": "^7.0.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"lint-staged": "^16.
|
|
69
|
-
"@wordpress/api-fetch": "^7.
|
|
68
|
+
"lint-staged": "^16.4.0",
|
|
69
|
+
"@wordpress/api-fetch": "^7.41.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@eightshift/ui-components": "^
|
|
72
|
+
"@eightshift/ui-components": "^7.0.0"
|
|
73
73
|
},
|
|
74
74
|
"sideEffects": false,
|
|
75
75
|
"lint-staged": {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { __, sprintf } from '@wordpress/i18n';
|
|
3
2
|
import { Inserter } from '@wordpress/block-editor';
|
|
4
3
|
import { useSuspenseSelect } from '@wordpress/data';
|
|
5
4
|
import { Button } from '@eightshift/ui-components';
|
|
6
|
-
import {
|
|
5
|
+
import { add } from '@eightshift/ui-components/icons';
|
|
7
6
|
import { clsx } from '@eightshift/ui-components/utilities';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -70,7 +69,7 @@ export const BlockInserter = (props) => {
|
|
|
70
69
|
<Button
|
|
71
70
|
onPress={onToggle}
|
|
72
71
|
disabled={disabled}
|
|
73
|
-
icon={
|
|
72
|
+
icon={add}
|
|
74
73
|
size={small ? 'small' : 'default'}
|
|
75
74
|
className={clsx(className, 'es:font-sans')}
|
|
76
75
|
>
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';
|
|
3
3
|
import { Button, FilePickerShell } from '@eightshift/ui-components';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
animationFile,
|
|
6
|
+
closedCaptions,
|
|
7
|
+
fileMetadata,
|
|
8
|
+
imageFile,
|
|
9
|
+
itemSelect,
|
|
10
|
+
swap,
|
|
11
|
+
upload,
|
|
12
|
+
videoFile,
|
|
13
|
+
} from '@eightshift/ui-components/icons';
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* A customizable button for managing files from the Media library.
|
|
@@ -62,9 +71,9 @@ export const ManageFileButton = (props) => {
|
|
|
62
71
|
replace: __('Select a new file', 'eightshift-frontend-libs-tailwind'),
|
|
63
72
|
},
|
|
64
73
|
buttonIcon: {
|
|
65
|
-
browse:
|
|
66
|
-
upload:
|
|
67
|
-
replace:
|
|
74
|
+
browse: itemSelect,
|
|
75
|
+
upload: upload,
|
|
76
|
+
replace: swap,
|
|
68
77
|
},
|
|
69
78
|
},
|
|
70
79
|
video: {
|
|
@@ -180,12 +189,12 @@ export const FileSelector = (props) => {
|
|
|
180
189
|
};
|
|
181
190
|
|
|
182
191
|
const fileIcons = {
|
|
183
|
-
image:
|
|
184
|
-
video:
|
|
185
|
-
subtitle:
|
|
186
|
-
geoJson:
|
|
187
|
-
lottie:
|
|
188
|
-
rive:
|
|
192
|
+
image: imageFile,
|
|
193
|
+
video: videoFile,
|
|
194
|
+
subtitle: closedCaptions,
|
|
195
|
+
geoJson: fileMetadata,
|
|
196
|
+
lottie: animationFile,
|
|
197
|
+
rive: animationFile,
|
|
189
198
|
custom: labels?.removeIcon,
|
|
190
199
|
};
|
|
191
200
|
|
|
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
|
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { RichText } from '@wordpress/block-editor';
|
|
4
4
|
import { Button } from '@eightshift/ui-components';
|
|
5
|
-
import {
|
|
5
|
+
import { add } from '@eightshift/ui-components/icons';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Link section editor.
|
|
@@ -292,7 +292,7 @@ export const LinkSectionEditor = (props) => {
|
|
|
292
292
|
|
|
293
293
|
<Button
|
|
294
294
|
size='small'
|
|
295
|
-
icon={
|
|
295
|
+
icon={add}
|
|
296
296
|
tooltip={__('Add link', 'eightshift-frontend-libs')}
|
|
297
297
|
onPress={({ target }) => {
|
|
298
298
|
updateItem(index, {
|
|
@@ -316,7 +316,7 @@ export const LinkSectionEditor = (props) => {
|
|
|
316
316
|
target?.previousElementSibling?.querySelector('[contenteditable="true"]')?.focus();
|
|
317
317
|
}, 20);
|
|
318
318
|
}}
|
|
319
|
-
icon={
|
|
319
|
+
icon={add}
|
|
320
320
|
tooltip={__('Add a section', 'eightshift-frontend-libs')}
|
|
321
321
|
className='justify-self-start'
|
|
322
322
|
>
|
|
@@ -24,7 +24,6 @@ const MediaButton = (props) => {
|
|
|
24
24
|
* @param {boolean} [props.hidden] - If `true`, the component will be hidden.
|
|
25
25
|
* @param {string[]} [props.allowedTypes=['image']] - Determines types of files which are allowed to be uploaded.
|
|
26
26
|
* @param {string} [props.className] - Classes to add to the button wrapper.
|
|
27
|
-
* @param {boolean} [props.__useSmartImageNext] - If `true`, the component will use the `__SmartImageNext` for image preview and processing.
|
|
28
27
|
*
|
|
29
28
|
* @returns {JSX.Element} The MediaPicker component.
|
|
30
29
|
*
|
|
@@ -38,17 +37,7 @@ const MediaButton = (props) => {
|
|
|
38
37
|
*
|
|
39
38
|
*/
|
|
40
39
|
export const MediaPicker = (props) => {
|
|
41
|
-
const {
|
|
42
|
-
onChange,
|
|
43
|
-
imageId,
|
|
44
|
-
imageUrl,
|
|
45
|
-
noDelete,
|
|
46
|
-
noUpload,
|
|
47
|
-
hidden,
|
|
48
|
-
allowedTypes = ['image'],
|
|
49
|
-
className,
|
|
50
|
-
__useSmartImageNext,
|
|
51
|
-
} = props;
|
|
40
|
+
const { onChange, imageId, imageUrl, noDelete, noUpload, hidden, allowedTypes = ['image'], className } = props;
|
|
52
41
|
|
|
53
42
|
if (hidden) {
|
|
54
43
|
return null;
|
|
@@ -74,7 +63,6 @@ export const MediaPicker = (props) => {
|
|
|
74
63
|
</>
|
|
75
64
|
}
|
|
76
65
|
className={className}
|
|
77
|
-
__useSmartImageNext={__useSmartImageNext}
|
|
78
66
|
>
|
|
79
67
|
{({ isDark, isTransparent }) => {
|
|
80
68
|
let buttonType = 'default';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { RichLabel, Button } from '@eightshift/ui-components';
|
|
3
|
-
import {
|
|
3
|
+
import { blockIcons, BlockIcon, componentGeneric, Icon } from '@eightshift/ui-components/icons';
|
|
4
4
|
import { dispatch } from '@wordpress/data';
|
|
5
5
|
import { createBlock } from '@wordpress/blocks';
|
|
6
6
|
import { BlockInserter } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
@@ -13,7 +13,7 @@ import { BlockInserter } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
|
13
13
|
* @param {string|JSX.Element} [props.title] - Block name. Overrides manifest value (if provided).
|
|
14
14
|
* @param {Array} [props.presets] - Presets to show the user.
|
|
15
15
|
* @param {string} props.presets.name - Preset name.
|
|
16
|
-
* @param {string} props.presets.icon - Icon name. (
|
|
16
|
+
* @param {string} props.presets.icon - Icon name. (from `@eightshift/ui-components/icons`).
|
|
17
17
|
* @param {array} [props.presets.blocks] - Inner blocks to be added by the preset.
|
|
18
18
|
* @param {object} [props.presets.attributes] - Attributes to set to the current block.
|
|
19
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.
|
|
@@ -47,13 +47,12 @@ export const PickerPlaceholder = (props) => {
|
|
|
47
47
|
const blockIcon = rawBlockIcon ?? manifest?.icon?.src;
|
|
48
48
|
const presets = rawPresets ?? manifest?.layoutPresets;
|
|
49
49
|
|
|
50
|
-
let icon =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
50
|
+
let icon = (
|
|
51
|
+
<Icon
|
|
52
|
+
icon={blockIcon}
|
|
53
|
+
fallback={blockIcon in blockIcons ? <BlockIcon iconName={blockIcon} /> : componentGeneric}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
57
56
|
|
|
58
57
|
if (hidden) {
|
|
59
58
|
return null;
|
|
@@ -64,7 +63,7 @@ export const PickerPlaceholder = (props) => {
|
|
|
64
63
|
<RichLabel
|
|
65
64
|
icon={icon}
|
|
66
65
|
label={title}
|
|
67
|
-
className='col-span-2 mb-2
|
|
66
|
+
className='col-span-2 mb-2 font-medium !text-gray-400 select-none'
|
|
68
67
|
/>
|
|
69
68
|
|
|
70
69
|
<span className='es:col-span-2 es:select-none es:justify-self-center'>{presetsHeading}</span>
|
|
@@ -82,7 +81,7 @@ export const PickerPlaceholder = (props) => {
|
|
|
82
81
|
|
|
83
82
|
await dispatch('core/block-editor').insertBlocks(blocksToInsert, 0, clientId);
|
|
84
83
|
}}
|
|
85
|
-
icon={
|
|
84
|
+
icon={<Icon icon={icon} />}
|
|
86
85
|
size='large'
|
|
87
86
|
>
|
|
88
87
|
{name}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Toaster } from 'sonner';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { Button, OptionsPanelHeader } from '@eightshift/ui-components';
|
|
6
|
-
import {
|
|
6
|
+
import { save } from '@eightshift/ui-components/icons';
|
|
7
7
|
import { createContext } from '@wordpress/element';
|
|
8
8
|
import { useThemeOptions } from './use-theme-options';
|
|
9
9
|
|
|
@@ -25,8 +25,8 @@ export const ThemeOptionsPage = ({
|
|
|
25
25
|
actions={
|
|
26
26
|
<Button
|
|
27
27
|
onPress={() => saveSettings()}
|
|
28
|
-
|
|
29
|
-
icon={
|
|
28
|
+
pending={isLoading}
|
|
29
|
+
icon={save}
|
|
30
30
|
>
|
|
31
31
|
{isLoading
|
|
32
32
|
? __('Saving...', 'eightshift-frontend-libs-tailwind')
|