@startupjs-ui/loader 0.1.3
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.
- package/CHANGELOG.md +27 -0
- package/README.mdx +54 -0
- package/index.d.ts +13 -0
- package/index.tsx +35 -0
- package/package.json +19 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [0.1.3](https://github.com/startupjs/startupjs-ui/compare/v0.1.2...v0.1.3) (2025-12-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/loader
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.2](https://github.com/startupjs/startupjs-ui/compare/v0.1.1...v0.1.2) (2025-12-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **div:** Refactor to use Pressable and get rid of an extra wrapper when the Div is pressable ([9e7c852](https://github.com/startupjs/startupjs-ui/commit/9e7c852f383f540cab58b7a31aba0bd64a531adc))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add Loader ([b042db3](https://github.com/startupjs/startupjs-ui/commit/b042db357b311badfeabedd43193632e2ab92537))
|
|
25
|
+
* add mdx and docs packages. Refactor docs to get rid of any @startupjs/ui usage and use startupjs-ui instead ([703c926](https://github.com/startupjs/startupjs-ui/commit/703c92636efb0421ffd11783f692fc892b74018f))
|
|
26
|
+
* auto-generate .d.ts files for components on commit ([7d51efe](https://github.com/startupjs/startupjs-ui/commit/7d51efed601aabd217670490ae1cd438b7852970))
|
|
27
|
+
* **tag:** refactor Tag component. Add support for handling extension of Omit<> interfaces ([01f4833](https://github.com/startupjs/startupjs-ui/commit/01f483350ad61f8ecad9d11f20d7e56e3dc35952))
|
package/README.mdx
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Loader, { _PropsJsonSchema as LoaderPropsJsonSchema } from './index'
|
|
2
|
+
import Div from '@startupjs-ui/div'
|
|
3
|
+
import { Sandbox } from '@startupjs-ui/docs'
|
|
4
|
+
|
|
5
|
+
# Loader
|
|
6
|
+
|
|
7
|
+
Loaders are used to show a wait time.
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { Loader } from 'startupjs-ui'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Simple example
|
|
14
|
+
|
|
15
|
+
```jsx example
|
|
16
|
+
return (
|
|
17
|
+
<Loader />
|
|
18
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Sizes
|
|
22
|
+
|
|
23
|
+
Loaders can be of two sizes - `s` and `m` (default).
|
|
24
|
+
|
|
25
|
+
```jsx example
|
|
26
|
+
return (
|
|
27
|
+
<Div row align='around'>
|
|
28
|
+
<Loader size='s' />
|
|
29
|
+
<Loader size='m' />
|
|
30
|
+
</Div>
|
|
31
|
+
)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Colors
|
|
35
|
+
|
|
36
|
+
Color is `text-description` by default. It can be changed by passing color name from the config colors to `color` property. Possible values of property can be found in the `Sandbox` section at the bottom of the page.
|
|
37
|
+
|
|
38
|
+
```jsx example
|
|
39
|
+
return (
|
|
40
|
+
<Div row align='around'>
|
|
41
|
+
<Loader />
|
|
42
|
+
<Loader color='success' />
|
|
43
|
+
<Loader color='error' />
|
|
44
|
+
<Loader color='warning' />
|
|
45
|
+
</Div>
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Sandbox
|
|
50
|
+
|
|
51
|
+
<Sandbox
|
|
52
|
+
Component={Loader}
|
|
53
|
+
propsJsonSchema={LoaderPropsJsonSchema}
|
|
54
|
+
/>
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// DO NOT MODIFY THIS FILE - IT IS AUTOMATICALLY GENERATED ON COMMITS.
|
|
3
|
+
|
|
4
|
+
import { type ActivityIndicatorProps } from 'react-native';
|
|
5
|
+
declare const _default: import("react").ComponentType<LoaderProps>;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const _PropsJsonSchema: {};
|
|
8
|
+
export interface LoaderProps extends Omit<ActivityIndicatorProps, 'size' | 'color' | 'children'> {
|
|
9
|
+
/** Color token defined in Colors @default 'text-description' */
|
|
10
|
+
color?: string;
|
|
11
|
+
/** Component size @default 'm' */
|
|
12
|
+
size?: 's' | 'm';
|
|
13
|
+
}
|
package/index.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react'
|
|
2
|
+
import { ActivityIndicator, type ActivityIndicatorProps } from 'react-native'
|
|
3
|
+
import { pug, observer } from 'startupjs'
|
|
4
|
+
import { Colors, themed, useColors } from '@startupjs-ui/core'
|
|
5
|
+
|
|
6
|
+
const SIZES = { s: 'small', m: 'large' }
|
|
7
|
+
|
|
8
|
+
export default observer(themed('Loader', Loader))
|
|
9
|
+
|
|
10
|
+
export const _PropsJsonSchema = {/* LoaderProps */}
|
|
11
|
+
|
|
12
|
+
export interface LoaderProps extends Omit<ActivityIndicatorProps, 'size' | 'color' | 'children'> {
|
|
13
|
+
/** Color token defined in Colors @default 'text-description' */
|
|
14
|
+
color?: string
|
|
15
|
+
/** Component size @default 'm' */
|
|
16
|
+
size?: 's' | 'm'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function Loader ({
|
|
20
|
+
color = Colors['text-description'],
|
|
21
|
+
size = 'm',
|
|
22
|
+
...props
|
|
23
|
+
}: LoaderProps): ReactNode {
|
|
24
|
+
const getColor = useColors()
|
|
25
|
+
const _color = getColor(color)
|
|
26
|
+
if (!_color) console.error('Loader component: Color for color property is incorrect. Use colors from Colors')
|
|
27
|
+
|
|
28
|
+
return pug`
|
|
29
|
+
ActivityIndicator(
|
|
30
|
+
color=_color
|
|
31
|
+
size=SIZES[size]
|
|
32
|
+
...props
|
|
33
|
+
)
|
|
34
|
+
`
|
|
35
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@startupjs-ui/loader",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"main": "index.tsx",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@startupjs-ui/core": "^0.1.3"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"react": "*",
|
|
15
|
+
"react-native": "*",
|
|
16
|
+
"startupjs": "*"
|
|
17
|
+
},
|
|
18
|
+
"gitHead": "fd964ebc3892d3dd0a6c85438c0af619cc50c3f0"
|
|
19
|
+
}
|