antd-solid 0.0.2 → 0.0.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.
Files changed (56) hide show
  1. package/dist/index.css +69 -0
  2. package/dist/index.esm.js +2369 -0
  3. package/dist/index.umd.js +1 -0
  4. package/package.json +32 -14
  5. package/src/index.ts +12 -5
  6. package/.eslintrc.cjs +0 -36
  7. package/.prettierrc +0 -11
  8. package/.vscode/settings.json +0 -13
  9. package/docs/.vitepress/components/Code.vue +0 -59
  10. package/docs/.vitepress/config.ts +0 -49
  11. package/docs/.vitepress/theme/index.css +0 -15
  12. package/docs/.vitepress/theme/index.ts +0 -13
  13. package/docs/components/Button.tsx +0 -20
  14. package/docs/components/Table.tsx +0 -34
  15. package/docs/components/button.md +0 -23
  16. package/docs/components/table.md +0 -23
  17. package/docs/index.md +0 -28
  18. package/rollup.config.js +0 -25
  19. package/src/Button.css +0 -14
  20. package/src/Button.tsx +0 -86
  21. package/src/ColorPicker.tsx +0 -66
  22. package/src/DatePicker.tsx +0 -12
  23. package/src/Form.tsx +0 -98
  24. package/src/Image.tsx +0 -29
  25. package/src/Input.tsx +0 -110
  26. package/src/InputNumber.test.tsx +0 -46
  27. package/src/InputNumber.tsx +0 -119
  28. package/src/Modal.tsx +0 -168
  29. package/src/Popconfirm.tsx +0 -73
  30. package/src/Popover.tsx +0 -30
  31. package/src/Progress.tsx +0 -4
  32. package/src/Radio.tsx +0 -132
  33. package/src/Result.tsx +0 -38
  34. package/src/Select.tsx +0 -6
  35. package/src/Skeleton.tsx +0 -14
  36. package/src/Spin.tsx +0 -23
  37. package/src/Switch.tsx +0 -34
  38. package/src/Table.tsx +0 -46
  39. package/src/Tabs.tsx +0 -88
  40. package/src/Timeline.tsx +0 -33
  41. package/src/Tooltip.tsx +0 -209
  42. package/src/Tree.tsx +0 -246
  43. package/src/Upload.tsx +0 -10
  44. package/src/hooks/createControllableValue.ts +0 -65
  45. package/src/hooks/createUpdateEffect.ts +0 -16
  46. package/src/hooks/index.ts +0 -2
  47. package/src/hooks/useClickAway.ts +0 -18
  48. package/src/hooks/useSize.ts +0 -26
  49. package/src/index.css +0 -21
  50. package/src/utils/ReactToSolid.tsx +0 -38
  51. package/src/utils/SolidToReact.tsx +0 -27
  52. package/src/utils/array.ts +0 -21
  53. package/src/utils/component.tsx +0 -85
  54. package/src/utils/solid.ts +0 -48
  55. package/tsconfig.json +0 -23
  56. package/unocss.config.ts +0 -92
package/src/Modal.tsx DELETED
@@ -1,168 +0,0 @@
1
- import { type JSXElement, Show, createSignal, untrack, Ref } from 'solid-js'
2
- import { Portal, render } from 'solid-js/web'
3
- import Button from './Button'
4
- import cs from 'classnames'
5
-
6
- export interface ModalInstance {
7
- open: () => void
8
- close: () => void
9
- }
10
-
11
- export interface ModalProps {
12
- ref?: Ref<ModalInstance>
13
- title?: JSXElement
14
- initialOpen?: boolean
15
- width?: string
16
- height?: string
17
- // open?: boolean
18
- children?: JSXElement
19
- /**
20
- * 垂直居中展示 Modal
21
- */
22
- centered?: boolean
23
- /**
24
- * 点击蒙层是否允许关闭
25
- * 默认 true
26
- */
27
- maskClosable?: boolean
28
- /**
29
- * 设置为 false 时隐藏关闭按钮
30
- */
31
- closeIcon?: boolean
32
- /**
33
- * 返回 true,会自动关闭 modal
34
- */
35
- onOk?: () => (boolean | Promise<boolean>)
36
- afterClose?: () => void
37
- }
38
-
39
- export interface MethodProps
40
- extends Pick<ModalProps, 'title' | 'children' | 'onOk' | 'afterClose'> {}
41
-
42
- function Modal(props: ModalProps) {
43
- const [open, setOpen] = createSignal(props.initialOpen ?? false)
44
- const close = () => {
45
- setOpen(false)
46
- props.afterClose?.()
47
- }
48
-
49
- const instance: ModalInstance = {
50
- open() {
51
- setOpen(true)
52
- },
53
- close() {
54
- setOpen(false)
55
- },
56
- }
57
- untrack(() => {
58
- if (typeof props.ref === 'function') {
59
- props.ref?.(instance)
60
- }
61
- })
62
-
63
- const [confirmLoading, setConfirmLoading] = createSignal(false)
64
-
65
- return (
66
- <Show when={open()}>
67
- <Portal>
68
- <div
69
- class={cs(
70
- 'ant-fixed ant-justify-center ant-inset-0 ant-bg-[rgba(0,0,0,.45)] ant-flex ant-z-1000',
71
- props.centered && 'ant-items-center',
72
- )}
73
- onClick={() => {
74
- if (props.maskClosable ?? true) {
75
- close()
76
- }
77
- }}
78
- >
79
- <div
80
- class={cs(
81
- 'ant-absolute ant-px-24px ant-py-20px ant-rounded-8px ant-overflow-hidden ant-bg-white ant-flex ant-flex-col',
82
- // '!ant-[animation-duration:.5s]',
83
- !props.centered && 'ant-top-100px',
84
- )}
85
- onClick={e => {
86
- e.stopPropagation()
87
- }}
88
- style={{
89
- width: props.width ?? '520px',
90
- height: props.height,
91
- }}
92
- >
93
- {/* 关闭按钮 */}
94
- <Show when={props.closeIcon !== false}>
95
- <Button
96
- type="text"
97
- class={cs(
98
- '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)]',
99
- )}
100
- onClick={close}
101
- >
102
- <span class="i-ant-design:close-outlined" />
103
- </Button>
104
- </Show>
105
-
106
- <div class="ant-text-[rgba(0,0,0,.88)] ant-text-16px ant-font-600 ant-mb-8px">{props.title}</div>
107
- <div class='ant-grow'>{props.children}</div>
108
-
109
- <div class="ant-text-right ant-mt-12px">
110
- <Button onClick={close}>取消</Button>
111
- <Button
112
- type="primary"
113
- class="!ant-ml-8px"
114
- loading={confirmLoading()}
115
- // eslint-disable-next-line solid/reactivity, @typescript-eslint/no-misused-promises
116
- onClick={async () => {
117
- if (!props.onOk) return
118
-
119
- let res = props.onOk?.()
120
- if (res instanceof Promise) {
121
- setConfirmLoading(true)
122
- res = await res.finally(() => setConfirmLoading(false))
123
- }
124
- if (res) {
125
- instance.close()
126
- }
127
- }}
128
- >
129
- 确定
130
- </Button>
131
- </div>
132
- </div>
133
- </div>
134
- </Portal>
135
- </Show>
136
- )
137
- }
138
-
139
- Modal.warning = (props: MethodProps) => {
140
- const div = document.createElement('div')
141
- document.body.appendChild(div)
142
- const dispose = render(
143
- () => (
144
- <Modal
145
- width="416px"
146
- maskClosable={false}
147
- closeIcon={false}
148
- {...props}
149
- title={
150
- <>
151
- <span class="i-ant-design:exclamation-circle ant-text-22px ant-mr-12px ant-text-[var(--warning-color)]" />
152
- {props.title}
153
- </>
154
- }
155
- children={<div class="ant-ml-34px">{props.children}</div>}
156
- initialOpen
157
- afterClose={() => {
158
- document.body.removeChild(div)
159
- dispose()
160
- props.afterClose?.()
161
- }}
162
- />
163
- ),
164
- div,
165
- )
166
- }
167
-
168
- export default Modal
@@ -1,73 +0,0 @@
1
- import { Component, JSXElement, createSignal, mergeProps, untrack } from 'solid-js'
2
- import Button from './Button'
3
- import Tooltip from './Tooltip'
4
-
5
- interface PopconfirmProps {
6
- title?: JSXElement
7
- content?: JSXElement
8
- children: JSXElement
9
- onCancel?: () => void
10
- onConfirm?: () => void
11
- /**
12
- * 确认按钮文字
13
- * 默认:确定
14
- */
15
- okText?: string
16
- /**
17
- * 取消按钮文字
18
- * 默认:取消
19
- */
20
- cancelText?: string
21
- }
22
-
23
- const Popconfirm: Component<PopconfirmProps> = props => {
24
- const mergedProps = mergeProps({ okText: '确定', cancelText: '取消' }, props)
25
- const [open, setOpen] = createSignal(false)
26
-
27
- return (
28
- <Tooltip
29
- mode="light"
30
- trigger="click"
31
- open={open()}
32
- onOpenChange={setOpen}
33
- content={
34
- <div>
35
- <div class="ant-mb-8px ant-flex ant-items-center">
36
- <span class="i-ant-design:exclamation-circle-fill ant-text-#faad14" />
37
- <span class="ant-ml-8px ant-text-[rgba(0,0,0,0.88)] ant-font-600">{mergedProps.title}</span>
38
- </div>
39
-
40
- <div class="ant-ml-22px ant-mb-8px ant-text-[rgba(0,0,0,0.88)]">{mergedProps.content}</div>
41
-
42
- <div class="ant-text-right">
43
- <Button
44
- class="ant-ml-8px"
45
- size="small"
46
- onClick={() => {
47
- setOpen(false)
48
- untrack(() => mergedProps.onCancel?.())
49
- }}
50
- >
51
- {mergedProps.cancelText}
52
- </Button>
53
- <Button
54
- class="ant-ml-8px"
55
- type="primary"
56
- size="small"
57
- onClick={() => {
58
- setOpen(false)
59
- untrack(() => mergedProps.onConfirm?.())
60
- }}
61
- >
62
- {mergedProps.okText}
63
- </Button>
64
- </div>
65
- </div>
66
- }
67
- >
68
- {mergedProps.children}
69
- </Tooltip>
70
- )
71
- }
72
-
73
- export default Popconfirm
package/src/Popover.tsx DELETED
@@ -1,30 +0,0 @@
1
- import { type Component, type JSXElement, Show } from 'solid-js'
2
- import Tooltip, { Content, type TooltipProps } from './Tooltip'
3
-
4
- interface PopoverProps extends TooltipProps {
5
- title?: JSXElement
6
- }
7
-
8
- const Popover: Component<PopoverProps> = props => {
9
- return (
10
- <Tooltip
11
- mode="light"
12
- {...props}
13
- content={close =>
14
- <div>
15
- <Show when={props.title}>
16
- <div class="ant-mb-8px ant-flex ant-items-center">
17
- <span class="ant-text-[rgba(0,0,0,0.88)] ant-font-600">{props.title}</span>
18
- </div>
19
- </Show>
20
-
21
- <div class="ant-text-[rgba(0,0,0,0.88)]">
22
- <Content content={props.content} close={close} />
23
- </div>
24
- </div>
25
- }
26
- />
27
- )
28
- }
29
-
30
- export default Popover
package/src/Progress.tsx DELETED
@@ -1,4 +0,0 @@
1
- import { Progress as ProgressAntd } from 'antd'
2
- import { reactToSolidComponent, replaceChildren, replaceClassName } from './utils/component'
3
-
4
- export default replaceChildren(replaceClassName(reactToSolidComponent(ProgressAntd)))
package/src/Radio.tsx DELETED
@@ -1,132 +0,0 @@
1
- import {
2
- type Component,
3
- type JSXElement,
4
- type ParentProps,
5
- type JSX,
6
- untrack,
7
- For,
8
- createSelector,
9
- mergeProps,
10
- } from 'solid-js'
11
- import { Dynamic } from 'solid-js/web'
12
- import cs from 'classnames'
13
- import createControllableValue from './hooks/createControllableValue'
14
-
15
- export interface RadioProps extends ParentProps {
16
- defaultChecked?: boolean
17
- checked?: boolean
18
- /**
19
- * input 的 value
20
- */
21
- value?: string
22
- onChange?: JSX.ChangeEventHandler<HTMLInputElement, Event>
23
- }
24
-
25
- export interface RadioGroupProps {
26
- defaultValue?: string
27
- value?: string
28
- onChange?: JSX.ChangeEventHandler<HTMLInputElement, Event>
29
- optionType?: 'default' | 'button'
30
- options: Array<{ label: JSXElement; value: string; disabled?: boolean }>
31
- block?: boolean
32
- }
33
-
34
- const Radio: Component<RadioProps> & {
35
- Group: Component<RadioGroupProps>
36
- Button: Component<RadioProps>
37
- } = props => {
38
- const [checked, setChecked] = createControllableValue(props, {
39
- defaultValue: false,
40
- defaultValuePropName: 'defaultChecked',
41
- valuePropName: 'checked',
42
- trigger: undefined,
43
- })
44
-
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
- />
56
- {props.children}
57
- </label>
58
- )
59
- }
60
-
61
- Radio.Button = props => {
62
- const [checked, setChecked] = createControllableValue(props, {
63
- defaultValue: false,
64
- defaultValuePropName: 'defaultChecked',
65
- valuePropName: 'checked',
66
- trigger: undefined,
67
- })
68
-
69
- return (
70
- <label
71
- 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',
73
- checked() &&
74
- 'ant-text-[var(--primary-color)] ant-[border:1px_solid_var(--primary-color)] !ant-border-r-[var(--primary-color)]',
75
- )}
76
- >
77
- <input
78
- class="ant-w-0 ant-h-0"
79
- checked={checked()}
80
- value={props.value ?? ''}
81
- type="radio"
82
- onInput={e => {
83
- setChecked(e.target.checked)
84
- untrack(() => props.onChange?.(e))
85
- }}
86
- />
87
- {props.children}
88
- </label>
89
- )
90
- }
91
-
92
- Radio.Group = _props => {
93
- const props = mergeProps(
94
- {
95
- optionType: 'default',
96
- } as RadioGroupProps,
97
- _props,
98
- )
99
- const [value, setValue] = createControllableValue<string>(props, {
100
- trigger: undefined,
101
- })
102
- const isChecked = createSelector(value)
103
-
104
- return (
105
- <div
106
- class={cs(
107
- props.block ? 'ant-flex' : 'ant-inline-flex',
108
- props.optionType === 'default' ? 'ant-gap-8px' : '',
109
- )}
110
- >
111
- <For each={props.options}>
112
- {option => (
113
- <Dynamic
114
- component={props.optionType === 'default' ? Radio : Radio.Button}
115
- checked={isChecked(option.value)}
116
- value={option.value}
117
- onChange={
118
- (e => {
119
- setValue(option.value)
120
- untrack(() => props.onChange?.(e))
121
- }) as JSX.ChangeEventHandler<HTMLInputElement, Event>
122
- }
123
- >
124
- {option.label}
125
- </Dynamic>
126
- )}
127
- </For>
128
- </div>
129
- )
130
- }
131
-
132
- export default Radio
package/src/Result.tsx DELETED
@@ -1,38 +0,0 @@
1
- import { type JSXElement, type Component, type ParentProps } from 'solid-js'
2
- import cs from 'classnames'
3
-
4
- type ResultStatusType = 'success' | 'error' | 'info' | 'warning'
5
-
6
- export interface ResultProps extends ParentProps {
7
- status?: ResultStatusType
8
- title?: JSXElement
9
- subTitle?: JSXElement
10
- extra?: JSXElement
11
- }
12
-
13
- const statusIconMap = {
14
- success: 'ant-text-#52c41a i-ant-design:check-circle-filled',
15
- info: 'ant-text-[var(--primary-color)] i-ant-design:exclamation-circle-filled',
16
- warning: 'ant-text-#faad14 i-ant-design:warning-filled',
17
- error: 'ant-text-#ff4d4f i-ant-design:close-circle-filled',
18
- }
19
-
20
- const Result: Component<ResultProps> = props => {
21
- return (
22
- <div class="ant-text-center ant-px-32px ant-py-48px">
23
- <div class="ant-mb-24px">
24
- <span class={cs(statusIconMap[props.status!], 'ant-text-72px')} />
25
- </div>
26
-
27
- <div class="ant-my-8px ant-text-[rgba(0,0,0,.88)] ant-text-24px">{props.title}</div>
28
-
29
- <div class="ant-text-[rgba(0,0,0,.45)] ant-text-14px">{props.subTitle}</div>
30
-
31
- <div class="ant-mt-24px">{props.extra}</div>
32
-
33
- <div class="ant-mt-24px">{props.children}</div>
34
- </div>
35
- )
36
- }
37
-
38
- export default Result
package/src/Select.tsx DELETED
@@ -1,6 +0,0 @@
1
- import { Select as SelectAntd } from 'antd'
2
- import { reactToSolidComponent, replaceClassName } from './utils/component'
3
-
4
- const Select = replaceClassName(reactToSolidComponent(SelectAntd))
5
-
6
- export default Select
package/src/Skeleton.tsx DELETED
@@ -1,14 +0,0 @@
1
- import { Skeleton as SkeletonAntd } from 'antd'
2
- import { reactToSolidComponent, replaceClassName } from './utils/component'
3
-
4
- const _Skeleton = replaceClassName(reactToSolidComponent(SkeletonAntd))
5
-
6
- const Image = replaceClassName(reactToSolidComponent(SkeletonAntd.Image))
7
-
8
- const Skeleton = _Skeleton as typeof _Skeleton & {
9
- Image: typeof Image
10
- }
11
-
12
- Skeleton.Image = Image
13
-
14
- export default Skeleton
package/src/Spin.tsx DELETED
@@ -1,23 +0,0 @@
1
- import { Show, type Component, type ParentProps } from 'solid-js'
2
-
3
- interface SpinProps extends ParentProps {
4
- /**
5
- * 是否为加载中状态
6
- */
7
- spinning?: boolean
8
- }
9
-
10
- const Spin: Component<SpinProps> = props => {
11
- return (
12
- <div class="ant-relative ant-min-h-32px">
13
- {props.children}
14
- <Show when={props.spinning}>
15
- <div class="ant-absolute ant-inset-0 ant-flex ant-items-center ant-justify-center ant-bg-[rgba(255,255,255,.5)]">
16
- <span class="i-ant-design:loading keyframes-spin ant-[animation:spin_1s_linear_infinite] ant-text-32px ant-text-[var(--primary-color)]" />
17
- </div>
18
- </Show>
19
- </div>
20
- )
21
- }
22
-
23
- export default Spin
package/src/Switch.tsx DELETED
@@ -1,34 +0,0 @@
1
- import { type Component } from 'solid-js'
2
- import createControllableValue from './hooks/createControllableValue'
3
- import cs from 'classnames'
4
-
5
- export interface SwitchProps {
6
- defaultChecked?: boolean
7
- checked?: boolean
8
- onChange?: (checked: boolean) => void
9
- }
10
-
11
- const Switch: Component<SwitchProps> = props => {
12
- const [checked, setChecked] = createControllableValue(props, {
13
- defaultValuePropName: 'defaultChecked',
14
- valuePropName: 'checked',
15
- })
16
- return (
17
- <button
18
- class={cs(
19
- 'ant-w-44px ant-h-22px ant-rounded-100px ant-relative',
20
- checked() ? 'ant-bg-[var(--primary-color)]' : 'ant-bg-[rgba(0,0,0,0.45)]',
21
- )}
22
- onClick={() => setChecked(c => !c)}
23
- >
24
- <div
25
- class={cs(
26
- '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',
27
- checked() ? 'ant-left-[calc(100%-20px)]' : 'ant-left-2px',
28
- )}
29
- />
30
- </button>
31
- )
32
- }
33
-
34
- export default Switch
package/src/Table.tsx DELETED
@@ -1,46 +0,0 @@
1
- import { type JSXElement, For } from 'solid-js'
2
-
3
- export interface Column<R extends {}> {
4
- title: JSXElement
5
- render: (row: R) => JSXElement
6
- }
7
-
8
- export interface TableProps<R extends {}> {
9
- columns: Array<Column<R>>
10
- dataSource: R[]
11
- }
12
-
13
- const Table = <R extends {}>(props: TableProps<R>) => {
14
- return (
15
- <table class="ant-w-full">
16
- <thead>
17
- <tr>
18
- <For each={props.columns}>
19
- {item => (
20
- <th class="ant-p-16px ant-bg-[var(--light-bg-color)] ant-font-bold ant-[border-bottom:1px_solid_var(--secondary-border-color)] ant-text-left">
21
- {item.title}
22
- </th>
23
- )}
24
- </For>
25
- </tr>
26
- </thead>
27
- <tbody>
28
- <For each={props.dataSource}>
29
- {row => (
30
- <tr class="hover:ant-bg-[var(--light-bg-color)]">
31
- <For each={props.columns}>
32
- {item => (
33
- <td class="ant-p-16px ant-[border-bottom:1px_solid_var(--secondary-border-color)]">
34
- {item.render(row)}
35
- </td>
36
- )}
37
- </For>
38
- </tr>
39
- )}
40
- </For>
41
- </tbody>
42
- </table>
43
- )
44
- }
45
-
46
- export default Table
package/src/Tabs.tsx DELETED
@@ -1,88 +0,0 @@
1
- import {
2
- type Component,
3
- For,
4
- type JSXElement,
5
- createSelector,
6
- createSignal,
7
- onMount,
8
- untrack,
9
- type JSX,
10
- Show,
11
- } from 'solid-js'
12
- import cs from 'classnames'
13
- import { isNil } from 'lodash-es'
14
-
15
- export interface Tab {
16
- key: string
17
- label: JSXElement
18
- children?: JSXElement
19
- }
20
-
21
- export interface TabsProps {
22
- class?: string
23
- navWrapClass?: string
24
- navItemClass?: string
25
- items: Tab[]
26
- }
27
-
28
- const Tabs: Component<TabsProps> = props => {
29
- const [selectedItem, setSelectedItem] = createSignal<Tab | undefined>(untrack(() => props.items[0]))
30
- const isSelectedItem = createSelector(() => selectedItem()?.key)
31
- const [selectedBarStyle, setSelectedBarStyle] = createSignal<JSX.CSSProperties>({
32
- left: '0px',
33
- width: '0px',
34
- })
35
- const updateSelectedBarStyle = (el: HTMLElement) => {
36
- setSelectedBarStyle({
37
- left: `${el.offsetLeft}px`,
38
- width: `${el.clientWidth}px`,
39
- })
40
- }
41
-
42
- let navWrap: HTMLDivElement
43
- onMount(() => {
44
- updateSelectedBarStyle(navWrap.children[0] as HTMLElement)
45
- })
46
-
47
- return (
48
- <div class={cs(props.class, 'ant-grid ant-[grid-template-rows:auto_1fr]')}>
49
- <div
50
- ref={navWrap!}
51
- class={cs(
52
- 'ant-flex ant-gap-32px ant-[border-bottom:solid_1px_rgba(5,5,5,0.1)] ant-relative',
53
- props.navWrapClass,
54
- )}
55
- >
56
- <For each={props.items}>
57
- {item => (
58
- <div
59
- class={cs(
60
- 'ant-py-12px ant-cursor-pointer',
61
- props.navItemClass,
62
- isSelectedItem(item.key) && 'ant-text-[var(--primary-color)]',
63
- )}
64
- onClick={e => {
65
- setSelectedItem(item)
66
- updateSelectedBarStyle(e.currentTarget)
67
- }}
68
- >
69
- {item.label}
70
- </div>
71
- )}
72
- </For>
73
-
74
- <div
75
- role={'selected-bar' as any}
76
- class="ant-absolute ant-bottom-0 ant-bg-[var(--primary-color)] ant-h-2px ant-transition-left"
77
- style={selectedBarStyle()}
78
- />
79
- </div>
80
-
81
- <Show when={!isNil(selectedItem()?.children)}>
82
- <div class="ant-px-12px ant-py-16px ant-overflow-auto">{selectedItem()?.children}</div>
83
- </Show>
84
- </div>
85
- )
86
- }
87
-
88
- export default Tabs
package/src/Timeline.tsx DELETED
@@ -1,33 +0,0 @@
1
- import { type Accessor, type Component, For, type JSXElement } from 'solid-js'
2
- import { type TimelineItemProps as TimelineItemAntdProps } from 'antd'
3
-
4
- interface TimelineItemProps extends Omit<TimelineItemAntdProps, 'children' | 'dot' | 'label'> {
5
- dot?: JSXElement
6
- label?: JSXElement
7
- children?: Accessor<JSXElement>
8
- }
9
-
10
- interface TimelineProps {
11
- class?: string
12
- items: TimelineItemProps[]
13
- }
14
-
15
- const Timeline: Component<TimelineProps> = props => {
16
- return (
17
- <div class="ant-flex ant-flex-col ant-gap-[16px]">
18
- <For each={props.items}>
19
- {(item, i) => (
20
- <div class="ant-flex ant-relative">
21
- {i() !== props.items.length - 1 && (
22
- <div class="ant-absolute ant-top-[8px] ant-bottom-[-24px] ant-left-[4px] ant-w-[2px] ant-bg-[rgba(5,5,5,.06)]" />
23
- )}
24
- <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]" />
25
- <div class="ant-ml-[8px]">{item.children?.()}</div>
26
- </div>
27
- )}
28
- </For>
29
- </div>
30
- )
31
- }
32
-
33
- export default Timeline