@lotte-innovate/ui-component-test 0.0.24 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@lotte-innovate/ui-component-test",
3
3
  "description": "Lotte UI Library",
4
- "version": "0.0.24",
4
+ "version": "0.0.26",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "files": [
8
- "dist/lib"
8
+ "dist/lib",
9
+ "tailwind.config.ts"
9
10
  ],
10
11
  "main": "dist/lib/index.js",
11
12
  "module": "dist/lib/index.js",
@@ -46,6 +47,7 @@
46
47
  "dependencies": {
47
48
  "@babel/runtime": "^7.24.7",
48
49
  "@babel/runtime-corejs3": "^7.24.7",
50
+ "@lotte-innovate/ui-component-test": "^0.0.24",
49
51
  "@radix-ui/colors": "^3.0.0",
50
52
  "@radix-ui/react-accordion": "^1.2.0",
51
53
  "@radix-ui/react-checkbox": "^1.0.4",
@@ -0,0 +1,163 @@
1
+ import type { Config } from 'tailwindcss';
2
+ import * as lightColors from './src/lib/color/light';
3
+ import * as darkColors from './src/lib/color/dark';
4
+ import * as alphaColors from './src/lib/color/alpha';
5
+ import { colorOptions, alphaColorOptions, darkColorOptions } from './src/lib/color/constants';
6
+
7
+ let classes: string[] = [];
8
+ let darkClasses: string[] = [];
9
+
10
+ const colorScale = Array.from({ length: 12 }, (_, i) => (i + 1).toString());
11
+ const allColorOptions = [colorOptions, alphaColorOptions];
12
+
13
+ const generateClasses = (colorList: string[], colorScale: string[]): string[] => {
14
+ const classPrefixes = ['accent', 'fill', 'border', 'outline', 'bg', 'text'];
15
+ return colorList.flatMap((color) =>
16
+ colorScale.flatMap((scale) => classPrefixes.map((prefix) => `${prefix}-${color}-${scale}`)),
17
+ );
18
+ };
19
+
20
+ const generateDarkClasses = (colorList: string[], colorScale: string[]): string[] => {
21
+ const classPrefixes = [
22
+ 'dark:accent',
23
+ 'dark:fill',
24
+ 'dark:outline',
25
+ 'dark:border',
26
+ 'dark:bg',
27
+ 'dark:text',
28
+ 'dark:hover:bg',
29
+ 'dark:hover:border',
30
+ 'dark:hover:text',
31
+ 'dark:active:bg',
32
+ 'dark:active:border',
33
+ 'dark:active:text',
34
+ 'dark:before:checked:bg',
35
+ 'dark:data-[state=on]:bg',
36
+ 'dark:data-[state=open]:bg',
37
+ 'dark:data-[state=on]:text',
38
+ 'dark:data-[state=on]:hover:bg',
39
+ 'dark:data-[state=on]:hover:border',
40
+ 'dark:data-[state=on]:hover:text',
41
+ ];
42
+
43
+ return colorList.flatMap((color) =>
44
+ colorScale.flatMap((scale) => classPrefixes.map((prefix) => `${prefix}-${color}-${scale}`)),
45
+ );
46
+ };
47
+
48
+ allColorOptions.forEach((options) => {
49
+ classes = classes.concat(generateClasses(options, colorScale));
50
+ });
51
+
52
+ darkClasses.push(...generateDarkClasses(darkColorOptions, colorScale));
53
+
54
+ const config: Config = {
55
+ content: [
56
+ './src/pages/**/*.{js,ts,jsx,tsx,mdx,zip}',
57
+ './src/components/**/*.{js,ts,jsx,tsx,mdx,zip}',
58
+ './src/app/**/*.{js,ts,jsx,tsx,mdx,zip}',
59
+ './src/**/*.{js,ts,jsx,tsx,mdx,zip}',
60
+ ],
61
+ safelist: [
62
+ ...classes,
63
+ ...classes.map((cls) => `hover:${cls}`),
64
+ ...classes.map((cls) => `active:${cls}`),
65
+ ...classes.map((cls) => `before:${cls}`),
66
+ ...classes.map((cls) => `data-[state=checked]:${cls}`),
67
+ ...classes.map((cls) => `data-[state=unchecked]:${cls}`),
68
+ ...classes.map((cls) => `data-[state=on]:${cls}`),
69
+ ...classes.map((cls) => `data-[state=on]:hover:${cls}`),
70
+ ...classes.map((cls) => `data-[state=open]:${cls}`),
71
+ ...classes.map((cls) => `after:checked:${cls}`),
72
+ ...classes.map((cls) => `before:checked:${cls}`),
73
+ ...darkClasses,
74
+ ],
75
+ theme: {
76
+ extend: {
77
+ fontFamily: {
78
+ sans: ['Noto Sans KR', 'sans-serif', 'Nunito Sans', 'Helvetica Neue', 'Helvetica', 'Arial'],
79
+ },
80
+ backgroundImage: {
81
+ 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
82
+ 'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
83
+ },
84
+ colors: {
85
+ danger: '#C40006',
86
+ warning: '#AB6400',
87
+ success: '#00713F',
88
+ information: '#00749E',
89
+ ...formatColors(lightColors),
90
+ ...formatColors(darkColors),
91
+ ...formatColors(alphaColors),
92
+ },
93
+ // radix tailwind
94
+ keyframes: {
95
+ overlayShow: {
96
+ from: { opacity: '0' },
97
+ to: { opacity: '1' },
98
+ },
99
+ contentShow: {
100
+ from: { opacity: '0', transform: 'translate(-50%, -48%) scale(0.96)' },
101
+ to: { opacity: '1', transform: 'translate(-50%, -50%) scale(1)' },
102
+ },
103
+ slideDown: {
104
+ from: { height: '0px' },
105
+ to: { height: 'var(--radix-accordion-content-height)' },
106
+ },
107
+ slideUp: {
108
+ from: { height: 'var(--radix-accordion-content-height)' },
109
+ to: { height: '0px' },
110
+ },
111
+ },
112
+ animation: {
113
+ overlayShow: 'overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1)',
114
+ contentShow: 'contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1)',
115
+ slideDown: 'slideDown 300ms cubic-bezier(0.87, 0, 0.13, 1)',
116
+ slideUp: 'slideUp 300ms cubic-bezier(0.87, 0, 0.13, 1)',
117
+ },
118
+ boxShadow: {
119
+ 'button-classic':
120
+ '0px 0px 0px 1px #00002D17 inset, 0px -2px 1px 0px #0000330F inset, 0px 4px 2px -2px #FFFFFFB2 inset, 0px 2px 1px -1px #FFFFFFB2 inset',
121
+ 'checkbox-classic':
122
+ '0px 0px 0px 1px #00002D17 inset, 0px -2px 1px 0px #0000330F inset, 0px 4px 2px -2px #FFFFFF66 inset, 0px 2px 1px -1px #FFFFFF66 inset',
123
+ 'button-dark-classic':
124
+ '0px 0px 0px 1px #414142 inset, 0px -2px 1px 0px #414142 inset, 0px 4px 2px -2px #414142 inset, 0px 2px 1px -1px #414142 inset',
125
+ 'card-classic':
126
+ '0px 0px 0px 0.5px #0000000D, 0px 1px 4px 0px #00002D17, 0px 2px 1px -1px #0000000D, 0px 1px 3px 0px #0000000D',
127
+ 'card-dark-classic':
128
+ '0px 0px 0px 0.5px #414142, 0px 1px 4px 0px #414142, 0px 2px 1px -1px #414142, 0px 1px 3px 0px #414142',
129
+ 'segmented-control-dark-classic':
130
+ '0px 0px 0px 0.5px #0000000D, 0px 1px 4px 0px #363636, 0px 2px 1px -1px #0000000D, 0px 1px 3px 0px #0000000D',
131
+ },
132
+ },
133
+ },
134
+ plugins: [
135
+ function ({ addVariant }) {
136
+ addVariant('data-placeholder', '&:where([data-placeholder])');
137
+ },
138
+ ],
139
+
140
+ darkMode: 'class',
141
+ };
142
+
143
+ /**
144
+ * tailwind 방식으로 변경
145
+ * ex) bg-yellow-3
146
+ */
147
+ function formatColors(colors: Record<string, Record<string, string>>) {
148
+ const formatcolors: Record<string, string> = {};
149
+
150
+ for (const [cn, c] of Object.entries(colors)) {
151
+ for (const [scale, value] of Object.entries(c)) {
152
+ if (!scale) {
153
+ continue;
154
+ }
155
+
156
+ formatcolors[`${cn}-${scale}`] = value;
157
+ }
158
+ }
159
+
160
+ return formatcolors;
161
+ }
162
+
163
+ export default config;