@redneckz/wildless-cms-uni-blocks 0.2.77 → 0.2.81
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 +5 -82
- package/bundle/bundle.umd.js +35 -0
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/ProjectSettings.d.ts +1 -0
- package/dist/ProjectSettings.js.map +1 -1
- package/dist/components/Accordion/Accordion.d.ts +5 -0
- package/dist/components/Accordion/Accordion.js +10 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/AccordionBlocks.d.ts +4 -0
- package/dist/components/Accordion/AccordionBlocks.js +7 -0
- package/dist/components/Accordion/AccordionBlocks.js.map +1 -0
- package/dist/components/Accordion/AccordionContent.d.ts +14 -0
- package/dist/components/Accordion/AccordionContent.js +2 -0
- package/dist/components/Accordion/AccordionContent.js.map +1 -0
- package/dist/components/Accordion/AccordionItem.d.ts +5 -0
- package/dist/components/Accordion/AccordionItem.js +35 -0
- package/dist/components/Accordion/AccordionItem.js.map +1 -0
- package/dist/components/Blocks.d.ts +1 -0
- package/dist/components/Blocks.js +2 -0
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/CreditCalculator/CreditCalculator.d.ts +2 -1
- package/dist/components/CreditCalculator/CreditCalculator.js +39 -15
- package/dist/components/CreditCalculator/CreditCalculator.js.map +1 -1
- package/dist/components/CreditCalculator/CreditCalculatorContent.d.ts +15 -0
- package/dist/components/CreditCalculator/CreditCalculatorContent.js +2 -0
- package/dist/components/CreditCalculator/CreditCalculatorContent.js.map +1 -0
- package/dist/components/CreditCalculator/constants.d.ts +7 -0
- package/dist/components/CreditCalculator/constants.js +10 -0
- package/dist/components/CreditCalculator/constants.js.map +1 -0
- package/dist/components/CreditCalculator/getCalculatorParams.d.ts +7 -0
- package/dist/components/CreditCalculator/getCalculatorParams.js +11 -0
- package/dist/components/CreditCalculator/getCalculatorParams.js.map +1 -0
- package/dist/components/CreditCalculator/getCreditRate.d.ts +7 -0
- package/dist/components/CreditCalculator/getCreditRate.js +13 -0
- package/dist/components/CreditCalculator/getCreditRate.js.map +1 -0
- package/dist/components/CreditCalculator/getCreditTermYears.d.ts +1 -0
- package/dist/components/CreditCalculator/getCreditTermYears.js +15 -0
- package/dist/components/CreditCalculator/getCreditTermYears.js.map +1 -0
- package/dist/components/CreditCalculator/getMonthlyPayment.d.ts +11 -0
- package/dist/components/CreditCalculator/getMonthlyPayment.js +19 -0
- package/dist/components/CreditCalculator/getMonthlyPayment.js.map +1 -0
- package/dist/content-page-repository/ContentPageRepository.d.ts +3 -0
- package/dist/content-page-repository/ContentPageRepository.js +14 -0
- package/dist/content-page-repository/ContentPageRepository.js.map +1 -1
- package/dist/hooks/useCreditCalculatorData.d.ts +3 -0
- package/dist/hooks/useCreditCalculatorData.js +15 -0
- package/dist/hooks/useCreditCalculatorData.js.map +1 -0
- package/dist/ui-kit/Icon/IconProps.d.ts +4 -1
- package/dist/ui-kit/Icon/IconProps.js +3 -0
- package/dist/ui-kit/Icon/IconProps.js.map +1 -1
- package/dist/ui-kit/InputRange/InputRange.js +3 -2
- package/dist/ui-kit/InputRange/InputRange.js.map +1 -1
- package/dist/utils/addSpacesBetweenNumbers.d.ts +1 -0
- package/dist/utils/addSpacesBetweenNumbers.js +5 -0
- package/dist/utils/addSpacesBetweenNumbers.js.map +1 -0
- package/lib/ProjectSettings.d.ts +1 -0
- package/lib/ProjectSettings.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Accordion/Accordion.d.ts +5 -0
- package/lib/components/Accordion/Accordion.fixture.d.ts +4 -0
- package/lib/components/Accordion/Accordion.js +8 -0
- package/lib/components/Accordion/Accordion.js.map +1 -0
- package/lib/components/Accordion/AccordionBlocks.d.ts +4 -0
- package/lib/components/Accordion/AccordionBlocks.js +6 -0
- package/lib/components/Accordion/AccordionBlocks.js.map +1 -0
- package/lib/components/Accordion/AccordionContent.d.ts +14 -0
- package/lib/components/Accordion/AccordionContent.js +2 -0
- package/lib/components/Accordion/AccordionContent.js.map +1 -0
- package/lib/components/Accordion/AccordionItem.d.ts +5 -0
- package/lib/components/Accordion/AccordionItem.js +30 -0
- package/lib/components/Accordion/AccordionItem.js.map +1 -0
- package/lib/components/BenefitsBlock/BenefitsBlock.fixture.d.ts +2 -0
- package/lib/components/Blocks.d.ts +1 -0
- package/lib/components/Blocks.js +2 -0
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/ComparisonTable/ComparisonTable.fixture.d.ts +8 -0
- package/lib/components/ContentPage/ContentPage.fixture.d.ts +6 -0
- package/lib/components/CreditCalculator/CreditCalculator.d.ts +2 -1
- package/lib/components/CreditCalculator/CreditCalculator.fixture.d.ts +2 -0
- package/lib/components/CreditCalculator/CreditCalculator.js +39 -15
- package/lib/components/CreditCalculator/CreditCalculator.js.map +1 -1
- package/lib/components/CreditCalculator/CreditCalculatorContent.d.ts +15 -0
- package/lib/components/CreditCalculator/CreditCalculatorContent.js +2 -0
- package/lib/components/CreditCalculator/CreditCalculatorContent.js.map +1 -0
- package/lib/components/CreditCalculator/constants.d.ts +7 -0
- package/lib/components/CreditCalculator/constants.js +8 -0
- package/lib/components/CreditCalculator/constants.js.map +1 -0
- package/lib/components/CreditCalculator/getCalculatorParams.d.ts +7 -0
- package/lib/components/CreditCalculator/getCalculatorParams.js +8 -0
- package/lib/components/CreditCalculator/getCalculatorParams.js.map +1 -0
- package/lib/components/CreditCalculator/getCreditRate.d.ts +7 -0
- package/lib/components/CreditCalculator/getCreditRate.js +10 -0
- package/lib/components/CreditCalculator/getCreditRate.js.map +1 -0
- package/lib/components/CreditCalculator/getCreditTermYears.d.ts +1 -0
- package/lib/components/CreditCalculator/getCreditTermYears.js +12 -0
- package/lib/components/CreditCalculator/getCreditTermYears.js.map +1 -0
- package/lib/components/CreditCalculator/getMonthlyPayment.d.ts +11 -0
- package/lib/components/CreditCalculator/getMonthlyPayment.js +16 -0
- package/lib/components/CreditCalculator/getMonthlyPayment.js.map +1 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.fixture.d.ts +4 -0
- package/lib/components/Footer/Footer.fixture.d.ts +2 -0
- package/lib/components/Gallery/Gallery.fixture.d.ts +9 -0
- package/lib/components/Header/Header.fixture.d.ts +2 -0
- package/lib/components/LikeControl/LikeControl.fixture.d.ts +2 -0
- package/lib/components/MiniGallery/MiniGallery.fixture.d.ts +5 -0
- package/lib/components/MobileAppTile/MobileAppTile.fixture.d.ts +4 -0
- package/lib/components/Placeholder/Placeholder.fixture.d.ts +2 -0
- package/lib/components/ProductBlock/ProductBlock.fixture.d.ts +5 -0
- package/lib/components/ProductGallery/ProductGallery.fixture.d.ts +2 -0
- package/lib/components/ProductTile/ProductTile.fixture.d.ts +7 -0
- package/lib/components/PromoTile/PromoTile.fixture.d.ts +4 -0
- package/lib/components/StepsBlock/StepsBlock.fixture.d.ts +2 -0
- package/lib/components/TextBlock/TextBlock.fixture.d.ts +2 -0
- package/lib/components/Tile/Tile.fixture.d.ts +8 -0
- package/lib/content-page-repository/ContentPageRepository.d.ts +3 -0
- package/lib/content-page-repository/ContentPageRepository.js +14 -0
- package/lib/content-page-repository/ContentPageRepository.js.map +1 -1
- package/lib/cosmos.decorator.d.ts +4 -0
- package/lib/hooks/useCreditCalculatorData.d.ts +3 -0
- package/lib/hooks/useCreditCalculatorData.js +12 -0
- package/lib/hooks/useCreditCalculatorData.js.map +1 -0
- package/lib/setup-fixture.d.ts +3 -0
- package/lib/ui-kit/BlockItem/BlockItem.fixture.d.ts +3 -0
- package/lib/ui-kit/Button/Button.fixture.d.ts +13 -0
- package/lib/ui-kit/Button/LikeButton.fixture.d.ts +5 -0
- package/lib/ui-kit/HeaderItem/HeaderItem.fixture.d.ts +6 -0
- package/lib/ui-kit/Icon/Icon.fixture.d.ts +5 -0
- package/lib/ui-kit/Icon/IconProps.d.ts +4 -1
- package/lib/ui-kit/Icon/IconProps.js +3 -0
- package/lib/ui-kit/Icon/IconProps.js.map +1 -1
- package/lib/ui-kit/InputRange/InputRange.js +3 -2
- package/lib/ui-kit/InputRange/InputRange.js.map +1 -1
- package/lib/ui-kit/Logo/Logo.fixture.d.ts +3 -0
- package/lib/ui-kit/TopItem/TopItem.fixture.d.ts +6 -0
- package/lib/utils/addSpacesBetweenNumbers.d.ts +1 -0
- package/lib/utils/addSpacesBetweenNumbers.js +2 -0
- package/lib/utils/addSpacesBetweenNumbers.js.map +1 -0
- package/package.json +5 -4
- package/src/ProjectSettings.ts +1 -0
- package/src/components/Accordion/Accordion.fixture.tsx +62 -0
- package/src/components/Accordion/Accordion.tsx +22 -0
- package/src/components/Accordion/AccordionBlocks.tsx +7 -0
- package/src/components/Accordion/AccordionContent.ts +18 -0
- package/src/components/Accordion/AccordionItem.tsx +68 -0
- package/src/components/Blocks.ts +2 -0
- package/src/components/ContentPage/ContentPage.page.json +78 -0
- package/src/components/CreditCalculator/CreditCalculator.fixture.tsx +1 -1
- package/src/components/CreditCalculator/CreditCalculator.tsx +134 -85
- package/src/components/CreditCalculator/CreditCalculatorContent.ts +17 -0
- package/src/components/CreditCalculator/constants.ts +8 -0
- package/src/components/CreditCalculator/getCalculatorParams.ts +16 -0
- package/src/components/CreditCalculator/getCreditRate.ts +18 -0
- package/src/components/CreditCalculator/getCreditTermYears.spec.ts +10 -0
- package/src/components/CreditCalculator/getCreditTermYears.ts +15 -0
- package/src/components/CreditCalculator/getMonthlyPayment.ts +32 -0
- package/src/content-page-repository/ContentPageRepository.ts +17 -0
- package/src/hooks/useCreditCalculatorData.ts +23 -0
- package/src/icons/DocIcon.svg +5 -0
- package/src/icons/MinusIcon.svg +1 -0
- package/src/icons/PlusIcon.svg +1 -0
- package/src/ui-kit/Icon/IconProps.ts +3 -0
- package/src/ui-kit/InputRange/InputRange.tsx +3 -2
- package/src/utils/addSpacesBetweenNumbers.ts +2 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '../../setup-fixture';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
all: any;
|
|
4
|
+
'primary (Private clients)': any;
|
|
5
|
+
'secondary (Private clients)': any;
|
|
6
|
+
'primary (Business clients)': any;
|
|
7
|
+
'secondary (Business clients)': any;
|
|
8
|
+
'primary (Ecosystem own)': any;
|
|
9
|
+
'secondary (Ecosystem own)': any;
|
|
10
|
+
'primary (disabled)': any;
|
|
11
|
+
'secondary (disabled)': any;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -18,7 +18,10 @@ export declare enum IconMap {
|
|
|
18
18
|
'SignDocsIcon' = 16,
|
|
19
19
|
'TelegramIcon' = 17,
|
|
20
20
|
'VKIcon' = 18,
|
|
21
|
-
'GlassIcon' = 19
|
|
21
|
+
'GlassIcon' = 19,
|
|
22
|
+
'DocIcon' = 20,
|
|
23
|
+
'PlusIcon' = 21,
|
|
24
|
+
'MinusIcon' = 22
|
|
22
25
|
}
|
|
23
26
|
export declare type IconName = keyof typeof IconMap;
|
|
24
27
|
export interface IconProps {
|
|
@@ -20,5 +20,8 @@ export var IconMap;
|
|
|
20
20
|
IconMap[IconMap["TelegramIcon"] = 17] = "TelegramIcon";
|
|
21
21
|
IconMap[IconMap["VKIcon"] = 18] = "VKIcon";
|
|
22
22
|
IconMap[IconMap["GlassIcon"] = 19] = "GlassIcon";
|
|
23
|
+
IconMap[IconMap["DocIcon"] = 20] = "DocIcon";
|
|
24
|
+
IconMap[IconMap["PlusIcon"] = 21] = "PlusIcon";
|
|
25
|
+
IconMap[IconMap["MinusIcon"] = 22] = "MinusIcon";
|
|
23
26
|
})(IconMap || (IconMap = {}));
|
|
24
27
|
//# sourceMappingURL=IconProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconProps.js","sourceRoot":"","sources":["../../../src/ui-kit/Icon/IconProps.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"IconProps.js","sourceRoot":"","sources":["../../../src/ui-kit/Icon/IconProps.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,OAwBX;AAxBD,WAAY,OAAO;IACjB,+DAAmB,CAAA;IACnB,+CAAW,CAAA;IACX,qDAAc,CAAA;IACd,+CAAW,CAAA;IACX,mEAAqB,CAAA;IACrB,iDAAY,CAAA;IACZ,2DAAiB,CAAA;IACjB,6CAAU,CAAA;IACV,6CAAU,CAAA;IACV,+CAAW,CAAA;IACX,kDAAY,CAAA;IACZ,0CAAQ,CAAA;IACR,sDAAc,CAAA;IACd,sEAAsB,CAAA;IACtB,0DAAgB,CAAA;IAChB,oDAAa,CAAA;IACb,sDAAc,CAAA;IACd,sDAAc,CAAA;IACd,0CAAQ,CAAA;IACR,gDAAW,CAAA;IACX,4CAAS,CAAA;IACT,8CAAU,CAAA;IACV,gDAAW,CAAA;AACb,CAAC,EAxBW,OAAO,KAAP,OAAO,QAwBlB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
2
|
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers.js';
|
|
3
4
|
export const InputRange = JSX(({ className, title, items = [], min = 1, max = 100, step = 1, value = min, onChange }) => {
|
|
4
5
|
const handleChange = (value) => {
|
|
5
6
|
if (!onChange)
|
|
@@ -8,7 +9,7 @@ export const InputRange = JSX(({ className, title, items = [], min = 1, max = 10
|
|
|
8
9
|
onChange(sanitizedValue);
|
|
9
10
|
};
|
|
10
11
|
const inputStyle = {
|
|
11
|
-
backgroundSize: `${(value * 100) / max -
|
|
12
|
+
backgroundSize: `${(((value - min) * 100) / (max - min)).toFixed(2)}% 100%`,
|
|
12
13
|
};
|
|
13
14
|
const handleBlur = () => {
|
|
14
15
|
if (!onChange)
|
|
@@ -18,6 +19,6 @@ export const InputRange = JSX(({ className, title, items = [], min = 1, max = 10
|
|
|
18
19
|
if (value > max)
|
|
19
20
|
onChange(max);
|
|
20
21
|
};
|
|
21
|
-
return (_jsxs("div", { className: className, children: [_jsxs("div", { className: "relative", children: [title ? (_jsx("span", { className: "absolute text-xs text-secondary-text top-1 mt-0.5 pl-4 ml-0.5", children: title })) : null, _jsx("input", { className: `m-0 font-sans text-sm w-full h-12 border-2 border-solid border-main-divider rounded-md outline-none p-0 pl-4 m-0 box-border text-primary-text ${title ? 'pt-4' : ''}`, value:
|
|
22
|
+
return (_jsxs("div", { className: className, children: [_jsxs("div", { className: "relative", children: [title ? (_jsx("span", { className: "absolute text-xs text-secondary-text top-1 mt-0.5 pl-4 ml-0.5", children: title })) : null, _jsx("input", { className: `m-0 font-sans text-sm w-full h-12 border-2 border-solid border-main-divider rounded-md outline-none p-0 pl-4 m-0 box-border text-primary-text ${title ? 'pt-4' : ''}`, value: addSpacesBetweenNumbers(value), onChange: (e) => handleChange(e.target.value), onBlur: handleBlur }), _jsx("div", { className: "absolute inset-x-0 mt-0.5 top-8 px-4", children: _jsx("input", { className: "box-border w-full m-0 cursor-pointer slider", type: "range", min: min, max: max, step: step, value: value, onChange: (e) => handleChange(e.target.value), style: inputStyle }) })] }), _jsx("div", { className: "flex justify-between mt-3 mb-4", children: items.map((item, i) => (_jsx("span", { className: "text-xs text-secondary-text pl-4", children: item }, String(i)))) })] }));
|
|
22
23
|
});
|
|
23
24
|
//# sourceMappingURL=InputRange.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputRange.js","sourceRoot":"","sources":["../../../src/ui-kit/InputRange/InputRange.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"InputRange.js","sourceRoot":"","sources":["../../../src/ui-kit/InputRange/InputRange.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAC3B,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxF,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE;QACrC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACxD,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG;QACjB,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;KAC5E,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,IAAI,KAAK,GAAG,GAAG;YAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,GAAG;YAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,aACvB,eAAK,SAAS,EAAC,UAAU,aACtB,KAAK,CAAC,CAAC,CAAC,CACP,eAAM,SAAS,EAAC,+DAA+D,YAC5E,KAAK,GACD,CACR,CAAC,CAAC,CAAC,IAAI,EACR,gBACE,SAAS,EAAE,iJACT,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EACnB,EAAE,EACF,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC,EACrC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC7C,MAAM,EAAE,UAAU,GAClB,EACF,cAAK,SAAS,EAAC,sCAAsC,YACnD,gBACE,SAAS,EAAC,6CAA6C,EACvD,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC7C,KAAK,EAAE,UAAU,GACjB,GACE,IACF,EACN,cAAK,SAAS,EAAC,gCAAgC,YAC5C,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACtB,eAAsB,SAAS,EAAC,kCAAkC,YAC/D,IAAI,IADI,MAAM,CAAC,CAAC,CAAC,CAEb,CACR,CAAC,GACE,IACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const addSpacesBetweenNumbers: (number: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addSpacesBetweenNumbers.js","sourceRoot":"","sources":["../../src/utils/addSpacesBetweenNumbers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAE,EAAE,CACxD,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,wBAAwB,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redneckz/wildless-cms-uni-blocks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.81",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
"scripts": {
|
|
80
80
|
"start": "npm run cosmos",
|
|
81
81
|
"build": "npm run build:lib && npm run build:commonjs && npm run bundle && npm run build:style && npm run build:icons",
|
|
82
|
-
"postbuild": "npm run size",
|
|
82
|
+
"postbuild": "npm run size && npm run cosmos:export && copyfiles --up 1 \"./docs/**/*\" ./build",
|
|
83
83
|
"build:lib": "rimraf ./lib && tsc --build --verbose",
|
|
84
84
|
"postbuild:lib": "replace-in-file --configFile=replace-config.lib.cjs --verbose",
|
|
85
85
|
"build:commonjs": "rimraf ./dist && tsc --module commonjs --noImplicitUseStrict --outDir dist",
|
|
86
86
|
"bundle": "rimraf ./bundle && rollup -c && npm run build:schema",
|
|
87
|
-
"build:schema": "ts-json-schema-generator --path
|
|
88
|
-
"build:style": "postcss
|
|
87
|
+
"build:schema": "ts-json-schema-generator --path ./src/**/*Content.ts --no-type-check -o ./bundle/blocks.schema.json",
|
|
88
|
+
"build:style": "postcss ./src/**/*.css --env production --dir ./lib",
|
|
89
89
|
"build:icons": "svgo -f ./src/icons -o ./cosmos-static/icons",
|
|
90
90
|
"size": "size-limit",
|
|
91
91
|
"test": "jest --coverage",
|
|
@@ -121,6 +121,7 @@
|
|
|
121
121
|
"@size-limit/file": "^7.0.8",
|
|
122
122
|
"@types/jest": "^28.1.1",
|
|
123
123
|
"autoprefixer": "^10.4.7",
|
|
124
|
+
"copyfiles": "^2.4.1",
|
|
124
125
|
"css-loader": "^6.7.1",
|
|
125
126
|
"cssnano": "^5.1.11",
|
|
126
127
|
"html-webpack-plugin": "^5.5.0",
|
package/src/ProjectSettings.ts
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { context } from '../../setup-fixture';
|
|
2
|
+
import type { AccordionProps } from './Accordion';
|
|
3
|
+
import type { TextBlockContent } from '../TextBlock/TextBlockContent';
|
|
4
|
+
import { Accordion } from './Accordion';
|
|
5
|
+
|
|
6
|
+
const TEXT_BLOCK: TextBlockContent = {
|
|
7
|
+
title: 'Title',
|
|
8
|
+
description:
|
|
9
|
+
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?',
|
|
10
|
+
blockVersion: 'secondary-light',
|
|
11
|
+
iconVersion: 'small',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const propsTextBlock: AccordionProps = {
|
|
15
|
+
title: 'Accordion title',
|
|
16
|
+
context,
|
|
17
|
+
accordionItems: [
|
|
18
|
+
{
|
|
19
|
+
label: 'Accordion label 1',
|
|
20
|
+
blocks: [
|
|
21
|
+
{
|
|
22
|
+
type: 'TextBlock',
|
|
23
|
+
data: TEXT_BLOCK,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'TextBlock',
|
|
27
|
+
data: TEXT_BLOCK,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Accordion label 2',
|
|
33
|
+
blocks: [
|
|
34
|
+
{
|
|
35
|
+
type: 'TextBlock',
|
|
36
|
+
data: TEXT_BLOCK,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'TextBlock',
|
|
40
|
+
data: TEXT_BLOCK,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: 'Accordion label 3',
|
|
46
|
+
blocks: [
|
|
47
|
+
{
|
|
48
|
+
type: 'TextBlock',
|
|
49
|
+
data: TEXT_BLOCK,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'TextBlock',
|
|
53
|
+
data: TEXT_BLOCK,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
'with text block': <Accordion {...propsTextBlock} />,
|
|
62
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { UniBlockProps } from '../../types';
|
|
3
|
+
import type { AccordionContent } from './AccordionContent';
|
|
4
|
+
import { AccordionItem } from './AccordionItem';
|
|
5
|
+
import { Title } from '../../ui-kit/Title/Title';
|
|
6
|
+
|
|
7
|
+
export interface AccordionProps extends AccordionContent, UniBlockProps {}
|
|
8
|
+
|
|
9
|
+
export const Accordion = JSX<AccordionProps>(({ title, accordionItems, context, className }) => {
|
|
10
|
+
return (
|
|
11
|
+
<section className={`p-[50px] font-sans bg-white text-primary-text ${className || ''}`}>
|
|
12
|
+
{title ? <Title className="m-0 mb-2.5">{title}</Title> : null}
|
|
13
|
+
{accordionItems?.length ? (
|
|
14
|
+
<ul className="list-none m-0 p-0">
|
|
15
|
+
{accordionItems.map((item, i) => (
|
|
16
|
+
<AccordionItem key={`AccordionItem${i}`} {...item} context={context} />
|
|
17
|
+
))}
|
|
18
|
+
</ul>
|
|
19
|
+
) : null}
|
|
20
|
+
</section>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TextBlockContent } from '../TextBlock/TextBlockContent';
|
|
2
|
+
|
|
3
|
+
export interface AccordionContent {
|
|
4
|
+
title?: string;
|
|
5
|
+
accordionItems?: AccordionItemContent[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AccordionItemContent {
|
|
9
|
+
label?: string;
|
|
10
|
+
blocks?: AccordionBlockContent[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AccordionBlockContent = {
|
|
14
|
+
type?: string;
|
|
15
|
+
data?: AccordionDataContent;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type AccordionDataContent = TextBlockContent;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { UniBlockProps } from '../../types';
|
|
3
|
+
import type { AccordionItemContent, AccordionBlockContent } from './AccordionContent';
|
|
4
|
+
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
5
|
+
import AccordionBlocks from './AccordionBlocks';
|
|
6
|
+
|
|
7
|
+
export interface AccordionItemProps extends AccordionItemContent, UniBlockProps {}
|
|
8
|
+
|
|
9
|
+
export const AccordionItem = JSX<AccordionItemProps>(({ label, blocks, context }) => {
|
|
10
|
+
const [isActive, setIsActive] = context.useState(false);
|
|
11
|
+
const hasContent = blocks?.length;
|
|
12
|
+
const icon = isActive ? 'MinusIcon' : 'PlusIcon';
|
|
13
|
+
|
|
14
|
+
const handleToggle = (e) => {
|
|
15
|
+
if (!hasContent) return null;
|
|
16
|
+
setIsActive(!isActive);
|
|
17
|
+
const contentBlock = getContentBlock(e);
|
|
18
|
+
contentBlock.style.maxHeight = contentBlock.style.maxHeight
|
|
19
|
+
? null
|
|
20
|
+
: `${contentBlock.scrollHeight}px`;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<li className="border-0 border-b border-solid border-main-divider last:border-b-0">
|
|
25
|
+
<button
|
|
26
|
+
className={`border-none bg-transparent px-0 py-5 flex justify-between text-left w-full font-sans text-primary-text
|
|
27
|
+
${hasContent ? 'group cursor-pointer' : ''}`}
|
|
28
|
+
onClick={handleToggle}
|
|
29
|
+
>
|
|
30
|
+
<span
|
|
31
|
+
className={`m-0 text-xl pr-2.5 font-medium ${
|
|
32
|
+
hasContent ? 'group-hover:text-primary-main' : ''
|
|
33
|
+
}`}
|
|
34
|
+
>
|
|
35
|
+
{label}
|
|
36
|
+
</span>
|
|
37
|
+
{hasContent ? <Icon name={icon} width="24" height="24" /> : null}
|
|
38
|
+
</button>
|
|
39
|
+
{hasContent ? (
|
|
40
|
+
<div
|
|
41
|
+
className={`${
|
|
42
|
+
isActive ? 'pb-5' : ''
|
|
43
|
+
} text-sm transition-all duration-300 max-h-0 overflow-hidden group-last:last:pb-0 `}
|
|
44
|
+
>
|
|
45
|
+
{blocks?.length ? blocks.map(renderComponent) : null}
|
|
46
|
+
</div>
|
|
47
|
+
) : null}
|
|
48
|
+
</li>
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// TODO: draft, for dynamic rendering of components
|
|
53
|
+
|
|
54
|
+
const renderComponent = (block: AccordionBlockContent, i: number) => {
|
|
55
|
+
if (block.type && block.data && !AccordionBlocks.hasOwnProperty(block.type)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const AccordionBlock = block.type && AccordionBlocks[block.type];
|
|
60
|
+
return (
|
|
61
|
+
<div className="mb-5 last:mb-0" key={`component${i}`}>
|
|
62
|
+
<AccordionBlock {...block.data} />
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const getContentBlock = (e) =>
|
|
68
|
+
e.target.tagName === 'BUTTON' ? e.target.nextSibling : e.target.parentNode.nextSibling;
|
package/src/components/Blocks.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { StepsBlock } from './StepsBlock/StepsBlock';
|
|
|
14
14
|
import { TextBlock } from './TextBlock/TextBlock';
|
|
15
15
|
import { Tile } from './Tile/Tile';
|
|
16
16
|
import { ComparisonTable } from './ComparisonTable/ComparisonTable';
|
|
17
|
+
import { Accordion } from './Accordion/Accordion';
|
|
17
18
|
|
|
18
19
|
export const Blocks = {
|
|
19
20
|
Header,
|
|
@@ -32,4 +33,5 @@ export const Blocks = {
|
|
|
32
33
|
Gallery,
|
|
33
34
|
MiniGallery,
|
|
34
35
|
ComparisonTable,
|
|
36
|
+
Accordion,
|
|
35
37
|
};
|
|
@@ -1282,6 +1282,84 @@
|
|
|
1282
1282
|
]
|
|
1283
1283
|
}
|
|
1284
1284
|
},
|
|
1285
|
+
{
|
|
1286
|
+
"type": "Accordion",
|
|
1287
|
+
"style": ["col-span-12"],
|
|
1288
|
+
"content": {
|
|
1289
|
+
"title": "Accordion title",
|
|
1290
|
+
"accordionItems": [
|
|
1291
|
+
{
|
|
1292
|
+
"label": "Accordion label 1",
|
|
1293
|
+
"blocks": [
|
|
1294
|
+
{
|
|
1295
|
+
"type": "TextBlock",
|
|
1296
|
+
"data": {
|
|
1297
|
+
"title": "Title",
|
|
1298
|
+
"description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
|
|
1299
|
+
"blockVersion": "secondary-light",
|
|
1300
|
+
"iconVersion": "small"
|
|
1301
|
+
}
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
"type": "TextBlock",
|
|
1305
|
+
"data": {
|
|
1306
|
+
"title": "Title",
|
|
1307
|
+
"description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
|
|
1308
|
+
"blockVersion": "secondary-light",
|
|
1309
|
+
"iconVersion": "small"
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
]
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
"label": "Accordion label 2",
|
|
1316
|
+
"blocks": [
|
|
1317
|
+
{
|
|
1318
|
+
"type": "TextBlock",
|
|
1319
|
+
"data": {
|
|
1320
|
+
"title": "Title",
|
|
1321
|
+
"description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
|
|
1322
|
+
"blockVersion": "secondary-light",
|
|
1323
|
+
"iconVersion": "small"
|
|
1324
|
+
}
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
"type": "TextBlock",
|
|
1328
|
+
"data": {
|
|
1329
|
+
"title": "Title",
|
|
1330
|
+
"description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
|
|
1331
|
+
"blockVersion": "secondary-light",
|
|
1332
|
+
"iconVersion": "small"
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
]
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
"label": "Accordion label 3",
|
|
1339
|
+
"blocks": [
|
|
1340
|
+
{
|
|
1341
|
+
"type": "TextBlock",
|
|
1342
|
+
"data": {
|
|
1343
|
+
"title": "Title",
|
|
1344
|
+
"description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
|
|
1345
|
+
"blockVersion": "secondary-light",
|
|
1346
|
+
"iconVersion": "small"
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
"type": "TextBlock",
|
|
1351
|
+
"data": {
|
|
1352
|
+
"title": "Title",
|
|
1353
|
+
"description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
|
|
1354
|
+
"blockVersion": "secondary-light",
|
|
1355
|
+
"iconVersion": "small"
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
]
|
|
1359
|
+
}
|
|
1360
|
+
]
|
|
1361
|
+
}
|
|
1362
|
+
},
|
|
1285
1363
|
{
|
|
1286
1364
|
"type": "Footer",
|
|
1287
1365
|
"style": ["col-span-12"],
|