@sebgroup/green-react 1.9.4 → 1.10.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.
package/index.js CHANGED
@@ -3860,6 +3860,7 @@ $({ global: true, forced: parseInt != $parseInt }, {
3860
3860
  parseInt: $parseInt
3861
3861
  });
3862
3862
 
3863
+ const Tab = props => null;
3863
3864
  const Tabs = ({
3864
3865
  list,
3865
3866
  onTabChange,
@@ -3875,10 +3876,10 @@ const Tabs = ({
3875
3876
  }
3876
3877
  };
3877
3878
  return jsxs(Fragment, {
3878
- children: [jsx("nav", Object.assign({
3879
+ children: [jsxs("nav", Object.assign({
3879
3880
  role: "tablist"
3880
3881
  }, {
3881
- children: list === null || list === void 0 ? void 0 : list.map((value, index) => jsx("a", Object.assign({
3882
+ children: [!children && (list === null || list === void 0 ? void 0 : list.map((value, index) => jsx("a", Object.assign({
3882
3883
  href: value.disabled ? undefined : value.href || '#',
3883
3884
  onClick: onClick,
3884
3885
  role: "tab",
@@ -3887,14 +3888,28 @@ const Tabs = ({
3887
3888
  "aria-selected": selectedTab === index
3888
3889
  }, {
3889
3890
  children: value.text
3890
- }), index))
3891
- })), jsx("section", {
3892
- children: list === null || list === void 0 ? void 0 : list.map((value, index) => jsx("article", Object.assign({
3891
+ }), index))), children === null || children === void 0 ? void 0 : children.map((tab, index) => jsx("a", Object.assign({
3892
+ href: tab.props.disabled ? undefined : tab.props.href || '#',
3893
+ onClick: onClick,
3894
+ role: "tab",
3895
+ "data-index-number": index,
3896
+ "aria-disabled": tab.props.disabled,
3897
+ "aria-selected": selectedTab === index
3898
+ }, {
3899
+ children: tab.props.title
3900
+ }), index))]
3901
+ })), jsxs("section", {
3902
+ children: [!children && (list === null || list === void 0 ? void 0 : list.map((value, index) => jsx("article", Object.assign({
3893
3903
  role: "tabpanel",
3894
3904
  "aria-hidden": selectedTab !== index
3895
3905
  }, {
3896
3906
  children: value.text
3897
- }), index))
3907
+ }), index))), children === null || children === void 0 ? void 0 : children.map((tab, index) => jsx("article", Object.assign({
3908
+ role: "tabpanel",
3909
+ "aria-hidden": selectedTab !== index
3910
+ }, {
3911
+ children: tab.props.children
3912
+ }), index))]
3898
3913
  })]
3899
3914
  });
3900
3915
  };
@@ -4000,4 +4015,4 @@ const Modal = _a => {
4000
4015
  return isOpen ? modalContent() : null;
4001
4016
  };
4002
4017
 
4003
- export { Accordion, AlertRibbon as Alert, AlertRibbon, Badge, Button, ButtonGroup, Card, Checkbox, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItem, FormItems, Group, Link, List$1 as List, Modal, Navbar, NumberInput, Option, OptionGroup, RadioButton, RadioGroup, RenderInput, Select, Slider, Stepper, Tabs, Text, TextInput, valueList$1 as ValueList };
4018
+ export { Accordion, AlertRibbon as Alert, AlertRibbon, Badge, Button, ButtonGroup, Card, Checkbox, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItem, FormItems, Group, Link, List$1 as List, Modal, Navbar, NumberInput, Option, OptionGroup, RadioButton, RadioGroup, RenderInput, Select, Slider, Stepper, Tab, Tabs, Text, TextInput, valueList$1 as ValueList };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "peerDependencies": {
5
5
  "react": "^17 || ^18",
6
6
  "react-dom": "^17 || ^18"
@@ -1,13 +1,24 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, ReactElement, PropsWithChildren } from 'react';
2
2
  export interface IList {
3
3
  text?: string;
4
4
  href?: string;
5
5
  disabled?: boolean;
6
6
  }
7
7
  interface TabsProps {
8
+ /**
9
+ * **Deprecated**
10
+ * @deprecated use `<Tab>` child components instead
11
+ */
8
12
  list?: IList[];
9
13
  onTabChange?: (index: number) => void;
10
- children?: ReactNode[];
14
+ children?: ReactElement<TabProps>[];
11
15
  }
16
+ export interface TabProps {
17
+ title: string;
18
+ disabled?: boolean;
19
+ href?: string;
20
+ children?: ReactNode;
21
+ }
22
+ export declare const Tab: (props: PropsWithChildren<TabProps>) => null;
12
23
  export declare const Tabs: ({ list, onTabChange, children }: TabsProps) => JSX.Element;
13
24
  export default Tabs;