pds-dev-kit-web 2.2.284 → 2.2.285
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.
|
@@ -10,8 +10,10 @@ type MobileTabBarProps = {
|
|
|
10
10
|
/** @description styleTheme이 'main'일 때만 colorTheme이 존재합니다. */
|
|
11
11
|
colorTheme?: MobileTabBarColorThemeType;
|
|
12
12
|
styleTheme?: 'main' | 'content';
|
|
13
|
+
/** @description 활성화 된 탭으로 자동 스크롤 되는 기능을 사용할지 여부입니다. 기본값: none */
|
|
14
|
+
autoScrollMode?: 'use' | 'none';
|
|
13
15
|
/** @deprecated v1.5 해당 필드 대신 itemArray를 사용하세요. */
|
|
14
16
|
textArray?: TextObj[];
|
|
15
17
|
};
|
|
16
|
-
declare function MobileTabBar({ itemArray, colorTheme, styleTheme, textArray }: MobileTabBarProps): JSX.Element;
|
|
18
|
+
declare function MobileTabBar({ itemArray, colorTheme, styleTheme, autoScrollMode, textArray }: MobileTabBarProps): JSX.Element;
|
|
17
19
|
export default MobileTabBar;
|
|
@@ -19,6 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
22
|
+
var react_1 = require("react");
|
|
22
23
|
var react_router_dom_1 = require("react-router-dom");
|
|
23
24
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
24
25
|
var TextLabel_1 = require("../TextLabel");
|
|
@@ -39,9 +40,19 @@ var mobileTabBarThemes = {
|
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
function MobileTabBar(_a) {
|
|
42
|
-
var itemArray = _a.itemArray, _b = _a.colorTheme, colorTheme = _b === void 0 ? 'none' : _b, _c = _a.styleTheme, styleTheme = _c === void 0 ? 'main' : _c, textArray = _a.textArray;
|
|
43
|
+
var itemArray = _a.itemArray, _b = _a.colorTheme, colorTheme = _b === void 0 ? 'none' : _b, _c = _a.styleTheme, styleTheme = _c === void 0 ? 'main' : _c, _d = _a.autoScrollMode, autoScrollMode = _d === void 0 ? 'none' : _d, textArray = _a.textArray;
|
|
43
44
|
var history = (0, react_router_dom_1.useHistory)();
|
|
44
45
|
var pathname = (0, react_router_dom_1.useLocation)().pathname;
|
|
46
|
+
var currentTabRef = (0, react_1.useRef)(null);
|
|
47
|
+
(0, react_1.useEffect)(function () {
|
|
48
|
+
var _a;
|
|
49
|
+
if (autoScrollMode === 'none')
|
|
50
|
+
return;
|
|
51
|
+
var anyActive = itemArray === null || itemArray === void 0 ? void 0 : itemArray.find(function (item) { return item.isActive; });
|
|
52
|
+
if (currentTabRef && anyActive) {
|
|
53
|
+
(_a = currentTabRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ inline: 'center' });
|
|
54
|
+
}
|
|
55
|
+
}, [itemArray]);
|
|
45
56
|
if (itemArray) {
|
|
46
57
|
var hasScroll_1 = styleTheme === 'content' ? true : itemArray.length > 3;
|
|
47
58
|
var handleClickTabItem_1 = function (item, e) {
|
|
@@ -49,7 +60,7 @@ function MobileTabBar(_a) {
|
|
|
49
60
|
item.onClick(e);
|
|
50
61
|
}
|
|
51
62
|
};
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(S_TabBarContainer, __assign({ styleTheme: styleTheme }, { children: (0, jsx_runtime_1.jsx)(S_TabBar, __assign({ "x-pds-name": "MobileTabBar", "x-pds-element-type": "component", "x-pds-device-type": "mobile", styleTheme: styleTheme, hasScroll: hasScroll_1 }, { children: itemArray.map(function (item, index) { return ((0, jsx_runtime_1.jsxs)(S_TabWrapper, __assign({ hasScroll: hasScroll_1, styleTheme: styleTheme, colorTheme: colorTheme, isActive: item.isActive, onClick: function (e) { return handleClickTabItem_1(item, e); } }, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: item.title, textAlign: "center", styleTheme: styleTheme === 'main' ? 'body2Bold' : 'caption1Bold', wordBreak: hasScroll_1 ? 'keep_all' : 'normal', colorTheme: styleTheme === 'content'
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(S_TabBarContainer, __assign({ styleTheme: styleTheme }, { children: (0, jsx_runtime_1.jsx)(S_TabBar, __assign({ "x-pds-name": "MobileTabBar", "x-pds-element-type": "component", "x-pds-device-type": "mobile", styleTheme: styleTheme, hasScroll: hasScroll_1 }, { children: itemArray.map(function (item, index) { return ((0, jsx_runtime_1.jsxs)(S_TabWrapper, __assign({ ref: item.isActive ? currentTabRef : null, hasScroll: hasScroll_1, styleTheme: styleTheme, colorTheme: colorTheme, isActive: item.isActive, onClick: function (e) { return handleClickTabItem_1(item, e); } }, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: item.title, textAlign: "center", styleTheme: styleTheme === 'main' ? 'body2Bold' : 'caption1Bold', wordBreak: hasScroll_1 ? 'keep_all' : 'normal', colorTheme: styleTheme === 'content'
|
|
53
64
|
? item.isActive
|
|
54
65
|
? mobileTabBarThemes.content.activeTextColor
|
|
55
66
|
: mobileTabBarThemes.content.inActiveTextColor
|
package/package.json
CHANGED