@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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { FieldPath, FieldValues, ControllerProps as RHFControllerProps } from 'react-hook-form';
3
2
  import { Dropdown, TextBox } from '../../ui/forms';
4
3
  type TextBoxType = {
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  export type ButtonEvent = React.MouseEvent<HTMLButtonElement, MouseEvent>;
3
2
  export type ButtonEventHandler = React.MouseEventHandler<HTMLButtonElement>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface AccordionType {
3
2
  name: string;
4
3
  iconType?: 'arrow' | 'plus';
@@ -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
- /// <reference types="react" />
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;
@@ -1,3 +1,4 @@
1
1
  export type * from './accordion.types';
2
2
  export type * from './avatar.types';
3
+ export type * from './badge.types';
3
4
  export type * from './button.types';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TextBoxType } from './text-box.types';
3
2
  export interface DropdownOption {
4
3
  value: string | number;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { IconType } from 'react-icons';
3
2
  import type { ColorType, ErrorType, SizeType } from '../../../types';
4
3
  export interface TextBoxType extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>, ErrorType {
@@ -0,0 +1,3 @@
1
+ import type { BadgeType } from '../../../types';
2
+ declare const Badge: ({ children, color, icon: Icon, iconPosition, outline, size }: BadgeType) => import("react/jsx-runtime").JSX.Element;
3
+ export default Badge;
@@ -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;
@@ -0,0 +1,2 @@
1
+ import Badge from './badge.component';
2
+ export { Badge };
@@ -0,0 +1,2 @@
1
+ import Badge from './badge.component';
2
+ export { 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('button', {
19
+ return (_jsx("button", { ref: ref, className: cls('btn', {
20
20
  'button-link': isLink,
21
- 'button-outline': !isLink && outline,
22
- [`button-color-${color}`]: !isLink && color,
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 }));
@@ -1,3 +1,4 @@
1
1
  export * from './accordion';
2
2
  export * from './avatar';
3
+ export * from './badge';
3
4
  export * from './button';
@@ -1,3 +1,4 @@
1
1
  export * from './accordion';
2
2
  export * from './avatar';
3
+ export * from './badge';
3
4
  export * from './button';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "framework design",
11
11
  "design system"
12
12
  ],
13
- "version": "0.5.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 install",
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.35",
52
- "postcss-import": "16.0.1",
53
- "react": "18.2.0",
54
- "react-hook-form": "7.50.1",
55
- "tailwindcss": "3.4.1",
56
- "usehooks-ts": "2.15.1"
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.24.0",
60
- "@babel/preset-env": "7.24.0",
61
- "@babel/preset-react": "7.23.3",
62
- "@babel/preset-typescript": "7.23.3",
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.17",
65
- "@storybook/addon-interactions": "7.6.17",
66
- "@storybook/addon-links": "7.6.17",
67
- "@storybook/addon-mdx-gfm": "7.6.17",
68
- "@storybook/blocks": "7.6.17",
69
- "@storybook/react": "7.6.17",
70
- "@storybook/react-webpack5": "7.6.17",
71
- "@storybook/test": "7.6.17",
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.2",
74
- "@testing-library/react": "14.2.1",
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.11.21",
78
- "@types/react": "18.2.60",
79
- "@types/react-dom": "18.2.19",
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.17",
82
- "chromatic": "11.0.0",
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.7.2",
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.3",
96
- "eslint-plugin-promise": "6.1.1",
97
- "eslint-plugin-react": "7.33.2",
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.1.0",
101
- "husky": "9.0.11",
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.2.5",
107
+ "prettier": "3.3.3",
108
108
  "prop-types": "15.8.1",
109
- "react-dom": "18.2.0",
110
- "react-icons": "5.0.1",
111
- "storybook": "7.6.17",
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.1.0",
114
- "ts-jest": "29.1.2",
113
+ "string-width": "7.2.0",
114
+ "ts-jest": "29.2.4",
115
115
  "ts-node": "10.9.2",
116
- "tsc-alias": "1.8.8",
116
+ "tsc-alias": "1.8.10",
117
117
  "tsconfig-paths-webpack-plugin": "4.1.0",
118
- "typescript": "5.3.3"
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
  }