@tactics/toddle-styleguide 1.7.11 → 1.7.13
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/App.tsx +8 -0
- package/index.d.ts +2 -1
- package/index.tsx +3 -1
- package/package.json +1 -1
- package/src/components/molecules/selectable-list-item/selectable-list-item-preview.d.ts +2 -0
- package/src/components/molecules/selectable-list-item/selectable-list-item-preview.tsx +51 -0
- package/src/components/molecules/selectable-list-item/selectable-list-item.component.d.ts +11 -0
- package/src/components/molecules/selectable-list-item/selectable-list-item.component.tsx +61 -0
- package/src/components/molecules/selectable-list-item/selectable-list-item.styles.d.ts +28 -0
- package/src/components/molecules/selectable-list-item/selectable-list-item.styles.js +34 -0
package/App.tsx
CHANGED
|
@@ -79,6 +79,7 @@ import { AmountPreview } from './src/components/molecules/amount/amount.preview'
|
|
|
79
79
|
import { BareTimePickerPreview } from './src/components/molecules/bare-time-picker/bare-time-picker.preview';
|
|
80
80
|
import { TimetableEditorPreview } from './src/components/organisms/timetable-editor/timetable-editor.preview';
|
|
81
81
|
import { InlineErrorPreview } from './src/components/molecules/inline-error/inline-error.preview';
|
|
82
|
+
import { SelectableListItemPreview } from './src/components/molecules/selectable-list-item/selectable-list-item-preview';
|
|
82
83
|
|
|
83
84
|
import {
|
|
84
85
|
SafeAreaProvider,
|
|
@@ -269,6 +270,10 @@ const HomeScreen = ({navigation}: {navigation: any}) => {
|
|
|
269
270
|
title="Select List Item"
|
|
270
271
|
onPress={() => navigation.push('select-list-item')}
|
|
271
272
|
/>
|
|
273
|
+
<ReactBtn
|
|
274
|
+
title="Selectable List Item"
|
|
275
|
+
onPress={() => navigation.push('selectable-list-item')}
|
|
276
|
+
/>
|
|
272
277
|
<ReactBtn
|
|
273
278
|
title="Select Picker"
|
|
274
279
|
onPress={() => navigation.push('select-picker')}
|
|
@@ -519,6 +524,9 @@ function App() {
|
|
|
519
524
|
<Stack.Screen name="inline-error">
|
|
520
525
|
{() => <InlineErrorPreview />}
|
|
521
526
|
</Stack.Screen>
|
|
527
|
+
<Stack.Screen name="selectable-list-item">
|
|
528
|
+
{() => <SelectableListItemPreview />}
|
|
529
|
+
</Stack.Screen>
|
|
522
530
|
</Stack.Navigator>
|
|
523
531
|
</NavigationContainer>
|
|
524
532
|
</ThemeCtx.Provider>
|
package/index.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ import { Amount } from './src/components/molecules/amount/amount.component';
|
|
|
65
65
|
import { TimetableEditor } from './src/components/organisms/timetable-editor/timetable-editor.component';
|
|
66
66
|
import { InlineError } from './src/components/molecules/inline-error/inline-error.component';
|
|
67
67
|
import { InlineNotice } from './src/components/molecules/inline-notice/inline-notice.component';
|
|
68
|
+
import { SelectableListItem } from './src/components/molecules/selectable-list-item/selectable-list-item.component';
|
|
68
69
|
import { BubbleAlignment } from './src/types/bubble-alignment.enum';
|
|
69
70
|
import { KeyBoardTypes } from './src/types/keyboard-types.enum';
|
|
70
71
|
import { Size } from './src/types/size.enum';
|
|
@@ -76,4 +77,4 @@ import { ToddleDateTime } from './src/utilities/toddle-datetime/toddle-datetime.
|
|
|
76
77
|
import { ThemeCtx } from './src/context/theme.context';
|
|
77
78
|
import { Scale } from './src/theme/scale/index';
|
|
78
79
|
import CreateResponsiveStyle from './src/theme/responsive/index';
|
|
79
|
-
export { AllCapsHeading, Avatar, BackgroundGradient, BlockedMessage, Button, Calendar, CalendarSelect, CancelLink, Check, Checkbox, ChildListItem, ContactItem, ContactRole, DateInput, DaySelect, DefaultSelect, DepartmentLogo, FilterRange, FilterTab, Footer, Heading1, Heading2, Heading3, Heading4, Icon, ImageBubble, IncrementInput, Info, JournalEntry, LanguageButton, Line, LoadingIndicator, Logo, MessageInput, Modal, MoreInfoButton, MyChildListItem, Paragraph, PasswordInput, PersonInfoCard, Pill, Popover, PopOverAction, PressableIcon, QuickFilter, QuickMessage, Search, SelectLink, SelectListItem, SelectPicker, SmallText, Snackbar, SplitContainer, Swipe, TabView, Tag, TextBubble, TextInput, TimeLine, TimePicker, TimeTracker, TinyText, WaveBackground, WideButton, BubbleAlignment, Initials, KeyBoardTypes, Size, ThemeCtx, ToddleDateTime, VisualState, CreateResponsiveStyle, Scale, TimetableEdit, ContextLabel, Count, Amount, TimetableEditor, TimeSlotRecord, TimeSlotSequence, InlineError, InlineNotice };
|
|
80
|
+
export { AllCapsHeading, Avatar, BackgroundGradient, BlockedMessage, Button, Calendar, CalendarSelect, CancelLink, Check, Checkbox, ChildListItem, ContactItem, ContactRole, DateInput, DaySelect, DefaultSelect, DepartmentLogo, FilterRange, FilterTab, Footer, Heading1, Heading2, Heading3, Heading4, Icon, ImageBubble, IncrementInput, Info, JournalEntry, LanguageButton, Line, LoadingIndicator, Logo, MessageInput, Modal, MoreInfoButton, MyChildListItem, Paragraph, PasswordInput, PersonInfoCard, Pill, Popover, PopOverAction, PressableIcon, QuickFilter, QuickMessage, Search, SelectLink, SelectListItem, SelectPicker, SmallText, Snackbar, SplitContainer, Swipe, TabView, Tag, TextBubble, TextInput, TimeLine, TimePicker, TimeTracker, TinyText, WaveBackground, WideButton, BubbleAlignment, Initials, KeyBoardTypes, Size, ThemeCtx, ToddleDateTime, VisualState, CreateResponsiveStyle, Scale, TimetableEdit, ContextLabel, Count, Amount, TimetableEditor, TimeSlotRecord, TimeSlotSequence, InlineError, InlineNotice, SelectableListItem };
|
package/index.tsx
CHANGED
|
@@ -83,6 +83,7 @@ import { Amount } from './src/components/molecules/amount/amount.component';
|
|
|
83
83
|
import { TimetableEditor } from './src/components/organisms/timetable-editor/timetable-editor.component';
|
|
84
84
|
import { InlineError } from './src/components/molecules/inline-error/inline-error.component';
|
|
85
85
|
import { InlineNotice } from './src/components/molecules/inline-notice/inline-notice.component';
|
|
86
|
+
import { SelectableListItem } from './src/components/molecules/selectable-list-item/selectable-list-item.component';
|
|
86
87
|
|
|
87
88
|
// Exports of enums
|
|
88
89
|
import {BubbleAlignment} from './src/types/bubble-alignment.enum';
|
|
@@ -189,5 +190,6 @@ export {
|
|
|
189
190
|
TimeSlotRecord,
|
|
190
191
|
TimeSlotSequence,
|
|
191
192
|
InlineError,
|
|
192
|
-
InlineNotice
|
|
193
|
+
InlineNotice,
|
|
194
|
+
SelectableListItem
|
|
193
195
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {SelectableListItem} from './selectable-list-item.component';
|
|
3
|
+
import {Icon} from '../../../icons/index';
|
|
4
|
+
|
|
5
|
+
const {View} = require('react-native');
|
|
6
|
+
|
|
7
|
+
export const SelectableListItemPreview = ({}: {}) => {
|
|
8
|
+
const [selected, setSelected] = useState(false);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<View
|
|
12
|
+
style={{
|
|
13
|
+
flex: 1,
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
backgroundColor: '#19216C',
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
<SelectableListItem
|
|
20
|
+
title="Vlindertjes VlindertjesVlindertjesVlindertjesVlindertjes"
|
|
21
|
+
subtitle={'Leeftijd 2 tot 4 jaar'}
|
|
22
|
+
icon={<Icon style={'regular'} name={'user-group'} size={27} />}
|
|
23
|
+
onPress={() => setSelected(!selected)}
|
|
24
|
+
selected={selected}
|
|
25
|
+
/>
|
|
26
|
+
<SelectableListItem
|
|
27
|
+
title="Vlindertjes"
|
|
28
|
+
subtitle={'Leeftijd 2 tot 4 jaar'}
|
|
29
|
+
icon={<Icon style={'regular'} name={'office-building'} size={27} />}
|
|
30
|
+
inverse={true}
|
|
31
|
+
onPress={() => setSelected(!selected)}
|
|
32
|
+
selected={selected}
|
|
33
|
+
/>
|
|
34
|
+
<SelectableListItem
|
|
35
|
+
title="Vlindertjes VlindertjesVlindertjesVlindertjesVlindertjes"
|
|
36
|
+
subtitle={'Leeftijd 2 tot 4 jaar'}
|
|
37
|
+
icon={<Icon style={'regular'} name={'user-group'} size={27} />}
|
|
38
|
+
onPress={() => setSelected(!selected)}
|
|
39
|
+
selected={selected}
|
|
40
|
+
/>
|
|
41
|
+
<SelectableListItem
|
|
42
|
+
title="Vlindertjes"
|
|
43
|
+
subtitle={'Leeftijd 2 tot 4 jaar'}
|
|
44
|
+
icon={<Icon style={'regular'} name={'office-building'} size={27} />}
|
|
45
|
+
inverse={true}
|
|
46
|
+
onPress={() => setSelected(!selected)}
|
|
47
|
+
selected={selected}
|
|
48
|
+
/>
|
|
49
|
+
</View>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type SelectableListProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
icon: React.ReactElement;
|
|
6
|
+
onPress?: () => void;
|
|
7
|
+
inverse?: boolean;
|
|
8
|
+
selected: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const SelectableListItem: ({ title, subtitle, icon, onPress, inverse, selected }: SelectableListProps) => React.JSX.Element;
|
|
11
|
+
export { SelectableListItem as SelectableListItem };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {useContext} from 'react';
|
|
3
|
+
|
|
4
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
5
|
+
import {Pressable, View} from 'react-native';
|
|
6
|
+
import {Stylesheet} from './selectable-list-item.styles';
|
|
7
|
+
import {Heading2} from '../../atoms/heading-components';
|
|
8
|
+
import {Paragraph} from '../../atoms/paragraph-components';
|
|
9
|
+
|
|
10
|
+
type SelectableListProps = {
|
|
11
|
+
title: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
icon: React.ReactElement;
|
|
14
|
+
onPress?: () => void;
|
|
15
|
+
inverse?: boolean;
|
|
16
|
+
selected: boolean
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const SelectableListItem = ({
|
|
20
|
+
title,
|
|
21
|
+
subtitle,
|
|
22
|
+
icon,
|
|
23
|
+
onPress,
|
|
24
|
+
inverse,
|
|
25
|
+
selected
|
|
26
|
+
}: SelectableListProps) => {
|
|
27
|
+
const context = useContext(ThemeCtx);
|
|
28
|
+
const styles = Stylesheet(context, selected, inverse);
|
|
29
|
+
const invertedIcon = React.Children.map(icon, (child) =>
|
|
30
|
+
React.cloneElement(child, {
|
|
31
|
+
...icon.props,
|
|
32
|
+
color: context.colors.main[6],
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Pressable onPress={onPress} style={[styles.container, {backgroundColor: selected ? context.colors.main['9'] : undefined}]}>
|
|
38
|
+
<View style={styles.iconCircle}>
|
|
39
|
+
<View>{inverse ? invertedIcon : icon}</View>
|
|
40
|
+
</View>
|
|
41
|
+
<View style={styles.textContainer}>
|
|
42
|
+
<View>
|
|
43
|
+
<Heading2
|
|
44
|
+
bold={true}
|
|
45
|
+
textColor={selected ? context.colors.main['0'] : context.colors.ui.white}
|
|
46
|
+
numberOfLines={2}
|
|
47
|
+
ellipsizeMode={'tail'}
|
|
48
|
+
>
|
|
49
|
+
{title}
|
|
50
|
+
</Heading2>
|
|
51
|
+
</View>
|
|
52
|
+
<View>
|
|
53
|
+
<Paragraph textColor={selected ? context.colors.main['1'] : context.colors.ui.lightgrey}>
|
|
54
|
+
{subtitle}
|
|
55
|
+
</Paragraph>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
</Pressable>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
export {SelectableListItem as SelectableListItem};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function Stylesheet(context: any, selected: any, inverse: any): {
|
|
2
|
+
container: {
|
|
3
|
+
width: "100%";
|
|
4
|
+
flexDirection: "row";
|
|
5
|
+
alignItems: "center";
|
|
6
|
+
padding: number;
|
|
7
|
+
borderBottomLeftRadius: number;
|
|
8
|
+
borderBottomRightRadius: number;
|
|
9
|
+
borderTopLeftRadius: number;
|
|
10
|
+
borderTopRightRadius: number;
|
|
11
|
+
};
|
|
12
|
+
iconCircle: {
|
|
13
|
+
justifyContent: "center";
|
|
14
|
+
alignItems: "center";
|
|
15
|
+
backgroundColor: any;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
borderRadius: number;
|
|
19
|
+
marginRight: number;
|
|
20
|
+
};
|
|
21
|
+
textContainer: {
|
|
22
|
+
flex: number;
|
|
23
|
+
flexDirection: "column";
|
|
24
|
+
justifyContent: "center";
|
|
25
|
+
paddingTop: number;
|
|
26
|
+
paddingBottom: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Scale} from '../../../theme/scale';
|
|
3
|
+
|
|
4
|
+
export const Stylesheet = (context, selected, inverse) =>
|
|
5
|
+
StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
width: '100%',
|
|
8
|
+
flexDirection: 'row',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
padding: Scale.xxs,
|
|
11
|
+
borderBottomLeftRadius: 65 / 2,
|
|
12
|
+
borderBottomRightRadius: Scale.m,
|
|
13
|
+
borderTopLeftRadius: 65 / 2,
|
|
14
|
+
borderTopRightRadius: Scale.m,
|
|
15
|
+
},
|
|
16
|
+
iconCircle: {
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
backgroundColor: inverse
|
|
20
|
+
? context.colors.main['3']
|
|
21
|
+
: context.colors.main['6'],
|
|
22
|
+
width: 62,
|
|
23
|
+
height: 62,
|
|
24
|
+
borderRadius: 62 / 2,
|
|
25
|
+
marginRight: Scale.m,
|
|
26
|
+
},
|
|
27
|
+
textContainer: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
paddingTop: Scale.xxxs,
|
|
32
|
+
paddingBottom: Scale.xxxs,
|
|
33
|
+
},
|
|
34
|
+
});
|