seven-design-ui 0.0.1

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 (157) hide show
  1. package/.eslintrc.json +35 -0
  2. package/.prettierrc.json +10 -0
  3. package/CONTRIBUTING.md +350 -0
  4. package/PROJECT_STRUCTURE.md +343 -0
  5. package/README.md +83 -0
  6. package/app/globals.css +125 -0
  7. package/app/layout.tsx +45 -0
  8. package/app/page.tsx +202 -0
  9. package/components/theme-provider.tsx +11 -0
  10. package/components/ui/accordion.tsx +66 -0
  11. package/components/ui/alert-dialog.tsx +157 -0
  12. package/components/ui/alert.tsx +66 -0
  13. package/components/ui/aspect-ratio.tsx +11 -0
  14. package/components/ui/avatar.tsx +53 -0
  15. package/components/ui/badge.tsx +46 -0
  16. package/components/ui/breadcrumb.tsx +109 -0
  17. package/components/ui/button-group.tsx +83 -0
  18. package/components/ui/button.tsx +60 -0
  19. package/components/ui/calendar.tsx +213 -0
  20. package/components/ui/card.tsx +92 -0
  21. package/components/ui/carousel.tsx +241 -0
  22. package/components/ui/chart.tsx +353 -0
  23. package/components/ui/checkbox.tsx +32 -0
  24. package/components/ui/collapsible.tsx +33 -0
  25. package/components/ui/command.tsx +184 -0
  26. package/components/ui/context-menu.tsx +252 -0
  27. package/components/ui/dialog.tsx +143 -0
  28. package/components/ui/drawer.tsx +135 -0
  29. package/components/ui/dropdown-menu.tsx +257 -0
  30. package/components/ui/empty.tsx +104 -0
  31. package/components/ui/field.tsx +244 -0
  32. package/components/ui/form.tsx +167 -0
  33. package/components/ui/hover-card.tsx +44 -0
  34. package/components/ui/input-group.tsx +169 -0
  35. package/components/ui/input-otp.tsx +77 -0
  36. package/components/ui/input.tsx +21 -0
  37. package/components/ui/item.tsx +193 -0
  38. package/components/ui/kbd.tsx +28 -0
  39. package/components/ui/label.tsx +24 -0
  40. package/components/ui/menubar.tsx +276 -0
  41. package/components/ui/navigation-menu.tsx +166 -0
  42. package/components/ui/pagination.tsx +127 -0
  43. package/components/ui/popover.tsx +48 -0
  44. package/components/ui/progress.tsx +31 -0
  45. package/components/ui/radio-group.tsx +45 -0
  46. package/components/ui/resizable.tsx +56 -0
  47. package/components/ui/scroll-area.tsx +58 -0
  48. package/components/ui/select.tsx +185 -0
  49. package/components/ui/separator.tsx +28 -0
  50. package/components/ui/sheet.tsx +139 -0
  51. package/components/ui/sidebar.tsx +726 -0
  52. package/components/ui/skeleton.tsx +13 -0
  53. package/components/ui/slider.tsx +63 -0
  54. package/components/ui/sonner.tsx +25 -0
  55. package/components/ui/spinner.tsx +16 -0
  56. package/components/ui/switch.tsx +31 -0
  57. package/components/ui/table.tsx +116 -0
  58. package/components/ui/tabs.tsx +66 -0
  59. package/components/ui/textarea.tsx +18 -0
  60. package/components/ui/toast.tsx +129 -0
  61. package/components/ui/toaster.tsx +35 -0
  62. package/components/ui/toggle-group.tsx +73 -0
  63. package/components/ui/toggle.tsx +47 -0
  64. package/components/ui/tooltip.tsx +61 -0
  65. package/components/ui/use-mobile.tsx +19 -0
  66. package/components/ui/use-toast.ts +191 -0
  67. package/components.json +21 -0
  68. package/docs/components/button.mdx +155 -0
  69. package/docs/components/input.mdx +157 -0
  70. package/docs/components/pagination.mdx +186 -0
  71. package/docs/components/switch.mdx +134 -0
  72. package/docs/doc_build/.nojekyll +0 -0
  73. package/docs/doc_build/404.html +15 -0
  74. package/docs/doc_build/components/button.html +39 -0
  75. package/docs/doc_build/components/input.html +39 -0
  76. package/docs/doc_build/components/pagination.html +39 -0
  77. package/docs/doc_build/components/switch.html +38 -0
  78. package/docs/doc_build/guide/introduction.html +58 -0
  79. package/docs/doc_build/guide/quick-start.html +98 -0
  80. package/docs/doc_build/guide/theme.html +139 -0
  81. package/docs/doc_build/index.html +15 -0
  82. package/docs/doc_build/logo.svg +1 -0
  83. package/docs/doc_build/static/css/styles.5a3e7113.css +1 -0
  84. package/docs/doc_build/static/js/414.04bb58dd.js +6 -0
  85. package/docs/doc_build/static/js/414.04bb58dd.js.LICENSE.txt +21 -0
  86. package/docs/doc_build/static/js/async/166.f43be01a.js +2 -0
  87. package/docs/doc_build/static/js/async/166.f43be01a.js.LICENSE.txt +19 -0
  88. package/docs/doc_build/static/js/async/218.cd780e24.js +1 -0
  89. package/docs/doc_build/static/js/async/232.11414fd7.js +1 -0
  90. package/docs/doc_build/static/js/async/416.b217df75.js +1 -0
  91. package/docs/doc_build/static/js/async/509.97958e51.js +1 -0
  92. package/docs/doc_build/static/js/async/512.9047d21e.js +1 -0
  93. package/docs/doc_build/static/js/async/531.131f5963.js +1 -0
  94. package/docs/doc_build/static/js/async/562.b402b94f.js +2 -0
  95. package/docs/doc_build/static/js/async/562.b402b94f.js.LICENSE.txt +11 -0
  96. package/docs/doc_build/static/js/async/637.cb5d76c9.js +1 -0
  97. package/docs/doc_build/static/js/async/712.558b85be.js +1 -0
  98. package/docs/doc_build/static/js/index.0991c749.js +1 -0
  99. package/docs/doc_build/static/js/lib-react.ce4199ca.js +2 -0
  100. package/docs/doc_build/static/js/lib-react.ce4199ca.js.LICENSE.txt +49 -0
  101. package/docs/doc_build/static/js/lib-router.4000fe55.js +2 -0
  102. package/docs/doc_build/static/js/lib-router.4000fe55.js.LICENSE.txt +32 -0
  103. package/docs/doc_build/static/js/styles.f2af9a40.js +1 -0
  104. package/docs/doc_build/static/search_index.72c9c372.json +1 -0
  105. package/docs/docs/public/logo.svg +1 -0
  106. package/docs/guide/introduction.md +50 -0
  107. package/docs/guide/quick-start.md +132 -0
  108. package/docs/guide/theme.md +230 -0
  109. package/docs/index.md +85 -0
  110. package/docs/package.json +22 -0
  111. package/docs/public/logo.svg +1 -0
  112. package/docs/rspress.config.ts +116 -0
  113. package/hooks/use-mobile.ts +19 -0
  114. package/hooks/use-toast.ts +191 -0
  115. package/next.config.mjs +11 -0
  116. package/package.json +75 -0
  117. package/packages/components/package.json +34 -0
  118. package/packages/components/src/button/Button.tsx +83 -0
  119. package/packages/components/src/button/button.css +256 -0
  120. package/packages/components/src/button/index.ts +2 -0
  121. package/packages/components/src/index.ts +8 -0
  122. package/packages/components/src/input/Input.tsx +230 -0
  123. package/packages/components/src/input/index.ts +2 -0
  124. package/packages/components/src/input/input.css +99 -0
  125. package/packages/components/src/pagination/Pagination.tsx +271 -0
  126. package/packages/components/src/pagination/index.ts +1 -0
  127. package/packages/components/src/pagination/pagination.css +225 -0
  128. package/packages/components/src/switch/Switch.tsx +145 -0
  129. package/packages/components/src/switch/index.ts +2 -0
  130. package/packages/components/src/switch/switch.css +119 -0
  131. package/packages/components/tsconfig.json +12 -0
  132. package/packages/components/vite.config.ts +31 -0
  133. package/packages/core/package.json +23 -0
  134. package/packages/core/src/hooks/useControllableState.ts +31 -0
  135. package/packages/core/src/hooks/useEventListener.ts +37 -0
  136. package/packages/core/src/index.ts +7 -0
  137. package/packages/core/src/utils/classnames.ts +48 -0
  138. package/packages/core/tsconfig.json +12 -0
  139. package/packages/core/vite.config.ts +24 -0
  140. package/packages/theme/package.json +20 -0
  141. package/packages/theme/src/index.css +138 -0
  142. package/packages/theme/src/index.ts +1 -0
  143. package/packages/theme/vite.config.ts +21 -0
  144. package/play/index.html +13 -0
  145. package/play/package.json +25 -0
  146. package/play/src/App.tsx +237 -0
  147. package/play/src/index.css +93 -0
  148. package/play/src/main.tsx +14 -0
  149. package/play/tsconfig.json +8 -0
  150. package/play/vite.config.ts +10 -0
  151. package/pnpm-workspace.yaml +4 -0
  152. package/postcss.config.mjs +8 -0
  153. package/public/logo.svg +1 -0
  154. package/scripts/build.sh +19 -0
  155. package/scripts/deploy-docs.js +38 -0
  156. package/styles/globals.css +125 -0
  157. package/tsconfig.json +30 -0
@@ -0,0 +1,191 @@
1
+ 'use client'
2
+
3
+ // Inspired by react-hot-toast library
4
+ import * as React from 'react'
5
+
6
+ import type { ToastActionElement, ToastProps } from '@/components/ui/toast'
7
+
8
+ const TOAST_LIMIT = 1
9
+ const TOAST_REMOVE_DELAY = 1000000
10
+
11
+ type ToasterToast = ToastProps & {
12
+ id: string
13
+ title?: React.ReactNode
14
+ description?: React.ReactNode
15
+ action?: ToastActionElement
16
+ }
17
+
18
+ const actionTypes = {
19
+ ADD_TOAST: 'ADD_TOAST',
20
+ UPDATE_TOAST: 'UPDATE_TOAST',
21
+ DISMISS_TOAST: 'DISMISS_TOAST',
22
+ REMOVE_TOAST: 'REMOVE_TOAST',
23
+ } as const
24
+
25
+ let count = 0
26
+
27
+ function genId() {
28
+ count = (count + 1) % Number.MAX_SAFE_INTEGER
29
+ return count.toString()
30
+ }
31
+
32
+ type ActionType = typeof actionTypes
33
+
34
+ type Action =
35
+ | {
36
+ type: ActionType['ADD_TOAST']
37
+ toast: ToasterToast
38
+ }
39
+ | {
40
+ type: ActionType['UPDATE_TOAST']
41
+ toast: Partial<ToasterToast>
42
+ }
43
+ | {
44
+ type: ActionType['DISMISS_TOAST']
45
+ toastId?: ToasterToast['id']
46
+ }
47
+ | {
48
+ type: ActionType['REMOVE_TOAST']
49
+ toastId?: ToasterToast['id']
50
+ }
51
+
52
+ interface State {
53
+ toasts: ToasterToast[]
54
+ }
55
+
56
+ const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
57
+
58
+ const addToRemoveQueue = (toastId: string) => {
59
+ if (toastTimeouts.has(toastId)) {
60
+ return
61
+ }
62
+
63
+ const timeout = setTimeout(() => {
64
+ toastTimeouts.delete(toastId)
65
+ dispatch({
66
+ type: 'REMOVE_TOAST',
67
+ toastId: toastId,
68
+ })
69
+ }, TOAST_REMOVE_DELAY)
70
+
71
+ toastTimeouts.set(toastId, timeout)
72
+ }
73
+
74
+ export const reducer = (state: State, action: Action): State => {
75
+ switch (action.type) {
76
+ case 'ADD_TOAST':
77
+ return {
78
+ ...state,
79
+ toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
80
+ }
81
+
82
+ case 'UPDATE_TOAST':
83
+ return {
84
+ ...state,
85
+ toasts: state.toasts.map((t) =>
86
+ t.id === action.toast.id ? { ...t, ...action.toast } : t,
87
+ ),
88
+ }
89
+
90
+ case 'DISMISS_TOAST': {
91
+ const { toastId } = action
92
+
93
+ // ! Side effects ! - This could be extracted into a dismissToast() action,
94
+ // but I'll keep it here for simplicity
95
+ if (toastId) {
96
+ addToRemoveQueue(toastId)
97
+ } else {
98
+ state.toasts.forEach((toast) => {
99
+ addToRemoveQueue(toast.id)
100
+ })
101
+ }
102
+
103
+ return {
104
+ ...state,
105
+ toasts: state.toasts.map((t) =>
106
+ t.id === toastId || toastId === undefined
107
+ ? {
108
+ ...t,
109
+ open: false,
110
+ }
111
+ : t,
112
+ ),
113
+ }
114
+ }
115
+ case 'REMOVE_TOAST':
116
+ if (action.toastId === undefined) {
117
+ return {
118
+ ...state,
119
+ toasts: [],
120
+ }
121
+ }
122
+ return {
123
+ ...state,
124
+ toasts: state.toasts.filter((t) => t.id !== action.toastId),
125
+ }
126
+ }
127
+ }
128
+
129
+ const listeners: Array<(state: State) => void> = []
130
+
131
+ let memoryState: State = { toasts: [] }
132
+
133
+ function dispatch(action: Action) {
134
+ memoryState = reducer(memoryState, action)
135
+ listeners.forEach((listener) => {
136
+ listener(memoryState)
137
+ })
138
+ }
139
+
140
+ type Toast = Omit<ToasterToast, 'id'>
141
+
142
+ function toast({ ...props }: Toast) {
143
+ const id = genId()
144
+
145
+ const update = (props: ToasterToast) =>
146
+ dispatch({
147
+ type: 'UPDATE_TOAST',
148
+ toast: { ...props, id },
149
+ })
150
+ const dismiss = () => dispatch({ type: 'DISMISS_TOAST', toastId: id })
151
+
152
+ dispatch({
153
+ type: 'ADD_TOAST',
154
+ toast: {
155
+ ...props,
156
+ id,
157
+ open: true,
158
+ onOpenChange: (open) => {
159
+ if (!open) dismiss()
160
+ },
161
+ },
162
+ })
163
+
164
+ return {
165
+ id: id,
166
+ dismiss,
167
+ update,
168
+ }
169
+ }
170
+
171
+ function useToast() {
172
+ const [state, setState] = React.useState<State>(memoryState)
173
+
174
+ React.useEffect(() => {
175
+ listeners.push(setState)
176
+ return () => {
177
+ const index = listeners.indexOf(setState)
178
+ if (index > -1) {
179
+ listeners.splice(index, 1)
180
+ }
181
+ }
182
+ }, [state])
183
+
184
+ return {
185
+ ...state,
186
+ toast,
187
+ dismiss: (toastId?: string) => dispatch({ type: 'DISMISS_TOAST', toastId }),
188
+ }
189
+ }
190
+
191
+ export { useToast, toast }
@@ -0,0 +1,11 @@
1
+ /** @type {import('next').NextConfig} */
2
+ const nextConfig = {
3
+ typescript: {
4
+ ignoreBuildErrors: true,
5
+ },
6
+ images: {
7
+ unoptimized: true,
8
+ },
9
+ }
10
+
11
+ export default nextConfig
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "seven-design-ui",
3
+ "version": "0.0.1",
4
+ "description": "企业级 React UI 组件库",
5
+ "license": "MIT",
6
+ "author": "seven.zhong",
7
+ "scripts": {
8
+ "build": "pnpm --filter ./packages/** build",
9
+ "build:components": "pnpm --filter @seven-design-ui/components build",
10
+ "build:core": "pnpm --filter @seven-design-ui/core build",
11
+ "build:theme": "pnpm --filter @seven-design-ui/theme build",
12
+ "changeset": "changeset",
13
+ "clean": "pnpm --filter ./packages/** exec rm -rf dist",
14
+ "dev": "pnpm --filter @seven-design-ui/play dev",
15
+ "docs:build": "pnpm --filter docs build",
16
+ "docs:deploy": "pnpm docs:build && node scripts/deploy-docs.js",
17
+ "docs:dev": "pnpm --filter docs dev",
18
+ "docs:preview": "pnpm --filter docs preview",
19
+ "format": "prettier --write \"**/*.{ts,tsx,json,md}\"",
20
+ "lint": "eslint . --ext .ts,.tsx",
21
+ "prepare": "husky install",
22
+ "release": "pnpm build && changeset publish",
23
+ "test": "vitest",
24
+ "version-packages": "changeset version"
25
+ },
26
+ "dependencies": {
27
+ "class-variance-authority": "0.7.1",
28
+ "clsx": "2.1.1",
29
+ "jiti": "latest",
30
+ "less": "latest",
31
+ "lightningcss": "latest",
32
+ "lucide-react": "0.562.0",
33
+ "next": "16.1.3",
34
+ "react": "19.2.3",
35
+ "react-dom": "19.2.3",
36
+ "rspress": "1.47.0",
37
+ "sass": "latest",
38
+ "sass-embedded": "latest",
39
+ "stylus": "latest",
40
+ "sugarss": "latest",
41
+ "tailwind-merge": "3.4.0",
42
+ "tailwindcss-animate": "1.0.7",
43
+ "terser": "latest",
44
+ "tsx": "latest",
45
+ "yaml": "latest"
46
+ },
47
+ "devDependencies": {
48
+ "@changesets/cli": "^2.27.1",
49
+ "@tailwindcss/postcss": "^4.1.18",
50
+ "@types/node": "^20.11.5",
51
+ "@types/react": "^18.2.48",
52
+ "@types/react-dom": "^18.2.18",
53
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
54
+ "@typescript-eslint/parser": "^6.19.1",
55
+ "@vitejs/plugin-react": "^4.2.1",
56
+ "eslint": "^8.56.0",
57
+ "eslint-config-prettier": "^9.1.0",
58
+ "eslint-plugin-react": "^7.33.2",
59
+ "eslint-plugin-react-hooks": "^4.6.0",
60
+ "gh-pages": "^6.3.0",
61
+ "husky": "^8.0.3",
62
+ "lint-staged": "^15.2.0",
63
+ "postcss": "8.5.6",
64
+ "prettier": "^3.2.4",
65
+ "tailwindcss": "4.1.18",
66
+ "typescript": "^5.3.3",
67
+ "vite": "^5.0.11",
68
+ "vitest": "^1.2.1"
69
+ },
70
+ "packageManager": "pnpm@8.15.0",
71
+ "engines": {
72
+ "node": ">=18.0.0",
73
+ "pnpm": ">=8.0.0"
74
+ }
75
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@seven-design-ui/components",
3
+ "version": "0.1.0",
4
+ "description": "SevenDesign React UI 组件库",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.esm.js",
14
+ "require": "./dist/index.cjs.js",
15
+ "types": "./dist/index.d.ts"
16
+ },
17
+ "./dist/style.css": "./dist/style.css"
18
+ },
19
+ "scripts": {
20
+ "build": "vite build && tsc --emitDeclarationOnly",
21
+ "dev": "vite build --watch"
22
+ },
23
+ "dependencies": {
24
+ "@seven-design-ui/core": "workspace:*",
25
+ "@seven-design-ui/theme": "workspace:*"
26
+ },
27
+ "peerDependencies": {
28
+ "react": ">=18.0.0",
29
+ "react-dom": ">=18.0.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }
@@ -0,0 +1,83 @@
1
+ import React from "react"
2
+ import { forwardRef, ButtonHTMLAttributes } from 'react'
3
+ import { classnames } from '@seven-design-ui/core'
4
+ import './button.css'
5
+
6
+ export type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info'
7
+ export type ButtonSize = 'large' | 'default' | 'small'
8
+ export type NativeType = 'button' | 'submit' | 'reset'
9
+
10
+ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
11
+ /** 按钮类型 */
12
+ type?: ButtonType
13
+ /** 按钮尺寸 */
14
+ size?: ButtonSize
15
+ /** 是否为朴素按钮 */
16
+ plain?: boolean
17
+ /** 是否为圆角按钮 */
18
+ round?: boolean
19
+ /** 是否为圆形按钮 */
20
+ circle?: boolean
21
+ /** 是否为加载中状态 */
22
+ loading?: boolean
23
+ /** 是否禁用 */
24
+ disabled?: boolean
25
+ /** 原生 button 的 type 属性 */
26
+ nativeType?: NativeType
27
+ /** 图标组件 */
28
+ icon?: React.ReactNode
29
+ /** 自定义类名 */
30
+ className?: string
31
+ /** 子元素 */
32
+ children?: React.ReactNode
33
+ }
34
+
35
+ export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
36
+ const {
37
+ type = 'default',
38
+ size = 'default',
39
+ plain = false,
40
+ round = false,
41
+ circle = false,
42
+ loading = false,
43
+ disabled = false,
44
+ nativeType = 'button',
45
+ icon,
46
+ className,
47
+ children,
48
+ ...rest
49
+ } = props
50
+
51
+ const classes = classnames(
52
+ 'sd-button',
53
+ `sd-button--${type}`,
54
+ `sd-button--${size}`,
55
+ {
56
+ 'sd-button--plain': plain,
57
+ 'sd-button--round': round,
58
+ 'sd-button--circle': circle,
59
+ 'sd-button--loading': loading,
60
+ 'is-disabled': disabled || loading,
61
+ },
62
+ className
63
+ )
64
+
65
+ return (
66
+ <button ref={ref} type={nativeType} className={classes} disabled={disabled || loading} {...rest}>
67
+ {loading && (
68
+ <span className="sd-button__loading-icon">
69
+ <svg viewBox="0 0 1024 1024" className="sd-button__spinner">
70
+ <path
71
+ fill="currentColor"
72
+ d="M512 64a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.2a32 32 0 0 1 0 45.248L692.992 376.32a32 32 0 0 1-45.248-45.248L783.552 195.2a32 32 0 0 1 45.248 0zM376.32 647.744a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
73
+ />
74
+ </svg>
75
+ </span>
76
+ )}
77
+ {icon && !loading && <span className="sd-button__icon">{icon}</span>}
78
+ {children && <span className="sd-button__text">{children}</span>}
79
+ </button>
80
+ )
81
+ })
82
+
83
+ Button.displayName = 'Button'
@@ -0,0 +1,256 @@
1
+ /* Button 组件样式 */
2
+ .sd-button {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ gap: 6px;
7
+ padding: 8px 15px;
8
+ font-size: var(--sd-font-size-base);
9
+ font-weight: 500;
10
+ line-height: 1;
11
+ white-space: nowrap;
12
+ cursor: pointer;
13
+ background-color: var(--sd-fill-color-blank);
14
+ border: 1px solid var(--sd-border-color);
15
+ border-radius: var(--sd-border-radius-base);
16
+ color: var(--sd-text-color-regular);
17
+ transition: all var(--sd-transition-duration-fast) var(--sd-transition-function-ease-in-out-bezier);
18
+ user-select: none;
19
+ outline: none;
20
+ }
21
+
22
+ .sd-button:hover,
23
+ .sd-button:focus {
24
+ color: var(--sd-color-primary);
25
+ border-color: var(--sd-color-primary-light-7);
26
+ background-color: var(--sd-color-primary-light-9);
27
+ }
28
+
29
+ .sd-button:active {
30
+ color: var(--sd-color-primary-dark-2);
31
+ border-color: var(--sd-color-primary-dark-2);
32
+ }
33
+
34
+ /* 按钮类型 */
35
+ .sd-button--primary {
36
+ color: var(--sd-color-white);
37
+ background-color: var(--sd-color-primary);
38
+ border-color: var(--sd-color-primary);
39
+ }
40
+
41
+ .sd-button--primary:hover,
42
+ .sd-button--primary:focus {
43
+ background-color: var(--sd-color-primary-light-3);
44
+ border-color: var(--sd-color-primary-light-3);
45
+ color: var(--sd-color-white);
46
+ }
47
+
48
+ .sd-button--primary:active {
49
+ background-color: var(--sd-color-primary-dark-2);
50
+ border-color: var(--sd-color-primary-dark-2);
51
+ }
52
+
53
+ .sd-button--success {
54
+ color: var(--sd-color-white);
55
+ background-color: var(--sd-color-success);
56
+ border-color: var(--sd-color-success);
57
+ }
58
+
59
+ .sd-button--success:hover,
60
+ .sd-button--success:focus {
61
+ opacity: 0.8;
62
+ }
63
+
64
+ .sd-button--warning {
65
+ color: var(--sd-color-white);
66
+ background-color: var(--sd-color-warning);
67
+ border-color: var(--sd-color-warning);
68
+ }
69
+
70
+ .sd-button--warning:hover,
71
+ .sd-button--warning:focus {
72
+ opacity: 0.8;
73
+ }
74
+
75
+ .sd-button--danger {
76
+ color: var(--sd-color-white);
77
+ background-color: var(--sd-color-danger);
78
+ border-color: var(--sd-color-danger);
79
+ }
80
+
81
+ .sd-button--danger:hover,
82
+ .sd-button--danger:focus {
83
+ opacity: 0.8;
84
+ }
85
+
86
+ .sd-button--info {
87
+ color: var(--sd-color-white);
88
+ background-color: var(--sd-color-info);
89
+ border-color: var(--sd-color-info);
90
+ }
91
+
92
+ .sd-button--info:hover,
93
+ .sd-button--info:focus {
94
+ opacity: 0.8;
95
+ }
96
+
97
+ /* 朴素按钮 */
98
+ .sd-button--plain {
99
+ background-color: transparent;
100
+ }
101
+
102
+ /* 默认类型的 plain 按钮保持原有样式 */
103
+ .sd-button--plain:hover,
104
+ .sd-button--plain:focus {
105
+ color: var(--sd-color-primary);
106
+ border-color: var(--sd-color-primary-light-7);
107
+ background-color: var(--sd-color-primary-light-9);
108
+ }
109
+
110
+ .sd-button--primary.sd-button--plain {
111
+ color: var(--sd-color-primary) !important;
112
+ background-color: var(--sd-color-primary-light-9) !important;
113
+ border-color: var(--sd-color-primary-light-5) !important;
114
+ }
115
+
116
+ .sd-button--primary.sd-button--plain:hover,
117
+ .sd-button--primary.sd-button--plain:focus {
118
+ background-color: var(--sd-color-primary) !important;
119
+ border-color: var(--sd-color-primary) !important;
120
+ color: var(--sd-color-white) !important;
121
+ }
122
+
123
+ .sd-button--success.sd-button--plain {
124
+ color: var(--sd-color-success) !important;
125
+ background-color: var(--sd-color-success-light-9) !important;
126
+ border-color: var(--sd-color-success-light-5) !important;
127
+ }
128
+
129
+ .sd-button--success.sd-button--plain:hover,
130
+ .sd-button--success.sd-button--plain:focus {
131
+ background-color: var(--sd-color-success) !important;
132
+ border-color: var(--sd-color-success) !important;
133
+ color: var(--sd-color-white) !important;
134
+ }
135
+
136
+ .sd-button--warning.sd-button--plain {
137
+ color: var(--sd-color-warning) !important;
138
+ background-color: var(--sd-color-warning-light-9) !important;
139
+ border-color: var(--sd-color-warning-light-5) !important;
140
+ }
141
+
142
+ .sd-button--warning.sd-button--plain:hover,
143
+ .sd-button--warning.sd-button--plain:focus {
144
+ background-color: var(--sd-color-warning) !important;
145
+ border-color: var(--sd-color-warning) !important;
146
+ color: var(--sd-color-white) !important;
147
+ }
148
+
149
+ .sd-button--danger.sd-button--plain {
150
+ color: var(--sd-color-danger) !important;
151
+ background-color: var(--sd-color-danger-light-9) !important;
152
+ border-color: var(--sd-color-danger-light-5) !important;
153
+ }
154
+
155
+ .sd-button--danger.sd-button--plain:hover,
156
+ .sd-button--danger.sd-button--plain:focus {
157
+ background-color: var(--sd-color-danger) !important;
158
+ border-color: var(--sd-color-danger) !important;
159
+ color: var(--sd-color-white) !important;
160
+ }
161
+
162
+ .sd-button--info.sd-button--plain {
163
+ color: var(--sd-color-info) !important;
164
+ background-color: var(--sd-color-info-light-9) !important;
165
+ border-color: var(--sd-color-info-light-5) !important;
166
+ }
167
+
168
+ .sd-button--info.sd-button--plain:hover,
169
+ .sd-button--info.sd-button--plain:focus {
170
+ background-color: var(--sd-color-info) !important;
171
+ border-color: var(--sd-color-info) !important;
172
+ color: var(--sd-color-white) !important;
173
+ }
174
+
175
+ /* 圆角按钮 */
176
+ .sd-button--round {
177
+ border-radius: var(--sd-border-radius-round);
178
+ padding: 8px 15px;
179
+ }
180
+
181
+ /* 圆形按钮 */
182
+ .sd-button--circle {
183
+ border-radius: var(--sd-border-radius-circle);
184
+ width: 32px;
185
+ height: 32px;
186
+ padding: 8px;
187
+ }
188
+
189
+ /* 尺寸 */
190
+ .sd-button--large {
191
+ height: var(--sd-component-size-large);
192
+ padding: 12px 19px;
193
+ font-size: var(--sd-font-size-base);
194
+ }
195
+
196
+ .sd-button--large.sd-button--circle {
197
+ width: 40px;
198
+ height: 40px;
199
+ }
200
+
201
+ .sd-button--small {
202
+ height: var(--sd-component-size-small);
203
+ padding: 5px 11px;
204
+ font-size: var(--sd-font-size-small);
205
+ }
206
+
207
+ .sd-button--small.sd-button--circle {
208
+ width: 24px;
209
+ height: 24px;
210
+ }
211
+
212
+ /* 禁用状态 */
213
+ .sd-button.is-disabled,
214
+ .sd-button.is-disabled:hover,
215
+ .sd-button.is-disabled:focus {
216
+ color: var(--sd-disabled-text-color);
217
+ background-color: var(--sd-disabled-bg-color);
218
+ border-color: var(--sd-disabled-border-color);
219
+ cursor: not-allowed;
220
+ }
221
+
222
+ /* 加载状态 */
223
+ .sd-button--loading {
224
+ position: relative;
225
+ pointer-events: none;
226
+ }
227
+
228
+ .sd-button__loading-icon {
229
+ display: inline-flex;
230
+ align-items: center;
231
+ }
232
+
233
+ .sd-button__spinner {
234
+ width: 1em;
235
+ height: 1em;
236
+ animation: sd-button-spin 2s linear infinite;
237
+ }
238
+
239
+ @keyframes sd-button-spin {
240
+ from {
241
+ transform: rotate(0deg);
242
+ }
243
+ to {
244
+ transform: rotate(360deg);
245
+ }
246
+ }
247
+
248
+ /* 图标 */
249
+ .sd-button__icon {
250
+ display: inline-flex;
251
+ align-items: center;
252
+ }
253
+
254
+ .sd-button__text {
255
+ display: inline-block;
256
+ }
@@ -0,0 +1,2 @@
1
+ export { Button } from './Button'
2
+ export type { ButtonProps, ButtonType, ButtonSize, NativeType } from './Button'
@@ -0,0 +1,8 @@
1
+ // 导入主题样式
2
+ import '@seven-design-ui/theme/src/index.css'
3
+
4
+ // 基础组件
5
+ export * from './button'
6
+ export * from './input'
7
+ export * from './switch'
8
+ export * from './pagination'