@vetc-miniapp/ui-react 0.0.22 → 0.0.24

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.
Files changed (57) hide show
  1. package/README.md +375 -56
  2. package/package.json +17 -5
  3. package/src/dist/ui-react/index.js +1 -1
  4. package/src/ui-react/components/avatar/Avatar.tsx +88 -0
  5. package/src/ui-react/components/avatar/index.ts +2 -0
  6. package/src/ui-react/components/bottom-sheet/BottomSheet.tsx +149 -0
  7. package/src/ui-react/components/bottom-sheet/index.ts +2 -0
  8. package/src/ui-react/components/button/Button.tsx +246 -0
  9. package/src/ui-react/components/button/index.ts +2 -0
  10. package/src/ui-react/components/button-group/ButtonGroup.tsx +108 -0
  11. package/src/ui-react/components/button-group/index.ts +2 -0
  12. package/src/ui-react/components/card/Card.tsx +77 -0
  13. package/src/ui-react/components/card/index.ts +2 -0
  14. package/src/ui-react/components/checkbox/Checkbox.tsx +232 -0
  15. package/src/ui-react/components/checkbox/index.ts +2 -0
  16. package/src/ui-react/components/chip/Chip.tsx +137 -0
  17. package/src/ui-react/components/chip/index.ts +2 -0
  18. package/src/ui-react/components/dialog/Dialog.tsx +135 -0
  19. package/src/ui-react/components/dialog/index.ts +2 -0
  20. package/src/ui-react/components/divider/Divider.tsx +54 -0
  21. package/src/ui-react/components/divider/index.ts +2 -0
  22. package/src/ui-react/components/input/Input.tsx +195 -0
  23. package/src/ui-react/components/input/index.ts +2 -0
  24. package/src/ui-react/components/list/List.tsx +180 -0
  25. package/src/ui-react/components/list/index.ts +2 -0
  26. package/src/ui-react/components/loading/Loading.tsx +121 -0
  27. package/src/ui-react/components/loading/index.ts +2 -0
  28. package/src/ui-react/components/modal/Modal.tsx +116 -0
  29. package/src/ui-react/components/modal/index.ts +2 -0
  30. package/src/ui-react/components/navigation-bar/NavigationBar.tsx +188 -0
  31. package/src/ui-react/components/navigation-bar/index.ts +2 -0
  32. package/src/ui-react/components/radio/Radio.tsx +216 -0
  33. package/src/ui-react/components/radio/index.ts +2 -0
  34. package/src/ui-react/components/select/Select.tsx +109 -0
  35. package/src/ui-react/components/select/index.ts +2 -0
  36. package/src/ui-react/components/switch/Switch.tsx +164 -0
  37. package/src/ui-react/components/switch/index.ts +2 -0
  38. package/src/ui-react/components/tab-bar/TabBar.tsx +137 -0
  39. package/src/ui-react/components/tab-bar/index.ts +2 -0
  40. package/src/ui-react/components/textarea/Textarea.tsx +109 -0
  41. package/src/ui-react/components/textarea/index.ts +2 -0
  42. package/src/ui-react/components/toast/Toast.ts +98 -0
  43. package/src/ui-react/components/toast/index.ts +2 -0
  44. package/src/ui-react/components/typography/Typography.tsx +201 -0
  45. package/src/ui-react/components/typography/index.ts +2 -0
  46. package/src/ui-react/hooks/use-did-show.js +1 -0
  47. package/src/ui-react/hooks/use-tap-app-bar.js +26 -0
  48. package/src/ui-react/hooks/use-tap-app-bar.ts +34 -0
  49. package/src/ui-react/index.js +1 -0
  50. package/src/ui-react/index.ts +79 -3
  51. package/src/ui-react/styles/VETCProvider.tsx +152 -0
  52. package/src/ui-react/styles/tokens.css +427 -0
  53. package/src/ui-react/tokens/colors.ts +91 -0
  54. package/src/ui-react/tokens/index.ts +3 -0
  55. package/src/ui-react/tokens/spacing.ts +59 -0
  56. package/src/ui-react/tokens/typography.ts +63 -0
  57. package/src/ui-react/tokens_vetc.json +1517 -0
@@ -0,0 +1,232 @@
1
+ /**
2
+ * VETC Checkbox & CheckboxGroup
3
+ * Figma: size=20px, touch-area=48px, states: default/hover/pressed/selected/indeterminate/disabled
4
+ * variant: neutral (gray-90) | brand (green-40)
5
+ */
6
+ import React, { useState } from 'react';
7
+
8
+ export type CheckboxVariant = 'neutral' | 'brand';
9
+
10
+ export interface CheckboxProps {
11
+ label?: React.ReactNode;
12
+ description?: React.ReactNode;
13
+ checked?: boolean;
14
+ defaultChecked?: boolean;
15
+ indeterminate?: boolean;
16
+ disabled?: boolean;
17
+ variant?: CheckboxVariant;
18
+ onChange?: (checked: boolean) => void;
19
+ value?: any;
20
+ id?: string;
21
+ className?: string;
22
+ style?: React.CSSProperties;
23
+ }
24
+
25
+ const CheckIcon = () => (
26
+ <svg width="12" height="9" viewBox="0 0 12 9" fill="none" aria-hidden="true">
27
+ <path d="M1 4L4.5 7.5L11 1" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
28
+ </svg>
29
+ );
30
+
31
+ const IndeterminateIcon = () => (
32
+ <svg width="10" height="2" viewBox="0 0 10 2" fill="none" aria-hidden="true">
33
+ <path d="M1 1H9" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
34
+ </svg>
35
+ );
36
+
37
+ export function Checkbox({
38
+ label,
39
+ description,
40
+ checked,
41
+ defaultChecked = false,
42
+ indeterminate = false,
43
+ disabled = false,
44
+ variant = 'brand',
45
+ onChange,
46
+ value,
47
+ id,
48
+ className = '',
49
+ style,
50
+ }: CheckboxProps) {
51
+ const [internalChecked, setInternalChecked] = useState(defaultChecked);
52
+ const [hovered, setHovered] = useState(false);
53
+
54
+ const isControlled = checked !== undefined;
55
+ const isChecked = isControlled ? checked : internalChecked;
56
+ const isActive = isChecked || indeterminate;
57
+
58
+ const handleChange = () => {
59
+ if (disabled) return;
60
+ const next = !isChecked;
61
+ if (!isControlled) setInternalChecked(next);
62
+ onChange?.(next);
63
+ };
64
+
65
+ const accentColor = variant === 'brand'
66
+ ? 'var(--vetc-color-brand)'
67
+ : 'var(--vetc-gray-90)';
68
+ const accentHover = variant === 'brand'
69
+ ? 'var(--vetc-color-brand-hover)'
70
+ : 'var(--vetc-gray-70)';
71
+
72
+ let boxBg = 'transparent';
73
+ let boxBorder = disabled ? 'var(--vetc-color-border-disabled)' : hovered ? accentColor : 'var(--vetc-color-border)';
74
+ let iconColor = 'var(--vetc-white)';
75
+
76
+ if (isActive) {
77
+ boxBg = disabled ? 'var(--vetc-color-bg-disabled)' : accentColor;
78
+ boxBorder = disabled ? 'var(--vetc-color-border-disabled)' : hovered ? accentHover : accentColor;
79
+ iconColor = disabled ? 'var(--vetc-color-text-disabled)' : 'var(--vetc-white)';
80
+ if (disabled) boxBg = 'var(--vetc-color-bg-disabled)';
81
+ }
82
+
83
+ return (
84
+ <label
85
+ htmlFor={id}
86
+ className={`vetc-checkbox ${className}`}
87
+ onMouseEnter={() => !disabled && setHovered(true)}
88
+ onMouseLeave={() => setHovered(false)}
89
+ style={{
90
+ display: 'inline-flex',
91
+ alignItems: description ? 'flex-start' : 'center',
92
+ gap: 'var(--vetc-space-12)',
93
+ cursor: disabled ? 'not-allowed' : 'pointer',
94
+ userSelect: 'none',
95
+ fontFamily: 'var(--vetc-font-family)',
96
+ ...style,
97
+ }}
98
+ >
99
+ <input
100
+ id={id}
101
+ type="checkbox"
102
+ checked={isChecked}
103
+ disabled={disabled}
104
+ value={value}
105
+ onChange={handleChange}
106
+ style={{ position: 'absolute', opacity: 0, width: 0, height: 0, pointerEvents: 'none' }}
107
+ aria-checked={indeterminate ? 'mixed' : isChecked}
108
+ />
109
+
110
+ {/* Visual box */}
111
+ <span
112
+ aria-hidden="true"
113
+ style={{
114
+ width: '20px',
115
+ height: '20px',
116
+ flexShrink: 0,
117
+ borderRadius: 'var(--vetc-radius-xs)',
118
+ border: `1.5px solid ${boxBorder}`,
119
+ backgroundColor: boxBg,
120
+ display: 'flex',
121
+ alignItems: 'center',
122
+ justifyContent: 'center',
123
+ transition: 'background-color var(--vetc-transition-fast), border-color var(--vetc-transition-fast)',
124
+ color: iconColor,
125
+ marginTop: description ? '2px' : 0,
126
+ }}
127
+ >
128
+ {isChecked && !indeterminate && <CheckIcon />}
129
+ {indeterminate && <IndeterminateIcon />}
130
+ </span>
131
+
132
+ {/* Label + description */}
133
+ {(label || description) && (
134
+ <span style={{ display: 'flex', flexDirection: 'column', gap: 'var(--vetc-space-2)' }}>
135
+ {label && (
136
+ <span style={{
137
+ fontSize: 'var(--vetc-font-size-base)',
138
+ fontWeight: 'var(--vetc-font-weight-regular)' as any,
139
+ lineHeight: 'var(--vetc-line-height-relaxed)',
140
+ color: disabled ? 'var(--vetc-color-text-disabled)' : 'var(--vetc-color-text-primary)',
141
+ }}>
142
+ {label}
143
+ </span>
144
+ )}
145
+ {description && (
146
+ <span style={{
147
+ fontSize: 'var(--vetc-font-size-sm)',
148
+ fontWeight: 'var(--vetc-font-weight-regular)' as any,
149
+ lineHeight: 'var(--vetc-line-height-relaxed)',
150
+ color: disabled ? 'var(--vetc-color-text-disabled)' : 'var(--vetc-color-text-secondary)',
151
+ }}>
152
+ {description}
153
+ </span>
154
+ )}
155
+ </span>
156
+ )}
157
+ </label>
158
+ );
159
+ }
160
+
161
+ // ── CheckboxGroup ─────────────────────────────────────────────────────────────
162
+ export interface CheckboxOption {
163
+ label: React.ReactNode;
164
+ description?: React.ReactNode;
165
+ value: any;
166
+ disabled?: boolean;
167
+ }
168
+
169
+ export interface CheckboxGroupProps {
170
+ options: CheckboxOption[];
171
+ value?: any[];
172
+ defaultValue?: any[];
173
+ direction?: 'horizontal' | 'vertical';
174
+ disabled?: boolean;
175
+ variant?: CheckboxVariant;
176
+ onChange?: (values: any[]) => void;
177
+ className?: string;
178
+ style?: React.CSSProperties;
179
+ }
180
+
181
+ export function CheckboxGroup({
182
+ options,
183
+ value,
184
+ defaultValue = [],
185
+ direction = 'vertical',
186
+ disabled = false,
187
+ variant = 'brand',
188
+ onChange,
189
+ className = '',
190
+ style,
191
+ }: CheckboxGroupProps) {
192
+ const [internalValue, setInternalValue] = useState<any[]>(defaultValue);
193
+ const isControlled = value !== undefined;
194
+ const currentValue = isControlled ? value! : internalValue;
195
+
196
+ const handleChange = (optValue: any, checked: boolean) => {
197
+ const next = checked
198
+ ? [...currentValue, optValue]
199
+ : currentValue.filter((v) => v !== optValue);
200
+ if (!isControlled) setInternalValue(next);
201
+ onChange?.(next);
202
+ };
203
+
204
+ return (
205
+ <div
206
+ className={`vetc-checkbox-group ${className}`}
207
+ style={{
208
+ display: 'flex',
209
+ flexDirection: direction === 'vertical' ? 'column' : 'row',
210
+ flexWrap: direction === 'horizontal' ? 'wrap' : undefined,
211
+ gap: direction === 'vertical' ? 'var(--vetc-space-12)' : 'var(--vetc-space-16)',
212
+ fontFamily: 'var(--vetc-font-family)',
213
+ ...style,
214
+ }}
215
+ >
216
+ {options.map((opt) => (
217
+ <Checkbox
218
+ key={String(opt.value)}
219
+ label={opt.label}
220
+ description={opt.description}
221
+ checked={currentValue.includes(opt.value)}
222
+ disabled={opt.disabled ?? disabled}
223
+ variant={variant}
224
+ value={opt.value}
225
+ onChange={(chk) => handleChange(opt.value, chk)}
226
+ />
227
+ ))}
228
+ </div>
229
+ );
230
+ }
231
+
232
+ export default Checkbox;
@@ -0,0 +1,2 @@
1
+ export { Checkbox, CheckboxGroup } from './Checkbox';
2
+ export type { CheckboxProps, CheckboxGroupProps, CheckboxOption, CheckboxVariant } from './Checkbox';
@@ -0,0 +1,137 @@
1
+ /**
2
+ * VETC Chip / Tag — tokenized
3
+ * Figma: Chip page (7 types × 3 styles)
4
+ */
5
+ import React from 'react';
6
+ import { Tag as AntTag } from 'antd';
7
+
8
+ export type ChipStyle = 'filled' | 'outlined' | 'tinted';
9
+ export type ChipType = 'default' | 'brand' | 'positive' | 'negative' | 'warning' | 'info';
10
+ export type ChipShape = 'pill' | 'rounded';
11
+
12
+ // Map type → CSS vars (from tokens.css --vetc-chip-*)
13
+ const typeVarMap: Record<ChipType, { bg: string; border: string; text: string; filledBg: string }> = {
14
+ default: {
15
+ bg: 'var(--vetc-chip-default-bg)',
16
+ border: 'var(--vetc-chip-default-border)',
17
+ text: 'var(--vetc-chip-default-text)',
18
+ filledBg: 'var(--vetc-chip-default-filled-bg)',
19
+ },
20
+ brand: {
21
+ bg: 'var(--vetc-chip-brand-bg)',
22
+ border: 'var(--vetc-chip-brand-border)',
23
+ text: 'var(--vetc-chip-brand-text)',
24
+ filledBg: 'var(--vetc-chip-brand-filled-bg)',
25
+ },
26
+ positive: {
27
+ bg: 'var(--vetc-chip-positive-bg)',
28
+ border: 'var(--vetc-chip-positive-border)',
29
+ text: 'var(--vetc-chip-positive-text)',
30
+ filledBg: 'var(--vetc-chip-positive-filled-bg)',
31
+ },
32
+ negative: {
33
+ bg: 'var(--vetc-chip-negative-bg)',
34
+ border: 'var(--vetc-chip-negative-border)',
35
+ text: 'var(--vetc-chip-negative-text)',
36
+ filledBg: 'var(--vetc-chip-negative-filled-bg)',
37
+ },
38
+ warning: {
39
+ bg: 'var(--vetc-chip-warning-bg)',
40
+ border: 'var(--vetc-chip-warning-border)',
41
+ text: 'var(--vetc-chip-warning-text)',
42
+ filledBg: 'var(--vetc-chip-warning-filled-bg)',
43
+ },
44
+ info: {
45
+ bg: 'var(--vetc-chip-info-bg)',
46
+ border: 'var(--vetc-chip-info-border)',
47
+ text: 'var(--vetc-chip-info-text)',
48
+ filledBg: 'var(--vetc-chip-info-filled-bg)',
49
+ },
50
+ };
51
+
52
+ export interface ChipProps {
53
+ style?: ChipStyle;
54
+ type?: ChipType;
55
+ shape?: ChipShape;
56
+ size?: 'md' | 'sm';
57
+ icon?: React.ReactNode;
58
+ closable?: boolean;
59
+ onClose?: () => void;
60
+ onClick?: () => void;
61
+ children?: React.ReactNode;
62
+ className?: string;
63
+ css?: React.CSSProperties;
64
+ id?: string;
65
+ }
66
+
67
+ export function Chip({
68
+ style = 'tinted',
69
+ type = 'default',
70
+ shape = 'pill',
71
+ size = 'md',
72
+ icon,
73
+ closable = false,
74
+ onClose,
75
+ onClick,
76
+ children,
77
+ className = '',
78
+ css,
79
+ id,
80
+ }: ChipProps) {
81
+ const vars = typeVarMap[type];
82
+
83
+ const height = size === 'md' ? 'var(--vetc-chip-height-md)' : 'var(--vetc-chip-height-sm)';
84
+ const paddingX = size === 'md' ? 'var(--vetc-chip-padding-x-md)' : 'var(--vetc-chip-padding-x-sm)';
85
+ const fontSize = size === 'md' ? 'var(--vetc-chip-font-size-md)' : 'var(--vetc-chip-font-size-sm)';
86
+ const fontWeight = 'var(--vetc-chip-font-weight)';
87
+ const borderRadius = shape === 'pill' ? 'var(--vetc-chip-radius-pill)' : 'var(--vetc-chip-radius-rounded)';
88
+
89
+ let bg = vars.bg;
90
+ let border = `1px solid ${vars.border}`;
91
+ let textColor = vars.text;
92
+
93
+ if (style === 'filled') {
94
+ bg = vars.filledBg;
95
+ border = 'none';
96
+ textColor = 'var(--vetc-white)';
97
+ } else if (style === 'outlined') {
98
+ bg = 'transparent';
99
+ border = `1px solid ${vars.border}`;
100
+ textColor = vars.text;
101
+ }
102
+ // tinted: bg + border (default)
103
+
104
+ return (
105
+ <AntTag
106
+ id={id}
107
+ closable={closable}
108
+ onClose={(e) => { e.preventDefault(); onClose?.(); }}
109
+ onClick={onClick}
110
+ icon={icon}
111
+ className={`vetc-chip vetc-chip--${style} vetc-chip--${type} ${className}`}
112
+ style={{
113
+ display: 'inline-flex',
114
+ alignItems: 'center',
115
+ height,
116
+ padding: `0 ${paddingX}`,
117
+ borderRadius,
118
+ background: bg,
119
+ border,
120
+ color: textColor,
121
+ fontSize,
122
+ fontWeight: fontWeight as any,
123
+ fontFamily: 'var(--vetc-font-family)',
124
+ cursor: onClick ? 'pointer' : 'default',
125
+ userSelect: 'none',
126
+ lineHeight: 1,
127
+ gap: 'var(--vetc-space-4)',
128
+ transition: 'var(--vetc-transition-fast)',
129
+ ...css,
130
+ }}
131
+ >
132
+ {children}
133
+ </AntTag>
134
+ );
135
+ }
136
+
137
+ export default Chip;
@@ -0,0 +1,2 @@
1
+ export { Chip } from './Chip';
2
+ export type { ChipProps, ChipStyle, ChipType, ChipShape } from './Chip';
@@ -0,0 +1,135 @@
1
+ import React, { useEffect } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { Button } from '../button';
4
+
5
+ export interface DialogProps {
6
+ open: boolean;
7
+ /** Optional image URL shown at the top of the dialog */
8
+ image?: string;
9
+ title?: React.ReactNode;
10
+ description?: React.ReactNode;
11
+ okText?: string;
12
+ cancelText?: string;
13
+ okDisabled?: boolean;
14
+ okLoading?: boolean;
15
+ okDanger?: boolean;
16
+ onOk?: () => void;
17
+ onCancel?: () => void;
18
+ /** Close dialog when clicking outside (default: true) */
19
+ maskClosable?: boolean;
20
+ }
21
+
22
+ export function Dialog({
23
+ open,
24
+ image,
25
+ title,
26
+ description,
27
+ okText = 'Xác nhận',
28
+ cancelText = 'Hủy',
29
+ okDisabled = false,
30
+ okLoading = false,
31
+ okDanger = false,
32
+ onOk,
33
+ onCancel,
34
+ maskClosable = true,
35
+ }: DialogProps) {
36
+ useEffect(() => {
37
+ if (open) document.body.style.overflow = 'hidden';
38
+ else document.body.style.overflow = '';
39
+ return () => { document.body.style.overflow = ''; };
40
+ }, [open]);
41
+
42
+ if (!open) return null;
43
+
44
+ const hasContent = title || description;
45
+
46
+ return createPortal(
47
+ <div
48
+ style={{
49
+ position: 'fixed',
50
+ inset: 0,
51
+ backgroundColor: 'var(--vetc-dialog-overlay)',
52
+ display: 'flex',
53
+ alignItems: 'center',
54
+ justifyContent: 'center',
55
+ zIndex: 1000,
56
+ padding: '0 var(--vetc-space-24)',
57
+ }}
58
+ onClick={maskClosable ? onCancel : undefined}
59
+ >
60
+ <div
61
+ style={{
62
+ width: '100%',
63
+ maxWidth: 'var(--vetc-dialog-width)',
64
+ backgroundColor: 'var(--vetc-dialog-bg)',
65
+ borderRadius: 'var(--vetc-dialog-radius)',
66
+ overflow: 'hidden',
67
+ boxShadow: 'var(--vetc-shadow-lg)',
68
+ fontFamily: 'var(--vetc-font-family)',
69
+ }}
70
+ onClick={e => e.stopPropagation()}
71
+ >
72
+ {image && (
73
+ <div style={{ width: '100%', height: 'var(--vetc-dialog-image-height)', overflow: 'hidden', flexShrink: 0 }}>
74
+ <img
75
+ src={image}
76
+ alt=""
77
+ style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }}
78
+ />
79
+ </div>
80
+ )}
81
+
82
+ {hasContent && (
83
+ <div style={{ padding: 'var(--vetc-dialog-padding)' }}>
84
+ {title && (
85
+ <div style={{
86
+ fontSize: 'var(--vetc-dialog-title-size)',
87
+ fontWeight: 'var(--vetc-dialog-title-weight)',
88
+ color: 'var(--vetc-color-text-primary)',
89
+ lineHeight: 'var(--vetc-line-height-relaxed)',
90
+ marginBottom: description ? 'var(--vetc-space-8)' : 0,
91
+ }}>
92
+ {title}
93
+ </div>
94
+ )}
95
+ {description && (
96
+ <div style={{
97
+ fontSize: 'var(--vetc-dialog-desc-size)',
98
+ color: 'var(--vetc-dialog-desc-color)',
99
+ lineHeight: 'var(--vetc-line-height-relaxed)',
100
+ }}>
101
+ {description}
102
+ </div>
103
+ )}
104
+ </div>
105
+ )}
106
+
107
+ <div style={{
108
+ display: 'flex',
109
+ gap: 'var(--vetc-dialog-btn-gap)',
110
+ padding: hasContent
111
+ ? `0 var(--vetc-dialog-padding) var(--vetc-dialog-padding)`
112
+ : 'var(--vetc-dialog-padding)',
113
+ }}>
114
+ {onCancel && (
115
+ <Button block style="outlined" variant="neutral" onClick={onCancel}>
116
+ {cancelText}
117
+ </Button>
118
+ )}
119
+ <Button
120
+ block
121
+ style={okDanger ? 'danger' : 'filled'}
122
+ loading={okLoading}
123
+ disabled={okDisabled}
124
+ onClick={onOk}
125
+ >
126
+ {okText}
127
+ </Button>
128
+ </div>
129
+ </div>
130
+ </div>,
131
+ document.body,
132
+ );
133
+ }
134
+
135
+ export default Dialog;
@@ -0,0 +1,2 @@
1
+ export { Dialog } from './Dialog';
2
+ export type { DialogProps } from './Dialog';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * VETC Divider — tokenized
3
+ */
4
+ import React from 'react';
5
+ import { Divider as AntDivider } from 'antd';
6
+
7
+ export interface DividerProps {
8
+ orientation?: 'horizontal' | 'vertical';
9
+ label?: React.ReactNode;
10
+ labelAlign?: 'left' | 'center' | 'right';
11
+ thickness?: number;
12
+ color?: string;
13
+ margin?: string;
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ }
17
+
18
+ export function Divider({
19
+ orientation = 'horizontal',
20
+ label,
21
+ labelAlign = 'center',
22
+ thickness = 1,
23
+ color,
24
+ margin,
25
+ className = '',
26
+ style,
27
+ }: DividerProps) {
28
+ const isVertical = orientation === 'vertical';
29
+
30
+ return (
31
+ <AntDivider
32
+ type={isVertical ? 'vertical' : 'horizontal'}
33
+ orientationMargin={labelAlign !== 'center' ? 0 : undefined}
34
+ orientation={labelAlign !== 'center' ? labelAlign as any : undefined}
35
+ className={`vetc-divider ${className}`}
36
+ style={{
37
+ borderColor: color ?? 'var(--vetc-divider-color)',
38
+ borderTopWidth: !isVertical ? thickness : undefined,
39
+ borderLeftWidth: isVertical ? thickness : undefined,
40
+ margin: margin ?? (isVertical
41
+ ? `0 var(--vetc-divider-margin-v)`
42
+ : `var(--vetc-divider-margin-h) 0`),
43
+ fontFamily: 'var(--vetc-font-family)',
44
+ fontSize: 'var(--vetc-divider-label-size)',
45
+ color: 'var(--vetc-divider-label-color)',
46
+ ...style,
47
+ }}
48
+ >
49
+ {label}
50
+ </AntDivider>
51
+ );
52
+ }
53
+
54
+ export default Divider;
@@ -0,0 +1,2 @@
1
+ export { Divider } from './Divider';
2
+ export type { DividerProps } from './Divider';