@homecode/ui 4.22.9 → 4.22.10
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.
|
@@ -171,9 +171,9 @@ class Gallery extends Component {
|
|
|
171
171
|
props.onPointerLeave = this.onPointerUp;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
return (jsxs("div", { className: classes, ...props, children: [jsx("div", { className: innerClasses, ref: this.innerRef, children: items.map((src, i) => (jsx(Item, { src: src, size: size, isLoaded: loading[src], isError: errors[src], onLoad: () => (loading[src] = true), onError: () => (errors[src] = true) }, `${i}_${src}`))) }), !isSingle && showArrows && !isDragging && (jsxs(Fragment, { children: [jsx(Arr, { className: S.left, size: size, icon: "chevronLeft", onClick: () => this.move(1) }), jsx(Arr, { className: S.right, size: size, icon: "chevronRight", onClick: () => this.move(-1) })] })), showDots && (jsx(Lazy, { hideSpinner: true,
|
|
174
|
+
return (jsxs("div", { className: classes, ...props, children: [jsx("div", { className: innerClasses, ref: this.innerRef, children: items.map((src, i) => (jsx(Item, { src: src, size: size, isLoaded: loading[src], isError: errors[src], onLoad: () => (loading[src] = true), onError: () => (errors[src] = true) }, `${i}_${src}`))) }), !isSingle && showArrows && !isDragging && (jsxs(Fragment, { children: [jsx(Arr, { className: S.left, size: size, icon: "chevronLeft", onClick: () => this.move(1) }), jsx(Arr, { className: S.right, size: size, icon: "chevronRight", onClick: () => this.move(-1) })] })), showDots && (jsx(Lazy, { hideSpinner: true, loader: () => import('./Dots/Dots.js'),
|
|
175
175
|
// @ts-ignore
|
|
176
|
-
|
|
176
|
+
index: this.index % items.length, count: items.length }))] }));
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -8,7 +8,7 @@ import S from './Tabs.styl.js';
|
|
|
8
8
|
|
|
9
9
|
const isId = id => ['string', 'number'].includes(typeof id);
|
|
10
10
|
function Tabs(props) {
|
|
11
|
-
const { size = 'm', className, contentClassName, items, hideTabsIfSingle = false, allowEmpty = false, onChange, renderAll, activeId: initialId, children, ...rest } = props;
|
|
11
|
+
const { size = 'm', className, tabsWrapperClassName, tabsClassName, contentClassName, items, hideTabsIfSingle = false, allowEmpty = false, onChange, renderAll, activeId: initialId, children, ...rest } = props;
|
|
12
12
|
const [activeId, setActiveId] = useState(isId(initialId) ? initialId : allowEmpty ? null : items[0].id);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
if (isId(initialId)) {
|
|
@@ -18,7 +18,7 @@ function Tabs(props) {
|
|
|
18
18
|
const onTabClick = useCallback((e, { id, onClick } = {}) => {
|
|
19
19
|
// @ts-ignore
|
|
20
20
|
if (onClick && !onClick(e)) {
|
|
21
|
-
e.
|
|
21
|
+
e.preventDefault();
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
const newId = allowEmpty && id === activeId ? null : id;
|
|
@@ -35,7 +35,7 @@ function Tabs(props) {
|
|
|
35
35
|
}
|
|
36
36
|
return (createElement(Button, { ...rest, className: cn(S.tab, rest.className), size: size, key: id, onClick: e => onTabClick(e, params), checked: isActive }, label));
|
|
37
37
|
});
|
|
38
|
-
const tabs = tabsButtons.length === 1 && hideTabsIfSingle ? null : (jsx(Scroll, { x: true, offset: { x: { before: 10, after: 10 } }, innerClassName: cn(S.tabsScroll, S[`size-${size}`]), autoHide: true, fadeSize: size, size: size, children: jsx(ButtonGroup, { className:
|
|
38
|
+
const tabs = tabsButtons.length === 1 && hideTabsIfSingle ? null : (jsx(Scroll, { x: true, offset: { x: { before: 10, after: 10 } }, className: tabsWrapperClassName, innerClassName: cn(S.tabsScroll, S[`size-${size}`]), autoHide: true, fadeSize: size, size: size, children: jsx(ButtonGroup, { className: tabsClassName, ...rest, children: tabsButtons }) }));
|
|
39
39
|
if (typeof children === 'function') {
|
|
40
40
|
return children({
|
|
41
41
|
tabs,
|