@umituz/react-native-design-system 2.0.1 → 2.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography and responsive utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Divider Domain - Divider Component
3
+ *
4
+ * Universal divider component for visual separation.
5
+ * Supports horizontal, vertical, and text dividers.
6
+ *
7
+ * @domain divider
8
+ * @layer presentation/components
9
+ */
10
+
11
+ import React from 'react';
12
+ import { View, StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
13
+ import { useAppDesignTokens } from '../../theme/hooks/useAppDesignTokens';
14
+ import { AtomicText } from '../../atoms/AtomicText';
15
+ import type { DividerOrientation, DividerStyle, DividerSpacing } from './types';
16
+ import {
17
+ DividerUtils,
18
+ DIVIDER_CONSTANTS,
19
+ } from './types';
20
+
21
+ /**
22
+ * Divider component props
23
+ */
24
+ export interface DividerProps {
25
+ /** Orientation (horizontal or vertical) */
26
+ orientation?: DividerOrientation;
27
+ /** Line style (solid, dashed, dotted) */
28
+ lineStyle?: DividerStyle;
29
+ /** Spacing (margin) */
30
+ spacing?: DividerSpacing;
31
+ /** Custom color */
32
+ color?: string;
33
+ /** Custom thickness */
34
+ thickness?: number;
35
+ /** Text label (for text divider) */
36
+ text?: string;
37
+ /** Custom container style */
38
+ style?: StyleProp<ViewStyle>;
39
+ }
40
+
41
+ /**
42
+ * Divider Component
43
+ *
44
+ * Visual separator for content sections.
45
+ * Supports horizontal, vertical, and text variants.
46
+ *
47
+ * USAGE:
48
+ * ```typescript
49
+ * // Horizontal divider (default)
50
+ * <Divider />
51
+ *
52
+ * // Vertical divider
53
+ * <Divider orientation="vertical" />
54
+ *
55
+ * // Text divider (OR separator)
56
+ * <Divider text="OR" />
57
+ *
58
+ * // Custom spacing
59
+ * <Divider spacing="large" />
60
+ *
61
+ * // Dashed style
62
+ * <Divider lineStyle="dashed" />
63
+ *
64
+ * // Custom color
65
+ * <Divider color="#FF0000" />
66
+ * ```
67
+ */
68
+ export const Divider: React.FC<DividerProps> = ({
69
+ orientation = DIVIDER_CONSTANTS.DEFAULT_ORIENTATION,
70
+ lineStyle = DIVIDER_CONSTANTS.DEFAULT_STYLE,
71
+ spacing = DIVIDER_CONSTANTS.DEFAULT_SPACING,
72
+ color,
73
+ thickness = DIVIDER_CONSTANTS.DEFAULT_THICKNESS,
74
+ text,
75
+ style,
76
+ }) => {
77
+ const tokens = useAppDesignTokens();
78
+ const spacingValue = DividerUtils.getSpacing(spacing);
79
+ const borderColor = color || tokens.colors.border;
80
+
81
+ // Determine border style based on lineStyle
82
+ const getBorderStyle = (): 'solid' | 'dashed' | 'dotted' => {
83
+ return lineStyle;
84
+ };
85
+
86
+ // Horizontal divider
87
+ if (orientation === 'horizontal' && !text) {
88
+ return (
89
+ <View
90
+ style={[
91
+ styles.horizontal,
92
+ {
93
+ marginVertical: spacingValue,
94
+ borderBottomWidth: thickness,
95
+ borderBottomColor: borderColor,
96
+ borderStyle: getBorderStyle(),
97
+ },
98
+ style,
99
+ ]}
100
+ />
101
+ );
102
+ }
103
+
104
+ // Vertical divider
105
+ if (orientation === 'vertical') {
106
+ return (
107
+ <View
108
+ style={[
109
+ styles.vertical,
110
+ {
111
+ marginHorizontal: spacingValue,
112
+ borderLeftWidth: thickness,
113
+ borderLeftColor: borderColor,
114
+ borderStyle: getBorderStyle(),
115
+ },
116
+ style,
117
+ ]}
118
+ />
119
+ );
120
+ }
121
+
122
+ // Text divider (horizontal with text label)
123
+ if (text) {
124
+ return (
125
+ <View
126
+ style={[
127
+ styles.textContainer,
128
+ {
129
+ marginVertical: spacingValue,
130
+ },
131
+ style,
132
+ ]}
133
+ >
134
+ <View
135
+ style={[
136
+ styles.textLine,
137
+ {
138
+ borderBottomWidth: thickness,
139
+ borderBottomColor: borderColor,
140
+ borderStyle: getBorderStyle(),
141
+ },
142
+ ]}
143
+ />
144
+ <AtomicText
145
+ type="bodySmall"
146
+ color="secondary"
147
+ style={styles.textLabel}
148
+ >
149
+ {text}
150
+ </AtomicText>
151
+ <View
152
+ style={[
153
+ styles.textLine,
154
+ {
155
+ borderBottomWidth: thickness,
156
+ borderBottomColor: borderColor,
157
+ borderStyle: getBorderStyle(),
158
+ },
159
+ ]}
160
+ />
161
+ </View>
162
+ );
163
+ }
164
+
165
+ return null;
166
+ };
167
+
168
+ const styles = StyleSheet.create({
169
+ horizontal: {
170
+ width: '100%',
171
+ },
172
+ vertical: {
173
+ height: '100%',
174
+ },
175
+ textContainer: {
176
+ flexDirection: 'row',
177
+ alignItems: 'center',
178
+ width: '100%',
179
+ },
180
+ textLine: {
181
+ flex: 1,
182
+ },
183
+ textLabel: {
184
+ marginHorizontal: 12,
185
+ fontWeight: '500',
186
+ },
187
+ });
@@ -0,0 +1,2 @@
1
+ export * from './Divider';
2
+ export * from './types';
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Divider Domain - Entity Definitions
3
+ *
4
+ * Core types and interfaces for dividers and separators.
5
+ * Simple visual separators for content sections.
6
+ *
7
+ * @domain divider
8
+ * @layer domain/entities
9
+ */
10
+
11
+ /**
12
+ * Divider orientation
13
+ */
14
+ export type DividerOrientation = 'horizontal' | 'vertical';
15
+
16
+ /**
17
+ * Divider style
18
+ */
19
+ export type DividerStyle = 'solid' | 'dashed' | 'dotted';
20
+
21
+ /**
22
+ * Divider spacing
23
+ */
24
+ export type DividerSpacing = 'none' | 'small' | 'medium' | 'large';
25
+
26
+ /**
27
+ * Divider configuration
28
+ */
29
+ export interface DividerConfig {
30
+ /** Orientation */
31
+ orientation: DividerOrientation;
32
+ /** Line style */
33
+ style: DividerStyle;
34
+ /** Spacing (margin) */
35
+ spacing: DividerSpacing;
36
+ /** Custom color */
37
+ color?: string;
38
+ /** Custom thickness */
39
+ thickness?: number;
40
+ /** Text label (for text divider) */
41
+ text?: string;
42
+ }
43
+
44
+ /**
45
+ * Spacing configurations (px)
46
+ */
47
+ export const SPACING_CONFIGS: Record<DividerSpacing, number> = {
48
+ none: 0,
49
+ small: 8,
50
+ medium: 16,
51
+ large: 24,
52
+ };
53
+
54
+ /**
55
+ * Divider utility class
56
+ */
57
+ export class DividerUtils {
58
+ /**
59
+ * Get spacing value
60
+ */
61
+ static getSpacing(spacing: DividerSpacing): number {
62
+ return SPACING_CONFIGS[spacing];
63
+ }
64
+
65
+ /**
66
+ * Validate divider config
67
+ */
68
+ static validateConfig(config: Partial<DividerConfig>): DividerConfig {
69
+ return {
70
+ orientation: config.orientation || 'horizontal',
71
+ style: config.style || 'solid',
72
+ spacing: config.spacing || 'medium',
73
+ color: config.color,
74
+ thickness: config.thickness || 1,
75
+ text: config.text,
76
+ };
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Divider constants
82
+ */
83
+ export const DIVIDER_CONSTANTS = {
84
+ DEFAULT_ORIENTATION: 'horizontal' as DividerOrientation,
85
+ DEFAULT_STYLE: 'solid' as DividerStyle,
86
+ DEFAULT_SPACING: 'medium' as DividerSpacing,
87
+ DEFAULT_THICKNESS: 1,
88
+ } as const;
@@ -17,3 +17,6 @@ export type {
17
17
  ConfirmationModalProps,
18
18
  ConfirmationModalVariant,
19
19
  } from './confirmation-modal/types/';
20
+
21
+ // Divider
22
+ export * from './Divider';