@creativecodeco/ui 0.0.5 → 0.2.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 (50) hide show
  1. package/README.md +37 -4
  2. package/lib/index.d.ts +2 -0
  3. package/lib/index.js +2 -0
  4. package/lib/theme/css/avatar.css +37 -0
  5. package/lib/theme/css/checkbox.css +47 -0
  6. package/lib/theme/css/main.css +2 -0
  7. package/lib/theme/main.css +590 -1
  8. package/lib/types/helpers/controller.types.d.ts +5 -5
  9. package/lib/types/index.d.ts +3 -2
  10. package/lib/types/index.js +3 -1
  11. package/lib/types/ui/base/constants.types.d.ts +1 -0
  12. package/lib/types/ui/base/error.types.d.ts +4 -0
  13. package/lib/types/ui/base/error.types.js +1 -0
  14. package/lib/types/ui/base/index.d.ts +2 -0
  15. package/lib/types/ui/base/index.js +1 -0
  16. package/lib/types/ui/components/avatar.types.d.ts +9 -0
  17. package/lib/types/ui/components/avatar.types.js +1 -0
  18. package/lib/types/ui/components/index.d.ts +2 -0
  19. package/lib/types/ui/components/index.js +1 -0
  20. package/lib/types/ui/forms/checkbox.types.d.ts +11 -0
  21. package/lib/types/ui/forms/checkbox.types.js +1 -0
  22. package/lib/types/ui/forms/{drop-down.types.d.ts → dropdown.types.d.ts} +3 -3
  23. package/lib/types/ui/forms/dropdown.types.js +1 -0
  24. package/lib/types/ui/forms/index.d.ts +3 -3
  25. package/lib/types/ui/forms/text-box.types.d.ts +3 -4
  26. package/lib/ui/components/avatar/avatar.component.d.ts +3 -0
  27. package/lib/ui/components/avatar/avatar.component.js +18 -0
  28. package/lib/ui/components/avatar/index.d.ts +2 -0
  29. package/lib/ui/components/avatar/index.js +2 -0
  30. package/lib/ui/components/index.d.ts +1 -0
  31. package/lib/ui/components/index.js +1 -0
  32. package/lib/ui/forms/checkbox/checkbox.component.d.ts +4 -0
  33. package/lib/ui/forms/checkbox/checkbox.component.js +14 -0
  34. package/lib/ui/forms/checkbox/index.d.ts +2 -0
  35. package/lib/ui/forms/checkbox/index.js +2 -0
  36. package/lib/ui/forms/dropdown/dropdown.component.d.ts +4 -0
  37. package/lib/ui/forms/{drop-down/drop-down.component.js → dropdown/dropdown.component.js} +4 -2
  38. package/lib/ui/forms/dropdown/index.d.ts +2 -0
  39. package/lib/ui/forms/dropdown/index.js +2 -0
  40. package/lib/ui/forms/index.d.ts +3 -3
  41. package/lib/ui/forms/index.js +3 -3
  42. package/lib/utils/index.d.ts +1 -0
  43. package/lib/utils/index.js +1 -0
  44. package/lib/utils/string.utils.d.ts +51 -0
  45. package/lib/utils/string.utils.js +75 -0
  46. package/package.json +29 -26
  47. package/lib/ui/forms/drop-down/drop-down.component.d.ts +0 -4
  48. package/lib/ui/forms/drop-down/index.d.ts +0 -2
  49. package/lib/ui/forms/drop-down/index.js +0 -2
  50. /package/lib/types/ui/{forms/drop-down.types.js → base/constants.types.js} +0 -0
package/README.md CHANGED
@@ -25,11 +25,11 @@ yarn add @creativecodeco/ui
25
25
  ### Dependencies
26
26
 
27
27
  ```bash
28
- npm install --save-dev tailwindcss postcss postcss-import autoprefixer usehooks-ts
28
+ npm install --save-dev tailwindcss postcss postcss-import autoprefixer usehooks-ts cssnano
29
29
 
30
30
  or
31
31
 
32
- yarn add -D tailwindcss postcss postcss-import autoprefixer usehooks-ts
32
+ yarn add -D tailwindcss postcss postcss-import autoprefixer usehooks-ts cssnano
33
33
  ```
34
34
 
35
35
  ### Setting Tailwind
@@ -46,13 +46,45 @@ const themeConfig = {
46
46
  ...creativeCodeTheme.content,
47
47
  './src/**/*.{js,jsx,ts,tsx}',
48
48
  './app/**/*.{js,jsx,ts,tsx}',
49
- './node_modules/@creativecodeco/ui/lib/**/*.{js,jsx,ts,tsx}',
50
49
  ],
51
50
  };
52
51
 
53
52
  export default themeConfig;
54
53
  ```
55
54
 
55
+ #### Custom theme
56
+
57
+ ```js
58
+ /** @type {import('tailwindcss').Config} */
59
+ import { creativeCodeTheme } from '@creativecodeco/ui';
60
+
61
+ const themeConfig = {
62
+ ...creativeCodeTheme,
63
+ content: [
64
+ ...creativeCodeTheme.content,
65
+ './src/**/*.{js,jsx,ts,tsx}',
66
+ './app/**/*.{js,jsx,ts,tsx}',
67
+ ],
68
+ daisyui: {
69
+ ...creativeCodeTheme.daisyui,
70
+ themes: [
71
+ {
72
+ customTheme: {
73
+ ...require('daisyui/src/theming/themes')['light'],
74
+ primary: '#08448c',
75
+ secondary: '#427AA1',
76
+ neutral: '#EBF2FA',
77
+ accent: '#679436',
78
+ other: '#A5BE00',
79
+ },
80
+ },
81
+ ],
82
+ },
83
+ };
84
+
85
+ export default themeConfig;
86
+ ```
87
+
56
88
  ### Setting Postcss
57
89
 
58
90
  Create file `postcss.config.js` and add
@@ -64,6 +96,7 @@ module.exports = {
64
96
  'tailwindcss/nesting': {},
65
97
  tailwindcss: {},
66
98
  autoprefixer: {},
99
+ ...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}),
67
100
  },
68
101
  };
69
102
  ```
@@ -75,7 +108,7 @@ Add on layout `layout.tsx`
75
108
  ```tsx
76
109
  import { CreativeCodeUIProvider } from '@creativecodeco/ui';
77
110
 
78
- import '@creativecodeco/ui/lib/theme/main.css';
111
+ import '@creativecodeco/ui/lib/theme/css/main.css';
79
112
 
80
113
  export default function RootLayout({ children }) {
81
114
  return (
package/lib/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './helpers';
2
2
  export * from './theme';
3
+ export * from './ui/components';
3
4
  export * from './ui/forms';
4
5
  export * from './ui/provider';
5
6
  export * from './types';
7
+ export * from './utils';
package/lib/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './helpers';
2
2
  export * from './theme';
3
+ export * from './ui/components';
3
4
  export * from './ui/forms';
4
5
  export * from './ui/provider';
5
6
  export * from './types';
7
+ export * from './utils';
@@ -0,0 +1,37 @@
1
+ .avatar-size {
2
+ &-xs {
3
+ @apply w-8;
4
+
5
+ > span {
6
+ @apply text-xs;
7
+ }
8
+ }
9
+
10
+ &-sm {
11
+ @apply w-12;
12
+
13
+ > span {
14
+ @apply text-sm;
15
+ }
16
+ }
17
+
18
+ &-md {
19
+ @apply w-16;
20
+
21
+ > span {
22
+ @apply text-xl;
23
+ }
24
+ }
25
+
26
+ &-lg {
27
+ @apply w-24;
28
+
29
+ > span {
30
+ @apply text-3xl;
31
+ }
32
+ }
33
+ }
34
+
35
+ .avatar-ring {
36
+ @apply ring ring-primary ring-offset-base-100 ring-offset-2;
37
+ }
@@ -0,0 +1,47 @@
1
+ .checkbox-color {
2
+ &-primary {
3
+ @apply checkbox-primary;
4
+ }
5
+
6
+ &-secondary {
7
+ @apply checkbox-secondary;
8
+ }
9
+
10
+ &-accent {
11
+ @apply checkbox-accent;
12
+ }
13
+
14
+ &-success {
15
+ @apply checkbox-success;
16
+ }
17
+
18
+ &-warning {
19
+ @apply checkbox-warning;
20
+ }
21
+
22
+ &-info {
23
+ @apply checkbox-info;
24
+ }
25
+
26
+ &-error {
27
+ @apply checkbox-error;
28
+ }
29
+ }
30
+
31
+ .checkbox-size {
32
+ &-xs {
33
+ @apply checkbox-xs;
34
+ }
35
+
36
+ &-sm {
37
+ @apply checkbox-sm;
38
+ }
39
+
40
+ &-md {
41
+ @apply checkbox-md;
42
+ }
43
+
44
+ &-lg {
45
+ @apply checkbox-lg;
46
+ }
47
+ }
@@ -2,4 +2,6 @@
2
2
  @import 'tailwindcss/components';
3
3
  @import 'tailwindcss/utilities';
4
4
 
5
+ @import './avatar.css';
6
+ @import './checkbox.css';
5
7
  @import './text-box.css';