@tecsinapse/cortex-core 0.0.7 → 0.0.10
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/LICENSE.md +21 -0
- package/dist/cjs/components/badge/badge.js +2 -1
- package/dist/cjs/components/button/button.js +3 -1
- package/dist/cjs/components/drawer/drawer.js +2 -1
- package/dist/cjs/components/hint/hint.js +2 -1
- package/dist/cjs/components/input/{index.js → input.js} +18 -12
- package/dist/cjs/components/select/select.js +5 -4
- package/dist/cjs/components/tag/tag.js +4 -3
- package/dist/cjs/components/toggle/toggle.js +2 -1
- package/dist/cjs/components/tooltip/tooltip.js +5 -4
- package/dist/cjs/index.js +8 -7
- package/dist/esm/components/badge/badge.js +2 -1
- package/dist/esm/components/button/button.js +3 -2
- package/dist/esm/components/drawer/drawer.js +2 -1
- package/dist/esm/components/hint/hint.js +2 -1
- package/dist/esm/components/input/{index.js → input.js} +17 -11
- package/dist/esm/components/select/select.js +5 -4
- package/dist/esm/components/tag/tag.js +3 -2
- package/dist/esm/components/toggle/toggle.js +2 -1
- package/dist/esm/components/tooltip/tooltip.js +5 -4
- package/dist/esm/index.js +3 -3
- package/dist/types/components/badge/badge.d.ts +5 -1
- package/dist/types/components/button/button.d.ts +4 -1
- package/dist/types/components/drawer/drawer.d.ts +5 -1
- package/dist/types/components/hint/hint.d.ts +5 -5
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/input/{index.d.ts → input.d.ts} +11 -8
- package/dist/types/components/select/select.d.ts +7 -1
- package/dist/types/components/snackbar/snackbar.d.ts +5 -1
- package/dist/types/components/tag/tag.d.ts +5 -1
- package/dist/types/components/toggle/toggle.d.ts +5 -1
- package/dist/types/components/tooltip/tooltip.d.ts +5 -1
- package/package.json +3 -2
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 TecSinapse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const badgeStyles = tailwindVariants.tv({
|
|
6
6
|
base: "text-sub text-white font-bold rounded-pill absolute items-center flex justify-center w-[1rem] h-[1rem] -top-1 -right-1 px-[5px] py-[2px]",
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
@@ -21,6 +21,7 @@ const badge = tailwindVariants.tv({
|
|
|
21
21
|
const containerBadge = tailwindVariants.tv({
|
|
22
22
|
base: "relative items-center justify-center self-center"
|
|
23
23
|
});
|
|
24
|
+
const badge = (props) => badgeStyles(props);
|
|
24
25
|
|
|
25
26
|
exports.badge = badge;
|
|
26
27
|
exports.containerBadge = containerBadge;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const buttonStyles = tailwindVariants.tv({
|
|
6
6
|
base: "p-deca rounded-mili text-base h-fit font-bold disabled:text-white enabled:active:scale-95 transform transition hover:text-white text-white cursor-pointer items-center flex justify-center",
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
@@ -91,5 +91,7 @@ const button = tailwindVariants.tv({
|
|
|
91
91
|
size: "default"
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
|
+
const button = (props) => buttonStyles(props);
|
|
94
95
|
|
|
95
96
|
exports.button = button;
|
|
97
|
+
exports.buttonStyles = buttonStyles;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const drawerStyles = tailwindVariants.tv({
|
|
6
6
|
base: "bg-white fixed top-0 h-full p-deca shadow-lg transition-all duration-500 transform peer-checked:translate-x-0",
|
|
7
7
|
variants: {
|
|
8
8
|
position: {
|
|
@@ -17,6 +17,7 @@ const drawer = tailwindVariants.tv({
|
|
|
17
17
|
const overlay = tailwindVariants.tv({
|
|
18
18
|
base: "fixed h-full w-full left-0 top-0 transition peer-checked:bg-black peer-checked:bg-opacity-50 z-[-1] peer-checked:z-[0] peer-checked:cursor-pointer"
|
|
19
19
|
});
|
|
20
|
+
const drawer = (props) => drawerStyles(props);
|
|
20
21
|
|
|
21
22
|
exports.drawer = drawer;
|
|
22
23
|
exports.overlay = overlay;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const hintStyles = tailwindVariants.tv({
|
|
6
6
|
base: "text-label font-bold flex items-center",
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
@@ -14,5 +14,6 @@ const hint = tailwindVariants.tv({
|
|
|
14
14
|
},
|
|
15
15
|
defaultVariants: { intent: "default" }
|
|
16
16
|
});
|
|
17
|
+
const hint = (props) => hintStyles(props);
|
|
17
18
|
|
|
18
19
|
exports.hint = hint;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const inputBaseStyles = tailwindVariants.tv({
|
|
7
7
|
base: "relative min-h-[44px] h-auto flex px-centi py-1.5 focus-within:outline focus-within:outline-1 text-base font-bold items-center bg-transparent border rounded-mili",
|
|
8
8
|
variants: {
|
|
9
9
|
intent: {
|
|
@@ -37,7 +37,7 @@ const inputBase = tailwindVariants.tv({
|
|
|
37
37
|
intent: "default"
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
-
const
|
|
40
|
+
const labelBaseStyles = tailwindVariants.tv({
|
|
41
41
|
base: "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-secondary-light select-none",
|
|
42
42
|
variants: {
|
|
43
43
|
intent: {
|
|
@@ -55,27 +55,33 @@ const labelBase = tailwindVariants.tv({
|
|
|
55
55
|
intent: "default"
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
const labelStyle = ({ intent, placeholder, className }) =>
|
|
58
|
+
const labelStyle = ({ intent, placeholder, className }) => labelBaseStyles({
|
|
59
59
|
intent,
|
|
60
60
|
className: clsx.clsx(className, {
|
|
61
61
|
"peer-placeholder-shown:hidden": !!placeholder
|
|
62
62
|
})
|
|
63
63
|
});
|
|
64
|
-
const
|
|
65
|
-
...variants,
|
|
66
|
-
className
|
|
67
|
-
});
|
|
68
|
-
const inputBox = (placeholder, label, className) => clsx.clsx(
|
|
64
|
+
const inputBox = (placeholder, label2, className) => clsx.clsx(
|
|
69
65
|
className,
|
|
70
66
|
"peer relative outline-none placeholder:text-base placeholder:text-secondary-xdark placeholder-shown:top-0 disabled:bg-opacity-0 disabled:placeholder:text-secondary-light bg-transparent",
|
|
71
67
|
{
|
|
72
|
-
"focus:top-1.5": !placeholder && !!
|
|
73
|
-
"top-1.5": !!
|
|
68
|
+
"focus:top-1.5": !placeholder && !!label2,
|
|
69
|
+
"top-1.5": !!label2
|
|
74
70
|
}
|
|
75
71
|
);
|
|
72
|
+
const input = (props) => inputBaseStyles(props);
|
|
73
|
+
const label = (props) => {
|
|
74
|
+
const { placeholder, intent } = props;
|
|
75
|
+
return labelBaseStyles({
|
|
76
|
+
intent,
|
|
77
|
+
className: clsx.clsx(props.className ?? props.class, {
|
|
78
|
+
"peer-placeholder-shown:hidden": !!placeholder
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
};
|
|
76
82
|
|
|
77
83
|
exports.input = input;
|
|
78
|
-
exports.
|
|
84
|
+
exports.inputBaseStyles = inputBaseStyles;
|
|
79
85
|
exports.inputBox = inputBox;
|
|
80
|
-
exports.
|
|
86
|
+
exports.label = label;
|
|
81
87
|
exports.labelStyle = labelStyle;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
|
-
var
|
|
4
|
+
var input = require('../input/input.js');
|
|
5
5
|
|
|
6
6
|
const buttonSelect = tailwindVariants.tv({
|
|
7
|
-
extend:
|
|
7
|
+
extend: input.inputBaseStyles,
|
|
8
8
|
base: "w-full justify-between bg-white gap-[200px]"
|
|
9
9
|
});
|
|
10
10
|
const option = tailwindVariants.tv({
|
|
11
11
|
base: "text-base py-mili px-deca font-bold hover:bg-primary-xlight hover:text-primary-medium cursor-pointer active:text-primary-medium"
|
|
12
12
|
});
|
|
13
|
-
const
|
|
13
|
+
const dropDownStyles = tailwindVariants.tv({
|
|
14
14
|
base: "text-base max-h-[200px] w-full bg-white mt-mili rounded-mili overflow-y-scroll py-mili transition-all duration-300 origin-top-left",
|
|
15
15
|
variants: {
|
|
16
16
|
open: {
|
|
@@ -19,7 +19,8 @@ const dropDown = tailwindVariants.tv({
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
const dropdown = (props) => dropDownStyles(props);
|
|
22
23
|
|
|
23
24
|
exports.buttonSelect = buttonSelect;
|
|
24
|
-
exports.
|
|
25
|
+
exports.dropdown = dropdown;
|
|
25
26
|
exports.option = option;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
|
-
var
|
|
4
|
+
var definitions = require('../../tokens/definitions.js');
|
|
5
5
|
|
|
6
6
|
const myTV = tailwindVariants.createTV({
|
|
7
7
|
twMergeConfig: {
|
|
8
8
|
//passar tema?
|
|
9
9
|
classGroups: {
|
|
10
|
-
"font-size": [{ text: Object.keys(
|
|
10
|
+
"font-size": [{ text: Object.keys(definitions.fontSize) }]
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const
|
|
14
|
+
const tagStyles = myTV({
|
|
15
15
|
base: "rounded-micro px-micro py-nano w-fit font-bold text-label items-center flex",
|
|
16
16
|
variants: {
|
|
17
17
|
intent: {
|
|
@@ -26,5 +26,6 @@ const tag = myTV({
|
|
|
26
26
|
intent: "secondary"
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
+
const tag = (props) => tagStyles(props);
|
|
29
30
|
|
|
30
31
|
exports.tag = tag;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const toggleStyles = tailwindVariants.tv({
|
|
6
6
|
base: "peer h-[22px] w-[40px] rounded-full bg-secondary-light after:absolute after:left-micro after:top-[3px] after:h-deca after:w-deca after:rounded-full after:border after:border-white after:bg-white after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none",
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
@@ -24,6 +24,7 @@ const styleLabelElement = tailwindVariants.tv({
|
|
|
24
24
|
const styleInputElement = tailwindVariants.tv({
|
|
25
25
|
base: "peer sr-only"
|
|
26
26
|
});
|
|
27
|
+
const toggle = (props) => toggleStyles(props);
|
|
27
28
|
|
|
28
29
|
exports.styleInputElement = styleInputElement;
|
|
29
30
|
exports.styleLabelElement = styleLabelElement;
|
|
@@ -5,7 +5,7 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
5
5
|
const tooltipContainer = tailwindVariants.tv({
|
|
6
6
|
base: "group relative inline-block"
|
|
7
7
|
});
|
|
8
|
-
const
|
|
8
|
+
const arrowTooltipStyles = tailwindVariants.tv({
|
|
9
9
|
base: 'after:content-[""] after:absolute after:border-secondary-dark',
|
|
10
10
|
variants: {
|
|
11
11
|
position: {
|
|
@@ -14,21 +14,22 @@ const arrowTooltip = tailwindVariants.tv({
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
const
|
|
17
|
+
const tooltipStyles = tailwindVariants.tv({
|
|
18
18
|
base: "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-secondary-dark text-white px-centi py-micro rounded-mili absolute",
|
|
19
19
|
variants: {
|
|
20
20
|
position: {
|
|
21
21
|
bottom: [
|
|
22
|
-
|
|
22
|
+
arrowTooltipStyles({ position: "bottom" }),
|
|
23
23
|
"-ml-[200px] left-[50%] top-[100%] mt-centi -translate-y-[10%]"
|
|
24
24
|
],
|
|
25
25
|
top: [
|
|
26
|
-
|
|
26
|
+
arrowTooltipStyles({ position: "top" }),
|
|
27
27
|
"-ml-[200px] left-[50%] bottom-[100%] mb-centi translate-y-[10%]"
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
+
const tooltip = (props) => tooltipStyles(props);
|
|
32
33
|
|
|
33
34
|
exports.tooltip = tooltip;
|
|
34
35
|
exports.tooltipContainer = tooltipContainer;
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var definitions = require('./tokens/definitions.js');
|
|
4
4
|
var button = require('./components/button/button.js');
|
|
5
5
|
var tag = require('./components/tag/tag.js');
|
|
6
|
-
var
|
|
6
|
+
var input = require('./components/input/input.js');
|
|
7
7
|
var hint = require('./components/hint/hint.js');
|
|
8
8
|
var toggle = require('./components/toggle/toggle.js');
|
|
9
9
|
var drawer = require('./components/drawer/drawer.js');
|
|
@@ -29,12 +29,13 @@ exports.fontSize = definitions.fontSize;
|
|
|
29
29
|
exports.spacing = definitions.spacing;
|
|
30
30
|
exports.textColor = definitions.textColor;
|
|
31
31
|
exports.button = button.button;
|
|
32
|
+
exports.buttonStyles = button.buttonStyles;
|
|
32
33
|
exports.tag = tag.tag;
|
|
33
|
-
exports.input =
|
|
34
|
-
exports.
|
|
35
|
-
exports.inputBox =
|
|
36
|
-
exports.
|
|
37
|
-
exports.labelStyle =
|
|
34
|
+
exports.input = input.input;
|
|
35
|
+
exports.inputBaseStyles = input.inputBaseStyles;
|
|
36
|
+
exports.inputBox = input.inputBox;
|
|
37
|
+
exports.label = input.label;
|
|
38
|
+
exports.labelStyle = input.labelStyle;
|
|
38
39
|
exports.hint = hint.hint;
|
|
39
40
|
exports.styleInputElement = toggle.styleInputElement;
|
|
40
41
|
exports.styleLabelElement = toggle.styleLabelElement;
|
|
@@ -42,7 +43,7 @@ exports.toggle = toggle.toggle;
|
|
|
42
43
|
exports.drawer = drawer.drawer;
|
|
43
44
|
exports.overlay = drawer.overlay;
|
|
44
45
|
exports.buttonSelect = select.buttonSelect;
|
|
45
|
-
exports.
|
|
46
|
+
exports.dropdown = select.dropdown;
|
|
46
47
|
exports.option = select.option;
|
|
47
48
|
exports.checkbox = checkbox.checkbox;
|
|
48
49
|
exports.badge = badge.badge;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const badgeStyles = tv({
|
|
4
4
|
base: "text-sub text-white font-bold rounded-pill absolute items-center flex justify-center w-[1rem] h-[1rem] -top-1 -right-1 px-[5px] py-[2px]",
|
|
5
5
|
variants: {
|
|
6
6
|
intent: {
|
|
@@ -19,5 +19,6 @@ const badge = tv({
|
|
|
19
19
|
const containerBadge = tv({
|
|
20
20
|
base: "relative items-center justify-center self-center"
|
|
21
21
|
});
|
|
22
|
+
const badge = (props) => badgeStyles(props);
|
|
22
23
|
|
|
23
24
|
export { badge, containerBadge };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const buttonStyles = tv({
|
|
4
4
|
base: "p-deca rounded-mili text-base h-fit font-bold disabled:text-white enabled:active:scale-95 transform transition hover:text-white text-white cursor-pointer items-center flex justify-center",
|
|
5
5
|
variants: {
|
|
6
6
|
intent: {
|
|
@@ -89,5 +89,6 @@ const button = tv({
|
|
|
89
89
|
size: "default"
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
+
const button = (props) => buttonStyles(props);
|
|
92
93
|
|
|
93
|
-
export { button };
|
|
94
|
+
export { button, buttonStyles };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const drawerStyles = tv({
|
|
4
4
|
base: "bg-white fixed top-0 h-full p-deca shadow-lg transition-all duration-500 transform peer-checked:translate-x-0",
|
|
5
5
|
variants: {
|
|
6
6
|
position: {
|
|
@@ -15,5 +15,6 @@ const drawer = tv({
|
|
|
15
15
|
const overlay = tv({
|
|
16
16
|
base: "fixed h-full w-full left-0 top-0 transition peer-checked:bg-black peer-checked:bg-opacity-50 z-[-1] peer-checked:z-[0] peer-checked:cursor-pointer"
|
|
17
17
|
});
|
|
18
|
+
const drawer = (props) => drawerStyles(props);
|
|
18
19
|
|
|
19
20
|
export { drawer, overlay };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const hintStyles = tv({
|
|
4
4
|
base: "text-label font-bold flex items-center",
|
|
5
5
|
variants: {
|
|
6
6
|
intent: {
|
|
@@ -12,5 +12,6 @@ const hint = tv({
|
|
|
12
12
|
},
|
|
13
13
|
defaultVariants: { intent: "default" }
|
|
14
14
|
});
|
|
15
|
+
const hint = (props) => hintStyles(props);
|
|
15
16
|
|
|
16
17
|
export { hint };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const inputBaseStyles = tv({
|
|
5
5
|
base: "relative min-h-[44px] h-auto flex px-centi py-1.5 focus-within:outline focus-within:outline-1 text-base font-bold items-center bg-transparent border rounded-mili",
|
|
6
6
|
variants: {
|
|
7
7
|
intent: {
|
|
@@ -35,7 +35,7 @@ const inputBase = tv({
|
|
|
35
35
|
intent: "default"
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
const
|
|
38
|
+
const labelBaseStyles = tv({
|
|
39
39
|
base: "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-secondary-light select-none",
|
|
40
40
|
variants: {
|
|
41
41
|
intent: {
|
|
@@ -53,23 +53,29 @@ const labelBase = tv({
|
|
|
53
53
|
intent: "default"
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
const labelStyle = ({ intent, placeholder, className }) =>
|
|
56
|
+
const labelStyle = ({ intent, placeholder, className }) => labelBaseStyles({
|
|
57
57
|
intent,
|
|
58
58
|
className: clsx(className, {
|
|
59
59
|
"peer-placeholder-shown:hidden": !!placeholder
|
|
60
60
|
})
|
|
61
61
|
});
|
|
62
|
-
const
|
|
63
|
-
...variants,
|
|
64
|
-
className
|
|
65
|
-
});
|
|
66
|
-
const inputBox = (placeholder, label, className) => clsx(
|
|
62
|
+
const inputBox = (placeholder, label2, className) => clsx(
|
|
67
63
|
className,
|
|
68
64
|
"peer relative outline-none placeholder:text-base placeholder:text-secondary-xdark placeholder-shown:top-0 disabled:bg-opacity-0 disabled:placeholder:text-secondary-light bg-transparent",
|
|
69
65
|
{
|
|
70
|
-
"focus:top-1.5": !placeholder && !!
|
|
71
|
-
"top-1.5": !!
|
|
66
|
+
"focus:top-1.5": !placeholder && !!label2,
|
|
67
|
+
"top-1.5": !!label2
|
|
72
68
|
}
|
|
73
69
|
);
|
|
70
|
+
const input = (props) => inputBaseStyles(props);
|
|
71
|
+
const label = (props) => {
|
|
72
|
+
const { placeholder, intent } = props;
|
|
73
|
+
return labelBaseStyles({
|
|
74
|
+
intent,
|
|
75
|
+
className: clsx(props.className ?? props.class, {
|
|
76
|
+
"peer-placeholder-shown:hidden": !!placeholder
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
};
|
|
74
80
|
|
|
75
|
-
export { input,
|
|
81
|
+
export { input, inputBaseStyles, inputBox, label, labelStyle };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
|
-
import {
|
|
2
|
+
import { inputBaseStyles } from '../input/input.js';
|
|
3
3
|
|
|
4
4
|
const buttonSelect = tv({
|
|
5
|
-
extend:
|
|
5
|
+
extend: inputBaseStyles,
|
|
6
6
|
base: "w-full justify-between bg-white gap-[200px]"
|
|
7
7
|
});
|
|
8
8
|
const option = tv({
|
|
9
9
|
base: "text-base py-mili px-deca font-bold hover:bg-primary-xlight hover:text-primary-medium cursor-pointer active:text-primary-medium"
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const dropDownStyles = tv({
|
|
12
12
|
base: "text-base max-h-[200px] w-full bg-white mt-mili rounded-mili overflow-y-scroll py-mili transition-all duration-300 origin-top-left",
|
|
13
13
|
variants: {
|
|
14
14
|
open: {
|
|
@@ -17,5 +17,6 @@ const dropDown = tv({
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
+
const dropdown = (props) => dropDownStyles(props);
|
|
20
21
|
|
|
21
|
-
export { buttonSelect,
|
|
22
|
+
export { buttonSelect, dropdown, option };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTV } from 'tailwind-variants';
|
|
2
|
-
import { fontSize } from '
|
|
2
|
+
import { fontSize } from '../../tokens/definitions.js';
|
|
3
3
|
|
|
4
4
|
const myTV = createTV({
|
|
5
5
|
twMergeConfig: {
|
|
@@ -9,7 +9,7 @@ const myTV = createTV({
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
const
|
|
12
|
+
const tagStyles = myTV({
|
|
13
13
|
base: "rounded-micro px-micro py-nano w-fit font-bold text-label items-center flex",
|
|
14
14
|
variants: {
|
|
15
15
|
intent: {
|
|
@@ -24,5 +24,6 @@ const tag = myTV({
|
|
|
24
24
|
intent: "secondary"
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
const tag = (props) => tagStyles(props);
|
|
27
28
|
|
|
28
29
|
export { tag };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const toggleStyles = tv({
|
|
4
4
|
base: "peer h-[22px] w-[40px] rounded-full bg-secondary-light after:absolute after:left-micro after:top-[3px] after:h-deca after:w-deca after:rounded-full after:border after:border-white after:bg-white after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none",
|
|
5
5
|
variants: {
|
|
6
6
|
intent: {
|
|
@@ -22,5 +22,6 @@ const styleLabelElement = tv({
|
|
|
22
22
|
const styleInputElement = tv({
|
|
23
23
|
base: "peer sr-only"
|
|
24
24
|
});
|
|
25
|
+
const toggle = (props) => toggleStyles(props);
|
|
25
26
|
|
|
26
27
|
export { styleInputElement, styleLabelElement, toggle };
|
|
@@ -3,7 +3,7 @@ import { tv } from 'tailwind-variants';
|
|
|
3
3
|
const tooltipContainer = tv({
|
|
4
4
|
base: "group relative inline-block"
|
|
5
5
|
});
|
|
6
|
-
const
|
|
6
|
+
const arrowTooltipStyles = tv({
|
|
7
7
|
base: 'after:content-[""] after:absolute after:border-secondary-dark',
|
|
8
8
|
variants: {
|
|
9
9
|
position: {
|
|
@@ -12,20 +12,21 @@ const arrowTooltip = tv({
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
const
|
|
15
|
+
const tooltipStyles = tv({
|
|
16
16
|
base: "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-secondary-dark text-white px-centi py-micro rounded-mili absolute",
|
|
17
17
|
variants: {
|
|
18
18
|
position: {
|
|
19
19
|
bottom: [
|
|
20
|
-
|
|
20
|
+
arrowTooltipStyles({ position: "bottom" }),
|
|
21
21
|
"-ml-[200px] left-[50%] top-[100%] mt-centi -translate-y-[10%]"
|
|
22
22
|
],
|
|
23
23
|
top: [
|
|
24
|
-
|
|
24
|
+
arrowTooltipStyles({ position: "top" }),
|
|
25
25
|
"-ml-[200px] left-[50%] bottom-[100%] mb-centi translate-y-[10%]"
|
|
26
26
|
]
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
const tooltip = (props) => tooltipStyles(props);
|
|
30
31
|
|
|
31
32
|
export { tooltip, tooltipContainer };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { borderColor, borderRadius, borderWidth, boxShadow, colors, fontFamily, fontSize, spacing, textColor } from './tokens/definitions.js';
|
|
2
|
-
export { button } from './components/button/button.js';
|
|
2
|
+
export { button, buttonStyles } from './components/button/button.js';
|
|
3
3
|
export { tag } from './components/tag/tag.js';
|
|
4
|
-
export { input,
|
|
4
|
+
export { input, inputBaseStyles, inputBox, label, labelStyle } from './components/input/input.js';
|
|
5
5
|
export { hint } from './components/hint/hint.js';
|
|
6
6
|
export { styleInputElement, styleLabelElement, toggle } from './components/toggle/toggle.js';
|
|
7
7
|
export { drawer, overlay } from './components/drawer/drawer.js';
|
|
8
|
-
export { buttonSelect,
|
|
8
|
+
export { buttonSelect, dropdown, option } from './components/select/select.js';
|
|
9
9
|
export { checkbox } from './components/checkbox/checkbox.js';
|
|
10
10
|
export { badge, containerBadge } from './components/badge/badge.js';
|
|
11
11
|
export { labelRadioButton, radioButton } from './components/radio-button/radio-button.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const badgeStyles: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
intent: {
|
|
3
4
|
primary: string;
|
|
4
5
|
secondary: string;
|
|
@@ -93,3 +94,6 @@ export declare const containerBadge: import("tailwind-variants").TVReturnType<{
|
|
|
93
94
|
};
|
|
94
95
|
};
|
|
95
96
|
} | {}>, unknown, unknown, undefined>>;
|
|
97
|
+
export type BadgeVariants = VariantProps<typeof badgeStyles>;
|
|
98
|
+
export declare const badge: (props?: BadgeVariants) => string;
|
|
99
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { VariantProps, ClassProp } from 'tailwind-variants';
|
|
2
|
+
export declare const buttonStyles: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
intent: {
|
|
3
4
|
primary: string;
|
|
4
5
|
secondary: string;
|
|
@@ -132,3 +133,5 @@ export declare const button: import("tailwind-variants").TVReturnType<{
|
|
|
132
133
|
circle: string;
|
|
133
134
|
};
|
|
134
135
|
}>, unknown, unknown, undefined>>;
|
|
136
|
+
export type ButtonVariants = VariantProps<typeof buttonStyles> & ClassProp;
|
|
137
|
+
export declare const button: (props?: ButtonVariants) => string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const drawerStyles: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
position: {
|
|
3
4
|
left: string;
|
|
4
5
|
right: string;
|
|
@@ -65,3 +66,6 @@ export declare const overlay: import("tailwind-variants").TVReturnType<{
|
|
|
65
66
|
};
|
|
66
67
|
};
|
|
67
68
|
} | {}>, unknown, unknown, undefined>>;
|
|
69
|
+
export type DrawerVariants = VariantProps<typeof drawerStyles> & ClassProp;
|
|
70
|
+
export declare const drawer: (props: DrawerVariants) => string;
|
|
71
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VariantProps } from 'tailwind-variants';
|
|
2
|
-
|
|
1
|
+
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const hintStyles: import("tailwind-variants").TVReturnType<{
|
|
3
3
|
intent: {
|
|
4
4
|
default: string;
|
|
5
5
|
success: string;
|
|
@@ -49,6 +49,6 @@ export declare const hint: import("tailwind-variants").TVReturnType<{
|
|
|
49
49
|
error: string;
|
|
50
50
|
};
|
|
51
51
|
}>, unknown, unknown, undefined>>;
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
}
|
|
52
|
+
export type HintVariants = VariantProps<typeof hintStyles> & ClassProp;
|
|
53
|
+
export declare const hint: (props?: HintVariants) => string;
|
|
54
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VariantProps } from 'tailwind-variants';
|
|
2
|
-
export declare const
|
|
1
|
+
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const inputBaseStyles: import("tailwind-variants").TVReturnType<{
|
|
3
3
|
intent: {
|
|
4
4
|
default: string[];
|
|
5
5
|
success: string[];
|
|
@@ -49,7 +49,7 @@ export declare const inputBase: import("tailwind-variants").TVReturnType<{
|
|
|
49
49
|
error: string[];
|
|
50
50
|
};
|
|
51
51
|
}>, unknown, unknown, undefined>>;
|
|
52
|
-
|
|
52
|
+
declare const labelBaseStyles: import("tailwind-variants").TVReturnType<{
|
|
53
53
|
intent: {
|
|
54
54
|
default: string[];
|
|
55
55
|
success: string[];
|
|
@@ -99,13 +99,16 @@ export declare const labelBase: import("tailwind-variants").TVReturnType<{
|
|
|
99
99
|
error: string[];
|
|
100
100
|
};
|
|
101
101
|
}>, unknown, unknown, undefined>>;
|
|
102
|
-
export interface LabelVariants extends VariantProps<typeof
|
|
102
|
+
export interface LabelVariants extends VariantProps<typeof labelBaseStyles> {
|
|
103
103
|
className?: string;
|
|
104
104
|
placeholder?: string;
|
|
105
105
|
}
|
|
106
106
|
export declare const labelStyle: ({ intent, placeholder, className }: LabelVariants) => string;
|
|
107
|
-
export interface InputVariants extends VariantProps<typeof inputBase> {
|
|
108
|
-
className?: string;
|
|
109
|
-
}
|
|
110
|
-
export declare const input: ({ className, ...variants }: InputVariants) => string;
|
|
111
107
|
export declare const inputBox: (placeholder?: string, label?: string, className?: string) => string;
|
|
108
|
+
export type InputBaseVariants = VariantProps<typeof inputBaseStyles> & ClassProp;
|
|
109
|
+
export declare const input: (props: InputBaseVariants) => string;
|
|
110
|
+
export type LabelBaseVariants = ClassProp & VariantProps<typeof labelBaseStyles> & {
|
|
111
|
+
placeholder?: string;
|
|
112
|
+
};
|
|
113
|
+
export declare const label: (props: LabelBaseVariants) => string;
|
|
114
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClassProp, type VariantProps } from 'tailwind-variants';
|
|
1
2
|
export declare const buttonSelect: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
[key: string]: {
|
|
3
4
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
@@ -135,7 +136,7 @@ export declare const option: import("tailwind-variants").TVReturnType<{
|
|
|
135
136
|
};
|
|
136
137
|
};
|
|
137
138
|
} | {}>, unknown, unknown, undefined>>;
|
|
138
|
-
|
|
139
|
+
declare const dropDownStyles: import("tailwind-variants").TVReturnType<{
|
|
139
140
|
open: {
|
|
140
141
|
true: string;
|
|
141
142
|
false: string;
|
|
@@ -171,3 +172,8 @@ export declare const dropDown: import("tailwind-variants").TVReturnType<{
|
|
|
171
172
|
false: string;
|
|
172
173
|
};
|
|
173
174
|
}>, unknown, unknown, undefined>>;
|
|
175
|
+
type DropDownVariants = VariantProps<typeof dropDownStyles> & ClassProp;
|
|
176
|
+
export interface DropDownProps extends Omit<DropDownVariants, 'open'>, Required<Pick<DropDownVariants, 'open'>> {
|
|
177
|
+
}
|
|
178
|
+
export declare const dropdown: (props: DropDownVariants) => string;
|
|
179
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const snackbarStyles: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
intent: {
|
|
3
4
|
primary: string;
|
|
4
5
|
secondary: string;
|
|
@@ -62,3 +63,6 @@ export declare const snackbar: import("tailwind-variants").TVReturnType<{
|
|
|
62
63
|
warning: string;
|
|
63
64
|
};
|
|
64
65
|
}>, unknown, unknown, undefined>>;
|
|
66
|
+
type SnackbarVariants = VariantProps<typeof snackbarStyles> & ClassProp;
|
|
67
|
+
export declare const snackbar: (props?: SnackbarVariants) => string;
|
|
68
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const tagStyles: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
intent: {
|
|
3
4
|
success: string;
|
|
4
5
|
primary: string;
|
|
@@ -55,3 +56,6 @@ export declare const tag: import("tailwind-variants").TVReturnType<{
|
|
|
55
56
|
white: string;
|
|
56
57
|
};
|
|
57
58
|
}>, unknown, unknown, undefined>>;
|
|
59
|
+
export type TagVariants = VariantProps<typeof tagStyles> & ClassProp;
|
|
60
|
+
export declare const tag: (props: TagVariants) => string;
|
|
61
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const toggleStyles: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
intent: {
|
|
3
4
|
primary: string;
|
|
4
5
|
secondary: string;
|
|
@@ -124,3 +125,6 @@ export declare const styleInputElement: import("tailwind-variants").TVReturnType
|
|
|
124
125
|
};
|
|
125
126
|
};
|
|
126
127
|
} | {}>, unknown, unknown, undefined>>;
|
|
128
|
+
type ToggleVariants = VariantProps<typeof toggleStyles> & ClassProp;
|
|
129
|
+
export declare const toggle: (props?: ToggleVariants) => string;
|
|
130
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
1
2
|
export declare const tooltipContainer: import("tailwind-variants").TVReturnType<{
|
|
2
3
|
[key: string]: {
|
|
3
4
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
@@ -29,7 +30,7 @@ export declare const tooltipContainer: import("tailwind-variants").TVReturnType<
|
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
} | {}>, unknown, unknown, undefined>>;
|
|
32
|
-
|
|
33
|
+
declare const tooltipStyles: import("tailwind-variants").TVReturnType<{
|
|
33
34
|
position: {
|
|
34
35
|
bottom: string[];
|
|
35
36
|
top: string[];
|
|
@@ -65,3 +66,6 @@ export declare const tooltip: import("tailwind-variants").TVReturnType<{
|
|
|
65
66
|
top: string[];
|
|
66
67
|
};
|
|
67
68
|
}>, unknown, unknown, undefined>>;
|
|
69
|
+
type TooltipVariants = VariantProps<typeof tooltipStyles> & ClassProp;
|
|
70
|
+
export declare const tooltip: (props: TooltipVariants) => string;
|
|
71
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -20,5 +20,6 @@
|
|
|
20
20
|
"class-variance-authority": "^0.7.0",
|
|
21
21
|
"tailwind-merge": "^2.0.0",
|
|
22
22
|
"tailwind-variants": "^0.1.18"
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"gitHead": "a1489e62337d020ca4e197c864e64f464a20d1a1"
|
|
24
25
|
}
|