bianic-ui 2.10.0-alpha.1 → 2.10.0-alpha.2
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/cjs/index.js +4 -12
- package/dist/cjs/types/components/TabMenu/TabMenu.d.ts +16 -6
- package/dist/cjs/types/stories/TabMenu/TabMenu.stories.d.ts +22 -7
- package/dist/esm/index.js +4 -12
- package/dist/esm/types/components/TabMenu/TabMenu.d.ts +16 -6
- package/dist/esm/types/stories/TabMenu/TabMenu.stories.d.ts +22 -7
- package/dist/index.d.ts +15 -6
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4562,8 +4562,7 @@ var actionButtonConfig = {
|
|
|
4562
4562
|
};
|
|
4563
4563
|
|
|
4564
4564
|
var TabMenu = React.forwardRef(function (props, ref) {
|
|
4565
|
-
var variant = props.variant, rounded = props.rounded, _a = props.text, text = _a === void 0 ? '' : _a, _b = props.isActive, isActive = _b === void 0 ? false : _b, _c = props.moreCount, moreCount = _c === void 0 ?
|
|
4566
|
-
var _e = React.useState(false), isMoreExpand = _e[0], setIsMoreExpand = _e[1];
|
|
4565
|
+
var variant = props.variant, rounded = props.rounded, _a = props.text, text = _a === void 0 ? '' : _a, _b = props.isActive, isActive = _b === void 0 ? false : _b, _c = props.moreCount, moreCount = _c === void 0 ? 0 : _c, onClose = props.onClose, onClick = props.onClick, _d = props.className, className = _d === void 0 ? '' : _d, isMoreExpand = props.isMoreExpand, rest = __rest(props, ["variant", "rounded", "text", "isActive", "moreCount", "onClose", "onClick", "className", "isMoreExpand"]);
|
|
4567
4566
|
var validatedVariant = validUnion(variant, [
|
|
4568
4567
|
'default',
|
|
4569
4568
|
'alternative',
|
|
@@ -4584,18 +4583,10 @@ var TabMenu = React.forwardRef(function (props, ref) {
|
|
|
4584
4583
|
var itemButtonStyles = validatedVariant === 'alternative'
|
|
4585
4584
|
? alternativeButtonConfigs[stateKey]
|
|
4586
4585
|
: defaultButtonConfigs[stateKey];
|
|
4587
|
-
var handleWrapperClick = function (e) {
|
|
4588
|
-
if (isMoreDropdown) {
|
|
4589
|
-
setIsMoreExpand(function (prev) { return !prev; });
|
|
4590
|
-
}
|
|
4591
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
4592
|
-
};
|
|
4586
|
+
var handleWrapperClick = function (e) { return onClick === null || onClick === void 0 ? void 0 : onClick(e); };
|
|
4593
4587
|
var handleKeyDown = function (e) {
|
|
4594
4588
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
4595
4589
|
e.preventDefault();
|
|
4596
|
-
if (isMoreDropdown) {
|
|
4597
|
-
setIsMoreExpand(function (prev) { return !prev; });
|
|
4598
|
-
}
|
|
4599
4590
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
4600
4591
|
}
|
|
4601
4592
|
};
|
|
@@ -4603,8 +4594,9 @@ var TabMenu = React.forwardRef(function (props, ref) {
|
|
|
4603
4594
|
e.stopPropagation();
|
|
4604
4595
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
4605
4596
|
};
|
|
4597
|
+
var moreCountText = moreCount > 0 ? " (".concat(moreCount, ")") : '';
|
|
4606
4598
|
return (React.createElement("div", __assign({ ref: ref, role: "tab", tabIndex: 0, "aria-selected": isActive, "aria-expanded": isMoreDropdown ? isMoreExpand : undefined, className: "tab-menu group/container flex flex-row items-center font-arial text-size-tiny font-normal select-none transition-all outline-none focus-visible:ring-2 focus-visible:ring-primary-black/30 ".concat(isAlternative && !isMoreDropdown ? 'pe-[36px]' : '', " ").concat(radiusConfig[validatedRadius], " ").concat(variantConfig[validatedVariant], " ").concat(baseStyles, " ").concat(className).trim(), onClick: handleWrapperClick, onKeyDown: handleKeyDown }, rest),
|
|
4607
|
-
React.createElement("span", { className: "truncate flex-grow" }, isMoreDropdown ? "More
|
|
4599
|
+
React.createElement("span", { className: "truncate flex-grow" }, isMoreDropdown ? "More".concat(moreCountText) : text),
|
|
4608
4600
|
React.createElement("div", { className: "grid items-center ".concat(itemButtonStyles) }, isMoreDropdown ? (React.createElement("div", { className: "col-start-2 pl-[2px] flex items-center justify-center h-full" }, isMoreExpand ? (React.createElement(TbChevronUp, { className: "rounded-radius-sm ".concat(isActive ? 'text-primary-black' : 'text-primary-white'), size: 14 })) : (React.createElement(TbChevronDown, { className: "rounded-radius-sm ".concat(isActive ? 'text-primary-black' : 'text-primary-white'), size: 14 })))) : (React.createElement("button", { type: "button", className: "col-start-2 group p-0.5 focus:outline-none flex items-center justify-center", onClick: handleCloseClick, "aria-label": "Close ".concat(text) },
|
|
4609
4601
|
React.createElement(TbX, { className: "rounded-radius-sm transition-colors ".concat(actionButtonStyles), size: 14 }))))));
|
|
4610
4602
|
});
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComponentPropsWithoutRef, MouseEvent, KeyboardEvent } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
variant?: TabMenuVariant;
|
|
3
|
+
import type { TabMenuRounded } from './configs';
|
|
4
|
+
interface BaseTabMenuProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onClick'> {
|
|
6
5
|
rounded?: TabMenuRounded;
|
|
7
|
-
|
|
8
|
-
isActive?: Boolean;
|
|
9
|
-
moreCount?: number;
|
|
6
|
+
isActive?: boolean;
|
|
10
7
|
onClose?: () => void;
|
|
11
8
|
onClick?: (e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>) => void;
|
|
12
9
|
}
|
|
10
|
+
interface StandardTabProps extends BaseTabMenuProps {
|
|
11
|
+
variant?: 'default' | 'alternative';
|
|
12
|
+
text: string;
|
|
13
|
+
isMoreExpand?: never;
|
|
14
|
+
moreCount?: never;
|
|
15
|
+
}
|
|
16
|
+
interface MoreDropdownTabProps extends BaseTabMenuProps {
|
|
17
|
+
variant: 'alternative-more';
|
|
18
|
+
text?: never;
|
|
19
|
+
isMoreExpand?: boolean;
|
|
20
|
+
moreCount?: number;
|
|
21
|
+
}
|
|
22
|
+
export type TabMenuProps = StandardTabProps | MoreDropdownTabProps;
|
|
13
23
|
declare const TabMenu: React.ForwardRefExoticComponent<TabMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
24
|
export default TabMenu;
|
|
@@ -11,23 +11,38 @@ declare const meta: {
|
|
|
11
11
|
control: "select";
|
|
12
12
|
options: string[];
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
control: "
|
|
16
|
-
|
|
14
|
+
text: {
|
|
15
|
+
control: "text";
|
|
16
|
+
if: {
|
|
17
|
+
arg: string;
|
|
18
|
+
neq: string;
|
|
19
|
+
};
|
|
17
20
|
};
|
|
18
|
-
|
|
21
|
+
isMoreExpand: {
|
|
19
22
|
control: "boolean";
|
|
23
|
+
if: {
|
|
24
|
+
arg: string;
|
|
25
|
+
eq: string;
|
|
26
|
+
};
|
|
20
27
|
};
|
|
21
28
|
moreCount: {
|
|
22
29
|
control: "number";
|
|
30
|
+
if: {
|
|
31
|
+
arg: string;
|
|
32
|
+
eq: string;
|
|
33
|
+
};
|
|
23
34
|
};
|
|
24
|
-
|
|
25
|
-
control: "
|
|
35
|
+
rounded: {
|
|
36
|
+
control: "select";
|
|
37
|
+
options: string[];
|
|
38
|
+
};
|
|
39
|
+
isActive: {
|
|
40
|
+
control: "boolean";
|
|
26
41
|
};
|
|
27
42
|
};
|
|
28
43
|
args: {
|
|
29
44
|
text: string;
|
|
30
|
-
isActive:
|
|
45
|
+
isActive: false;
|
|
31
46
|
variant: "default";
|
|
32
47
|
rounded: "top";
|
|
33
48
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -4560,8 +4560,7 @@ var actionButtonConfig = {
|
|
|
4560
4560
|
};
|
|
4561
4561
|
|
|
4562
4562
|
var TabMenu = forwardRef(function (props, ref) {
|
|
4563
|
-
var variant = props.variant, rounded = props.rounded, _a = props.text, text = _a === void 0 ? '' : _a, _b = props.isActive, isActive = _b === void 0 ? false : _b, _c = props.moreCount, moreCount = _c === void 0 ?
|
|
4564
|
-
var _e = useState(false), isMoreExpand = _e[0], setIsMoreExpand = _e[1];
|
|
4563
|
+
var variant = props.variant, rounded = props.rounded, _a = props.text, text = _a === void 0 ? '' : _a, _b = props.isActive, isActive = _b === void 0 ? false : _b, _c = props.moreCount, moreCount = _c === void 0 ? 0 : _c, onClose = props.onClose, onClick = props.onClick, _d = props.className, className = _d === void 0 ? '' : _d, isMoreExpand = props.isMoreExpand, rest = __rest(props, ["variant", "rounded", "text", "isActive", "moreCount", "onClose", "onClick", "className", "isMoreExpand"]);
|
|
4565
4564
|
var validatedVariant = validUnion(variant, [
|
|
4566
4565
|
'default',
|
|
4567
4566
|
'alternative',
|
|
@@ -4582,18 +4581,10 @@ var TabMenu = forwardRef(function (props, ref) {
|
|
|
4582
4581
|
var itemButtonStyles = validatedVariant === 'alternative'
|
|
4583
4582
|
? alternativeButtonConfigs[stateKey]
|
|
4584
4583
|
: defaultButtonConfigs[stateKey];
|
|
4585
|
-
var handleWrapperClick = function (e) {
|
|
4586
|
-
if (isMoreDropdown) {
|
|
4587
|
-
setIsMoreExpand(function (prev) { return !prev; });
|
|
4588
|
-
}
|
|
4589
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
4590
|
-
};
|
|
4584
|
+
var handleWrapperClick = function (e) { return onClick === null || onClick === void 0 ? void 0 : onClick(e); };
|
|
4591
4585
|
var handleKeyDown = function (e) {
|
|
4592
4586
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
4593
4587
|
e.preventDefault();
|
|
4594
|
-
if (isMoreDropdown) {
|
|
4595
|
-
setIsMoreExpand(function (prev) { return !prev; });
|
|
4596
|
-
}
|
|
4597
4588
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
4598
4589
|
}
|
|
4599
4590
|
};
|
|
@@ -4601,8 +4592,9 @@ var TabMenu = forwardRef(function (props, ref) {
|
|
|
4601
4592
|
e.stopPropagation();
|
|
4602
4593
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
4603
4594
|
};
|
|
4595
|
+
var moreCountText = moreCount > 0 ? " (".concat(moreCount, ")") : '';
|
|
4604
4596
|
return (React.createElement("div", __assign({ ref: ref, role: "tab", tabIndex: 0, "aria-selected": isActive, "aria-expanded": isMoreDropdown ? isMoreExpand : undefined, className: "tab-menu group/container flex flex-row items-center font-arial text-size-tiny font-normal select-none transition-all outline-none focus-visible:ring-2 focus-visible:ring-primary-black/30 ".concat(isAlternative && !isMoreDropdown ? 'pe-[36px]' : '', " ").concat(radiusConfig[validatedRadius], " ").concat(variantConfig[validatedVariant], " ").concat(baseStyles, " ").concat(className).trim(), onClick: handleWrapperClick, onKeyDown: handleKeyDown }, rest),
|
|
4605
|
-
React.createElement("span", { className: "truncate flex-grow" }, isMoreDropdown ? "More
|
|
4597
|
+
React.createElement("span", { className: "truncate flex-grow" }, isMoreDropdown ? "More".concat(moreCountText) : text),
|
|
4606
4598
|
React.createElement("div", { className: "grid items-center ".concat(itemButtonStyles) }, isMoreDropdown ? (React.createElement("div", { className: "col-start-2 pl-[2px] flex items-center justify-center h-full" }, isMoreExpand ? (React.createElement(TbChevronUp, { className: "rounded-radius-sm ".concat(isActive ? 'text-primary-black' : 'text-primary-white'), size: 14 })) : (React.createElement(TbChevronDown, { className: "rounded-radius-sm ".concat(isActive ? 'text-primary-black' : 'text-primary-white'), size: 14 })))) : (React.createElement("button", { type: "button", className: "col-start-2 group p-0.5 focus:outline-none flex items-center justify-center", onClick: handleCloseClick, "aria-label": "Close ".concat(text) },
|
|
4607
4599
|
React.createElement(TbX, { className: "rounded-radius-sm transition-colors ".concat(actionButtonStyles), size: 14 }))))));
|
|
4608
4600
|
});
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComponentPropsWithoutRef, MouseEvent, KeyboardEvent } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
variant?: TabMenuVariant;
|
|
3
|
+
import type { TabMenuRounded } from './configs';
|
|
4
|
+
interface BaseTabMenuProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onClick'> {
|
|
6
5
|
rounded?: TabMenuRounded;
|
|
7
|
-
|
|
8
|
-
isActive?: Boolean;
|
|
9
|
-
moreCount?: number;
|
|
6
|
+
isActive?: boolean;
|
|
10
7
|
onClose?: () => void;
|
|
11
8
|
onClick?: (e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>) => void;
|
|
12
9
|
}
|
|
10
|
+
interface StandardTabProps extends BaseTabMenuProps {
|
|
11
|
+
variant?: 'default' | 'alternative';
|
|
12
|
+
text: string;
|
|
13
|
+
isMoreExpand?: never;
|
|
14
|
+
moreCount?: never;
|
|
15
|
+
}
|
|
16
|
+
interface MoreDropdownTabProps extends BaseTabMenuProps {
|
|
17
|
+
variant: 'alternative-more';
|
|
18
|
+
text?: never;
|
|
19
|
+
isMoreExpand?: boolean;
|
|
20
|
+
moreCount?: number;
|
|
21
|
+
}
|
|
22
|
+
export type TabMenuProps = StandardTabProps | MoreDropdownTabProps;
|
|
13
23
|
declare const TabMenu: React.ForwardRefExoticComponent<TabMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
24
|
export default TabMenu;
|
|
@@ -11,23 +11,38 @@ declare const meta: {
|
|
|
11
11
|
control: "select";
|
|
12
12
|
options: string[];
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
control: "
|
|
16
|
-
|
|
14
|
+
text: {
|
|
15
|
+
control: "text";
|
|
16
|
+
if: {
|
|
17
|
+
arg: string;
|
|
18
|
+
neq: string;
|
|
19
|
+
};
|
|
17
20
|
};
|
|
18
|
-
|
|
21
|
+
isMoreExpand: {
|
|
19
22
|
control: "boolean";
|
|
23
|
+
if: {
|
|
24
|
+
arg: string;
|
|
25
|
+
eq: string;
|
|
26
|
+
};
|
|
20
27
|
};
|
|
21
28
|
moreCount: {
|
|
22
29
|
control: "number";
|
|
30
|
+
if: {
|
|
31
|
+
arg: string;
|
|
32
|
+
eq: string;
|
|
33
|
+
};
|
|
23
34
|
};
|
|
24
|
-
|
|
25
|
-
control: "
|
|
35
|
+
rounded: {
|
|
36
|
+
control: "select";
|
|
37
|
+
options: string[];
|
|
38
|
+
};
|
|
39
|
+
isActive: {
|
|
40
|
+
control: "boolean";
|
|
26
41
|
};
|
|
27
42
|
};
|
|
28
43
|
args: {
|
|
29
44
|
text: string;
|
|
30
|
-
isActive:
|
|
45
|
+
isActive: false;
|
|
31
46
|
variant: "default";
|
|
32
47
|
rounded: "top";
|
|
33
48
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -728,18 +728,27 @@ interface TabProps extends ComponentPropsWithoutRef<'button'> {
|
|
|
728
728
|
}
|
|
729
729
|
declare function Tab({ children, active, icon, disabled, mode, fit, size, className, ...rest }: TabProps): React$1.JSX.Element;
|
|
730
730
|
|
|
731
|
-
type TabMenuVariant = 'default' | 'alternative' | 'alternative-more';
|
|
732
731
|
type TabMenuRounded = 'none' | 'all' | 'top' | 'right' | 'left';
|
|
733
732
|
|
|
734
|
-
interface
|
|
735
|
-
variant?: TabMenuVariant;
|
|
733
|
+
interface BaseTabMenuProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onClick'> {
|
|
736
734
|
rounded?: TabMenuRounded;
|
|
737
|
-
|
|
738
|
-
isActive?: Boolean;
|
|
739
|
-
moreCount?: number;
|
|
735
|
+
isActive?: boolean;
|
|
740
736
|
onClose?: () => void;
|
|
741
737
|
onClick?: (e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>) => void;
|
|
742
738
|
}
|
|
739
|
+
interface StandardTabProps extends BaseTabMenuProps {
|
|
740
|
+
variant?: 'default' | 'alternative';
|
|
741
|
+
text: string;
|
|
742
|
+
isMoreExpand?: never;
|
|
743
|
+
moreCount?: never;
|
|
744
|
+
}
|
|
745
|
+
interface MoreDropdownTabProps extends BaseTabMenuProps {
|
|
746
|
+
variant: 'alternative-more';
|
|
747
|
+
text?: never;
|
|
748
|
+
isMoreExpand?: boolean;
|
|
749
|
+
moreCount?: number;
|
|
750
|
+
}
|
|
751
|
+
type TabMenuProps = StandardTabProps | MoreDropdownTabProps;
|
|
743
752
|
declare const TabMenu: React$1.ForwardRefExoticComponent<TabMenuProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
744
753
|
|
|
745
754
|
interface TableCellProps extends ComponentPropsWithoutRef<'td'> {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"@biaenergi:registry": "https://gitlab.com/api/v4/projects/50905269/packages/npm/"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.10.0-alpha.
|
|
6
|
+
"version": "2.10.0-alpha.2",
|
|
7
7
|
"description": "Design Language System develop by BIAENERGI",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|