antd-solid 0.0.10 → 0.0.12

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.
Files changed (78) hide show
  1. package/css/index.css +23 -6
  2. package/dist/index.esm.js +555 -152
  3. package/dist/index.umd.js +1 -1
  4. package/es/{Button.d.ts → Button/index.d.ts} +3 -2
  5. package/es/{Button.js → Button/index.js} +11 -9
  6. package/es/Button/index.scss.js +6 -0
  7. package/es/{Compact.js → Compact/index.js} +4 -4
  8. package/es/Drawer/index.d.ts +44 -0
  9. package/es/Drawer/index.js +162 -0
  10. package/es/Drawer/index.scss.js +6 -0
  11. package/es/Empty/index.d.ts +6 -2
  12. package/es/Empty/index.js +7 -2
  13. package/es/Input.js +3 -3
  14. package/es/InputNumber.js +1 -1
  15. package/es/Modal.js +23 -8
  16. package/es/Popconfirm.js +1 -1
  17. package/es/Progress/index.d.ts +24 -0
  18. package/es/Progress/index.js +81 -0
  19. package/es/Radio.js +25 -21
  20. package/es/Result.js +1 -1
  21. package/es/Select.js +2 -2
  22. package/es/Spin.d.ts +1 -0
  23. package/es/Spin.js +12 -6
  24. package/es/Switch.js +1 -1
  25. package/es/Tabs.js +2 -2
  26. package/es/Timeline.js +1 -1
  27. package/es/Tree.js +2 -2
  28. package/es/Upload.d.ts +56 -10
  29. package/es/Upload.js +93 -3
  30. package/es/hooks/createControllableValue.d.ts +1 -1
  31. package/es/hooks/createTransition.d.ts +8 -0
  32. package/es/hooks/createTransition.js +39 -0
  33. package/es/index.d.ts +5 -2
  34. package/es/index.js +5 -4
  35. package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +26 -0
  36. package/es/utils/solid.d.ts +4 -1
  37. package/es/utils/solid.js +9 -1
  38. package/package.json +3 -1
  39. package/src/Button/index.scss +9 -0
  40. package/src/{Button.tsx → Button/index.tsx} +23 -11
  41. package/src/Compact/index.tsx +20 -0
  42. package/src/Drawer/index.scss +53 -0
  43. package/src/Drawer/index.tsx +211 -0
  44. package/src/Empty/index.tsx +11 -6
  45. package/src/{form → Form}/FormItem.tsx +9 -7
  46. package/src/Input.tsx +2 -2
  47. package/src/InputNumber.tsx +34 -20
  48. package/src/Modal.tsx +37 -12
  49. package/src/Progress/index.tsx +81 -0
  50. package/src/Radio.tsx +26 -16
  51. package/src/Result.tsx +1 -1
  52. package/src/Select.tsx +14 -4
  53. package/src/Spin.tsx +16 -5
  54. package/src/Switch.tsx +1 -1
  55. package/src/Tabs.tsx +2 -2
  56. package/src/Timeline.tsx +1 -1
  57. package/src/Tree.tsx +4 -3
  58. package/src/Upload.tsx +138 -5
  59. package/src/hooks/createControllableValue.ts +3 -3
  60. package/src/hooks/createTransition.ts +52 -0
  61. package/src/index.ts +5 -2
  62. package/src/utils/solid.ts +9 -1
  63. package/es/Progress.d.ts +0 -7
  64. package/es/Progress.js +0 -6
  65. package/src/Compact.tsx +0 -15
  66. package/src/Progress.tsx +0 -4
  67. /package/es/{Compact.d.ts → Compact/index.d.ts} +0 -0
  68. /package/es/{form → Form}/Form.d.ts +0 -0
  69. /package/es/{form → Form}/Form.js +0 -0
  70. /package/es/{form → Form}/FormItem.d.ts +0 -0
  71. /package/es/{form → Form}/FormItem.js +0 -0
  72. /package/es/{form → Form}/context.d.ts +0 -0
  73. /package/es/{form → Form}/context.js +0 -0
  74. /package/es/{form → Form}/index.d.ts +0 -0
  75. /package/es/{form → Form}/index.js +0 -0
  76. /package/src/{form → Form}/Form.tsx +0 -0
  77. /package/src/{form → Form}/context.ts +0 -0
  78. /package/src/{form → Form}/index.ts +0 -0
@@ -0,0 +1,162 @@
1
+ import { delegateEvents, createComponent, use, insert, effect, className, Portal, template } from 'solid-js/web';
2
+ import { mergeProps, createSignal, createMemo, Show, untrack } from 'solid-js';
3
+ import cs from 'classnames';
4
+ import Button from '../Button/index.js';
5
+ import { setRef } from '../utils/solid.js';
6
+ import { Transition } from 'solid-transition-group';
7
+ import './index.scss.js';
8
+ import createTransition from '../hooks/createTransition.js';
9
+
10
+ const _tmpl$ = /*#__PURE__*/template(`<span class="i-ant-design:close-outlined">`),
11
+ _tmpl$2 = /*#__PURE__*/template(`<div><div><div class="ant-px-[var(--ant-padding-lg)] ant-py-[var(--ant-padding)] ant-flex ant-justify-between ant-items-center ant-[border-bottom:var(--ant-line-width)_solid_var(--ant-color-split)]"><div class="ant-flex ant-items-center"><span class="ant-text-[var(--ant-color-text)] ant-text-size-[var(--ant-font-size-lg)] ant-[font-weight:var(--ant-font-weight-strong)] ant-leading-[var(--ant-line-height-lg)]"></span></div><div></div></div><div class="ant-p-[var(--ant-padding-lg)] ant-overflow-auto">`);
12
+ const Drawer = _props => {
13
+ const props = mergeProps({
14
+ width: '378px',
15
+ height: '378px',
16
+ maskClosable: true,
17
+ placement: 'right',
18
+ getContainer: document.body
19
+ }, _props);
20
+ /**
21
+ * 控制是否打开/销毁
22
+ */
23
+ const [open, setOpen] = createSignal(false);
24
+ /**
25
+ * 控制显隐
26
+ */
27
+ const [hide, setHide] = createSignal(false);
28
+ let cleanup;
29
+ const container = createMemo(() => {
30
+ if (typeof props.getContainer === 'function') {
31
+ return props.getContainer();
32
+ }
33
+ if (props.getContainer instanceof HTMLElement) {
34
+ return props.getContainer;
35
+ }
36
+ return undefined;
37
+ });
38
+ const isBody = createMemo(() => container() === document.body);
39
+ const instance = {
40
+ open() {
41
+ setOpen(true);
42
+ setHide(false);
43
+ untrack(() => {
44
+ if (!isBody()) return;
45
+ const originOverflow = document.body.style.overflow;
46
+ document.body.style.overflow = 'hidden';
47
+ const onKeyup = e => {
48
+ if (e.key === 'Escape') {
49
+ instance.close();
50
+ }
51
+ };
52
+ document.addEventListener('keyup', onKeyup);
53
+ cleanup = () => {
54
+ document.body.style.overflow = originOverflow;
55
+ document.removeEventListener('keyup', onKeyup);
56
+ };
57
+ });
58
+ },
59
+ close() {
60
+ untrack(() => {
61
+ if (props.destroyOnClose) {
62
+ setOpen(false);
63
+ } else {
64
+ setHide(true);
65
+ }
66
+ cleanup?.();
67
+ });
68
+ }
69
+ };
70
+ setRef(props, instance);
71
+ let drawer;
72
+ createTransition(() => drawer, () => !hide(), 'ant-drawer-fade');
73
+ const direction = createMemo(() => ['top', 'bottom'].includes(props.placement) ? 'vertical' : 'horizontal');
74
+ const children = createComponent(Transition, {
75
+ name: "ant-drawer-fade",
76
+ get children() {
77
+ return createComponent(Show, {
78
+ get when() {
79
+ return open();
80
+ },
81
+ get children() {
82
+ const _el$ = _tmpl$2(),
83
+ _el$2 = _el$.firstChild,
84
+ _el$3 = _el$2.firstChild,
85
+ _el$4 = _el$3.firstChild,
86
+ _el$6 = _el$4.firstChild,
87
+ _el$7 = _el$4.nextSibling,
88
+ _el$8 = _el$3.nextSibling;
89
+ _el$.$$click = () => {
90
+ if (props.maskClosable) {
91
+ instance.close();
92
+ }
93
+ };
94
+ const _ref$ = drawer;
95
+ typeof _ref$ === "function" ? use(_ref$, _el$) : drawer = _el$;
96
+ _el$2.$$click = e => {
97
+ e.stopPropagation();
98
+ };
99
+ insert(_el$4, createComponent(Show, {
100
+ get when() {
101
+ return props.closeIcon !== false;
102
+ },
103
+ get children() {
104
+ return createComponent(Button, {
105
+ type: "text",
106
+ "class": "ant-mr-[var(--ant-margin-sm)] ant-text-size-[var(--ant-font-size-lg)] ant-h-[var(--ant-font-size-lg)] ant-leading-[var(--ant-font-size-lg)] hover:!ant-bg-transparent !ant-text-[var(--ant-color-icon)] hover:!ant-text-[var(--ant-color-icon-hover)] !ant-p-0",
107
+ onClick: () => {
108
+ instance?.close();
109
+ },
110
+ get children() {
111
+ return _tmpl$();
112
+ }
113
+ });
114
+ }
115
+ }), _el$6);
116
+ insert(_el$6, () => props.title);
117
+ insert(_el$7, () => props.extra);
118
+ insert(_el$8, () => props.children);
119
+ effect(_p$ => {
120
+ const _v$ = cs('ant-inset-0 ant-bg-[rgba(0,0,0,.45)] ant-z-1000', isBody() ? 'ant-fixed' : 'ant-absolute'),
121
+ _v$2 = cs('ant-drawer-content', {
122
+ left: 'ant-drawer-content-left',
123
+ right: 'ant-drawer-content-right',
124
+ top: 'ant-drawer-content-top',
125
+ bottom: 'ant-drawer-content-bottom'
126
+ }[props.placement], 'ant-absolute ant-bg-white ant-grid ant-[grid-template-rows:auto_1fr]'),
127
+ _v$3 = direction() === 'horizontal' ? props.width : undefined,
128
+ _v$4 = direction() === 'vertical' ? props.height : undefined;
129
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
130
+ _v$2 !== _p$._v$2 && className(_el$2, _p$._v$2 = _v$2);
131
+ _v$3 !== _p$._v$3 && ((_p$._v$3 = _v$3) != null ? _el$2.style.setProperty("width", _v$3) : _el$2.style.removeProperty("width"));
132
+ _v$4 !== _p$._v$4 && ((_p$._v$4 = _v$4) != null ? _el$2.style.setProperty("height", _v$4) : _el$2.style.removeProperty("height"));
133
+ return _p$;
134
+ }, {
135
+ _v$: undefined,
136
+ _v$2: undefined,
137
+ _v$3: undefined,
138
+ _v$4: undefined
139
+ });
140
+ return _el$;
141
+ }
142
+ });
143
+ }
144
+ });
145
+ return createComponent(Show, {
146
+ get when() {
147
+ return props.getContainer !== false;
148
+ },
149
+ fallback: children,
150
+ get children() {
151
+ return createComponent(Portal, {
152
+ get mount() {
153
+ return container();
154
+ },
155
+ children: children
156
+ });
157
+ }
158
+ });
159
+ };
160
+ delegateEvents(["click"]);
161
+
162
+ export { Drawer as default };
@@ -0,0 +1,6 @@
1
+ import styleInject from '../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".ant-drawer-content-right {\n top: 0;\n bottom: 0;\n right: 0;\n}\n\n.ant-drawer-content-left {\n top: 0;\n bottom: 0;\n left: 0;\n}\n\n.ant-drawer-content-top {\n top: 0;\n left: 0;\n right: 0;\n}\n\n.ant-drawer-content-bottom {\n bottom: 0;\n left: 0;\n right: 0;\n}\n\n.ant-drawer-fade-enter-active,\n.ant-drawer-fade-exit-active {\n transition: opacity 0.3s;\n}\n.ant-drawer-fade-enter-active .ant-drawer-content,\n.ant-drawer-fade-exit-active .ant-drawer-content {\n transition: transform 0.3s;\n}\n\n.ant-drawer-fade-enter,\n.ant-drawer-fade-exit-to {\n opacity: 0;\n}\n.ant-drawer-fade-enter .ant-drawer-content-right,\n.ant-drawer-fade-exit-to .ant-drawer-content-right {\n transform: translateX(100%);\n}\n.ant-drawer-fade-enter .ant-drawer-content-left,\n.ant-drawer-fade-exit-to .ant-drawer-content-left {\n transform: translateX(-100%);\n}\n.ant-drawer-fade-enter .ant-drawer-content-top,\n.ant-drawer-fade-exit-to .ant-drawer-content-top {\n transform: translateY(-100%);\n}\n.ant-drawer-fade-enter .ant-drawer-content-bottom,\n.ant-drawer-fade-exit-to .ant-drawer-content-bottom {\n transform: translateY(100%);\n}";
4
+ styleInject(css_248z);
5
+
6
+ export { css_248z as default };
@@ -1,5 +1,9 @@
1
- import { type Component } from 'solid-js';
2
- declare const Empty: Component & {
1
+ import { type Component, type JSX } from 'solid-js';
2
+ export interface EmptyProps {
3
+ class?: string;
4
+ style?: JSX.CSSProperties;
5
+ }
6
+ declare const Empty: Component<EmptyProps> & {
3
7
  PRESENTED_IMAGE_SIMPLE: Component;
4
8
  };
5
9
  export default Empty;
package/es/Empty/index.js CHANGED
@@ -1,12 +1,17 @@
1
- import { insert, createComponent, template } from 'solid-js/web';
1
+ import { spread, mergeProps, insert, createComponent, template } from 'solid-js/web';
2
2
  import PRESENTED_IMAGE_SIMPLE from './PRESENTED_IMAGE_SIMPLE.js';
3
3
  import EmptySvg from './assets/EmptySvg.js';
4
4
 
5
5
  const _tmpl$ = /*#__PURE__*/template(`<div><div class="ant-mb-[var(--ant-margin-xs)] ant-flex ant-justify-center"></div><div class="ant-text-[var(--ant-color-text)] ant-text-center">暂无数据`);
6
- const Empty = () => {
6
+ const Empty = props => {
7
7
  return (() => {
8
8
  const _el$ = _tmpl$(),
9
9
  _el$2 = _el$.firstChild;
10
+ spread(_el$, mergeProps(props, {
11
+ get style() {
12
+ return props.style;
13
+ }
14
+ }), false, true);
10
15
  insert(_el$2, createComponent(EmptySvg, {}));
11
16
  return _el$;
12
17
  })();
package/es/Input.js CHANGED
@@ -3,14 +3,14 @@ import { isNil, omit } from 'lodash-es';
3
3
  import { splitProps, createMemo, Show } from 'solid-js';
4
4
  import cs from 'classnames';
5
5
  import createControllableValue from './hooks/createControllableValue.js';
6
- import Compact from './Compact.js';
6
+ import Compact from './Compact/index.js';
7
7
 
8
8
  const _tmpl$ = /*#__PURE__*/template(`<div>`),
9
9
  _tmpl$2 = /*#__PURE__*/template(`<div class="ant-mr-4px">`),
10
10
  _tmpl$3 = /*#__PURE__*/template(`<div class="ant-ml-4px">`),
11
11
  _tmpl$4 = /*#__PURE__*/template(`<div class="ant-[display:var(--input-after-display)] ant-absolute ant-top-0 ant-bottom-0 ant-right-0 ant-h-[calc(100%-2px)] ant-translate-y-1px -ant-translate-x-1px">`);
12
12
  const statusClassDict = {
13
- default: disabled => cs('ant-[border:1px_solid_var(--ant-color-border)]', !disabled && 'hover:ant-border-[var(--primary-color)] focus-within:ant-border-[var(--primary-color)] focus-within:ant-[box-shadow:0_0_0_2px_rgba(5,145,255,0.1)]'),
13
+ default: disabled => cs('ant-[border:1px_solid_var(--ant-color-border)]', !disabled && 'hover:ant-border-[var(--ant-color-primary)] focus-within:ant-border-[var(--ant-color-primary)] focus-within:ant-[box-shadow:0_0_0_2px_rgba(5,145,255,0.1)]'),
14
14
  error: disabled => cs('ant-[border:1px_solid_var(--ant-color-error)]', !disabled && 'hover:ant-border-[var(--light-error-color)] focus-within:ant-[box-shadow:0_0_0_2px_rgba(255,38,5,.06)]'),
15
15
  warning: disabled => cs('ant-[border:1px_solid_var(--warning-color)]', !disabled && 'hover:ant-border-[var(--color-warning-border-hover)] focus-within:ant-[box-shadow:0_0_0_2px_rgba(255,215,5,.1)]')
16
16
  };
@@ -104,7 +104,7 @@ function CommonInput(props) {
104
104
  return _el$6;
105
105
  }
106
106
  }), null);
107
- effect(() => className(_el$3, cs('ant-flex ant-items-center ant-w-full ant-relative ant-[--input-after-display:none] hover:ant-[--input-after-display:block] p:hover-child[input]:ant-border-[var(--primary-color)]', inputWrapClass())));
107
+ effect(() => className(_el$3, cs('ant-flex ant-items-center ant-w-full ant-relative ant-[--input-after-display:none] hover:ant-[--input-after-display:block] p:hover-child[input]:ant-border-[var(--ant-color-primary)]', inputWrapClass())));
108
108
  return _el$3;
109
109
  }
110
110
  }), null);
package/es/InputNumber.js CHANGED
@@ -4,7 +4,7 @@ import { CommonInput } from './Input.js';
4
4
  import { isNil, clamp } from 'lodash-es';
5
5
  import { dispatchEventHandlerUnion } from './utils/solid.js';
6
6
 
7
- const _tmpl$ = /*#__PURE__*/template(`<div class="ant-flex ant-flex-col ant-h-full ant-w-24px ant-[border-left:1px_solid_var(--ant-color-border)]"><div class="ant-text-12px ant-flex ant-justify-center ant-items-center ant-h-1/2 ant-cursor-pointer ant-opacity-70 hover:ant-h-100% hover:ant-text-[var(--primary-color)] ant-transition-color ant-transition-height ant-transition-duration-500"><div class="i-ant-design:up-outlined"></div></div><div class="ant-[border-top:1px_solid_var(--ant-color-border)] ant-text-12px ant-flex ant-justify-center ant-items-center ant-h-1/2 ant-cursor-pointer ant-opacity-70 hover:ant-h-100% hover:ant-text-[var(--primary-color)] ant-transition-color ant-transition-height ant-transition-duration-500"><div class="i-ant-design:down-outlined">`);
7
+ const _tmpl$ = /*#__PURE__*/template(`<div class="ant-flex ant-flex-col ant-h-full ant-w-24px ant-[border-left:1px_solid_var(--ant-color-border)]"><div class="ant-text-12px ant-flex ant-justify-center ant-items-center ant-h-1/2 ant-cursor-pointer ant-opacity-70 hover:ant-h-100% hover:ant-text-[var(--ant-color-primary)] ant-transition-color ant-transition-height ant-transition-duration-500"><div class="i-ant-design:up-outlined"></div></div><div class="ant-[border-top:1px_solid_var(--ant-color-border)] ant-text-12px ant-flex ant-justify-center ant-items-center ant-h-1/2 ant-cursor-pointer ant-opacity-70 hover:ant-h-100% hover:ant-text-[var(--ant-color-primary)] ant-transition-color ant-transition-height ant-transition-duration-500"><div class="i-ant-design:down-outlined">`);
8
8
  const isEmptyValue = value => isNil(value) || value === '';
9
9
  const InputNumber = _props => {
10
10
  const props = mergeProps({
package/es/Modal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { delegateEvents, createComponent, Portal, insert, memo, effect, className, render, mergeProps as mergeProps$1, template } from 'solid-js/web';
2
2
  import { mergeProps, createSignal, untrack, Show } from 'solid-js';
3
- import Button from './Button.js';
3
+ import Button from './Button/index.js';
4
4
  import cs from 'classnames';
5
5
 
6
6
  const _tmpl$ = /*#__PURE__*/template(`<span class="i-ant-design:close-outlined">`),
@@ -16,10 +16,23 @@ 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
38
  untrack(() => {
@@ -28,6 +41,8 @@ function Modal(_props) {
28
41
  } else {
29
42
  setHide(true);
30
43
  }
44
+ cleanup();
45
+ props.afterClose?.();
31
46
  });
32
47
  }
33
48
  };
@@ -36,10 +51,6 @@ function Modal(_props) {
36
51
  props.ref?.(instance);
37
52
  }
38
53
  });
39
- const close = () => {
40
- instance.close();
41
- props.afterClose?.();
42
- };
43
54
  const [confirmLoading, setConfirmLoading] = createSignal(false);
44
55
  return createComponent(Show, {
45
56
  get when() {
@@ -51,7 +62,7 @@ function Modal(_props) {
51
62
  const _el$ = _tmpl$5();
52
63
  _el$.$$click = () => {
53
64
  if (props.maskClosable ?? true) {
54
- close();
65
+ instance.close();
55
66
  }
56
67
  };
57
68
  insert(_el$, createComponent(Show, {
@@ -78,7 +89,9 @@ function Modal(_props) {
78
89
  get ["class"]() {
79
90
  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
91
  },
81
- onClick: close,
92
+ onClick: () => {
93
+ instance.close();
94
+ },
82
95
  get children() {
83
96
  return _tmpl$();
84
97
  }
@@ -103,7 +116,9 @@ function Modal(_props) {
103
116
  get children() {
104
117
  const _el$7 = _tmpl$2();
105
118
  insert(_el$7, createComponent(Button, {
106
- onClick: close,
119
+ onClick: () => {
120
+ instance.close();
121
+ },
107
122
  children: "\u53D6\u6D88"
108
123
  }), null);
109
124
  insert(_el$7, createComponent(Button, {
package/es/Popconfirm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createComponent, mergeProps as mergeProps$1, insert, template } from 'solid-js/web';
2
2
  import { mergeProps, splitProps, createSignal, untrack } from 'solid-js';
3
- import Button from './Button.js';
3
+ import Button from './Button/index.js';
4
4
  import Tooltip from './Tooltip.js';
5
5
 
6
6
  const _tmpl$ = /*#__PURE__*/template(`<div><div class="ant-mb-8px ant-flex ant-items-center"><span class="i-ant-design:exclamation-circle-fill ant-text-#faad14"></span><span class="ant-ml-8px ant-text-[rgba(0,0,0,0.88)] ant-font-600"></span></div><div class="ant-ml-22px ant-mb-8px ant-text-[rgba(0,0,0,0.88)]"></div><div class="ant-text-right">`);
@@ -0,0 +1,24 @@
1
+ import { type Component } from 'solid-js';
2
+ export interface ProgressProps {
3
+ /**
4
+ * 百分比
5
+ * 默认 0
6
+ */
7
+ percent?: number;
8
+ /**
9
+ * 状态
10
+ */
11
+ status?: 'normal' | 'success' | 'error';
12
+ /**
13
+ * 'line' 类型进度条的高度
14
+ * 默认 8
15
+ */
16
+ height?: number;
17
+ /**
18
+ * 是否显示进度数值或状态图标
19
+ * 默认 true
20
+ */
21
+ showInfo?: boolean;
22
+ }
23
+ declare const Progress: Component<ProgressProps>;
24
+ export default Progress;
@@ -0,0 +1,81 @@
1
+ import { insert, createComponent, effect, className, template } from 'solid-js/web';
2
+ import { mergeProps, createMemo, 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(--ant-color-success)]">`),
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
+ height: 8,
13
+ showInfo: true
14
+ }, _props);
15
+ const status = createMemo(() => {
16
+ if (props.status) return props.status;
17
+ return props.percent >= 100 ? 'success' : 'normal';
18
+ });
19
+ return (() => {
20
+ const _el$ = _tmpl$4(),
21
+ _el$2 = _el$.firstChild;
22
+ _el$.style.setProperty("--ant-progress-remaining-color", "rgba(0, 0, 0, 0.06)");
23
+ insert(_el$, createComponent(Show, {
24
+ get when() {
25
+ return props.showInfo;
26
+ },
27
+ get children() {
28
+ const _el$3 = _tmpl$3();
29
+ insert(_el$3, createComponent(Switch, {
30
+ get fallback() {
31
+ return `${props.percent}%`;
32
+ },
33
+ get children() {
34
+ return [createComponent(Match, {
35
+ get when() {
36
+ return status() === 'success';
37
+ },
38
+ get children() {
39
+ return _tmpl$();
40
+ }
41
+ }), createComponent(Match, {
42
+ get when() {
43
+ return status() === 'error';
44
+ },
45
+ get children() {
46
+ return _tmpl$2();
47
+ }
48
+ })];
49
+ }
50
+ }));
51
+ return _el$3;
52
+ }
53
+ }), null);
54
+ effect(_p$ => {
55
+ const _v$ = cs('ant-w-full ant-bg-[var(--ant-progress-remaining-color)]', 'before:ant-content-empty before:ant-block before:ant-bg-[var(--color)] before:ant-w-[var(--percent)] before:ant-h-full before:ant-rounded-inherit'),
56
+ _v$2 = `${props.height}px`,
57
+ _v$3 = `${props.height / 2}px`,
58
+ _v$4 = `${props.percent}%`,
59
+ _v$5 = {
60
+ normal: 'var(--ant-color-primary)',
61
+ success: 'var(--ant-color-success)',
62
+ error: 'var(--ant-color-error)'
63
+ }[status()];
64
+ _v$ !== _p$._v$ && className(_el$2, _p$._v$ = _v$);
65
+ _v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$2.style.setProperty("height", _v$2) : _el$2.style.removeProperty("height"));
66
+ _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"));
67
+ _v$4 !== _p$._v$4 && ((_p$._v$4 = _v$4) != null ? _el$2.style.setProperty("--percent", _v$4) : _el$2.style.removeProperty("--percent"));
68
+ _v$5 !== _p$._v$5 && ((_p$._v$5 = _v$5) != null ? _el$2.style.setProperty("--color", _v$5) : _el$2.style.removeProperty("--color"));
69
+ return _p$;
70
+ }, {
71
+ _v$: undefined,
72
+ _v$2: undefined,
73
+ _v$3: undefined,
74
+ _v$4: undefined,
75
+ _v$5: undefined
76
+ });
77
+ return _el$;
78
+ })();
79
+ };
80
+
81
+ 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: undefined
14
+ trigger: null
15
15
  });
16
16
  return (() => {
17
17
  const _el$ = _tmpl$(),
18
- _el$2 = _el$.firstChild;
19
- _el$2.$$input = e => {
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.checked = checked());
25
- effect(() => _el$2.value = props.value ?? '');
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(--ant-color-primary)]')));
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: undefined
36
+ trigger: null
35
37
  });
36
38
  return (() => {
37
- const _el$3 = _tmpl$2(),
38
- _el$4 = _el$3.firstChild;
39
- _el$4.$$input = e => {
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$3, () => props.children, null);
44
- effect(() => className(_el$3, 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)]')));
45
- effect(() => _el$4.checked = checked());
46
- effect(() => _el$4.value = props.value ?? '');
47
- return _el$3;
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(--ant-color-primary)] not[:last-child]:ant-border-r-transparent ant-cursor-pointer ant-flex-grow ant-justify-center', checked() && 'ant-text-[var(--ant-color-primary)] ant-[border:1px_solid_var(--ant-color-primary)] !ant-border-r-[var(--ant-color-primary)]')));
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: undefined
57
+ trigger: null
56
58
  });
57
59
  const isChecked = createSelector(value);
58
60
  return (() => {
59
- const _el$5 = _tmpl$3();
60
- insert(_el$5, createComponent(For, {
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(() => props.onChange?.(e));
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$5, cs(props.block ? 'ant-flex' : 'ant-inline-flex', props.optionType === 'default' ? 'ant-gap-8px' : '')));
84
- return _el$5;
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"]);
package/es/Result.js CHANGED
@@ -4,7 +4,7 @@ import cs from 'classnames';
4
4
  const _tmpl$ = /*#__PURE__*/template(`<div class="ant-text-center ant-px-32px ant-py-48px"><div class="ant-mb-24px"><span></span></div><div class="ant-my-8px ant-text-[rgba(0,0,0,.88)] ant-text-24px"></div><div class="ant-text-[rgba(0,0,0,.45)] ant-text-14px"></div><div class="ant-mt-24px"></div><div class="ant-mt-24px">`);
5
5
  const statusIconMap = {
6
6
  success: 'ant-text-#52c41a i-ant-design:check-circle-filled',
7
- info: 'ant-text-[var(--primary-color)] i-ant-design:exclamation-circle-filled',
7
+ info: 'ant-text-[var(--ant-color-primary)] i-ant-design:exclamation-circle-filled',
8
8
  warning: 'ant-text-#faad14 i-ant-design:warning-filled',
9
9
  error: 'ant-text-#ff4d4f i-ant-design:close-circle-filled'
10
10
  };
package/es/Select.js CHANGED
@@ -47,7 +47,7 @@ const Select = props => {
47
47
  close();
48
48
  };
49
49
  insert(_el$7, () => item.label);
50
- effect(() => className(_el$7, cs('ant-box-content ant-px-12px ant-py-5px ant-h-22px ant-leading-22px hover:ant-bg-[var(--hover-bg-color)]', selectedValue(item.value) ? '!ant-bg-[var(--active-bg-color)]' : '')));
50
+ effect(() => className(_el$7, cs('ant-box-content ant-px-12px ant-py-5px ant-h-22px ant-leading-22px hover:ant-bg-[var(--hover-bg-color)]', selectedValue(item.value) ? '!ant-bg-[var(--ant-select-option-selected-bg)]' : '')));
51
51
  return _el$7;
52
52
  })()
53
53
  }));
@@ -103,7 +103,7 @@ const Select = props => {
103
103
  return _el$5;
104
104
  }
105
105
  }));
106
- effect(() => className(_el$, cs('ant-h-32px ant-leading-32px ant-rounded-6px ant-[border:1px_solid_var(--ant-color-border)] ant-px-11px focus:ant-[border-color:var(--primary-color)]', props.class)));
106
+ effect(() => className(_el$, cs('ant-h-32px ant-leading-32px ant-rounded-6px ant-[border:1px_solid_var(--ant-color-border)] ant-px-11px focus:ant-[border-color:var(--ant-color-primary)]', props.class)));
107
107
  return _el$;
108
108
  }
109
109
  });
package/es/Spin.d.ts CHANGED
@@ -4,6 +4,7 @@ interface SpinProps extends ParentProps {
4
4
  * 是否为加载中状态
5
5
  */
6
6
  spinning?: boolean;
7
+ size?: number;
7
8
  }
8
9
  declare const Spin: Component<SpinProps>;
9
10
  export default Spin;
package/es/Spin.js CHANGED
@@ -1,9 +1,12 @@
1
- import { insert, createComponent, template } from 'solid-js/web';
2
- import { Show } from 'solid-js';
1
+ import { insert, createComponent, effect, template } from 'solid-js/web';
2
+ import { mergeProps, Show } from 'solid-js';
3
3
 
4
- const _tmpl$ = /*#__PURE__*/template(`<div class="ant-absolute ant-inset-0 ant-flex ant-items-center ant-justify-center ant-bg-[rgba(255,255,255,.5)]"><span class="i-ant-design:loading keyframes-spin ant-[animation:spin_1s_linear_infinite] ant-text-32px ant-text-[var(--primary-color)]">`),
5
- _tmpl$2 = /*#__PURE__*/template(`<div class="ant-relative ant-min-h-32px">`);
6
- const Spin = props => {
4
+ const _tmpl$ = /*#__PURE__*/template(`<div class="ant-flex ant-items-center ant-justify-center ant-bg-[rgba(255,255,255,.5)]"><span class="i-ant-design:loading keyframes-spin ant-[animation:spin_1s_linear_infinite] ant-text-[var(--ant-color-primary)]">`),
5
+ _tmpl$2 = /*#__PURE__*/template(`<div>`);
6
+ const Spin = _props => {
7
+ const props = mergeProps({
8
+ size: 20
9
+ }, _props);
7
10
  return (() => {
8
11
  const _el$ = _tmpl$2();
9
12
  insert(_el$, () => props.children, null);
@@ -12,7 +15,10 @@ const Spin = props => {
12
15
  return props.spinning;
13
16
  },
14
17
  get children() {
15
- return _tmpl$();
18
+ const _el$2 = _tmpl$(),
19
+ _el$3 = _el$2.firstChild;
20
+ effect(() => `${props.size}px` != null ? _el$3.style.setProperty("font-size", `${props.size}px`) : _el$3.style.removeProperty("font-size"));
21
+ return _el$2;
16
22
  }
17
23
  }), null);
18
24
  return _el$;
package/es/Switch.js CHANGED
@@ -13,7 +13,7 @@ const Switch = props => {
13
13
  _el$2 = _el$.firstChild;
14
14
  _el$.$$click = () => setChecked(c => !c);
15
15
  effect(_p$ => {
16
- const _v$ = cs('ant-w-44px ant-h-22px ant-rounded-100px ant-relative', checked() ? 'ant-bg-[var(--primary-color)]' : 'ant-bg-[rgba(0,0,0,0.45)]'),
16
+ const _v$ = cs('ant-w-44px ant-h-22px ant-rounded-100px ant-relative', checked() ? 'ant-bg-[var(--ant-color-primary)]' : 'ant-bg-[rgba(0,0,0,0.45)]'),
17
17
  _v$2 = cs('ant-w-18px ant-h-18px ant-rounded-50% ant-bg-white ant-absolute ant-top-1/2 -ant-translate-y-1/2 ant-transition-left', checked() ? 'ant-left-[calc(100%-20px)]' : 'ant-left-2px');
18
18
  _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
19
19
  _v$2 !== _p$._v$2 && className(_el$2, _p$._v$2 = _v$2);
package/es/Tabs.js CHANGED
@@ -4,7 +4,7 @@ import cs from 'classnames';
4
4
  import Segmented from './Segmented/index.js';
5
5
  import { unwrapStringOrJSXElement } from './utils/solid.js';
6
6
 
7
- const _tmpl$ = /*#__PURE__*/template(`<div><div role="selected-bar" class="ant-absolute ant-bottom-0 ant-bg-[var(--primary-color)] ant-h-2px ant-transition-left">`),
7
+ const _tmpl$ = /*#__PURE__*/template(`<div><div role="selected-bar" class="ant-absolute ant-bottom-0 ant-bg-[var(--ant-color-primary)] ant-h-2px ant-transition-left">`),
8
8
  _tmpl$2 = /*#__PURE__*/template(`<div><div>`),
9
9
  _tmpl$3 = /*#__PURE__*/template(`<div>`);
10
10
  const Tabs = _props => {
@@ -63,7 +63,7 @@ const Tabs = _props => {
63
63
  updateSelectedBarStyle();
64
64
  };
65
65
  insert(_el$5, () => unwrapStringOrJSXElement(item.label));
66
- effect(() => className(_el$5, cs('ant-py-12px ant-cursor-pointer', props.navItemClass, isSelectedItem(item.key) && 'ant-text-[var(--primary-color)] selected')));
66
+ effect(() => className(_el$5, cs('ant-py-12px ant-cursor-pointer', props.navItemClass, isSelectedItem(item.key) && 'ant-text-[var(--ant-color-primary)] selected')));
67
67
  return _el$5;
68
68
  })()
69
69
  }), _el$3);
package/es/Timeline.js CHANGED
@@ -2,7 +2,7 @@ import { insert, createComponent, memo, template } from 'solid-js/web';
2
2
  import { For } from 'solid-js';
3
3
 
4
4
  const _tmpl$ = /*#__PURE__*/template(`<div class="ant-flex ant-flex-col ant-gap-[16px]">`),
5
- _tmpl$2 = /*#__PURE__*/template(`<div class="ant-flex ant-relative"><div class="ant-w-[10px] ant-h-[10px] ant-border-solid ant-border-width-[3px] ant-border-[var(--primary-color)] ant-bg-white ant-rounded-[50%] ant-mt-[8px]"></div><div class="ant-ml-[8px]">`),
5
+ _tmpl$2 = /*#__PURE__*/template(`<div class="ant-flex ant-relative"><div class="ant-w-[10px] ant-h-[10px] ant-border-solid ant-border-width-[3px] ant-border-[var(--ant-color-primary)] ant-bg-white ant-rounded-[50%] ant-mt-[8px]"></div><div class="ant-ml-[8px]">`),
6
6
  _tmpl$3 = /*#__PURE__*/template(`<div class="ant-absolute ant-top-[8px] ant-bottom-[-24px] ant-left-[4px] ant-w-[2px] ant-bg-[rgba(5,5,5,.06)]">`);
7
7
  const Timeline = props => {
8
8
  return (() => {