@creativecodeco/ui 0.6.2 → 1.0.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.
Files changed (71) hide show
  1. package/README.md +13 -19
  2. package/lib/helpers/index.js +8 -2
  3. package/lib/helpers/react-hook-form/controller.component.js +7 -4
  4. package/lib/helpers/react-hook-form/index.js +7 -2
  5. package/lib/hooks/index.js +8 -2
  6. package/lib/hooks/use-safe-button-props.hook.d.ts +98 -97
  7. package/lib/hooks/use-safe-button-props.hook.js +17 -8
  8. package/lib/index.js +23 -7
  9. package/lib/theme/css/accordion.css +5 -7
  10. package/lib/theme/css/avatar.css +19 -21
  11. package/lib/theme/css/badge.css +38 -44
  12. package/lib/theme/css/button.css +49 -53
  13. package/lib/theme/css/checkbox.css +31 -35
  14. package/lib/theme/css/main.css +3 -4
  15. package/lib/theme/css/radio.css +31 -35
  16. package/lib/theme/css/span.css +2 -4
  17. package/lib/theme/css/textbox.css +115 -0
  18. package/lib/theme/index.js +10 -6
  19. package/lib/theme/main.css +2669 -4112
  20. package/lib/types/helpers/controller.types.js +2 -1
  21. package/lib/types/index.js +2 -1
  22. package/lib/types/ui/base/constants.types.js +2 -1
  23. package/lib/types/ui/base/dom.types.js +2 -1
  24. package/lib/types/ui/base/error.types.js +2 -1
  25. package/lib/types/ui/base/index.js +2 -1
  26. package/lib/types/ui/components/accordion.types.js +2 -1
  27. package/lib/types/ui/components/avatar.types.js +2 -1
  28. package/lib/types/ui/components/badge.types.js +2 -1
  29. package/lib/types/ui/components/button.types.js +2 -1
  30. package/lib/types/ui/components/index.js +2 -1
  31. package/lib/types/ui/forms/checkbox.types.js +2 -1
  32. package/lib/types/ui/forms/dropdown.types.d.ts +1 -1
  33. package/lib/types/ui/forms/dropdown.types.js +2 -1
  34. package/lib/types/ui/forms/index.d.ts +1 -1
  35. package/lib/types/ui/forms/index.js +2 -1
  36. package/lib/types/ui/forms/radio.types.js +2 -1
  37. package/lib/types/ui/forms/textbox.types.js +2 -0
  38. package/lib/ui/components/accordion/accordion.component.js +11 -6
  39. package/lib/ui/components/accordion/index.js +8 -2
  40. package/lib/ui/components/avatar/avatar.component.js +18 -13
  41. package/lib/ui/components/avatar/index.js +8 -2
  42. package/lib/ui/components/badge/badge.component.js +12 -7
  43. package/lib/ui/components/badge/index.js +8 -2
  44. package/lib/ui/components/button/button.component.js +18 -13
  45. package/lib/ui/components/button/index.js +8 -2
  46. package/lib/ui/components/index.js +20 -4
  47. package/lib/ui/forms/checkbox/checkbox.component.js +15 -10
  48. package/lib/ui/forms/checkbox/index.js +8 -2
  49. package/lib/ui/forms/dropdown/dropdown.component.js +20 -18
  50. package/lib/ui/forms/dropdown/index.js +8 -2
  51. package/lib/ui/forms/index.d.ts +1 -1
  52. package/lib/ui/forms/index.js +21 -5
  53. package/lib/ui/forms/radio/index.js +8 -2
  54. package/lib/ui/forms/radio/radio.component.js +15 -10
  55. package/lib/ui/forms/radio-list/index.js +8 -2
  56. package/lib/ui/forms/radio-list/radio-list.component.js +6 -4
  57. package/lib/ui/forms/textbox/index.d.ts +2 -0
  58. package/lib/ui/forms/textbox/index.js +8 -0
  59. package/lib/ui/forms/textbox/textbox.component.js +26 -0
  60. package/lib/ui/provider/creativecode/creativecode-ui.provider.js +8 -5
  61. package/lib/ui/provider/index.js +8 -2
  62. package/lib/utils/index.js +17 -1
  63. package/lib/utils/string.utils.js +7 -3
  64. package/package.json +54 -61
  65. package/lib/theme/css/text-box.css +0 -113
  66. package/lib/types/ui/forms/text-box.types.js +0 -1
  67. package/lib/ui/forms/text-box/index.d.ts +0 -2
  68. package/lib/ui/forms/text-box/index.js +0 -2
  69. package/lib/ui/forms/text-box/text-box.component.js +0 -21
  70. /package/lib/types/ui/forms/{text-box.types.d.ts → textbox.types.d.ts} +0 -0
  71. /package/lib/ui/forms/{text-box/text-box.component.d.ts → textbox/textbox.component.d.ts} +0 -0
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const TextBox = (0, react_1.forwardRef)(({ name, label, isError, error, disabled, size = 'md', color, leftIcon: LeftIcon, rightIcon: RightIcon, rightButton, onClick, ...otherProps }, ref) => {
10
+ const inputRef = (0, react_1.useRef)(null);
11
+ (0, react_1.useImperativeHandle)(ref, () => inputRef.current);
12
+ return ((0, jsx_runtime_1.jsxs)("label", { htmlFor: name, className: 'form-control w-full flex flex-row gap-2', children: [label && ((0, jsx_runtime_1.jsx)("div", { className: 'label', children: (0, jsx_runtime_1.jsx)("span", { className: 'label-text', children: label }) })), (0, jsx_runtime_1.jsxs)("div", { className: 'relative', children: [LeftIcon && ((0, jsx_runtime_1.jsx)(LeftIcon, { className: (0, classnames_1.default)('textbox-left-icon', {
13
+ [`textbox-left-icon-size-${size}`]: size,
14
+ 'cursor-not-allowed': disabled
15
+ }) })), (0, jsx_runtime_1.jsx)("input", { ref: inputRef, id: name, name: name, "data-testid": name, ...otherProps, onClick: (e) => !disabled && onClick?.(e), className: (0, classnames_1.default)('input input-bordered w-full', `textbox-size-${size}`, {
16
+ 'input-error': isError,
17
+ 'textbox-with-left-icon': LeftIcon,
18
+ 'textbox-with-right-icon': RightIcon,
19
+ [`textbox-color-${color}`]: !isError && color
20
+ }), disabled: disabled }), RightIcon && ((0, jsx_runtime_1.jsx)(RightIcon, { className: (0, classnames_1.default)('textbox-right-icon', {
21
+ [`textbox-right-icon-size-${size}`]: size,
22
+ 'cursor-pointer': !disabled && rightButton,
23
+ 'cursor-not-allowed': disabled
24
+ }), onClick: () => rightButton && !disabled && inputRef.current?.click() }))] }), isError && (0, jsx_runtime_1.jsx)("p", { className: 'text-red-500 flex items-center', children: error })] }));
25
+ });
26
+ exports.default = TextBox;
@@ -1,9 +1,12 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Fragment, useEffect } from 'react';
3
- export default function CreativeCodeUIProvider({ children }) {
4
- useEffect(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = CreativeCodeUIProvider;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ function CreativeCodeUIProvider({ children }) {
7
+ (0, react_1.useEffect)(() => {
5
8
  const html = document.querySelector('html');
6
9
  html?.setAttribute('data-theme', 'creativecode');
7
10
  }, []);
8
- return _jsx(Fragment, { children: children });
11
+ return (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: children });
9
12
  }
@@ -1,2 +1,8 @@
1
- import CreativeCodeUIProvider from './creativecode/creativecode-ui.provider';
2
- export { CreativeCodeUIProvider };
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CreativeCodeUIProvider = void 0;
7
+ const creativecode_ui_provider_1 = __importDefault(require("./creativecode/creativecode-ui.provider"));
8
+ exports.CreativeCodeUIProvider = creativecode_ui_provider_1.default;
@@ -1 +1,17 @@
1
- export * from './string.utils';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./string.utils"), exports);
@@ -1,3 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInitials = getInitials;
4
+ exports.isValidUrl = isValidUrl;
1
5
  /**
2
6
  * Generates initials from the given name.
3
7
  *
@@ -22,7 +26,7 @@
22
26
  *
23
27
  * @public
24
28
  */
25
- export function getInitials(name) {
29
+ function getInitials(name) {
26
30
  const words = name.split(' ');
27
31
  const getCharAt = (word) => word.charAt(0).toUpperCase();
28
32
  if (words.length === 1) {
@@ -61,7 +65,7 @@ export function getInitials(name) {
61
65
  *
62
66
  * @public
63
67
  */
64
- export function isValidUrl(uri) {
68
+ function isValidUrl(uri) {
65
69
  if (!uri) {
66
70
  return false;
67
71
  }
@@ -69,7 +73,7 @@ export function isValidUrl(uri) {
69
73
  new URL(uri);
70
74
  return true;
71
75
  }
72
- catch (ignored) {
76
+ catch (_) {
73
77
  return false;
74
78
  }
75
79
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "framework design",
11
11
  "design system"
12
12
  ],
13
- "version": "0.6.2",
13
+ "version": "1.0.0",
14
14
  "homepage": "https://github.com/creativecodeco/ui",
15
15
  "author": {
16
16
  "name": "John Toro",
@@ -40,87 +40,80 @@
40
40
  "test:watch": "jest --watch"
41
41
  },
42
42
  "peerDependencies": {
43
- "postcss": "8.4.41",
44
- "postcss-import": "16.1.0",
43
+ "@tailwindcss/postcss": "4.1.18",
44
+ "postcss": "8.5.6",
45
45
  "react": "18.3.1",
46
- "react-hook-form": "7.52.2",
47
- "tailwindcss": "3.4.9",
48
- "usehooks-ts": "3.1.0"
46
+ "react-hook-form": "7.58.1",
47
+ "tailwindcss": "4.1.18",
48
+ "usehooks-ts": "3.1.1"
49
49
  },
50
50
  "dependencies": {
51
- "postcss": "8.4.41",
52
- "postcss-import": "16.1.0",
51
+ "@tailwindcss/postcss": "4.1.18",
52
+ "postcss": "8.5.6",
53
53
  "react": "18.3.1",
54
- "react-hook-form": "7.52.2",
55
- "tailwindcss": "3.4.9",
56
- "usehooks-ts": "3.1.0"
54
+ "react-hook-form": "7.58.1",
55
+ "tailwindcss": "4.1.18",
56
+ "usehooks-ts": "3.1.1"
57
57
  },
58
58
  "devDependencies": {
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
- "@chromatic-com/storybook": "1.6.1",
64
- "@jest/globals": "29.7.0",
65
- "@storybook/addon-essentials": "8.2.8",
66
- "@storybook/addon-interactions": "8.2.8",
67
- "@storybook/addon-links": "8.2.8",
68
- "@storybook/addon-webpack5-compiler-swc": "1.0.5",
69
- "@storybook/blocks": "8.2.8",
70
- "@storybook/manager-api": "8.2.8",
71
- "@storybook/react": "8.2.8",
72
- "@storybook/react-webpack5": "8.2.8",
73
- "@storybook/test": "8.2.8",
74
- "@storybook/theming": "8.2.8",
75
- "@testing-library/dom": "9.3.4",
76
- "@testing-library/jest-dom": "6.4.8",
59
+ "@babel/core": "7.28.5",
60
+ "@babel/preset-env": "7.28.5",
61
+ "@babel/preset-react": "7.28.5",
62
+ "@babel/preset-typescript": "7.28.5",
63
+ "@chromatic-com/storybook": "4.1.3",
64
+ "@eslint/js": "^9.39.2",
65
+ "@jest/globals": "30.2.0",
66
+ "@storybook/addon-docs": "10.1.11",
67
+ "@storybook/addon-links": "10.1.11",
68
+ "@storybook/addon-webpack5-compiler-swc": "4.0.2",
69
+ "@storybook/react-webpack5": "10.1.11",
70
+ "@testing-library/dom": "10.4.1",
71
+ "@testing-library/jest-dom": "6.9.1",
77
72
  "@testing-library/react": "14.3.1",
78
- "@testing-library/user-event": "14.5.2",
79
- "@types/jest": "29.5.12",
80
- "@types/node": "22.1.0",
81
- "@types/react": "18.3.3",
82
- "@types/react-dom": "18.3.0",
83
- "@typescript-eslint/eslint-plugin": "6.21.0",
84
- "autoprefixer": "10.4.20",
85
- "chromatic": "11.7.0",
73
+ "@testing-library/user-event": "14.6.1",
74
+ "@types/jest": "30.0.0",
75
+ "@types/node": "25.0.3",
76
+ "@types/react": "18.3.27",
77
+ "@types/react-dom": "18.3.7",
78
+ "chromatic": "13.3.4",
86
79
  "classnames": "2.5.1",
87
- "cpx2": "7.0.1",
88
- "daisyui": "4.12.10",
89
- "eslint": "8.57.0",
90
- "eslint-config-prettier": "9.1.0",
80
+ "cpx2": "8.0.0",
81
+ "daisyui": "5.5.14",
82
+ "eslint": "8.57.1",
83
+ "eslint-config-prettier": "10.1.8",
91
84
  "eslint-config-standard": "17.1.0",
92
85
  "eslint-config-standard-react": "13.0.0",
93
86
  "eslint-config-standard-with-typescript": "43.0.1",
94
- "eslint-plugin-import": "2.29.1",
95
- "eslint-plugin-import-order": "2.1.4",
87
+ "eslint-plugin-import": "2.32.0",
96
88
  "eslint-plugin-n": "16.6.2",
97
89
  "eslint-plugin-node": "11.1.0",
98
- "eslint-plugin-prettier": "5.2.1",
90
+ "eslint-plugin-prettier": "5.5.4",
99
91
  "eslint-plugin-promise": "6.6.0",
100
- "eslint-plugin-react": "7.35.0",
92
+ "eslint-plugin-react": "7.37.5",
101
93
  "eslint-plugin-standard": "5.0.0",
102
- "eslint-plugin-storybook": "0.8.0",
103
- "eslint-plugin-unused-imports": "3.2.0",
104
- "husky": "9.1.4",
94
+ "eslint-plugin-storybook": "10.1.11",
95
+ "eslint-plugin-unused-imports": "4.3.0",
96
+ "globals": "^17.0.0",
97
+ "husky": "9.1.7",
105
98
  "jest": "29.7.0",
106
- "jest-environment-jsdom": "29.7.0",
99
+ "jest-environment-jsdom": "30.2.0",
107
100
  "jest-junit": "16.0.0",
108
- "jest-transform-css": "6.0.1",
109
- "postcss-cli": "11.0.0",
110
- "prettier": "3.3.3",
101
+ "jest-transform-css": "6.0.3",
102
+ "postcss-cli": "11.0.1",
103
+ "prettier": "3.7.4",
111
104
  "prop-types": "15.8.1",
112
105
  "react-dom": "18.3.1",
113
- "react-icons": "5.2.1",
114
- "storybook": "8.2.8",
115
- "string-width": "7.2.0",
116
- "ts-jest": "29.2.4",
106
+ "react-icons": "5.5.0",
107
+ "storybook": "10.1.11",
108
+ "string-width": "8.1.0",
109
+ "ts-jest": "29.4.6",
117
110
  "ts-node": "10.9.2",
118
- "tsc-alias": "1.8.10",
119
- "tsconfig-paths-webpack-plugin": "4.1.0",
120
- "typescript": "5.5.4"
111
+ "tsc-alias": "1.8.16",
112
+ "tsconfig-paths-webpack-plugin": "4.2.0",
113
+ "typescript": "5.9.3",
114
+ "typescript-eslint": "^8.51.0"
121
115
  },
122
116
  "files": [
123
117
  "lib"
124
- ],
125
- "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
118
+ ]
126
119
  }
@@ -1,113 +0,0 @@
1
- .text-box-size {
2
- &-xs {
3
- @apply input-xs;
4
-
5
- &.text-box-with-left-icon {
6
- @apply pl-8;
7
- }
8
-
9
- &.text-box-with-right-icon {
10
- @apply pr-8;
11
- }
12
- }
13
-
14
- &-sm {
15
- @apply input-sm;
16
-
17
- &.text-box-with-left-icon {
18
- @apply pl-8;
19
- }
20
-
21
- &.text-box-with-right-icon {
22
- @apply pr-8;
23
- }
24
- }
25
-
26
- &-md {
27
- @apply input-md;
28
-
29
- &.text-box-with-left-icon {
30
- @apply pl-9;
31
- }
32
-
33
- &.text-box-with-right-icon {
34
- @apply pr-9;
35
- }
36
- }
37
-
38
- &-lg {
39
- @apply input-lg;
40
-
41
- &.text-box-with-left-icon {
42
- @apply pl-9;
43
- }
44
-
45
- &.text-box-with-right-icon {
46
- @apply pr-9;
47
- }
48
- }
49
- }
50
-
51
- .text-box-left-icon {
52
- @apply absolute;
53
-
54
- &-size-xs {
55
- @apply top-[5px] left-2;
56
- }
57
-
58
- &-size-sm {
59
- @apply top-2 left-2;
60
- }
61
-
62
- &-size-md {
63
- @apply top-4 left-3;
64
- }
65
-
66
- &-size-lg {
67
- @apply top-6 left-3;
68
- }
69
- }
70
-
71
- .text-box-right-icon {
72
- @apply absolute;
73
-
74
- &-size-xs {
75
- @apply top-[5px] right-2;
76
- }
77
-
78
- &-size-sm {
79
- @apply top-2 right-2;
80
- }
81
-
82
- &-size-md {
83
- @apply top-4 right-3;
84
- }
85
-
86
- &-size-lg {
87
- @apply top-6 right-3;
88
- }
89
- }
90
-
91
- .text-box-color {
92
- &-primary {
93
- @apply input-primary;
94
- }
95
- &-secondary {
96
- @apply input-secondary;
97
- }
98
- &-accent {
99
- @apply input-accent;
100
- }
101
- &-success {
102
- @apply input-success;
103
- }
104
- &-warning {
105
- @apply input-warning;
106
- }
107
- &-info {
108
- @apply input-info;
109
- }
110
- &-error {
111
- @apply input-error;
112
- }
113
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import TextBox from "./text-box.component";
2
- export { TextBox };
@@ -1,2 +0,0 @@
1
- import TextBox from "./text-box.component";
2
- export { TextBox };
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useImperativeHandle, useRef } from 'react';
3
- import cls from 'classnames';
4
- const TextBox = forwardRef(({ name, label, isError, error, disabled, size = 'md', color, leftIcon: LeftIcon, rightIcon: RightIcon, rightButton, onClick, ...otherProps }, ref) => {
5
- const inputRef = useRef(null);
6
- useImperativeHandle(ref, () => inputRef.current);
7
- return (_jsxs("label", { htmlFor: name, className: 'form-control w-full flex', children: [label && _jsx("span", { className: 'label-text', children: label }), _jsxs("div", { className: 'relative', children: [LeftIcon && (_jsx(LeftIcon, { className: cls('text-box-left-icon', {
8
- [`text-box-left-icon-size-${size}`]: size,
9
- 'cursor-not-allowed': disabled
10
- }) })), _jsx("input", { ref: inputRef, id: name, name: name, "data-testid": name, ...otherProps, onClick: (e) => !disabled && onClick?.(e), className: cls('input input-bordered w-full', `text-box-size-${size}`, {
11
- 'input-error': isError,
12
- 'text-box-with-left-icon': LeftIcon,
13
- 'text-box-with-right-icon': RightIcon,
14
- [`text-box-color-${color}`]: !isError && color
15
- }), disabled: disabled }), RightIcon && (_jsx(RightIcon, { className: cls('text-box-right-icon', {
16
- [`text-box-right-icon-size-${size}`]: size,
17
- 'cursor-pointer': !disabled && rightButton,
18
- 'cursor-not-allowed': disabled
19
- }), onClick: () => rightButton && !disabled && inputRef.current?.click() }))] }), isError && _jsx("p", { className: 'text-red-500', children: error })] }));
20
- });
21
- export default TextBox;