@gogitcms/design-system 0.15.0-next.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/README.md +77 -0
- package/css/components.css +312 -0
- package/css/tokens.css +212 -0
- package/package.json +65 -0
- package/src/ThemeProvider.tsx +86 -0
- package/src/__tests__/ApplyChangesModal.test.tsx +148 -0
- package/src/__tests__/BranchImport.test.tsx +46 -0
- package/src/__tests__/Button.test.tsx +45 -0
- package/src/__tests__/ChangeRequestSummary.test.tsx +57 -0
- package/src/__tests__/ContentBrowser.changes.test.tsx +611 -0
- package/src/__tests__/ContentBrowser.collab.test.tsx +322 -0
- package/src/__tests__/ContentBrowser.collabsync.test.tsx +264 -0
- package/src/__tests__/ContentBrowser.contentslot.test.tsx +53 -0
- package/src/__tests__/ContentBrowser.discriminator.test.tsx +142 -0
- package/src/__tests__/ContentBrowser.drafts.test.tsx +271 -0
- package/src/__tests__/ContentBrowser.fields.test.tsx +117 -0
- package/src/__tests__/ContentBrowser.media.test.tsx +140 -0
- package/src/__tests__/ContentBrowser.mixedcollab.test.tsx +63 -0
- package/src/__tests__/ContentBrowser.mixedvalues.test.tsx +38 -0
- package/src/__tests__/ContentBrowser.pagination.test.tsx +62 -0
- package/src/__tests__/ContentBrowser.previewtab.test.tsx +212 -0
- package/src/__tests__/ContentBrowser.reorder.test.tsx +45 -0
- package/src/__tests__/ContentBrowser.search.test.tsx +135 -0
- package/src/__tests__/ContentBrowser.selectvalue.test.tsx +185 -0
- package/src/__tests__/ContentBrowser.staged.test.tsx +132 -0
- package/src/__tests__/ContentBrowser.usermenu.test.tsx +56 -0
- package/src/__tests__/MediaBrowser.test.tsx +353 -0
- package/src/__tests__/MediaField.test.tsx +185 -0
- package/src/__tests__/Notifications.test.tsx +69 -0
- package/src/__tests__/Onboarding.test.tsx +287 -0
- package/src/__tests__/cssTokens.test.ts +201 -0
- package/src/__tests__/fieldComponents.test.ts +43 -0
- package/src/__tests__/reorder.test.ts +58 -0
- package/src/components/ApplyChangesModal.tsx +348 -0
- package/src/components/BranchImport.tsx +157 -0
- package/src/components/BranchMenu.tsx +192 -0
- package/src/components/Button.tsx +131 -0
- package/src/components/ChangeDetail.tsx +472 -0
- package/src/components/ChangeRequestSummary.tsx +173 -0
- package/src/components/CollabField.tsx +388 -0
- package/src/components/ContentBrowser.tsx +5073 -0
- package/src/components/Icon.tsx +28 -0
- package/src/components/Icon.web.tsx +31 -0
- package/src/components/Input.tsx +106 -0
- package/src/components/MediaBrowser.tsx +766 -0
- package/src/components/MediaField.tsx +670 -0
- package/src/components/MediaPreview.tsx +91 -0
- package/src/components/MediaPreview.web.tsx +169 -0
- package/src/components/NavRow.tsx +105 -0
- package/src/components/Notifications.tsx +301 -0
- package/src/components/Onboarding.tsx +751 -0
- package/src/components/ProjectMenu.tsx +124 -0
- package/src/components/Segment.tsx +87 -0
- package/src/components/Skeleton.tsx +216 -0
- package/src/components/Spinner.tsx +44 -0
- package/src/components/Text.tsx +85 -0
- package/src/components/documentDrafts.ts +213 -0
- package/src/components/layout.tsx +284 -0
- package/src/components/primitives.tsx +143 -0
- package/src/components/reorder.ts +40 -0
- package/src/fieldComponents.ts +63 -0
- package/src/icons.ts +102 -0
- package/src/index.ts +198 -0
- package/src/media.ts +229 -0
- package/src/theme.ts +116 -0
- package/src/web/Button.tsx +110 -0
- package/src/web/Icon.tsx +52 -0
- package/src/web/Input.tsx +39 -0
- package/src/web/index.ts +43 -0
- package/src/web/primitives.tsx +119 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
import { icons, IconName } from "../icons";
|
|
4
|
+
|
|
5
|
+
export type IconProps = {
|
|
6
|
+
name: IconName;
|
|
7
|
+
size?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Native: react-native-svg. (Web uses Icon.web.tsx via platform resolution.)
|
|
13
|
+
export function Icon({ name, size = 18, color = "#000", strokeWidth = 1.5 }: IconProps) {
|
|
14
|
+
return (
|
|
15
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
16
|
+
{icons[name].map((d, i) => (
|
|
17
|
+
<Path
|
|
18
|
+
key={i}
|
|
19
|
+
d={d}
|
|
20
|
+
stroke={color}
|
|
21
|
+
strokeWidth={strokeWidth}
|
|
22
|
+
strokeLinecap="round"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
/>
|
|
25
|
+
))}
|
|
26
|
+
</Svg>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { icons, IconName } from "../icons";
|
|
3
|
+
|
|
4
|
+
export type IconProps = {
|
|
5
|
+
name: IconName;
|
|
6
|
+
size?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Web: a raw <svg> renders directly inside the react-native-web DOM tree.
|
|
12
|
+
export function Icon({ name, size = 18, color = "currentColor", strokeWidth = 1.5 }: IconProps) {
|
|
13
|
+
return (
|
|
14
|
+
<svg
|
|
15
|
+
width={size}
|
|
16
|
+
height={size}
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
fill="none"
|
|
19
|
+
stroke={color}
|
|
20
|
+
strokeWidth={strokeWidth}
|
|
21
|
+
strokeLinecap="round"
|
|
22
|
+
strokeLinejoin="round"
|
|
23
|
+
style={{ display: "block", flexShrink: 0 }}
|
|
24
|
+
aria-hidden
|
|
25
|
+
>
|
|
26
|
+
{icons[name].map((d, i) => (
|
|
27
|
+
<path key={i} d={d} />
|
|
28
|
+
))}
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { View, TextInput, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { useTheme } from "../ThemeProvider";
|
|
4
|
+
import { Text } from "./Text";
|
|
5
|
+
|
|
6
|
+
export type InputProps = {
|
|
7
|
+
value: string;
|
|
8
|
+
onChangeText: (text: string) => void;
|
|
9
|
+
label?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
secureTextEntry?: boolean;
|
|
12
|
+
mono?: boolean;
|
|
13
|
+
autoCapitalize?: "none" | "sentences" | "words" | "characters";
|
|
14
|
+
size?: "md" | "lg";
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
onSubmitEditing?: () => void;
|
|
17
|
+
keyboardType?: "default" | "numeric";
|
|
18
|
+
// editable defaults to true; false renders a muted, read-only field (still
|
|
19
|
+
// shows the value) — used to reflect a permission the caller lacks.
|
|
20
|
+
editable?: boolean;
|
|
21
|
+
// error highlights the field with the danger border color (e.g. a failed save
|
|
22
|
+
// or validation naming this field).
|
|
23
|
+
error?: boolean;
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
testID?: string;
|
|
26
|
+
// Optional focus/blur passthroughs (used by collaborative presence tracking).
|
|
27
|
+
onFocus?: () => void;
|
|
28
|
+
onBlur?: () => void;
|
|
29
|
+
// When this number changes to a truthy value, the field programmatically
|
|
30
|
+
// focuses itself (used to jump to a peer's field from a presence avatar).
|
|
31
|
+
focusSignal?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function Input({
|
|
35
|
+
value,
|
|
36
|
+
onChangeText,
|
|
37
|
+
label,
|
|
38
|
+
placeholder,
|
|
39
|
+
secureTextEntry,
|
|
40
|
+
mono,
|
|
41
|
+
autoCapitalize = "none",
|
|
42
|
+
size = "lg",
|
|
43
|
+
autoFocus,
|
|
44
|
+
onSubmitEditing,
|
|
45
|
+
keyboardType,
|
|
46
|
+
editable = true,
|
|
47
|
+
error = false,
|
|
48
|
+
style,
|
|
49
|
+
testID,
|
|
50
|
+
onFocus,
|
|
51
|
+
onBlur,
|
|
52
|
+
focusSignal,
|
|
53
|
+
}: InputProps) {
|
|
54
|
+
const t = useTheme();
|
|
55
|
+
const [focused, setFocused] = useState(false);
|
|
56
|
+
const ref = useRef<TextInput>(null);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (focusSignal) ref.current?.focus();
|
|
59
|
+
}, [focusSignal]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<View style={[{ gap: t.space(2) }, style]}>
|
|
63
|
+
{label ? (
|
|
64
|
+
<Text variant="label" color="tertiary">
|
|
65
|
+
{label}
|
|
66
|
+
</Text>
|
|
67
|
+
) : null}
|
|
68
|
+
<TextInput
|
|
69
|
+
ref={ref}
|
|
70
|
+
testID={testID}
|
|
71
|
+
accessibilityLabel={label}
|
|
72
|
+
value={value}
|
|
73
|
+
onChangeText={onChangeText}
|
|
74
|
+
editable={editable}
|
|
75
|
+
placeholder={placeholder}
|
|
76
|
+
placeholderTextColor={t.color.textTertiary}
|
|
77
|
+
secureTextEntry={secureTextEntry}
|
|
78
|
+
autoCapitalize={autoCapitalize}
|
|
79
|
+
autoFocus={autoFocus}
|
|
80
|
+
onSubmitEditing={onSubmitEditing}
|
|
81
|
+
keyboardType={keyboardType}
|
|
82
|
+
onFocus={() => { setFocused(true); onFocus?.(); }}
|
|
83
|
+
onBlur={() => { setFocused(false); onBlur?.(); }}
|
|
84
|
+
// @ts-expect-error react-native-web accepts CSS outline; RN's TextStyle
|
|
85
|
+
// has no outlineStyle, and the mismatch is reported on the whole style
|
|
86
|
+
// object rather than on the property, so the suppression belongs here.
|
|
87
|
+
style={{
|
|
88
|
+
height: t.control[size],
|
|
89
|
+
paddingHorizontal: t.space(3),
|
|
90
|
+
borderRadius: t.radius.md,
|
|
91
|
+
borderWidth: 1,
|
|
92
|
+
borderColor: error
|
|
93
|
+
? t.color.diffDelFg
|
|
94
|
+
: focused && editable
|
|
95
|
+
? t.color.borderStrong
|
|
96
|
+
: t.color.borderDefault,
|
|
97
|
+
backgroundColor: editable ? t.color.surfaceRaised : t.color.surfaceSunken,
|
|
98
|
+
color: editable ? t.color.textPrimary : t.color.textSecondary,
|
|
99
|
+
fontFamily: mono ? t.font.mono : t.font.sans,
|
|
100
|
+
fontSize: mono ? t.type.mono.size : t.type.body.size,
|
|
101
|
+
outlineStyle: "none",
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|