@startupjs-ui/br 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 ADDED
@@ -0,0 +1,20 @@
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/br
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
+ ### Features
18
+
19
+ * 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))
20
+ * refactor Br, Layout, Portal ([d5f4dcd](https://github.com/startupjs/startupjs-ui/commit/d5f4dcd17e834ceae95decfc1df38bda2b5a17ab))
package/README.mdx ADDED
@@ -0,0 +1,80 @@
1
+ import { useState } from 'react'
2
+ import Br, { _PropsJsonSchema as BrPropsJsonSchema } from './index'
3
+ import Content from '@startupjs-ui/content'
4
+ import NumberInput from '@startupjs-ui/number-input'
5
+ import Div from '@startupjs-ui/div'
6
+ import Span from '@startupjs-ui/span'
7
+ import { u } from 'startupjs'
8
+ import { Sandbox } from '@startupjs-ui/docs'
9
+
10
+ # Br
11
+
12
+ `Br` is used to insert a line break. It also lets the developer customize the number of line breaks needed.
13
+
14
+ ```jsx
15
+ import { Br } from 'startupjs-ui'
16
+ ```
17
+
18
+ ## Simple example
19
+ ```jsx example
20
+ return (
21
+ <Br />
22
+ )
23
+ ```
24
+
25
+ ## Number of lines
26
+
27
+ Number of line breaks can be changed by passing a number to `lines` prop. The default value of `lines` is `1` and the width of a one line is `16px`.
28
+
29
+ ```jsx example
30
+ const itemStyle = {
31
+ height: u(5),
32
+ justifyContent: 'center',
33
+ alignItems: 'center'
34
+ }
35
+ const [value, setValue] = useState(1)
36
+ return (
37
+ <Content>
38
+ <NumberInput
39
+ label='Enter number of lines of space'
40
+ value={value}
41
+ onChangeNumber={num => setValue(num)}
42
+ />
43
+ <Br />
44
+ <Div style={itemStyle} level={1}>
45
+ <Span>Item 1</Span>
46
+ </Div>
47
+ <Br lines={Number(value)} />
48
+ <Div style={itemStyle} level={1}>
49
+ <Span>Item 2</Span>
50
+ </Div>
51
+ </Content>
52
+ )
53
+ ```
54
+
55
+ ## Half of line break
56
+
57
+ Setting the `half` prop to `true` creates a line break equivalent to a `lines` value of `0.5`.
58
+
59
+ ```jsx example
60
+ const itemStyle = {
61
+ height: u(5),
62
+ justifyContent: 'center',
63
+ alignItems: 'center'
64
+ }
65
+ return (
66
+ <Content>
67
+ <Div style={itemStyle} level={1}>
68
+ <Span>Item 1</Span>
69
+ </Div>
70
+ <Br half />
71
+ <Div style={itemStyle} level={1}>
72
+ <Span>Item 2</Span>
73
+ </Div>
74
+ </Content>
75
+ )
76
+ ```
77
+
78
+ ## Sandbox
79
+
80
+ <Sandbox Component={Br} propsJsonSchema={BrPropsJsonSchema} />
@@ -0,0 +1,2 @@
1
+ .root
2
+ flex-shrink 0
package/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /* eslint-disable */
2
+ // DO NOT MODIFY THIS FILE - IT IS AUTOMATICALLY GENERATED ON COMMITS.
3
+
4
+ import { type StyleProp, type TextStyle } from 'react-native';
5
+ import './index.cssx.styl';
6
+ export declare const _PropsJsonSchema: {};
7
+ export interface BrProps {
8
+ /** Custom styles applied to the spacer */
9
+ style?: StyleProp<TextStyle>;
10
+ /** Use half-height spacing */
11
+ half?: boolean;
12
+ /** Number of spacer lines @default 1 */
13
+ lines?: number;
14
+ }
15
+ declare const _default: import("react").ComponentType<BrProps>;
16
+ export default _default;
package/index.tsx ADDED
@@ -0,0 +1,31 @@
1
+ import { type ReactNode } from 'react'
2
+ import { Text, type StyleProp, type TextStyle } from 'react-native'
3
+ import { pug, observer } from 'startupjs'
4
+ import { themed, u } from '@startupjs-ui/core'
5
+ import './index.cssx.styl'
6
+
7
+ const LINE_HEIGHT = u(2)
8
+
9
+ export const _PropsJsonSchema = {/* BrProps */}
10
+
11
+ export interface BrProps {
12
+ /** Custom styles applied to the spacer */
13
+ style?: StyleProp<TextStyle>
14
+ /** Use half-height spacing */
15
+ half?: boolean
16
+ /** Number of spacer lines @default 1 */
17
+ lines?: number
18
+ }
19
+
20
+ function Br ({
21
+ style,
22
+ half = false,
23
+ lines = 1
24
+ }: BrProps): ReactNode {
25
+ const height = half ? LINE_HEIGHT / 2 : LINE_HEIGHT * lines
26
+ return pug`
27
+ Text.root(style=[{ height }, style])
28
+ `
29
+ }
30
+
31
+ export default observer(themed('Br', Br))
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@startupjs-ui/br",
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
+ }