bianic-ui 2.9.0 → 2.10.0-alpha.0

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.
@@ -1,6 +1,7 @@
1
1
  declare const config: {
2
- 'dark-background': string;
3
- 'light-background': string;
4
- 'outline-light-background': string;
2
+ readonly 'dark-background': "bg-white enabled:hover:bg-bia-grey-light-90 outline-none focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 enabled:active:bg-bia-grey-light-80";
3
+ readonly 'light-background': "bg-bia-grey-light-90 enabled:hover:bg-bia-grey-light-80 outline-none focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 enabled:active:bg-bia-grey-light-70";
4
+ readonly 'outline-light-background': "bg-white border border-bia-grey-light-40 enabled:hover:bg-bia-grey-light-90 outline-none focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 enabled:active:bg-bia-grey-light-80";
5
5
  };
6
+ export type CardVariant = keyof typeof config;
6
7
  export default config;
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import config from './config';
3
- declare const Card: ({ children, disabled, variant, }: {
1
+ import React, { ComponentPropsWithoutRef } from 'react';
2
+ import { CardVariant } from './config';
3
+ export interface CardProps extends ComponentPropsWithoutRef<'button'> {
4
4
  children: React.ReactNode;
5
- disabled?: boolean | undefined;
6
- variant?: "dark-background" | "light-background" | "outline-light-background" | undefined;
7
- }) => React.JSX.Element;
5
+ variant?: CardVariant;
6
+ }
7
+ declare const Card: ({ children, disabled, variant, className, type, ...rest }: CardProps) => React.JSX.Element;
8
8
  export default Card;
@@ -1,10 +1,14 @@
1
- import React, { ComponentPropsWithoutRef } from 'react';
1
+ import React from 'react';
2
+ import type { ComponentPropsWithoutRef, MouseEvent } from 'react';
3
+ import type { TabMenuVariant, TabMenuRounded } from './configs';
2
4
  export interface TabMenuProps extends ComponentPropsWithoutRef<'div'> {
3
- variant?: 'default' | 'alternative';
4
- rounded?: 'none' | 'all' | 'top' | 'right' | 'left';
5
+ variant?: TabMenuVariant;
6
+ rounded?: TabMenuRounded;
5
7
  text?: string;
6
- onClose?: () => void;
7
8
  isActive?: boolean;
9
+ moreCount?: number;
10
+ onClose?: () => void;
11
+ onClickMore?: (e: MouseEvent<HTMLButtonElement>) => void;
8
12
  }
9
- declare const TabMenu: ({ variant, text, rounded, isActive, onClose, ...rest }: TabMenuProps) => React.JSX.Element;
13
+ declare const TabMenu: React.ForwardRefExoticComponent<TabMenuProps & React.RefAttributes<HTMLDivElement>>;
10
14
  export default TabMenu;
@@ -1,31 +1,10 @@
1
- export declare const radiusConfig: {
2
- none: string;
3
- all: string;
4
- top: string;
5
- right: string;
6
- left: string;
7
- };
8
- export declare const variantConfig: {
9
- default: string;
10
- alternative: string;
11
- };
12
- export declare const defaultConfigs: {
13
- true: string;
14
- false: string;
15
- };
16
- export declare const defaultButtonConfigs: {
17
- true: string;
18
- false: string;
19
- };
20
- export declare const alternativeConfigs: {
21
- true: string;
22
- false: string;
23
- };
24
- export declare const alternativeButtonConfigs: {
25
- true: string;
26
- false: string;
27
- };
28
- export declare const actionButtonConfig: {
29
- true: string;
30
- false: string;
31
- };
1
+ export type ComponentStateKey = 'active' | 'inactive';
2
+ export type TabMenuVariant = 'default' | 'alternative' | 'alternative-more';
3
+ export type TabMenuRounded = 'none' | 'all' | 'top' | 'right' | 'left';
4
+ export declare const radiusConfig: Record<TabMenuRounded, string>;
5
+ export declare const variantConfig: Record<TabMenuVariant, string>;
6
+ export declare const defaultConfigs: Record<ComponentStateKey, string>;
7
+ export declare const alternativeConfigs: Record<ComponentStateKey, string>;
8
+ export declare const defaultButtonConfigs: Record<ComponentStateKey, string>;
9
+ export declare const alternativeButtonConfigs: Record<ComponentStateKey, string>;
10
+ export declare const actionButtonConfig: Record<ComponentStateKey, string>;
@@ -2,11 +2,7 @@
2
2
  import type { StoryObj } from '@storybook/react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ children, disabled, variant, }: {
6
- children: import("react").ReactNode;
7
- disabled?: boolean | undefined;
8
- variant?: "dark-background" | "light-background" | "outline-light-background" | undefined;
9
- }) => import("react").JSX.Element;
5
+ component: ({ children, disabled, variant, className, type, ...rest }: import("../../components/Card").CardProps) => import("react").JSX.Element;
10
6
  parameters: {
11
7
  layout: string;
12
8
  };
@@ -2,7 +2,7 @@
2
2
  import type { StoryObj } from '@storybook/react/*';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ variant, text, rounded, isActive, onClose, ...rest }: import("../../components/TabMenu/TabMenu").TabMenuProps) => import("react").JSX.Element;
5
+ component: import("react").ForwardRefExoticComponent<import("../../components/TabMenu/TabMenu").TabMenuProps & import("react").RefAttributes<HTMLDivElement>>;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
package/dist/esm/index.js CHANGED
@@ -1574,24 +1574,19 @@ var ContextualButton = forwardRef(function (_a, ref) {
1574
1574
  });
1575
1575
 
1576
1576
  var config$2 = {
1577
- 'dark-background': 'bg-white hover:bg-bia-grey-light-90 outline-none focus:outline-2 focus:outline-bia-blue-light-50 focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 active:bg-bia-grey-light-80',
1578
- 'light-background': 'bg-bia-grey-light-90 hover:bg-bia-grey-light-80 outline-none focus:outline-2 focus:outline-bia-blue-light-50 focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 active:bg-bia-grey-light-70',
1579
- 'outline-light-background': 'bg-white border border-bia-grey-light-40 hover:bg-bia-grey-light-90 outline-none focus:outline-2 focus:outline-bia-blue-light-50 focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 active:bg-bia-grey-light-80',
1577
+ 'dark-background': 'bg-white enabled:hover:bg-bia-grey-light-90 outline-none focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 enabled:active:bg-bia-grey-light-80',
1578
+ 'light-background': 'bg-bia-grey-light-90 enabled:hover:bg-bia-grey-light-80 outline-none focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 enabled:active:bg-bia-grey-light-70',
1579
+ 'outline-light-background': 'bg-white border border-bia-grey-light-40 enabled:hover:bg-bia-grey-light-90 outline-none focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 enabled:active:bg-bia-grey-light-80',
1580
1580
  };
1581
1581
 
1582
1582
  var Card = function (_a) {
1583
- var children = _a.children, disabled = _a.disabled, variant = _a.variant;
1584
- var base = config$2[variant || 'dark-background'];
1585
- var removeStateClasses = function (cls) {
1586
- return cls
1587
- .replace(/\b(?:hover|active|focus-visible|focus):[^\s]+/g, '')
1588
- .replace(/\s+/g, ' ')
1589
- .trim();
1590
- };
1591
- var cardClassName = disabled
1592
- ? "".concat(removeStateClasses(base), " cursor-not-allowed")
1593
- : base;
1594
- return (React.createElement("button", { disabled: disabled, "aria-disabled": disabled, className: "rounded-radius-md p-5 ".concat(cardClassName), tabIndex: disabled ? -1 : 0 }, children));
1583
+ var children = _a.children, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.variant, variant = _c === void 0 ? 'dark-background' : _c, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.type, type = _e === void 0 ? 'button' : _e, rest = __rest(_a, ["children", "disabled", "variant", "className", "type"]);
1584
+ var baseStyles = config$2[variant];
1585
+ var stateStyles = disabled
1586
+ ? 'opacity-50 cursor-not-allowed pointer-events-none'
1587
+ : '';
1588
+ var combinedClassName = "rounded-radius-md p-5 ".concat(baseStyles, " ").concat(stateStyles, " ").concat(className).trim();
1589
+ return (React.createElement("button", __assign({ type: type, disabled: disabled, "aria-disabled": disabled, className: combinedClassName }, rest), children));
1595
1590
  };
1596
1591
 
1597
1592
  function Color() {
@@ -4541,56 +4536,66 @@ var radiusConfig = {
4541
4536
  var variantConfig = {
4542
4537
  default: 'pb-[7.5px] pt-[8.5px] ps-[15px] pe-[10px] gap-[10px]',
4543
4538
  alternative: 'pt-[4.8px] pb-[4.0px] px-[20px] relative',
4539
+ 'alternative-more': 'pt-[4.8px] pb-[4.0px] px-[10px] relative',
4544
4540
  };
4545
4541
  var defaultConfigs = {
4546
- true: 'cursor-default bg-bia-grey-light-80 hover:bg-bia-coolgrey-light-90 text-primary-black ',
4547
- false: 'cursor-pointer bg-bia-grey hover:bg-bia-grey-light-50 text-bia-coolgrey-dark-10',
4548
- };
4549
- var defaultButtonConfigs = {
4550
- true: 'text-primary-black',
4551
- false: 'text-primary-black',
4542
+ active: 'cursor-default bg-bia-grey-light-80 hover:bg-bia-coolgrey-light-90 text-primary-black',
4543
+ inactive: 'cursor-pointer bg-bia-grey hover:bg-bia-grey-light-50 text-bia-coolgrey-dark-10',
4552
4544
  };
4553
4545
  var alternativeConfigs = {
4554
- true: 'cursor-default bg-primary-white text-primary-black overflow-hidden',
4555
- false: 'cursor-pointer bg-bia-verdantgreen-dark-40 hover:bg-bia-verdantgreen-dark-50 text-primary-white overflow-hidden',
4546
+ active: 'cursor-default bg-primary-white text-primary-black overflow-hidden',
4547
+ inactive: 'cursor-pointer bg-bia-verdantgreen-dark-40 hover:bg-bia-verdantgreen-dark-50 text-primary-white overflow-hidden',
4548
+ };
4549
+ var defaultButtonConfigs = {
4550
+ active: 'text-primary-black',
4551
+ inactive: 'text-primary-black',
4556
4552
  };
4557
4553
  var alternativeButtonConfigs = {
4558
- true: 'absolute px-[5px] opacity-0 group-hover/container:opacity-100 grid-cols-2 gap-[2px] bg-gradient-to-l from-primary-white from-50% to-primary-white/[.0] inset-y-0 right-0',
4559
- false: ' absolute px-[5px] opacity-0 hover:opacity-100 grid-cols-2 gap-[2px] bg-gradient-to-l from-bia-verdantgreen-dark-50 from-50% to-bia-verdantgreen-dark-50/[.0] inset-y-0 right-0',
4554
+ active: 'absolute px-[5px] opacity-0 group-hover/container:opacity-100 grid-cols-2 gap-[2px] bg-gradient-to-l from-primary-white from-50% to-primary-white/[.0] inset-y-0 right-0',
4555
+ inactive: 'absolute px-[5px] opacity-0 hover:opacity-100 grid-cols-2 gap-[2px] bg-gradient-to-l from-bia-verdantgreen-dark-50 from-50% to-bia-verdantgreen-dark-50/[.0] inset-y-0 right-0',
4560
4556
  };
4561
4557
  var actionButtonConfig = {
4562
- true: 'text-[#979797] group-hover:bg-primary-black/10 group-hover:text-primary-black group-active:bg-primary-black/20 group-active:text-primary-black',
4563
- false: 'text-[#95b491] group-hover:bg-primary-black/40 group-hover:text-primary-white group-active:bg-primary-black/60 group-hover:text-primary-white',
4558
+ active: 'text-[#979797] group-hover:bg-primary-black/10 group-hover:text-primary-black group-active:bg-primary-black/20 group-active:text-primary-black',
4559
+ inactive: 'text-[#95b491] group-hover:bg-primary-black/40 group-hover:text-primary-white group-active:bg-primary-black/60 group-hover:text-primary-white',
4564
4560
  };
4565
4561
 
4566
- var TabMenu = function (_a) {
4567
- var variant = _a.variant, _b = _a.text, text = _b === void 0 ? '' : _b, _c = _a.rounded, rounded = _c === void 0 ? 'none' : _c, _d = _a.isActive, isActive = _d === void 0 ? false : _d, _e = _a.onClose, onClose = _e === void 0 ? function () { } : _e, rest = __rest(_a, ["variant", "text", "rounded", "isActive", "onClose"]);
4568
- // valiated parameter
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 ? 1 : _c, onClose = props.onClose, onClickMore = props.onClickMore, _d = props.className, className = _d === void 0 ? '' : _d, rest = __rest(props, ["variant", "rounded", "text", "isActive", "moreCount", "onClose", "onClickMore", "className"]);
4564
+ var _e = useState(false), isMoreExpand = _e[0], setIsMoreExpand = _e[1];
4569
4565
  var validatedVariant = validUnion(variant, [
4570
4566
  'default',
4571
4567
  'alternative',
4568
+ 'alternative-more',
4572
4569
  ]);
4573
- var validatedRadius = validUnion(rounded, ['none', 'all', 'top', 'right', 'left']);
4574
- var usedBaseConfig;
4575
- var usedButtonConfig;
4576
- var usedActionButtonConfig;
4577
- if (validatedVariant === 'alternative') {
4578
- usedBaseConfig = alternativeConfigs[isActive];
4579
- usedButtonConfig = alternativeButtonConfigs[isActive];
4580
- usedActionButtonConfig = actionButtonConfig[isActive];
4581
- }
4582
- else {
4583
- usedBaseConfig = defaultConfigs[isActive];
4584
- usedButtonConfig = defaultButtonConfigs[isActive];
4585
- usedActionButtonConfig = '';
4586
- }
4587
- return (React.createElement("div", __assign({ className: "tab-menu group/container flex flex-row font-arial text-size-tiny font-normal ".concat(radiusConfig[validatedRadius], " ").concat(variantConfig[validatedVariant], " ").concat(usedBaseConfig, " ").concat(rest.className) }, rest),
4588
- text,
4589
- React.createElement("div", { className: "grid ".concat(usedButtonConfig, " ") },
4590
- validatedVariant === 'alternative' && React.createElement("div", { className: "order-first" }),
4591
- React.createElement("button", { className: "group order-last", onClick: onClose },
4592
- React.createElement(TbX, { className: "rounded-radius-sm ".concat(usedActionButtonConfig), size: 14 })))));
4593
- };
4570
+ var validatedRadius = validUnion(rounded, [
4571
+ 'none',
4572
+ 'all',
4573
+ 'top',
4574
+ 'right',
4575
+ 'left',
4576
+ ]);
4577
+ var isAlternative = validatedVariant.startsWith('alternative');
4578
+ var isMoreDropdown = validatedVariant === 'alternative-more';
4579
+ var stateKey = isActive ? 'active' : 'inactive';
4580
+ var baseStyles = isAlternative
4581
+ ? alternativeConfigs[stateKey]
4582
+ : defaultConfigs[stateKey];
4583
+ var actionButtonStyles = isAlternative ? actionButtonConfig[stateKey] : '';
4584
+ var itemButtonStyles = validatedVariant === 'alternative'
4585
+ ? alternativeButtonConfigs[stateKey]
4586
+ : defaultButtonConfigs[stateKey];
4587
+ var handleMoreClick = function (e) {
4588
+ setIsMoreExpand(function (prev) { return !prev; });
4589
+ onClickMore === null || onClickMore === void 0 ? void 0 : onClickMore(e);
4590
+ };
4591
+ return (React.createElement("div", __assign({ ref: ref, className: "tab-menu group/container flex flex-row font-arial text-size-tiny font-normal ".concat(radiusConfig[validatedRadius], " ").concat(variantConfig[validatedVariant], " ").concat(baseStyles, " ").concat(className).trim() }, rest),
4592
+ isMoreDropdown ? "More (".concat(moreCount, ")") : text,
4593
+ React.createElement("div", { className: "grid ".concat(itemButtonStyles) },
4594
+ isAlternative && React.createElement("div", { className: "order-first" }),
4595
+ isMoreDropdown ? (React.createElement("button", { type: "button", className: "group order-last pl-[2px]", onClick: handleMoreClick }, 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: "group order-last", onClick: onClose },
4596
+ React.createElement(TbX, { className: "rounded-radius-sm ".concat(actionButtonStyles), size: 14 }))))));
4597
+ });
4598
+ TabMenu.displayName = 'TabMenu';
4594
4599
 
4595
4600
  var sizeConfig$1 = {
4596
4601
  md: 'px-2.5 py-[9px]',