antd-solid 0.0.9 → 0.0.11
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/css/index.css +15 -2
- package/dist/index.esm.js +408 -102
- package/dist/index.umd.js +1 -1
- package/es/Button.js +2 -2
- package/es/Drawer/index.d.ts +44 -0
- package/es/Drawer/index.js +163 -0
- package/es/Drawer/index.scss.js +6 -0
- package/es/Modal.d.ts +5 -4
- package/es/Modal.js +28 -14
- package/es/Progress/index.d.ts +25 -0
- package/es/Progress/index.js +71 -0
- package/es/Radio.js +25 -21
- package/es/hooks/createControllableValue.d.ts +1 -1
- package/es/hooks/createTransition.d.ts +8 -0
- package/es/hooks/createTransition.js +39 -0
- package/es/index.d.ts +5 -2
- package/es/index.js +3 -2
- package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +26 -0
- package/es/utils/solid.d.ts +4 -1
- package/es/utils/solid.js +9 -1
- package/package.json +4 -2
- package/src/Button.tsx +8 -5
- package/src/Drawer/index.scss +53 -0
- package/src/Drawer/index.tsx +212 -0
- package/src/{form → Form}/FormItem.tsx +9 -7
- package/src/Modal.tsx +46 -22
- package/src/Progress/index.tsx +73 -0
- package/src/Radio.tsx +24 -14
- package/src/hooks/createControllableValue.ts +3 -3
- package/src/hooks/createTransition.ts +52 -0
- package/src/index.ts +5 -2
- package/src/utils/solid.ts +9 -1
- package/es/Progress.d.ts +0 -7
- package/es/Progress.js +0 -6
- package/src/Progress.tsx +0 -4
- /package/es/{form → Form}/Form.d.ts +0 -0
- /package/es/{form → Form}/Form.js +0 -0
- /package/es/{form → Form}/FormItem.d.ts +0 -0
- /package/es/{form → Form}/FormItem.js +0 -0
- /package/es/{form → Form}/context.d.ts +0 -0
- /package/es/{form → Form}/context.js +0 -0
- /package/es/{form → Form}/index.d.ts +0 -0
- /package/es/{form → Form}/index.js +0 -0
- /package/src/{form → Form}/Form.tsx +0 -0
- /package/src/{form → Form}/context.ts +0 -0
- /package/src/{form → Form}/index.ts +0 -0
package/es/Modal.js
CHANGED
|
@@ -16,19 +16,33 @@ function Modal(_props) {
|
|
|
16
16
|
}, _props);
|
|
17
17
|
const [open, setOpen] = createSignal(props.defaultOpen ?? false);
|
|
18
18
|
const [hide, setHide] = createSignal(false);
|
|
19
|
+
let cleanup;
|
|
19
20
|
const instance = {
|
|
20
21
|
open() {
|
|
21
22
|
setOpen(true);
|
|
22
23
|
setHide(false);
|
|
24
|
+
const originOverflow = document.body.style.overflow;
|
|
25
|
+
document.body.style.overflow = 'hidden';
|
|
26
|
+
const onKeyup = e => {
|
|
27
|
+
if (e.key === 'Escape') {
|
|
28
|
+
instance.close();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
document.addEventListener('keyup', onKeyup);
|
|
32
|
+
cleanup = () => {
|
|
33
|
+
document.body.style.overflow = originOverflow;
|
|
34
|
+
document.removeEventListener('keyup', onKeyup);
|
|
35
|
+
};
|
|
23
36
|
},
|
|
24
37
|
close() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
setHide(true);
|
|
39
|
+
cleanup();
|
|
40
|
+
props.afterClose?.();
|
|
41
|
+
},
|
|
42
|
+
destroy() {
|
|
43
|
+
setOpen(false);
|
|
44
|
+
cleanup();
|
|
45
|
+
props.afterClose?.();
|
|
32
46
|
}
|
|
33
47
|
};
|
|
34
48
|
untrack(() => {
|
|
@@ -36,10 +50,6 @@ function Modal(_props) {
|
|
|
36
50
|
props.ref?.(instance);
|
|
37
51
|
}
|
|
38
52
|
});
|
|
39
|
-
const close = () => {
|
|
40
|
-
instance.close();
|
|
41
|
-
props.afterClose?.();
|
|
42
|
-
};
|
|
43
53
|
const [confirmLoading, setConfirmLoading] = createSignal(false);
|
|
44
54
|
return createComponent(Show, {
|
|
45
55
|
get when() {
|
|
@@ -51,7 +61,7 @@ function Modal(_props) {
|
|
|
51
61
|
const _el$ = _tmpl$5();
|
|
52
62
|
_el$.$$click = () => {
|
|
53
63
|
if (props.maskClosable ?? true) {
|
|
54
|
-
close();
|
|
64
|
+
instance.close();
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
67
|
insert(_el$, createComponent(Show, {
|
|
@@ -78,7 +88,9 @@ function Modal(_props) {
|
|
|
78
88
|
get ["class"]() {
|
|
79
89
|
return cs('ant-rm-size-btn !ant-w-22px !ant-h-22px !ant-flex !ant-justify-center !ant-items-center ant-text-center ant-text-18px !ant-absolute !ant-top-16px !ant-right-16px ant-z-1000 ant-text-[rgba(0,0,0,.45)] hover:!ant-text-[rgba(0,0,0,.88)]');
|
|
80
90
|
},
|
|
81
|
-
onClick:
|
|
91
|
+
onClick: () => {
|
|
92
|
+
instance.close();
|
|
93
|
+
},
|
|
82
94
|
get children() {
|
|
83
95
|
return _tmpl$();
|
|
84
96
|
}
|
|
@@ -103,7 +115,9 @@ function Modal(_props) {
|
|
|
103
115
|
get children() {
|
|
104
116
|
const _el$7 = _tmpl$2();
|
|
105
117
|
insert(_el$7, createComponent(Button, {
|
|
106
|
-
onClick:
|
|
118
|
+
onClick: () => {
|
|
119
|
+
instance.close();
|
|
120
|
+
},
|
|
107
121
|
children: "\u53D6\u6D88"
|
|
108
122
|
}), null);
|
|
109
123
|
insert(_el$7, createComponent(Button, {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Component } from 'solid-js';
|
|
2
|
+
export interface ProgressProps {
|
|
3
|
+
/**
|
|
4
|
+
* 百分比
|
|
5
|
+
* 默认 0
|
|
6
|
+
*/
|
|
7
|
+
percent?: number;
|
|
8
|
+
/**
|
|
9
|
+
* 状态
|
|
10
|
+
* 默认 'default'
|
|
11
|
+
*/
|
|
12
|
+
status?: 'default' | 'success' | 'error';
|
|
13
|
+
/**
|
|
14
|
+
* 'line' 类型进度条的高度
|
|
15
|
+
* 默认 8
|
|
16
|
+
*/
|
|
17
|
+
height?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 是否显示进度数值或状态图标
|
|
20
|
+
* 默认 true
|
|
21
|
+
*/
|
|
22
|
+
showInfo?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const Progress: Component<ProgressProps>;
|
|
25
|
+
export default Progress;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { insert, createComponent, effect, className, template } from 'solid-js/web';
|
|
2
|
+
import { mergeProps, Show, Switch, Match } from 'solid-js';
|
|
3
|
+
import cs from 'classnames';
|
|
4
|
+
|
|
5
|
+
const _tmpl$ = /*#__PURE__*/template(`<span class="i-ant-design:check-circle-filled ant-text-[var(--primary-color)]">`),
|
|
6
|
+
_tmpl$2 = /*#__PURE__*/template(`<span class="i-ant-design:close-circle-filled ant-text-[var(--ant-color-error)]">`),
|
|
7
|
+
_tmpl$3 = /*#__PURE__*/template(`<span class="ant-shrink-0 ant-min-w-40px ant-ml-8px ant-text-center">`),
|
|
8
|
+
_tmpl$4 = /*#__PURE__*/template(`<div class="ant-flex ant-items-center"><div>`);
|
|
9
|
+
const Progress = _props => {
|
|
10
|
+
const props = mergeProps({
|
|
11
|
+
percent: 0,
|
|
12
|
+
status: 'default',
|
|
13
|
+
height: 8,
|
|
14
|
+
showInfo: true
|
|
15
|
+
}, _props);
|
|
16
|
+
return (() => {
|
|
17
|
+
const _el$ = _tmpl$4(),
|
|
18
|
+
_el$2 = _el$.firstChild;
|
|
19
|
+
_el$.style.setProperty("--ant-progress-remaining-color", "rgba(0, 0, 0, 0.06)");
|
|
20
|
+
insert(_el$, createComponent(Show, {
|
|
21
|
+
get when() {
|
|
22
|
+
return props.showInfo;
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
const _el$3 = _tmpl$3();
|
|
26
|
+
insert(_el$3, createComponent(Switch, {
|
|
27
|
+
get fallback() {
|
|
28
|
+
return `${props.percent}%`;
|
|
29
|
+
},
|
|
30
|
+
get children() {
|
|
31
|
+
return [createComponent(Match, {
|
|
32
|
+
get when() {
|
|
33
|
+
return props.status === 'success' || props.percent >= 100;
|
|
34
|
+
},
|
|
35
|
+
get children() {
|
|
36
|
+
return _tmpl$();
|
|
37
|
+
}
|
|
38
|
+
}), createComponent(Match, {
|
|
39
|
+
get when() {
|
|
40
|
+
return props.status === 'error';
|
|
41
|
+
},
|
|
42
|
+
get children() {
|
|
43
|
+
return _tmpl$2();
|
|
44
|
+
}
|
|
45
|
+
})];
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
48
|
+
return _el$3;
|
|
49
|
+
}
|
|
50
|
+
}), null);
|
|
51
|
+
effect(_p$ => {
|
|
52
|
+
const _v$ = cs('ant-w-full ant-bg-[var(--ant-progress-remaining-color)]', 'before:ant-content-empty before:ant-block before:ant-bg-[var(--primary-color)] before:ant-w-[var(--percent)] before:ant-h-full before:ant-rounded-inherit'),
|
|
53
|
+
_v$2 = `${props.height}px`,
|
|
54
|
+
_v$3 = `${props.height / 2}px`,
|
|
55
|
+
_v$4 = `${props.percent}%`;
|
|
56
|
+
_v$ !== _p$._v$ && className(_el$2, _p$._v$ = _v$);
|
|
57
|
+
_v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$2.style.setProperty("height", _v$2) : _el$2.style.removeProperty("height"));
|
|
58
|
+
_v$3 !== _p$._v$3 && ((_p$._v$3 = _v$3) != null ? _el$2.style.setProperty("border-radius", _v$3) : _el$2.style.removeProperty("border-radius"));
|
|
59
|
+
_v$4 !== _p$._v$4 && ((_p$._v$4 = _v$4) != null ? _el$2.style.setProperty("--percent", _v$4) : _el$2.style.removeProperty("--percent"));
|
|
60
|
+
return _p$;
|
|
61
|
+
}, {
|
|
62
|
+
_v$: undefined,
|
|
63
|
+
_v$2: undefined,
|
|
64
|
+
_v$3: undefined,
|
|
65
|
+
_v$4: undefined
|
|
66
|
+
});
|
|
67
|
+
return _el$;
|
|
68
|
+
})();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { Progress as default };
|
package/es/Radio.js
CHANGED
|
@@ -3,7 +3,7 @@ import { untrack, mergeProps, createSelector, For } from 'solid-js';
|
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import createControllableValue from './hooks/createControllableValue.js';
|
|
5
5
|
|
|
6
|
-
const _tmpl$ = /*#__PURE__*/template(`<label class="ant-inline-flex ant-gap-4px"><input type="radio">`),
|
|
6
|
+
const _tmpl$ = /*#__PURE__*/template(`<label class="ant-inline-flex ant-gap-4px ant-cursor-pointer ant-inline-flex ant-items-center"><span><input class="ant-m-0 ant-hidden" type="radio">`),
|
|
7
7
|
_tmpl$2 = /*#__PURE__*/template(`<label><input class="ant-w-0 ant-h-0" type="radio">`),
|
|
8
8
|
_tmpl$3 = /*#__PURE__*/template(`<div>`);
|
|
9
9
|
const Radio = props => {
|
|
@@ -11,18 +11,20 @@ const Radio = props => {
|
|
|
11
11
|
defaultValue: false,
|
|
12
12
|
defaultValuePropName: 'defaultChecked',
|
|
13
13
|
valuePropName: 'checked',
|
|
14
|
-
trigger:
|
|
14
|
+
trigger: null
|
|
15
15
|
});
|
|
16
16
|
return (() => {
|
|
17
17
|
const _el$ = _tmpl$(),
|
|
18
|
-
_el$2 = _el$.firstChild
|
|
19
|
-
|
|
18
|
+
_el$2 = _el$.firstChild,
|
|
19
|
+
_el$3 = _el$2.firstChild;
|
|
20
|
+
_el$3.$$input = e => {
|
|
20
21
|
setChecked(e.target.checked);
|
|
21
22
|
untrack(() => props.onChange?.(e));
|
|
22
23
|
};
|
|
23
24
|
insert(_el$, () => props.children, null);
|
|
24
|
-
effect(() => _el$2
|
|
25
|
-
effect(() => _el$
|
|
25
|
+
effect(() => className(_el$2, cs('ant-w-16px ant-h-16px ant-rounded-50% ant-[border:1px_solid_var(--ant-color-border)]', checked() && 'ant-[border:5px_solid_var(--primary-color)]')));
|
|
26
|
+
effect(() => _el$3.checked = checked());
|
|
27
|
+
effect(() => _el$3.value = props.value ?? '');
|
|
26
28
|
return _el$;
|
|
27
29
|
})();
|
|
28
30
|
};
|
|
@@ -31,20 +33,20 @@ Radio.Button = props => {
|
|
|
31
33
|
defaultValue: false,
|
|
32
34
|
defaultValuePropName: 'defaultChecked',
|
|
33
35
|
valuePropName: 'checked',
|
|
34
|
-
trigger:
|
|
36
|
+
trigger: null
|
|
35
37
|
});
|
|
36
38
|
return (() => {
|
|
37
|
-
const _el$
|
|
38
|
-
_el$
|
|
39
|
-
_el$
|
|
39
|
+
const _el$4 = _tmpl$2(),
|
|
40
|
+
_el$5 = _el$4.firstChild;
|
|
41
|
+
_el$5.$$input = e => {
|
|
40
42
|
setChecked(e.target.checked);
|
|
41
43
|
untrack(() => props.onChange?.(e));
|
|
42
44
|
};
|
|
43
|
-
insert(_el$
|
|
44
|
-
effect(() => className(_el$
|
|
45
|
-
effect(() => _el$
|
|
46
|
-
effect(() => _el$
|
|
47
|
-
return _el$
|
|
45
|
+
insert(_el$4, () => props.children, null);
|
|
46
|
+
effect(() => className(_el$4, cs('ant-px-15px ant-[border:1px_solid_rgb(217,217,217)] first:ant-rounded-l-6px last:ant-rounded-r-6px ant-h-32px ant-inline-flex ant-items-center hover:ant-text-[var(--primary-color)] not[:last-child]:ant-border-r-transparent ant-cursor-pointer ant-flex-grow ant-justify-center', checked() && 'ant-text-[var(--primary-color)] ant-[border:1px_solid_var(--primary-color)] !ant-border-r-[var(--primary-color)]')));
|
|
47
|
+
effect(() => _el$5.checked = checked());
|
|
48
|
+
effect(() => _el$5.value = props.value ?? '');
|
|
49
|
+
return _el$4;
|
|
48
50
|
})();
|
|
49
51
|
};
|
|
50
52
|
Radio.Group = _props => {
|
|
@@ -52,12 +54,12 @@ Radio.Group = _props => {
|
|
|
52
54
|
optionType: 'default'
|
|
53
55
|
}, _props);
|
|
54
56
|
const [value, setValue] = createControllableValue(props, {
|
|
55
|
-
trigger:
|
|
57
|
+
trigger: null
|
|
56
58
|
});
|
|
57
59
|
const isChecked = createSelector(value);
|
|
58
60
|
return (() => {
|
|
59
|
-
const _el$
|
|
60
|
-
insert(_el$
|
|
61
|
+
const _el$6 = _tmpl$3();
|
|
62
|
+
insert(_el$6, createComponent(For, {
|
|
61
63
|
get each() {
|
|
62
64
|
return props.options;
|
|
63
65
|
},
|
|
@@ -73,15 +75,17 @@ Radio.Group = _props => {
|
|
|
73
75
|
},
|
|
74
76
|
onChange: e => {
|
|
75
77
|
setValue(option.value);
|
|
76
|
-
untrack(() =>
|
|
78
|
+
untrack(() => {
|
|
79
|
+
props.onChange?.(e);
|
|
80
|
+
});
|
|
77
81
|
},
|
|
78
82
|
get children() {
|
|
79
83
|
return option.label;
|
|
80
84
|
}
|
|
81
85
|
})
|
|
82
86
|
}));
|
|
83
|
-
effect(() => className(_el$
|
|
84
|
-
return _el$
|
|
87
|
+
effect(() => className(_el$6, cs(props.block ? 'ant-flex' : 'ant-inline-flex', props.optionType === 'default' ? 'ant-gap-8px' : '')));
|
|
88
|
+
return _el$6;
|
|
85
89
|
})();
|
|
86
90
|
};
|
|
87
91
|
delegateEvents(["input"]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* dom 节点显示或隐藏时的动画
|
|
4
|
+
* @param target
|
|
5
|
+
* @param when
|
|
6
|
+
* @param className 动画类名
|
|
7
|
+
*/
|
|
8
|
+
export default function createTransition(target: Accessor<HTMLElement | undefined | null>, when: Accessor<boolean>, className: string): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createEffect, on } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* dom 节点显示或隐藏时的动画
|
|
5
|
+
* @param target
|
|
6
|
+
* @param when
|
|
7
|
+
* @param className 动画类名
|
|
8
|
+
*/
|
|
9
|
+
function createTransition(target, when, className) {
|
|
10
|
+
createEffect(on(when, input => {
|
|
11
|
+
const targetValue = target();
|
|
12
|
+
if (!targetValue) return;
|
|
13
|
+
if (input) {
|
|
14
|
+
targetValue.style.display = '';
|
|
15
|
+
targetValue.classList.add(`${className}-enter-active`, `${className}-enter`, `${className}-enter-to`);
|
|
16
|
+
requestAnimationFrame(() => {
|
|
17
|
+
targetValue.classList.remove(`${className}-enter`);
|
|
18
|
+
});
|
|
19
|
+
const onTransitionEnd = () => {
|
|
20
|
+
targetValue.classList.remove(`${className}-enter-active`, `${className}-enter-to`);
|
|
21
|
+
targetValue.removeEventListener('transitionend', onTransitionEnd);
|
|
22
|
+
};
|
|
23
|
+
targetValue.addEventListener('transitionend', onTransitionEnd);
|
|
24
|
+
} else {
|
|
25
|
+
targetValue.classList.add(`${className}-exit-active`, `${className}-exit`, `${className}-exit-to`);
|
|
26
|
+
requestAnimationFrame(() => {
|
|
27
|
+
targetValue.classList.remove(`${className}-exit`);
|
|
28
|
+
});
|
|
29
|
+
const onTransitionEnd = () => {
|
|
30
|
+
targetValue.style.display = 'none';
|
|
31
|
+
targetValue.classList.remove(`${className}-exit-active`, `${className}-exit-to`);
|
|
32
|
+
targetValue.removeEventListener('transitionend', onTransitionEnd);
|
|
33
|
+
};
|
|
34
|
+
targetValue.addEventListener('transitionend', onTransitionEnd);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { createTransition as default };
|
package/es/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export type { InputNumberProps } from './InputNumber';
|
|
|
6
6
|
export { default as Timeline } from './Timeline';
|
|
7
7
|
export { default as Modal } from './Modal';
|
|
8
8
|
export type { ModalInstance } from './Modal';
|
|
9
|
+
export { default as Drawer } from './Drawer';
|
|
10
|
+
export type { DrawerProps, DrawerInstance } from './Drawer';
|
|
9
11
|
export { default as DatePicker } from './DatePicker';
|
|
10
12
|
export { default as Select } from './Select';
|
|
11
13
|
export { default as Tree } from './Tree';
|
|
@@ -16,6 +18,7 @@ export { default as ColorPicker } from './ColorPicker';
|
|
|
16
18
|
export type { ColorPickerProps } from './ColorPicker';
|
|
17
19
|
export { default as Result } from './Result';
|
|
18
20
|
export { default as Progress } from './Progress';
|
|
21
|
+
export type { ProgressProps } from './Progress';
|
|
19
22
|
export { default as Tabs } from './Tabs';
|
|
20
23
|
export type { TabsProps, Tab } from './Tabs';
|
|
21
24
|
export { default as Popconfirm } from './Popconfirm';
|
|
@@ -23,8 +26,8 @@ export { default as Upload } from './Upload';
|
|
|
23
26
|
export type { UploadProps, UploadFile } from './Upload';
|
|
24
27
|
export { default as Radio } from './Radio';
|
|
25
28
|
export type { RadioProps, RadioGroupProps } from './Radio';
|
|
26
|
-
export { default as Form } from './
|
|
27
|
-
export type { FormInstance, FormProps, FormItemProps, FormItemComponentProps } from './
|
|
29
|
+
export { default as Form } from './Form';
|
|
30
|
+
export type { FormInstance, FormProps, FormItemProps, FormItemComponentProps } from './Form';
|
|
28
31
|
export { default as Switch } from './Switch';
|
|
29
32
|
export type { SwitchProps } from './Switch';
|
|
30
33
|
export { default as Skeleton } from './Skeleton';
|
package/es/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { default as Input } from './Input.js';
|
|
|
3
3
|
export { default as InputNumber } from './InputNumber.js';
|
|
4
4
|
export { default as Timeline } from './Timeline.js';
|
|
5
5
|
export { default as Modal } from './Modal.js';
|
|
6
|
+
export { default as Drawer } from './Drawer/index.js';
|
|
6
7
|
export { default as DatePicker } from './DatePicker.js';
|
|
7
8
|
export { default as Select } from './Select.js';
|
|
8
9
|
export { default as Tree } from './Tree.js';
|
|
@@ -10,12 +11,12 @@ export { default as Popover } from './Popover.js';
|
|
|
10
11
|
export { default as Tooltip } from './Tooltip.js';
|
|
11
12
|
export { default as ColorPicker } from './ColorPicker.js';
|
|
12
13
|
export { default as Result } from './Result.js';
|
|
13
|
-
export { default as Progress } from './Progress.js';
|
|
14
|
+
export { default as Progress } from './Progress/index.js';
|
|
14
15
|
export { default as Tabs } from './Tabs.js';
|
|
15
16
|
export { default as Popconfirm } from './Popconfirm.js';
|
|
16
17
|
export { default as Upload } from './Upload.js';
|
|
17
18
|
export { default as Radio } from './Radio.js';
|
|
18
|
-
export { default as Form } from './
|
|
19
|
+
export { default as Form } from './Form/index.js';
|
|
19
20
|
export { default as Switch } from './Switch.js';
|
|
20
21
|
export { default as Skeleton } from './Skeleton.js';
|
|
21
22
|
export { default as Spin } from './Spin.js';
|
package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function styleInject(css, ref) {
|
|
2
|
+
if (ref === void 0) ref = {};
|
|
3
|
+
var insertAt = ref.insertAt;
|
|
4
|
+
if (!css || typeof document === 'undefined') {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
8
|
+
var style = document.createElement('style');
|
|
9
|
+
style.type = 'text/css';
|
|
10
|
+
if (insertAt === 'top') {
|
|
11
|
+
if (head.firstChild) {
|
|
12
|
+
head.insertBefore(style, head.firstChild);
|
|
13
|
+
} else {
|
|
14
|
+
head.appendChild(style);
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
head.appendChild(style);
|
|
18
|
+
}
|
|
19
|
+
if (style.styleSheet) {
|
|
20
|
+
style.styleSheet.cssText = css;
|
|
21
|
+
} else {
|
|
22
|
+
style.appendChild(document.createTextNode(css));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { styleInject as default };
|
package/es/utils/solid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type JSXElement, type JSX } from 'solid-js';
|
|
2
|
+
import { type JSXElement, type JSX, type Ref } from 'solid-js';
|
|
3
3
|
import { type StringOrJSXElement } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* 判断 JSXElement 是否是基础类型
|
|
@@ -13,3 +13,6 @@ export declare function dispatchEventHandlerUnion<T, E extends Event>(handler: J
|
|
|
13
13
|
target: Element;
|
|
14
14
|
}): void;
|
|
15
15
|
export declare function unwrapStringOrJSXElement(value: StringOrJSXElement): JSXElement;
|
|
16
|
+
export declare function setRef<T>(props: {
|
|
17
|
+
ref?: Ref<T>;
|
|
18
|
+
}, value: T | null): void;
|
package/es/utils/solid.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { untrack } from 'solid-js';
|
|
2
3
|
import { isNil } from 'lodash-es';
|
|
3
4
|
import SolidToReact from './SolidToReact.js';
|
|
4
5
|
|
|
@@ -28,5 +29,12 @@ function dispatchEventHandlerUnion(handler, e) {
|
|
|
28
29
|
function unwrapStringOrJSXElement(value) {
|
|
29
30
|
return typeof value === 'function' ? value() : value;
|
|
30
31
|
}
|
|
32
|
+
function setRef(props, value) {
|
|
33
|
+
untrack(() => {
|
|
34
|
+
if (typeof props.ref === 'function') {
|
|
35
|
+
props.ref?.(value);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
31
39
|
|
|
32
|
-
export { dispatchEventHandlerUnion, isBaseType, solidToReact, unwrapStringOrJSXElement };
|
|
40
|
+
export { dispatchEventHandlerUnion, isBaseType, setRef, solidToReact, unwrapStringOrJSXElement };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
|
-
"types": "
|
|
6
|
+
"types": "es/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@iconify-json/ant-design": "^1.1.5",
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
"rollup": "^3.21.0",
|
|
39
39
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
40
40
|
"rollup-plugin-import-css": "^3.2.1",
|
|
41
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
41
42
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
43
|
+
"sass": "^1.69.6",
|
|
42
44
|
"typescript": "^5.1.6",
|
|
43
45
|
"vite-plugin-solid": "^2.7.0",
|
|
44
46
|
"vitepress": "1.0.0-rc.4",
|
package/src/Button.tsx
CHANGED
|
@@ -43,10 +43,10 @@ const typeClassMap = {
|
|
|
43
43
|
),
|
|
44
44
|
primary: (danger: boolean) =>
|
|
45
45
|
cs(
|
|
46
|
-
'ant-
|
|
46
|
+
'ant-text-white',
|
|
47
47
|
danger
|
|
48
|
-
? 'ant-bg-[var(--ant-color-error)] hover:ant-bg-[var(--light-error-color)] active:ant-bg-[var(--dark-error-color)]'
|
|
49
|
-
: 'ant-bg-[var(--primary-color)] hover:ant-bg-[var(--light-primary-color)] active:ant-bg-[var(--dark-primary-color)]',
|
|
48
|
+
? 'ant-[border:1px_solid_var(--ant-color-error)] ant-bg-[var(--ant-color-error)] hover:ant-[border-color:var(--light-error-color)] hover:ant-bg-[var(--light-error-color)] active:ant-[border-color:var(--dark-error-color)] active:ant-bg-[var(--dark-error-color)]'
|
|
49
|
+
: 'ant-[border:1px_solid_var(--primary-color)] ant-bg-[var(--primary-color)] hover:ant-[border-color:var(--light-primary-color)] hover:ant-bg-[var(--light-primary-color)] active:ant-[border-color:var(--dark-primary-color)] active:ant-bg-[var(--dark-primary-color)]',
|
|
50
50
|
),
|
|
51
51
|
dashed: (danger: boolean) =>
|
|
52
52
|
cs(
|
|
@@ -81,11 +81,12 @@ const Button: Component<ButtonProps> = props => {
|
|
|
81
81
|
ref={mergedProps.ref}
|
|
82
82
|
class={cs(
|
|
83
83
|
'ant-relative ant-cursor-pointer',
|
|
84
|
+
'focus-visible:ant-[outline:4px_solid_var(--ant-color-primary-border)] focus-visible:ant-[outline-offset:1px]',
|
|
84
85
|
mergedProps.class,
|
|
85
86
|
sizeClassMap[mergedProps.size!],
|
|
86
87
|
typeClassMap[mergedProps.type!](props.danger ?? false),
|
|
87
88
|
loading() && 'ant-opacity-65',
|
|
88
|
-
'ant-[--color:--light-primary-color]'
|
|
89
|
+
'ant-[--color:--light-primary-color]',
|
|
89
90
|
)}
|
|
90
91
|
style={mergedProps.style}
|
|
91
92
|
onClick={e => {
|
|
@@ -102,7 +103,9 @@ const Button: Component<ButtonProps> = props => {
|
|
|
102
103
|
) {
|
|
103
104
|
const div = document.createElement('div')
|
|
104
105
|
div.className = cs(
|
|
105
|
-
props.danger
|
|
106
|
+
props.danger
|
|
107
|
+
? 'ant-[--color:var(--light-error-color)]'
|
|
108
|
+
: 'ant-[--color:var(--light-primary-color)]',
|
|
106
109
|
'ant-absolute ant-inset-0 ant-rounded-inherit ant-[background:radial-gradient(var(--color),rgba(0,0,0,0))] ant-z--1 ant-keyframes-button-border[inset:0px][inset:-6px] ant-[animation:button-border_ease-out_0.3s]',
|
|
107
110
|
)
|
|
108
111
|
const onAnimationEnd = () => {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.ant-drawer-content-right {
|
|
2
|
+
top: 0;
|
|
3
|
+
bottom: 0;
|
|
4
|
+
right: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ant-drawer-content-left {
|
|
8
|
+
top: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ant-drawer-content-top {
|
|
14
|
+
top: 0;
|
|
15
|
+
left: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ant-drawer-content-bottom {
|
|
20
|
+
bottom: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
right: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ant-drawer-fade-enter-active,
|
|
26
|
+
.ant-drawer-fade-exit-active {
|
|
27
|
+
transition: opacity .3s;
|
|
28
|
+
|
|
29
|
+
.ant-drawer-content {
|
|
30
|
+
transition: transform .3s;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ant-drawer-fade-enter,
|
|
35
|
+
.ant-drawer-fade-exit-to {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
|
|
38
|
+
.ant-drawer-content-right {
|
|
39
|
+
transform: translateX(100%);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ant-drawer-content-left {
|
|
43
|
+
transform: translateX(-100%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ant-drawer-content-top {
|
|
47
|
+
transform: translateY(-100%);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ant-drawer-content-bottom {
|
|
51
|
+
transform: translateY(100%);
|
|
52
|
+
}
|
|
53
|
+
}
|