@apia/icons 4.0.102 → 5.0.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.
- package/dist/FileIcon.d.ts +10 -0
- package/dist/FileIcon.d.ts.map +1 -0
- package/dist/FileIcon.js +123 -0
- package/dist/FileIcon.js.map +1 -0
- package/dist/Icon.d.ts +16 -0
- package/dist/Icon.d.ts.map +1 -0
- package/dist/Icon.js +53 -0
- package/dist/Icon.js.map +1 -0
- package/dist/iconMap.d.ts +482 -0
- package/dist/iconMap.d.ts.map +1 -0
- package/dist/iconMap.js +243 -0
- package/dist/iconMap.js.map +1 -0
- package/dist/index.d.ts +3 -471
- package/dist/index.js +3 -395
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/LICENSE.md +0 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const FileIcon: ({ docName, iconSize, className, }: {
|
|
4
|
+
docName: string;
|
|
5
|
+
iconSize?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
className?: string;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { FileIcon };
|
|
10
|
+
//# sourceMappingURL=FileIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileIcon.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/FileIcon.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { injectStyles, Box, getVariant } from '@apia/theme';
|
|
3
|
+
|
|
4
|
+
function getFileExtension(fileName) {
|
|
5
|
+
return (fileName.match(/\.?([^.]+)$/) ?? [])[1] ?? "";
|
|
6
|
+
}
|
|
7
|
+
injectStyles("layout.common.components.fileIcon", {
|
|
8
|
+
"&": {
|
|
9
|
+
fontFamily: "Arial, Tahoma, sans-serif",
|
|
10
|
+
fontWeight: 300,
|
|
11
|
+
display: "inline-block",
|
|
12
|
+
width: "24px",
|
|
13
|
+
height: "32px",
|
|
14
|
+
background: "#018fef",
|
|
15
|
+
position: "relative",
|
|
16
|
+
borderRadius: "2px",
|
|
17
|
+
textAlign: "left",
|
|
18
|
+
WebkitFontSmoothing: "antialiased",
|
|
19
|
+
margin: "2px !important"
|
|
20
|
+
},
|
|
21
|
+
"&::before": {
|
|
22
|
+
display: "block",
|
|
23
|
+
content: '""',
|
|
24
|
+
position: "absolute",
|
|
25
|
+
top: "0",
|
|
26
|
+
right: "0",
|
|
27
|
+
width: "0",
|
|
28
|
+
height: "0",
|
|
29
|
+
borderBottomLeftRadius: "2px",
|
|
30
|
+
borderWidth: "5px",
|
|
31
|
+
borderStyle: "solid",
|
|
32
|
+
borderTopColor: "palette.background.paper",
|
|
33
|
+
borderRightColor: "palette.background.paper",
|
|
34
|
+
borderBottomColor: "rgba(255,255,255,.35)",
|
|
35
|
+
borderLeftColor: "rgba(255,255,255,.35)"
|
|
36
|
+
},
|
|
37
|
+
"&::after": {
|
|
38
|
+
display: "block",
|
|
39
|
+
content: "attr(data-extension)",
|
|
40
|
+
position: "absolute",
|
|
41
|
+
bottom: "0",
|
|
42
|
+
left: "0",
|
|
43
|
+
fontSize: "10px",
|
|
44
|
+
color: "#fff",
|
|
45
|
+
textTransform: "lowercase",
|
|
46
|
+
width: "100%",
|
|
47
|
+
padding: "2px",
|
|
48
|
+
whiteSpace: "nowrap",
|
|
49
|
+
overflow: "hidden"
|
|
50
|
+
},
|
|
51
|
+
"&.xs": { width: "12px", height: "16px", borderRadius: "2px" },
|
|
52
|
+
"&.xs::before": {
|
|
53
|
+
borderBottomLeftRadius: "1px",
|
|
54
|
+
borderWidth: "3px"
|
|
55
|
+
},
|
|
56
|
+
"&.xs::after": {
|
|
57
|
+
content: '""',
|
|
58
|
+
borderBottom: "2px solid rgba(255,255,255,.45)",
|
|
59
|
+
width: "auto",
|
|
60
|
+
left: "2px",
|
|
61
|
+
right: "2px",
|
|
62
|
+
bottom: "3px"
|
|
63
|
+
},
|
|
64
|
+
"&.sm": { width: "18px", height: "24px", borderRadius: "2px" },
|
|
65
|
+
"&.sm::before": {
|
|
66
|
+
borderBottomLeftRadius: "2px",
|
|
67
|
+
borderWidth: "4px"
|
|
68
|
+
},
|
|
69
|
+
"&.sm::after": { fontSize: "7px", padding: "2px" },
|
|
70
|
+
"&.lg": { width: "48px", height: "64px", borderRadius: "3px" },
|
|
71
|
+
"&.lg::before": {
|
|
72
|
+
borderBottomLeftRadius: "2px",
|
|
73
|
+
borderWidth: "8px"
|
|
74
|
+
},
|
|
75
|
+
"&.lg::after": { fontSize: "11px", padding: "4px 6px" },
|
|
76
|
+
"&.lg.sm": { width: "30px", height: "40px", fontSize: "11px" },
|
|
77
|
+
"&.xl": { width: "96px", height: "128px", borderRadius: "4px" },
|
|
78
|
+
"&.xl::before": {
|
|
79
|
+
borderBottomLeftRadius: "4px",
|
|
80
|
+
borderWidth: "16px"
|
|
81
|
+
},
|
|
82
|
+
"&.xl::after": { fontSize: "24px", padding: "4px 10px" },
|
|
83
|
+
"&.sm.sm": { height: "18px" },
|
|
84
|
+
"&[data-extension=zip], &[data-extension=rar]": {
|
|
85
|
+
background: "#acacac"
|
|
86
|
+
},
|
|
87
|
+
"&[data-extension^=doc], &[data-extension^=docx], &[data-extension^=odt]": {
|
|
88
|
+
background: "#307cf1"
|
|
89
|
+
},
|
|
90
|
+
"&[data-extension^=xls], &[data-extension^=xlsx]": {
|
|
91
|
+
background: "#0f9d58"
|
|
92
|
+
},
|
|
93
|
+
"&[data-extension^=ppt]": { background: "#d24726" },
|
|
94
|
+
"&[data-extension=pdf]": { background: "#e13d34" },
|
|
95
|
+
"&[data-extension=txt]": { background: "#5eb533" },
|
|
96
|
+
"&[data-extension=mp3], &[data-extension=wma], &[data-extension=m4a], &[data-extension=flac]": {
|
|
97
|
+
background: "#8e44ad"
|
|
98
|
+
},
|
|
99
|
+
"&[data-extension=mp4], &[data-extension=wmv], &[data-extension=mov], &[data-extension=avi], &[data-extension=mkv]": {
|
|
100
|
+
background: "#7a3ce7"
|
|
101
|
+
},
|
|
102
|
+
"&[data-extension=bmp], &[data-extension=jpg], &[data-extension=jpeg], &[data-extension=gif], &[data-extension=png]": {
|
|
103
|
+
background: "#f4b400"
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
const FileIcon = ({
|
|
107
|
+
docName,
|
|
108
|
+
iconSize,
|
|
109
|
+
className
|
|
110
|
+
}) => {
|
|
111
|
+
const extension = getFileExtension(docName);
|
|
112
|
+
return /* @__PURE__ */ jsx(
|
|
113
|
+
Box,
|
|
114
|
+
{
|
|
115
|
+
className: `file__icon ${className || ""} ${iconSize ?? ""}`,
|
|
116
|
+
"data-extension": extension,
|
|
117
|
+
...getVariant("layout.common.components.fileIcon")
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { FileIcon };
|
|
123
|
+
//# sourceMappingURL=FileIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileIcon.js","sources":["../src/FileIcon.tsx"],"sourcesContent":["import { Box, getVariant, injectStyles } from '@apia/theme';\r\n\r\nfunction getFileExtension(fileName: string) {\r\n return (fileName.match(/\\.?([^.]+)$/) ?? [])[1] ?? '';\r\n}\r\n\r\ninjectStyles('layout.common.components.fileIcon', {\r\n '&': {\r\n fontFamily: 'Arial, Tahoma, sans-serif',\r\n fontWeight: 300,\r\n display: 'inline-block',\r\n width: '24px',\r\n height: '32px',\r\n background: '#018fef',\r\n position: 'relative',\r\n borderRadius: '2px',\r\n textAlign: 'left',\r\n WebkitFontSmoothing: 'antialiased',\r\n margin: '2px !important',\r\n },\r\n '&::before': {\r\n display: 'block',\r\n content: '\"\"',\r\n position: 'absolute',\r\n top: '0',\r\n right: '0',\r\n width: '0',\r\n height: '0',\r\n borderBottomLeftRadius: '2px',\r\n borderWidth: '5px',\r\n borderStyle: 'solid',\r\n borderTopColor: 'palette.background.paper',\r\n borderRightColor: 'palette.background.paper',\r\n borderBottomColor: 'rgba(255,255,255,.35)',\r\n borderLeftColor: 'rgba(255,255,255,.35)',\r\n },\r\n '&::after': {\r\n display: 'block',\r\n content: 'attr(data-extension)',\r\n position: 'absolute',\r\n bottom: '0',\r\n left: '0',\r\n fontSize: '10px',\r\n color: '#fff',\r\n textTransform: 'lowercase',\r\n width: '100%',\r\n padding: '2px',\r\n whiteSpace: 'nowrap',\r\n overflow: 'hidden',\r\n },\r\n '&.xs': { width: '12px', height: '16px', borderRadius: '2px' },\r\n '&.xs::before': {\r\n borderBottomLeftRadius: '1px',\r\n borderWidth: '3px',\r\n },\r\n '&.xs::after': {\r\n content: '\"\"',\r\n borderBottom: '2px solid rgba(255,255,255,.45)',\r\n width: 'auto',\r\n left: '2px',\r\n right: '2px',\r\n bottom: '3px',\r\n },\r\n '&.sm': { width: '18px', height: '24px', borderRadius: '2px' },\r\n '&.sm::before': {\r\n borderBottomLeftRadius: '2px',\r\n borderWidth: '4px',\r\n },\r\n '&.sm::after': { fontSize: '7px', padding: '2px' },\r\n '&.lg': { width: '48px', height: '64px', borderRadius: '3px' },\r\n '&.lg::before': {\r\n borderBottomLeftRadius: '2px',\r\n borderWidth: '8px',\r\n },\r\n '&.lg::after': { fontSize: '11px', padding: '4px 6px' },\r\n '&.lg.sm': { width: '30px', height: '40px', fontSize: '11px' },\r\n '&.xl': { width: '96px', height: '128px', borderRadius: '4px' },\r\n '&.xl::before': {\r\n borderBottomLeftRadius: '4px',\r\n borderWidth: '16px',\r\n },\r\n '&.xl::after': { fontSize: '24px', padding: '4px 10px' },\r\n '&.sm.sm': { height: '18px' },\r\n '&[data-extension=zip], &[data-extension=rar]': {\r\n background: '#acacac',\r\n },\r\n '&[data-extension^=doc], &[data-extension^=docx], &[data-extension^=odt]': {\r\n background: '#307cf1',\r\n },\r\n '&[data-extension^=xls], &[data-extension^=xlsx]': {\r\n background: '#0f9d58',\r\n },\r\n '&[data-extension^=ppt]': { background: '#d24726' },\r\n '&[data-extension=pdf]': { background: '#e13d34' },\r\n '&[data-extension=txt]': { background: '#5eb533' },\r\n '&[data-extension=mp3], &[data-extension=wma], &[data-extension=m4a], &[data-extension=flac]':\r\n {\r\n background: '#8e44ad',\r\n },\r\n '&[data-extension=mp4], &[data-extension=wmv], &[data-extension=mov], &[data-extension=avi], &[data-extension=mkv]':\r\n {\r\n background: '#7a3ce7',\r\n },\r\n '&[data-extension=bmp], &[data-extension=jpg], &[data-extension=jpeg], &[data-extension=gif], &[data-extension=png]':\r\n {\r\n background: '#f4b400',\r\n },\r\n});\r\n\r\nexport const FileIcon = ({\r\n docName,\r\n iconSize,\r\n className,\r\n}: {\r\n docName: string;\r\n iconSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\r\n className?: string;\r\n}) => {\r\n const extension = getFileExtension(docName);\r\n\r\n return (\r\n <Box\r\n className={`file__icon ${className || ''} ${iconSize ?? ''}`}\r\n data-extension={extension}\r\n {...getVariant('layout.common.components.fileIcon')}\r\n />\r\n );\r\n};\r\n"],"names":[],"mappings":";;;AAEA,SAAS,iBAAiB,QAAA,EAAkB;AAC1C,EAAA,OAAA,CAAQ,SAAS,KAAA,CAAM,aAAa,KAAK,EAAC,EAAG,CAAC,CAAA,IAAK,EAAA;AACrD;AAEA,YAAA,CAAa,mCAAA,EAAqC;AAAA,EAChD,GAAA,EAAK;AAAA,IACH,UAAA,EAAY,2BAAA;AAAA,IACZ,UAAA,EAAY,GAAA;AAAA,IACZ,OAAA,EAAS,cAAA;AAAA,IACT,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,MAAA;AAAA,IACR,UAAA,EAAY,SAAA;AAAA,IACZ,QAAA,EAAU,UAAA;AAAA,IACV,YAAA,EAAc,KAAA;AAAA,IACd,SAAA,EAAW,MAAA;AAAA,IACX,mBAAA,EAAqB,aAAA;AAAA,IACrB,MAAA,EAAQ;AAAA,GACV;AAAA,E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AAA,EACjD,6FAAA,EACE;AAAA,IACE,UAAA,EAAY;AAAA,GACd;AAAA,EACF,mHAAA,EACE;AAAA,IACE,UAAA,EAAY;AAAA,GACd;AAAA,EACF,oHAAA,EACE;AAAA,IACE,UAAA,EAAY;AAAA;AAElB,CAAC,CAAA;AAEM,MAAM,WAAW,CAAC;AAAA,EACvB,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,SAAA,GAAY,iBAAiB,OAAO,CAAA;AAE1C,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,WAAW,CAAA,WAAA,EAAc,SAAA,IAAa,EAAE,CAAA,CAAA,EAAI,YAAY,EAAE,CAAA,CAAA;AAAA,MAC1D,gBAAA,EAAgB,SAAA;AAAA,MACf,GAAG,WAAW,mCAAmC;AAAA;AAAA,GACpD;AAEJ;;;;"}
|
package/dist/Icon.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IconBaseProps } from '@meronex/icons';
|
|
2
|
+
import { RequireExactlyOne } from 'type-fest';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { TIconName, TIconType } from './iconMap.js';
|
|
5
|
+
|
|
6
|
+
type TIconArgs = RequireExactlyOne<{
|
|
7
|
+
icon: TIconName | TIconType;
|
|
8
|
+
name: TIconName;
|
|
9
|
+
}>;
|
|
10
|
+
declare const Icon: React__default.ForwardRefExoticComponent<(TIconArgs & IconBaseProps & {
|
|
11
|
+
title: string;
|
|
12
|
+
imageSrc?: string;
|
|
13
|
+
}) & React__default.RefAttributes<any>>;
|
|
14
|
+
|
|
15
|
+
export { Icon };
|
|
16
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/Icon.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { icons, isIconName } from './iconMap.js';
|
|
4
|
+
import { Box } from '@apia/theme';
|
|
5
|
+
|
|
6
|
+
const Icon = forwardRef(({ className, icon, name, size, ...props }, ref) => {
|
|
7
|
+
const IconComponent = (
|
|
8
|
+
// eslint-disable-next-line no-nested-ternary
|
|
9
|
+
icon === void 0 ? icons[name] : isIconName(icon) ? icons[icon] : icon
|
|
10
|
+
);
|
|
11
|
+
const sx = React.useMemo(() => {
|
|
12
|
+
return {
|
|
13
|
+
"&.icon__wrapper": {
|
|
14
|
+
display: "inline-flex",
|
|
15
|
+
p: 0,
|
|
16
|
+
m: 0,
|
|
17
|
+
svg: {
|
|
18
|
+
width: size,
|
|
19
|
+
height: size
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}, [size]);
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
Box,
|
|
26
|
+
{
|
|
27
|
+
ref,
|
|
28
|
+
as: "span",
|
|
29
|
+
className: `icon__wrapper ${className ?? ""}`,
|
|
30
|
+
sx,
|
|
31
|
+
children: props.imageSrc ? /* @__PURE__ */ jsx(
|
|
32
|
+
"img",
|
|
33
|
+
{
|
|
34
|
+
"aria-label": props["aria-label"] ?? props.title,
|
|
35
|
+
style: {
|
|
36
|
+
height: size,
|
|
37
|
+
width: size
|
|
38
|
+
},
|
|
39
|
+
src: props.imageSrc
|
|
40
|
+
}
|
|
41
|
+
) : /* @__PURE__ */ jsx(
|
|
42
|
+
IconComponent,
|
|
43
|
+
{
|
|
44
|
+
...props,
|
|
45
|
+
"aria-label": props["aria-label"] ?? props.title
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export { Icon };
|
|
53
|
+
//# sourceMappingURL=Icon.js.map
|
package/dist/Icon.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","sources":["../src/Icon.tsx"],"sourcesContent":["import { IconBaseProps } from '@meronex/icons';\r\nimport { RequireExactlyOne } from 'type-fest';\r\nimport React, { forwardRef } from 'react';\r\nimport { icons, isIconName, TIconName, TIconType } from './iconMap';\r\nimport { Box } from '@apia/theme';\r\n\r\ntype TIconArgs = RequireExactlyOne<{\r\n icon: TIconName | TIconType;\r\n name: TIconName;\r\n}>;\r\n\r\nexport const Icon = forwardRef<\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n any,\r\n TIconArgs & IconBaseProps & { title: string; imageSrc?: string }\r\n>(({ className, icon, name, size, ...props }, ref) => {\r\n const IconComponent =\r\n // eslint-disable-next-line no-nested-ternary\r\n icon === undefined ? icons[name] : isIconName(icon) ? icons[icon] : icon;\r\n\r\n const sx = React.useMemo(() => {\r\n return {\r\n '&.icon__wrapper': {\r\n display: 'inline-flex',\r\n p: 0,\r\n m: 0,\r\n\r\n svg: {\r\n width: size,\r\n height: size,\r\n },\r\n },\r\n };\r\n }, [size]);\r\n\r\n return (\r\n <Box\r\n ref={ref}\r\n as=\"span\"\r\n className={`icon__wrapper ${className ?? ''}`}\r\n sx={sx}\r\n >\r\n {props.imageSrc ? (\r\n <img\r\n aria-label={props['aria-label'] ?? props.title}\r\n style={{\r\n height: size,\r\n width: size,\r\n }}\r\n src={props.imageSrc}\r\n />\r\n ) : (\r\n <IconComponent\r\n {...props}\r\n aria-label={props['aria-label'] ?? props.title}\r\n />\r\n )}\r\n </Box>\r\n );\r\n});\r\n"],"names":[],"mappings":";;;;;AAWO,MAAM,IAAA,GAAO,UAAA,CAIlB,CAAC,EAAE,SAAA,EAAW,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AACpD,EAAA,MAAM,aAAA;AAAA;AAAA,IAEJ,IAAA,KAAS,MAAA,GAAY,KAAA,CAAM,IAAI,CAAA,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