@hazelcast/ui 1.3.2-next.7 → 1.3.2-next.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/lib/Tabs/Tab.d.ts +17 -4
- package/lib/Tabs/Tab.js +15 -4
- package/lib/Tabs/Tab.js.map +1 -1
- package/package.json +2 -2
package/lib/Tabs/Tab.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, MouseEvent, KeyboardEvent } from 'react';
|
|
1
|
+
import { FC, MouseEvent, KeyboardEvent, ReactNode } from 'react';
|
|
2
2
|
import { IconProps } from '../Icon';
|
|
3
3
|
export declare type AnchorTabProps = {
|
|
4
4
|
component: 'a';
|
|
@@ -9,19 +9,32 @@ export declare type ButtonTabProps = {
|
|
|
9
9
|
href?: never;
|
|
10
10
|
};
|
|
11
11
|
declare type TabTypeProps = AnchorTabProps | ButtonTabProps;
|
|
12
|
-
declare type
|
|
12
|
+
declare type TabLabelProps = {
|
|
13
|
+
/** @deprecated The property should not be used */
|
|
14
|
+
label: string;
|
|
13
15
|
icon: IconProps['icon'];
|
|
14
16
|
iconAriaLabel: string;
|
|
17
|
+
children?: never;
|
|
18
|
+
ariaLabel?: never;
|
|
19
|
+
} | {
|
|
20
|
+
/** @deprecated The property should not be used */
|
|
21
|
+
label: string;
|
|
22
|
+
icon?: never;
|
|
23
|
+
iconAriaLabel?: never;
|
|
24
|
+
children?: never;
|
|
25
|
+
ariaLabel?: never;
|
|
15
26
|
} | {
|
|
27
|
+
label?: never;
|
|
16
28
|
icon?: never;
|
|
17
29
|
iconAriaLabel?: never;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
ariaLabel: string;
|
|
18
32
|
};
|
|
19
33
|
export declare type TabCommonProps = {
|
|
20
|
-
label: string;
|
|
21
34
|
value: number;
|
|
22
35
|
onClick?: (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement> | KeyboardEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
23
36
|
};
|
|
24
|
-
export declare type TabProps<T = TabTypeProps> = TabCommonProps & T &
|
|
37
|
+
export declare type TabProps<T = TabTypeProps> = TabCommonProps & T & TabLabelProps;
|
|
25
38
|
/**
|
|
26
39
|
* ### Purpose
|
|
27
40
|
* A single tab implementation that works together with TabContext and TabList components.
|
package/lib/Tabs/Tab.js
CHANGED
|
@@ -15,7 +15,16 @@ import styles from './Tab.module.scss';
|
|
|
15
15
|
* More info - https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
|
-
export const Tab = ({ component: Component = 'button',
|
|
18
|
+
export const Tab = ({ component: Component = 'button',
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated The property should not be used
|
|
21
|
+
*/
|
|
22
|
+
label, value, href, onClick,
|
|
23
|
+
/** @deprecated The property should not be used */
|
|
24
|
+
icon,
|
|
25
|
+
/** @deprecated The property should not be used */
|
|
26
|
+
iconAriaLabel, children, ariaLabel, }) => {
|
|
27
|
+
var _a;
|
|
19
28
|
const { onChange, value: activeValue, idPrefix, fullWidth } = useTabContext();
|
|
20
29
|
const selected = value === activeValue;
|
|
21
30
|
const handleClick = useCallback((event) => {
|
|
@@ -35,8 +44,10 @@ export const Tab = ({ component: Component = 'button', label, value, href, onCli
|
|
|
35
44
|
handleClick(event);
|
|
36
45
|
}
|
|
37
46
|
}, [handleClick]);
|
|
38
|
-
return (React.createElement(Component, { className: cn(styles.tab, { [styles.selected]: selected, [styles.fullWidth]: fullWidth }), role: "tab", id: getTabId(idPrefix, value.toString()), "aria-controls": getPanelId(idPrefix, value.toString()), "aria-selected": selected, tabIndex: selected ? 0 : -1, onKeyPress: onKeyPress, onClick: handleClick, href:
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
return (React.createElement(Component, { className: cn(styles.tab, { [styles.selected]: selected, [styles.fullWidth]: fullWidth }), role: "tab", id: getTabId(idPrefix, value.toString()), "aria-controls": getPanelId(idPrefix, value.toString()), "aria-selected": selected, tabIndex: selected ? 0 : -1, onKeyPress: onKeyPress, onClick: handleClick, ...(Component === 'a' && selected && href), "aria-label": label !== null && label !== void 0 ? label : ariaLabel }, children
|
|
48
|
+
? children
|
|
49
|
+
: (_a = (icon && iconAriaLabel && (React.createElement("span", null,
|
|
50
|
+
React.createElement(Icon, { icon: icon, ariaLabel: iconAriaLabel, className: styles.icon }),
|
|
51
|
+
label)))) !== null && _a !== void 0 ? _a : label));
|
|
41
52
|
};
|
|
42
53
|
//# sourceMappingURL=Tab.js.map
|
package/lib/Tabs/Tab.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../src/Tabs/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../src/Tabs/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,WAAW,EAAwC,MAAM,OAAO,CAAA;AACpF,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAa,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AA6CtC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,GAAG,GAAiB,CAAC,EAChC,SAAS,EAAE,SAAS,GAAG,QAAQ;AAC/B;;GAEG;AACH,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO;AACP,kDAAkD;AAClD,IAAI;AACJ,kDAAkD;AAClD,aAAa,EACb,QAAQ,EACR,SAAS,GACV,EAAE,EAAE;;IACH,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,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K,aAAL,KAAK,cAAL,KAAK,GAAI,SAAS,IAE7B,QAAQ;QACP,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,MAAA,CAAC,IAAI,IAAI,aAAa,IAAI,CACxB;YACE,oBAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,GAAI;YACrE,KAAK,CACD,CACR,CAAC,mCACF,KAAK,CACC,CACb,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hazelcast/ui",
|
|
3
|
-
"version": "1.3.2-next.
|
|
3
|
+
"version": "1.3.2-next.8+fd39e22",
|
|
4
4
|
"description": "Hazelcast design system components",
|
|
5
5
|
"author": "",
|
|
6
6
|
"homepage": "https://github.com/hazelcast/frontend-shared#readme",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"webpack": "^5.65.0",
|
|
114
114
|
"yup": "^0.32.11"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "fd39e222091b5cf1c90fb8bab1f2fa994543a4cb"
|
|
117
117
|
}
|