krl-alfred 2.17.6 → 2.17.8
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/dist/components/Breadcrumbs/Breadcrumbs.styled.d.ts +1 -1
- package/dist/components/ReviewBlock/ReviewBlock.js +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -4
- package/dist/components/Tabs/Tabs.js +31 -63
- package/dist/components/Tabs/Tabs.styled.js +30 -4
- package/dist/components/Tabs/index.d.ts +2 -1
- package/dist/components/Tabs/index.js +15 -0
- package/dist/components/Tabs/props.d.ts +14 -20
- package/dist/components/Tabs/props.js +5 -17
- package/dist/components/Tabs/stories/Tabs.stories.d.ts +14 -11
- package/dist/components/Tabs/stories/Tabs.stories.js +69 -9
- package/dist/components/VideoCard/VideoCard.js +1 -1
- package/package.json +1 -1
- package/dist/components/Tabs/TabContext.d.ts +0 -7
- package/dist/components/Tabs/TabContext.js +0 -13
- package/dist/components/Tabs/TabItem.d.ts +0 -3
- package/dist/components/Tabs/TabItem.js +0 -42
|
@@ -10,6 +10,6 @@ export declare const BreadcrumbsListItemIconWrapper: import("styled-components/d
|
|
|
10
10
|
export declare const BreadcrumbsListItemBackIconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
11
11
|
export declare const BreadcrumbsListDropdownWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
12
|
export declare const BreadcrumbsListDropdownOpener: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
13
|
-
export declare const DropdownList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components
|
|
13
|
+
export declare const DropdownList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
14
14
|
export declare const SubMenuMobileWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
15
15
|
export declare const SubMenuMobileItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, BreadcrumbsStyledProps>> & string;
|
|
@@ -34,7 +34,7 @@ var ReviewBlock = function (_a) {
|
|
|
34
34
|
];
|
|
35
35
|
return ((0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.ReviewCard, { children: [(0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.Header, __assign({ "$hasDropdown": hasDropdown, "$hasApproveButton": hasApproveButton }, { children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.StarsWrapper, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "notFilleds" }, { children: Array.from({ length: maxStars }).map(function (_, i) { return ((0, jsx_runtime_1.jsx)(Icon_1.default, { name: "StarfullSmall", color: "var(--dark-opacity-10)" }, i)); }) })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "filleds", style: { width: "".concat(percentage, "%") } }, { children: Array.from({ length: maxStars }).map(function (_, i) { return ((0, jsx_runtime_1.jsx)(Icon_1.default, { name: "StarfullSmall", color: "var(--yellowDark)" }, i)); }) }))] }), (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.CustomerName, { children: customerName })] }), (0, jsx_runtime_1.jsxs)("div", { children: [hasApproveButton && ((0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.TextLinkWrapper, { children: (0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({ onClick: onApproveButtonClick }, { children: t("POST_COMMENTS") })) })), hasBadge && ((0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.BadgeWrapper, { children: (0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: badgeVariant, title: badgeText }) })), hasDropdown && ((0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.DropdownWrapper, { children: (0, jsx_runtime_1.jsx)(Dropdown_1.default, { size: "small", list: dropdownList, isShowTopChevron: false, Toggle: function () { return (0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.DropdownToggleButton, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "MoreCircle" }), " "] }); }, childrenVariant: "primary", right: "0", width: "145px", top: "calc(100% + 4px)" }) })), (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.Date, { children: date })] })] })), comment && (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.PlatformReview, { children: comment }), productReviews === null || productReviews === void 0 ? void 0 : productReviews.map(function (product, idx) {
|
|
36
36
|
var _a, _b;
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.ProductReviewBlock, { children: [(0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.ProductWrapper, { children: [(0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductImage, { children: product === null || product === void 0 ? void 0 : product.image }), (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductReviewContent, { children: (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductName, { children: product === null || product === void 0 ? void 0 : product.name }) })] }), (product === null || product === void 0 ? void 0 : product.question) && (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductQuestion, { children: product === null || product === void 0 ? void 0 : product.question }), (0, jsx_runtime_1.
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.ProductReviewBlock, { children: [(0, jsx_runtime_1.jsxs)(ReviewBlock_styled_1.ProductWrapper, { children: [(0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductImage, { children: product === null || product === void 0 ? void 0 : product.image }), (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductReviewContent, { children: (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductName, { children: product === null || product === void 0 ? void 0 : product.name }) })] }), (product === null || product === void 0 ? void 0 : product.question) && (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductQuestion, { children: product === null || product === void 0 ? void 0 : product.question }), (0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.ProductAnswer, { children: product === null || product === void 0 ? void 0 : product.answer }), ((_a = product === null || product === void 0 ? void 0 : product.tags) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((0, jsx_runtime_1.jsx)(ReviewBlock_styled_1.Tags, { children: (_b = product === null || product === void 0 ? void 0 : product.tags) === null || _b === void 0 ? void 0 : _b.map(function (tag, i) { return ((0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "secondary", title: tag }, i)); }) }))] }, idx));
|
|
38
38
|
})] }));
|
|
39
39
|
};
|
|
40
40
|
exports.default = ReviewBlock;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { TabsProps } from "./props";
|
|
2
|
-
declare const Tabs: {
|
|
3
|
-
({ activeIndex, children, onActive, hasAutoFlex, isHideTabHeaderOnMobile, size, }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
TabItem: ({ isActive, hasAutoFlex, size, isDisabled, title, children, key, onClick, }: import("./props").TabItem) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
};
|
|
2
|
+
declare const Tabs: ({ tabs, activeTab, defaultTab, size, hasAutoFlex, isHideTabHeaderOnMobile, onChange, }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
3
|
export default Tabs;
|
|
@@ -10,79 +10,47 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
14
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
var react_1 =
|
|
15
|
+
var react_1 = require("react");
|
|
42
16
|
var props_1 = require("./props");
|
|
43
17
|
var Tabs_styled_1 = require("./Tabs.styled");
|
|
44
|
-
var TabContext_1 = require("./TabContext");
|
|
45
|
-
var TabItem_1 = __importDefault(require("./TabItem"));
|
|
46
18
|
var Tabs = function (_a) {
|
|
47
|
-
var _b
|
|
48
|
-
var
|
|
49
|
-
var
|
|
19
|
+
var _b;
|
|
20
|
+
var _c = _a.tabs, tabs = _c === void 0 ? props_1.TabsDefault.tabs : _c, activeTab = _a.activeTab, defaultTab = _a.defaultTab, _d = _a.size, size = _d === void 0 ? props_1.TabsDefault.size : _d, _e = _a.hasAutoFlex, hasAutoFlex = _e === void 0 ? props_1.TabsDefault.hasAutoFlex : _e, _f = _a.isHideTabHeaderOnMobile, isHideTabHeaderOnMobile = _f === void 0 ? props_1.TabsDefault.isHideTabHeaderOnMobile : _f, onChange = _a.onChange;
|
|
21
|
+
var _g = (0, react_1.useState)(function () {
|
|
22
|
+
var _a;
|
|
23
|
+
if (activeTab)
|
|
24
|
+
return activeTab;
|
|
25
|
+
if (defaultTab)
|
|
26
|
+
return defaultTab;
|
|
27
|
+
return ((_a = tabs[0]) === null || _a === void 0 ? void 0 : _a.key) || '';
|
|
28
|
+
}), currentTab = _g[0], setCurrentTab = _g[1];
|
|
29
|
+
var headerRef = (0, react_1.useRef)(null);
|
|
30
|
+
// Sync with controlled activeTab prop
|
|
50
31
|
(0, react_1.useEffect)(function () {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setTabActiveIndex(nextIndex);
|
|
57
|
-
if (handleActive) {
|
|
58
|
-
handleActive(nextIndex);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
return {
|
|
62
|
-
activeIndex: tabActiveIndex,
|
|
63
|
-
setActiveIndex: setTabActiveIndex,
|
|
64
|
-
active: activeIndex === index,
|
|
65
|
-
onActivate: function () { return activateTab(index); },
|
|
66
|
-
setActiveContent: setActiveContent,
|
|
67
|
-
};
|
|
68
|
-
}, [tabActiveIndex, activeIndex]);
|
|
32
|
+
if (activeTab) {
|
|
33
|
+
setCurrentTab(activeTab);
|
|
34
|
+
}
|
|
35
|
+
}, [activeTab]);
|
|
36
|
+
// Handle mobile scroll into view
|
|
69
37
|
(0, react_1.useEffect)(function () {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
var activeItem = (_b = window === null || window === void 0 ? void 0 : window.document) === null || _b === void 0 ? void 0 : _b.querySelector(".customTabItem.isActive");
|
|
74
|
-
// Mobil cihaz kontrolü (768px breakpoint'i)
|
|
38
|
+
if (typeof window !== "undefined") {
|
|
39
|
+
var headerElement = headerRef.current;
|
|
40
|
+
var activeItem = headerElement === null || headerElement === void 0 ? void 0 : headerElement.querySelector("[data-key=\"".concat(currentTab, "\"]"));
|
|
75
41
|
var isMobile = window.innerWidth <= 992;
|
|
76
|
-
if (activeItem &&
|
|
42
|
+
if (activeItem && headerElement && isMobile) {
|
|
77
43
|
activeItem.scrollIntoView({ behavior: 'smooth', inline: 'center', block: 'nearest' });
|
|
78
44
|
}
|
|
79
45
|
}
|
|
80
|
-
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
46
|
+
}, [currentTab]);
|
|
47
|
+
var handleTabChange = function (key) {
|
|
48
|
+
if (onChange) {
|
|
49
|
+
onChange(key);
|
|
50
|
+
}
|
|
51
|
+
setCurrentTab(key);
|
|
52
|
+
};
|
|
53
|
+
var activeTabContent = (_b = tabs.find(function (tab) { return tab.key === currentTab; })) === null || _b === void 0 ? void 0 : _b.content;
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(Tabs_styled_1.TabsStyled, { children: [(0, jsx_runtime_1.jsx)(Tabs_styled_1.TabHeaderStyled, __assign({ ref: headerRef, "$size": size, "$hasAutoFlex": hasAutoFlex, "$isHideTabHeaderOnMobile": isHideTabHeaderOnMobile }, { children: tabs.map(function (tab) { return ((0, jsx_runtime_1.jsx)(Tabs_styled_1.TabItemStyled, __assign({ "data-key": tab.key, "$size": size, "$isActive": currentTab === tab.key, "$isDisabled": tab.isDisabled, "$hasAutoFlex": hasAutoFlex }, { children: (0, jsx_runtime_1.jsx)(Tabs_styled_1.TabItemTitleStyled, __assign({ "$size": size, "$isActive": currentTab === tab.key, "$hasAutoFlex": hasAutoFlex, onClick: function () { return !tab.isDisabled && handleTabChange(tab.key); } }, { children: tab.title })) }), tab.key)); }) })), (0, jsx_runtime_1.jsx)(Tabs_styled_1.TabItemContentStyled, __assign({ "$size": size }, { children: activeTabContent }))] }));
|
|
86
55
|
};
|
|
87
|
-
Tabs.TabItem = TabItem_1.default;
|
|
88
56
|
exports.default = Tabs;
|
|
@@ -10,9 +10,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.TabItemContentStyled = exports.TabItemTitleStyled = exports.TabItemStyled = exports.TabHeaderStyled = exports.TabsStyled = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var devices_1 = require("../../constants/devices");
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var getTabSize = function ($size) {
|
|
14
|
+
switch ($size) {
|
|
15
|
+
case 'lg':
|
|
16
|
+
return {
|
|
17
|
+
columnGap: '1.5rem',
|
|
18
|
+
padding: '0 1.5rem',
|
|
19
|
+
paddingTop: '1.5rem',
|
|
20
|
+
height: '40px'
|
|
21
|
+
};
|
|
22
|
+
case 'sm':
|
|
23
|
+
return {
|
|
24
|
+
columnGap: '1rem',
|
|
25
|
+
padding: '0 1rem',
|
|
26
|
+
paddingTop: '1rem',
|
|
27
|
+
height: '32px'
|
|
28
|
+
};
|
|
29
|
+
case 'md':
|
|
30
|
+
default:
|
|
31
|
+
return {
|
|
32
|
+
columnGap: '1rem',
|
|
33
|
+
padding: '0 1rem',
|
|
34
|
+
paddingTop: '1rem',
|
|
35
|
+
height: '40px'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.TabsStyled = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
40
|
+
exports.TabHeaderStyled = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n column-gap: ", ";\n ", "\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: ", ";\n column-gap: ", ";\n ", "\n ", "\n"])), function (props) { return props.$hasAutoFlex ? "center" : "flex-start"; }, function (props) { return getTabSize(props.$size).columnGap; }, function (props) { return !props.$hasAutoFlex && "\n scroll-snap-type: x proximity;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: none;\n overflow-x: scroll;\n padding: 2rem;\n margin: -2rem;\n @media only screen and (".concat(devices_1.devices.xl, ") {\n padding: 2rem 1rem;\n margin: -2rem -1rem;\n column-gap: ").concat(getTabSize(props.$size).columnGap, ";\n }\n "); }, function (props) { return props.$isHideTabHeaderOnMobile ? "\n @media only screen and (".concat(devices_1.devices.lg, ") {\n display: none;\n }\n ") : ""; });
|
|
15
41
|
exports.TabItemStyled = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex: ", ";\n ", "\n"], ["\n flex: ", ";\n ", "\n"])), function (props) { return props.$hasAutoFlex ? "1 0" : "auto 0"; }, function (props) { return props.$isDisabled ? "\n cursor: no-drop;\n pointer-events: none;\n user-select: none;\n " : ""; });
|
|
16
|
-
exports.TabItemTitleStyled = styled_components_1.default.button(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: transparent;\n color: ", ";\n border: 1px solid ", ";\n width: 100%;\n box-shadow: 0 6px 30px 0 ", ";\n border-radius: 0.5rem;\n transition: all .2s ease;\n padding: ", ";\n height:
|
|
17
|
-
exports.TabItemContentStyled = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-top: ", ";\n @media only screen and ", " {\n padding-top: ", ";\n }\n"], ["\n padding-top: ", ";\n @media only screen and ", " {\n padding-top: ", ";\n }\n"])), function (props) { return props.$size
|
|
42
|
+
exports.TabItemTitleStyled = styled_components_1.default.button(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: transparent;\n color: ", ";\n border: 1px solid ", ";\n width: 100%;\n box-shadow: 0 6px 30px 0 ", ";\n border-radius: 0.5rem;\n transition: all .2s ease;\n padding: ", ";\n height: ", ";\n cursor: pointer;\n font: var(--body-semi-bold-14-17);\n white-space: ", ";\n outline: none !important;\n &:hover {\n color: var(--dark);\n border: 1px solid var(--grey-10);\n box-shadow: 0 6px 30px 0 var(--box-shadow-color);\n }\n"], ["\n background: transparent;\n color: ", ";\n border: 1px solid ", ";\n width: 100%;\n box-shadow: 0 6px 30px 0 ", ";\n border-radius: 0.5rem;\n transition: all .2s ease;\n padding: ", ";\n height: ", ";\n cursor: pointer;\n font: var(--body-semi-bold-14-17);\n white-space: ", ";\n outline: none !important;\n &:hover {\n color: var(--dark);\n border: 1px solid var(--grey-10);\n box-shadow: 0 6px 30px 0 var(--box-shadow-color);\n }\n"])), function (props) { return props.$isActive ? "var(--dark)" : "var(--dark-opacity-75)"; }, function (props) { return props.$isActive ? "var(--grey-10)" : "transparent"; }, function (props) { return props.$isActive ? "var(--box-shadow-color)" : "transparent"; }, function (props) { return props.$hasAutoFlex ? "0" : getTabSize(props.$size).padding; }, function (props) { return getTabSize(props.$size).height; }, function (props) { return props.$hasAutoFlex ? "pre-wrap" : "nowrap"; });
|
|
43
|
+
exports.TabItemContentStyled = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-top: ", ";\n @media only screen and (", ") {\n padding-top: ", ";\n }\n"], ["\n padding-top: ", ";\n @media only screen and (", ") {\n padding-top: ", ";\n }\n"])), function (props) { return getTabSize(props.$size).paddingTop; }, devices_1.devices.lg, function (props) { return getTabSize(props.$size).paddingTop; });
|
|
18
44
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from "./Tabs";
|
|
2
|
+
export * from "./props";
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
18
|
};
|
|
@@ -6,3 +20,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
20
|
exports.default = void 0;
|
|
7
21
|
var Tabs_1 = require("./Tabs");
|
|
8
22
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Tabs_1).default; } });
|
|
23
|
+
__exportStar(require("./props"), exports);
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const sizes:
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export declare const sizes: readonly ["lg", "md", "sm"];
|
|
3
3
|
type SIZES = typeof sizes[number];
|
|
4
|
-
export interface Tabs {
|
|
5
|
-
activeIndex?: number;
|
|
6
|
-
children?: any;
|
|
7
|
-
onActive?(e: any): void;
|
|
8
|
-
hasAutoFlex?: boolean;
|
|
9
|
-
isHideTabHeaderOnMobile?: boolean;
|
|
10
|
-
size: SIZES;
|
|
11
|
-
}
|
|
12
4
|
export interface TabItem {
|
|
13
|
-
|
|
5
|
+
key: string;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
content: ReactNode;
|
|
14
8
|
isDisabled?: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
}
|
|
10
|
+
export interface TabsProps {
|
|
11
|
+
tabs: TabItem[];
|
|
12
|
+
activeTab?: string;
|
|
13
|
+
defaultTab?: string;
|
|
20
14
|
size?: SIZES;
|
|
15
|
+
hasAutoFlex?: boolean;
|
|
16
|
+
isHideTabHeaderOnMobile?: boolean;
|
|
17
|
+
onChange?: (key: string) => void;
|
|
21
18
|
}
|
|
22
19
|
export interface TabStyledProps {
|
|
23
20
|
$hasAutoFlex?: boolean;
|
|
@@ -30,8 +27,5 @@ export interface TabItemStyledProps {
|
|
|
30
27
|
$hasAutoFlex?: boolean;
|
|
31
28
|
$size?: SIZES;
|
|
32
29
|
}
|
|
33
|
-
export declare const TabsDefault:
|
|
34
|
-
export declare const TabItemDefault: TabItem;
|
|
35
|
-
export type TabsProps = typeof TabsDefault;
|
|
36
|
-
export type TabItemProps = typeof TabItemDefault;
|
|
30
|
+
export declare const TabsDefault: TabsProps;
|
|
37
31
|
export {};
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.sizes = ['
|
|
3
|
+
exports.TabsDefault = exports.sizes = void 0;
|
|
4
|
+
exports.sizes = ['lg', 'md', 'sm'];
|
|
5
5
|
exports.TabsDefault = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
hasAutoFlex: true,
|
|
6
|
+
tabs: [],
|
|
7
|
+
size: 'md',
|
|
8
|
+
hasAutoFlex: false,
|
|
10
9
|
isHideTabHeaderOnMobile: false,
|
|
11
|
-
size: "medium"
|
|
12
|
-
};
|
|
13
|
-
exports.TabItemDefault = {
|
|
14
|
-
isActive: false,
|
|
15
|
-
isDisabled: false,
|
|
16
|
-
title: null,
|
|
17
|
-
children: null,
|
|
18
|
-
key: null,
|
|
19
|
-
onClick: null,
|
|
20
|
-
hasAutoFlex: exports.TabsDefault.hasAutoFlex,
|
|
21
|
-
size: exports.TabsDefault.size,
|
|
22
10
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
declare const meta: {
|
|
2
3
|
title: string;
|
|
3
|
-
component: (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export declare const Default: {
|
|
9
|
-
args: {
|
|
10
|
-
activeIndex: number;
|
|
11
|
-
onActive: (e: any) => void;
|
|
12
|
-
hasAutoFlex: boolean;
|
|
4
|
+
component: ({ tabs, activeTab, defaultTab, size, hasAutoFlex, isHideTabHeaderOnMobile, onChange, }: import("..").TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
13
7
|
};
|
|
8
|
+
tags: string[];
|
|
14
9
|
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const Default: Story;
|
|
13
|
+
export declare const WithDefaultTab: Story;
|
|
14
|
+
export declare const WithDisabledTab: Story;
|
|
15
|
+
export declare const WithAutoFlex: Story;
|
|
16
|
+
export declare const SmallSize: Story;
|
|
17
|
+
export declare const LargeSize: Story;
|
|
@@ -14,21 +14,81 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Default = void 0;
|
|
17
|
+
exports.LargeSize = exports.SmallSize = exports.WithAutoFlex = exports.WithDisabledTab = exports.WithDefaultTab = exports.Default = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var Tabs_1 = __importDefault(require("../Tabs"));
|
|
20
|
-
|
|
21
|
-
title:
|
|
22
|
-
component:
|
|
23
|
-
|
|
20
|
+
var meta = {
|
|
21
|
+
title: "Components/Tabs",
|
|
22
|
+
component: Tabs_1.default,
|
|
23
|
+
parameters: {
|
|
24
|
+
layout: "centered",
|
|
24
25
|
},
|
|
25
|
-
tags: [
|
|
26
|
-
|
|
26
|
+
tags: ["autodocs"],
|
|
27
|
+
};
|
|
28
|
+
exports.default = meta;
|
|
29
|
+
var ExampleContent = function (_a) {
|
|
30
|
+
var title = _a.title;
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: { padding: "20px", background: "#f5f5f5", borderRadius: "8px" } }, { children: [title, " Content"] })));
|
|
27
32
|
};
|
|
28
33
|
exports.Default = {
|
|
29
34
|
args: {
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
tabs: [
|
|
36
|
+
{ key: "tab1", title: "Tab 1", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 1" }) },
|
|
37
|
+
{ key: "tab2", title: "Tab 2", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 2" }) },
|
|
38
|
+
{ key: "tab3", title: "Tab 3", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 3" }) },
|
|
39
|
+
],
|
|
40
|
+
size: "md",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
exports.WithDefaultTab = {
|
|
44
|
+
args: {
|
|
45
|
+
tabs: [
|
|
46
|
+
{ key: "tab1", title: "Tab 1", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 1" }) },
|
|
47
|
+
{ key: "tab2", title: "Tab 2", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 2" }) },
|
|
48
|
+
{ key: "tab3", title: "Tab 3", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 3" }) },
|
|
49
|
+
],
|
|
50
|
+
defaultTab: "tab2",
|
|
51
|
+
size: "md",
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
exports.WithDisabledTab = {
|
|
55
|
+
args: {
|
|
56
|
+
tabs: [
|
|
57
|
+
{ key: "tab1", title: "Tab 1", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 1" }) },
|
|
58
|
+
{ key: "tab2", title: "Tab 2", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 2" }), isDisabled: true },
|
|
59
|
+
{ key: "tab3", title: "Tab 3", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 3" }) },
|
|
60
|
+
],
|
|
61
|
+
size: "md",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
exports.WithAutoFlex = {
|
|
65
|
+
args: {
|
|
66
|
+
tabs: [
|
|
67
|
+
{ key: "tab1", title: "Tab 1", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 1" }) },
|
|
68
|
+
{ key: "tab2", title: "Tab 2", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 2" }) },
|
|
69
|
+
{ key: "tab3", title: "Tab 3", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 3" }) },
|
|
70
|
+
],
|
|
32
71
|
hasAutoFlex: true,
|
|
72
|
+
size: "md",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
exports.SmallSize = {
|
|
76
|
+
args: {
|
|
77
|
+
tabs: [
|
|
78
|
+
{ key: "tab1", title: "Tab 1", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 1" }) },
|
|
79
|
+
{ key: "tab2", title: "Tab 2", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 2" }) },
|
|
80
|
+
{ key: "tab3", title: "Tab 3", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 3" }) },
|
|
81
|
+
],
|
|
82
|
+
size: "sm",
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
exports.LargeSize = {
|
|
86
|
+
args: {
|
|
87
|
+
tabs: [
|
|
88
|
+
{ key: "tab1", title: "Tab 1", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 1" }) },
|
|
89
|
+
{ key: "tab2", title: "Tab 2", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 2" }) },
|
|
90
|
+
{ key: "tab3", title: "Tab 3", content: (0, jsx_runtime_1.jsx)(ExampleContent, { title: "Tab 3" }) },
|
|
91
|
+
],
|
|
92
|
+
size: "lg",
|
|
33
93
|
},
|
|
34
94
|
};
|
|
@@ -53,6 +53,6 @@ var VideoControlsComponent = function (_a) {
|
|
|
53
53
|
var VideoCard = function (_a) {
|
|
54
54
|
var _b = _a.poster, poster = _b === void 0 ? props_1.VideoCardDefault.poster : _b, _c = _a.title, title = _c === void 0 ? props_1.VideoCardDefault.title : _c, _d = _a.videoUrl, videoUrl = _d === void 0 ? props_1.VideoCardDefault.videoUrl : _d;
|
|
55
55
|
var _e = (0, useVideoPlayer_1.useVideoPlayer)(), videoRef = _e.videoRef, togglePlay = _e.togglePlay, toggleMute = _e.toggleMute;
|
|
56
|
-
return ((0, jsx_runtime_1.jsxs)(VideoCard_styled_1.VideoCardStyled, { children: [(0, jsx_runtime_1.jsxs)(VideoCard_styled_1.VideoWrapper, { children: [(0, jsx_runtime_1.jsxs)("video", __assign({ ref: videoRef, poster: poster, onClick: togglePlay }, { children: [(0, jsx_runtime_1.jsx)("source", { src: videoUrl, type: "video/mp4" }), "Your browser does not support the video tag."] })), (0, jsx_runtime_1.jsx)(VideoControlsComponent, { videoRef: videoRef, onPlayClick: togglePlay, onMuteClick: toggleMute })] }), (0, jsx_runtime_1.jsx)(VideoCard_styled_1.Title, { children: title })] }));
|
|
56
|
+
return ((0, jsx_runtime_1.jsxs)(VideoCard_styled_1.VideoCardStyled, { children: [(0, jsx_runtime_1.jsxs)(VideoCard_styled_1.VideoWrapper, { children: [(0, jsx_runtime_1.jsxs)("video", __assign({ ref: videoRef, poster: poster, onClick: togglePlay, playsInline: true }, { children: [(0, jsx_runtime_1.jsx)("source", { src: videoUrl, type: "video/mp4" }), "Your browser does not support the video tag."] })), (0, jsx_runtime_1.jsx)(VideoControlsComponent, { videoRef: videoRef, onPlayClick: togglePlay, onMuteClick: toggleMute })] }), (0, jsx_runtime_1.jsx)(VideoCard_styled_1.Title, { children: title })] }));
|
|
57
57
|
};
|
|
58
58
|
exports.default = VideoCard;
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TabsContext = void 0;
|
|
7
|
-
var react_1 = __importDefault(require("react"));
|
|
8
|
-
exports.TabsContext = react_1.default.createContext({
|
|
9
|
-
activeIndex: 0,
|
|
10
|
-
setActiveIndex: function (e) { },
|
|
11
|
-
onActivate: function () { },
|
|
12
|
-
setActiveContent: function (e) { },
|
|
13
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
-
var props_1 = require("./props");
|
|
19
|
-
var react_1 = require("react");
|
|
20
|
-
var TabContext_1 = require("./TabContext");
|
|
21
|
-
var Tabs_styled_1 = require("./Tabs.styled");
|
|
22
|
-
var classnames_1 = __importDefault(require("classnames"));
|
|
23
|
-
var TabItem = function (_a) {
|
|
24
|
-
var _b = _a.isActive, isActive = _b === void 0 ? props_1.TabItemDefault.isActive : _b, _c = _a.hasAutoFlex, hasAutoFlex = _c === void 0 ? props_1.TabsDefault.hasAutoFlex : _c, _d = _a.size, size = _d === void 0 ? props_1.TabsDefault.size : _d, _e = _a.isDisabled, isDisabled = _e === void 0 ? props_1.TabItemDefault.isDisabled : _e, _f = _a.title, title = _f === void 0 ? props_1.TabItemDefault.title : _f, _g = _a.children, children = _g === void 0 ? props_1.TabItemDefault.children : _g, _h = _a.key, key = _h === void 0 ? props_1.TabItemDefault.key : _h, _j = _a.onClick, onClick = _j === void 0 ? props_1.TabItemDefault.onClick : _j;
|
|
25
|
-
var _k = (0, react_1.useContext)(TabContext_1.TabsContext), onActivate = _k.onActivate, setActiveContent = _k.setActiveContent;
|
|
26
|
-
var onClickTab = function (event) {
|
|
27
|
-
if (event) {
|
|
28
|
-
event.preventDefault();
|
|
29
|
-
}
|
|
30
|
-
onActivate();
|
|
31
|
-
setActiveContent(children);
|
|
32
|
-
if (onClick) {
|
|
33
|
-
onClick(event);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
(0, react_1.useEffect)(function () {
|
|
37
|
-
if (isActive)
|
|
38
|
-
setActiveContent(children);
|
|
39
|
-
}, [isActive, children]);
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(Tabs_styled_1.TabItemStyled, __assign({ "$size": size, className: (0, classnames_1.default)("customTabItem", { isActive: isActive }), "$isDisabled": isDisabled, "$hasAutoFlex": hasAutoFlex }, { children: (0, jsx_runtime_1.jsx)(Tabs_styled_1.TabItemTitleStyled, __assign({ "$size": size, "$isActive": isActive, "$hasAutoFlex": hasAutoFlex, onClick: onClickTab }, { children: title })) }), key));
|
|
41
|
-
};
|
|
42
|
-
exports.default = TabItem;
|