@eightshift/frontend-libs-tailwind 1.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/.gitattributes +37 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/CONTRIBUTING.md +17 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +10 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +10 -0
- package/.github/ISSUE_TEMPLATE/question.md +10 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- package/.github/workflows/ci.yml +31 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +14 -0
- package/.stylelintrc +4 -0
- package/CHANGELOG.md +13 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/blocks/init/assets/application-admin.js +10 -0
- package/blocks/init/assets/application.js +13 -0
- package/blocks/init/assets/images/index.js +5 -0
- package/blocks/init/assets/scripts/application-admin.js +7 -0
- package/blocks/init/assets/scripts/application.js +3 -0
- package/blocks/init/assets/scripts/theme-colors.js +39 -0
- package/blocks/init/assets/styles/application-admin.css +6 -0
- package/blocks/init/assets/styles/application.css +3 -0
- package/blocks/init/src/Blocks/assets/application-blocks-editor.js +14 -0
- package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +13 -0
- package/blocks/init/src/Blocks/assets/application-blocks.js +9 -0
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +65 -0
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +24 -0
- package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +258 -0
- package/blocks/init/src/Blocks/assets/scripts/shared.js +25 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +15 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +12 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -0
- package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +15 -0
- package/blocks/init/src/Blocks/assets/styles/tailwind.css +34 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +20 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +36 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +55 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/button/assets/index.js +22 -0
- package/blocks/init/src/Blocks/components/button/button.php +77 -0
- package/blocks/init/src/Blocks/components/button/components/button-editor.js +40 -0
- package/blocks/init/src/Blocks/components/button/components/button-options.js +135 -0
- package/blocks/init/src/Blocks/components/button/manifest.json +299 -0
- package/blocks/init/src/Blocks/components/card/card.php +42 -0
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +39 -0
- package/blocks/init/src/Blocks/components/card/components/card-options.js +56 -0
- package/blocks/init/src/Blocks/components/card/manifest.json +111 -0
- package/blocks/init/src/Blocks/components/head/head.php +52 -0
- package/blocks/init/src/Blocks/components/head/manifest.json +17 -0
- package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +30 -0
- package/blocks/init/src/Blocks/components/heading/components/heading-options.js +62 -0
- package/blocks/init/src/Blocks/components/heading/heading.php +45 -0
- package/blocks/init/src/Blocks/components/heading/manifest.json +76 -0
- package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +42 -0
- package/blocks/init/src/Blocks/components/hero/components/hero-options.js +100 -0
- package/blocks/init/src/Blocks/components/hero/hero.php +45 -0
- package/blocks/init/src/Blocks/components/hero/manifest.json +96 -0
- package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +23 -0
- package/blocks/init/src/Blocks/components/icon/components/icon-options.js +65 -0
- package/blocks/init/src/Blocks/components/icon/icon.php +34 -0
- package/blocks/init/src/Blocks/components/icon/manifest.json +1234 -0
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +65 -0
- package/blocks/init/src/Blocks/components/image/components/image-options.js +111 -0
- package/blocks/init/src/Blocks/components/image/image.php +62 -0
- package/blocks/init/src/Blocks/components/image/manifest.json +125 -0
- package/blocks/init/src/Blocks/components/list/components/list-editor.js +30 -0
- package/blocks/init/src/Blocks/components/list/components/list-options.js +62 -0
- package/blocks/init/src/Blocks/components/list/list.php +32 -0
- package/blocks/init/src/Blocks/components/list/manifest.json +127 -0
- package/blocks/init/src/Blocks/components/load-more/assets/index.js +19 -0
- package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +147 -0
- package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +14 -0
- package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +18 -0
- package/blocks/init/src/Blocks/components/load-more/load-more.php +47 -0
- package/blocks/init/src/Blocks/components/load-more/manifest.json +39 -0
- package/blocks/init/src/Blocks/components/modal/assets/index.js +27 -0
- package/blocks/init/src/Blocks/components/modal/manifest.json +48 -0
- package/blocks/init/src/Blocks/components/modal/modal.php +46 -0
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +40 -0
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +48 -0
- package/blocks/init/src/Blocks/components/paragraph/manifest.json +83 -0
- package/blocks/init/src/Blocks/components/paragraph/paragraph.php +33 -0
- package/blocks/init/src/Blocks/components/post-header/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/post-header/post-header.php +24 -0
- package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +53 -0
- package/blocks/init/src/Blocks/components/quote/components/quote-options.js +29 -0
- package/blocks/init/src/Blocks/components/quote/manifest.json +47 -0
- package/blocks/init/src/Blocks/components/quote/quote.php +49 -0
- package/blocks/init/src/Blocks/components/share/assets/index.js +39 -0
- package/blocks/init/src/Blocks/components/share/components/share-editor.js +25 -0
- package/blocks/init/src/Blocks/components/share/components/share-options.js +112 -0
- package/blocks/init/src/Blocks/components/share/manifest.json +72 -0
- package/blocks/init/src/Blocks/components/share/share.php +66 -0
- package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +9 -0
- package/blocks/init/src/Blocks/components/tracking-head/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +9 -0
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +74 -0
- package/blocks/init/src/Blocks/components/video/components/video-options.js +280 -0
- package/blocks/init/src/Blocks/components/video/manifest.json +116 -0
- package/blocks/init/src/Blocks/components/video/video.php +72 -0
- package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +15 -0
- package/blocks/init/src/Blocks/custom/accordion/accordion.php +28 -0
- package/blocks/init/src/Blocks/custom/accordion/assets/index.js +37 -0
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +17 -0
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +18 -0
- package/blocks/init/src/Blocks/custom/accordion/manifest.json +32 -0
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +19 -0
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +46 -0
- package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +60 -0
- package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +69 -0
- package/blocks/init/src/Blocks/custom/button/button-block.js +13 -0
- package/blocks/init/src/Blocks/custom/button/button.php +11 -0
- package/blocks/init/src/Blocks/custom/button/components/button-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/button/components/button-options.js +12 -0
- package/blocks/init/src/Blocks/custom/button/manifest.json +18 -0
- package/blocks/init/src/Blocks/custom/card/card-block.js +13 -0
- package/blocks/init/src/Blocks/custom/card/card.php +11 -0
- package/blocks/init/src/Blocks/custom/card/components/card-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/card/components/card-options.js +15 -0
- package/blocks/init/src/Blocks/custom/card/manifest.json +18 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/index.js +46 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +31 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +39 -0
- package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +21 -0
- package/blocks/init/src/Blocks/custom/carousel/carousel.php +61 -0
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +25 -0
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +47 -0
- package/blocks/init/src/Blocks/custom/carousel/manifest.json +130 -0
- package/blocks/init/src/Blocks/custom/column/column-block.js +21 -0
- package/blocks/init/src/Blocks/custom/column/column-hooks.js +32 -0
- package/blocks/init/src/Blocks/custom/column/column.php +21 -0
- package/blocks/init/src/Blocks/custom/column/components/column-editor.js +19 -0
- package/blocks/init/src/Blocks/custom/column/components/column-options.js +579 -0
- package/blocks/init/src/Blocks/custom/column/manifest.json +625 -0
- package/blocks/init/src/Blocks/custom/columns/columns-block.js +20 -0
- package/blocks/init/src/Blocks/custom/columns/columns.php +21 -0
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +81 -0
- package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +104 -0
- package/blocks/init/src/Blocks/custom/columns/manifest.json +555 -0
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +28 -0
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +239 -0
- package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +13 -0
- package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +139 -0
- package/blocks/init/src/Blocks/custom/featured-content/manifest.json +131 -0
- package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +39 -0
- package/blocks/init/src/Blocks/custom/group/components/group-editor.js +8 -0
- package/blocks/init/src/Blocks/custom/group/group-block.js +14 -0
- package/blocks/init/src/Blocks/custom/group/group.php +10 -0
- package/blocks/init/src/Blocks/custom/group/manifest.json +32 -0
- package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +15 -0
- package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +38 -0
- package/blocks/init/src/Blocks/custom/heading/heading-block.js +13 -0
- package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +25 -0
- package/blocks/init/src/Blocks/custom/heading/heading.php +15 -0
- package/blocks/init/src/Blocks/custom/heading/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +14 -0
- package/blocks/init/src/Blocks/custom/hero/hero-block.js +13 -0
- package/blocks/init/src/Blocks/custom/hero/hero.php +11 -0
- package/blocks/init/src/Blocks/custom/hero/manifest.json +17 -0
- package/blocks/init/src/Blocks/custom/image/components/image-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/image/components/image-options.js +14 -0
- package/blocks/init/src/Blocks/custom/image/image-block.js +13 -0
- package/blocks/init/src/Blocks/custom/image/image.php +11 -0
- package/blocks/init/src/Blocks/custom/image/manifest.json +105 -0
- package/blocks/init/src/Blocks/custom/list/components/list-editor.js +14 -0
- package/blocks/init/src/Blocks/custom/list/components/list-options.js +39 -0
- package/blocks/init/src/Blocks/custom/list/list-block.js +13 -0
- package/blocks/init/src/Blocks/custom/list/list.php +15 -0
- package/blocks/init/src/Blocks/custom/list/manifest.json +58 -0
- package/blocks/init/src/Blocks/custom/map/assets/index.js +20 -0
- package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +42 -0
- package/blocks/init/src/Blocks/custom/map/assets/utils.js +161 -0
- package/blocks/init/src/Blocks/custom/map/components/map-components.js +403 -0
- package/blocks/init/src/Blocks/custom/map/components/map-editor.js +56 -0
- package/blocks/init/src/Blocks/custom/map/components/map-options.js +557 -0
- package/blocks/init/src/Blocks/custom/map/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/map/map-block.js +13 -0
- package/blocks/init/src/Blocks/custom/map/map.php +52 -0
- package/blocks/init/src/Blocks/custom/map/styles.css +2 -0
- package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +90 -0
- package/blocks/init/src/Blocks/custom/modal/manifest.json +51 -0
- package/blocks/init/src/Blocks/custom/modal/modal-block.js +14 -0
- package/blocks/init/src/Blocks/custom/modal/modal.php +20 -0
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +41 -0
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +38 -0
- package/blocks/init/src/Blocks/custom/paragraph/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +13 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +45 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +15 -0
- package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +14 -0
- package/blocks/init/src/Blocks/custom/quote/manifest.json +17 -0
- package/blocks/init/src/Blocks/custom/quote/quote-block.js +13 -0
- package/blocks/init/src/Blocks/custom/quote/quote.php +13 -0
- package/blocks/init/src/Blocks/custom/share/components/share-editor.js +6 -0
- package/blocks/init/src/Blocks/custom/share/components/share-options.js +12 -0
- package/blocks/init/src/Blocks/custom/share/manifest.json +19 -0
- package/blocks/init/src/Blocks/custom/share/share-block.js +13 -0
- package/blocks/init/src/Blocks/custom/share/share.php +11 -0
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +57 -0
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +106 -0
- package/blocks/init/src/Blocks/custom/site-footer/manifest.json +73 -0
- package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +13 -0
- package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +72 -0
- package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +9 -0
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +42 -0
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +73 -0
- package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +77 -0
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +13 -0
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +99 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +58 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +38 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +32 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +48 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +13 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +31 -0
- package/blocks/init/src/Blocks/custom/video/components/video-editor.js +6 -0
- package/blocks/init/src/Blocks/custom/video/components/video-options.js +12 -0
- package/blocks/init/src/Blocks/custom/video/manifest.json +105 -0
- package/blocks/init/src/Blocks/custom/video/video-block.js +13 -0
- package/blocks/init/src/Blocks/custom/video/video.php +22 -0
- package/blocks/init/src/Blocks/manifest.json +14 -0
- package/blocks/init/src/Blocks/variations/card-simple/manifest.json +17 -0
- package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +12 -0
- package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +348 -0
- package/blocks/init/src/Blocks/wrapper/manifest.json +450 -0
- package/blocks/init/src/Blocks/wrapper/styles-editor.css +13 -0
- package/blocks/init/src/Blocks/wrapper/styles.css +19 -0
- package/blocks/init/src/Blocks/wrapper/wrapper.js +30 -0
- package/blocks/init/src/Blocks/wrapper/wrapper.php +34 -0
- package/eslint.config.mjs +3 -0
- package/linters/base.config.mjs +81 -0
- package/linters/eslint.config.mjs +4 -0
- package/linters/ignore-gitignored.mjs +9 -0
- package/linters/stylelint.config.js +146 -0
- package/package.json +93 -0
- package/readme/packages.md +74 -0
- package/schemas/block.json +302 -0
- package/schemas/component.json +240 -0
- package/schemas/globalManifest.json +73 -0
- package/schemas/variation.json +83 -0
- package/scripts/components/block-inserter.js +70 -0
- package/scripts/components/file-picker.js +243 -0
- package/scripts/components/index.js +6 -0
- package/scripts/components/link-section-editor.js +319 -0
- package/scripts/components/media-picker.js +86 -0
- package/scripts/components/server-side-render.js +37 -0
- package/scripts/components/settings/settings.js +48 -0
- package/scripts/components/settings/use-theme-options.js +52 -0
- package/scripts/editor/attributes.js +304 -0
- package/scripts/editor/colors.js +64 -0
- package/scripts/editor/editor.js +139 -0
- package/scripts/editor/fetch.js +102 -0
- package/scripts/editor/hooks.js +44 -0
- package/scripts/editor/index.js +11 -0
- package/scripts/editor/options.js +152 -0
- package/scripts/editor/registration.js +901 -0
- package/scripts/editor/store.js +213 -0
- package/scripts/editor/tailwindcss.js +224 -0
- package/scripts/editor/utility.js +47 -0
- package/scripts/helpers/breakpoints.js +48 -0
- package/scripts/helpers/cookies.js +65 -0
- package/scripts/helpers/dynamic-import.js +19 -0
- package/scripts/helpers/index.js +11 -0
- package/scripts/index.js +22 -0
- package/scripts/plugins/index.js +3 -0
- package/scripts/plugins/yoast-seo.js +70 -0
- package/webpack/base.mjs +138 -0
- package/webpack/helpers.mjs +67 -0
- package/webpack/index.mjs +52 -0
- package/webpack/production.mjs +60 -0
- package/webpack/project.mjs +55 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import {
|
|
3
|
+
getOption,
|
|
4
|
+
checkAttr,
|
|
5
|
+
getAttrKey,
|
|
6
|
+
props,
|
|
7
|
+
getOptions,
|
|
8
|
+
wpSearchRoute,
|
|
9
|
+
getHiddenOptions,
|
|
10
|
+
} from '@eightshift/frontend-libs-tailwind/scripts';
|
|
11
|
+
import { IconOptions } from '../../icon/components/icon-options';
|
|
12
|
+
import {
|
|
13
|
+
BaseControl,
|
|
14
|
+
ButtonGroup,
|
|
15
|
+
ColorPicker,
|
|
16
|
+
ComponentToggle,
|
|
17
|
+
HStack,
|
|
18
|
+
InputField,
|
|
19
|
+
LinkInput,
|
|
20
|
+
OptionSelect,
|
|
21
|
+
Spacer,
|
|
22
|
+
Toggle,
|
|
23
|
+
} from '@eightshift/ui-components';
|
|
24
|
+
import { icons } from '@eightshift/ui-components/icons';
|
|
25
|
+
import { upperFirst } from '@eightshift/ui-components/utilities';
|
|
26
|
+
import manifest from './../manifest.json';
|
|
27
|
+
|
|
28
|
+
export const ButtonOptions = (attributes) => {
|
|
29
|
+
const { setAttributes, hideOptions, ...rest } = attributes;
|
|
30
|
+
|
|
31
|
+
const hiddenOptions = getHiddenOptions(hideOptions);
|
|
32
|
+
|
|
33
|
+
const buttonId = checkAttr('buttonId', attributes, manifest);
|
|
34
|
+
const buttonAriaLabel = checkAttr('buttonAriaLabel', attributes, manifest);
|
|
35
|
+
const buttonUrl = checkAttr('buttonUrl', attributes, manifest);
|
|
36
|
+
const buttonIsAnchor = checkAttr('buttonIsAnchor', attributes, manifest);
|
|
37
|
+
const buttonIsNewTab = checkAttr('buttonIsNewTab', attributes, manifest);
|
|
38
|
+
const buttonVariant = checkAttr('buttonVariant', attributes, manifest);
|
|
39
|
+
const buttonColor = checkAttr('buttonColor', attributes, manifest);
|
|
40
|
+
const buttonUse = checkAttr('buttonUse', attributes, manifest);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<ComponentToggle
|
|
44
|
+
label={manifest.title}
|
|
45
|
+
icon={icons.buttonOutline}
|
|
46
|
+
onChange={(value) => setAttributes({ [getAttrKey('buttonUse', attributes, manifest)]: value })}
|
|
47
|
+
useComponent={buttonUse}
|
|
48
|
+
{...rest}
|
|
49
|
+
>
|
|
50
|
+
<HStack hidden={hiddenOptions?.variant && hiddenOptions?.color && hiddenOptions?.icon}>
|
|
51
|
+
<ButtonGroup hidden={hiddenOptions?.variant && hiddenOptions?.color}>
|
|
52
|
+
<OptionSelect
|
|
53
|
+
aria-label={__('Style', '%g_textdomain%')}
|
|
54
|
+
value={buttonVariant}
|
|
55
|
+
onChange={(value) => setAttributes({ [getAttrKey('buttonVariant', attributes, manifest)]: value })}
|
|
56
|
+
options={getOption('buttonVariant', attributes, manifest)}
|
|
57
|
+
type='menu'
|
|
58
|
+
hidden={hiddenOptions?.variant}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<ColorPicker
|
|
62
|
+
aria-label={__('Color', '%g_textdomain%')}
|
|
63
|
+
value={buttonColor}
|
|
64
|
+
onChange={(value) => setAttributes({ [getAttrKey('buttonColor', attributes, manifest)]: value })}
|
|
65
|
+
colors={getOption(`buttonColor${upperFirst(buttonVariant)}`, attributes, manifest, true)}
|
|
66
|
+
hidden={hiddenOptions?.color}
|
|
67
|
+
/>
|
|
68
|
+
</ButtonGroup>
|
|
69
|
+
|
|
70
|
+
<IconOptions
|
|
71
|
+
{...props('icon', attributes, {
|
|
72
|
+
options: getOptions(attributes, manifest),
|
|
73
|
+
})}
|
|
74
|
+
hidden={hiddenOptions?.icon}
|
|
75
|
+
hideOptions='size'
|
|
76
|
+
design='compactLabel'
|
|
77
|
+
/>
|
|
78
|
+
</HStack>
|
|
79
|
+
|
|
80
|
+
<Spacer hidden={hiddenOptions?.link} />
|
|
81
|
+
|
|
82
|
+
<LinkInput
|
|
83
|
+
icon={buttonIsAnchor ? icons.globeAnchor : icons.globe}
|
|
84
|
+
url={buttonUrl}
|
|
85
|
+
onChange={({ url, isAnchor }) => {
|
|
86
|
+
setAttributes({
|
|
87
|
+
[getAttrKey('buttonUrl', attributes, manifest)]: url,
|
|
88
|
+
[getAttrKey('buttonIsAnchor', attributes, manifest)]: isAnchor ?? false,
|
|
89
|
+
});
|
|
90
|
+
}}
|
|
91
|
+
fetchSuggestions={wpSearchRoute}
|
|
92
|
+
hidden={hiddenOptions?.link}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<Toggle
|
|
96
|
+
icon={icons.newTab}
|
|
97
|
+
label={__('Open in new tab', '%g_textdomain%')}
|
|
98
|
+
checked={buttonIsNewTab}
|
|
99
|
+
onChange={(value) => setAttributes({ [getAttrKey('buttonIsNewTab', attributes, manifest)]: value })}
|
|
100
|
+
hidden={hiddenOptions?.link || hiddenOptions?.newTab}
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<Spacer hidden={hiddenOptions?.ariaLabel} />
|
|
104
|
+
<Spacer
|
|
105
|
+
icon={icons.a11y}
|
|
106
|
+
text={__('Accessibility', '%g_textdomain%')}
|
|
107
|
+
border
|
|
108
|
+
hidden={hiddenOptions?.ariaLabel}
|
|
109
|
+
/>
|
|
110
|
+
<InputField
|
|
111
|
+
icon={icons.ariaLabel}
|
|
112
|
+
label={__('ARIA label', '%g_textdomain%')}
|
|
113
|
+
value={buttonAriaLabel}
|
|
114
|
+
onChange={(value) => setAttributes({ [getAttrKey('buttonAriaLabel', attributes, manifest)]: value })}
|
|
115
|
+
help={__('Description of the button.', '%g_textdomain%')}
|
|
116
|
+
hidden={hiddenOptions?.ariaLabel}
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
<Spacer hidden={hiddenOptions?.uniqueId} />
|
|
120
|
+
<Spacer
|
|
121
|
+
icon={icons.pointerHand}
|
|
122
|
+
text={__('Advanced', '%g_textdomain%')}
|
|
123
|
+
border
|
|
124
|
+
hidden={hiddenOptions?.uniqueId}
|
|
125
|
+
/>
|
|
126
|
+
<InputField
|
|
127
|
+
icon={icons.id}
|
|
128
|
+
label={__('Unique identifier', '%g_textdomain%')}
|
|
129
|
+
value={buttonId}
|
|
130
|
+
onChange={(value) => setAttributes({ [getAttrKey('buttonId', attributes, manifest)]: value })}
|
|
131
|
+
hidden={hiddenOptions?.uniqueId}
|
|
132
|
+
/>
|
|
133
|
+
</ComponentToggle>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
+
"componentName": "button",
|
|
4
|
+
"title": "Button",
|
|
5
|
+
"componentClass": "btn",
|
|
6
|
+
"example": {
|
|
7
|
+
"attributes": {
|
|
8
|
+
"buttonContent": "This is a button",
|
|
9
|
+
"buttonUrl": "https://eightshift.com/",
|
|
10
|
+
"buttonId": "custom ID"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"attributes": {
|
|
14
|
+
"buttonContent": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"buttonUrl": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"buttonId": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"buttonColor": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"default": "navy-500"
|
|
26
|
+
},
|
|
27
|
+
"buttonVariant": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"default": "primary"
|
|
30
|
+
},
|
|
31
|
+
"buttonSize": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"default": "base"
|
|
34
|
+
},
|
|
35
|
+
"buttonIsAnchor": {
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"default": false
|
|
38
|
+
},
|
|
39
|
+
"buttonIsNewTab": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"default": false
|
|
42
|
+
},
|
|
43
|
+
"buttonAriaLabel": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"buttonUse": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"default": true
|
|
49
|
+
},
|
|
50
|
+
"buttonIconUse": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"default": false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"components": {
|
|
56
|
+
"icon": "icon"
|
|
57
|
+
},
|
|
58
|
+
"options": {
|
|
59
|
+
"buttonVariant": [
|
|
60
|
+
{
|
|
61
|
+
"label": "Primary",
|
|
62
|
+
"value": "primary",
|
|
63
|
+
"icon": "buttonFilled"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"label": "Secondary",
|
|
67
|
+
"value": "secondary",
|
|
68
|
+
"icon": "buttonOutline"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"label": "Link",
|
|
72
|
+
"value": "link",
|
|
73
|
+
"icon": "link"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"buttonSize": [
|
|
77
|
+
{
|
|
78
|
+
"label": "Regular",
|
|
79
|
+
"value": "base"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"label": "Small",
|
|
83
|
+
"value": "sm"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"buttonColorPrimary": [
|
|
87
|
+
"navy-100",
|
|
88
|
+
"navy-500",
|
|
89
|
+
"navy-800",
|
|
90
|
+
"red-100",
|
|
91
|
+
"red-500",
|
|
92
|
+
"red-800",
|
|
93
|
+
"gray-100",
|
|
94
|
+
"gray-500",
|
|
95
|
+
"gray-800"
|
|
96
|
+
],
|
|
97
|
+
"buttonColorSecondary": [
|
|
98
|
+
"navy-100",
|
|
99
|
+
"navy-800",
|
|
100
|
+
"red-100",
|
|
101
|
+
"red-800",
|
|
102
|
+
"gray-100",
|
|
103
|
+
"gray-500",
|
|
104
|
+
"gray-800"
|
|
105
|
+
],
|
|
106
|
+
"buttonColorLink": [
|
|
107
|
+
"black",
|
|
108
|
+
"white",
|
|
109
|
+
"red-500",
|
|
110
|
+
"navy-500"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"tailwind": {
|
|
114
|
+
"base": {
|
|
115
|
+
"twClasses": "font-sans transition duration-300 inline-flex items-center focus-visible:ring focus:outline-none text-sm disabled:shadow-none disabled:grayscale disabled:cursor-default disabled:opacity-85"
|
|
116
|
+
},
|
|
117
|
+
"options": {
|
|
118
|
+
"buttonVariant": {
|
|
119
|
+
"twClasses": {
|
|
120
|
+
"primary": "border shadow hover:shadow-md bg-gradient-to-br [&>svg]:size-6 gap-2",
|
|
121
|
+
"secondary": "border [&>svg]:size-6 gap-2",
|
|
122
|
+
"link": "leading-tight rounded-sm underline cursor-pointer underline-offset-1 decoration-[1.5px] [&>svg]:size-4 gap-1 hover:ring-4"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"combinations": [
|
|
127
|
+
{
|
|
128
|
+
"attributes": {
|
|
129
|
+
"buttonVariant": [
|
|
130
|
+
"primary",
|
|
131
|
+
"secondary"
|
|
132
|
+
],
|
|
133
|
+
"buttonSize": "base"
|
|
134
|
+
},
|
|
135
|
+
"twClasses": "~pr-3/4 ~pl-2.5/3.5 ~py-2/3 ~rounded-lg/xl"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"attributes": {
|
|
139
|
+
"buttonVariant": [
|
|
140
|
+
"primary",
|
|
141
|
+
"secondary"
|
|
142
|
+
],
|
|
143
|
+
"buttonSize": "sm"
|
|
144
|
+
},
|
|
145
|
+
"twClasses": "~pr-1/2 ~pl-1.5/2.5 ~py-1/1.5 ~rounded-md/lg"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"attributes": {
|
|
149
|
+
"buttonVariant": [
|
|
150
|
+
"primary",
|
|
151
|
+
"secondary"
|
|
152
|
+
],
|
|
153
|
+
"buttonSize": "square"
|
|
154
|
+
},
|
|
155
|
+
"twClasses": "size-14 sm:size-9 rounded-full sm:[&>svg]:size-5 justify-center"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"attributes": {
|
|
159
|
+
"buttonColor": "navy-100",
|
|
160
|
+
"buttonVariant": "primary"
|
|
161
|
+
},
|
|
162
|
+
"twClasses": "from-navy-100 to-navy-200 text-navy-950 border-navy-200 hover:border-navy-200 focus-visible:ring-navy-500/30"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"attributes": {
|
|
166
|
+
"buttonColor": "navy-500",
|
|
167
|
+
"buttonVariant": "primary"
|
|
168
|
+
},
|
|
169
|
+
"twClasses": "from-navy-500 to-navy-600 text-navy-50 border-navy-500 hover:border-navy-600 focus-visible:ring-navy-500/30"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"attributes": {
|
|
173
|
+
"buttonColor": "navy-800",
|
|
174
|
+
"buttonVariant": "primary"
|
|
175
|
+
},
|
|
176
|
+
"twClasses": "from-navy-700 to-navy-800 text-navy-50 border-navy-800 hover:border-navy-900 focus-visible:ring-navy-500/30"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"attributes": {
|
|
180
|
+
"buttonColor": "red-100",
|
|
181
|
+
"buttonVariant": "primary"
|
|
182
|
+
},
|
|
183
|
+
"twClasses": "from-red-100 to-red-200 text-red-950 border-red-200 hover:border-red-300 focus-visible:ring-red-500/30"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"attributes": {
|
|
187
|
+
"buttonColor": "red-500",
|
|
188
|
+
"buttonVariant": "primary"
|
|
189
|
+
},
|
|
190
|
+
"twClasses": "from-red-500 to-red-600 text-red-50 border-red-500 hover:border-red-600 focus-visible:ring-red-500/30"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"attributes": {
|
|
194
|
+
"buttonColor": "red-800",
|
|
195
|
+
"buttonVariant": "primary"
|
|
196
|
+
},
|
|
197
|
+
"twClasses": "from-red-700 to-red-800 text-red-50 border-red-800 hover:border-red-900 focus-visible:ring-red-500/30"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"attributes": {
|
|
201
|
+
"buttonColor": "gray-100",
|
|
202
|
+
"buttonVariant": "primary"
|
|
203
|
+
},
|
|
204
|
+
"twClasses": "from-gray-100 to-gray-200 text-gray-950 border-gray-200 hover:border-gray-300 focus-visible:ring-gray-500/30"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"attributes": {
|
|
208
|
+
"buttonColor": "gray-500",
|
|
209
|
+
"buttonVariant": "primary"
|
|
210
|
+
},
|
|
211
|
+
"twClasses": "from-gray-500 to-gray-600 text-gray-50 border-gray-500 hover:border-gray-600 focus-visible:ring-gray-500/30"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"attributes": {
|
|
215
|
+
"buttonColor": "gray-800",
|
|
216
|
+
"buttonVariant": "primary"
|
|
217
|
+
},
|
|
218
|
+
"twClasses": "from-gray-700 to-gray-800 text-gray-50 border-gray-800 hover:border-gray-900 focus-visible:ring-gray-500/30"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"attributes": {
|
|
222
|
+
"buttonColor": "navy-100",
|
|
223
|
+
"buttonVariant": "secondary"
|
|
224
|
+
},
|
|
225
|
+
"twClasses": "text-navy-100 border-navy-100 focus-visible:ring-navy-500/30 hover:bg-navy-50"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"attributes": {
|
|
229
|
+
"buttonColor": "navy-800",
|
|
230
|
+
"buttonVariant": "secondary"
|
|
231
|
+
},
|
|
232
|
+
"twClasses": "text-navy-800 border-navy-800 focus-visible:ring-navy-500/30 hover:bg-navy-50"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"attributes": {
|
|
236
|
+
"buttonColor": "red-100",
|
|
237
|
+
"buttonVariant": "secondary"
|
|
238
|
+
},
|
|
239
|
+
"twClasses": "text-red-100 border-red-100 focus-visible:ring-red-500/30 hover:bg-red-50"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"attributes": {
|
|
243
|
+
"buttonColor": "red-800",
|
|
244
|
+
"buttonVariant": "secondary"
|
|
245
|
+
},
|
|
246
|
+
"twClasses": "text-red-800 border-red-800 focus-visible:ring-red-500/30 hover:bg-red-50"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"attributes": {
|
|
250
|
+
"buttonColor": "gray-100",
|
|
251
|
+
"buttonVariant": "secondary"
|
|
252
|
+
},
|
|
253
|
+
"twClasses": "text-gray-100 border-gray-100 focus-visible:ring-gray-500/30 hover:bg-gray-50"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"attributes": {
|
|
257
|
+
"buttonColor": "gray-500",
|
|
258
|
+
"buttonVariant": "secondary"
|
|
259
|
+
},
|
|
260
|
+
"twClasses": "text-gray-500 border-gray-500 focus-visible:ring-gray-500/30 hover:bg-gray-50"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"attributes": {
|
|
264
|
+
"buttonColor": "gray-800",
|
|
265
|
+
"buttonVariant": "secondary"
|
|
266
|
+
},
|
|
267
|
+
"twClasses": "text-gray-800 border-gray-800 focus-visible:ring-gray-500/30"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"attributes": {
|
|
271
|
+
"buttonColor": "black",
|
|
272
|
+
"buttonVariant": "link"
|
|
273
|
+
},
|
|
274
|
+
"twClasses": "text-gray-950 decoration-gray-500 hover:bg-gray-100 focus-visible:ring-gray-500/30 hover:ring-gray-100"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"attributes": {
|
|
278
|
+
"buttonColor": "white",
|
|
279
|
+
"buttonVariant": "link"
|
|
280
|
+
},
|
|
281
|
+
"twClasses": "text-gray-50 decoration-gray-100 hover:bg-gray-100 focus-visible:ring-gray-500/30 hover:ring-gray-100"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"attributes": {
|
|
285
|
+
"buttonColor": "red-500",
|
|
286
|
+
"buttonVariant": "link"
|
|
287
|
+
},
|
|
288
|
+
"twClasses": "text-current decoration-red-500 hover:bg-red-50 focus-visible:ring-red-500/30 hover:ring-red-50"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"attributes": {
|
|
292
|
+
"buttonColor": "navy-500",
|
|
293
|
+
"buttonVariant": "link"
|
|
294
|
+
},
|
|
295
|
+
"twClasses": "text-current decoration-navy-500 hover:bg-navy-50 focus-visible:ring-navy-500/30 hover:ring-navy-50"
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Card component template.
|
|
5
|
+
*
|
|
6
|
+
* @package %g_namespace%
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
|
|
10
|
+
|
|
11
|
+
$manifest = Helpers::getManifestByDir(__DIR__);
|
|
12
|
+
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
13
|
+
?>
|
|
14
|
+
|
|
15
|
+
<div class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest, $additionalClass)); ?>" >
|
|
16
|
+
<?php
|
|
17
|
+
echo Helpers::render('image', Helpers::props('image', $attributes, [
|
|
18
|
+
'additionalClass' => [
|
|
19
|
+
'image' => Helpers::getTwPart('image', $manifest),
|
|
20
|
+
'picture' => Helpers::getTwPart('imagePicture', $manifest),
|
|
21
|
+
]
|
|
22
|
+
]));
|
|
23
|
+
?>
|
|
24
|
+
|
|
25
|
+
<div class="<?php echo esc_attr(Helpers::getTwPart('content-container', $manifest)); ?>">
|
|
26
|
+
<?php
|
|
27
|
+
echo Helpers::render('paragraph', Helpers::props('intro', $attributes, [
|
|
28
|
+
'additionalClass' => Helpers::getTwPart('intro', $manifest),
|
|
29
|
+
])),
|
|
30
|
+
|
|
31
|
+
Helpers::render('heading', Helpers::props('heading', $attributes)),
|
|
32
|
+
|
|
33
|
+
Helpers::render('paragraph', Helpers::props('paragraph', $attributes, [
|
|
34
|
+
'additionalClass' => Helpers::getTwPart('text', $manifest),
|
|
35
|
+
])),
|
|
36
|
+
|
|
37
|
+
Helpers::render('button', Helpers::props('button', $attributes, [
|
|
38
|
+
'additionalClass' => Helpers::getTwPart('button', $manifest),
|
|
39
|
+
]));
|
|
40
|
+
?>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { props, getTwClasses, getTwPart } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
+
import { ImageEditor } from '../../image/components/image-editor';
|
|
3
|
+
import { HeadingEditor } from '../../heading/components/heading-editor';
|
|
4
|
+
import { ParagraphEditor } from '../../paragraph/components/paragraph-editor';
|
|
5
|
+
import { ButtonEditor } from '../../button/components/button-editor';
|
|
6
|
+
import manifest from './../manifest.json';
|
|
7
|
+
|
|
8
|
+
export const CardEditor = (attributes) => {
|
|
9
|
+
const { additionalClass } = attributes;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className={getTwClasses(attributes, manifest, additionalClass)}>
|
|
13
|
+
<ImageEditor
|
|
14
|
+
{...props('image', attributes, {
|
|
15
|
+
additionalClass: {
|
|
16
|
+
image: getTwPart('image', manifest),
|
|
17
|
+
picture: getTwPart('imagePicture', manifest),
|
|
18
|
+
imagePlaceholder:
|
|
19
|
+
'!border-x-0 !border-t-0 !border-solid !w-full !h-auto aspect-3/2 [&_svg]:!size-12 border-b !rounded-none bg-gray-100 !border-b-gray-200',
|
|
20
|
+
},
|
|
21
|
+
})}
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<div className={getTwPart('content-container', manifest)}>
|
|
25
|
+
<ParagraphEditor
|
|
26
|
+
{...props('intro', attributes, {
|
|
27
|
+
additionalClass: getTwPart('intro', manifest),
|
|
28
|
+
})}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<HeadingEditor {...props('heading', attributes)} />
|
|
32
|
+
|
|
33
|
+
<ParagraphEditor {...props('paragraph', attributes, { additionalClass: getTwPart('text', manifest) })} />
|
|
34
|
+
|
|
35
|
+
<ButtonEditor {...props('button', attributes, { additionalClass: getTwPart('button', manifest) })} />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { props, getOptions, checkAttr, getOption, getAttrKey } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
+
import { ImageOptions } from '../../image/components/image-options';
|
|
4
|
+
import { HeadingOptions } from '../../heading/components/heading-options';
|
|
5
|
+
import { ParagraphOptions } from '../../paragraph/components/paragraph-options';
|
|
6
|
+
import { ButtonOptions } from '../../button/components/button-options';
|
|
7
|
+
import { OptionSelect } from '@eightshift/ui-components';
|
|
8
|
+
import manifest from './../manifest.json';
|
|
9
|
+
|
|
10
|
+
export const CardOptions = (attributes) => {
|
|
11
|
+
const { setAttributes } = attributes;
|
|
12
|
+
|
|
13
|
+
const cardAlign = checkAttr('cardAlign', attributes, manifest);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<OptionSelect
|
|
18
|
+
value={cardAlign}
|
|
19
|
+
options={getOption('cardAlign', attributes, manifest)}
|
|
20
|
+
onChange={(value) => setAttributes({ [getAttrKey('cardAlign', attributes, manifest)]: value })}
|
|
21
|
+
aria-label={__('Card align', '%g_textdomain%')}
|
|
22
|
+
itemProps={{ size: 'large' }}
|
|
23
|
+
noItemLabel
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<div>
|
|
27
|
+
<ImageOptions
|
|
28
|
+
{...props('image', attributes)}
|
|
29
|
+
hideOptions='borderRadius'
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<ParagraphOptions
|
|
33
|
+
{...props('intro', attributes, { options: getOptions(attributes, manifest) })}
|
|
34
|
+
label={__('Intro', '%g_textdomain%')}
|
|
35
|
+
expandButtonDisabled
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
<HeadingOptions
|
|
39
|
+
{...props('heading', attributes, { options: getOptions(attributes, manifest) })}
|
|
40
|
+
hideOptions='size'
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<ParagraphOptions
|
|
44
|
+
{...props('paragraph', attributes, { options: getOptions(attributes, manifest) })}
|
|
45
|
+
expandButtonDisabled
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<ButtonOptions
|
|
49
|
+
{...props('button', attributes, { options: getOptions(attributes, manifest) })}
|
|
50
|
+
label={__('Call to action', '%g_textdomain%')}
|
|
51
|
+
hideOptions='variant,color'
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
+
"componentName": "card",
|
|
4
|
+
"title": "Card",
|
|
5
|
+
"componentClass": "card-simple",
|
|
6
|
+
"example": {
|
|
7
|
+
"attributes": {
|
|
8
|
+
"cardIntroContent": "This is intro",
|
|
9
|
+
"cardAlign": "start"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"attributes": {
|
|
13
|
+
"cardAlign": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"default": "start"
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
"cardIntroSize": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"default": "sm"
|
|
21
|
+
},
|
|
22
|
+
"cardButtonVariant": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"default": "secondary"
|
|
25
|
+
},
|
|
26
|
+
"cardHeadingSize": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"default": "md"
|
|
29
|
+
},
|
|
30
|
+
"cardHeadingTag": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"default": "p"
|
|
33
|
+
},
|
|
34
|
+
"cardParagraphSize": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"default": "sm"
|
|
37
|
+
},
|
|
38
|
+
"cardButtonContent": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"default": "Read more"
|
|
41
|
+
},
|
|
42
|
+
"cardButtonColor": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"default": "gray-500"
|
|
45
|
+
},
|
|
46
|
+
"cardButtonSize": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"default": "sm"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"options": {
|
|
52
|
+
"cardAlign": [
|
|
53
|
+
{
|
|
54
|
+
"label": "Start",
|
|
55
|
+
"value": "start",
|
|
56
|
+
"icon": "textAlignLeft"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"label": "Center",
|
|
60
|
+
"value": "center",
|
|
61
|
+
"icon": "textAlignCenter"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"label": "End",
|
|
65
|
+
"value": "end",
|
|
66
|
+
"icon": "textAlignRight"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"components": {
|
|
71
|
+
"image": "image",
|
|
72
|
+
"intro": "paragraph",
|
|
73
|
+
"heading": "heading",
|
|
74
|
+
"paragraph": "paragraph",
|
|
75
|
+
"button": "button"
|
|
76
|
+
},
|
|
77
|
+
"tailwind": {
|
|
78
|
+
"base": {
|
|
79
|
+
"twClasses": "w-full sm:max-w-80 rounded-2xl border bg-white shadow-md overflow-hidden"
|
|
80
|
+
},
|
|
81
|
+
"parts": {
|
|
82
|
+
"image": {
|
|
83
|
+
"twClasses": "w-full aspect-3/2"
|
|
84
|
+
},
|
|
85
|
+
"imagePicture": {
|
|
86
|
+
"twClasses": "w-full !block border-b border-b-gray-200 bg-gray-100"
|
|
87
|
+
},
|
|
88
|
+
"content-container": {
|
|
89
|
+
"twClasses": "p-4"
|
|
90
|
+
},
|
|
91
|
+
"intro": {
|
|
92
|
+
"twClasses": "text-gray-400 italic"
|
|
93
|
+
},
|
|
94
|
+
"text": {
|
|
95
|
+
"twClasses": "mt-2 text-gray-600"
|
|
96
|
+
},
|
|
97
|
+
"button": {
|
|
98
|
+
"twClasses": "mt-3"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"options": {
|
|
102
|
+
"cardAlign": {
|
|
103
|
+
"twClasses": {
|
|
104
|
+
"start": "text-start",
|
|
105
|
+
"center": "text-center",
|
|
106
|
+
"end": "text-end"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|