react-restyle-components 0.2.31 → 0.2.32
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/lib/package.json +2 -0
- package/lib/src/App.js +2 -2
- package/lib/src/core-components/atoms/tabs/tabs.component.js +4 -3
- package/lib/src/core-utils/index.d.ts +1 -0
- package/lib/src/core-utils/index.js +1 -0
- package/lib/src/core-utils/utility.util.d.ts +1 -0
- package/lib/src/core-utils/utility.util.js +5 -0
- package/package.json +3 -1
package/lib/package.json
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"@vitest/coverage-c8": "^0.31.4",
|
|
82
82
|
"@vitest/ui": "^0.31.4",
|
|
83
83
|
"autoprefixer": "^10.4.19",
|
|
84
|
+
"clsx": "^2.1.1",
|
|
84
85
|
"copyfiles": "^2.4.1",
|
|
85
86
|
"craco-alias": "^3.0.1",
|
|
86
87
|
"css-loader": "^7.1.2",
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
"storybook": "^8.0.6",
|
|
99
100
|
"storybook-multilevel-sort": "^2.0.1",
|
|
100
101
|
"style-loader": "^4.0.0",
|
|
102
|
+
"tailwind-merge": "^2.5.5",
|
|
101
103
|
"tailwindcss": "^3.4.14",
|
|
102
104
|
"ts-jest": "^29.2.5",
|
|
103
105
|
"vitest": "^0.31.4",
|
package/lib/src/App.js
CHANGED
|
@@ -7,8 +7,8 @@ function App() {
|
|
|
7
7
|
React.createElement(Button, null, "Title"),
|
|
8
8
|
React.createElement(Tabs, { options: [{ title: 'Work History' }, { title: 'Book Order' }] },
|
|
9
9
|
React.createElement(Tab, { title: "Work History" },
|
|
10
|
-
React.createElement("div", null, "
|
|
10
|
+
React.createElement("div", null, "Work")),
|
|
11
11
|
React.createElement(Tab, { title: "Book Order" },
|
|
12
|
-
React.createElement("div", null, "
|
|
12
|
+
React.createElement("div", null, "Book")))));
|
|
13
13
|
}
|
|
14
14
|
export default App;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import '../../../tc.css';
|
|
3
|
+
import { cn } from '@/core-utils';
|
|
3
4
|
export const Tab = ({ title, children }) => {
|
|
4
5
|
return (React.createElement("div", { className: "flex", key: title }, children));
|
|
5
6
|
};
|
|
@@ -8,12 +9,12 @@ export const Tabs = ({ options, children }) => {
|
|
|
8
9
|
const [selected, setSelected] = useState(options[0].title);
|
|
9
10
|
const tabs = React.Children.toArray(children).filter((child) => React.isValidElement(child) && child.type === Tab);
|
|
10
11
|
return (React.createElement(React.Fragment, null,
|
|
11
|
-
React.createElement("div", { className:
|
|
12
|
-
React.createElement("div", { className: "flex border-b" }, options?.map((tab, index) => (React.createElement("button", { type: "button", key: index, className: `py-2 px-4 mr-1 border-none rounded-t-md shadow-inner cursor-pointer ${activeTab === index ? 'bg-blue-500 border-none text-white' : ''}
|
|
12
|
+
React.createElement("div", { className: cn('flex flex-col w-full') },
|
|
13
|
+
React.createElement("div", { className: "flex border-b" }, options?.map((tab, index) => (React.createElement("button", { type: "button", key: index, className: cn(`py-2 px-4 mr-1 border-none rounded-t-md shadow-inner cursor-pointer ${activeTab === index ? 'bg-blue-500 border-none text-white' : ''}`), onClick: () => {
|
|
13
14
|
setSelected(tab?.title);
|
|
14
15
|
!tab.inActive && setActiveTab(index);
|
|
15
16
|
}, disabled: tab.inActive }, tab.title)))),
|
|
16
|
-
React.createElement("div", { className:
|
|
17
|
+
React.createElement("div", { className: cn('p-2 border border-solid border-slate-600 rounded-b-md') }, options[activeTab]?.content
|
|
17
18
|
? options[activeTab]?.content
|
|
18
19
|
: tabs[options?.findIndex((item) => item.title === selected)]))));
|
|
19
20
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cn: (...inputs: any[]) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-restyle-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.32",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easy use restyle components",
|
|
6
6
|
"author": {
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"@vitest/coverage-c8": "^0.31.4",
|
|
82
82
|
"@vitest/ui": "^0.31.4",
|
|
83
83
|
"autoprefixer": "^10.4.19",
|
|
84
|
+
"clsx": "^2.1.1",
|
|
84
85
|
"copyfiles": "^2.4.1",
|
|
85
86
|
"craco-alias": "^3.0.1",
|
|
86
87
|
"css-loader": "^7.1.2",
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
"storybook": "^8.0.6",
|
|
99
100
|
"storybook-multilevel-sort": "^2.0.1",
|
|
100
101
|
"style-loader": "^4.0.0",
|
|
102
|
+
"tailwind-merge": "^2.5.5",
|
|
101
103
|
"tailwindcss": "^3.4.14",
|
|
102
104
|
"ts-jest": "^29.2.5",
|
|
103
105
|
"vitest": "^0.31.4",
|