@startupjs-ui/span 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,29 @@
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/span
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
+ * remove async ([9782d01](https://github.com/startupjs/startupjs-ui/commit/9782d01aa728b4970cf3919055a87eaee27a5d16))
21
+ * remove async await in components ([67c97ec](https://github.com/startupjs/startupjs-ui/commit/67c97eccce202095f0f4c85b1d7c204f6cdc4a6e))
22
+ * specify explicit return for react components ([20648e6](https://github.com/startupjs/startupjs-ui/commit/20648e67c9e004c1e7e8eb01a92bbaf36a0362d0))
23
+
24
+
25
+ ### Features
26
+
27
+ * 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))
28
+ * auto-generate .d.ts files for components on commit ([7d51efe](https://github.com/startupjs/startupjs-ui/commit/7d51efed601aabd217670490ae1cd438b7852970))
29
+ * **icon:** refactor Icon component ([70237be](https://github.com/startupjs/startupjs-ui/commit/70237be3cd372154f1010def67735ef08db0c02a))
package/README.mdx ADDED
@@ -0,0 +1,57 @@
1
+ import { useState } from 'react'
2
+ import { pug } from 'startupjs'
3
+ import Span, { _PropsJsonSchema as SpanPropsJsonSchema } from './index'
4
+ import { Sandbox } from '@startupjs-ui/docs'
5
+
6
+ # Span
7
+
8
+ The base component of typography is `Span`, which is used for plain text.
9
+
10
+ ```jsx
11
+ import { Span } from 'startupjs-ui'
12
+ ```
13
+
14
+ ## Simple example
15
+
16
+ ```jsx example
17
+ <Span>Lorem ipsum dolor sit amet, consectetur adipisicing elit</Span>
18
+ ```
19
+
20
+ ## Headers
21
+
22
+ Use `h1` - `h6` props to create headers.
23
+
24
+ ```jsx example
25
+ <Span h1>H1 Heading</Span>
26
+ <Span h2>H2 Heading</Span>
27
+ <Span h3>H3 Heading</Span>
28
+ <Span h4>H4 Heading</Span>
29
+ <Span h5>H5 Heading</Span>
30
+ <Span h6>H6 Heading</Span>
31
+ ```
32
+
33
+ ## Bold and Italic
34
+
35
+ ```jsx example
36
+ <Span bold>Bold text</Span>
37
+ <Span italic>Italic text</Span>
38
+ <Span bold italic>Bold and Italic text</Span>
39
+ ```
40
+
41
+ ## Description
42
+
43
+ Use `description` prop for secondary text.
44
+
45
+ ```jsx example
46
+ <Span description>Description text</Span>
47
+ ```
48
+
49
+ ## Sandbox
50
+
51
+ <Sandbox
52
+ Component={Span}
53
+ propsJsonSchema={SpanPropsJsonSchema}
54
+ props={{
55
+ children: 'Test text'
56
+ }}
57
+ />
@@ -0,0 +1,45 @@
1
+ // ----- CONFIG: $UI.Span
2
+
3
+ $this = merge({
4
+ color: var(--color-text-main),
5
+ descriptionColor: var(--color-text-description)
6
+ }, $UI.Span, true)
7
+
8
+ // ----- COMPONENT
9
+
10
+ _tags = ('h1' 'h2' 'h3' 'h4' 'h5' 'h6')
11
+
12
+ .root
13
+ color: $this.color
14
+ fontFamily('normal')
15
+ font()
16
+
17
+ for tag in _tags
18
+ &.{tag}
19
+ fontFamily('heading')
20
+ font(tag)
21
+
22
+ &.bold
23
+ fontFamily('normal', $UI.fontWeights.normalBold)
24
+
25
+ &.italic
26
+ fontFamily('normal', $UI.fontWeights.normal, italic)
27
+
28
+ &.bold.italic
29
+ fontFamily('normal', $UI.fontWeights.normalBold, italic)
30
+
31
+ &.description
32
+ color: $this.descriptionColor
33
+
34
+ &.full
35
+ flex: 1
36
+
37
+ // Overrides for headers when bold/italic
38
+ for tag in _tags
39
+ &.{tag}
40
+ &.bold
41
+ fontFamily('heading', $UI.fontWeights.headingBold)
42
+ &.italic
43
+ fontFamily('heading', $UI.fontWeights.heading, italic)
44
+ &.bold.italic
45
+ fontFamily('heading', $UI.fontWeights.headingBold, italic)
package/index.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /* eslint-disable */
2
+ // DO NOT MODIFY THIS FILE - IT IS AUTOMATICALLY GENERATED ON COMMITS.
3
+
4
+ import { type ReactNode, type RefObject } from 'react';
5
+ import { type TextStyle, type StyleProp, type TextProps } from 'react-native';
6
+ import './index.cssx.styl';
7
+ declare const _default: import("react").ComponentType<SpanProps>;
8
+ export default _default;
9
+ export declare const _PropsJsonSchema: {};
10
+ export interface SpanProps extends TextProps {
11
+ /** Ref to access underlying <Text> */
12
+ ref?: RefObject<any>;
13
+ /** Custom styles applied to the root view */
14
+ style?: StyleProp<TextStyle>;
15
+ /** Content rendered inside Span */
16
+ children?: ReactNode;
17
+ /** bold text */
18
+ bold?: boolean;
19
+ /** italic text */
20
+ italic?: boolean;
21
+ /** full width (flex: 1) */
22
+ full?: boolean;
23
+ /** description text color */
24
+ description?: boolean;
25
+ /** theme name */
26
+ theme?: string;
27
+ /** h1 header */
28
+ h1?: boolean;
29
+ /** h2 header */
30
+ h2?: boolean;
31
+ /** h3 header */
32
+ h3?: boolean;
33
+ /** h4 header */
34
+ h4?: boolean;
35
+ /** h5 header */
36
+ h5?: boolean;
37
+ /** h6 header */
38
+ h6?: boolean;
39
+ /** @deprecated use h1-h6 props instead */
40
+ variant?: 'default' | 'description' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
41
+ }
package/index.tsx ADDED
@@ -0,0 +1,90 @@
1
+ import { type ReactNode, type RefObject } from 'react'
2
+ import { Platform, Text, type TextStyle, type StyleProp, type TextProps } from 'react-native'
3
+ import { pug, observer } from 'startupjs'
4
+ import { themed } from '@startupjs-ui/core'
5
+ import './index.cssx.styl'
6
+
7
+ export default observer(themed('Span', Span))
8
+
9
+ export const _PropsJsonSchema = {/* SpanProps */}
10
+
11
+ export interface SpanProps extends TextProps {
12
+ /** Ref to access underlying <Text> */
13
+ ref?: RefObject<any>
14
+ /** Custom styles applied to the root view */
15
+ style?: StyleProp<TextStyle>
16
+ /** Content rendered inside Span */
17
+ children?: ReactNode
18
+ /** bold text */
19
+ bold?: boolean
20
+ /** italic text */
21
+ italic?: boolean
22
+ /** full width (flex: 1) */
23
+ full?: boolean
24
+ /** description text color */
25
+ description?: boolean
26
+ /** theme name */
27
+ theme?: string
28
+ /** h1 header */
29
+ h1?: boolean
30
+ /** h2 header */
31
+ h2?: boolean
32
+ /** h3 header */
33
+ h3?: boolean
34
+ /** h4 header */
35
+ h4?: boolean
36
+ /** h5 header */
37
+ h5?: boolean
38
+ /** h6 header */
39
+ h6?: boolean
40
+ /** @deprecated use h1-h6 props instead */
41
+ variant?: 'default' | 'description' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
42
+ }
43
+
44
+ function Span ({
45
+ ref,
46
+ style,
47
+ children,
48
+ variant,
49
+ bold,
50
+ italic,
51
+ full,
52
+ description,
53
+ theme,
54
+ h1,
55
+ h2,
56
+ h3,
57
+ h4,
58
+ h5,
59
+ h6,
60
+ ...props
61
+ }: SpanProps): ReactNode {
62
+ if (variant && variant !== 'default') {
63
+ if (variant === 'description') {
64
+ console.warn("[@startupjs/ui] Span: variant='description' is DEPRECATED, use prop description instead.")
65
+ } else {
66
+ console.warn(`[@startupjs/ui] Span: variant='${variant}' is DEPRECATED, use font(${variant}) mixin instead or h1-h6 props.`)
67
+ }
68
+ }
69
+
70
+ const tag = h1 ? 'h1' : h2 ? 'h2' : h3 ? 'h3' : h4 ? 'h4' : h5 ? 'h5' : h6 ? 'h6' : undefined
71
+
72
+ const role: any = Platform.OS === 'web' && tag
73
+ ? { accessibilityRole: 'header', accessibilityLevel: tag.replace(/^h/, '') }
74
+ : {}
75
+
76
+ return pug`
77
+ Text.root(
78
+ ref=ref
79
+ style=style
80
+ styleName=[
81
+ theme,
82
+ variant,
83
+ tag,
84
+ { bold, italic, full, description }
85
+ ]
86
+ ...role
87
+ ...props
88
+ )= children
89
+ `
90
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@startupjs-ui/span",
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
+ }