@tactics/toddle-styleguide 1.7.11 → 1.7.12

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "1.7.11",
3
+ "version": "1.7.12",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const SelectableListItemPreview: ({}: {}) => React.JSX.Element;
@@ -0,0 +1,49 @@
1
+ import React 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
+ return (
9
+ <View
10
+ style={{
11
+ flex: 1,
12
+ alignItems: 'center',
13
+ justifyContent: 'center',
14
+ backgroundColor: '#19216C',
15
+ }}
16
+ >
17
+ <SelectableListItem
18
+ title="Vlindertjes VlindertjesVlindertjesVlindertjesVlindertjes"
19
+ subtitle={'Leeftijd 2 tot 4 jaar'}
20
+ icon={<Icon style={'regular'} name={'user-group'} size={27} />}
21
+ onPress={() => console.log('clicked')}
22
+ selected={false}
23
+ />
24
+ <SelectableListItem
25
+ title="Vlindertjes"
26
+ subtitle={'Leeftijd 2 tot 4 jaar'}
27
+ icon={<Icon style={'regular'} name={'office-building'} size={27} />}
28
+ inverse={true}
29
+ onPress={() => console.log('clicked')}
30
+ selected={false}
31
+ />
32
+ <SelectableListItem
33
+ title="Vlindertjes VlindertjesVlindertjesVlindertjesVlindertjes"
34
+ subtitle={'Leeftijd 2 tot 4 jaar'}
35
+ icon={<Icon style={'regular'} name={'user-group'} size={27} />}
36
+ onPress={() => console.log('clicked')}
37
+ selected={true}
38
+ />
39
+ <SelectableListItem
40
+ title="Vlindertjes"
41
+ subtitle={'Leeftijd 2 tot 4 jaar'}
42
+ icon={<Icon style={'regular'} name={'office-building'} size={27} />}
43
+ inverse={true}
44
+ onPress={() => console.log('clicked')}
45
+ selected={true}
46
+ />
47
+ </View>
48
+ );
49
+ };
@@ -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}>
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,30 @@
1
+ export function Stylesheet(context: any, selected: any, inverse: any): StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
2
+ container: {
3
+ width: "100%";
4
+ flexDirection: "row";
5
+ alignItems: "center";
6
+ backgroundColor: any;
7
+ padding: number;
8
+ borderBottomLeftRadius: string;
9
+ borderBottomRightRadius: number;
10
+ borderTopLeftRadius: string;
11
+ borderTopRightRadius: number;
12
+ };
13
+ iconCircle: {
14
+ justifyContent: "center";
15
+ alignItems: "center";
16
+ backgroundColor: any;
17
+ width: number;
18
+ height: number;
19
+ borderRadius: number;
20
+ marginRight: number;
21
+ };
22
+ textContainer: {
23
+ flex: number;
24
+ flexDirection: "column";
25
+ justifyContent: "center";
26
+ paddingTop: number;
27
+ paddingBottom: number;
28
+ };
29
+ }>;
30
+ import { StyleSheet } from 'react-native';
@@ -0,0 +1,35 @@
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
+ backgroundColor: selected ? context.colors.main['9'] : 'none',
11
+ padding: Scale.xxs,
12
+ borderBottomLeftRadius: '50%',
13
+ borderBottomRightRadius: Scale.m,
14
+ borderTopLeftRadius: '50%',
15
+ borderTopRightRadius: Scale.m,
16
+ },
17
+ iconCircle: {
18
+ justifyContent: 'center',
19
+ alignItems: 'center',
20
+ backgroundColor: inverse
21
+ ? context.colors.main['3']
22
+ : context.colors.main['6'],
23
+ width: 62,
24
+ height: 62,
25
+ borderRadius: 62 / 2,
26
+ marginRight: Scale.m,
27
+ },
28
+ textContainer: {
29
+ flex: 1,
30
+ flexDirection: 'column',
31
+ justifyContent: 'center',
32
+ paddingTop: Scale.xxxs,
33
+ paddingBottom: Scale.xxxs,
34
+ },
35
+ });