@liner-fe/internal-icon 1.0.33 → 1.0.34
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/.ultra.cache.json +1 -1
- package/CHANGELOG.md +8 -0
- package/figma.json +688 -1068
- package/lib/index.js +9 -20
- package/package.json +1 -1
- package/src/generate-svg-files.ts +0 -4
- package/src/generate-tsx-components.ts +9 -15
package/lib/index.js
CHANGED
|
@@ -34,11 +34,7 @@ var generateSvgFiles = /* @__PURE__ */ __name(() => {
|
|
|
34
34
|
// @ts-ignore
|
|
35
35
|
default: v.default,
|
|
36
36
|
// @ts-ignore
|
|
37
|
-
fill: v.fill
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
thick: v.thick,
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
"fill-thick": v["fill-thick"]
|
|
37
|
+
fill: v.fill
|
|
42
38
|
};
|
|
43
39
|
Object.entries(variants).forEach(([variant, svgString]) => {
|
|
44
40
|
if (svgString && svgString.trim() !== "") {
|
|
@@ -69,7 +65,7 @@ var generateTsxComponents = /* @__PURE__ */ __name(() => {
|
|
|
69
65
|
return svgString.replace(/fill-rule/g, "fillRule").replace(/clip-rule/g, "clipRule").replace(/width="\d+"/, "width={iconSize}").replace(/height="\d+"/, "height={iconSize}").replace(
|
|
70
66
|
/xmlns="http:\/\/www.w3.org\/2000\/svg"/,
|
|
71
67
|
"ref={ref} className={className} {...props}"
|
|
72
|
-
).replace(/style="[^"]*"/g, "").replace(/xmlns="http:\/\/www.w3.org\/1999\/xhtml"/g, "");
|
|
68
|
+
).replace(/style="[^"]*"/g, "").replace(/xmlns="http:\/\/www.w3.org\/1999\/xhtml"/g, "").replace(/xmlns:xlink="[^"]*"/g, 'xmlnsXlink="http://www.w3.org/1999/xlink"').replace(/xlink:href=/g, "xlinkHref=");
|
|
73
69
|
}
|
|
74
70
|
__name(normalizeSvgAttributes, "normalizeSvgAttributes");
|
|
75
71
|
const KEBAB_REGEX = /\p{Lu}/gu;
|
|
@@ -88,7 +84,6 @@ var generateTsxComponents = /* @__PURE__ */ __name(() => {
|
|
|
88
84
|
}, "generateIconName");
|
|
89
85
|
const IconProps = /* @__PURE__ */ __name((additionalProps = "") => `{
|
|
90
86
|
fill?: boolean;
|
|
91
|
-
thick?: boolean;
|
|
92
87
|
className?: string;
|
|
93
88
|
${additionalProps}
|
|
94
89
|
${COLOR}?: BasicColorType;
|
|
@@ -104,9 +99,7 @@ var generateTsxComponents = /* @__PURE__ */ __name(() => {
|
|
|
104
99
|
const variantSvgs = {};
|
|
105
100
|
const variants = {
|
|
106
101
|
default: v.default,
|
|
107
|
-
fill: v.fill
|
|
108
|
-
thick: v.thick,
|
|
109
|
-
"fill-thick": v["fill-thick"]
|
|
102
|
+
fill: v.fill
|
|
110
103
|
};
|
|
111
104
|
Object.entries(variants).forEach(([variant, svgString]) => {
|
|
112
105
|
if (svgString && svgString.trim() !== "") {
|
|
@@ -136,16 +129,12 @@ import { iconSizeMap } from '@liner-fe/design-token-primitive';
|
|
|
136
129
|
import { IconProps } from '../../index';
|
|
137
130
|
|
|
138
131
|
export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
|
|
139
|
-
({ fill = false,
|
|
132
|
+
({ fill = false, size = 'm', type = 'neutral-label-primary', className, fillType = 'inverse-label-primary', ...props }, ref) => {
|
|
140
133
|
const iconSize = iconSizeMap[size];
|
|
141
|
-
if (fill
|
|
142
|
-
return ${variantSvgs["fill-thick"] || defaultSvg};
|
|
143
|
-
} else if (fill) {
|
|
134
|
+
if (fill) {
|
|
144
135
|
return ${variantSvgs.fill || defaultSvg};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
136
|
+
}
|
|
137
|
+
|
|
149
138
|
return ${variantSvgs.default || defaultSvg};
|
|
150
139
|
}
|
|
151
140
|
);
|
|
@@ -170,7 +159,7 @@ export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
|
|
|
170
159
|
} else {
|
|
171
160
|
const variantSvgs = processSvgVariants(variants);
|
|
172
161
|
if (Object.keys(variantSvgs).length > 0) {
|
|
173
|
-
const defaultSvg = variantSvgs.default ||
|
|
162
|
+
const defaultSvg = variantSvgs.default || Object.values(variantSvgs)[0];
|
|
174
163
|
const tsxCode = generateTsxComponent(componentName, variantSvgs, defaultSvg);
|
|
175
164
|
const filePath = path3.join(iconDir, "index.tsx");
|
|
176
165
|
fs2.writeFileSync(filePath, tsxCode);
|
|
@@ -198,7 +187,7 @@ export type IconSizeKey = keyof typeof iconSizeMap;
|
|
|
198
187
|
|
|
199
188
|
export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'fill' | 'name'> ${IconProps("size?: keyof typeof iconSizeMap;")}
|
|
200
189
|
|
|
201
|
-
export type ColorIconProps = Omit<IconProps, 'type' | 'fillType' | 'fill'
|
|
190
|
+
export type ColorIconProps = Omit<IconProps, 'type' | 'fillType' | 'fill'>;
|
|
202
191
|
|
|
203
192
|
export type IconComponentType = React.ForwardRefExoticComponent<
|
|
204
193
|
Omit<IconProps, 'ref'> & React.RefAttributes<SVGSVGElement>
|
package/package.json
CHANGED
|
@@ -28,10 +28,6 @@ export const generateSvgFiles = () => {
|
|
|
28
28
|
default: v.default,
|
|
29
29
|
// @ts-ignore
|
|
30
30
|
fill: v.fill,
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
thick: v.thick,
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
'fill-thick': v['fill-thick'],
|
|
35
31
|
};
|
|
36
32
|
|
|
37
33
|
Object.entries(variants).forEach(([variant, svgString]) => {
|
|
@@ -29,7 +29,9 @@ export const generateTsxComponents = () => {
|
|
|
29
29
|
'ref={ref} className={className} {...props}',
|
|
30
30
|
)
|
|
31
31
|
.replace(/style="[^"]*"/g, '')
|
|
32
|
-
.replace(/xmlns="http:\/\/www.w3.org\/1999\/xhtml"/g, '')
|
|
32
|
+
.replace(/xmlns="http:\/\/www.w3.org\/1999\/xhtml"/g, '')
|
|
33
|
+
.replace(/xmlns:xlink="[^"]*"/g, 'xmlnsXlink="http://www.w3.org/1999/xlink"')
|
|
34
|
+
.replace(/xlink:href=/g, 'xlinkHref=');
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
// 케밥 케이스 변환 함수
|
|
@@ -59,7 +61,6 @@ export const generateTsxComponents = () => {
|
|
|
59
61
|
// 아이콘 Props 인터페이스 생성 함수
|
|
60
62
|
const IconProps = (additionalProps = '') => `{
|
|
61
63
|
fill?: boolean;
|
|
62
|
-
thick?: boolean;
|
|
63
64
|
className?: string;
|
|
64
65
|
${additionalProps}
|
|
65
66
|
${COLOR}?: BasicColorType;
|
|
@@ -80,8 +81,6 @@ export const generateTsxComponents = () => {
|
|
|
80
81
|
const variants = {
|
|
81
82
|
default: v.default,
|
|
82
83
|
fill: v.fill,
|
|
83
|
-
thick: v.thick,
|
|
84
|
-
'fill-thick': v['fill-thick'],
|
|
85
84
|
};
|
|
86
85
|
|
|
87
86
|
Object.entries(variants).forEach(([variant, svgString]) => {
|
|
@@ -119,16 +118,12 @@ import { iconSizeMap } from '@liner-fe/design-token-primitive';
|
|
|
119
118
|
import { IconProps } from '../../index';
|
|
120
119
|
|
|
121
120
|
export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
|
|
122
|
-
({ fill = false,
|
|
121
|
+
({ fill = false, size = 'm', type = 'neutral-label-primary', className, fillType = 'inverse-label-primary', ...props }, ref) => {
|
|
123
122
|
const iconSize = iconSizeMap[size];
|
|
124
|
-
if (fill
|
|
125
|
-
return ${variantSvgs['fill-thick'] || defaultSvg};
|
|
126
|
-
} else if (fill) {
|
|
123
|
+
if (fill) {
|
|
127
124
|
return ${variantSvgs.fill || defaultSvg};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
125
|
+
}
|
|
126
|
+
|
|
132
127
|
return ${variantSvgs.default || defaultSvg};
|
|
133
128
|
}
|
|
134
129
|
);
|
|
@@ -163,8 +158,7 @@ export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
|
|
|
163
158
|
const variantSvgs = processSvgVariants(variants);
|
|
164
159
|
|
|
165
160
|
if (Object.keys(variantSvgs).length > 0) {
|
|
166
|
-
const defaultSvg =
|
|
167
|
-
variantSvgs.default || variantSvgs.thick || Object.values(variantSvgs)[0];
|
|
161
|
+
const defaultSvg = variantSvgs.default || Object.values(variantSvgs)[0];
|
|
168
162
|
|
|
169
163
|
const tsxCode = generateTsxComponent(componentName, variantSvgs, defaultSvg);
|
|
170
164
|
|
|
@@ -201,7 +195,7 @@ export type IconSizeKey = keyof typeof iconSizeMap;
|
|
|
201
195
|
|
|
202
196
|
export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'fill' | 'name'> ${IconProps('size?: keyof typeof iconSizeMap;')}
|
|
203
197
|
|
|
204
|
-
export type ColorIconProps = Omit<IconProps, 'type' | 'fillType' | 'fill'
|
|
198
|
+
export type ColorIconProps = Omit<IconProps, 'type' | 'fillType' | 'fill'>;
|
|
205
199
|
|
|
206
200
|
export type IconComponentType = React.ForwardRefExoticComponent<
|
|
207
201
|
Omit<IconProps, 'ref'> & React.RefAttributes<SVGSVGElement>
|