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,211 @@
1
+ import {
2
+ mergeProps,
3
+ type Component,
4
+ Show,
5
+ type JSXElement,
6
+ type Ref,
7
+ createSignal,
8
+ untrack,
9
+ createMemo,
10
+ } from 'solid-js'
11
+ import cs from 'classnames'
12
+ import Button from '../Button'
13
+ import { setRef } from '../utils/solid'
14
+ import { Portal } from 'solid-js/web'
15
+ import { Transition } from 'solid-transition-group'
16
+ import './index.scss'
17
+ import createTransition from '../hooks/createTransition'
18
+
19
+ export interface DrawerInstance {
20
+ open: () => void
21
+ close: () => void
22
+ }
23
+
24
+ export interface DrawerProps {
25
+ ref?: Ref<DrawerInstance>
26
+ title?: JSXElement
27
+ extra?: JSXElement
28
+ children?: JSXElement
29
+ /**
30
+ * 宽度
31
+ * 默认 378px
32
+ */
33
+ width?: string
34
+ /**
35
+ * 高度,在 placement 为 top 或 bottom 时使用
36
+ * 默认 378px
37
+ */
38
+ height?: string
39
+ closeIcon?: boolean
40
+ /**
41
+ * 点击蒙层是否允许关闭
42
+ * 默认 true
43
+ */
44
+ maskClosable?: boolean
45
+ /**
46
+ * 关闭时销毁 Modal 里的子元素
47
+ */
48
+ destroyOnClose?: boolean
49
+ /**
50
+ * 抽屉的方向
51
+ * 默认 right
52
+ */
53
+ placement?: 'top' | 'right' | 'bottom' | 'left'
54
+ /**
55
+ * 指定 Drawer 挂载的节点,并在容器内展现,false 为挂载在当前位置
56
+ * 默认 body
57
+ */
58
+ getContainer?: HTMLElement | (() => HTMLElement) | false
59
+ }
60
+
61
+ const Drawer: Component<DrawerProps> = _props => {
62
+ const props = mergeProps(
63
+ {
64
+ width: '378px',
65
+ height: '378px',
66
+ maskClosable: true,
67
+ placement: 'right',
68
+ getContainer: document.body,
69
+ },
70
+ _props,
71
+ )
72
+
73
+ /**
74
+ * 控制是否打开/销毁
75
+ */
76
+ const [open, setOpen] = createSignal(false)
77
+ /**
78
+ * 控制显隐
79
+ */
80
+ const [hide, setHide] = createSignal(false)
81
+ let cleanup: (() => void) | undefined
82
+
83
+ const container = createMemo(() => {
84
+ if (typeof props.getContainer === 'function') {
85
+ return props.getContainer()
86
+ }
87
+ if (props.getContainer instanceof HTMLElement) {
88
+ return props.getContainer
89
+ }
90
+ return undefined
91
+ })
92
+ const isBody = createMemo(() => container() === document.body)
93
+
94
+ const instance: DrawerInstance = {
95
+ open() {
96
+ setOpen(true)
97
+ setHide(false)
98
+
99
+ untrack(() => {
100
+ if (!isBody()) return
101
+
102
+ const originOverflow = document.body.style.overflow
103
+ document.body.style.overflow = 'hidden'
104
+
105
+ const onKeyup = (e: KeyboardEvent) => {
106
+ if (e.key === 'Escape') {
107
+ instance.close()
108
+ }
109
+ }
110
+ document.addEventListener('keyup', onKeyup)
111
+
112
+ cleanup = () => {
113
+ document.body.style.overflow = originOverflow
114
+ document.removeEventListener('keyup', onKeyup)
115
+ }
116
+ })
117
+ },
118
+ close() {
119
+ untrack(() => {
120
+ if (props.destroyOnClose) {
121
+ setOpen(false)
122
+ } else {
123
+ setHide(true)
124
+ }
125
+
126
+ cleanup?.()
127
+ })
128
+ },
129
+ }
130
+ setRef(props, instance)
131
+
132
+ let drawer: HTMLDivElement | undefined
133
+ createTransition(
134
+ () => drawer,
135
+ () => !hide(),
136
+ 'ant-drawer-fade',
137
+ )
138
+
139
+ const direction = createMemo(() =>
140
+ ['top', 'bottom'].includes(props.placement) ? 'vertical' : 'horizontal',
141
+ )
142
+
143
+ const children = (
144
+ <Transition name="ant-drawer-fade">
145
+ <Show when={open()}>
146
+ <div
147
+ ref={drawer}
148
+ class={cs(
149
+ 'ant-inset-0 ant-bg-[rgba(0,0,0,.45)] ant-z-1000',
150
+ isBody() ? 'ant-fixed' : 'ant-absolute',
151
+ )}
152
+ onClick={() => {
153
+ if (props.maskClosable) {
154
+ instance.close()
155
+ }
156
+ }}
157
+ >
158
+ <div
159
+ class={cs(
160
+ 'ant-drawer-content',
161
+ {
162
+ left: 'ant-drawer-content-left',
163
+ right: 'ant-drawer-content-right',
164
+ top: 'ant-drawer-content-top',
165
+ bottom: 'ant-drawer-content-bottom',
166
+ }[props.placement],
167
+ 'ant-absolute ant-bg-white ant-grid ant-[grid-template-rows:auto_1fr]',
168
+ )}
169
+ style={{
170
+ width: direction() === 'horizontal' ? props.width : undefined,
171
+ height: direction() === 'vertical' ? props.height : undefined,
172
+ }}
173
+ onClick={e => {
174
+ e.stopPropagation()
175
+ }}
176
+ >
177
+ <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)]">
178
+ <div class="ant-flex ant-items-center">
179
+ <Show when={props.closeIcon !== false}>
180
+ <Button
181
+ type="text"
182
+ 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"
183
+ onClick={() => {
184
+ instance?.close()
185
+ }}
186
+ >
187
+ <span class="i-ant-design:close-outlined" />
188
+ </Button>
189
+ </Show>
190
+ <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)]">
191
+ {props.title}
192
+ </span>
193
+ </div>
194
+
195
+ <div>{props.extra}</div>
196
+ </div>
197
+ <div class="ant-p-[var(--ant-padding-lg)] ant-overflow-auto">{props.children}</div>
198
+ </div>
199
+ </div>
200
+ </Show>
201
+ </Transition>
202
+ )
203
+
204
+ return (
205
+ <Show when={props.getContainer !== false} fallback={children}>
206
+ <Portal mount={container()}>{children}</Portal>
207
+ </Show>
208
+ )
209
+ }
210
+
211
+ export default Drawer
@@ -1,16 +1,21 @@
1
- import { type Component } from 'solid-js'
1
+ import { type Component, type JSX } from 'solid-js'
2
2
  import PRESENTED_IMAGE_SIMPLE from './PRESENTED_IMAGE_SIMPLE'
3
3
  import EmptySvg from './assets/EmptySvg'
4
4
 
5
- const Empty: Component & {
5
+ export interface EmptyProps {
6
+ class?: string
7
+ style?: JSX.CSSProperties
8
+ }
9
+
10
+ const Empty: Component<EmptyProps> & {
6
11
  PRESENTED_IMAGE_SIMPLE: Component
7
- } = () => {
12
+ } = props => {
8
13
  return (
9
- <div>
10
- <div class='ant-mb-[var(--ant-margin-xs)] ant-flex ant-justify-center'>
14
+ <div {...props} style={props.style}>
15
+ <div class="ant-mb-[var(--ant-margin-xs)] ant-flex ant-justify-center">
11
16
  <EmptySvg />
12
17
  </div>
13
- <div class='ant-text-[var(--ant-color-text)] ant-text-center'>暂无数据</div>
18
+ <div class="ant-text-[var(--ant-color-text)] ant-text-center">暂无数据</div>
14
19
  </div>
15
20
  )
16
21
  }
@@ -67,7 +67,7 @@ const FormItem: Component<FormItemProps> = props => {
67
67
  })
68
68
 
69
69
  resizeObserver.observe(label)
70
-
70
+
71
71
  onCleanup(() => {
72
72
  setItemWidthDict(dict => {
73
73
  // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
@@ -84,13 +84,15 @@ const FormItem: Component<FormItemProps> = props => {
84
84
  'ant-shrink-0 ant-h-32px ant-leading-32px not[:empty]:ant-pr-8px ant-text-right ant-[white-space:nowrap]',
85
85
  hidden && 'ant-absolute ant-opacity-0',
86
86
  )}
87
- {...hidden ? {
88
- ref: (el) => {
89
- label = el
87
+ {...(hidden
88
+ ? {
89
+ ref: el => {
90
+ label = el
91
+ },
90
92
  }
91
- }: {
92
- style: { width: `${maxItemWidth() ?? 0}px` }
93
- }}
93
+ : {
94
+ style: { width: `${maxItemWidth() ?? 0}px` },
95
+ })}
94
96
  >
95
97
  <Show when={!isNil(props.required)}>
96
98
  <span class="ant-mr-4px ant-text-[var(--ant-color-error)]">*</span>
package/src/Input.tsx CHANGED
@@ -34,7 +34,7 @@ const statusClassDict = {
34
34
  cs(
35
35
  'ant-[border:1px_solid_var(--ant-color-border)]',
36
36
  !disabled &&
37
- '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)]',
37
+ '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)]',
38
38
  ),
39
39
  error: (disabled: boolean) =>
40
40
  cs(
@@ -138,7 +138,7 @@ export function CommonInput<T extends HTMLInputElement | HTMLTextAreaElement = H
138
138
  <Show when={hasPrefixOrSuffix()} fallback={inputJSX}>
139
139
  <div
140
140
  class={cs(
141
- '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)]',
141
+ '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)]',
142
142
  inputWrapClass(),
143
143
  )}
144
144
  >
@@ -1,4 +1,12 @@
1
- import { type Component, createEffect, on, splitProps, untrack, createSignal, mergeProps } from 'solid-js'
1
+ import {
2
+ type Component,
3
+ createEffect,
4
+ on,
5
+ splitProps,
6
+ untrack,
7
+ createSignal,
8
+ mergeProps,
9
+ } from 'solid-js'
2
10
  import { CommonInput, type InputProps } from './Input'
3
11
  import { clamp, isNil } from 'lodash-es'
4
12
  import { dispatchEventHandlerUnion } from './utils/solid'
@@ -18,22 +26,20 @@ export interface InputNumberProps
18
26
  const isEmptyValue = (value: number | string | null | undefined) => isNil(value) || value === ''
19
27
 
20
28
  const actionBtnClass =
21
- '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'
29
+ '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'
22
30
 
23
31
  const InputNumber: Component<InputNumberProps> = _props => {
24
- const props = mergeProps({
25
- min: -Infinity,
26
- max: Infinity,
27
- }, _props)
28
- const [_, inputProps] = splitProps(props, [
29
- 'defaultValue',
30
- 'value',
31
- 'onChange',
32
- 'onBlur',
33
- ])
32
+ const props = mergeProps(
33
+ {
34
+ min: -Infinity,
35
+ max: Infinity,
36
+ },
37
+ _props,
38
+ )
39
+ const [_, inputProps] = splitProps(props, ['defaultValue', 'value', 'onChange', 'onBlur'])
34
40
 
35
41
  const clampValue = (v: number) => untrack(() => clamp(v, props.min, props.max))
36
-
42
+
37
43
  let prev: number | null = null
38
44
  const updatePrev = (v: number | null) => {
39
45
  if (prev === v) return
@@ -42,12 +48,20 @@ const InputNumber: Component<InputNumberProps> = _props => {
42
48
  props.onChange?.(prev)
43
49
  }
44
50
 
45
- const [value, setValue] = createSignal<number | string | null | undefined>(untrack(() => props.value ?? props.defaultValue))
46
- createEffect(on(() => props.value, () => {
47
- setValue(props.value)
48
- }, {
49
- defer: true
50
- }))
51
+ const [value, setValue] = createSignal<number | string | null | undefined>(
52
+ untrack(() => props.value ?? props.defaultValue),
53
+ )
54
+ createEffect(
55
+ on(
56
+ () => props.value,
57
+ () => {
58
+ setValue(props.value)
59
+ },
60
+ {
61
+ defer: true,
62
+ },
63
+ ),
64
+ )
51
65
 
52
66
  const add = (addon: number) => {
53
67
  let newValue: number | null
@@ -104,7 +118,7 @@ const InputNumber: Component<InputNumberProps> = _props => {
104
118
 
105
119
  let newValueNum: number | null = Number(newValue)
106
120
  if (Number.isNaN(newValueNum)) return
107
-
121
+
108
122
  if (isEmptyValue(newValue)) {
109
123
  newValueNum = null
110
124
  } else {
package/src/Modal.tsx CHANGED
@@ -30,7 +30,7 @@ export interface ModalProps {
30
30
  closeIcon?: boolean
31
31
  footer?: boolean | ((modal: ModalInstance) => JSXElement)
32
32
  /**
33
- * 关闭时销毁 Modal 里的子元素
33
+ * 关闭时销毁 Modal 里的子元素
34
34
  */
35
35
  destroyOnClose?: boolean
36
36
  /**
@@ -51,11 +51,27 @@ function Modal(_props: ModalProps) {
51
51
  const props = mergeProps({ footer: true }, _props)
52
52
  const [open, setOpen] = createSignal(props.defaultOpen ?? false)
53
53
  const [hide, setHide] = createSignal(false)
54
+ let cleanup: () => void
54
55
 
55
56
  const instance: ModalInstance = {
56
57
  open() {
57
58
  setOpen(true)
58
59
  setHide(false)
60
+
61
+ const originOverflow = document.body.style.overflow
62
+ document.body.style.overflow = 'hidden'
63
+
64
+ const onKeyup = (e: KeyboardEvent) => {
65
+ if (e.key === 'Escape') {
66
+ instance.close()
67
+ }
68
+ }
69
+ document.addEventListener('keyup', onKeyup)
70
+
71
+ cleanup = () => {
72
+ document.body.style.overflow = originOverflow
73
+ document.removeEventListener('keyup', onKeyup)
74
+ }
59
75
  },
60
76
  close() {
61
77
  untrack(() => {
@@ -64,6 +80,9 @@ function Modal(_props: ModalProps) {
64
80
  } else {
65
81
  setHide(true)
66
82
  }
83
+
84
+ cleanup()
85
+ props.afterClose?.()
67
86
  })
68
87
  },
69
88
  }
@@ -73,11 +92,6 @@ function Modal(_props: ModalProps) {
73
92
  }
74
93
  })
75
94
 
76
- const close = () => {
77
- instance.close()
78
- props.afterClose?.()
79
- }
80
-
81
95
  const [confirmLoading, setConfirmLoading] = createSignal(false)
82
96
 
83
97
  return (
@@ -90,7 +104,7 @@ function Modal(_props: ModalProps) {
90
104
  )}
91
105
  onClick={() => {
92
106
  if (props.maskClosable ?? true) {
93
- close()
107
+ instance.close()
94
108
  }
95
109
  }}
96
110
  style={{ display: hide() ? 'none' : undefined }}
@@ -117,7 +131,9 @@ function Modal(_props: ModalProps) {
117
131
  class={cs(
118
132
  '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)]',
119
133
  )}
120
- onClick={close}
134
+ onClick={() => {
135
+ instance.close()
136
+ }}
121
137
  >
122
138
  <span class="i-ant-design:close-outlined" />
123
139
  </Button>
@@ -130,9 +146,18 @@ function Modal(_props: ModalProps) {
130
146
 
131
147
  <Show when={props.footer !== false}>
132
148
  <div class="ant-mt-12px">
133
- <Show when={typeof props.footer !== 'function'} fallback={typeof props.footer === 'function' && props.footer(instance)}>
134
- <div class='ant-flex ant-gap-8px ant-justify-end'>
135
- <Button onClick={close}>取消</Button>
149
+ <Show
150
+ when={typeof props.footer !== 'function'}
151
+ fallback={typeof props.footer === 'function' && props.footer(instance)}
152
+ >
153
+ <div class="ant-flex ant-gap-8px ant-justify-end">
154
+ <Button
155
+ onClick={() => {
156
+ instance.close()
157
+ }}
158
+ >
159
+ 取消
160
+ </Button>
136
161
  <Button
137
162
  type="primary"
138
163
  loading={confirmLoading()}
@@ -150,7 +175,7 @@ function Modal(_props: ModalProps) {
150
175
  }
151
176
  }}
152
177
  >
153
- 确定
178
+ 确定
154
179
  </Button>
155
180
  </div>
156
181
  </Show>
@@ -0,0 +1,81 @@
1
+ import { mergeProps, type Component, Switch, Match, Show, createMemo } from 'solid-js'
2
+ import cs from 'classnames'
3
+
4
+ export interface ProgressProps {
5
+ /**
6
+ * 百分比
7
+ * 默认 0
8
+ */
9
+ percent?: number
10
+ /**
11
+ * 状态
12
+ */
13
+ status?: 'normal' | 'success' | 'error'
14
+ /**
15
+ * 'line' 类型进度条的高度
16
+ * 默认 8
17
+ */
18
+ height?: number
19
+ /**
20
+ * 是否显示进度数值或状态图标
21
+ * 默认 true
22
+ */
23
+ showInfo?: boolean
24
+ }
25
+
26
+ const Progress: Component<ProgressProps> = _props => {
27
+ const props = mergeProps(
28
+ {
29
+ percent: 0,
30
+ height: 8,
31
+ showInfo: true,
32
+ },
33
+ _props,
34
+ )
35
+
36
+ const status = createMemo(() => {
37
+ if (props.status) return props.status
38
+ return props.percent >= 100 ? 'success' : 'normal'
39
+ })
40
+
41
+ return (
42
+ <div
43
+ class="ant-flex ant-items-center"
44
+ style={{
45
+ '--ant-progress-remaining-color': 'rgba(0, 0, 0, 0.06)',
46
+ }}
47
+ >
48
+ <div
49
+ class={cs(
50
+ 'ant-w-full ant-bg-[var(--ant-progress-remaining-color)]',
51
+ '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',
52
+ )}
53
+ style={{
54
+ height: `${props.height}px`,
55
+ 'border-radius': `${props.height / 2}px`,
56
+ '--percent': `${props.percent}%`,
57
+ '--color': {
58
+ normal: 'var(--ant-color-primary)',
59
+ success: 'var(--ant-color-success)',
60
+ error: 'var(--ant-color-error)',
61
+ }[status()],
62
+ }}
63
+ />
64
+
65
+ <Show when={props.showInfo}>
66
+ <span class="ant-shrink-0 ant-min-w-40px ant-ml-8px ant-text-center">
67
+ <Switch fallback={`${props.percent}%`}>
68
+ <Match when={status() === 'success'}>
69
+ <span class="i-ant-design:check-circle-filled ant-text-[var(--ant-color-success)]" />
70
+ </Match>
71
+ <Match when={status() === 'error'}>
72
+ <span class="i-ant-design:close-circle-filled ant-text-[var(--ant-color-error)]" />
73
+ </Match>
74
+ </Switch>
75
+ </span>
76
+ </Show>
77
+ </div>
78
+ )
79
+ }
80
+
81
+ export default Progress
package/src/Radio.tsx CHANGED
@@ -39,20 +39,28 @@ const Radio: Component<RadioProps> & {
39
39
  defaultValue: false,
40
40
  defaultValuePropName: 'defaultChecked',
41
41
  valuePropName: 'checked',
42
- trigger: undefined,
42
+ trigger: null,
43
43
  })
44
44
 
45
45
  return (
46
- <label class="ant-inline-flex ant-gap-4px">
47
- <input
48
- checked={checked()}
49
- value={props.value ?? ''}
50
- type="radio"
51
- onInput={e => {
52
- setChecked(e.target.checked)
53
- untrack(() => props.onChange?.(e))
54
- }}
55
- />
46
+ <label class="ant-inline-flex ant-gap-4px ant-cursor-pointer ant-inline-flex ant-items-center">
47
+ <span
48
+ class={cs(
49
+ 'ant-w-16px ant-h-16px ant-rounded-50% ant-[border:1px_solid_var(--ant-color-border)]',
50
+ checked() && 'ant-[border:5px_solid_var(--ant-color-primary)]',
51
+ )}
52
+ >
53
+ <input
54
+ class="ant-m-0 ant-hidden"
55
+ checked={checked()}
56
+ value={props.value ?? ''}
57
+ type="radio"
58
+ onInput={e => {
59
+ setChecked(e.target.checked)
60
+ untrack(() => props.onChange?.(e))
61
+ }}
62
+ />
63
+ </span>
56
64
  {props.children}
57
65
  </label>
58
66
  )
@@ -63,15 +71,15 @@ Radio.Button = props => {
63
71
  defaultValue: false,
64
72
  defaultValuePropName: 'defaultChecked',
65
73
  valuePropName: 'checked',
66
- trigger: undefined,
74
+ trigger: null,
67
75
  })
68
76
 
69
77
  return (
70
78
  <label
71
79
  class={cs(
72
- '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',
80
+ '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',
73
81
  checked() &&
74
- 'ant-text-[var(--primary-color)] ant-[border:1px_solid_var(--primary-color)] !ant-border-r-[var(--primary-color)]',
82
+ 'ant-text-[var(--ant-color-primary)] ant-[border:1px_solid_var(--ant-color-primary)] !ant-border-r-[var(--ant-color-primary)]',
75
83
  )}
76
84
  >
77
85
  <input
@@ -97,7 +105,7 @@ Radio.Group = _props => {
97
105
  _props,
98
106
  )
99
107
  const [value, setValue] = createControllableValue<string>(props, {
100
- trigger: undefined,
108
+ trigger: null,
101
109
  })
102
110
  const isChecked = createSelector(value)
103
111
 
@@ -117,7 +125,9 @@ Radio.Group = _props => {
117
125
  onChange={
118
126
  (e => {
119
127
  setValue(option.value)
120
- untrack(() => props.onChange?.(e))
128
+ untrack(() => {
129
+ props.onChange?.(e)
130
+ })
121
131
  }) as JSX.ChangeEventHandler<HTMLInputElement, Event>
122
132
  }
123
133
  >
package/src/Result.tsx CHANGED
@@ -12,7 +12,7 @@ export interface ResultProps extends ParentProps {
12
12
 
13
13
  const statusIconMap = {
14
14
  success: 'ant-text-#52c41a i-ant-design:check-circle-filled',
15
- info: 'ant-text-[var(--primary-color)] i-ant-design:exclamation-circle-filled',
15
+ info: 'ant-text-[var(--ant-color-primary)] i-ant-design:exclamation-circle-filled',
16
16
  warning: 'ant-text-#faad14 i-ant-design:warning-filled',
17
17
  error: 'ant-text-#ff4d4f i-ant-design:close-circle-filled',
18
18
  }