@creativecodeco/ui 0.5.0 → 0.6.1
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/hooks/use-safe-button-props.hook.d.ts +15 -19
- package/lib/theme/css/badge.css +45 -0
- package/lib/theme/css/button.css +4 -2
- package/lib/theme/css/main.css +1 -0
- package/lib/theme/main.css +694 -262
- package/lib/types/helpers/controller.types.d.ts +0 -1
- package/lib/types/ui/base/dom.types.d.ts +0 -1
- package/lib/types/ui/components/accordion.types.d.ts +0 -1
- package/lib/types/ui/components/badge.types.d.ts +11 -0
- package/lib/types/ui/components/badge.types.js +1 -0
- package/lib/types/ui/components/button.types.d.ts +4 -2
- package/lib/types/ui/components/index.d.ts +1 -0
- package/lib/types/ui/forms/dropdown.types.d.ts +0 -1
- package/lib/types/ui/forms/text-box.types.d.ts +0 -1
- package/lib/ui/components/badge/badge.component.d.ts +3 -0
- package/lib/ui/components/badge/badge.component.js +19 -0
- package/lib/ui/components/badge/index.d.ts +2 -0
- package/lib/ui/components/badge/index.js +2 -0
- package/lib/ui/components/button/button.component.js +4 -3
- package/lib/ui/components/index.d.ts +1 -0
- package/lib/ui/components/index.js +1 -0
- package/package.json +43 -42
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ColorType, SizeType } from '../../../types';
|
|
2
|
+
import type { IconType } from 'react-icons';
|
|
3
|
+
import type { PositionType } from '../../../types';
|
|
4
|
+
export interface BadgeType {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
color?: ColorType;
|
|
7
|
+
outline?: boolean;
|
|
8
|
+
size?: SizeType;
|
|
9
|
+
icon?: IconType;
|
|
10
|
+
iconPosition?: PositionType;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ColorButtonType, SizeType } from '../../../types';
|
|
1
|
+
import type { BadgeType, ColorButtonType, SizeType } from '../../../types';
|
|
3
2
|
import type { IconType } from 'react-icons';
|
|
4
3
|
import type { PositionType } from '../../../types';
|
|
5
4
|
export interface ButtonType extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -11,5 +10,8 @@ export interface ButtonType extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
11
10
|
iconPosition?: PositionType;
|
|
12
11
|
loading?: boolean;
|
|
13
12
|
loadingLabel?: string;
|
|
13
|
+
withBadge?: boolean;
|
|
14
|
+
badge?: React.ReactNode;
|
|
15
|
+
badgeProps?: Omit<BadgeType, 'children' | 'size'>;
|
|
14
16
|
}
|
|
15
17
|
export type ButtonRef = HTMLButtonElement;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import cls from 'classnames';
|
|
4
|
+
const Badge = ({ children, color, icon: Icon, iconPosition = 'left', outline, size = 'md' }) => {
|
|
5
|
+
const newIcon = useMemo(() => {
|
|
6
|
+
if (!Icon) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
return _jsx(Icon, {});
|
|
10
|
+
}, [Icon]);
|
|
11
|
+
return (_jsxs("div", { className: cls('badge', {
|
|
12
|
+
[`badge-color-${color}`]: !outline && color,
|
|
13
|
+
[`badge-${color}`]: outline && color,
|
|
14
|
+
'badge-outline': outline,
|
|
15
|
+
[`badge-size-${size}`]: size !== 'md',
|
|
16
|
+
'gap-2': Icon
|
|
17
|
+
}), children: [iconPosition === 'left' && newIcon, children, iconPosition === 'right' && newIcon] }));
|
|
18
|
+
};
|
|
19
|
+
export default Badge;
|
|
@@ -16,10 +16,11 @@ const Button = forwardRef(({ children, isLink, color, outline, size = 'md', icon
|
|
|
16
16
|
}
|
|
17
17
|
return (_jsxs(_Fragment, { children: [iconPosition === 'left' && newIcon, children, iconPosition === 'right' && newIcon] }));
|
|
18
18
|
}, [loading, loadingLabel, iconPosition, children, newIcon]);
|
|
19
|
-
return (_jsx("button", { ref: ref, className: cls('
|
|
19
|
+
return (_jsx("button", { ref: ref, className: cls('btn', {
|
|
20
20
|
'button-link': isLink,
|
|
21
|
-
'
|
|
22
|
-
[`
|
|
21
|
+
'btn-outline': !isLink && outline,
|
|
22
|
+
[`btn-${color}`]: outline && color,
|
|
23
|
+
[`button-color-${color}`]: !outline && color,
|
|
23
24
|
[`button-size-${size}`]: size !== 'md',
|
|
24
25
|
'button-loading': loading
|
|
25
26
|
}), ...safeProps, children: content }));
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"framework design",
|
|
11
11
|
"design system"
|
|
12
12
|
],
|
|
13
|
-
"version": "0.
|
|
13
|
+
"version": "0.6.1",
|
|
14
14
|
"homepage": "https://github.com/creativecodeco/ui",
|
|
15
15
|
"author": {
|
|
16
16
|
"name": "John Toro",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"lint:eslint": "eslint .",
|
|
32
32
|
"lint:fix": "npm run lint:eslint --fix --quiet",
|
|
33
33
|
"prepack": "npm run build",
|
|
34
|
-
"prepare": "husky
|
|
34
|
+
"prepare": "husky",
|
|
35
35
|
"release": "npm publish --access public",
|
|
36
36
|
"storybook": "storybook dev -p 6006",
|
|
37
37
|
"test": "jest .",
|
|
@@ -48,41 +48,41 @@
|
|
|
48
48
|
"usehooks-ts": "2.9.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"postcss": "8.4.
|
|
52
|
-
"postcss-import": "16.0
|
|
53
|
-
"react": "18.
|
|
54
|
-
"react-hook-form": "7.
|
|
55
|
-
"tailwindcss": "3.4.
|
|
56
|
-
"usehooks-ts": "2.
|
|
51
|
+
"postcss": "8.4.41",
|
|
52
|
+
"postcss-import": "16.1.0",
|
|
53
|
+
"react": "18.3.1",
|
|
54
|
+
"react-hook-form": "7.52.2",
|
|
55
|
+
"tailwindcss": "3.4.8",
|
|
56
|
+
"usehooks-ts": "2.16.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@babel/core": "7.
|
|
60
|
-
"@babel/preset-env": "7.
|
|
61
|
-
"@babel/preset-react": "7.
|
|
62
|
-
"@babel/preset-typescript": "7.
|
|
59
|
+
"@babel/core": "7.25.2",
|
|
60
|
+
"@babel/preset-env": "7.25.3",
|
|
61
|
+
"@babel/preset-react": "7.24.7",
|
|
62
|
+
"@babel/preset-typescript": "7.24.7",
|
|
63
63
|
"@jest/globals": "29.7.0",
|
|
64
|
-
"@storybook/addon-essentials": "7.6.
|
|
65
|
-
"@storybook/addon-interactions": "7.6.
|
|
66
|
-
"@storybook/addon-links": "7.6.
|
|
67
|
-
"@storybook/addon-mdx-gfm": "7.6.
|
|
68
|
-
"@storybook/blocks": "7.6.
|
|
69
|
-
"@storybook/react": "7.6.
|
|
70
|
-
"@storybook/react-webpack5": "7.6.
|
|
71
|
-
"@storybook/test": "7.6.
|
|
64
|
+
"@storybook/addon-essentials": "7.6.20",
|
|
65
|
+
"@storybook/addon-interactions": "7.6.20",
|
|
66
|
+
"@storybook/addon-links": "7.6.20",
|
|
67
|
+
"@storybook/addon-mdx-gfm": "7.6.20",
|
|
68
|
+
"@storybook/blocks": "7.6.20",
|
|
69
|
+
"@storybook/react": "7.6.20",
|
|
70
|
+
"@storybook/react-webpack5": "7.6.20",
|
|
71
|
+
"@storybook/test": "7.6.20",
|
|
72
72
|
"@testing-library/dom": "9.3.4",
|
|
73
|
-
"@testing-library/jest-dom": "6.4.
|
|
74
|
-
"@testing-library/react": "14.
|
|
73
|
+
"@testing-library/jest-dom": "6.4.8",
|
|
74
|
+
"@testing-library/react": "14.3.1",
|
|
75
75
|
"@testing-library/user-event": "14.5.2",
|
|
76
76
|
"@types/jest": "29.5.12",
|
|
77
|
-
"@types/node": "20.
|
|
78
|
-
"@types/react": "18.
|
|
79
|
-
"@types/react-dom": "18.
|
|
77
|
+
"@types/node": "20.14.14",
|
|
78
|
+
"@types/react": "18.3.3",
|
|
79
|
+
"@types/react-dom": "18.3.0",
|
|
80
80
|
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
81
|
-
"autoprefixer": "10.4.
|
|
82
|
-
"chromatic": "11.
|
|
81
|
+
"autoprefixer": "10.4.20",
|
|
82
|
+
"chromatic": "11.7.0",
|
|
83
83
|
"classnames": "2.5.1",
|
|
84
84
|
"cpx2": "7.0.1",
|
|
85
|
-
"daisyui": "4.
|
|
85
|
+
"daisyui": "4.12.10",
|
|
86
86
|
"eslint": "8.57.0",
|
|
87
87
|
"eslint-config-prettier": "9.1.0",
|
|
88
88
|
"eslint-config-standard": "17.1.0",
|
|
@@ -92,32 +92,33 @@
|
|
|
92
92
|
"eslint-plugin-import-order": "2.1.4",
|
|
93
93
|
"eslint-plugin-n": "16.6.2",
|
|
94
94
|
"eslint-plugin-node": "11.1.0",
|
|
95
|
-
"eslint-plugin-prettier": "5.1
|
|
96
|
-
"eslint-plugin-promise": "6.
|
|
97
|
-
"eslint-plugin-react": "7.
|
|
95
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
96
|
+
"eslint-plugin-promise": "6.6.0",
|
|
97
|
+
"eslint-plugin-react": "7.35.0",
|
|
98
98
|
"eslint-plugin-standard": "5.0.0",
|
|
99
99
|
"eslint-plugin-storybook": "0.8.0",
|
|
100
|
-
"eslint-plugin-unused-imports": "3.
|
|
101
|
-
"husky": "9.
|
|
100
|
+
"eslint-plugin-unused-imports": "3.2.0",
|
|
101
|
+
"husky": "9.1.4",
|
|
102
102
|
"jest": "29.7.0",
|
|
103
103
|
"jest-environment-jsdom": "29.7.0",
|
|
104
104
|
"jest-junit": "16.0.0",
|
|
105
105
|
"jest-transform-css": "6.0.1",
|
|
106
106
|
"postcss-cli": "11.0.0",
|
|
107
|
-
"prettier": "3.
|
|
107
|
+
"prettier": "3.3.3",
|
|
108
108
|
"prop-types": "15.8.1",
|
|
109
|
-
"react-dom": "18.
|
|
110
|
-
"react-icons": "5.
|
|
111
|
-
"storybook": "7.6.
|
|
109
|
+
"react-dom": "18.3.1",
|
|
110
|
+
"react-icons": "5.2.1",
|
|
111
|
+
"storybook": "7.6.20",
|
|
112
112
|
"storybook-addon-themes": "6.1.0",
|
|
113
|
-
"string-width": "7.
|
|
114
|
-
"ts-jest": "29.
|
|
113
|
+
"string-width": "7.2.0",
|
|
114
|
+
"ts-jest": "29.2.4",
|
|
115
115
|
"ts-node": "10.9.2",
|
|
116
|
-
"tsc-alias": "1.8.
|
|
116
|
+
"tsc-alias": "1.8.10",
|
|
117
117
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
118
|
-
"typescript": "5.
|
|
118
|
+
"typescript": "5.5.4"
|
|
119
119
|
},
|
|
120
120
|
"files": [
|
|
121
121
|
"lib"
|
|
122
|
-
]
|
|
122
|
+
],
|
|
123
|
+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
|
123
124
|
}
|