@rovula/ui 0.0.56 → 0.0.57

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
  import React from "react";
2
2
  import "./Tabs.css";
3
3
  type Tab = {
4
+ id?: string;
4
5
  label: string;
5
6
  startTabContent?: React.ReactElement;
6
7
  endTabContent?: React.ReactElement;
@@ -3,6 +3,7 @@ declare const meta: {
3
3
  title: string;
4
4
  component: React.FC<{
5
5
  tabs: {
6
+ id?: string | undefined;
6
7
  label: string;
7
8
  startTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
8
9
  endTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
@@ -38,6 +39,7 @@ declare const meta: {
38
39
  };
39
40
  decorators: ((Story: import("@storybook/types").PartialStoryFn<import("@storybook/react").ReactRenderer, {
40
41
  tabs: {
42
+ id?: string | undefined;
41
43
  label: string;
42
44
  startTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
43
45
  endTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
@@ -91,6 +91,6 @@ export interface TreeProps extends Pick<TreeItemProps, "renderIcon" | "renderRig
91
91
  hierarchicalCheck?: boolean;
92
92
  checkable?: boolean;
93
93
  maxLevel?: number;
94
- mode: "checkbox" | "radio";
94
+ mode?: "checkbox" | "radio";
95
95
  autoDisabled?: boolean;
96
96
  }
@@ -6,7 +6,7 @@ import ActionButton from "../ActionButton/ActionButton";
6
6
  import Icon from "../Icon/Icon";
7
7
  import { Loading } from "@/index";
8
8
  const Tabs = ({ tabs = [], value, initialTab = 0, tabBarSize = 38, enableBorderLine = true, enableAddTabButton = false, keepIconSpace = true, disabled = false, tabMode = "start", className, tabBarClassName, tabBarContainerClassName, tabBarWrapperClassName, tabButtonClassName, tabButtonActiveClassName, tabContentClassName, addTabButtonWrapperClassName, borderSliderClassName, leftAction, rightAction, onAddTab, onTabChange, }) => {
9
- var _a;
9
+ var _a, _b;
10
10
  const [activeTab, setActiveTab] = useState(initialTab);
11
11
  const [sliderStyle, setSliderStyle] = useState({
12
12
  width: "0px",
@@ -77,6 +77,6 @@ const Tabs = ({ tabs = [], value, initialTab = 0, tabBarSize = 38, enableBorderL
77
77
  onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(index);
78
78
  }, children: [(keepIconSpace || tab.startTabContent) && (_jsx("div", { className: "h-full w-3 flex items-center justify-center", children: tab.isLoading ? _jsx(Loading, {}) : tab.startTabContent })), tab.label, (keepIconSpace || tab.endTabContent) && (_jsx("div", { className: "h-full w-3 flex items-center justify-center", children: tab.endTabContent }))] }, index))), _jsx("div", { className: cn(`absolute left-0 bottom-0 h-[2px] rounded-full bg-foreground transition-all duration-300 ease-in-out`, {
79
79
  "bg-state-disable-solid": disabled,
80
- }, borderSliderClassName), style: sliderStyle })] }) }), enableAddTabButton && (_jsx("div", { className: cn("sticky right-0 flex content-center items-center mx-4", addTabButtonWrapperClassName), children: _jsx(ActionButton, { variant: "outline", size: "sm", onClick: () => onAddTab === null || onAddTab === void 0 ? void 0 : onAddTab(), disabled: disabled, children: _jsx(Icon, { name: "plus" }) }) })), rightAction] }), _jsx("div", { className: cn("mt-4 text-foreground", tabContentClassName), role: "tabpanel", id: `tab-content-${activeTab}`, "aria-labelledby": `tab-${activeTab}`, children: (_a = tabs[activeTab]) === null || _a === void 0 ? void 0 : _a.content })] }));
80
+ }, borderSliderClassName), style: sliderStyle })] }) }), enableAddTabButton && (_jsx("div", { className: cn("sticky right-0 flex content-center items-center mx-4", addTabButtonWrapperClassName), children: _jsx(ActionButton, { variant: "outline", size: "sm", onClick: () => onAddTab === null || onAddTab === void 0 ? void 0 : onAddTab(), disabled: disabled, children: _jsx(Icon, { name: "plus" }) }) })), rightAction] }), _jsx("div", { className: cn("mt-4 text-foreground", tabContentClassName), role: "tabpanel", id: `tab-content-${activeTab}`, "aria-labelledby": `tab-${activeTab}`, children: _jsx("div", { children: (_a = tabs[activeTab]) === null || _a === void 0 ? void 0 : _a.content }, (_b = tabs[activeTab].label + tabs[activeTab].id) !== null && _b !== void 0 ? _b : Math.random()) })] }));
81
81
  };
82
82
  export default Tabs;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useState } from "react";
3
3
  import TreeItem from "./TreeItem";
4
4
  import { cn } from "@/utils/cn";
5
- const Tree = ({ classes, data, defaultExpandedId, defaultCheckedId, checkedId, loadingId, lineSize, horizontalLineWidth, expandButtonSize, spacing, renderIcon, renderRightSection, renderElement, renderTitle, onExpandChange, onCheckedChange, onClickItem, onCheckedItem, defaultExpandAll = false, defaultCheckAll = false, hierarchicalCheck = false, showIcon = true, disabled, enableSeparatorLine = true, checkable = true, maxLevel, mode, autoDisabled = false, }) => {
5
+ const Tree = ({ classes, data, defaultExpandedId, defaultCheckedId, checkedId, loadingId, lineSize, horizontalLineWidth, expandButtonSize, spacing, renderIcon, renderRightSection, renderElement, renderTitle, onExpandChange, onCheckedChange, onClickItem, onCheckedItem, defaultExpandAll = false, defaultCheckAll = false, hierarchicalCheck = false, showIcon = true, disabled, enableSeparatorLine = true, checkable = true, maxLevel, mode = "checkbox", autoDisabled = false, }) => {
6
6
  const [checkedState, setCheckedState] = useState({});
7
7
  const [expandedState, setExpandedState] = useState({});
8
8
  const traverseTree = (nodes, callback) => {