@tactics/toddle-styleguide 1.6.1 → 1.7.1

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
@@ -78,6 +78,7 @@ import { CountPreview } from './src/components/atoms/count/count.preview';
78
78
  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
+ import { InlineErrorPreview } from './src/components/molecules/inline-error/inline-error.preview';
81
82
 
82
83
  import {
83
84
  SafeAreaProvider,
@@ -199,6 +200,10 @@ const HomeScreen = ({navigation}: {navigation: any}) => {
199
200
  title="Info Component"
200
201
  onPress={() => navigation.push('info')}
201
202
  />
203
+ <ReactBtn
204
+ title="Inline Error"
205
+ onPress={() => navigation.push('inline-error')}
206
+ />
202
207
  <ReactBtn
203
208
  title="Journal Entry"
204
209
  onPress={() => navigation.push('journal-entry')}
@@ -511,6 +516,9 @@ function App() {
511
516
  <Stack.Screen name="wide-button">
512
517
  {() => <WideButtonPreview />}
513
518
  </Stack.Screen>
519
+ <Stack.Screen name="inline-error">
520
+ {() => <InlineErrorPreview />}
521
+ </Stack.Screen>
514
522
  </Stack.Navigator>
515
523
  </NavigationContainer>
516
524
  </ThemeCtx.Provider>
package/index.d.ts CHANGED
@@ -63,6 +63,7 @@ import { ContextLabel } from './src/components/molecules/context-label/context-l
63
63
  import { Count } from './src/components/atoms/count/count.component';
64
64
  import { Amount } from './src/components/molecules/amount/amount.component';
65
65
  import { TimetableEditor } from './src/components/organisms/timetable-editor/timetable-editor.component';
66
+ import { InlineError } from './src/components/molecules/inline-error/inline-error.component';
66
67
  import { BubbleAlignment } from './src/types/bubble-alignment.enum';
67
68
  import { KeyBoardTypes } from './src/types/keyboard-types.enum';
68
69
  import { Size } from './src/types/size.enum';
@@ -74,4 +75,4 @@ import { ToddleDateTime } from './src/utilities/toddle-datetime/toddle-datetime.
74
75
  import { ThemeCtx } from './src/context/theme.context';
75
76
  import { Scale } from './src/theme/scale/index';
76
77
  import CreateResponsiveStyle from './src/theme/responsive/index';
77
- 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 };
78
+ 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 };
package/index.tsx CHANGED
@@ -81,6 +81,7 @@ import { ContextLabel } from './src/components/molecules/context-label/context-l
81
81
  import { Count } from './src/components/atoms/count/count.component';
82
82
  import { Amount } from './src/components/molecules/amount/amount.component';
83
83
  import { TimetableEditor } from './src/components/organisms/timetable-editor/timetable-editor.component';
84
+ import { InlineError } from './src/components/molecules/inline-error/inline-error.component';
84
85
 
85
86
  // Exports of enums
86
87
  import {BubbleAlignment} from './src/types/bubble-alignment.enum';
@@ -185,5 +186,6 @@ export {
185
186
  Amount,
186
187
  TimetableEditor,
187
188
  TimeSlotRecord,
188
- TimeSlotSequence
189
+ TimeSlotSequence,
190
+ InlineError
189
191
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ type InlineErrorProps = {
3
+ label: string;
4
+ };
5
+ declare const InlineError: ({ label }: InlineErrorProps) => React.JSX.Element;
6
+ export { InlineError as InlineError };
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import {useContext} from 'react';
3
+
4
+ import {ThemeCtx} from '../../../context/theme.context';
5
+ import {View} from 'react-native';
6
+ import {Stylesheet} from './inline-error.styles';
7
+ import {SmallText} from '../../atoms/paragraph-components';
8
+ import { Icon } from '../../../icons';
9
+
10
+ type InlineErrorProps = {
11
+ label: string;
12
+ };
13
+
14
+ const InlineError = ({label}: InlineErrorProps) => {
15
+ const context = useContext(ThemeCtx);
16
+ const styles = Stylesheet(context);
17
+
18
+ return (
19
+ <View style={styles.container}>
20
+ <Icon name='exclamation-circle' style='regular' color={context.colors.ui.error.dark} />
21
+ <SmallText addStyle={styles.label} textColor={context.colors.ui.error.dark}>
22
+ {label}
23
+ </SmallText>
24
+ </View>
25
+ );
26
+ };
27
+ export {InlineError as InlineError};
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const InlineErrorPreview: ({}: {}) => React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { InlineError } from './inline-error.component';
3
+ const {View} = require('react-native');
4
+
5
+ export const InlineErrorPreview = ({}: {}) => {
6
+ return (
7
+ <View
8
+ style={{
9
+ flex: 1,
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ backgroundColor: 'white',
13
+ }}
14
+ >
15
+ <InlineError
16
+ label={'Deze dag is reeds gefactureerd. U kan deze enkel nog aanpassen in de beheerssoftware.'}
17
+ />
18
+ </View>
19
+ );
20
+ };
@@ -0,0 +1,18 @@
1
+ export function Stylesheet(context: any): {
2
+ container: {
3
+ flexDirection: "row";
4
+ gap: number;
5
+ width: "100%";
6
+ backgroundColor: any;
7
+ borderRadius: number;
8
+ alignItems: "center";
9
+ justifyContent: "flex-start";
10
+ paddingLeft: number;
11
+ paddingTop: number;
12
+ paddingRight: number;
13
+ paddingBottom: number;
14
+ };
15
+ label: {
16
+ flex: number;
17
+ };
18
+ };
@@ -0,0 +1,22 @@
1
+ import {StyleSheet} from 'react-native';
2
+ import {Scale} from '../../../theme/scale';
3
+
4
+ export const Stylesheet = (context) =>
5
+ StyleSheet.create({
6
+ container: {
7
+ flexDirection: 'row',
8
+ gap: Scale.m,
9
+ width: '100%',
10
+ backgroundColor: context.colors.ui.error.xlight,
11
+ borderRadius: Scale.s,
12
+ alignItems: 'center',
13
+ justifyContent: 'flex-start',
14
+ paddingLeft: Scale.m,
15
+ paddingTop: Scale.m,
16
+ paddingRight: Scale.m,
17
+ paddingBottom: Scale.m,
18
+ },
19
+ label: {
20
+ flex: 1
21
+ }
22
+ });
@@ -16,6 +16,7 @@ type ChildListItemProps = {
16
16
  textTimeTracker?: string;
17
17
  visualStateTimeTracker?: VisualState;
18
18
  tags?: string[];
19
+ error: boolean;
19
20
  };
20
- declare const ChildListItem: React.MemoExoticComponent<({ id, name, department, selectable, isSelected, onPressArrow, onPressText, onLongPress, onSelect, sourceAvatar, textTimeTracker, visualStateTimeTracker, tags, }: ChildListItemProps) => React.JSX.Element>;
21
+ declare const ChildListItem: React.MemoExoticComponent<({ id, name, department, selectable, isSelected, onPressArrow, onPressText, onLongPress, onSelect, sourceAvatar, textTimeTracker, visualStateTimeTracker, tags, error }: ChildListItemProps) => React.JSX.Element>;
21
22
  export { ChildListItem as ChildListItem };
@@ -8,7 +8,7 @@ import {Size} from '../../../types/size.enum';
8
8
  import {VisualState} from '../../../types/visual-state.enum';
9
9
  import {Avatar} from '../../molecules/avatar/avatar.component';
10
10
  import {Stylesheet} from './child-list-item.styles';
11
- import {SmallText, TinyText} from '../../atoms/paragraph-components';
11
+ import {SmallText} from '../../atoms/paragraph-components';
12
12
  import {Heading2} from '../../atoms/heading-components';
13
13
  import {TimeTracker} from '../../molecules/time-tracker/time-tracker.component';
14
14
  import {Icon} from '../../../icons/index';
@@ -28,6 +28,7 @@ type ChildListItemProps = {
28
28
  textTimeTracker?: string;
29
29
  visualStateTimeTracker?: VisualState;
30
30
  tags?: string[];
31
+ error: boolean;
31
32
  };
32
33
 
33
34
  const ChildListItem = React.memo(
@@ -45,6 +46,7 @@ const ChildListItem = React.memo(
45
46
  textTimeTracker,
46
47
  visualStateTimeTracker,
47
48
  tags,
49
+ error
48
50
  }: ChildListItemProps) => {
49
51
  const context = useContext(ThemeCtx);
50
52
  const styles = Stylesheet(isSelected, context);
@@ -66,8 +68,10 @@ const ChildListItem = React.memo(
66
68
  }, [id, onLongPress]);
67
69
 
68
70
  const textColor = useMemo(() => {
69
- return isSelected ? context.colors.ui.white : context.colors.ui.black;
70
- }, [isSelected]);
71
+ return isSelected
72
+ ? context.colors.ui.white
73
+ : error ? context.colors.ui.error.default : context.colors.ui.black;
74
+ }, [isSelected, error]);
71
75
 
72
76
  const renderTimeTracker = (textTimeTracker?: string, visualStateTimeTracker?: VisualState) => {
73
77
  if (textTimeTracker && visualStateTimeTracker) {
@@ -83,7 +87,7 @@ const ChildListItem = React.memo(
83
87
  <View style={styles.container}>
84
88
  <View style={styles.pressableContainer}>
85
89
  <Pressable
86
- onPress={onPressSelectable}
90
+ onPress={!error ? onPressSelectable : null}
87
91
  style={styles.innerContainer}
88
92
  onLongPress={onLongPressCallback}
89
93
  >
@@ -102,14 +106,14 @@ const ChildListItem = React.memo(
102
106
  numberOfLines={1}
103
107
  ellipsizeMode={'tail'}
104
108
  textColor={
105
- isSelected ? context.colors.ui.white : context.colors.ui.black
109
+ textColor
106
110
  }
107
111
  >
108
112
  {name}
109
113
  </Heading2>
110
114
  <SmallText
111
115
  textColor={
112
- isSelected ? context.colors.ui.white : context.colors.ui.black
116
+ textColor
113
117
  }
114
118
  >
115
119
  {department}
@@ -71,6 +71,7 @@ export const ChildListItemPreview = ({}: {}) => {
71
71
  // sourceAvatar={require('./../../../../assets/components/avatar/baby.png')}
72
72
  sourceAvatar={Initials.for('Zeno', 'Driesen')}
73
73
  tags={item.tags}
74
+ error={true}
74
75
  />
75
76
  );
76
77
  };
@@ -32,6 +32,7 @@ export function Stylesheet(isSelectedItem: any, context: any): {
32
32
  justifyContent: "center";
33
33
  paddingRight: number;
34
34
  width: number;
35
+ height: number;
35
36
  borderTopRightRadius: number;
36
37
  borderBottomRightRadius: number;
37
38
  };
@@ -48,5 +49,6 @@ export function Stylesheet(isSelectedItem: any, context: any): {
48
49
  gap: number;
49
50
  flexWrap: "wrap";
50
51
  marginLeft: number;
52
+ marginBottom: number;
51
53
  };
52
54
  };
@@ -39,6 +39,7 @@ export const Stylesheet = (isSelectedItem, context) =>
39
39
  justifyContent: 'center',
40
40
  paddingRight: Scale.xs,
41
41
  width: Scale.m * 3,
42
+ height: Scale.m * 3,
42
43
  borderTopRightRadius: Scale.l,
43
44
  borderBottomRightRadius: Scale.l,
44
45
  },