@sebgroup/green-react 1.9.3 → 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 +30 -10
- package/package.json +3 -3
- package/src/lib/tabs/tabs.d.ts +13 -2
package/index.js
CHANGED
|
@@ -2321,6 +2321,9 @@ const Datepicker = (options = {}) => {
|
|
|
2321
2321
|
const datepickerTriggerRef = useRef(null);
|
|
2322
2322
|
const datepickerDialogRef = useRef(null);
|
|
2323
2323
|
const dateInputRef = useRef(null);
|
|
2324
|
+
options = Object.assign({
|
|
2325
|
+
label: 'Date'
|
|
2326
|
+
}, options);
|
|
2324
2327
|
const {
|
|
2325
2328
|
datepicker,
|
|
2326
2329
|
data,
|
|
@@ -2343,7 +2346,7 @@ const Datepicker = (options = {}) => {
|
|
|
2343
2346
|
children: [jsx("label", Object.assign({
|
|
2344
2347
|
htmlFor: id
|
|
2345
2348
|
}, {
|
|
2346
|
-
children:
|
|
2349
|
+
children: options.label
|
|
2347
2350
|
})), jsxs("div", Object.assign({
|
|
2348
2351
|
className: "group",
|
|
2349
2352
|
ref: datepickerRef
|
|
@@ -2397,13 +2400,15 @@ const Datepicker = (options = {}) => {
|
|
|
2397
2400
|
display: "key",
|
|
2398
2401
|
texts: {
|
|
2399
2402
|
placeholder: data.monthName
|
|
2400
|
-
}
|
|
2403
|
+
},
|
|
2404
|
+
onChange: datepicker.setMonth
|
|
2401
2405
|
}), jsx(Dropdown, {
|
|
2402
2406
|
options: years({}),
|
|
2403
2407
|
display: "key",
|
|
2404
2408
|
texts: {
|
|
2405
2409
|
placeholder: data.year + ''
|
|
2406
|
-
}
|
|
2410
|
+
},
|
|
2411
|
+
onChange: datepicker.setYear
|
|
2407
2412
|
}), jsx("button", Object.assign({
|
|
2408
2413
|
className: "link",
|
|
2409
2414
|
onClick: () => datepicker.add(1, 'months')
|
|
@@ -3855,6 +3860,7 @@ $({ global: true, forced: parseInt != $parseInt }, {
|
|
|
3855
3860
|
parseInt: $parseInt
|
|
3856
3861
|
});
|
|
3857
3862
|
|
|
3863
|
+
const Tab = props => null;
|
|
3858
3864
|
const Tabs = ({
|
|
3859
3865
|
list,
|
|
3860
3866
|
onTabChange,
|
|
@@ -3870,10 +3876,10 @@ const Tabs = ({
|
|
|
3870
3876
|
}
|
|
3871
3877
|
};
|
|
3872
3878
|
return jsxs(Fragment, {
|
|
3873
|
-
children: [
|
|
3879
|
+
children: [jsxs("nav", Object.assign({
|
|
3874
3880
|
role: "tablist"
|
|
3875
3881
|
}, {
|
|
3876
|
-
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({
|
|
3877
3883
|
href: value.disabled ? undefined : value.href || '#',
|
|
3878
3884
|
onClick: onClick,
|
|
3879
3885
|
role: "tab",
|
|
@@ -3882,14 +3888,28 @@ const Tabs = ({
|
|
|
3882
3888
|
"aria-selected": selectedTab === index
|
|
3883
3889
|
}, {
|
|
3884
3890
|
children: value.text
|
|
3885
|
-
}), index))
|
|
3886
|
-
|
|
3887
|
-
|
|
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({
|
|
3888
3903
|
role: "tabpanel",
|
|
3889
3904
|
"aria-hidden": selectedTab !== index
|
|
3890
3905
|
}, {
|
|
3891
3906
|
children: value.text
|
|
3892
|
-
}), 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))]
|
|
3893
3913
|
})]
|
|
3894
3914
|
});
|
|
3895
3915
|
};
|
|
@@ -3995,4 +4015,4 @@ const Modal = _a => {
|
|
|
3995
4015
|
return isOpen ? modalContent() : null;
|
|
3996
4016
|
};
|
|
3997
4017
|
|
|
3998
|
-
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,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebgroup/green-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": "^17 || ^18",
|
|
6
6
|
"react-dom": "^17 || ^18"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@sebgroup/chlorophyll": "^1.10.
|
|
10
|
-
"@sebgroup/extract": "^1.3.
|
|
9
|
+
"@sebgroup/chlorophyll": "^1.10.3",
|
|
10
|
+
"@sebgroup/extract": "^1.3.4",
|
|
11
11
|
"classnames": "^2.3.2"
|
|
12
12
|
},
|
|
13
13
|
"description": "React components built on top of @sebgroup/chlorophyll.",
|
package/src/lib/tabs/tabs.d.ts
CHANGED
|
@@ -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?:
|
|
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;
|