diff --git a/components/auto-complete/auto-complete.tsx b/components/auto-complete/auto-complete.tsx
index 43eb4b8..6cd4c24 100644
--- a/components/auto-complete/auto-complete.tsx
+++ b/components/auto-complete/auto-complete.tsx
@@ -6,7 +6,7 @@ import AutoCompleteSearching from './auto-complete-searching'
import AutoCompleteEmpty from './auto-complete-empty'
import { AutoCompleteContext, AutoCompleteConfig } from './auto-complete-context'
import { NormalSizes, NormalTypes } from '../utils/prop-types'
-import ButtonLoading from '../button/button.loading'
+import Loading from '../loading'
import { pickChild } from 'components/utils/collections'
export type AutoCompleteOption = {
@@ -62,7 +62,7 @@ const childrenToOptionsNode = (options: AutoCompleteOptions) => {
// When the search is seted, at least one element should exist to avoid re-render.
const getSearchIcon = (searching?: boolean) => {
if (searching === undefined) return null
- return searching ? :
+ return searching ? :
}
const AutoComplete: React.FC> = ({
@@ -146,6 +146,12 @@ const AutoComplete: React.FC> = ({
.auto-complete {
width: ${width || 'max-content'};
}
+
+ .auto-complete :global(.loading) {
+ left: -3px;
+ right: -3px;
+ width: max-content;
+ }
`}
diff --git a/components/button-dropdown/button-dropdown-item.tsx b/components/button-dropdown/button-dropdown-item.tsx
index 8b3d145..e73ed3e 100644
--- a/components/button-dropdown/button-dropdown-item.tsx
+++ b/components/button-dropdown/button-dropdown-item.tsx
@@ -4,7 +4,7 @@ import withDefaults from '../utils/with-defaults'
import { getColor } from './styles'
import { useButtonDropdown } from './button-dropdown-context'
import { getButtonSize } from '../button/styles'
-import ButtonLoading from '../button/button.loading'
+import Loading from '../loading'
import { NormalTypes } from '../utils/prop-types'
interface Props {
@@ -43,7 +43,7 @@ const ButtonDropdownItem: React.FC
- {loading ? : children}
+ {loading ? : children}
-
- )
-})
-
-export default ButtonLoading
diff --git a/components/button/button.tsx b/components/button/button.tsx
index 3b18f0a..55cb7c2 100644
--- a/components/button/button.tsx
+++ b/components/button/button.tsx
@@ -3,7 +3,7 @@ import withDefaults from '../utils/with-defaults'
import useTheme from '../styles/use-theme'
import { ButtonTypes, NormalSizes } from '../utils/prop-types'
import ButtonDrip from './button.drip'
-import ButtonLoading from './button.loading'
+import ButtonLoading from '../loading'
import { getButtonColors, getButtonCursor, getButtonHoverColors, getButtonSize } from './styles'
interface Props {
diff --git a/components/index.ts b/components/index.ts
index 8f877f9..5b28be6 100644
--- a/components/index.ts
+++ b/components/index.ts
@@ -39,3 +39,4 @@ export { default as Tree } from './file-tree'
export { default as Badge } from './badge'
export { default as AutoComplete } from './auto-complete'
export { default as Collapse } from './collapse'
+export { default as Loading } from './loading'
diff --git a/components/input/input-icon.tsx b/components/input/input-icon.tsx
index a9fa558..2a1f38f 100644
--- a/components/input/input-icon.tsx
+++ b/components/input/input-icon.tsx
@@ -18,10 +18,10 @@ const InputIcon: React.FC = React.memo(({
}, [theme.layout.gap, ratio])
return (
-
+
{icon}
+
+ )
+})
+
+export default withDefaults(Loading, defaultProps)
diff --git a/pages/docs/components/loading.mdx b/pages/docs/components/loading.mdx
new file mode 100644
index 0000000..1f5fb47
--- /dev/null
+++ b/pages/docs/components/loading.mdx
@@ -0,0 +1,91 @@
+import { Layout, Playground, Attributes } from 'lib/components'
+import { Loading, Spacer, Row } from 'components'
+
+export const meta = {
+ title: 'Loading',
+ description: 'Loading',
+}
+
+## Loading
+
+Indicate an action running in the background.
+
+
+
+
+`} />
+
+
+ Loading
+
+`} />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>
+`} />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>
+`} />
+
+
+Loading.Props
+
+| Attribute | Description | Type | Accepted values | Default
+| ---------- | ---------- | ---- | -------------- | ------ |
+| **type** | bg-color type | `NormalTypes` | `'default', 'secondary', 'success', 'warning', 'error'` | `default` |
+| **size** | loading size | `NormalSizes` | `'mini', 'small', 'medium', 'large'` | `medium` |
+| **color** | custom bg color | `string` | - | - |
+| **width** | custom width | `string` | - | `100%` |
+| **height** | custom height | `string` | - | `100%` |
+| ... | native props | `HTMLAttributes` | `'id', 'title', 'className', ...` | - |
+
+
+
+export default ({ children }) => {children}
diff --git a/pages/docs/components/spinner.mdx b/pages/docs/components/spinner.mdx
index e95e5b5..8f63704 100644
--- a/pages/docs/components/spinner.mdx
+++ b/pages/docs/components/spinner.mdx
@@ -1,5 +1,6 @@
import { Layout, Playground, Attributes } from 'lib/components'
-import { Spinner, Spacer } from 'components'
+import { Spinner, Spacer, Note, Code, Link } from 'components'
+import NextLink from 'next/link'
export const meta = {
title: 'Spinner',
@@ -10,6 +11,8 @@ export const meta = {
Indicate an action running in the background.
+Looking for Loading? Use the Loading Component.
+