@zuzjs/ui 0.3.2 → 0.3.4
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/README.md +0 -0
- package/dist/hooks.js +89 -0
- package/dist/styles.css +37 -62
- package/dist/ui.js +665 -0
- package/jest.config.js +0 -0
- package/package.json +16 -18
- package/rollup.config.js +30 -47
- package/src/comps/box.tsx +24 -28
- package/src/comps/button.tsx +23 -47
- package/src/comps/crumb.tsx +9 -0
- package/src/comps/form.tsx +57 -88
- package/src/comps/heading.tsx +25 -31
- package/src/comps/icon.tsx +24 -36
- package/src/comps/input.tsx +24 -224
- package/src/comps/select.tsx +23 -63
- package/src/comps/spinner.tsx +23 -35
- package/src/comps/stylesheet.tsx +5 -0
- package/src/context/AppContext.tsx +2 -2
- package/src/context/AppProvider.tsx +68 -105
- package/src/context/createSlice.tsx +15 -39
- package/src/context/index.tsx +4 -5
- package/src/core/css.ts +1 -0
- package/src/core/index.tsx +241 -0
- package/src/core/styles.ts +378 -371
- package/src/hooks/index.tsx +2 -10
- package/src/hooks/useDispatch.tsx +36 -36
- package/src/hooks/useStore.tsx +24 -26
- package/src/hooks.tsx +8 -0
- package/src/scss/mixins.scss +2 -2
- package/src/scss/props.scss +91 -69
- package/src/scss/{style.scss → styles.scss} +102 -132
- package/src/ui.tsx +13 -0
- package/tsconfig.json +0 -0
- package/tsconfig.lib.json +0 -0
- package/tsconfig.spec.json +0 -0
- package/dist/index.js +0 -1868
- package/src/actions/addForm.tsx +0 -0
- package/src/actions/index.tsx +0 -29
- package/src/actions/redo.tsx +0 -1
- package/src/actions/reset.tsx +0 -1
- package/src/actions/undo.tsx +0 -1
- package/src/comps/app.tsx +0 -34
- package/src/comps/checkbox.tsx +0 -74
- package/src/comps/component.tsx +0 -32
- package/src/comps/contextmenu.tsx +0 -60
- package/src/comps/cover.tsx +0 -34
- package/src/comps/image.tsx +0 -34
- package/src/comps/masonry.tsx +0 -192
- package/src/comps/mediaplayer.tsx +0 -12
- package/src/comps/placeholder.tsx +0 -58
- package/src/comps/root.tsx +0 -32
- package/src/comps/spacer.tsx +0 -20
- package/src/comps/text.tsx +0 -27
- package/src/comps/toaster.tsx +0 -117
- package/src/comps/tweet.tsx +0 -48
- package/src/context/_AppProvider.tsx +0 -116
- package/src/context/combineReducers.tsx +0 -47
- package/src/context/combineState.tsx +0 -14
- package/src/context/reduceReducers.tsx +0 -6
- package/src/context/store/appbase.tsx +0 -19
- package/src/context/store/lang.tsx +0 -26
- package/src/context/store/theme.tsx +0 -54
- package/src/core/defaultTheme.ts +0 -90
- package/src/core/extractCurrentDesignState.tsx +0 -0
- package/src/core/index.ts +0 -431
- package/src/core/router.ts +0 -86
- package/src/hooks/useAppReducer.tsx +0 -40
- package/src/hooks/useChooseEffect.tsx +0 -6
- package/src/hooks/useContextMenu.tsx +0 -123
- package/src/hooks/useDevice.tsx +0 -164
- package/src/hooks/useImage.tsx +0 -84
- package/src/hooks/useLang.tsx +0 -9
- package/src/hooks/useMediaPlayer.tsx +0 -27
- package/src/hooks/useNavigator.tsx +0 -6
- package/src/hooks/useRender.tsx +0 -29
- package/src/hooks/useResizeObserver.tsx +0 -84
- package/src/hooks/useRouter.tsx +0 -45
- package/src/hooks/useSelector.tsx +0 -9
- package/src/hooks/useTheme.tsx +0 -9
- package/src/hooks/useToast.tsx +0 -11
- package/src/index.tsx +0 -35
- package/src/kit/Builder.tsx +0 -18
- package/src/kit/Component.tsx +0 -32
- package/src/kit/Header.tsx +0 -21
- package/src/redux/slices/app.js +0 -26
- package/src/redux/slices/form.js +0 -46
- package/src/redux/store.js +0 -33
- package/src/scss/constants.scss +0 -4
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuzjs/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./dist/
|
|
7
|
+
".": "./dist/ui.js",
|
|
8
|
+
"./core": "./dist/index.js",
|
|
9
|
+
"./hooks": "./dist/hooks.js",
|
|
8
10
|
"./styles": "./dist/styles.css"
|
|
9
11
|
},
|
|
10
12
|
"scripts": {
|
|
@@ -13,35 +15,31 @@
|
|
|
13
15
|
"test": "jest"
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
16
|
-
"@emotion/react": "^11.10.6",
|
|
17
|
-
"@emotion/styled": "^11.10.6",
|
|
18
18
|
"@testing-library/react": "14.0.0",
|
|
19
19
|
"@types/jest": "^29.5.0",
|
|
20
20
|
"@types/react": "^18.0.31",
|
|
21
|
-
"axios": "^1.
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
21
|
+
"axios": "^1.6.2",
|
|
22
|
+
"hashids": "^2.3.0",
|
|
23
|
+
"jest": "^29.7.0",
|
|
24
|
+
"js-cookie": "^3.0.5",
|
|
25
|
+
"nanoid": "^5.0.4",
|
|
25
26
|
"prop-types": "^15.8.1",
|
|
26
27
|
"react": "18.2.0",
|
|
27
28
|
"react-children-utilities": "^2.9.0",
|
|
28
29
|
"react-dom": "18.2.0",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"typescript": "^5.0.2"
|
|
30
|
+
"ts-jest": "^29.1.1",
|
|
31
|
+
"tslib": "^2.6.2",
|
|
32
|
+
"typescript": "^5.3.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
36
36
|
"postcss": "^8.4.21",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"rollup": "^3.20.2",
|
|
37
|
+
"rimraf": "^5.0.5",
|
|
38
|
+
"rollup": "^4.8.0",
|
|
40
39
|
"rollup-plugin-livereload": "^2.0.5",
|
|
41
40
|
"rollup-plugin-scss": "^4.0.0",
|
|
42
|
-
"rollup-plugin-typescript2": "^0.
|
|
41
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
43
42
|
"rollup-plugin-uglify": "^6.0.4",
|
|
44
|
-
"sass": "^1.
|
|
45
|
-
"vite-plugin-environment": "^1.1.3"
|
|
43
|
+
"sass": "^1.69.5"
|
|
46
44
|
}
|
|
47
45
|
}
|
package/rollup.config.js
CHANGED
|
@@ -6,63 +6,46 @@ import livereload from 'rollup-plugin-livereload'
|
|
|
6
6
|
import { uglify } from 'rollup-plugin-uglify';
|
|
7
7
|
|
|
8
8
|
const isWatching = process && process.argv.includes('-w') || process.argv.includes('--watch')
|
|
9
|
+
const plugins = [
|
|
10
|
+
typescript(),
|
|
11
|
+
commonjs(),
|
|
12
|
+
scss({
|
|
13
|
+
processor: () => postcss(),
|
|
14
|
+
fileName: 'styles.css',
|
|
15
|
+
failOnError: true
|
|
16
|
+
}),
|
|
17
|
+
!isWatching && uglify()
|
|
18
|
+
// livereload()
|
|
19
|
+
]
|
|
20
|
+
const externals = [
|
|
21
|
+
"react","react-children-utilities","js-cookie","axios","nanoid","hashids","react/jsx-runtime","prop-types"
|
|
22
|
+
]
|
|
9
23
|
|
|
10
24
|
export default [
|
|
11
25
|
{
|
|
12
|
-
input: ["src/
|
|
26
|
+
input: ["src/ui.tsx"],
|
|
13
27
|
output: [
|
|
14
28
|
{
|
|
15
29
|
dir: "dist",
|
|
16
30
|
entryFileNames: "[name].js",
|
|
17
31
|
format: "es",
|
|
18
32
|
exports: "named",
|
|
19
|
-
// preserveModules: true,
|
|
20
|
-
// preserveModulesRoot: 'src',
|
|
21
33
|
}
|
|
22
34
|
],
|
|
23
|
-
plugins:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
plugins: plugins,
|
|
36
|
+
externals: externals
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
input: ["src/hooks.tsx"],
|
|
40
|
+
output: [
|
|
41
|
+
{
|
|
42
|
+
dir: "dist",
|
|
43
|
+
entryFileNames: "[name].js",
|
|
44
|
+
format: "es",
|
|
45
|
+
exports: "named",
|
|
46
|
+
}
|
|
33
47
|
],
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"@emotion/react","@emotion/styled","prop-types","react-hot-toast"
|
|
37
|
-
]
|
|
48
|
+
plugins: plugins,
|
|
49
|
+
externals: externals
|
|
38
50
|
}
|
|
39
|
-
|
|
40
|
-
// {
|
|
41
|
-
// input: ["src/kit/index.tsx"],
|
|
42
|
-
// output: [
|
|
43
|
-
// {
|
|
44
|
-
// dir: "dist",
|
|
45
|
-
// entryFileNames: "kit.js",
|
|
46
|
-
// format: "es",
|
|
47
|
-
// exports: "named",
|
|
48
|
-
// // preserveModules: true,
|
|
49
|
-
// // preserveModulesRoot: 'src',
|
|
50
|
-
// }
|
|
51
|
-
// ],
|
|
52
|
-
// plugins: [
|
|
53
|
-
// typescript(),
|
|
54
|
-
// // commonjs(),
|
|
55
|
-
// // scss({
|
|
56
|
-
// // processor: () => postcss(),
|
|
57
|
-
// // fileName: 'styles.css',
|
|
58
|
-
// // failOnError: true
|
|
59
|
-
// // }),
|
|
60
|
-
// // !isWatching && uglify()
|
|
61
|
-
// // livereload()
|
|
62
|
-
// ],
|
|
63
|
-
// // external: [
|
|
64
|
-
// // "react","react-children-utilities","js-cookie","axios","nanoid","@reduxjs/toolkit","react-redux","react/jsx-runtime",
|
|
65
|
-
// // "@emotion/react","@emotion/styled","prop-types","react-hot-toast"
|
|
66
|
-
// // ]
|
|
67
|
-
// }
|
|
68
|
-
];
|
|
51
|
+
]
|
package/src/comps/box.tsx
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export default Box;
|
|
1
|
+
import {
|
|
2
|
+
forwardRef
|
|
3
|
+
} from "react";
|
|
4
|
+
import {
|
|
5
|
+
cleanProps,
|
|
6
|
+
withStyle,
|
|
7
|
+
getStylesheet
|
|
8
|
+
} from "../core";
|
|
9
|
+
|
|
10
|
+
const Box = forwardRef(( props: { [ key: string ] : any }, ref) => {
|
|
11
|
+
|
|
12
|
+
const _styles = withStyle(props)
|
|
13
|
+
|
|
14
|
+
return <div
|
|
15
|
+
ref={props.ref || ref}
|
|
16
|
+
className={_styles}
|
|
17
|
+
{ ...cleanProps(props) }>
|
|
18
|
+
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
19
|
+
{/* {getStylesheet().join("")} */}
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default Box
|
package/src/comps/button.tsx
CHANGED
|
@@ -1,47 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<button
|
|
25
|
-
{...cleanProps(props)}
|
|
26
|
-
title={"title" in props ? props.title : undefined}
|
|
27
|
-
type={props.type}
|
|
28
|
-
className={`button${props.as ? ` ${props.as}` : ``} ${cx(css`
|
|
29
|
-
padding: 5px 10px;
|
|
30
|
-
border-radius: 2px;
|
|
31
|
-
${buildCSS(props)} &:hover {${buildCSS(props.hover || {})}} &:active {${buildCSS(props.active || {})}}`)}`}
|
|
32
|
-
ref={ref}
|
|
33
|
-
onDoubleClick={props.onDoubleClick || undefined}
|
|
34
|
-
onClick={e => {
|
|
35
|
-
if(props.form && props.type && props.type == 'submit'){
|
|
36
|
-
props.onSubmit(forms[props.form]);
|
|
37
|
-
}else{
|
|
38
|
-
props.onClick ? props.onClick(e) : () => console.warn('onClick Missing')
|
|
39
|
-
}
|
|
40
|
-
}} disabled={props.disabled || false} >{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}</button>
|
|
41
|
-
)
|
|
42
|
-
}}
|
|
43
|
-
</ClassNames>
|
|
44
|
-
)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
export default Button;
|
|
1
|
+
import {
|
|
2
|
+
LegacyRef,
|
|
3
|
+
forwardRef
|
|
4
|
+
} from "react";
|
|
5
|
+
import {
|
|
6
|
+
cleanProps,
|
|
7
|
+
withStyle
|
|
8
|
+
} from "../core";
|
|
9
|
+
|
|
10
|
+
const Button = forwardRef(( props: { [ key: string ] : any }, ref : LegacyRef<HTMLButtonElement>) => {
|
|
11
|
+
|
|
12
|
+
const _styles = withStyle(props)
|
|
13
|
+
|
|
14
|
+
return <button
|
|
15
|
+
ref={props.ref || ref}
|
|
16
|
+
className={_styles}
|
|
17
|
+
{ ...cleanProps(props) }>
|
|
18
|
+
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
19
|
+
</button>
|
|
20
|
+
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default Button
|
package/src/comps/form.tsx
CHANGED
|
@@ -1,89 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
dispatch(ADD_FORM(name, f.fields, forms))
|
|
59
|
-
}
|
|
60
|
-
}, [children, forms[name]?.loading])
|
|
61
|
-
|
|
62
|
-
return createElement(
|
|
63
|
-
Box,
|
|
64
|
-
{
|
|
65
|
-
rel: true,
|
|
66
|
-
...props,
|
|
67
|
-
as: name
|
|
68
|
-
},
|
|
69
|
-
[
|
|
70
|
-
_loading? <Cover key={`form-${name}-cover`} backdrop={cover?.filter || { saturate: 80, blur: 10 }} bg={cover?.bg || `rgba(0,0,0,0.5)`} /> : null,
|
|
71
|
-
_html
|
|
72
|
-
]
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
Form.defaultProps = {
|
|
78
|
-
name: 'form1',
|
|
79
|
-
onSubmit: () => { console.log(`onSubmit not provided`) }
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
Form.propTypes = {
|
|
83
|
-
name: PropTypes.string.isRequired,
|
|
84
|
-
children: PropTypes.node.isRequired,
|
|
85
|
-
onSubmit: PropTypes.func.isRequired
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
import Box from './box'
|
|
2
|
+
import { buildFormData, isEmail } from '../core'
|
|
3
|
+
// import { useEffect, useState } from 'react'
|
|
4
|
+
import Children from 'react-children-utilities'
|
|
5
|
+
|
|
6
|
+
const Form = (props: any) => {
|
|
7
|
+
|
|
8
|
+
const _props = { ...props }
|
|
9
|
+
delete _props['children']
|
|
10
|
+
const formName = `form-${props.name}`
|
|
11
|
+
const fields = []
|
|
12
|
+
|
|
13
|
+
const validateForm = () => {
|
|
14
|
+
const _data = buildFormData(document.querySelector(`form[name="${formName}"]`))
|
|
15
|
+
const data = []
|
|
16
|
+
_data.map(f => {
|
|
17
|
+
const id = Object.keys(f)[0]
|
|
18
|
+
const field = fields.find(x => x.name == id)
|
|
19
|
+
if(field){
|
|
20
|
+
const value = decodeURIComponent(f[id])
|
|
21
|
+
let valid = 'should' in field ? field.value != "" : true
|
|
22
|
+
if('should' in field){
|
|
23
|
+
switch(field.should){
|
|
24
|
+
case "email":
|
|
25
|
+
valid = isEmail(value)
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
data.push({ name: field.name, value: value, valid: valid })
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
if(props.onSubmit){
|
|
33
|
+
props.onSubmit({ validation: !data.find(x => x.valid == false), data: data })
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Children.deepMap(props.children, c => {
|
|
38
|
+
if(c['props'].name && !fields.find(x => x.name == c['props'].name)){
|
|
39
|
+
let xyz = { name: c['props'].name, touched: false }
|
|
40
|
+
if('should' in c['props']){
|
|
41
|
+
xyz['should'] = c['props'].should
|
|
42
|
+
}
|
|
43
|
+
fields.push(xyz)
|
|
44
|
+
}
|
|
45
|
+
return null
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
return <form name={formName} method={props.method || undefined} onSubmit={e => {
|
|
49
|
+
e.preventDefault(); e.stopPropagation();
|
|
50
|
+
validateForm()
|
|
51
|
+
}} >
|
|
52
|
+
<Box {..._props}>
|
|
53
|
+
{props.children}
|
|
54
|
+
</Box>
|
|
55
|
+
</form>
|
|
56
|
+
}
|
|
57
|
+
|
|
89
58
|
export default Form
|
package/src/comps/heading.tsx
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const Heading = forwardRef((props
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
>{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : children}</HeadingTag>}
|
|
27
|
-
</ClassNames>
|
|
28
|
-
)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
export default Heading;
|
|
1
|
+
import {
|
|
2
|
+
LegacyRef,
|
|
3
|
+
forwardRef
|
|
4
|
+
} from "react";
|
|
5
|
+
import {
|
|
6
|
+
cleanProps,
|
|
7
|
+
withStyle
|
|
8
|
+
} from "../core";
|
|
9
|
+
|
|
10
|
+
const Heading = forwardRef(( props: { [ key: string ] : any }, ref : LegacyRef<HTMLHeadingElement>) => {
|
|
11
|
+
|
|
12
|
+
const _styles = withStyle(props)
|
|
13
|
+
|
|
14
|
+
const Tag : string = `h${props.h || 1}`;
|
|
15
|
+
const HeadingTag = Tag as `h1` | `h2` | `h3` | `h4` | `h5` | `h6`
|
|
16
|
+
|
|
17
|
+
return <HeadingTag
|
|
18
|
+
className={_styles}
|
|
19
|
+
{ ...cleanProps(props) }>
|
|
20
|
+
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
21
|
+
</HeadingTag>
|
|
22
|
+
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export default Heading
|
package/src/comps/icon.tsx
CHANGED
|
@@ -1,36 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const Icon = forwardRef((props
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
as={`icon-${as}`}
|
|
26
|
-
ai={`c`}
|
|
27
|
-
jc={`c`}
|
|
28
|
-
size={size || 24}
|
|
29
|
-
color={color || `#111111`}
|
|
30
|
-
>
|
|
31
|
-
{path && Array(path).fill(undefined).map((p : any, i : any) => <span key={`ico-${as}-${i}`} className={`path${i+1}`} />)}
|
|
32
|
-
</Box>
|
|
33
|
-
)
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
export default Icon;
|
|
1
|
+
import {
|
|
2
|
+
forwardRef
|
|
3
|
+
} from "react";
|
|
4
|
+
import {
|
|
5
|
+
cleanProps,
|
|
6
|
+
withStyle,
|
|
7
|
+
getStylesheet
|
|
8
|
+
} from "../core";
|
|
9
|
+
|
|
10
|
+
const Icon = forwardRef(( props: { [ key: string ] : any }, ref) => {
|
|
11
|
+
|
|
12
|
+
const _styles = withStyle({ ...props, as: `icon-${props.as}`, size: props.size || 16 })
|
|
13
|
+
|
|
14
|
+
return <span
|
|
15
|
+
ref={props.ref || ref}
|
|
16
|
+
className={_styles}
|
|
17
|
+
{ ...cleanProps(props) }>
|
|
18
|
+
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
19
|
+
{/* {getStylesheet().join("")} */}
|
|
20
|
+
</span>
|
|
21
|
+
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default Icon
|