@redneckz/wildless-cms-uni-blocks 0.9.10 → 0.9.11

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 (50) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +15 -11
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/Filtration/FiltrationContent.d.ts +18 -8
  5. package/dist/components/Filtration/Filtration.js +1 -1
  6. package/dist/components/Filtration/Filtration.js.map +1 -1
  7. package/dist/components/Filtration/FiltrationContent.d.ts +18 -8
  8. package/dist/components/Filtration/FiltrationInner.js +9 -5
  9. package/dist/components/Filtration/FiltrationInner.js.map +1 -1
  10. package/dist/components/Filtration/renderFormItem.js +6 -5
  11. package/dist/components/Filtration/renderFormItem.js.map +1 -1
  12. package/lib/common.css +1 -1
  13. package/lib/components/Filtration/Filtration.js +1 -1
  14. package/lib/components/Filtration/Filtration.js.map +1 -1
  15. package/lib/components/Filtration/FiltrationContent.d.ts +18 -8
  16. package/lib/components/Filtration/FiltrationInner.js +9 -5
  17. package/lib/components/Filtration/FiltrationInner.js.map +1 -1
  18. package/lib/components/Filtration/renderFormItem.js +6 -5
  19. package/lib/components/Filtration/renderFormItem.js.map +1 -1
  20. package/mobile/bundle/bundle.umd.js +1 -1
  21. package/mobile/bundle/bundle.umd.min.js +1 -1
  22. package/mobile/bundle/components/Filtration/FiltrationContent.d.ts +18 -8
  23. package/mobile/dist/components/Filtration/Filtration.js +1 -1
  24. package/mobile/dist/components/Filtration/Filtration.js.map +1 -1
  25. package/mobile/dist/components/Filtration/FiltrationContent.d.ts +18 -8
  26. package/mobile/dist/components/Filtration/FiltrationInner.js +9 -5
  27. package/mobile/dist/components/Filtration/FiltrationInner.js.map +1 -1
  28. package/mobile/dist/components/Filtration/renderFormItem.js +6 -5
  29. package/mobile/dist/components/Filtration/renderFormItem.js.map +1 -1
  30. package/mobile/lib/components/Filtration/Filtration.js +1 -1
  31. package/mobile/lib/components/Filtration/Filtration.js.map +1 -1
  32. package/mobile/lib/components/Filtration/FiltrationContent.d.ts +18 -8
  33. package/mobile/lib/components/Filtration/FiltrationInner.js +9 -5
  34. package/mobile/lib/components/Filtration/FiltrationInner.js.map +1 -1
  35. package/mobile/lib/components/Filtration/renderFormItem.js +6 -5
  36. package/mobile/lib/components/Filtration/renderFormItem.js.map +1 -1
  37. package/mobile/src/components/Filtration/Filtration.example.json +39 -19
  38. package/mobile/src/components/Filtration/Filtration.tsx +3 -8
  39. package/mobile/src/components/Filtration/FiltrationContent.ts +19 -8
  40. package/mobile/src/components/Filtration/FiltrationInner.tsx +31 -12
  41. package/mobile/src/components/Filtration/renderFormItem.tsx +20 -20
  42. package/mobile/src/components/RichTextBlock/RichTextBlock.example.json +1 -1
  43. package/package.json +1 -1
  44. package/src/components/Filtration/Filtration.example.json +39 -19
  45. package/src/components/Filtration/Filtration.fixture.tsx +36 -20
  46. package/src/components/Filtration/Filtration.tsx +3 -8
  47. package/src/components/Filtration/FiltrationContent.ts +19 -8
  48. package/src/components/Filtration/FiltrationInner.tsx +31 -12
  49. package/src/components/Filtration/renderFormItem.tsx +20 -20
  50. package/src/components/RichTextBlock/RichTextBlock.example.json +1 -1
@@ -2612,15 +2612,18 @@
2612
2612
 
2613
2613
  const ICONS = ['ArrowDownIcon', 'ArrowUpIcon'];
2614
2614
  const resultsGridStyle = 'grid grid-cols-12 gap-1 border-box';
2615
- const FiltrationInner = JSX(({ label = '', filtrationState = {}, topItemsCount = 0, block, ...rest }) => {
2615
+ const FiltrationInner = JSX(({ label = '', filtrationState = {}, topItemsCount = 0, block, notFound, ...rest }) => {
2616
2616
  const blocksToRender = block?.blocks?.filter((b) => checkShouldRenderBlock(filtrationState, b.content || {})) || [];
2617
2617
  const [visibleBlocks, hiddenBlocks] = topItemsCount > 0
2618
2618
  ? [blocksToRender.slice(0, topItemsCount), blocksToRender.slice(topItemsCount)]
2619
2619
  : [blocksToRender, []];
2620
- return (jsxs("div", { children: [jsx("div", { className: style(blocksToRender.length ? 'hidden' : ''), children: jsx(ErrorBlock, { error: { errorContentType: 'Image' }, title: "\u041D\u0435\u0442 \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0435\u0439 \u0438\u043F\u043E\u0442\u0435\u0447\u043D\u043E\u0439 \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B", subtitle: "\u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B" }) }), jsxs("div", { className: style(blocksToRender.length ? '' : 'hidden'), children: [jsx("div", { className: resultsGridStyle, children: renderBlocksList(visibleBlocks, { ...rest.options, parent: block }) }), jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => {
2621
- return (jsx(FoldableSection, { className: resultsGridStyle, isUnfolded: isUnfolded, children: renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }) }));
2622
- }, renderFoldButton: ({ isUnfolded, onToggle }) => (jsx(DefaultFoldButton, { className: style('mt-11', topItemsCount < 1 ? 'hidden' : ''), disabled: !hiddenBlocks?.length, label: label, icon: ICONS[Number(isUnfolded)], dataTheme: rest.options?.page?.colorPalette, onClick: onToggle })) })] })] }));
2620
+ return (jsxs("div", { children: [jsx("div", { className: style(blocksToRender.length ? 'hidden' : 'block'), children: notFound ? renderNotFound(notFound) : null }), jsxs("div", { className: style(blocksToRender.length ? '' : 'hidden'), children: [jsx("div", { className: style('mb-1', resultsGridStyle), children: renderBlocksList(visibleBlocks, { ...rest.options, parent: block }) }), jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => {
2621
+ return (jsx(FoldableSection, { className: style(resultsGridStyle, isUnfolded ? 'mb-1' : ''), isUnfolded: isUnfolded, children: renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }) }));
2622
+ }, renderFoldButton: ({ isUnfolded, onToggle }) => (jsx(DefaultFoldButton, { className: style(topItemsCount < 1 ? 'hidden' : ''), disabled: !hiddenBlocks?.length, label: label, icon: ICONS[Number(isUnfolded)], dataTheme: rest.options?.page?.colorPalette, onClick: onToggle })) })] })] }));
2623
2623
  });
2624
+ function renderNotFound({ title, description }) {
2625
+ return (jsxs("div", { className: "bg-white py-20", children: [title ? (jsx("div", { className: "mb-2", children: jsx(Paragraph, { align: "text-center", children: jsx(Text, { size: "text-h4", children: title }) }) })) : null, description ? (jsx(Paragraph, { size: "text-xl", font: "font-light", align: "text-center", children: description })) : null] }));
2626
+ }
2624
2627
 
2625
2628
  const SlideCheckboxGroup = JSX(({ value, onChange, items = [], multiple }) => {
2626
2629
  const handleChange = (newValue) => {
@@ -2640,20 +2643,21 @@
2640
2643
  const item = filtrationSchema[key];
2641
2644
  const type = item?.type;
2642
2645
  switch (type) {
2643
- case 'string':
2644
- return renderRadioButtons(key, register)(item);
2646
+ case 'array':
2647
+ return renderCheckboxes(key, register)(item);
2645
2648
  default:
2646
2649
  return null;
2647
2650
  }
2648
2651
  };
2649
- const renderRadioButtons = (key, register) => (item) => {
2650
- const options = item?.enum?.map((e, i) => ({ value: e, title: item?.enumNames?.[i] || '' })) || [];
2651
- return (jsxs("div", { role: "radiogroup", children: [item?.title ? (jsx("div", { className: "mb-4", children: jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: item.title }) })) : null, jsx(SlideCheckboxGroup, { items: options, multiple: false, ...register(key) })] }, key));
2652
+ const renderCheckboxes = (key, register) => (item) => {
2653
+ const options = item?.items?.enum?.map((e, i) => ({ value: e, title: item?.items?.enumNames?.[i] || '' })) ||
2654
+ [];
2655
+ return (jsxs("div", { children: [item?.title ? (jsx("div", { className: "mb-4", children: jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: item.title }) })) : null, jsx(SlideCheckboxGroup, { items: options, multiple: true, ...register(key) })] }, key));
2652
2656
  };
2653
2657
 
2654
2658
  const Filtration = JSX(({ className, filtrationSchema = {}, resetButton, ...rest }) => {
2655
2659
  const { formState, register, resetForm } = useForm();
2656
- return (jsxs(BlockWrapper, { className: style('p-9', className), ...rest, children: [jsxs("form", { className: "flex justify-between", children: [jsx("div", { className: "flex gap-11", children: Object.keys(filtrationSchema).map(renderFormItem(filtrationSchema, register)) }), resetButton ? (jsx("div", { children: jsx(Button, { className: "w-72", text: resetButton.text, version: resetButton.buttonVersion, onClick: resetForm }) })) : null] }), jsx(FiltrationInner, { filtrationState: formState, ...rest })] }));
2660
+ return (jsxs(BlockWrapper, { className: style(className), version: "transparent", ...rest, children: [jsxs("form", { className: "flex justify-between bg-white p-9 mb-1", children: [jsx("div", { className: "flex gap-11", children: Object.keys(filtrationSchema).map(renderFormItem(filtrationSchema, register)) }), resetButton ? (jsx("div", { children: jsx(Button, { className: "w-72", onClick: resetForm, ...resetButton }) })) : null] }), jsx(FiltrationInner, { filtrationState: formState, ...rest })] }));
2657
2661
  });
2658
2662
  Filtration.childrenTypes = ['ProductTile'];
2659
2663
  Filtration.childSchema = (content) => content?.filtrationSchema || {};
@@ -4885,7 +4889,7 @@
4885
4889
  return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto" }) }));
4886
4890
  }
4887
4891
 
4888
- const packageVersion = "0.9.10";
4892
+ const packageVersion = "0.9.11";
4889
4893
 
4890
4894
  exports.Blocks = Blocks;
4891
4895
  exports.ContentPage = ContentPage;