@startupjs-ui/divider 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/divider
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
+ * **divider:** refactor Divider component ([c8d77f8](https://github.com/startupjs/startupjs-ui/commit/c8d77f8cedba5b238c7f14f880a3cb39ae0af42f))
package/README.mdx ADDED
@@ -0,0 +1,92 @@
1
+ import Divider, { _PropsJsonSchema as DividerPropsJsonSchema } from './index'
2
+ import Span from '@startupjs-ui/span'
3
+ import Div from '@startupjs-ui/div'
4
+ import Content from '@startupjs-ui/content'
5
+ import { Sandbox } from '@startupjs-ui/docs'
6
+
7
+ # Divider
8
+
9
+ A divider is a thin line that is used to divide content into thematic blocks. For example a thematic break between paragraphs.
10
+
11
+ ```jsx
12
+ import { Divider } from 'startupjs-ui'
13
+ ```
14
+
15
+ ## Simple example
16
+
17
+ ```jsx example
18
+ return (
19
+ <Content padding style={{ backgroundColor: 'white' }}>
20
+ <Span>
21
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
22
+ </Span>
23
+ <Divider />
24
+ <Span>
25
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
26
+ </Span>
27
+ </Content>
28
+ )
29
+ ```
30
+
31
+ ## Sizes
32
+
33
+ Size of the divider thin line can be modified using `size` prop. The default size is `m`.
34
+
35
+ ```jsx example
36
+ return (
37
+ <Content padding style={{ backgroundColor: 'white' }}>
38
+ <Span>
39
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
40
+ </Span>
41
+ <Divider size='l' />
42
+ <Span>
43
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
44
+ </Span>
45
+ </Content>
46
+ )
47
+ ```
48
+
49
+ ## Divider width
50
+
51
+ The divider width can be changed by passing a number to `lines` property. The default value of `lines` is `1` and the width of a one line is `16px`.
52
+
53
+ ```jsx example
54
+ return (
55
+ <Content padding style={{ backgroundColor: 'white' }}>
56
+ <Span>
57
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
58
+ </Span>
59
+ <Divider lines={4} />
60
+ <Span>
61
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
62
+ </Span>
63
+ </Content>
64
+ )
65
+ ```
66
+
67
+ ## Vertical divider
68
+
69
+ By default the divider shows horizontally. To make it vertical, you need pass the string `vertical` to the `variant` property.
70
+
71
+ ```jsx example
72
+ return (
73
+ <Content padding style={{ backgroundColor: 'white' }}>
74
+ <Div row>
75
+ <Span>
76
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
77
+ </Span>
78
+ <Divider variant='vertical' />
79
+ <Span>
80
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
81
+ </Span>
82
+ </Div>
83
+ </Content>
84
+ )
85
+ ```
86
+
87
+ ## Sandbox
88
+
89
+ <Sandbox
90
+ Component={Divider}
91
+ propsJsonSchema={DividerPropsJsonSchema}
92
+ />
@@ -0,0 +1,24 @@
1
+ // ----- CONFIG: $UI.Divider
2
+
3
+ $this = merge({
4
+ heights: {
5
+ m: 1px,
6
+ l: 2px
7
+ }
8
+ }, $UI.Divider, true)
9
+
10
+ // ----- COMPONENT
11
+
12
+ .root
13
+ background-color var(--color-bg-main-subtle-alt)
14
+
15
+ &.horizontal
16
+ width 100%
17
+
18
+ &.vertical
19
+ height 100%
20
+
21
+ // ----- JS EXPORTS
22
+
23
+ :export
24
+ config: $this
package/index.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /* eslint-disable */
2
+ // DO NOT MODIFY THIS FILE - IT IS AUTOMATICALLY GENERATED ON COMMITS.
3
+
4
+ import { type StyleProp, type ViewStyle } from 'react-native';
5
+ declare const _default: import("react").ComponentType<DividerProps>;
6
+ export default _default;
7
+ export declare const _PropsJsonSchema: {};
8
+ export interface DividerProps {
9
+ /** Custom styles applied to the divider */
10
+ style?: StyleProp<ViewStyle>;
11
+ /** Divider orientation @default 'horizontal' */
12
+ variant?: 'horizontal' | 'vertical';
13
+ /** Divider thickness preset @default 'm' */
14
+ size?: 'm' | 'l';
15
+ /** Divider length in lines (1 line is 16px) @default 1 */
16
+ lines?: number;
17
+ }
package/index.tsx ADDED
@@ -0,0 +1,56 @@
1
+ import { type ReactNode } from 'react'
2
+ import { View, type StyleProp, type ViewStyle } from 'react-native'
3
+ import { pug, observer } from 'startupjs'
4
+ import { themed, u } from '@startupjs-ui/core'
5
+ import STYLES from './index.cssx.styl'
6
+
7
+ const {
8
+ config: { heights }
9
+ } = STYLES
10
+ const LINE_HEIGHT = u(2)
11
+
12
+ export default observer(themed('Divider', Divider))
13
+
14
+ export const _PropsJsonSchema = {/* DividerProps */}
15
+
16
+ export interface DividerProps {
17
+ /** Custom styles applied to the divider */
18
+ style?: StyleProp<ViewStyle>
19
+ /** Divider orientation @default 'horizontal' */
20
+ variant?: 'horizontal' | 'vertical'
21
+ /** Divider thickness preset @default 'm' */
22
+ size?: 'm' | 'l'
23
+ /** Divider length in lines (1 line is 16px) @default 1 */
24
+ lines?: number
25
+ }
26
+
27
+ function Divider ({
28
+ style,
29
+ size = 'm',
30
+ lines = 1,
31
+ variant = 'horizontal'
32
+ }: DividerProps): ReactNode {
33
+ const lineWidth = heights[size]
34
+ const width = LINE_HEIGHT * lines
35
+ const margin = (width - lineWidth) / 2
36
+ const marginFirstSide = Math.floor(margin)
37
+ const marginSecondSide = Math.ceil(margin)
38
+ const extraStyle: Record<string, any> = {}
39
+
40
+ switch (variant) {
41
+ case 'horizontal':
42
+ extraStyle.height = lineWidth
43
+ extraStyle.marginTop = marginFirstSide
44
+ extraStyle.marginBottom = marginSecondSide
45
+ break
46
+ case 'vertical':
47
+ extraStyle.width = lineWidth
48
+ extraStyle.marginLeft = marginFirstSide
49
+ extraStyle.marginRight = marginSecondSide
50
+ break
51
+ }
52
+
53
+ return pug`
54
+ View.root(style=[extraStyle, style] styleName=[size, variant])
55
+ `
56
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@startupjs-ui/divider",
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
+ }