@brilo/base-blocks 0.1.60 → 0.1.62

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.
Files changed (165) hide show
  1. package/build/.tsbuildinfo +1 -1
  2. package/build/blocks/anchor/anchor-group/icon.js +1 -1
  3. package/build/blocks/career/career-benefits/icon.js +1 -1
  4. package/build/blocks/career/career-header/icon.js +1 -1
  5. package/build/blocks/career/job-position-group/icon.js +1 -1
  6. package/build/blocks/column/column-item/edit.d.ts.map +1 -1
  7. package/build/blocks/column/column-item/index.d.ts.map +1 -1
  8. package/build/blocks/column/column-item/index.js +1 -0
  9. package/build/blocks/compare/compare-option/edit.d.ts +1 -1
  10. package/build/blocks/compare/compare-option/edit.d.ts.map +1 -1
  11. package/build/blocks/compare/compare-option/edit.js +1 -1
  12. package/build/blocks/contact/contact-item/factory.d.ts.map +1 -1
  13. package/build/blocks/document/documents-grid/icon.js +1 -1
  14. package/build/blocks/event/event-detail-content/icon.js +1 -1
  15. package/build/blocks/event/event-detail-header/icon.js +1 -1
  16. package/build/blocks/event/event-list-group/icon.js +1 -1
  17. package/build/blocks/faq/faq-item/edit.d.ts.map +1 -1
  18. package/build/blocks/faq/faq-item/edit.js +2 -2
  19. package/build/blocks/food-menu/food-menu-group/FoodMenuPreview.d.ts.map +1 -1
  20. package/build/blocks/food-menu/food-menu-group/FoodMenuPreview.js +34 -4
  21. package/build/blocks/food-menu/food-menu-group/constants.d.ts +51 -3
  22. package/build/blocks/food-menu/food-menu-group/constants.d.ts.map +1 -1
  23. package/build/blocks/food-menu/food-menu-group/constants.js +32 -6
  24. package/build/blocks/food-menu/food-menu-group/edit.d.ts.map +1 -1
  25. package/build/blocks/food-menu/food-menu-group/edit.js +61 -2
  26. package/build/blocks/food-menu/food-menu-group/factory.d.ts.map +1 -1
  27. package/build/blocks/food-menu/food-menu-group/factory.js +77 -45
  28. package/build/blocks/food-menu/food-menu-group/index.d.ts +1 -1
  29. package/build/blocks/food-menu/food-menu-group/index.d.ts.map +1 -1
  30. package/build/blocks/food-menu/food-menu-group/types.d.ts +12 -5
  31. package/build/blocks/food-menu/food-menu-group/types.d.ts.map +1 -1
  32. package/build/blocks/food-menu/food-reservation/edit.d.ts +7 -0
  33. package/build/blocks/food-menu/food-reservation/edit.d.ts.map +1 -0
  34. package/build/blocks/food-menu/food-reservation/edit.js +69 -0
  35. package/build/blocks/food-menu/food-reservation/factory.d.ts +4 -0
  36. package/build/blocks/food-menu/food-reservation/factory.d.ts.map +1 -0
  37. package/build/blocks/food-menu/food-reservation/factory.js +24 -0
  38. package/build/blocks/food-menu/food-reservation/icon.d.ts +2 -0
  39. package/build/blocks/food-menu/food-reservation/icon.d.ts.map +1 -0
  40. package/build/blocks/food-menu/food-reservation/icon.js +2 -0
  41. package/build/blocks/food-menu/food-reservation/index.d.ts +5 -0
  42. package/build/blocks/food-menu/food-reservation/index.d.ts.map +1 -0
  43. package/build/blocks/food-menu/food-reservation/index.js +6 -0
  44. package/build/blocks/food-menu/food-reservation/types.d.ts +7 -0
  45. package/build/blocks/food-menu/food-reservation/types.d.ts.map +1 -0
  46. package/build/blocks/food-menu/food-reservation/types.js +1 -0
  47. package/build/blocks/form/form-field/types.d.ts +1 -1
  48. package/build/blocks/form/form-field/types.d.ts.map +1 -1
  49. package/build/blocks/groups/banner-group/icon.js +1 -1
  50. package/build/blocks/groups/content-group/icon.js +1 -1
  51. package/build/blocks/hero/hero-group/edit.js +1 -1
  52. package/build/blocks/hero/hero-group/icon.js +1 -1
  53. package/build/blocks/hero/hero-group/types.d.ts +1 -1
  54. package/build/blocks/hero/hero-group/types.d.ts.map +1 -1
  55. package/build/blocks/hero/hero-item/edit.js +1 -1
  56. package/build/blocks/layout/box/icon.js +1 -1
  57. package/build/blocks/layout/layout-aside/edit.d.ts +1 -2
  58. package/build/blocks/layout/layout-aside/edit.d.ts.map +1 -1
  59. package/build/blocks/layout/layout-aside/edit.js +1 -1
  60. package/build/blocks/layout/layout-aside/factory.d.ts.map +1 -1
  61. package/build/blocks/layout/layout-aside/icon.d.ts +1 -2
  62. package/build/blocks/layout/layout-aside/icon.d.ts.map +1 -1
  63. package/build/blocks/layout/layout-aside/icon.js +1 -1
  64. package/build/blocks/layout/layout-content/edit.d.ts +1 -2
  65. package/build/blocks/layout/layout-content/edit.d.ts.map +1 -1
  66. package/build/blocks/layout/layout-content/edit.js +1 -1
  67. package/build/blocks/layout/layout-content/factory.d.ts.map +1 -1
  68. package/build/blocks/layout/layout-content/icon.d.ts +1 -2
  69. package/build/blocks/layout/layout-content/icon.d.ts.map +1 -1
  70. package/build/blocks/layout/layout-content/icon.js +1 -1
  71. package/build/blocks/layout/layout-content-w-aside/edit.d.ts +1 -2
  72. package/build/blocks/layout/layout-content-w-aside/edit.d.ts.map +1 -1
  73. package/build/blocks/layout/layout-content-w-aside/factory.d.ts.map +1 -1
  74. package/build/blocks/layout/layout-content-w-aside/icon.d.ts +1 -2
  75. package/build/blocks/layout/layout-content-w-aside/icon.d.ts.map +1 -1
  76. package/build/blocks/layout/layout-content-w-aside/icon.js +1 -1
  77. package/build/blocks/link/link-item/icon.js +1 -1
  78. package/build/blocks/map/map-group/edit.d.ts.map +1 -1
  79. package/build/blocks/map/map-group/edit.js +1 -1
  80. package/build/blocks/map/map-group/factory.d.ts.map +1 -1
  81. package/build/blocks/map/map-group/types.d.ts.map +1 -1
  82. package/build/blocks/newsletter/newsletter-form/edit.d.ts.map +1 -1
  83. package/build/blocks/newsletter/newsletter-form/edit.js +2 -1
  84. package/build/blocks/person/person-group/icon.js +1 -1
  85. package/build/blocks/person/person-item/constants.d.ts.map +1 -1
  86. package/build/blocks/post/post-content/icon.js +1 -1
  87. package/build/blocks/post/post-content/types.d.ts.map +1 -1
  88. package/build/blocks/post/post-slider-group/icon.js +1 -1
  89. package/build/blocks/post/posts-grid/icon.js +1 -1
  90. package/build/blocks/share/share/icon.js +1 -1
  91. package/build/blocks/signpost/signpost-group/icon.js +1 -1
  92. package/build/blocks/step/step-group/factory.d.ts.map +1 -1
  93. package/build/blocks/step/step-group/icon.js +1 -1
  94. package/build/blocks/testimonial/testimonial-group/icon.js +1 -1
  95. package/build/components/ImagePicker/ImagePicker.d.ts.map +1 -1
  96. package/build/components/ImagePicker/ImagePicker.js +1 -5
  97. package/build/hooks/useGroupBlock.d.ts.map +1 -1
  98. package/build/hooks/useGroupBlock.js +10 -3
  99. package/build/index.d.ts +2 -0
  100. package/build/index.d.ts.map +1 -1
  101. package/build/index.js +1 -0
  102. package/package.json +4 -3
  103. package/src/blocks/anchor/anchor-group/icon.tsx +1 -1
  104. package/src/blocks/career/career-benefits/icon.tsx +1 -1
  105. package/src/blocks/career/career-header/icon.tsx +1 -1
  106. package/src/blocks/career/job-position-group/icon.tsx +1 -1
  107. package/src/blocks/column/column-item/edit.tsx +0 -1
  108. package/src/blocks/column/column-item/index.ts +1 -0
  109. package/src/blocks/compare/compare-option/edit.tsx +1 -1
  110. package/src/blocks/contact/contact-item/factory.tsx +1 -2
  111. package/src/blocks/document/documents-grid/icon.tsx +1 -1
  112. package/src/blocks/event/event-detail-content/icon.tsx +1 -1
  113. package/src/blocks/event/event-detail-header/icon.tsx +1 -1
  114. package/src/blocks/event/event-list-group/icon.tsx +1 -1
  115. package/src/blocks/faq/faq-item/edit.tsx +23 -25
  116. package/src/blocks/food-menu/food-menu-group/FoodMenuPreview.tsx +55 -6
  117. package/src/blocks/food-menu/food-menu-group/constants.ts +37 -6
  118. package/src/blocks/food-menu/food-menu-group/edit.tsx +116 -20
  119. package/src/blocks/food-menu/food-menu-group/editor.scss +35 -6
  120. package/src/blocks/food-menu/food-menu-group/factory.tsx +77 -39
  121. package/src/blocks/food-menu/food-menu-group/index.ts +2 -0
  122. package/src/blocks/food-menu/food-menu-group/types.ts +18 -5
  123. package/src/blocks/food-menu/food-reservation/edit.tsx +179 -0
  124. package/src/blocks/food-menu/food-reservation/factory.tsx +28 -0
  125. package/src/blocks/food-menu/food-reservation/icon.tsx +9 -0
  126. package/src/blocks/food-menu/food-reservation/index.ts +10 -0
  127. package/src/blocks/food-menu/food-reservation/types.ts +8 -0
  128. package/src/blocks/form/form-field/types.ts +1 -7
  129. package/src/blocks/groups/banner-group/edit.tsx +1 -1
  130. package/src/blocks/groups/banner-group/icon.tsx +1 -1
  131. package/src/blocks/groups/content-group/icon.tsx +1 -1
  132. package/src/blocks/hero/hero-group/edit.tsx +3 -3
  133. package/src/blocks/hero/hero-group/icon.tsx +1 -1
  134. package/src/blocks/hero/hero-group/types.ts +1 -1
  135. package/src/blocks/hero/hero-item/edit.tsx +5 -5
  136. package/src/blocks/layout/box/icon.tsx +1 -1
  137. package/src/blocks/layout/layout-aside/edit.tsx +2 -3
  138. package/src/blocks/layout/layout-aside/factory.tsx +0 -1
  139. package/src/blocks/layout/layout-aside/icon.tsx +1 -3
  140. package/src/blocks/layout/layout-content/edit.tsx +2 -3
  141. package/src/blocks/layout/layout-content/factory.tsx +0 -1
  142. package/src/blocks/layout/layout-content/icon.tsx +1 -3
  143. package/src/blocks/layout/layout-content-w-aside/edit.tsx +0 -1
  144. package/src/blocks/layout/layout-content-w-aside/factory.tsx +0 -1
  145. package/src/blocks/layout/layout-content-w-aside/icon.tsx +1 -3
  146. package/src/blocks/link/link-item/icon.tsx +1 -1
  147. package/src/blocks/map/map-group/edit.tsx +8 -3
  148. package/src/blocks/map/map-group/factory.tsx +1 -1
  149. package/src/blocks/map/map-group/types.ts +1 -1
  150. package/src/blocks/newsletter/newsletter-form/edit.tsx +5 -2
  151. package/src/blocks/person/person-group/icon.tsx +1 -1
  152. package/src/blocks/person/person-item/constants.ts +1 -1
  153. package/src/blocks/post/post-content/icon.tsx +1 -1
  154. package/src/blocks/post/post-content/types.ts +0 -1
  155. package/src/blocks/post/post-slider-group/icon.tsx +1 -1
  156. package/src/blocks/post/posts-grid/icon.tsx +1 -1
  157. package/src/blocks/share/share/icon.tsx +1 -1
  158. package/src/blocks/signpost/signpost-group/icon.tsx +1 -1
  159. package/src/blocks/step/step-group/factory.tsx +1 -1
  160. package/src/blocks/step/step-group/icon.tsx +1 -1
  161. package/src/blocks/testimonial/testimonial-group/icon.tsx +1 -1
  162. package/src/components/ImagePicker/ImagePicker.tsx +6 -6
  163. package/src/components/ItemIconControl/types.d.ts +0 -1
  164. package/src/hooks/useGroupBlock.ts +10 -2
  165. package/src/index.ts +2 -0
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M4 4H9V5H4V4Z", fill: "black" }), _jsx("path", { d: "M10 4H16V5H10V4Z", fill: "black" }), _jsx("path", { d: "M12 2C12 1.44772 12.4477 1 13 1H14C14.5523 1 15 1.44772 15 2C15 2.55228 14.5523 3 14 3H13C12.4477 3 12 2.55228 12 2Z", fill: "black" }), _jsx("path", { d: "M5 2C5 1.44772 5.44772 1 6 1H10C10.5523 1 11 1.44772 11 2C11 2.55228 10.5523 3 10 3H6C5.44772 3 5 2.55228 5 2Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "7.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M16 9H18V10H16V9Z", fill: "#357AB5" }), _jsx("path", { d: "M13 9H14V10H13V9Z", fill: "black" }), _jsx("rect", { x: "0.5", y: "7.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M5 9H7V10H5V9Z", fill: "#357AB5" }), _jsx("path", { d: "M2 9H3V10H2V9Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "14.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M16 16H18V17H16V16Z", fill: "#357AB5" }), _jsx("path", { d: "M13 16H14V17H13V16Z", fill: "black" }), _jsx("rect", { x: "0.5", y: "14.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M5 16H7V17H5V16Z", fill: "#357AB5" }), _jsx("path", { d: "M2 16H3V17H2V16Z", fill: "black" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M4 4H9V5H4V4Z", fill: "black" }), _jsx("path", { d: "M10 4H16V5H10V4Z", fill: "black" }), _jsx("path", { d: "M12 2C12 1.44772 12.4477 1 13 1H14C14.5523 1 15 1.44772 15 2C15 2.55228 14.5523 3 14 3H13C12.4477 3 12 2.55228 12 2Z", fill: "black" }), _jsx("path", { d: "M5 2C5 1.44772 5.44772 1 6 1H10C10.5523 1 11 1.44772 11 2C11 2.55228 10.5523 3 10 3H6C5.44772 3 5 2.55228 5 2Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "7.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M16 9H18V10H16V9Z", fill: "#357AB5" }), _jsx("path", { d: "M13 9H14V10H13V9Z", fill: "black" }), _jsx("rect", { x: "0.5", y: "7.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M5 9H7V10H5V9Z", fill: "#357AB5" }), _jsx("path", { d: "M2 9H3V10H2V9Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "14.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M16 16H18V17H16V16Z", fill: "#357AB5" }), _jsx("path", { d: "M13 16H14V17H13V16Z", fill: "black" }), _jsx("rect", { x: "0.5", y: "14.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M5 16H7V17H5V16Z", fill: "#357AB5" }), _jsx("path", { d: "M2 16H3V17H2V16Z", fill: "black" })] }));
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M3 5.5L5 7.5L9 3.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("path", { d: "M3 10.5L5 12.5L9 8.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("path", { d: "M3 15.5L5 17.5L9 13.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("line", { x1: "11", y1: "5", x2: "18", y2: "5", stroke: "black" }), _jsx("line", { x1: "11", y1: "10", x2: "18", y2: "10", stroke: "black" }), _jsx("line", { x1: "11", y1: "15", x2: "18", y2: "15", stroke: "black" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M3 5.5L5 7.5L9 3.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("path", { d: "M3 10.5L5 12.5L9 8.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("path", { d: "M3 15.5L5 17.5L9 13.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("line", { x1: "11", y1: "5", x2: "18", y2: "5", stroke: "black" }), _jsx("line", { x1: "11", y1: "10", x2: "18", y2: "10", stroke: "black" }), _jsx("line", { x1: "11", y1: "15", x2: "18", y2: "15", stroke: "black" })] }));
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "2", y: "3", width: "16", height: "4", rx: "1", stroke: "black", fill: "none" }), _jsx("line", { x1: "2", y1: "10", x2: "14", y2: "10", stroke: "black" }), _jsx("line", { x1: "2", y1: "13", x2: "18", y2: "13", stroke: "black" }), _jsx("line", { x1: "2", y1: "16", x2: "10", y2: "16", stroke: "black" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "2", y: "3", width: "16", height: "4", rx: "1", stroke: "black", fill: "none" }), _jsx("line", { x1: "2", y1: "10", x2: "14", y2: "10", stroke: "black" }), _jsx("line", { x1: "2", y1: "13", x2: "18", y2: "13", stroke: "black" }), _jsx("line", { x1: "2", y1: "16", x2: "10", y2: "16", stroke: "black" })] }));
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "2", y: "6", width: "16", height: "11", rx: "1", stroke: "black", fill: "none" }), _jsx("path", { d: "M7 6V4C7 3.44772 7.44772 3 8 3H12C12.5523 3 13 3.44772 13 4V6", stroke: "black", fill: "none" }), _jsx("line", { x1: "2", y1: "11", x2: "18", y2: "11", stroke: "black" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "2", y: "6", width: "16", height: "11", rx: "1", stroke: "black", fill: "none" }), _jsx("path", { d: "M7 6V4C7 3.44772 7.44772 3 8 3H12C12.5523 3 13 3.44772 13 4V6", stroke: "black", fill: "none" }), _jsx("line", { x1: "2", y1: "11", x2: "18", y2: "11", stroke: "black" })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/edit.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAIpE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,oCAI1D;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAA;CAC1D,iCAqDF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/edit.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAGpE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,oCAI1D;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAA;CAC1D,iCAqDF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,WAAW,CAAA;AAE/C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,kBAAkB,EAAE,iBAkBhC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,WAAW,CAAA;AAE/C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,kBAAkB,EAAE,iBAmBhC,CAAA"}
@@ -16,5 +16,6 @@ export const columnItemDefaults = {
16
16
  'brilo/button-group',
17
17
  'brilo/gallery-group',
18
18
  'brilo/food-menu-group',
19
+ 'brilo/food-reservation',
19
20
  ],
20
21
  };
@@ -1,5 +1,5 @@
1
1
  import type { CompareOptionAttributes, CompareOptionOptions } from './types';
2
- export declare function createCompareOptionEdit(options: CompareOptionOptions): ({ attributes, setAttributes, }: {
2
+ export declare function createCompareOptionEdit(_options: CompareOptionOptions): ({ attributes, setAttributes, }: {
3
3
  attributes: CompareOptionAttributes;
4
4
  setAttributes: (a: Partial<CompareOptionAttributes>) => void;
5
5
  }) => import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/compare/compare-option/edit.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,oCAIhE;IACD,UAAU,EAAE,uBAAuB,CAAA;IACnC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAA;CAC7D,iCA6CF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/compare/compare-option/edit.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,oCAIjE;IACD,UAAU,EAAE,uBAAuB,CAAA;IACnC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAA;CAC7D,iCA6CF"}
@@ -3,7 +3,7 @@ import { InspectorControls, RichText, useBlockProps } from '@wordpress/block-edi
3
3
  import { PanelBody, TextControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { VARIANTS } from './constants';
6
- export function createCompareOptionEdit(options) {
6
+ export function createCompareOptionEdit(_options) {
7
7
  return function Edit({ attributes, setAttributes, }) {
8
8
  const { text, variant, customChar } = attributes;
9
9
  const blockProps = useBlockProps({ className: 'i-compare-option' });
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAGzE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sCAAsC,CAAA;AAGlE,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,EAC5F,OAAO,EAAE,kBAAkB,GAAG;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;CAChD,GACA,kBAAkB,CAAC,CAAC,CAAC,CAyBvB"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAEzE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sCAAsC,CAAA;AAGlE,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,EAC5F,OAAO,EAAE,kBAAkB,GAAG;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;CAChD,GACA,kBAAkB,CAAC,CAAC,CAAC,CAyBvB"}
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M4 1H12L16 5V19H4V1Z", stroke: "black", fill: "none" }), _jsx("path", { d: "M12 1V5H16", stroke: "black", fill: "none" }), _jsx("line", { x1: "6.5", y1: "9", x2: "13.5", y2: "9", stroke: "black" }), _jsx("line", { x1: "6.5", y1: "12", x2: "13.5", y2: "12", stroke: "black" }), _jsx("line", { x1: "6.5", y1: "15", x2: "11", y2: "15", stroke: "black" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M4 1H12L16 5V19H4V1Z", stroke: "black", fill: "none" }), _jsx("path", { d: "M12 1V5H16", stroke: "black", fill: "none" }), _jsx("line", { x1: "6.5", y1: "9", x2: "13.5", y2: "9", stroke: "black" }), _jsx("line", { x1: "6.5", y1: "12", x2: "13.5", y2: "12", stroke: "black" }), _jsx("line", { x1: "6.5", y1: "15", x2: "11", y2: "15", stroke: "black" })] }));
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "3", y: "2", width: "14", height: "16", rx: "1", stroke: "black", fill: "none" }), _jsx("line", { x1: "6", y1: "6", x2: "14", y2: "6", stroke: "black" }), _jsx("line", { x1: "6", y1: "9", x2: "14", y2: "9", stroke: "black" }), _jsx("line", { x1: "6", y1: "12", x2: "14", y2: "12", stroke: "black" }), _jsx("line", { x1: "6", y1: "15", x2: "10", y2: "15", stroke: "black" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "3", y: "2", width: "14", height: "16", rx: "1", stroke: "black", fill: "none" }), _jsx("line", { x1: "6", y1: "6", x2: "14", y2: "6", stroke: "black" }), _jsx("line", { x1: "6", y1: "9", x2: "14", y2: "9", stroke: "black" }), _jsx("line", { x1: "6", y1: "12", x2: "14", y2: "12", stroke: "black" }), _jsx("line", { x1: "6", y1: "15", x2: "10", y2: "15", stroke: "black" })] }));
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "2", y: "3", width: "16", height: "4", rx: "1", stroke: "black", fill: "none" }), _jsx("line", { x1: "2", y1: "10", x2: "14", y2: "10", stroke: "black" }), _jsx("line", { x1: "2", y1: "13", x2: "18", y2: "13", stroke: "black" }), _jsx("line", { x1: "2", y1: "16", x2: "10", y2: "16", stroke: "black" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "2", y: "3", width: "16", height: "4", rx: "1", stroke: "black", fill: "none" }), _jsx("line", { x1: "2", y1: "10", x2: "14", y2: "10", stroke: "black" }), _jsx("line", { x1: "2", y1: "13", x2: "18", y2: "13", stroke: "black" }), _jsx("line", { x1: "2", y1: "16", x2: "10", y2: "16", stroke: "black" })] }));
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M4 4H9V5H4V4Z", fill: "black" }), _jsx("path", { d: "M10 4H16V5H10V4Z", fill: "black" }), _jsx("path", { d: "M12 2C12 1.44772 12.4477 1 13 1H14C14.5523 1 15 1.44772 15 2C15 2.55228 14.5523 3 14 3H13C12.4477 3 12 2.55228 12 2Z", fill: "black" }), _jsx("path", { d: "M5 2C5 1.44772 5.44772 1 6 1H10C10.5523 1 11 1.44772 11 2C11 2.55228 10.5523 3 10 3H6C5.44772 3 5 2.55228 5 2Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "14.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M17 14H20V15H17V14Z", fill: "black" }), _jsx("path", { d: "M17 16H19V17H17V16Z", fill: "black" }), _jsx("path", { d: "M18 18H20V19H18V18Z", fill: "#357AB5" }), _jsx("rect", { x: "0.5", y: "14.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M6 14H9V15H6V14Z", fill: "black" }), _jsx("path", { d: "M6 16H8V17H6V16Z", fill: "black" }), _jsx("path", { d: "M7 18H9V19H7V18Z", fill: "#357AB5" }), _jsx("rect", { x: "11.5", y: "7.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M17 7H20V8H17V7Z", fill: "black" }), _jsx("path", { d: "M17 9H19V10H17V9Z", fill: "black" }), _jsx("path", { d: "M18 11H20V12H18V11Z", fill: "#357AB5" }), _jsx("rect", { x: "0.5", y: "7.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M6 7H9V8H6V7Z", fill: "black" }), _jsx("path", { d: "M6 9H8V10H6V9Z", fill: "black" }), _jsx("path", { d: "M7 11H9V12H7V11Z", fill: "#357AB5" })] }));
2
+ export const icon = (_jsxs("svg", { "aria-hidden": "true", focusable: "false", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M4 4H9V5H4V4Z", fill: "black" }), _jsx("path", { d: "M10 4H16V5H10V4Z", fill: "black" }), _jsx("path", { d: "M12 2C12 1.44772 12.4477 1 13 1H14C14.5523 1 15 1.44772 15 2C15 2.55228 14.5523 3 14 3H13C12.4477 3 12 2.55228 12 2Z", fill: "black" }), _jsx("path", { d: "M5 2C5 1.44772 5.44772 1 6 1H10C10.5523 1 11 1.44772 11 2C11 2.55228 10.5523 3 10 3H6C5.44772 3 5 2.55228 5 2Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "14.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M17 14H20V15H17V14Z", fill: "black" }), _jsx("path", { d: "M17 16H19V17H17V16Z", fill: "black" }), _jsx("path", { d: "M18 18H20V19H18V18Z", fill: "#357AB5" }), _jsx("rect", { x: "0.5", y: "14.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M6 14H9V15H6V14Z", fill: "black" }), _jsx("path", { d: "M6 16H8V17H6V16Z", fill: "black" }), _jsx("path", { d: "M7 18H9V19H7V18Z", fill: "#357AB5" }), _jsx("rect", { x: "11.5", y: "7.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M17 7H20V8H17V7Z", fill: "black" }), _jsx("path", { d: "M17 9H19V10H17V9Z", fill: "black" }), _jsx("path", { d: "M18 11H20V12H18V11Z", fill: "#357AB5" }), _jsx("rect", { x: "0.5", y: "7.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M6 7H9V8H6V7Z", fill: "black" }), _jsx("path", { d: "M6 9H8V10H6V9Z", fill: "black" }), _jsx("path", { d: "M7 11H9V12H7V11Z", fill: "#357AB5" })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-item/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,oCAIrD;IACD,UAAU,EAAE,iBAAiB,CAAA;IAC7B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CACvD,iCAmCF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-item/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,oCAIrD;IACD,UAAU,EAAE,iBAAiB,CAAA;IAC7B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CACvD,iCAiCF"}
@@ -1,4 +1,4 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { RichText, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
3
  import { BaseControl } from '@wordpress/components';
4
4
  import { Icon, chevronDown } from '@wordpress/icons';
@@ -9,6 +9,6 @@ export function createFaqItemEdit(_options) {
9
9
  const { title } = attributes;
10
10
  const blockProps = useBlockProps({ className: clsx('faq-item') });
11
11
  const innerBlocksProps = useInnerBlocksProps({}, { allowedBlocks: ['core/paragraph', 'core/list', 'core/image', 'core/table', 'brilo/button-group'] });
12
- return (_jsx(_Fragment, { children: _jsxs("div", { ...blockProps, children: [_jsxs("header", { className: "faq-item__header flex gap-2", children: [_jsx(RichText, { identifier: "title", className: "title u-text-editable grow", tagName: "h3", value: title, allowedFormats: [], onChange: (value) => setAttributes({ title: value }), placeholder: __('Nadpis prvku', 'brilo-blocks'), "data-custom-placeholder": true }), _jsxs("label", { className: "faq-item__dropdown flex items-center justify-center cursor-pointer", children: [_jsx(Icon, { icon: chevronDown, size: 32, className: "faq-item__dropdown-icon", color: "white" }), _jsx("input", { type: "checkbox", defaultChecked: true })] })] }), _jsx(BaseControl, { label: __('Odpověď:', 'brilo-blocks'), className: "faq-item__content", children: _jsx("div", { ...innerBlocksProps }) })] }) }));
12
+ return (_jsxs("div", { ...blockProps, children: [_jsxs("header", { className: "faq-item__header flex gap-2", children: [_jsx(RichText, { identifier: "title", className: "title u-text-editable grow", tagName: "h3", value: title, allowedFormats: [], onChange: (value) => setAttributes({ title: value }), placeholder: __('Nadpis prvku', 'brilo-blocks'), "data-custom-placeholder": true }), _jsxs("label", { className: "faq-item__dropdown flex items-center justify-center cursor-pointer", children: [_jsx(Icon, { icon: chevronDown, size: 32, className: "faq-item__dropdown-icon", color: "white" }), _jsx("input", { type: "checkbox", defaultChecked: true })] })] }), _jsx(BaseControl, { label: __('Odpověď:', 'brilo-blocks'), className: "faq-item__content", children: _jsx("div", { ...innerBlocksProps }) })] }));
13
13
  };
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FoodMenuPreview.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/FoodMenuPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAG5E,OAAO,KAAK,EAAC,uBAAuB,EAAiD,MAAM,SAAS,CAAA;AA2UpG,wBAAgB,eAAe,CAAC,EAAC,UAAU,EAAC,EAAE;IAAC,UAAU,EAAE,uBAAuB,CAAA;CAAC,qBAyClF"}
1
+ {"version":3,"file":"FoodMenuPreview.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/FoodMenuPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAG5E,OAAO,KAAK,EAAC,uBAAuB,EAAiD,MAAM,SAAS,CAAA;AAwXpG,wBAAgB,eAAe,CAAC,EAAC,UAAU,EAAC,EAAE;IAAC,UAAU,EAAE,uBAAuB,CAAA;CAAC,qBA6ClF"}
@@ -1,4 +1,4 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import apiFetch from '@wordpress/api-fetch';
3
3
  import { Button, Spinner } from '@wordpress/components';
4
4
  import { __, sprintf } from '@wordpress/i18n';
@@ -7,6 +7,31 @@ import { useEffect, useRef, useState } from 'react';
7
7
  import { plural } from '../../../utils/plural';
8
8
  import { icon as menuIcon } from './icon';
9
9
  const BASE = 'brilo-food-menu-preview';
10
+ /** Stand-ins for the theme's shadow tokens, which the editor canvas does not carry. */
11
+ const PREVIEW_SHADOWS = {
12
+ sm: '0 1px 3px rgba(0, 0, 0, 0.12)',
13
+ md: '0 4px 14px rgba(0, 0, 0, 0.16)',
14
+ };
15
+ /**
16
+ * The block's style as custom properties on the preview root, so the card
17
+ * picks up the colours, shadow and alignment the moment they change. Empty
18
+ * values are left out and the admin defaults in `editor.scss` apply.
19
+ */
20
+ function previewStyle({ style, textAlign }) {
21
+ const properties = { '--food-menu-preview-align': textAlign };
22
+ const values = {
23
+ '--food-menu-preview-border': style.borderColor,
24
+ '--food-menu-preview-background': style.backgroundColor,
25
+ '--food-menu-preview-text': style.textColor,
26
+ '--food-menu-preview-shadow': PREVIEW_SHADOWS[style.shadow],
27
+ };
28
+ for (const [key, value] of Object.entries(values)) {
29
+ if (value) {
30
+ properties[key] = value;
31
+ }
32
+ }
33
+ return properties;
34
+ }
10
35
  /**
11
36
  * The menu is assembled on the server — the week in the site's time zone,
12
37
  * which days have a menu, whether ordering is open — so the preview asks the
@@ -96,7 +121,11 @@ function sourceLabel(mode, day, data) {
96
121
  return 'daily' === day.menu.kind && day.date ? sprintf(__('Denní · %s', 'brilo-blocks'), day.date) : __('Trvalý', 'brilo-blocks');
97
122
  }
98
123
  function PreviewRows({ menu, showPrices, showAllergens }) {
99
- return (_jsx(_Fragment, { children: menu.courses.map((course, courseIndex) => (_jsxs("div", { className: `${BASE}__section`, children: [course.title && _jsx("div", { className: `${BASE}__section-title`, children: course.title }), course.items.map((item) => (_jsxs("div", { className: clsx(`${BASE}__row`, !showPrices && `${BASE}__row--no-price`), children: [_jsx("span", { className: `${BASE}__unit`, children: item.unit }), item.missing ? (_jsx("span", { className: clsx(`${BASE}__name`, `${BASE}__name--missing`), children: sprintf(__('Jídlo #%d (smazáno)', 'brilo-blocks'), item.food_id) })) : (_jsxs("span", { className: `${BASE}__name`, children: [item.title, showAllergens && 0 < item.allergens.length && _jsx("span", { className: `${BASE}__chip`, children: item.allergens.join(', ') }), item.note && _jsx("small", { className: `${BASE}__note`, children: item.note })] })), showPrices && _jsx("span", { className: `${BASE}__price`, children: item.price })] }, item.id || `food-${item.food_id}`)))] }, `${menu.id}-${courseIndex}`))) }));
124
+ // Halves come in pairs, as on the page; the second of each pair gets the
125
+ // divider between the two.
126
+ let halves = 0;
127
+ const isSplit = menu.courses.some((course) => 'half' === course.width);
128
+ return (_jsx("div", { className: clsx(`${BASE}__sections`, isSplit && `${BASE}__sections--split`), children: menu.courses.map((course, courseIndex) => (_jsxs("div", { className: clsx(`${BASE}__section`, 'half' === course.width && `${BASE}__section--half`, 'half' === course.width && 0 === halves++ % 2 && `${BASE}__section--first-half`), children: [course.title && _jsx("div", { className: `${BASE}__section-title`, children: course.title }), course.items.map((item) => (_jsxs("div", { className: clsx(`${BASE}__row`, !showPrices && `${BASE}__row--no-price`), children: [_jsx("span", { className: `${BASE}__unit`, children: item.unit }), item.missing ? (_jsx("span", { className: clsx(`${BASE}__name`, `${BASE}__name--missing`), children: sprintf(__('Jídlo #%d (smazáno)', 'brilo-blocks'), item.food_id) })) : (_jsxs("span", { className: `${BASE}__name`, children: [item.title, showAllergens && 0 < item.allergens.length && _jsx("span", { className: `${BASE}__chip`, children: item.allergens.join(', ') }), item.note && _jsx("small", { className: `${BASE}__note`, children: item.note })] })), showPrices && _jsx("span", { className: `${BASE}__price`, children: item.price })] }, item.id || `food-${item.food_id}`)))] }, `${menu.id}-${courseIndex}`))) }));
100
129
  }
101
130
  function PreviewDayTabs({ days, selected, onSelect }) {
102
131
  const tabs = useRef([]);
@@ -121,7 +150,8 @@ function PreviewDayTabs({ days, selected, onSelect }) {
121
150
  }
122
151
  function PreviewCard({ attributes, data, day, tabs }) {
123
152
  var _a;
124
- const { mode, showPrices, showAllergens, showReservation } = attributes;
153
+ const { mode, showPrices, showAllergens, reservationMode } = attributes;
154
+ const showReservation = 'off' !== reservationMode;
125
155
  const { menu } = day;
126
156
  const source = sourceLabel(mode, day, data);
127
157
  const reservation = showReservation ? menu === null || menu === void 0 ? void 0 : menu.reservation : null;
@@ -163,5 +193,5 @@ export function FoodMenuPreview({ attributes }) {
163
193
  else {
164
194
  content = data.days.map((day) => { var _a; var _b; return _jsx(PreviewCard, { attributes: attributes, data: data, day: day }, (_b = (_a = day.menu) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : day.label); });
165
195
  }
166
- return _jsx("div", { className: clsx(BASE, isLoading && `${BASE}--loading`), children: content });
196
+ return (_jsx("div", { className: clsx(BASE, isLoading && `${BASE}--loading`), style: previewStyle(attributes), children: content }));
167
197
  }
@@ -1,8 +1,56 @@
1
- export declare const FOOD_MENU_GROUP_MODES: readonly ['manual', 'today', 'week'];
2
- export declare const FOOD_MENU_GROUP_LAYOUTS: readonly ['slider', 'list'];
1
+ export declare const FOOD_MENU_GROUP_MODES: readonly [{
2
+ readonly value: 'manual';
3
+ readonly label: import("@wordpress/i18n").TransformedText<"Ruční výběr">;
4
+ }, {
5
+ readonly value: 'today';
6
+ readonly label: import("@wordpress/i18n").TransformedText<"Dnešní">;
7
+ }, {
8
+ readonly value: 'week';
9
+ readonly label: import("@wordpress/i18n").TransformedText<"Týden">;
10
+ }];
11
+ export declare const FOOD_MENU_GROUP_LAYOUTS: readonly [{
12
+ readonly value: 'slider';
13
+ readonly label: import("@wordpress/i18n").TransformedText<"Slider">;
14
+ }, {
15
+ readonly value: 'list';
16
+ readonly label: import("@wordpress/i18n").TransformedText<"Seznam">;
17
+ }];
3
18
  /** What the block does on a day with no menu to show. */
4
- export declare const FOOD_MENU_GROUP_EMPTY_BEHAVIOURS: readonly ['message', 'permanent', 'hide'];
19
+ export declare const FOOD_MENU_GROUP_EMPTY_BEHAVIOURS: readonly [{
20
+ readonly value: 'message';
21
+ readonly label: import("@wordpress/i18n").TransformedText<"Zpráva">;
22
+ }, {
23
+ readonly value: 'permanent';
24
+ readonly label: import("@wordpress/i18n").TransformedText<"Stálá nabídka">;
25
+ }, {
26
+ readonly value: 'hide';
27
+ readonly label: import("@wordpress/i18n").TransformedText<"Skrýt">;
28
+ }];
29
+ /** How the "Rezervovat oběd" button under a daily menu works. */
30
+ export declare const FOOD_MENU_GROUP_RESERVATION_MODES: readonly [{
31
+ readonly value: 'modal';
32
+ readonly label: import("@wordpress/i18n").TransformedText<"Modal">;
33
+ }, {
34
+ readonly value: 'link';
35
+ readonly label: import("@wordpress/i18n").TransformedText<"Odkaz">;
36
+ }, {
37
+ readonly value: 'off';
38
+ readonly label: import("@wordpress/i18n").TransformedText<"Vypnuto">;
39
+ }];
5
40
  export declare const FOOD_MENU_GROUP_MODE: "manual";
41
+ export declare const FOOD_MENU_GROUP_RESERVATION_MODE: "modal";
6
42
  export declare const FOOD_MENU_GROUP_LAYOUT: "slider";
7
43
  export declare const FOOD_MENU_GROUP_EMPTY_BEHAVIOUR: "message";
44
+ /** Alignment of the texts around the dishes; the dish rows keep their own layout. */
45
+ export declare const FOOD_MENU_GROUP_TEXT_ALIGNS: readonly [{
46
+ readonly value: 'left';
47
+ readonly label: import("@wordpress/i18n").TransformedText<"Vlevo">;
48
+ }, {
49
+ readonly value: 'center';
50
+ readonly label: import("@wordpress/i18n").TransformedText<"Na střed">;
51
+ }, {
52
+ readonly value: 'right';
53
+ readonly label: import("@wordpress/i18n").TransformedText<"Vpravo">;
54
+ }];
55
+ export declare const FOOD_MENU_GROUP_TEXT_ALIGN: "left";
8
56
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,YAAI,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAU,CAAA;AACzE,eAAO,MAAM,uBAAuB,YAAI,QAAQ,EAAE,MAAM,CAAU,CAAA;AAElE,yDAAyD;AACzD,eAAO,MAAM,gCAAgC,YAAI,SAAS,EAAE,WAAW,EAAE,MAAM,CAAU,CAAA;AAEzF,eAAO,MAAM,oBAAoB,UAA2B,CAAA;AAC5D,eAAO,MAAM,sBAAsB,UAA6B,CAAA;AAChE,eAAO,MAAM,+BAA+B,WAAsC,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;aAC/B,KAAK,EAAE,QAAQ;aAAE,KAAK;;aACtB,KAAK,EAAE,OAAO;aAAE,KAAK;;aACrB,KAAK,EAAE,MAAM;aAAE,KAAK;EACb,CAAA;AAEV,eAAO,MAAM,uBAAuB;aACjC,KAAK,EAAE,QAAQ;aAAE,KAAK;;aACtB,KAAK,EAAE,MAAM;aAAE,KAAK;EACb,CAAA;AAEV,yDAAyD;AACzD,eAAO,MAAM,gCAAgC;aAC1C,KAAK,EAAE,SAAS;aAAE,KAAK;;aACvB,KAAK,EAAE,WAAW;aAAE,KAAK;;aACzB,KAAK,EAAE,MAAM;aAAE,KAAK;EACb,CAAA;AAEV,iEAAiE;AACjE,eAAO,MAAM,iCAAiC;aAC3C,KAAK,EAAE,OAAO;aAAE,KAAK;;aACrB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,KAAK;aAAE,KAAK;EACZ,CAAA;AAEV,eAAO,MAAM,oBAAoB,UAAiC,CAAA;AAClE,eAAO,MAAM,gCAAgC,SAA6C,CAAA;AAC1F,eAAO,MAAM,sBAAsB,UAAmC,CAAA;AACtE,eAAO,MAAM,+BAA+B,WAA4C,CAAA;AAExF,qFAAqF;AACrF,eAAO,MAAM,2BAA2B;aACrC,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,QAAQ;aAAE,KAAK;;aACtB,KAAK,EAAE,OAAO;aAAE,KAAK;EACd,CAAA;AAEV,eAAO,MAAM,0BAA0B,QAAuC,CAAA"}
@@ -1,7 +1,33 @@
1
- export const FOOD_MENU_GROUP_MODES = ['manual', 'today', 'week'];
2
- export const FOOD_MENU_GROUP_LAYOUTS = ['slider', 'list'];
1
+ import { __ } from '@wordpress/i18n';
2
+ export const FOOD_MENU_GROUP_MODES = [
3
+ { value: 'manual', label: __('Ruční výběr', 'brilo-blocks') },
4
+ { value: 'today', label: __('Dnešní', 'brilo-blocks') },
5
+ { value: 'week', label: __('Týden', 'brilo-blocks') },
6
+ ];
7
+ export const FOOD_MENU_GROUP_LAYOUTS = [
8
+ { value: 'slider', label: __('Slider', 'brilo-blocks') },
9
+ { value: 'list', label: __('Seznam', 'brilo-blocks') },
10
+ ];
3
11
  /** What the block does on a day with no menu to show. */
4
- export const FOOD_MENU_GROUP_EMPTY_BEHAVIOURS = ['message', 'permanent', 'hide'];
5
- export const FOOD_MENU_GROUP_MODE = FOOD_MENU_GROUP_MODES[0];
6
- export const FOOD_MENU_GROUP_LAYOUT = FOOD_MENU_GROUP_LAYOUTS[0];
7
- export const FOOD_MENU_GROUP_EMPTY_BEHAVIOUR = FOOD_MENU_GROUP_EMPTY_BEHAVIOURS[0];
12
+ export const FOOD_MENU_GROUP_EMPTY_BEHAVIOURS = [
13
+ { value: 'message', label: __('Zpráva', 'brilo-blocks') },
14
+ { value: 'permanent', label: __('Stálá nabídka', 'brilo-blocks') },
15
+ { value: 'hide', label: __('Skrýt', 'brilo-blocks') },
16
+ ];
17
+ /** How the "Rezervovat oběd" button under a daily menu works. */
18
+ export const FOOD_MENU_GROUP_RESERVATION_MODES = [
19
+ { value: 'modal', label: __('Modal', 'brilo-blocks') },
20
+ { value: 'link', label: __('Odkaz', 'brilo-blocks') },
21
+ { value: 'off', label: __('Vypnuto', 'brilo-blocks') },
22
+ ];
23
+ export const FOOD_MENU_GROUP_MODE = FOOD_MENU_GROUP_MODES[0].value;
24
+ export const FOOD_MENU_GROUP_RESERVATION_MODE = FOOD_MENU_GROUP_RESERVATION_MODES[0].value;
25
+ export const FOOD_MENU_GROUP_LAYOUT = FOOD_MENU_GROUP_LAYOUTS[0].value;
26
+ export const FOOD_MENU_GROUP_EMPTY_BEHAVIOUR = FOOD_MENU_GROUP_EMPTY_BEHAVIOURS[0].value;
27
+ /** Alignment of the texts around the dishes; the dish rows keep their own layout. */
28
+ export const FOOD_MENU_GROUP_TEXT_ALIGNS = [
29
+ { value: 'left', label: __('Vlevo', 'brilo-blocks') },
30
+ { value: 'center', label: __('Na střed', 'brilo-blocks') },
31
+ { value: 'right', label: __('Vpravo', 'brilo-blocks') },
32
+ ];
33
+ export const FOOD_MENU_GROUP_TEXT_ALIGN = FOOD_MENU_GROUP_TEXT_ALIGNS[0].value;
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/edit.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AA6B1E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,oCAIhE;IACD,UAAU,EAAE,uBAAuB,CAAA;IACnC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAA;CAC7D,uBAqGF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/edit.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAWhD,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAiG1E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,oCAMhE;IACD,UAAU,EAAE,uBAAuB,CAAA;IACnC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAA;CAC7D,uBAsHF"}
@@ -1,9 +1,14 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import apiFetch from '@wordpress/api-fetch';
2
3
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
3
4
  import { PanelBody, __experimentalText as Text, TextareaControl, ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
4
5
  import { __, sprintf } from '@wordpress/i18n';
5
6
  import clsx from 'clsx';
7
+ // biome-ignore lint/correctness/noUnusedImports: required in scope for classic JSX transform
8
+ import { useEffect, useState } from 'react';
9
+ import { DEFAULT_SURFACE_SHADOWS, SurfaceStylePanel } from '../../../components/SurfaceStyleControl';
6
10
  import { plural } from '../../../utils/plural';
11
+ import { FOOD_MENU_GROUP_EMPTY_BEHAVIOURS, FOOD_MENU_GROUP_LAYOUTS, FOOD_MENU_GROUP_MODES, FOOD_MENU_GROUP_RESERVATION_MODES, FOOD_MENU_GROUP_TEXT_ALIGNS, } from './constants';
7
12
  import { FoodMenuPreview } from './FoodMenuPreview';
8
13
  const MODE_HINTS = {
9
14
  manual: __('Zobrazí se ručně vybrané lístky.', 'brilo-blocks'),
@@ -15,6 +20,57 @@ const EMPTY_HINTS = {
15
20
  permanent: __('Místo chybějícího denního lístku se nabídne stálá nabídka. Když žádná není, ukáže se věta.', 'brilo-blocks'),
16
21
  hide: __('Blok ze stránky zmizí. Stránka pak může zůstat prázdná.', 'brilo-blocks'),
17
22
  };
23
+ /**
24
+ * The "Stránka rezervace" module setting, for the hint under the reservation
25
+ * mode: the link mode needs it and falls back to the modal without it.
26
+ */
27
+ function useReservationPage(enabled) {
28
+ const [page, setPage] = useState(null);
29
+ const [isLoading, setIsLoading] = useState(enabled);
30
+ useEffect(() => {
31
+ if (!enabled) {
32
+ return;
33
+ }
34
+ let cancelled = false;
35
+ setIsLoading(true);
36
+ apiFetch({ path: '/brilo/v1/food-reservation/preview' })
37
+ .then((result) => {
38
+ if (!cancelled) {
39
+ setPage(result.page);
40
+ }
41
+ })
42
+ .catch(() => {
43
+ if (!cancelled) {
44
+ setPage(null);
45
+ }
46
+ })
47
+ .finally(() => {
48
+ if (!cancelled) {
49
+ setIsLoading(false);
50
+ }
51
+ });
52
+ return () => {
53
+ cancelled = true;
54
+ };
55
+ }, [enabled]);
56
+ return { page, isLoading };
57
+ }
58
+ function reservationHint(reservationMode, page, isLoading) {
59
+ const scope = __('Tlačítko se ukáže jen u denních lístků a jen když jsou rezervace zapnuté v nastavení modulu.', 'brilo-blocks');
60
+ if ('off' === reservationMode) {
61
+ return __('Pod lístkem nebude tlačítko rezervace, formulář ani uzávěrka.', 'brilo-blocks');
62
+ }
63
+ if ('modal' === reservationMode) {
64
+ return `${__('Tlačítko otevře rezervační formulář v okně.', 'brilo-blocks')} ${scope}`;
65
+ }
66
+ if (isLoading) {
67
+ return scope;
68
+ }
69
+ if (!page) {
70
+ return __('Stránka rezervace není v nastavení modulu vybraná, tlačítko proto zatím otevře formulář v okně. Vyberte ji v Nastavení jídelního lístku.', 'brilo-blocks');
71
+ }
72
+ return `${sprintf(__('Tlačítko povede na stránku „%s“ k bloku Rezervace obědu s předvybraným dnem.', 'brilo-blocks'), page.title)} ${scope}`;
73
+ }
18
74
  function pickedNote(count) {
19
75
  if (0 === count) {
20
76
  return __('Zatím nevybrán žádný lístek.', 'brilo-blocks');
@@ -23,12 +79,15 @@ function pickedNote(count) {
23
79
  return `${sprintf(picked, count)} · ${__('pořadí změníte ve výběru lístků', 'brilo-blocks')}`;
24
80
  }
25
81
  export function createFoodMenuGroupEdit(options) {
82
+ var _a;
83
+ const shadows = (_a = options.shadows) !== null && _a !== void 0 ? _a : DEFAULT_SURFACE_SHADOWS;
26
84
  return function Edit({ attributes, setAttributes, }) {
27
85
  var _a;
28
86
  var _b;
29
- const { mode, layout, menuIds, showPrices, showAllergens, showReservation, emptyBehaviour, emptyText } = attributes;
87
+ const { mode, layout, menuIds, showPrices, showAllergens, reservationMode, emptyBehaviour, emptyText, style, textAlign } = attributes;
88
+ const { page, isLoading } = useReservationPage('link' === reservationMode);
30
89
  const blockProps = useBlockProps({ className: clsx((_b = options.blockClassName) !== null && _b !== void 0 ? _b : 'g-food-menu', `--${layout}`) });
31
- return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Nastavení lístku', 'brilo-blocks'), initialOpen: true, children: [_jsxs(ToggleGroupControl, { label: __('Zdroj lístků', 'brilo-blocks'), help: MODE_HINTS[mode], value: mode, onChange: (value) => setAttributes({ mode: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "manual", label: __('Ruční výběr', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "today", label: __('Dnešní', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "week", label: __('Týden', 'brilo-blocks') })] }), _jsxs(ToggleGroupControl, { label: __('Rozvržení', 'brilo-blocks'), help: __('Slider se použije jen tehdy, když je lístků víc než jeden.', 'brilo-blocks'), value: layout, onChange: (value) => setAttributes({ layout: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "slider", label: __('Slider', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "list", label: __('Seznam', 'brilo-blocks') })] }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit ceny', 'brilo-blocks'), checked: showPrices, onChange: (value) => setAttributes({ showPrices: value }) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit alergeny a legendu', 'brilo-blocks'), checked: showAllergens, onChange: (value) => setAttributes({ showAllergens: value }) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Umožnit rezervaci obědu', 'brilo-blocks'), help: __('Tlačítko rezervace se ukáže jen u denních lístků a jen když jsou rezervace zapnuté v nastavení modulu.', 'brilo-blocks'), checked: showReservation, onChange: (value) => setAttributes({ showReservation: value }) })] }), _jsxs(PanelBody, { title: __('Když není co zobrazit', 'brilo-blocks'), initialOpen: false, children: [_jsxs(ToggleGroupControl, { label: __('Chování', 'brilo-blocks'), help: EMPTY_HINTS[emptyBehaviour], value: emptyBehaviour, onChange: (value) => setAttributes({ emptyBehaviour: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "message", label: __('Zpráva', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "permanent", label: __('Stálá nabídka', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "hide", label: __('Skrýt', 'brilo-blocks') })] }), 'hide' !== emptyBehaviour && (_jsx(TextareaControl, { __nextHasNoMarginBottom: true, label: __('Vlastní text zprávy', 'brilo-blocks'), help: __('Když zůstane prázdné, použije se věta podle zvoleného zdroje lístků.', 'brilo-blocks'), rows: 2, value: emptyText, onChange: (value) => setAttributes({ emptyText: value }) }))] })] }), _jsxs("div", { ...blockProps, children: ['manual' === mode && (_jsxs("div", { className: "brilo-food-menu-preview__pick", children: [(_a = options.renderMenusControl) === null || _a === void 0 ? void 0 : _a.call(options, {
90
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Nastavení lístku', 'brilo-blocks'), initialOpen: true, children: [_jsx(ToggleGroupControl, { label: __('Zdroj lístků', 'brilo-blocks'), help: MODE_HINTS[mode], value: mode, onChange: (value) => setAttributes({ mode: value }), isBlock: true, children: FOOD_MENU_GROUP_MODES.map((option) => (_jsx(ToggleGroupControlOption, { value: option.value, label: option.label }, option.value))) }), _jsx(ToggleGroupControl, { label: __('Rozvržení', 'brilo-blocks'), help: __('Slider se použije jen tehdy, když je lístků víc než jeden.', 'brilo-blocks'), value: layout, onChange: (value) => setAttributes({ layout: value }), isBlock: true, children: FOOD_MENU_GROUP_LAYOUTS.map((option) => (_jsx(ToggleGroupControlOption, { value: option.value, label: option.label }, option.value))) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit ceny', 'brilo-blocks'), checked: showPrices, onChange: (value) => setAttributes({ showPrices: value }) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit alergeny a legendu', 'brilo-blocks'), checked: showAllergens, onChange: (value) => setAttributes({ showAllergens: value }) }), _jsx(ToggleGroupControl, { label: __('Rezervace', 'brilo-blocks'), help: reservationHint(reservationMode, page, isLoading), value: reservationMode, onChange: (value) => setAttributes({ reservationMode: value }), isBlock: true, children: FOOD_MENU_GROUP_RESERVATION_MODES.map((option) => (_jsx(ToggleGroupControlOption, { value: option.value, label: option.label }, option.value))) })] }), _jsxs(PanelBody, { title: __('Když není co zobrazit', 'brilo-blocks'), initialOpen: false, children: [_jsx(ToggleGroupControl, { label: __('Chování', 'brilo-blocks'), help: EMPTY_HINTS[emptyBehaviour], value: emptyBehaviour, onChange: (value) => setAttributes({ emptyBehaviour: value }), isBlock: true, children: FOOD_MENU_GROUP_EMPTY_BEHAVIOURS.map((option) => (_jsx(ToggleGroupControlOption, { value: option.value, label: option.label }, option.value))) }), 'hide' !== emptyBehaviour && (_jsx(TextareaControl, { __nextHasNoMarginBottom: true, label: __('Vlastní text zprávy', 'brilo-blocks'), help: __('Když zůstane prázdné, použije se věta podle zvoleného zdroje lístků.', 'brilo-blocks'), rows: 2, value: emptyText, onChange: (value) => setAttributes({ emptyText: value }) }))] }), _jsx(SurfaceStylePanel, { style: style, shadows: shadows, idPrefix: "food-menu-group", onChange: (next) => setAttributes({ style: next }), children: _jsx(ToggleGroupControl, { label: __('Zarovnání textu', 'brilo-blocks'), help: __('Nadpisy, názvy chodů a texty pod lístkem. Řádky jídel zůstávají beze změny.', 'brilo-blocks'), value: textAlign, onChange: (value) => setAttributes({ textAlign: value }), isBlock: true, children: FOOD_MENU_GROUP_TEXT_ALIGNS.map((align) => (_jsx(ToggleGroupControlOption, { value: align.value, label: align.label }, align.value))) }) })] }), _jsxs("div", { ...blockProps, children: ['manual' === mode && (_jsxs("div", { className: "brilo-food-menu-preview__pick", children: [(_a = options.renderMenusControl) === null || _a === void 0 ? void 0 : _a.call(options, {
32
91
  selectedItems: menuIds,
33
92
  onChange: (ids) => setAttributes({ menuIds: ids }),
34
93
  }), _jsx(Text, { variant: "muted", children: pickedNote(menuIds.length) })] })), _jsx(FoodMenuPreview, { attributes: attributes })] })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAYzD,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAmDnH"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/food-menu/food-menu-group/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAkBzD,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAmFnH"}
@@ -1,57 +1,89 @@
1
1
  import { __ } from '@wordpress/i18n';
2
- import { FOOD_MENU_GROUP_EMPTY_BEHAVIOUR, FOOD_MENU_GROUP_EMPTY_BEHAVIOURS, FOOD_MENU_GROUP_LAYOUT, FOOD_MENU_GROUP_LAYOUTS, FOOD_MENU_GROUP_MODE, FOOD_MENU_GROUP_MODES, } from './constants';
2
+ import { DEFAULT_SURFACE_SHADOWS, surfaceStyleAttribute } from '../../../components/SurfaceStyleControl';
3
+ import { withObjectDefaults } from '../../../utils/withObjectDefaults';
4
+ import { FOOD_MENU_GROUP_EMPTY_BEHAVIOUR, FOOD_MENU_GROUP_EMPTY_BEHAVIOURS, FOOD_MENU_GROUP_LAYOUT, FOOD_MENU_GROUP_LAYOUTS, FOOD_MENU_GROUP_MODE, FOOD_MENU_GROUP_MODES, FOOD_MENU_GROUP_RESERVATION_MODE, FOOD_MENU_GROUP_RESERVATION_MODES, FOOD_MENU_GROUP_TEXT_ALIGN, FOOD_MENU_GROUP_TEXT_ALIGNS, } from './constants';
3
5
  import { createFoodMenuGroupEdit } from './edit';
4
6
  import { icon as defaultIcon } from './icon';
5
7
  export function createFoodMenuGroupBlock(options) {
6
- var _a, _b, _c, _d;
8
+ var _a, _b, _c, _d, _e;
9
+ const attributes = {
10
+ mode: {
11
+ type: 'string',
12
+ default: FOOD_MENU_GROUP_MODE,
13
+ enum: FOOD_MENU_GROUP_MODES.map((option) => option.value),
14
+ },
15
+ layout: {
16
+ type: 'string',
17
+ default: FOOD_MENU_GROUP_LAYOUT,
18
+ enum: FOOD_MENU_GROUP_LAYOUTS.map((option) => option.value),
19
+ },
20
+ menuIds: {
21
+ type: 'array',
22
+ default: [],
23
+ items: { type: 'number' },
24
+ },
25
+ showPrices: {
26
+ type: 'boolean',
27
+ default: true,
28
+ },
29
+ showAllergens: {
30
+ type: 'boolean',
31
+ default: true,
32
+ },
33
+ reservationMode: {
34
+ type: 'string',
35
+ default: FOOD_MENU_GROUP_RESERVATION_MODE,
36
+ enum: FOOD_MENU_GROUP_RESERVATION_MODES.map((option) => option.value),
37
+ },
38
+ emptyBehaviour: {
39
+ type: 'string',
40
+ default: FOOD_MENU_GROUP_EMPTY_BEHAVIOUR,
41
+ enum: FOOD_MENU_GROUP_EMPTY_BEHAVIOURS.map((option) => option.value),
42
+ },
43
+ // Empty means "use the wording the server picks for this mode".
44
+ emptyText: {
45
+ type: 'string',
46
+ default: '',
47
+ },
48
+ style: surfaceStyleAttribute((_a = options.shadows) !== null && _a !== void 0 ? _a : DEFAULT_SURFACE_SHADOWS),
49
+ textAlign: {
50
+ type: 'string',
51
+ default: FOOD_MENU_GROUP_TEXT_ALIGN,
52
+ enum: FOOD_MENU_GROUP_TEXT_ALIGNS.map((align) => align.value),
53
+ },
54
+ };
55
+ const { reservationMode: _reservationMode, ...withoutReservationMode } = attributes;
7
56
  return {
8
57
  name: options.name,
9
- title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Jídelní lístek', 'brilo-blocks'),
10
- description: (_b = options.description) !== null && _b !== void 0 ? _b : __('Zobrazí vybraný lístek, dnešní denní lístek nebo celý týden.', 'brilo-blocks'),
11
- category: (_c = options.category) !== null && _c !== void 0 ? _c : 'widgets',
58
+ title: (_b = options.title) !== null && _b !== void 0 ? _b : __('Jídelní lístek', 'brilo-blocks'),
59
+ description: (_c = options.description) !== null && _c !== void 0 ? _c : __('Zobrazí vybraný lístek, dnešní denní lístek nebo celý týden.', 'brilo-blocks'),
60
+ category: (_d = options.category) !== null && _d !== void 0 ? _d : 'widgets',
12
61
  ...(options.parent && { parent: options.parent }),
13
- icon: (_d = options.icon) !== null && _d !== void 0 ? _d : { src: defaultIcon },
62
+ icon: (_e = options.icon) !== null && _e !== void 0 ? _e : { src: defaultIcon },
14
63
  supports: { html: false, customClassName: false },
15
- attributes: {
16
- mode: {
17
- type: 'string',
18
- default: FOOD_MENU_GROUP_MODE,
19
- enum: [...FOOD_MENU_GROUP_MODES],
20
- },
21
- layout: {
22
- type: 'string',
23
- default: FOOD_MENU_GROUP_LAYOUT,
24
- enum: [...FOOD_MENU_GROUP_LAYOUTS],
25
- },
26
- menuIds: {
27
- type: 'array',
28
- default: [],
29
- items: { type: 'number' },
30
- },
31
- showPrices: {
32
- type: 'boolean',
33
- default: true,
34
- },
35
- showAllergens: {
36
- type: 'boolean',
37
- default: true,
64
+ attributes,
65
+ // The on/off "Umožnit rezervaci obědu" toggle became a three-way choice.
66
+ // A dynamic block is always valid, so the migration opts in through
67
+ // `isEligible`, which sees the raw comment attributes. Blocks that never
68
+ // stored the toggle had it on, which is the new default too.
69
+ deprecated: [
70
+ {
71
+ attributes: {
72
+ ...withoutReservationMode,
73
+ showReservation: {
74
+ type: 'boolean',
75
+ default: true,
76
+ },
77
+ },
78
+ isEligible: (raw) => 'showReservation' in raw && !('reservationMode' in raw),
79
+ migrate: ({ showReservation, ...rest }) => ({
80
+ ...rest,
81
+ reservationMode: false === showReservation ? 'off' : 'modal',
82
+ }),
83
+ save: () => null,
38
84
  },
39
- showReservation: {
40
- type: 'boolean',
41
- default: true,
42
- },
43
- emptyBehaviour: {
44
- type: 'string',
45
- default: FOOD_MENU_GROUP_EMPTY_BEHAVIOUR,
46
- enum: [...FOOD_MENU_GROUP_EMPTY_BEHAVIOURS],
47
- },
48
- // Empty means "use the wording the server picks for this mode".
49
- emptyText: {
50
- type: 'string',
51
- default: '',
52
- },
53
- },
54
- edit: createFoodMenuGroupEdit(options),
85
+ ],
86
+ edit: withObjectDefaults(createFoodMenuGroupEdit(options)),
55
87
  save: () => null,
56
88
  };
57
89
  }
@@ -1,4 +1,4 @@
1
- export type { FoodMenuGroupAttributes, FoodMenuGroupEmptyBehaviour, FoodMenuGroupLayout, FoodMenuGroupMode, FoodMenuGroupOptions, } from './types';
1
+ export type { FoodMenuGroupAttributes, FoodMenuGroupEmptyBehaviour, FoodMenuGroupLayout, FoodMenuGroupMode, FoodMenuGroupOptions, FoodMenuGroupReservationMode, FoodMenuGroupTextAlign, } from './types';
2
2
  export { createFoodMenuGroupBlock } from './factory';
3
3
  export { FoodMenuSelectModal } from './FoodMenuSelectModal';
4
4
  import type { FoodMenuGroupOptions } from './types';