@redneckz/wildless-cms-uni-blocks 0.3.22 → 0.3.23
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +33 -20
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/Accordion/Accordion.js +6 -2
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/AccordionContent.d.ts +7 -0
- package/dist/components/Accordion/AccordionItem.js +14 -5
- package/dist/components/Accordion/AccordionItem.js.map +1 -1
- package/dist/components/Accordion/AccordionItem.mobile.js +1 -1
- package/dist/components/Accordion/AccordionItem.mobile.js.map +1 -1
- package/dist/components/Accordion/AccordionItemInner.js +2 -2
- package/dist/components/Accordion/AccordionItemInner.js.map +1 -1
- package/dist/components/Accordion/AccordionItemInner.mobile.js +2 -2
- package/dist/components/Accordion/AccordionItemInner.mobile.js.map +1 -1
- package/dist/components/Accordion/useActiveHandler.d.ts +7 -0
- package/dist/components/Accordion/{utils/useActiveHandler.js → useActiveHandler.js} +2 -2
- package/dist/components/Accordion/useActiveHandler.js.map +1 -0
- package/dist/components/LinkDocs/LinkDocs.mobile.js +1 -1
- package/dist/components/LinkDocs/LinkDocs.mobile.js.map +1 -1
- package/dist/components/OtherProducts/OtherProductsContent.d.ts +4 -1
- package/dist/components/OtherProducts/OtherProductsItem.js +4 -4
- package/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/dist/components/OtherProducts/useActiveHandler.d.ts +7 -0
- package/dist/components/OtherProducts/{utils/useActiveHandler.js → useActiveHandler.js} +2 -2
- package/dist/components/OtherProducts/useActiveHandler.js.map +1 -0
- package/dist/components/TariffsTable/TariffsTable.mobile.js +1 -1
- package/dist/components/TariffsTable/TariffsTable.mobile.js.map +1 -1
- package/dist/content-page-repository/transformPicture.js +2 -1
- package/dist/content-page-repository/transformPicture.js.map +1 -1
- package/dist/icons/IconName.d.ts +1 -1
- package/dist/icons/IconName.js.map +1 -1
- package/dist/model/Picture.d.ts +2 -2
- package/dist/ui-kit/BlocksList/BlocksListProps.d.ts +46 -18
- package/dist/ui-kit/BlocksList/renderBlocksList.d.ts +4 -2
- package/dist/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/dist/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/dist/ui-kit/SearchBar/SearchBar.mobile.js +1 -1
- package/dist/ui-kit/SearchBar/SearchBar.mobile.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Accordion/Accordion.js +6 -2
- package/lib/components/Accordion/Accordion.js.map +1 -1
- package/lib/components/Accordion/AccordionContent.d.ts +7 -0
- package/lib/components/Accordion/AccordionItem.js +14 -5
- package/lib/components/Accordion/AccordionItem.js.map +1 -1
- package/lib/components/Accordion/AccordionItem.mobile.js +1 -1
- package/lib/components/Accordion/AccordionItem.mobile.js.map +1 -1
- package/lib/components/Accordion/AccordionItemInner.js +2 -2
- package/lib/components/Accordion/AccordionItemInner.js.map +1 -1
- package/lib/components/Accordion/AccordionItemInner.mobile.js +2 -2
- package/lib/components/Accordion/AccordionItemInner.mobile.js.map +1 -1
- package/lib/components/Accordion/useActiveHandler.d.ts +7 -0
- package/{mobile/lib/components/Accordion/utils → lib/components/Accordion}/useActiveHandler.js +2 -2
- package/lib/components/Accordion/useActiveHandler.js.map +1 -0
- package/lib/components/LinkDocs/LinkDocs.mobile.js +1 -1
- package/lib/components/LinkDocs/LinkDocs.mobile.js.map +1 -1
- package/lib/components/OtherProducts/OtherProductsContent.d.ts +4 -1
- package/lib/components/OtherProducts/OtherProductsItem.js +4 -4
- package/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/lib/components/OtherProducts/useActiveHandler.d.ts +7 -0
- package/{mobile/lib/components/OtherProducts/utils → lib/components/OtherProducts}/useActiveHandler.js +2 -2
- package/lib/components/OtherProducts/useActiveHandler.js.map +1 -0
- package/lib/components/TariffsTable/TariffsTable.mobile.js +1 -1
- package/lib/components/TariffsTable/TariffsTable.mobile.js.map +1 -1
- package/lib/content-page-repository/transformPicture.js +2 -1
- package/lib/content-page-repository/transformPicture.js.map +1 -1
- package/lib/icons/IconName.js.map +1 -1
- package/lib/model/Picture.d.ts +2 -2
- package/lib/ui-kit/BlocksList/BlocksListProps.d.ts +46 -18
- package/lib/ui-kit/BlocksList/renderBlocksList.d.ts +4 -2
- package/lib/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/lib/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/lib/ui-kit/SearchBar/SearchBar.mobile.js +1 -1
- package/lib/ui-kit/SearchBar/SearchBar.mobile.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +10 -10
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/Accordion/AccordionContent.d.ts +7 -0
- package/mobile/dist/components/Accordion/AccordionItem.js +1 -1
- package/mobile/dist/components/Accordion/AccordionItem.js.map +1 -1
- package/mobile/dist/components/Accordion/AccordionItemInner.js +2 -2
- package/mobile/dist/components/Accordion/AccordionItemInner.js.map +1 -1
- package/mobile/dist/components/Accordion/useActiveHandler.d.ts +7 -0
- package/mobile/dist/components/Accordion/{utils/useActiveHandler.js → useActiveHandler.js} +2 -2
- package/mobile/dist/components/Accordion/useActiveHandler.js.map +1 -0
- package/mobile/dist/components/LinkDocs/LinkDocs.js +1 -1
- package/mobile/dist/components/LinkDocs/LinkDocs.js.map +1 -1
- package/mobile/dist/components/OtherProducts/OtherProductsContent.d.ts +4 -1
- package/mobile/dist/components/OtherProducts/OtherProductsItem.js +4 -4
- package/mobile/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/mobile/dist/components/OtherProducts/useActiveHandler.d.ts +7 -0
- package/mobile/dist/components/OtherProducts/{utils/useActiveHandler.js → useActiveHandler.js} +2 -2
- package/mobile/dist/components/OtherProducts/useActiveHandler.js.map +1 -0
- package/mobile/dist/components/TariffsTable/TariffsTable.js +1 -1
- package/mobile/dist/components/TariffsTable/TariffsTable.js.map +1 -1
- package/mobile/dist/content-page-repository/transformPicture.js +2 -1
- package/mobile/dist/content-page-repository/transformPicture.js.map +1 -1
- package/mobile/dist/model/Picture.d.ts +2 -2
- package/mobile/dist/ui-kit/BlocksList/BlocksListProps.d.ts +46 -18
- package/mobile/dist/ui-kit/BlocksList/renderBlocksList.d.ts +4 -2
- package/mobile/dist/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/mobile/dist/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/mobile/dist/ui-kit/SearchBar/SearchBar.js +1 -1
- package/mobile/dist/ui-kit/SearchBar/SearchBar.js.map +1 -1
- package/mobile/lib/components/Accordion/AccordionContent.d.ts +7 -0
- package/mobile/lib/components/Accordion/AccordionItem.js +1 -1
- package/mobile/lib/components/Accordion/AccordionItem.js.map +1 -1
- package/mobile/lib/components/Accordion/AccordionItemInner.js +2 -2
- package/mobile/lib/components/Accordion/AccordionItemInner.js.map +1 -1
- package/mobile/lib/components/Accordion/useActiveHandler.d.ts +7 -0
- package/{lib/components/Accordion/utils → mobile/lib/components/Accordion}/useActiveHandler.js +2 -2
- package/mobile/lib/components/Accordion/useActiveHandler.js.map +1 -0
- package/mobile/lib/components/LinkDocs/LinkDocs.js +1 -1
- package/mobile/lib/components/LinkDocs/LinkDocs.js.map +1 -1
- package/mobile/lib/components/OtherProducts/OtherProductsContent.d.ts +4 -1
- package/mobile/lib/components/OtherProducts/OtherProductsItem.js +4 -4
- package/mobile/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/mobile/lib/components/OtherProducts/useActiveHandler.d.ts +7 -0
- package/{lib/components/OtherProducts/utils → mobile/lib/components/OtherProducts}/useActiveHandler.js +2 -2
- package/mobile/lib/components/OtherProducts/useActiveHandler.js.map +1 -0
- package/mobile/lib/components/TariffsTable/TariffsTable.js +1 -1
- package/mobile/lib/components/TariffsTable/TariffsTable.js.map +1 -1
- package/mobile/lib/content-page-repository/transformPicture.js +2 -1
- package/mobile/lib/content-page-repository/transformPicture.js.map +1 -1
- package/mobile/lib/model/Picture.d.ts +2 -2
- package/mobile/lib/ui-kit/BlocksList/BlocksListProps.d.ts +46 -18
- package/mobile/lib/ui-kit/BlocksList/renderBlocksList.d.ts +4 -2
- package/mobile/lib/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/mobile/lib/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/mobile/lib/ui-kit/SearchBar/SearchBar.js +1 -1
- package/mobile/lib/ui-kit/SearchBar/SearchBar.js.map +1 -1
- package/mobile/src/components/Accordion/AccordionContent.ts +8 -1
- package/mobile/src/components/Accordion/AccordionItem.tsx +1 -1
- package/mobile/src/components/Accordion/AccordionItemInner.tsx +11 -9
- package/mobile/src/components/Accordion/{utils/useActiveHandler.ts → useActiveHandler.ts} +4 -3
- package/mobile/src/components/LinkDocs/LinkDocs.tsx +3 -1
- package/mobile/src/components/OtherProducts/OtherProductsContent.ts +4 -1
- package/mobile/src/components/OtherProducts/OtherProductsItem.tsx +29 -27
- package/mobile/src/components/OtherProducts/{utils/useActiveHandler.ts → useActiveHandler.ts} +4 -3
- package/mobile/src/components/TariffsTable/TariffsTable.tsx +3 -1
- package/mobile/src/content-page-repository/transformPicture.ts +2 -1
- package/mobile/src/model/Picture.ts +2 -2
- package/mobile/src/ui-kit/BlocksList/BlocksListProps.ts +27 -29
- package/mobile/src/ui-kit/BlocksList/renderBlocksList.tsx +12 -4
- package/mobile/src/ui-kit/SearchBar/SearchBar.tsx +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +27 -14
- package/src/components/Accordion/AccordionContent.ts +8 -1
- package/src/components/Accordion/AccordionItem.mobile.tsx +1 -1
- package/src/components/Accordion/AccordionItem.tsx +48 -26
- package/src/components/Accordion/AccordionItemInner.mobile.tsx +11 -9
- package/src/components/Accordion/AccordionItemInner.tsx +10 -8
- package/src/components/Accordion/{utils/useActiveHandler.ts → useActiveHandler.ts} +4 -3
- package/src/components/LinkDocs/LinkDocs.mobile.tsx +3 -1
- package/src/components/OtherProducts/OtherProductsContent.ts +4 -1
- package/src/components/OtherProducts/OtherProductsItem.tsx +29 -27
- package/src/components/OtherProducts/{utils/useActiveHandler.ts → useActiveHandler.ts} +4 -3
- package/src/components/TariffsTable/TariffsTable.mobile.tsx +3 -1
- package/src/content-page-repository/transformPicture.ts +2 -1
- package/src/icons/IconName.ts +3 -152
- package/src/model/Picture.ts +2 -2
- package/src/ui-kit/BlocksList/BlocksListProps.ts +27 -29
- package/src/ui-kit/BlocksList/renderBlocksList.tsx +12 -4
- package/src/ui-kit/SearchBar/SearchBar.mobile.tsx +1 -1
- package/dist/components/Accordion/utils/useActiveHandler.d.ts +0 -9
- package/dist/components/Accordion/utils/useActiveHandler.js.map +0 -1
- package/dist/components/OtherProducts/utils/useActiveHandler.d.ts +0 -9
- package/dist/components/OtherProducts/utils/useActiveHandler.js.map +0 -1
- package/lib/components/Accordion/utils/useActiveHandler.d.ts +0 -9
- package/lib/components/Accordion/utils/useActiveHandler.js.map +0 -1
- package/lib/components/OtherProducts/utils/useActiveHandler.d.ts +0 -9
- package/lib/components/OtherProducts/utils/useActiveHandler.js.map +0 -1
- package/mobile/dist/components/Accordion/utils/useActiveHandler.d.ts +0 -9
- package/mobile/dist/components/Accordion/utils/useActiveHandler.js.map +0 -1
- package/mobile/dist/components/OtherProducts/utils/useActiveHandler.d.ts +0 -9
- package/mobile/dist/components/OtherProducts/utils/useActiveHandler.js.map +0 -1
- package/mobile/lib/components/Accordion/utils/useActiveHandler.d.ts +0 -9
- package/mobile/lib/components/Accordion/utils/useActiveHandler.js.map +0 -1
- package/mobile/lib/components/OtherProducts/utils/useActiveHandler.d.ts +0 -9
- package/mobile/lib/components/OtherProducts/utils/useActiveHandler.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
3
3
|
import { Icon } from '../Icon/Icon.js';
|
|
4
4
|
export const SearchBar = JSX(({ className, context }) => {
|
|
5
5
|
const { term, setTerm } = context.useSearch();
|
|
6
|
-
return (_jsxs("form", { className: `relative ${className || ''}`, children: [_jsxs("div", { className: "absolute rounded h-full flex items-center justify-center pl-4 max-w-[170px] gap-3.5 pointer-events-none", children: [_jsx("div", { className: "w-[20px] h-[20px]", children: _jsx(Icon, { name: "LoupeIcon", width: "24", height: "24" }) }), !term && (_jsx("label", { htmlFor: "search-bar-input", className: "font-sans font-normal text-sm text-secondary-text", children: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u0430\u0439\u0442\u0443" }))] }), _jsx("input", { id: "search-bar-input", className: 'h-12 pl-12 w-full peer placeholder-transparent font-sans font-normal text-base text-black border border-solid rounded box-border outline-none pr-[6%] border-main-divider focus:border-primary-text', value: term, onChange: (e) => setTerm(e.target.value), type: "text", name: "search-bar-input", placeholder: "some search" }), _jsx("button", { className: "visible peer-placeholder-shown:invisible absolute top-2 right-3 w-6 h-6 p-1 bg-transparent cursor-pointer", onClick: (e) => {
|
|
6
|
+
return (_jsxs("form", { className: `relative ${className || ''}`, children: [_jsxs("div", { className: "absolute rounded h-full flex items-center justify-center pl-4 max-w-[170px] gap-3.5 pointer-events-none", children: [_jsx("div", { className: "w-[20px] h-[20px]", children: _jsx(Icon, { name: "LoupeIcon", width: "24", height: "24" }) }), !term && (_jsx("label", { htmlFor: "search-bar-input", className: "font-sans font-normal text-sm text-secondary-text", children: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u0430\u0439\u0442\u0443" }))] }), _jsx("input", { id: "search-bar-input", className: 'h-12 pl-12 w-full peer placeholder-transparent font-sans font-normal text-base text-black border border-solid rounded box-border outline-none pr-[6%] border-main-divider focus:border-primary-text', value: term, onChange: (e) => setTerm(e.target.value), type: "text", name: "search-bar-input", placeholder: "some search" }), _jsx("button", { className: "visible peer-placeholder-shown:invisible absolute top-2 right-3 w-6 h-6 p-1 bg-transparent cursor-pointer border-none", onClick: (e) => {
|
|
7
7
|
e.preventDefault();
|
|
8
8
|
setTerm('');
|
|
9
9
|
}, children: _jsx(Icon, { name: "CloseIcon", width: "24", height: "24" }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../src/ui-kit/SearchBar/SearchBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAgB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;IACrE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAC9C,OAAO,CACL,gBAAM,SAAS,EAAE,YAAY,SAAS,IAAI,EAAE,EAAE,aAC5C,eAAK,SAAS,EAAC,yGAAyG,aACtH,cAAK,SAAS,EAAC,mBAAmB,YAChC,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAG,GAC5C,EACL,CAAC,IAAI,IAAI,CACR,gBACE,OAAO,EAAC,kBAAkB,EAC1B,SAAS,EAAC,mDAAmD,2FAGvD,CACT,IACG,EACN,gBACE,EAAE,EAAC,kBAAkB,EACrB,SAAS,EACP,qMAAqM,EAEvM,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACxC,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,kBAAkB,EACvB,WAAW,EAAC,aAAa,GACzB,EACF,iBACE,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../src/ui-kit/SearchBar/SearchBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAgB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;IACrE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAC9C,OAAO,CACL,gBAAM,SAAS,EAAE,YAAY,SAAS,IAAI,EAAE,EAAE,aAC5C,eAAK,SAAS,EAAC,yGAAyG,aACtH,cAAK,SAAS,EAAC,mBAAmB,YAChC,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAG,GAC5C,EACL,CAAC,IAAI,IAAI,CACR,gBACE,OAAO,EAAC,kBAAkB,EAC1B,SAAS,EAAC,mDAAmD,2FAGvD,CACT,IACG,EACN,gBACE,EAAE,EAAC,kBAAkB,EACrB,SAAS,EACP,qMAAqM,EAEvM,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACxC,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,kBAAkB,EACvB,WAAW,EAAC,aAAa,GACzB,EACF,iBACE,SAAS,EAAC,uHAAuH,EACjI,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACb,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,OAAO,CAAC,EAAE,CAAC,CAAC;gBACd,CAAC,YAED,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAG,GACzC,IACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BlockDef, ColumnsCount } from '../../ui-kit/BlocksList/BlocksListProps';
|
|
2
|
-
|
|
2
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
3
3
|
/**
|
|
4
4
|
* @title Элемент списка
|
|
5
5
|
*/
|
|
@@ -9,6 +9,10 @@ export interface AccordionItemCommonProps {
|
|
|
9
9
|
* @default Список
|
|
10
10
|
*/
|
|
11
11
|
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @title Отображать в раскрытом виде
|
|
14
|
+
*/
|
|
15
|
+
isExpanded?: boolean;
|
|
12
16
|
/** @title Блоки */
|
|
13
17
|
blocks?: BlockDef[];
|
|
14
18
|
/**
|
|
@@ -16,6 +20,8 @@ export interface AccordionItemCommonProps {
|
|
|
16
20
|
* @default false
|
|
17
21
|
*/
|
|
18
22
|
bordered?: boolean; // TODO: только для мобильной версии
|
|
23
|
+
version?: BlockVersion;
|
|
24
|
+
|
|
19
25
|
columns?: ColumnsCount;
|
|
20
26
|
}
|
|
21
27
|
|
|
@@ -25,6 +31,7 @@ export interface AccordionItemCommonProps {
|
|
|
25
31
|
export interface AccordionContent {
|
|
26
32
|
/** @title Заголовок */
|
|
27
33
|
title?: string;
|
|
34
|
+
version?: BlockVersion;
|
|
28
35
|
/** @title Список */
|
|
29
36
|
accordionItems?: AccordionItemCommonProps[];
|
|
30
37
|
/** @title Описание */
|
|
@@ -3,7 +3,7 @@ import type { UniBlockProps } from '../../types';
|
|
|
3
3
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
4
4
|
import type { AccordionItemCommonProps } from './AccordionContent';
|
|
5
5
|
import { AccordionItemInner } from './AccordionItemInner';
|
|
6
|
-
import { useActiveHandler } from './
|
|
6
|
+
import { useActiveHandler } from './useActiveHandler';
|
|
7
7
|
|
|
8
8
|
export interface AccordionItemProps extends AccordionItemCommonProps, UniBlockProps {}
|
|
9
9
|
|
|
@@ -2,12 +2,14 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import type { AccordionItemProps } from './AccordionItem';
|
|
3
3
|
import { renderBlocksList } from '../../ui-kit/BlocksList/renderBlocksList';
|
|
4
4
|
|
|
5
|
-
export const AccordionItemInner = JSX<AccordionItemProps>(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
export const AccordionItemInner = JSX<AccordionItemProps>(
|
|
6
|
+
({ blocks, context, version = 'primary' }) => {
|
|
7
|
+
const className = 'mb-5 last:mb-0 first:mt-2';
|
|
8
|
+
const columns = 1;
|
|
9
|
+
return (
|
|
10
|
+
<div className="transition-all duration-300 max-h-0 overflow-hidden group-last:last:pb-0">
|
|
11
|
+
{renderBlocksList({ context, className, columns, blocks, version })}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
},
|
|
15
|
+
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { IconName } from '
|
|
1
|
+
import type { IconName } from '../../icons/IconName';
|
|
2
|
+
import { ActiveHandler } from '../../ui-kit/BlocksList/BlocksListProps';
|
|
2
3
|
|
|
3
|
-
export const useActiveHandler = ({ context, blocks }) => {
|
|
4
|
-
const [isActive, setIsActive] = context.useState(
|
|
4
|
+
export const useActiveHandler = ({ context, blocks, initialState = false }: ActiveHandler) => {
|
|
5
|
+
const [isActive, setIsActive] = context.useState(initialState);
|
|
5
6
|
const hasContent = blocks?.length;
|
|
6
7
|
const icon: IconName = isActive ? 'MinusIcon' : 'PlusIcon';
|
|
7
8
|
|
|
@@ -19,7 +19,9 @@ export const LinkDocs = JSX<LinkDocsProps>(
|
|
|
19
19
|
hasBorder = true,
|
|
20
20
|
}) => {
|
|
21
21
|
return (
|
|
22
|
-
<section
|
|
22
|
+
<section
|
|
23
|
+
className={`font-sans text-primary-text py-6 px-4 bg-white overflow-x-hidden ${className}`}
|
|
24
|
+
>
|
|
23
25
|
{title ? (
|
|
24
26
|
<Heading
|
|
25
27
|
headingType="h2"
|
|
@@ -9,6 +9,10 @@ export interface blockItemCommonProps {
|
|
|
9
9
|
* @default Список
|
|
10
10
|
*/
|
|
11
11
|
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @title Отображать в раскрытом виде
|
|
14
|
+
*/
|
|
15
|
+
isExpanded?: boolean;
|
|
12
16
|
/** @title Блоки */
|
|
13
17
|
blocks?: BlockDef[];
|
|
14
18
|
/**
|
|
@@ -17,7 +21,6 @@ export interface blockItemCommonProps {
|
|
|
17
21
|
*/
|
|
18
22
|
bordered?: boolean; // TODO: только для мобильной версии
|
|
19
23
|
columns?: ColumnsCount;
|
|
20
|
-
isActive?: boolean;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import { useActiveHandler } from './
|
|
2
|
+
import { useActiveHandler } from './useActiveHandler';
|
|
3
3
|
import type { UniBlockProps } from '../../types';
|
|
4
4
|
import type { blockItemCommonProps } from './OtherProductsContent';
|
|
5
5
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
@@ -7,30 +7,32 @@ import { OtherProductsItemInner } from './OtherProductsItemInner';
|
|
|
7
7
|
|
|
8
8
|
export interface BlockItemProps extends blockItemCommonProps, UniBlockProps {}
|
|
9
9
|
|
|
10
|
-
export const OtherProductsItem = JSX<BlockItemProps>(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export const OtherProductsItem = JSX<BlockItemProps>(
|
|
11
|
+
({ label, isExpanded, blocks, columns, context }) => {
|
|
12
|
+
const { hasContent, icon, handleToggle, isActive } = useActiveHandler({
|
|
13
|
+
context,
|
|
14
|
+
blocks,
|
|
15
|
+
initialState: isExpanded,
|
|
16
|
+
});
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
return (
|
|
19
|
+
<div className="border-0 border-b border-solid border-main-divider">
|
|
20
|
+
{hasContent ? (
|
|
21
|
+
<OtherProductsItemInner
|
|
22
|
+
isExpanded={isActive}
|
|
23
|
+
columns={columns}
|
|
24
|
+
blocks={blocks}
|
|
25
|
+
context={context}
|
|
26
|
+
/>
|
|
27
|
+
) : null}
|
|
28
|
+
<button
|
|
29
|
+
className="border-none bg-primary-main px-0 py-[25px] w-full font-sans text-white text-base flex justify-center cursor-pointer"
|
|
30
|
+
onClick={handleToggle}
|
|
31
|
+
>
|
|
32
|
+
<span className="pr-3">{isActive ? 'Скрыть' : label}</span>
|
|
33
|
+
{hasContent ? <Icon name={icon} width="20" height="20" asSVG /> : null}
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
);
|
package/mobile/src/components/OtherProducts/{utils/useActiveHandler.ts → useActiveHandler.ts}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { IconName } from '
|
|
1
|
+
import type { IconName } from '../../icons/IconName';
|
|
2
|
+
import { ActiveHandler } from '../../ui-kit/BlocksList/BlocksListProps';
|
|
2
3
|
|
|
3
|
-
export const useActiveHandler = ({ context, blocks }) => {
|
|
4
|
-
const [isActive, setIsActive] = context.useState(
|
|
4
|
+
export const useActiveHandler = ({ context, blocks, initialState = false }: ActiveHandler) => {
|
|
5
|
+
const [isActive, setIsActive] = context.useState(initialState);
|
|
5
6
|
const hasContent = blocks?.length;
|
|
6
7
|
const icon: IconName = isActive ? 'ArrowUpIcon' : 'ArrowDownIcon';
|
|
7
8
|
|
|
@@ -18,7 +18,9 @@ export const TariffsTable = JSX<TariffsTableProps>(
|
|
|
18
18
|
const tiles = getTiles(rowHeaders, colData);
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
|
-
<section
|
|
21
|
+
<section
|
|
22
|
+
className={`px-4 py-6 bg-white font-sans text-primary-text overflow-x-hidden ${className}`}
|
|
23
|
+
>
|
|
22
24
|
{title ? (
|
|
23
25
|
<Heading
|
|
24
26
|
headingType="h2"
|
|
@@ -13,8 +13,9 @@ export async function transformPicture(
|
|
|
13
13
|
options: TransformationOptions,
|
|
14
14
|
): Promise<Picture> {
|
|
15
15
|
const sources = picture.sources || [];
|
|
16
|
+
const src = picture?.src || '';
|
|
16
17
|
const [transformedPicture, ...transformedSources] = await Promise.all(
|
|
17
|
-
[picture].concat(sources).map((_) => transformImg(pagePath,
|
|
18
|
+
[picture].concat(sources).map((_) => transformImg(pagePath, src, { ...options, ..._ })),
|
|
18
19
|
);
|
|
19
20
|
return {
|
|
20
21
|
...picture,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface Img {
|
|
2
2
|
/** @title Картинка */
|
|
3
|
-
src
|
|
3
|
+
src?: string;
|
|
4
4
|
/** @title Альтернативный текст (alt) */
|
|
5
5
|
alt?: string;
|
|
6
6
|
/** @title Текст подсказки (title) */
|
|
@@ -9,7 +9,7 @@ export interface Img {
|
|
|
9
9
|
|
|
10
10
|
export interface ImgSource {
|
|
11
11
|
/** @title Картинка */
|
|
12
|
-
src
|
|
12
|
+
src?: string;
|
|
13
13
|
/** @title Формат */
|
|
14
14
|
format?: 'jpeg' | 'jpg' | 'png' | 'gif' | 'webp' | 'heif' | 'avif';
|
|
15
15
|
/** @hidden */
|
|
@@ -8,6 +8,13 @@ import type { ProductTileContent } from '../../components/ProductTile/ProductTil
|
|
|
8
8
|
import type { TextBlockContent } from '../../components/TextBlock/TextBlockContent';
|
|
9
9
|
import type { TileContent } from '../../components/Tile/TileContent';
|
|
10
10
|
import type { LinkListContent } from '../../components/LinkList/LinkListContent';
|
|
11
|
+
import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
12
|
+
|
|
13
|
+
export interface ActiveHandler {
|
|
14
|
+
context: ContentPageContext;
|
|
15
|
+
blocks?: BlockDef[];
|
|
16
|
+
initialState?: boolean;
|
|
17
|
+
}
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* @title Количество колонок
|
|
@@ -15,74 +22,65 @@ import type { LinkListContent } from '../../components/LinkList/LinkListContent'
|
|
|
15
22
|
*/
|
|
16
23
|
export type ColumnsCount = 1 | 2;
|
|
17
24
|
|
|
18
|
-
/**
|
|
19
|
-
* @title Тип блока
|
|
20
|
-
*/
|
|
21
|
-
export type BlockDefType =
|
|
22
|
-
| 'Headline'
|
|
23
|
-
| 'LinkDocs'
|
|
24
|
-
| 'TextBlock'
|
|
25
|
-
| 'PictureText'
|
|
26
|
-
| 'Tile'
|
|
27
|
-
| 'ProductTile'
|
|
28
|
-
| 'ProductBlock'
|
|
29
|
-
| 'Gallery'
|
|
30
|
-
| 'MiniGallery'
|
|
31
|
-
| 'LinkList';
|
|
32
|
-
|
|
33
|
-
interface BaseBlockDef {
|
|
34
|
-
blockListType: BlockDefType;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
/**
|
|
38
26
|
* @title Заголовок
|
|
27
|
+
* @default {"blockListType": "Headline"}
|
|
39
28
|
*/
|
|
40
|
-
export type HeadlineBlockListDef = HeadlineContent &
|
|
29
|
+
export type HeadlineBlockListDef = HeadlineContent & { blockListType: 'Headline' };
|
|
41
30
|
|
|
42
31
|
/**
|
|
43
32
|
* @title Список документов
|
|
33
|
+
* @default {"blockListType": "LinkDocs"}
|
|
44
34
|
*/
|
|
45
|
-
export type LinkDocsBlockListDef = LinkDocsContent &
|
|
35
|
+
export type LinkDocsBlockListDef = LinkDocsContent & { blockListType: 'LinkDocs' };
|
|
46
36
|
|
|
47
37
|
/**
|
|
48
38
|
* @title Текстовый блок
|
|
39
|
+
* @default {"blockListType": "TextBlock"}
|
|
49
40
|
*/
|
|
50
|
-
export type TextBlockBlockListDef = TextBlockContent &
|
|
41
|
+
export type TextBlockBlockListDef = TextBlockContent & { blockListType: 'TextBlock' };
|
|
51
42
|
|
|
52
43
|
/**
|
|
53
44
|
* @title Картинка с текстом
|
|
45
|
+
* @default {"blockListType": "PictureText"}
|
|
54
46
|
*/
|
|
55
|
-
export type PictureTextBlockListDef = PictureTextContent &
|
|
47
|
+
export type PictureTextBlockListDef = PictureTextContent & { blockListType: 'PictureText' };
|
|
56
48
|
|
|
57
49
|
/**
|
|
58
50
|
* @title Продуктовый блок
|
|
51
|
+
* @default {"blockListType": "ProductBlock"}
|
|
59
52
|
*/
|
|
60
|
-
export type ProductBlockBlockListDef = ProductBlockContent &
|
|
53
|
+
export type ProductBlockBlockListDef = ProductBlockContent & { blockListType: 'ProductBlock' };
|
|
61
54
|
|
|
62
55
|
/**
|
|
63
56
|
* @title Плитка
|
|
57
|
+
* @default {"blockListType": "Tile"}
|
|
64
58
|
*/
|
|
65
|
-
export type TileBlockListDef = TileContent &
|
|
59
|
+
export type TileBlockListDef = TileContent & { blockListType: 'Tile' };
|
|
66
60
|
|
|
67
61
|
/**
|
|
68
62
|
* @title Продуктовая плитка
|
|
63
|
+
* @default {"blockListType": "ProductTile"}
|
|
69
64
|
*/
|
|
70
|
-
export type ProductTileBlockListDef = ProductTileContent &
|
|
65
|
+
export type ProductTileBlockListDef = ProductTileContent & { blockListType: 'ProductTile' };
|
|
71
66
|
|
|
72
67
|
/**
|
|
73
68
|
* @title Галлерея
|
|
69
|
+
* @default {"blockListType": "Gallery"}
|
|
74
70
|
*/
|
|
75
|
-
export type GalleryBlockListDef = GalleryContent &
|
|
71
|
+
export type GalleryBlockListDef = GalleryContent & { blockListType: 'Gallery' };
|
|
76
72
|
|
|
77
73
|
/**
|
|
78
74
|
* @title Мини-галлерея
|
|
75
|
+
* @default {"blockListType": "MiniGallery"}
|
|
79
76
|
*/
|
|
80
|
-
export type MiniGalleryBlockListDef = MiniGalleryContent &
|
|
77
|
+
export type MiniGalleryBlockListDef = MiniGalleryContent & { blockListType: 'MiniGallery' };
|
|
81
78
|
|
|
82
79
|
/**
|
|
83
80
|
* @title Список ссылок
|
|
81
|
+
* @default {"blockListType": "LinkList"}
|
|
84
82
|
*/
|
|
85
|
-
export type LinkListBlockListDef = LinkListContent &
|
|
83
|
+
export type LinkListBlockListDef = LinkListContent & { blockListType: 'LinkList' };
|
|
86
84
|
|
|
87
85
|
/**
|
|
88
86
|
* @title Выберите блок
|
|
@@ -2,19 +2,27 @@ import type { JSXBlock } from '../../components/ContentPage/ContentPage';
|
|
|
2
2
|
import type { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
3
3
|
import type { BlockDef, ColumnsCount } from './BlocksListProps';
|
|
4
4
|
import { EmbeddableBlocks } from './EmbeddableBlocks';
|
|
5
|
+
import { BlockVersion } from '../../model/BlockVersion';
|
|
5
6
|
|
|
6
7
|
type EmbeddableBlocksProps = {
|
|
7
8
|
blocks?: BlockDef[];
|
|
8
9
|
context: ContentPageContext;
|
|
9
10
|
columns?: ColumnsCount;
|
|
10
11
|
className?: string;
|
|
12
|
+
version?: BlockVersion;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
|
-
export const renderBlocksList = ({
|
|
14
|
-
blocks
|
|
15
|
+
export const renderBlocksList = ({
|
|
16
|
+
blocks,
|
|
17
|
+
context,
|
|
18
|
+
className,
|
|
19
|
+
columns,
|
|
20
|
+
version,
|
|
21
|
+
}: EmbeddableBlocksProps) =>
|
|
22
|
+
blocks?.length ? blocks.map(renderBlock({ context, className, columns, version })) : null;
|
|
15
23
|
|
|
16
24
|
export const renderBlock =
|
|
17
|
-
({ context, columns, className }: EmbeddableBlocksProps) =>
|
|
25
|
+
({ context, columns, className, version }: EmbeddableBlocksProps) =>
|
|
18
26
|
(block: BlockDef, i: number) => {
|
|
19
27
|
const type = block?.blockListType;
|
|
20
28
|
if (!type || !(type in EmbeddableBlocks)) {
|
|
@@ -24,7 +32,7 @@ export const renderBlock =
|
|
|
24
32
|
const EmbeddedBlock: JSXBlock = EmbeddableBlocks[type];
|
|
25
33
|
return (
|
|
26
34
|
<div className={`${className} ${columnsCountClass}`} key={`block_${i}`}>
|
|
27
|
-
<EmbeddedBlock context={context} {...block} className="!p-0" />
|
|
35
|
+
<EmbeddedBlock context={context} {...block} blockVersion={version} className="!p-0" />
|
|
28
36
|
</div>
|
|
29
37
|
);
|
|
30
38
|
};
|
|
@@ -31,7 +31,7 @@ export const SearchBar = JSX<UniBlockProps>(({ className, context }) => {
|
|
|
31
31
|
placeholder="some search"
|
|
32
32
|
/>
|
|
33
33
|
<button
|
|
34
|
-
className="visible peer-placeholder-shown:invisible absolute top-2 right-3 w-6 h-6 p-1 bg-transparent cursor-pointer"
|
|
34
|
+
className="visible peer-placeholder-shown:invisible absolute top-2 right-3 w-6 h-6 p-1 bg-transparent cursor-pointer border-none"
|
|
35
35
|
onClick={(e) => {
|
|
36
36
|
e.preventDefault();
|
|
37
37
|
setTerm('');
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { BlockVersion } from '../../model/BlockVersion';
|
|
2
3
|
import type { UniBlockProps } from '../../types';
|
|
3
4
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
4
5
|
import type { AccordionContent } from './AccordionContent';
|
|
@@ -6,17 +7,29 @@ import { AccordionItem } from './AccordionItem';
|
|
|
6
7
|
|
|
7
8
|
export interface AccordionProps extends AccordionContent, UniBlockProps {}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
const accordionStyleMap: Record<BlockVersion, string> = {
|
|
11
|
+
primary: 'bg-white text-primary-text',
|
|
12
|
+
secondary: 'bg-primary-main text-white',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Accordion = JSX<AccordionProps>(
|
|
16
|
+
({ title, accordionItems, context, className = '', version = 'primary' }) => {
|
|
17
|
+
return (
|
|
18
|
+
<section className={`p-[50px] font-sans ${className} ${accordionStyleMap[version]}`}>
|
|
19
|
+
{title ? <Heading headingType="h4" className="mb-2.5" title={title} /> : null}
|
|
20
|
+
{accordionItems?.length ? (
|
|
21
|
+
<ul className="list-none m-0 p-0">
|
|
22
|
+
{accordionItems.map((item, i) => (
|
|
23
|
+
<AccordionItem
|
|
24
|
+
key={`AccordionItem${i}`}
|
|
25
|
+
{...item}
|
|
26
|
+
version={version}
|
|
27
|
+
context={context}
|
|
28
|
+
/>
|
|
29
|
+
))}
|
|
30
|
+
</ul>
|
|
31
|
+
) : null}
|
|
32
|
+
</section>
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BlockDef, ColumnsCount } from '../../ui-kit/BlocksList/BlocksListProps';
|
|
2
|
-
|
|
2
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
3
3
|
/**
|
|
4
4
|
* @title Элемент списка
|
|
5
5
|
*/
|
|
@@ -9,6 +9,10 @@ export interface AccordionItemCommonProps {
|
|
|
9
9
|
* @default Список
|
|
10
10
|
*/
|
|
11
11
|
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @title Отображать в раскрытом виде
|
|
14
|
+
*/
|
|
15
|
+
isExpanded?: boolean;
|
|
12
16
|
/** @title Блоки */
|
|
13
17
|
blocks?: BlockDef[];
|
|
14
18
|
/**
|
|
@@ -16,6 +20,8 @@ export interface AccordionItemCommonProps {
|
|
|
16
20
|
* @default false
|
|
17
21
|
*/
|
|
18
22
|
bordered?: boolean; // TODO: только для мобильной версии
|
|
23
|
+
version?: BlockVersion;
|
|
24
|
+
|
|
19
25
|
columns?: ColumnsCount;
|
|
20
26
|
}
|
|
21
27
|
|
|
@@ -25,6 +31,7 @@ export interface AccordionItemCommonProps {
|
|
|
25
31
|
export interface AccordionContent {
|
|
26
32
|
/** @title Заголовок */
|
|
27
33
|
title?: string;
|
|
34
|
+
version?: BlockVersion;
|
|
28
35
|
/** @title Список */
|
|
29
36
|
accordionItems?: AccordionItemCommonProps[];
|
|
30
37
|
/** @title Описание */
|
|
@@ -3,7 +3,7 @@ import type { UniBlockProps } from '../../types';
|
|
|
3
3
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
4
4
|
import type { AccordionItemCommonProps } from './AccordionContent';
|
|
5
5
|
import { AccordionItemInner } from './AccordionItemInner';
|
|
6
|
-
import { useActiveHandler } from './
|
|
6
|
+
import { useActiveHandler } from './useActiveHandler';
|
|
7
7
|
|
|
8
8
|
export interface AccordionItemProps extends AccordionItemCommonProps, UniBlockProps {}
|
|
9
9
|
|
|
@@ -1,37 +1,59 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { BlockVersion } from '../../model/BlockVersion';
|
|
2
3
|
import type { UniBlockProps } from '../../types';
|
|
3
4
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
4
5
|
import type { AccordionItemCommonProps } from './AccordionContent';
|
|
5
6
|
import { AccordionItemInner } from './AccordionItemInner';
|
|
6
|
-
import { useActiveHandler } from './
|
|
7
|
+
import { useActiveHandler } from './useActiveHandler';
|
|
7
8
|
|
|
8
9
|
export interface AccordionItemProps extends AccordionItemCommonProps, UniBlockProps {}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
11
|
+
const buttonStyleMap: Record<BlockVersion, string> = {
|
|
12
|
+
primary: 'text-primary-text',
|
|
13
|
+
secondary: 'text-white',
|
|
14
|
+
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const buttonHoverStyleMap: Record<BlockVersion, string> = {
|
|
17
|
+
primary: 'group-hover:text-primary-main',
|
|
18
|
+
secondary: 'group-hover:text-white',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const AccordionItem = JSX<AccordionItemProps>(
|
|
22
|
+
({ label, isExpanded, blocks, columns, context, version = 'primary' }) => {
|
|
23
|
+
const { isActive, hasContent, icon, handleToggle } = useActiveHandler({
|
|
24
|
+
context,
|
|
25
|
+
blocks,
|
|
26
|
+
initialState: isExpanded,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<li className="border-0 border-b border-solid border-main-divider last:border-b-0">
|
|
31
|
+
<button
|
|
32
|
+
className={`border-none bg-transparent px-0 py-5 flex justify-between text-left w-full font-sans ${
|
|
33
|
+
buttonStyleMap[version]
|
|
34
|
+
}
|
|
20
35
|
${hasContent ? 'group cursor-pointer' : ''}`}
|
|
21
|
-
|
|
22
|
-
>
|
|
23
|
-
<span
|
|
24
|
-
className={`text-xl pr-2.5 font-medium ${
|
|
25
|
-
hasContent ? 'group-hover:text-primary-main' : ''
|
|
26
|
-
}`}
|
|
36
|
+
onClick={handleToggle}
|
|
27
37
|
>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
<span
|
|
39
|
+
className={`text-xl pr-2.5 font-medium ${
|
|
40
|
+
hasContent ? buttonHoverStyleMap[version] : ''
|
|
41
|
+
}`}
|
|
42
|
+
>
|
|
43
|
+
{label}
|
|
44
|
+
</span>
|
|
45
|
+
{hasContent ? <Icon name={icon} width="24" height="24" asSVG /> : null}
|
|
46
|
+
</button>
|
|
47
|
+
{hasContent ? (
|
|
48
|
+
<AccordionItemInner
|
|
49
|
+
isExpanded={isActive}
|
|
50
|
+
columns={columns}
|
|
51
|
+
blocks={blocks}
|
|
52
|
+
version={version}
|
|
53
|
+
context={context}
|
|
54
|
+
/>
|
|
55
|
+
) : null}
|
|
56
|
+
</li>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
@@ -2,12 +2,14 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import type { AccordionItemProps } from './AccordionItem';
|
|
3
3
|
import { renderBlocksList } from '../../ui-kit/BlocksList/renderBlocksList';
|
|
4
4
|
|
|
5
|
-
export const AccordionItemInner = JSX<AccordionItemProps>(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
export const AccordionItemInner = JSX<AccordionItemProps>(
|
|
6
|
+
({ blocks, context, version = 'primary' }) => {
|
|
7
|
+
const className = 'mb-5 last:mb-0 first:mt-2';
|
|
8
|
+
const columns = 1;
|
|
9
|
+
return (
|
|
10
|
+
<div className="transition-all duration-300 max-h-0 overflow-hidden group-last:last:pb-0">
|
|
11
|
+
{renderBlocksList({ context, className, columns, blocks, version })}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
},
|
|
15
|
+
);
|