@brilo/base-blocks 0.1.41 → 0.1.43
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/build/.tsbuildinfo +1 -1
- package/build/blocks/compare/compare-group/types.d.ts +1 -1
- package/build/blocks/compare/compare-group/types.d.ts.map +1 -1
- package/build/blocks/compare/compare-option/types.d.ts +1 -1
- package/build/blocks/compare/compare-option/types.d.ts.map +1 -1
- package/build/blocks/core/basic-button/edit.d.ts.map +1 -1
- package/build/blocks/core/basic-button/edit.js +3 -3
- package/build/blocks/core/basic-button/factory.d.ts.map +1 -1
- package/build/blocks/core/basic-button/factory.js +1 -0
- package/build/blocks/core/basic-button/types.d.ts +1 -0
- package/build/blocks/core/basic-button/types.d.ts.map +1 -1
- package/build/blocks/core/basic-overline/edit.d.ts.map +1 -1
- package/build/blocks/core/basic-overline/edit.js +6 -1
- package/build/blocks/core/basic-overline/factory.d.ts.map +1 -1
- package/build/blocks/core/basic-overline/factory.js +2 -0
- package/build/blocks/core/basic-overline/types.d.ts +3 -1
- package/build/blocks/core/basic-overline/types.d.ts.map +1 -1
- package/build/blocks/form/form-field/edit.d.ts +1 -1
- package/build/blocks/form/form-field/edit.d.ts.map +1 -1
- package/build/blocks/form/form-field/types.d.ts +1 -1
- package/build/blocks/form/form-field/types.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-item/index.d.ts +1 -1
- package/build/blocks/gallery/gallery-item/index.d.ts.map +1 -1
- package/build/blocks/groups/banner-group/index.d.ts +1 -1
- package/build/blocks/groups/banner-group/index.d.ts.map +1 -1
- package/build/blocks/groups/banner-group/types.d.ts +2 -2
- package/build/blocks/groups/banner-group/types.d.ts.map +1 -1
- package/build/blocks/groups/basic-header-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/basic-header-group/edit.js +8 -3
- package/build/blocks/groups/basic-header-group/factory.js +1 -1
- package/build/blocks/groups/basic-header-group/types.d.ts +2 -0
- package/build/blocks/groups/basic-header-group/types.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/constants.d.ts +25 -0
- package/build/blocks/groups/text-and-media-group/constants.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/constants.js +10 -0
- package/build/blocks/groups/text-and-media-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/edit.js +16 -9
- package/build/blocks/groups/text-and-media-group/factory.d.ts +2 -2
- package/build/blocks/groups/text-and-media-group/factory.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/factory.js +12 -10
- package/build/blocks/groups/text-and-media-group/types.d.ts +8 -3
- package/build/blocks/groups/text-and-media-group/types.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/constants.d.ts +16 -0
- package/build/blocks/hero/hero-group/constants.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/constants.js +7 -0
- package/build/blocks/hero/hero-group/edit.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/edit.js +6 -5
- package/build/blocks/hero/hero-group/factory.d.ts +2 -2
- package/build/blocks/hero/hero-group/factory.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/factory.js +11 -5
- package/build/blocks/hero/hero-group/types.d.ts +7 -4
- package/build/blocks/hero/hero-group/types.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/edit.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/edit.js +7 -2
- package/build/blocks/hero/hero-item/factory.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/factory.js +1 -0
- package/build/blocks/hero/hero-item/types.d.ts +12 -2
- package/build/blocks/hero/hero-item/types.d.ts.map +1 -1
- package/build/blocks/link/link-item/factory.d.ts +1 -1
- package/build/blocks/link/link-item/factory.d.ts.map +1 -1
- package/build/blocks/map/map-group/types.d.ts +3 -3
- package/build/blocks/map/map-group/types.d.ts.map +1 -1
- package/build/blocks/newsletter/newsletter-form/types.d.ts +1 -1
- package/build/blocks/newsletter/newsletter-form/types.d.ts.map +1 -1
- package/build/blocks/person/person-group/types.d.ts +1 -1
- package/build/blocks/person/person-group/types.d.ts.map +1 -1
- package/build/blocks/person/person-item/constants.d.ts.map +1 -1
- package/build/blocks/person/person-item/types.d.ts +2 -2
- package/build/blocks/person/person-item/types.d.ts.map +1 -1
- package/build/blocks/priceplan/priceplan-group/constants.d.ts +2 -0
- package/build/blocks/priceplan/priceplan-group/constants.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-group/constants.js +1 -0
- package/build/blocks/priceplan/priceplan-group/edit.d.ts +3 -0
- package/build/blocks/priceplan/priceplan-group/edit.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-group/edit.js +16 -0
- package/build/blocks/priceplan/priceplan-group/factory.d.ts +5 -0
- package/build/blocks/priceplan/priceplan-group/factory.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-group/factory.js +20 -0
- package/build/blocks/priceplan/priceplan-group/icon.d.ts +2 -0
- package/build/blocks/priceplan/priceplan-group/icon.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-group/icon.js +2 -0
- package/build/blocks/priceplan/priceplan-group/index.d.ts +5 -0
- package/build/blocks/priceplan/priceplan-group/index.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-group/index.js +11 -0
- package/build/blocks/priceplan/priceplan-group/types.d.ts +7 -0
- package/build/blocks/priceplan/priceplan-group/types.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-group/types.js +1 -0
- package/build/blocks/priceplan/priceplan-item/constants.d.ts +15 -0
- package/build/blocks/priceplan/priceplan-item/constants.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-item/constants.js +9 -0
- package/build/blocks/priceplan/priceplan-item/edit.d.ts +6 -0
- package/build/blocks/priceplan/priceplan-item/edit.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-item/edit.js +30 -0
- package/build/blocks/priceplan/priceplan-item/factory.d.ts +7 -0
- package/build/blocks/priceplan/priceplan-item/factory.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-item/factory.js +70 -0
- package/build/blocks/priceplan/priceplan-item/icon.d.ts +2 -0
- package/build/blocks/priceplan/priceplan-item/icon.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-item/icon.js +2 -0
- package/build/blocks/priceplan/priceplan-item/index.d.ts +5 -0
- package/build/blocks/priceplan/priceplan-item/index.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-item/index.js +12 -0
- package/build/blocks/priceplan/priceplan-item/types.d.ts +28 -0
- package/build/blocks/priceplan/priceplan-item/types.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-item/types.js +1 -0
- package/build/blocks/priceplan/priceplan-list-item/constants.d.ts +8 -0
- package/build/blocks/priceplan/priceplan-list-item/constants.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-list-item/constants.js +5 -0
- package/build/blocks/priceplan/priceplan-list-item/edit.d.ts +6 -0
- package/build/blocks/priceplan/priceplan-list-item/edit.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-list-item/edit.js +17 -0
- package/build/blocks/priceplan/priceplan-list-item/factory.d.ts +7 -0
- package/build/blocks/priceplan/priceplan-list-item/factory.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-list-item/factory.js +30 -0
- package/build/blocks/priceplan/priceplan-list-item/icon.d.ts +2 -0
- package/build/blocks/priceplan/priceplan-list-item/icon.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-list-item/icon.js +2 -0
- package/build/blocks/priceplan/priceplan-list-item/index.d.ts +5 -0
- package/build/blocks/priceplan/priceplan-list-item/index.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-list-item/index.js +5 -0
- package/build/blocks/priceplan/priceplan-list-item/types.d.ts +11 -0
- package/build/blocks/priceplan/priceplan-list-item/types.d.ts.map +1 -0
- package/build/blocks/priceplan/priceplan-list-item/types.js +1 -0
- package/build/blocks/review/review-group/constants.d.ts +16 -0
- package/build/blocks/review/review-group/constants.d.ts.map +1 -0
- package/build/blocks/review/review-group/constants.js +16 -0
- package/build/blocks/review/review-group/edit.d.ts +4 -0
- package/build/blocks/review/review-group/edit.d.ts.map +1 -0
- package/build/blocks/review/review-group/edit.js +28 -0
- package/build/blocks/review/review-group/factory.d.ts +7 -0
- package/build/blocks/review/review-group/factory.d.ts.map +1 -0
- package/build/blocks/review/review-group/factory.js +36 -0
- package/build/blocks/review/review-group/icon.d.ts +2 -0
- package/build/blocks/review/review-group/icon.d.ts.map +1 -0
- package/build/blocks/review/review-group/icon.js +2 -0
- package/build/blocks/review/review-group/index.d.ts +5 -0
- package/build/blocks/review/review-group/index.d.ts.map +1 -0
- package/build/blocks/review/review-group/index.js +6 -0
- package/build/blocks/review/review-group/types.d.ts +15 -0
- package/build/blocks/review/review-group/types.d.ts.map +1 -0
- package/build/blocks/review/review-group/types.js +1 -0
- package/build/blocks/review/review-item/constants.d.ts +2 -0
- package/build/blocks/review/review-item/constants.d.ts.map +1 -0
- package/build/blocks/review/review-item/constants.js +1 -0
- package/build/blocks/review/review-item/edit.d.ts +4 -0
- package/build/blocks/review/review-item/edit.d.ts.map +1 -0
- package/build/blocks/review/review-item/edit.js +29 -0
- package/build/blocks/review/review-item/factory.d.ts +5 -0
- package/build/blocks/review/review-item/factory.d.ts.map +1 -0
- package/build/blocks/review/review-item/factory.js +36 -0
- package/build/blocks/review/review-item/icon.d.ts +2 -0
- package/build/blocks/review/review-item/icon.d.ts.map +1 -0
- package/build/blocks/review/review-item/icon.js +2 -0
- package/build/blocks/review/review-item/index.d.ts +5 -0
- package/build/blocks/review/review-item/index.d.ts.map +1 -0
- package/build/blocks/review/review-item/index.js +5 -0
- package/build/blocks/review/review-item/types.d.ts +17 -0
- package/build/blocks/review/review-item/types.d.ts.map +1 -0
- package/build/blocks/review/review-item/types.js +1 -0
- package/build/blocks/sections/base-section/attributes.d.ts +25 -0
- package/build/blocks/sections/base-section/attributes.d.ts.map +1 -1
- package/build/blocks/sections/base-section/attributes.js +9 -0
- package/build/blocks/sections/base-section/controls.d.ts.map +1 -1
- package/build/blocks/sections/base-section/controls.js +46 -2
- package/build/blocks/sections/base-section/types.d.ts +24 -1
- package/build/blocks/sections/base-section/types.d.ts.map +1 -1
- package/build/blocks/share/share/index.d.ts.map +1 -1
- package/build/blocks/share/share/index.js +1 -0
- package/build/blocks/signpost/signpost-group/constants.d.ts +26 -0
- package/build/blocks/signpost/signpost-group/constants.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/constants.js +21 -0
- package/build/blocks/signpost/signpost-group/edit.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/edit.js +13 -8
- package/build/blocks/signpost/signpost-group/factory.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/factory.js +5 -1
- package/build/blocks/signpost/signpost-group/types.d.ts +5 -1
- package/build/blocks/signpost/signpost-group/types.d.ts.map +1 -1
- package/build/blocks/step/step-group/edit.d.ts +1 -1
- package/build/blocks/step/step-group/edit.d.ts.map +1 -1
- package/build/blocks/step/step-group/factory.d.ts +1 -1
- package/build/blocks/step/step-group/factory.d.ts.map +1 -1
- package/build/blocks/step/step-group/types.d.ts +2 -2
- package/build/blocks/step/step-group/types.d.ts.map +1 -1
- package/build/blocks/step/step-item/types.d.ts +1 -1
- package/build/blocks/step/step-item/types.d.ts.map +1 -1
- package/build/blocks/testimonial/testimonial-group/index.d.ts +1 -1
- package/build/blocks/testimonial/testimonial-group/index.d.ts.map +1 -1
- package/build/blocks/testimonial/testimonial-group/types.d.ts +1 -1
- package/build/blocks/testimonial/testimonial-group/types.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/edit.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/edit.js +9 -2
- package/build/blocks/text-and-form/text-and-form-text-column/factory.js +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/types.d.ts +2 -0
- package/build/blocks/text-and-form/text-and-form-text-column/types.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/types.d.ts +1 -1
- package/build/blocks/usp/usp-item/types.d.ts.map +1 -1
- package/build/blocks/video/video-group/constants.d.ts +15 -0
- package/build/blocks/video/video-group/constants.d.ts.map +1 -0
- package/build/blocks/video/video-group/constants.js +9 -0
- package/build/blocks/video/video-group/edit.d.ts +4 -0
- package/build/blocks/video/video-group/edit.d.ts.map +1 -0
- package/build/blocks/video/video-group/edit.js +23 -0
- package/build/blocks/video/video-group/factory.d.ts +5 -0
- package/build/blocks/video/video-group/factory.d.ts.map +1 -0
- package/build/blocks/video/video-group/factory.js +47 -0
- package/build/blocks/video/video-group/icon.d.ts +2 -0
- package/build/blocks/video/video-group/icon.d.ts.map +1 -0
- package/build/blocks/video/video-group/icon.js +2 -0
- package/build/blocks/video/video-group/index.d.ts +5 -0
- package/build/blocks/video/video-group/index.d.ts.map +1 -0
- package/build/blocks/video/video-group/index.js +5 -0
- package/build/blocks/video/video-group/types.d.ts +19 -0
- package/build/blocks/video/video-group/types.d.ts.map +1 -0
- package/build/blocks/video/video-group/types.js +1 -0
- package/build/components/Document/DocumentTermSelectModal.js +1 -1
- package/build/components/EntitySelectModal/EntitySelectModal.d.ts.map +1 -0
- package/build/components/Event/EventSelectModal.js +1 -1
- package/build/components/Event/EventTermSelectModal.js +1 -1
- package/build/components/Post/PostSelectModal.js +1 -1
- package/build/components/Post/PostTermSelectModal.js +1 -1
- package/build/index.d.ts +12 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +6 -0
- package/build/types.d.ts +1 -1
- package/build/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/blocks/compare/compare-group/types.ts +1 -1
- package/src/blocks/compare/compare-option/types.ts +1 -1
- package/src/blocks/core/basic-button/edit.tsx +29 -18
- package/src/blocks/core/basic-button/factory.tsx +1 -0
- package/src/blocks/core/basic-button/types.ts +1 -0
- package/src/blocks/core/basic-overline/edit.tsx +8 -0
- package/src/blocks/core/basic-overline/factory.tsx +2 -0
- package/src/blocks/core/basic-overline/types.ts +3 -1
- package/src/blocks/form/form-field/edit.tsx +1 -1
- package/src/blocks/form/form-field/types.ts +4 -4
- package/src/blocks/form/form-group/editor.scss +1 -0
- package/src/blocks/gallery/gallery-item/index.ts +1 -1
- package/src/blocks/groups/banner-group/index.ts +1 -1
- package/src/blocks/groups/banner-group/types.ts +2 -2
- package/src/blocks/groups/basic-header-group/edit.tsx +25 -1
- package/src/blocks/groups/basic-header-group/factory.tsx +1 -1
- package/src/blocks/groups/basic-header-group/types.ts +1 -1
- package/src/blocks/groups/text-and-media-group/constants.ts +11 -0
- package/src/blocks/groups/text-and-media-group/edit.tsx +37 -2
- package/src/blocks/groups/text-and-media-group/editor.scss +50 -4
- package/src/blocks/groups/text-and-media-group/factory.tsx +10 -4
- package/src/blocks/groups/text-and-media-group/types.ts +7 -1
- package/src/blocks/hero/hero-group/constants.ts +8 -0
- package/src/blocks/hero/hero-group/edit.tsx +16 -4
- package/src/blocks/hero/hero-group/factory.tsx +13 -4
- package/src/blocks/hero/hero-group/types.ts +15 -3
- package/src/blocks/hero/hero-item/edit.tsx +42 -2
- package/src/blocks/hero/hero-item/editor.scss +13 -0
- package/src/blocks/hero/hero-item/factory.tsx +1 -0
- package/src/blocks/hero/hero-item/types.ts +4 -2
- package/src/blocks/link/link-item/factory.tsx +1 -1
- package/src/blocks/map/map-group/types.ts +3 -3
- package/src/blocks/newsletter/newsletter-form/types.ts +1 -1
- package/src/blocks/person/person-group/types.ts +1 -1
- package/src/blocks/person/person-item/constants.ts +0 -3
- package/src/blocks/person/person-item/types.ts +2 -2
- package/src/blocks/priceplan/priceplan-group/constants.ts +1 -0
- package/src/blocks/priceplan/priceplan-group/edit.tsx +21 -0
- package/src/blocks/priceplan/priceplan-group/editor.scss +3 -0
- package/src/blocks/priceplan/priceplan-group/factory.tsx +23 -0
- package/src/blocks/priceplan/priceplan-group/icon.tsx +36 -0
- package/src/blocks/priceplan/priceplan-group/index.ts +15 -0
- package/src/blocks/priceplan/priceplan-group/types.ts +7 -0
- package/src/blocks/priceplan/priceplan-item/constants.ts +11 -0
- package/src/blocks/priceplan/priceplan-item/edit.tsx +158 -0
- package/src/blocks/priceplan/priceplan-item/editor.scss +131 -0
- package/src/blocks/priceplan/priceplan-item/factory.tsx +80 -0
- package/src/blocks/priceplan/priceplan-item/icon.tsx +9 -0
- package/src/blocks/priceplan/priceplan-item/index.ts +16 -0
- package/src/blocks/priceplan/priceplan-item/types.ts +34 -0
- package/src/blocks/priceplan/priceplan-list-item/constants.ts +6 -0
- package/src/blocks/priceplan/priceplan-list-item/edit.tsx +59 -0
- package/src/blocks/priceplan/priceplan-list-item/editor.scss +21 -0
- package/src/blocks/priceplan/priceplan-list-item/factory.tsx +38 -0
- package/src/blocks/priceplan/priceplan-list-item/icon.tsx +9 -0
- package/src/blocks/priceplan/priceplan-list-item/index.ts +9 -0
- package/src/blocks/priceplan/priceplan-list-item/types.ts +13 -0
- package/src/blocks/review/review-group/constants.ts +19 -0
- package/src/blocks/review/review-group/edit.tsx +72 -0
- package/src/blocks/review/review-group/editor.scss +10 -0
- package/src/blocks/review/review-group/factory.tsx +43 -0
- package/src/blocks/review/review-group/icon.tsx +12 -0
- package/src/blocks/review/review-group/index.ts +10 -0
- package/src/blocks/review/review-group/types.ts +17 -0
- package/src/blocks/review/review-item/constants.ts +1 -0
- package/src/blocks/review/review-item/edit.tsx +126 -0
- package/src/blocks/review/review-item/editor.scss +96 -0
- package/src/blocks/review/review-item/factory.tsx +40 -0
- package/src/blocks/review/review-item/icon.tsx +9 -0
- package/src/blocks/review/review-item/index.ts +9 -0
- package/src/blocks/review/review-item/types.ts +19 -0
- package/src/blocks/sections/base-section/attributes.ts +9 -0
- package/src/blocks/sections/base-section/controls.tsx +97 -1
- package/src/blocks/sections/base-section/types.ts +9 -1
- package/src/blocks/share/share/index.ts +1 -0
- package/src/blocks/signpost/signpost-group/constants.ts +23 -0
- package/src/blocks/signpost/signpost-group/edit.tsx +25 -4
- package/src/blocks/signpost/signpost-group/factory.tsx +5 -1
- package/src/blocks/signpost/signpost-group/types.ts +4 -1
- package/src/blocks/signpost/signpost-item/editor.scss +5 -0
- package/src/blocks/step/step-group/edit.tsx +1 -1
- package/src/blocks/step/step-group/factory.tsx +1 -1
- package/src/blocks/step/step-group/types.ts +2 -2
- package/src/blocks/step/step-item/types.ts +1 -1
- package/src/blocks/testimonial/testimonial-group/index.ts +1 -1
- package/src/blocks/testimonial/testimonial-group/types.ts +1 -1
- package/src/blocks/text-and-form/text-and-form-text-column/edit.tsx +31 -0
- package/src/blocks/text-and-form/text-and-form-text-column/editor.scss +8 -4
- package/src/blocks/text-and-form/text-and-form-text-column/factory.tsx +1 -1
- package/src/blocks/text-and-form/text-and-form-text-column/types.ts +1 -1
- package/src/blocks/usp/usp-item/types.ts +1 -1
- package/src/blocks/video/video-group/constants.ts +11 -0
- package/src/blocks/video/video-group/edit.tsx +158 -0
- package/src/blocks/video/video-group/editor.scss +105 -0
- package/src/blocks/video/video-group/factory.tsx +51 -0
- package/src/blocks/video/video-group/icon.tsx +17 -0
- package/src/blocks/video/video-group/index.ts +9 -0
- package/src/blocks/video/video-group/types.ts +21 -0
- package/src/components/Document/DocumentTermSelectModal.tsx +1 -1
- package/src/components/Event/EventSelectModal.tsx +1 -1
- package/src/components/Event/EventTermSelectModal.tsx +1 -1
- package/src/components/ImagePicker/ImagePicker.tsx +1 -1
- package/src/components/Post/PostSelectModal.tsx +1 -1
- package/src/components/Post/PostTermSelectModal.tsx +1 -1
- package/src/editor.scss +6 -0
- package/src/index.ts +12 -0
- package/src/types.ts +1 -1
- package/build/components/Event/EntitySelectModal.d.ts.map +0 -1
- /package/build/components/{Event → EntitySelectModal}/EntitySelectModal.d.ts +0 -0
- /package/build/components/{Event → EntitySelectModal}/EntitySelectModal.js +0 -0
- /package/src/components/{Event → EntitySelectModal}/EntitySelectModal.tsx +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {InspectorControls, RichText, useBlockProps} from '@wordpress/block-editor'
|
|
2
|
+
import {
|
|
3
|
+
PanelBody,
|
|
4
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
5
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
6
|
+
} from '@wordpress/components'
|
|
7
|
+
import {__} from '@wordpress/i18n'
|
|
8
|
+
import clsx from 'clsx'
|
|
9
|
+
import {LIST_VARIANTS} from './constants'
|
|
10
|
+
import type {PriceplanListItemAttributes, PriceplanListItemOptions, PriceplanListVariant} from './types'
|
|
11
|
+
|
|
12
|
+
export function createPriceplanListItemEdit(options: PriceplanListItemOptions) {
|
|
13
|
+
const LIST_VARIANTS_OPTIONS = options.variants ?? LIST_VARIANTS
|
|
14
|
+
|
|
15
|
+
return function Edit({
|
|
16
|
+
attributes,
|
|
17
|
+
setAttributes,
|
|
18
|
+
}: {
|
|
19
|
+
attributes: PriceplanListItemAttributes
|
|
20
|
+
setAttributes: (a: Partial<PriceplanListItemAttributes>) => void
|
|
21
|
+
}) {
|
|
22
|
+
const {title, variant} = attributes
|
|
23
|
+
|
|
24
|
+
const blockProps = useBlockProps({
|
|
25
|
+
className: clsx('i-priceplan-list', `--${variant}`),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<InspectorControls>
|
|
31
|
+
<PanelBody title={__('Položka', 'brilo-blocks')}>
|
|
32
|
+
<ToggleGroupControl
|
|
33
|
+
label={__('Stav', 'brilo-blocks')}
|
|
34
|
+
value={variant}
|
|
35
|
+
onChange={(value) => setAttributes({variant: value as PriceplanListVariant})}
|
|
36
|
+
isBlock
|
|
37
|
+
>
|
|
38
|
+
{LIST_VARIANTS_OPTIONS.map((v) => (
|
|
39
|
+
<ToggleGroupControlOption key={v.value} value={v.value} label={v.label} />
|
|
40
|
+
))}
|
|
41
|
+
</ToggleGroupControl>
|
|
42
|
+
</PanelBody>
|
|
43
|
+
</InspectorControls>
|
|
44
|
+
|
|
45
|
+
<div {...blockProps}>
|
|
46
|
+
<span className="i-priceplan-list__icon">{variant === 'included' ? '✓' : '✕'}</span>
|
|
47
|
+
<RichText
|
|
48
|
+
tagName="span"
|
|
49
|
+
className="i-priceplan-list__title u-text-editable"
|
|
50
|
+
value={title}
|
|
51
|
+
onChange={(value) => setAttributes({title: value})}
|
|
52
|
+
placeholder={__('Funkce...', 'brilo-blocks')}
|
|
53
|
+
allowedFormats={['core/bold', 'core/italic', 'core/link', 'brilo-blocks/text-color']}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.i-priceplan-list {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: baseline;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
padding: 2px 0;
|
|
7
|
+
|
|
8
|
+
&.--excluded {
|
|
9
|
+
opacity: 0.45;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.i-priceplan-list__icon {
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
font-size: 13px;
|
|
16
|
+
font-weight: 700;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.i-priceplan-list__title {
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
import type {OptionArray} from '~/types'
|
|
4
|
+
import {LIST_VARIANTS} from './constants'
|
|
5
|
+
import {createPriceplanListItemEdit} from './edit'
|
|
6
|
+
import {icon as defaultIcon} from './icon'
|
|
7
|
+
import type {PriceplanListItemAttributes, PriceplanListItemOptions} from './types'
|
|
8
|
+
|
|
9
|
+
export type {PriceplanListItemAttributes, PriceplanListItemOptions}
|
|
10
|
+
|
|
11
|
+
export function createPriceplanListItemBlock<TVariants extends OptionArray = typeof LIST_VARIANTS>(
|
|
12
|
+
options: PriceplanListItemOptions<TVariants>,
|
|
13
|
+
): BlockConfiguration<PriceplanListItemAttributes<TVariants[number]['value']>> {
|
|
14
|
+
const variants = options.variants ?? LIST_VARIANTS
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
name: options.name,
|
|
18
|
+
title: options.title ?? __('Ceník položka seznamu', 'brilo-blocks'),
|
|
19
|
+
description: options.description ?? __('Položka ceníkového seznamu funkcí (zahrnuto / nezahrnuto)', 'brilo-blocks'),
|
|
20
|
+
category: options.category ?? 'layout',
|
|
21
|
+
...(options.parent && {parent: options.parent}),
|
|
22
|
+
icon: options.icon ?? {src: defaultIcon},
|
|
23
|
+
supports: {html: false, customClassName: false},
|
|
24
|
+
attributes: {
|
|
25
|
+
title: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: '',
|
|
28
|
+
},
|
|
29
|
+
variant: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: variants[0].value,
|
|
32
|
+
enum: variants.map((v) => v.value),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
edit: createPriceplanListItemEdit(options as unknown as PriceplanListItemOptions),
|
|
36
|
+
save: () => null,
|
|
37
|
+
} as unknown as BlockConfiguration<PriceplanListItemAttributes<TVariants[number]['value']>>
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const icon = (
|
|
2
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<title>Priceplan List Item</title>
|
|
4
|
+
<path d="M4 6L6 8L10 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
|
5
|
+
<path d="M13 6H17" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
|
6
|
+
<path d="M4 14L6 16L10 12" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
|
7
|
+
<path d="M13 14H17" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
|
8
|
+
</svg>
|
|
9
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type {PriceplanListItemOptions} from './types'
|
|
2
|
+
|
|
3
|
+
export type {PriceplanListItemAttributes, PriceplanListItemOptions} from './types'
|
|
4
|
+
export {createPriceplanListItemBlock} from './factory'
|
|
5
|
+
|
|
6
|
+
export const priceplanListItemDefaults: PriceplanListItemOptions = {
|
|
7
|
+
name: 'brilo/priceplan-list-item',
|
|
8
|
+
parent: ['brilo/priceplan-item'],
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type {BriloBlockType, OptionArray} from '~/types'
|
|
2
|
+
import type {LIST_VARIANTS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type PriceplanListVariant = (typeof LIST_VARIANTS)[number]['value']
|
|
5
|
+
|
|
6
|
+
export interface PriceplanListItemAttributes<TVariant extends string = PriceplanListVariant> extends Record<string, unknown> {
|
|
7
|
+
title: string
|
|
8
|
+
variant: TVariant
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PriceplanListItemOptions<TVariants extends OptionArray = typeof LIST_VARIANTS> extends BriloBlockType {
|
|
12
|
+
variants?: TVariants
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {__} from '@wordpress/i18n'
|
|
2
|
+
|
|
3
|
+
export const VARIANTS = [
|
|
4
|
+
{
|
|
5
|
+
value: 'default',
|
|
6
|
+
label: __('Výchozí', 'brilo-blocks'),
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
value: 'slider',
|
|
10
|
+
label: __('Slider', 'brilo-blocks'),
|
|
11
|
+
},
|
|
12
|
+
] as const
|
|
13
|
+
|
|
14
|
+
export const COLUMNS = [2, 3, 4] as const
|
|
15
|
+
|
|
16
|
+
export const IMAGE_MODES = [
|
|
17
|
+
{value: 'avatar', label: __('Zobrazit', 'brilo-blocks')},
|
|
18
|
+
{value: 'none', label: __('Skrýt', 'brilo-blocks')},
|
|
19
|
+
] as const
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {InspectorControls} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockEditProps} from '@wordpress/blocks'
|
|
3
|
+
import {
|
|
4
|
+
PanelBody,
|
|
5
|
+
SelectControl,
|
|
6
|
+
ToggleControl,
|
|
7
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
8
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
9
|
+
} from '@wordpress/components'
|
|
10
|
+
import {__} from '@wordpress/i18n'
|
|
11
|
+
import clsx from 'clsx'
|
|
12
|
+
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
13
|
+
import {COLUMNS, VARIANTS} from './constants'
|
|
14
|
+
import type {ReviewColumns, ReviewGroupAttributes, ReviewGroupOptions, ReviewImageMode, Variant} from './types'
|
|
15
|
+
|
|
16
|
+
export function createReviewGroupEdit(options: ReviewGroupOptions) {
|
|
17
|
+
const VARIANTS_OPTIONS = options.variants ?? VARIANTS
|
|
18
|
+
|
|
19
|
+
return function ReviewGroupEdit({attributes, setAttributes}: BlockEditProps<ReviewGroupAttributes>) {
|
|
20
|
+
const {columns, image, variant} = attributes
|
|
21
|
+
|
|
22
|
+
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
23
|
+
blockClassName: clsx(
|
|
24
|
+
options.blockClassName ?? 'g-review wp-block-section',
|
|
25
|
+
`--variant-${variant}`,
|
|
26
|
+
image === 'none' && '--image-none',
|
|
27
|
+
),
|
|
28
|
+
containerClassName: [options.containerClassName ?? 'u-grid-responsive-blocks-list', `--col-${columns}`],
|
|
29
|
+
containerStyle: {'--grid-max-col-count': columns},
|
|
30
|
+
allowedBlocks: options.allowedBlocks ?? ['brilo/review-item'],
|
|
31
|
+
template: options.template ?? [
|
|
32
|
+
['brilo/review-item', {}],
|
|
33
|
+
['brilo/review-item', {}],
|
|
34
|
+
['brilo/review-item', {}],
|
|
35
|
+
],
|
|
36
|
+
layout: {type: 'default'},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<InspectorControls>
|
|
42
|
+
<PanelBody title={__('Rozložení', 'brilo-blocks')}>
|
|
43
|
+
<ToggleGroupControl
|
|
44
|
+
isBlock
|
|
45
|
+
label={__('Varianta', 'brilo-blocks')}
|
|
46
|
+
value={variant}
|
|
47
|
+
onChange={(v) => setAttributes({variant: v as Variant})}
|
|
48
|
+
>
|
|
49
|
+
{VARIANTS_OPTIONS.map((v) => (
|
|
50
|
+
<ToggleGroupControlOption key={v.value} value={v.value} label={v.label} />
|
|
51
|
+
))}
|
|
52
|
+
</ToggleGroupControl>
|
|
53
|
+
<SelectControl
|
|
54
|
+
label={__('Počet sloupců', 'brilo-blocks')}
|
|
55
|
+
value={String(columns)}
|
|
56
|
+
options={COLUMNS.map((c) => ({value: String(c), label: String(c)}))}
|
|
57
|
+
onChange={(value) => setAttributes({columns: Number(value) as ReviewColumns})}
|
|
58
|
+
/>
|
|
59
|
+
<ToggleControl
|
|
60
|
+
label={__('Zobrazit foto autora', 'brilo-blocks')}
|
|
61
|
+
checked={image === 'avatar'}
|
|
62
|
+
onChange={(checked) => setAttributes({image: (checked ? 'avatar' : 'none') as ReviewImageMode})}
|
|
63
|
+
/>
|
|
64
|
+
</PanelBody>
|
|
65
|
+
</InspectorControls>
|
|
66
|
+
<div {...blockProps}>
|
|
67
|
+
<div {...innerBlocksProps} />
|
|
68
|
+
</div>
|
|
69
|
+
</>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import type {OptionArray} from '~/types'
|
|
5
|
+
import {COLUMNS, VARIANTS} from './constants'
|
|
6
|
+
import {createReviewGroupEdit} from './edit'
|
|
7
|
+
import {icon as defaultIcon} from './icon'
|
|
8
|
+
import type {ReviewGroupAttributes, ReviewGroupOptions} from './types'
|
|
9
|
+
|
|
10
|
+
export type {ReviewGroupAttributes, ReviewGroupOptions}
|
|
11
|
+
|
|
12
|
+
export function createReviewGroupBlock<TVariants extends OptionArray = typeof VARIANTS>(
|
|
13
|
+
options: ReviewGroupOptions<TVariants>,
|
|
14
|
+
): BlockConfiguration<ReviewGroupAttributes<TVariants[number]['value']>> {
|
|
15
|
+
const variants = options.variants ?? VARIANTS
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
name: options.name,
|
|
19
|
+
title: options.title ?? __('Recenze', 'brilo-blocks'),
|
|
20
|
+
description: options.description ?? __('Grid recenzí / hodnocení zákazníků', 'brilo-blocks'),
|
|
21
|
+
category: options.category ?? 'layout',
|
|
22
|
+
...(options.parent && {parent: options.parent}),
|
|
23
|
+
icon: options.icon ?? {src: defaultIcon},
|
|
24
|
+
supports: {html: false, customClassName: false},
|
|
25
|
+
attributes: {
|
|
26
|
+
variant: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: variants[0].value,
|
|
29
|
+
enum: variants.map((v) => v.value),
|
|
30
|
+
},
|
|
31
|
+
columns: {
|
|
32
|
+
type: 'number',
|
|
33
|
+
default: COLUMNS[1],
|
|
34
|
+
},
|
|
35
|
+
image: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
default: 'none',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
edit: createReviewGroupEdit(options as unknown as ReviewGroupOptions),
|
|
41
|
+
save: () => <InnerBlocks.Content />,
|
|
42
|
+
} as unknown as BlockConfiguration<ReviewGroupAttributes<TVariants[number]['value']>>
|
|
43
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const icon = (
|
|
2
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<title>Review Group</title>
|
|
4
|
+
<path
|
|
5
|
+
d="M3 4C3 2.89543 3.89543 2 5 2H15C16.1046 2 17 2.89543 17 4V13C17 14.1046 16.1046 15 15 15H11L7 18V15H5C3.89543 15 3 14.1046 3 13V4Z"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
strokeWidth="1.5"
|
|
8
|
+
/>
|
|
9
|
+
<path d="M6 6H14" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
|
10
|
+
<path d="M6 9H11" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
|
11
|
+
</svg>
|
|
12
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type {ReviewGroupOptions} from './types'
|
|
2
|
+
|
|
3
|
+
export type {ReviewColumns, ReviewGroupAttributes, ReviewGroupOptions, ReviewImageMode, ReviewVariant, Variant} from './types'
|
|
4
|
+
export {createReviewGroupBlock} from './factory'
|
|
5
|
+
|
|
6
|
+
export const reviewGroupDefaults: ReviewGroupOptions = {
|
|
7
|
+
name: 'brilo/review-group',
|
|
8
|
+
parent: ['brilo/base-section'],
|
|
9
|
+
allowedBlocks: ['brilo/review-item'],
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {BriloBlockType, OptionArray} from '~/types'
|
|
2
|
+
import type {COLUMNS, IMAGE_MODES, VARIANTS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type Variant = (typeof VARIANTS)[number]['value']
|
|
5
|
+
export type ReviewVariant = Variant
|
|
6
|
+
export type ReviewColumns = (typeof COLUMNS)[number]
|
|
7
|
+
export type ReviewImageMode = (typeof IMAGE_MODES)[number]['value']
|
|
8
|
+
|
|
9
|
+
export interface ReviewGroupAttributes<TVariant extends string = Variant> extends Record<string, unknown> {
|
|
10
|
+
variant: TVariant
|
|
11
|
+
columns: ReviewColumns
|
|
12
|
+
image: ReviewImageMode
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ReviewGroupOptions<TVariants extends OptionArray = typeof VARIANTS> extends BriloBlockType {
|
|
16
|
+
variants?: TVariants
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RATINGS = [1, 2, 3, 4, 5] as const
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {InspectorControls, MediaUpload, MediaUploadCheck, RichText, useBlockProps} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockEditProps} from '@wordpress/blocks'
|
|
3
|
+
import {
|
|
4
|
+
PanelBody,
|
|
5
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
6
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
7
|
+
} from '@wordpress/components'
|
|
8
|
+
import {__} from '@wordpress/i18n'
|
|
9
|
+
import clsx from 'clsx'
|
|
10
|
+
import {ImagePickerControl, useMediaUrl} from '~/components/ImagePicker'
|
|
11
|
+
import {RATINGS} from './constants'
|
|
12
|
+
import type {ReviewItemAttributes, ReviewItemOptions, ReviewRating} from './types'
|
|
13
|
+
|
|
14
|
+
function getInitials(name: string): string {
|
|
15
|
+
return name
|
|
16
|
+
.split(' ')
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.slice(0, 2)
|
|
19
|
+
.map((w) => w[0].toUpperCase())
|
|
20
|
+
.join('')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function createReviewItemEdit(options: ReviewItemOptions) {
|
|
24
|
+
return function ReviewItemEdit({attributes, setAttributes}: BlockEditProps<ReviewItemAttributes>) {
|
|
25
|
+
const {rating = 5, text = '', author = {img: {id: 0, alt: ''}, name: '', meta: ''}} = attributes
|
|
26
|
+
const avatarUrl = useMediaUrl(author?.img?.id)
|
|
27
|
+
|
|
28
|
+
const blockProps = useBlockProps({className: clsx(options.blockClassName ?? 'i-review')})
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<InspectorControls>
|
|
33
|
+
<PanelBody title={__('Hodnocení', 'brilo-blocks')}>
|
|
34
|
+
<ToggleGroupControl
|
|
35
|
+
label={__('Počet hvězd', 'brilo-blocks')}
|
|
36
|
+
value={rating}
|
|
37
|
+
isBlock
|
|
38
|
+
onChange={(value) => setAttributes({rating: Number(value) as ReviewRating})}
|
|
39
|
+
>
|
|
40
|
+
{RATINGS.map((r) => (
|
|
41
|
+
<ToggleGroupControlOption key={r} value={r} label={String(r)} />
|
|
42
|
+
))}
|
|
43
|
+
</ToggleGroupControl>
|
|
44
|
+
</PanelBody>
|
|
45
|
+
<PanelBody title={__('Autor', 'brilo-blocks')}>
|
|
46
|
+
<ImagePickerControl
|
|
47
|
+
value={author?.img ?? {id: 0, alt: ''}}
|
|
48
|
+
onChange={(val) => setAttributes({author: {...author, img: val}})}
|
|
49
|
+
labels={{
|
|
50
|
+
select: __('Vybrat fotku', 'brilo-blocks'),
|
|
51
|
+
change: __('Změnit fotku', 'brilo-blocks'),
|
|
52
|
+
remove: __('Odstranit fotku', 'brilo-blocks'),
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</PanelBody>
|
|
56
|
+
</InspectorControls>
|
|
57
|
+
<div {...blockProps}>
|
|
58
|
+
<div className="i-review__inner">
|
|
59
|
+
<div className="i-review__stars">
|
|
60
|
+
{RATINGS.map((n) => (
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
key={n}
|
|
64
|
+
className="i-review__star"
|
|
65
|
+
aria-label={`${n} z 5`}
|
|
66
|
+
onClick={() => setAttributes({rating: n as ReviewRating})}
|
|
67
|
+
>
|
|
68
|
+
{n <= rating ? '★' : '☆'}
|
|
69
|
+
</button>
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
<RichText
|
|
73
|
+
tagName="p"
|
|
74
|
+
className="i-review__text u-text-editable"
|
|
75
|
+
value={text}
|
|
76
|
+
onChange={(value) => setAttributes({text: value})}
|
|
77
|
+
placeholder={__('„Text recenze..."', 'brilo-blocks')}
|
|
78
|
+
allowedFormats={['core/bold', 'core/italic', 'brilo-blocks/text-color']}
|
|
79
|
+
/>
|
|
80
|
+
<hr className="i-review__divider" />
|
|
81
|
+
<div className="i-review__author">
|
|
82
|
+
<MediaUploadCheck>
|
|
83
|
+
<MediaUpload
|
|
84
|
+
onSelect={(media: {id: number; alt: string}) =>
|
|
85
|
+
setAttributes({author: {...author, img: {id: media.id, alt: media.alt ?? ''}}})
|
|
86
|
+
}
|
|
87
|
+
allowedTypes={['image']}
|
|
88
|
+
value={author?.img?.id || 0}
|
|
89
|
+
render={({open}: {open: () => void}) => (
|
|
90
|
+
<button type="button" className="i-review__avatar" onClick={open}>
|
|
91
|
+
{author?.img?.id && avatarUrl ? (
|
|
92
|
+
<img src={avatarUrl} alt={author?.img?.alt || ''} className="i-review__avatar-img" />
|
|
93
|
+
) : author?.name ? (
|
|
94
|
+
getInitials(author.name)
|
|
95
|
+
) : (
|
|
96
|
+
'?'
|
|
97
|
+
)}
|
|
98
|
+
</button>
|
|
99
|
+
)}
|
|
100
|
+
/>
|
|
101
|
+
</MediaUploadCheck>
|
|
102
|
+
<div className="i-review__author-info">
|
|
103
|
+
<RichText
|
|
104
|
+
tagName="strong"
|
|
105
|
+
className="i-review__author-name u-text-editable"
|
|
106
|
+
value={author?.name}
|
|
107
|
+
onChange={(value) => setAttributes({author: {...author, name: value}})}
|
|
108
|
+
placeholder={__('Jméno Příjmení', 'brilo-blocks')}
|
|
109
|
+
allowedFormats={[]}
|
|
110
|
+
/>
|
|
111
|
+
<RichText
|
|
112
|
+
tagName="span"
|
|
113
|
+
className="i-review__author-meta u-text-editable"
|
|
114
|
+
value={author?.meta}
|
|
115
|
+
onChange={(value) => setAttributes({author: {...author, meta: value}})}
|
|
116
|
+
placeholder={__('Město · služba', 'brilo-blocks')}
|
|
117
|
+
allowedFormats={['core/bold', 'core/italic', 'core/link', 'brilo-blocks/text-color']}
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
.i-review {
|
|
2
|
+
width: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.i-review__inner {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: 12px;
|
|
9
|
+
padding: 20px;
|
|
10
|
+
border: 1px solid #e0e4ea;
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
background: #fff;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.i-review__stars {
|
|
16
|
+
font-size: 20px;
|
|
17
|
+
color: #1e2d45;
|
|
18
|
+
letter-spacing: 2px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.i-review__star {
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
background: none;
|
|
24
|
+
border: none;
|
|
25
|
+
padding: 0;
|
|
26
|
+
font-size: inherit;
|
|
27
|
+
color: inherit;
|
|
28
|
+
letter-spacing: inherit;
|
|
29
|
+
line-height: 1;
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
opacity: 0.7;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.i-review__text {
|
|
37
|
+
font-style: italic;
|
|
38
|
+
color: #2c3e50;
|
|
39
|
+
margin: 0;
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.i-review__divider {
|
|
44
|
+
border: none;
|
|
45
|
+
border-top: 1px solid #e0e4ea;
|
|
46
|
+
margin: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.i-review__author {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 12px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.i-review__avatar {
|
|
56
|
+
width: 40px;
|
|
57
|
+
height: 40px;
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
background: #e8ecf1;
|
|
60
|
+
color: #4a5568;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
font-size: 13px;
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
position: relative;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
border: none;
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.i-review__avatar-img {
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
object-fit: cover;
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.i-review__author-info {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
gap: 2px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.i-review__author-name {
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
color: #1e2d45;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.i-review__author-meta {
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
color: #718096;
|
|
96
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
import {RATINGS} from './constants'
|
|
4
|
+
import {createReviewItemEdit} from './edit'
|
|
5
|
+
import {icon as defaultIcon} from './icon'
|
|
6
|
+
import type {ReviewItemAttributes, ReviewItemOptions} from './types'
|
|
7
|
+
|
|
8
|
+
export type {ReviewItemAttributes, ReviewItemOptions}
|
|
9
|
+
|
|
10
|
+
export function createReviewItemBlock(options: ReviewItemOptions): BlockConfiguration<ReviewItemAttributes> {
|
|
11
|
+
return {
|
|
12
|
+
name: options.name,
|
|
13
|
+
title: options.title ?? __('Recenze položka', 'brilo-blocks'),
|
|
14
|
+
description: options.description ?? __('Karta recenze se hodnocením, textem a autorem', 'brilo-blocks'),
|
|
15
|
+
category: options.category ?? 'layout',
|
|
16
|
+
...(options.parent && {parent: options.parent}),
|
|
17
|
+
icon: options.icon ?? {src: defaultIcon},
|
|
18
|
+
supports: {html: false, customClassName: false},
|
|
19
|
+
attributes: {
|
|
20
|
+
rating: {
|
|
21
|
+
type: 'number',
|
|
22
|
+
default: RATINGS[4],
|
|
23
|
+
},
|
|
24
|
+
text: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: '',
|
|
27
|
+
},
|
|
28
|
+
author: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
default: {
|
|
31
|
+
img: {id: 0, alt: ''},
|
|
32
|
+
name: '',
|
|
33
|
+
meta: '',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
edit: createReviewItemEdit(options),
|
|
38
|
+
save: () => null,
|
|
39
|
+
} as unknown as BlockConfiguration<ReviewItemAttributes>
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const icon = (
|
|
2
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<title>Review Item</title>
|
|
4
|
+
<path
|
|
5
|
+
d="M10 2L12.472 7.008L18 7.81L14 11.708L14.944 17.212L10 14.612L5.056 17.212L6 11.708L2 7.81L7.528 7.008L10 2Z"
|
|
6
|
+
fill="currentColor"
|
|
7
|
+
/>
|
|
8
|
+
</svg>
|
|
9
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type {ReviewItemOptions} from './types'
|
|
2
|
+
|
|
3
|
+
export type {ReviewAuthor, ReviewItemAttributes, ReviewItemOptions, ReviewRating} from './types'
|
|
4
|
+
export {createReviewItemBlock} from './factory'
|
|
5
|
+
|
|
6
|
+
export const reviewItemDefaults: ReviewItemOptions = {
|
|
7
|
+
name: 'brilo/review-item',
|
|
8
|
+
parent: ['brilo/review-group'],
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type {ImageValue} from '~/components/ImagePicker'
|
|
2
|
+
import type {BriloBlockType} from '~/types'
|
|
3
|
+
import type {RATINGS} from './constants'
|
|
4
|
+
|
|
5
|
+
export type ReviewRating = (typeof RATINGS)[number]
|
|
6
|
+
|
|
7
|
+
export interface ReviewAuthor {
|
|
8
|
+
img: ImageValue
|
|
9
|
+
name: string
|
|
10
|
+
meta: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ReviewItemAttributes extends Record<string, unknown> {
|
|
14
|
+
rating: ReviewRating
|
|
15
|
+
text: string
|
|
16
|
+
author: ReviewAuthor
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ReviewItemOptions extends BriloBlockType {}
|
|
@@ -33,4 +33,13 @@ export const baseAttributes = {
|
|
|
33
33
|
position: 'center center',
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
|
+
border: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
default: {
|
|
39
|
+
top: {width: 0, color: '', style: 'solid'},
|
|
40
|
+
bottom: {width: 0, color: '', style: 'solid'},
|
|
41
|
+
left: {width: 0, color: '', style: 'solid'},
|
|
42
|
+
right: {width: 0, color: '', style: 'solid'},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
36
45
|
} as const
|