@ornikar/kitt-universal 1.0.0 → 1.0.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/package.json +4 -4
- package/CHANGELOG.md +0 -8
- package/src/.eslintrc.json +0 -19
- package/src/Avatar/Avatar.stories.tsx +0 -45
- package/src/Avatar/Avatar.tsx +0 -60
- package/src/Avatar/__snapshots__/Avatar.stories.tsx.snap +0 -1229
- package/src/Button/Button.stories.tsx +0 -301
- package/src/Button/Button.tsx +0 -60
- package/src/Button/ButtonContainer.tsx +0 -32
- package/src/Button/ButtonContent.tsx +0 -133
- package/src/Button/__snapshots__/Button.stories.tsx.snap +0 -7483
- package/src/Button/useButton.ts +0 -14
- package/src/Card/Card.stories.tsx +0 -31
- package/src/Card/Card.tsx +0 -25
- package/src/Card/__snapshots__/Card.stories.tsx.snap +0 -306
- package/src/FullScreenModal/Body.tsx +0 -25
- package/src/FullScreenModal/FullScreenModal.stories.tsx +0 -63
- package/src/FullScreenModal/FullScreenModal.tsx +0 -21
- package/src/FullScreenModal/Header.tsx +0 -129
- package/src/FullScreenModal/__snapshots__/FullScreenModal.stories.tsx.snap +0 -771
- package/src/Icon/Icon.stories.tsx +0 -59
- package/src/Icon/Icon.tsx +0 -37
- package/src/Icon/SpinningIcon.tsx +0 -38
- package/src/Icon/SpinningIcon.web.module.css +0 -13
- package/src/Icon/SpinningIcon.web.module.css.d.ts +0 -6
- package/src/Icon/SpinningIcon.web.tsx +0 -11
- package/src/Icon/__snapshots__/Icon.stories.tsx.snap +0 -5648
- package/src/KittBreakpoints.ts +0 -44
- package/src/ListItem/ListItem.stories.tsx +0 -122
- package/src/ListItem/ListItem.tsx +0 -61
- package/src/ListItem/ListItemContent.tsx +0 -17
- package/src/ListItem/ListItemSideContent.tsx +0 -41
- package/src/ListItem/__snapshots__/ListItem.stories.tsx.snap +0 -1514
- package/src/Loader/LargeLoader.tsx +0 -12
- package/src/Loader/LargeLoader.web.module.css +0 -103
- package/src/Loader/LargeLoader.web.module.css.d.ts +0 -11
- package/src/Loader/LargeLoader.web.test.tsx +0 -10
- package/src/Loader/LargeLoader.web.tsx +0 -18
- package/src/Loader/Loader.stories.tsx +0 -47
- package/src/Loader/Loader.tsx +0 -21
- package/src/Loader/Loader.web.test.tsx +0 -20
- package/src/Loader/Loader.web.tsx +0 -14
- package/src/Loader/__snapshots__/LargeLoader.web.test.tsx.snap +0 -33
- package/src/Loader/__snapshots__/Loader.stories.tsx.snap +0 -607
- package/src/Loader/__snapshots__/Loader.web.test.tsx.snap +0 -103
- package/src/Message/Message.stories.tsx +0 -102
- package/src/Message/Message.tsx +0 -114
- package/src/Message/__snapshots__/Message.stories.tsx.snap +0 -2776
- package/src/Modal/Body.tsx +0 -20
- package/src/Modal/Footer.tsx +0 -18
- package/src/Modal/Header.tsx +0 -66
- package/src/Modal/Modal.stories.tsx +0 -181
- package/src/Modal/Modal.tsx +0 -66
- package/src/Modal/OnCloseContext.ts +0 -3
- package/src/Modal/__snapshots__/Modal.stories.tsx.snap +0 -2960
- package/src/Notification/Notification.stories.tsx +0 -102
- package/src/Notification/Notification.tsx +0 -21
- package/src/Notification/__snapshots__/Notification.stories.tsx.snap +0 -2861
- package/src/Overlay/Overlay.tsx +0 -22
- package/src/Tag/Tag.stories.tsx +0 -18
- package/src/Tag/Tag.tsx +0 -31
- package/src/Tag/__snapshots__/Tag.stories.tsx.snap +0 -303
- package/src/Tooltip/Tooltip.tsx +0 -17
- package/src/__mocks__/react-native-safe-area-context.tsx +0 -26
- package/src/forms/InputFeedback/InputFeedback.stories.tsx +0 -17
- package/src/forms/InputFeedback/InputFeedback.tsx +0 -28
- package/src/forms/InputFeedback/__snapshots__/InputFeedback.stories.tsx.snap +0 -252
- package/src/forms/InputField/InputField.stories.tsx +0 -19
- package/src/forms/InputField/InputField.tsx +0 -45
- package/src/forms/InputField/__snapshots__/InputField.stories.tsx.snap +0 -240
- package/src/forms/InputFormState.ts +0 -1
- package/src/forms/InputText/InputText.stories.tsx +0 -85
- package/src/forms/InputText/InputText.tsx +0 -172
- package/src/forms/InputText/__snapshots__/InputText.stories.tsx.snap +0 -4274
- package/src/forms/InputText/useInputText.ts +0 -19
- package/src/forms/Label/Label.stories.tsx +0 -14
- package/src/forms/Label/Label.tsx +0 -17
- package/src/forms/Label/__snapshots__/Label.stories.tsx.snap +0 -174
- package/src/forms/Radio/Radio.stories.tsx +0 -48
- package/src/forms/Radio/Radio.tsx +0 -81
- package/src/forms/Radio/__snapshots__/Radio.stories.tsx.snap +0 -967
- package/src/forms/TextArea/TextArea.stories.tsx +0 -72
- package/src/forms/TextArea/TextArea.tsx +0 -12
- package/src/forms/TextArea/__snapshots__/TextArea.stories.tsx.snap +0 -2091
- package/src/index.ts +0 -61
- package/src/stories/Block.tsx +0 -24
- package/src/stories/Flex.tsx +0 -16
- package/src/stories/color-tokens.stories.tsx +0 -143
- package/src/stories-list.ts +0 -22
- package/src/story-components/Section.tsx +0 -56
- package/src/story-components/Story.tsx +0 -24
- package/src/story-components/StoryDecorator.tsx +0 -8
- package/src/story-components/StoryGrid.tsx +0 -80
- package/src/story-components/StoryTitle.stories.tsx +0 -12
- package/src/story-components/StoryTitle.tsx +0 -69
- package/src/story-components/__snapshots__/StoryTitle.stories.tsx.snap +0 -155
- package/src/story-components/index.ts +0 -5
- package/src/themes/default.ts +0 -34
- package/src/themes/late-ocean/avatarLateOceanTheme.ts +0 -12
- package/src/themes/late-ocean/buttonLateOceanTheme.ts +0 -37
- package/src/themes/late-ocean/cardLateOceanTheme.ts +0 -19
- package/src/themes/late-ocean/colorsLateOceanTheme.ts +0 -19
- package/src/themes/late-ocean/feedbackMessageLateOceanTheme.ts +0 -10
- package/src/themes/late-ocean/formLateOceanTheme.ts +0 -9
- package/src/themes/late-ocean/fullScreenModalLateOceanTheme.ts +0 -9
- package/src/themes/late-ocean/inputFieldLateOceanTheme.ts +0 -4
- package/src/themes/late-ocean/inputLateOceanTheme.ts +0 -55
- package/src/themes/late-ocean/listItemLateOceanTheme.ts +0 -8
- package/src/themes/late-ocean/radioLateOceanTheme.ts +0 -19
- package/src/themes/late-ocean/shadowsLateOceanTheme.ts +0 -3
- package/src/themes/late-ocean/tagLateOceanTheme.ts +0 -17
- package/src/themes/late-ocean/typographyLateOceanTheme.ts +0 -94
- package/src/themes/palettes/lateOceanColorPalette.ts +0 -24
- package/src/typings/babel-config.d.ts +0 -6
- package/src/typings/metro.d.ts +0 -6
- package/src/typography/Typography.stories.tsx +0 -113
- package/src/typography/Typography.tsx +0 -165
- package/src/typography/TypographyIcon.stories.tsx +0 -31
- package/src/typography/TypographyIcon.tsx +0 -35
- package/src/typography/TypographyLink.stories.tsx +0 -88
- package/src/typography/TypographyLink.tsx +0 -48
- package/src/typography/__snapshots__/Typography.stories.tsx.snap +0 -6118
- package/src/typography/__snapshots__/TypographyIcon.stories.tsx.snap +0 -334
- package/src/typography/__snapshots__/TypographyLink.stories.tsx.snap +0 -10945
- package/src/useKittTheme.tsx +0 -12
- package/src/utils/storybook/decorators/KittThemeDecorator.tsx +0 -27
- package/src/utils/storybook/decorators/SafeAreaProviderDecorator.tsx +0 -11
- package/src/utils/storybook/setup-global-decorators.ts +0 -6
- package/src/utils/tests/renderWithProvidersUtils.tsx +0 -17
- package/src/utils/typeUtils.ts +0 -6
- package/src/utils/windowSize/MatchWindowSize.tsx +0 -14
- package/src/utils/windowSize/__snapshots__/windowSize.stories.tsx.snap +0 -1485
- package/src/utils/windowSize/createWindowSizeHelper.test.ts +0 -11
- package/src/utils/windowSize/createWindowSizeHelper.ts +0 -65
- package/src/utils/windowSize/useMatchWindowSize.ts +0 -14
- package/src/utils/windowSize/useWindowSize.ts +0 -1
- package/src/utils/windowSize/windowSize.stories.tsx +0 -115
- package/tsconfig.build.json +0 -33
- package/tsconfig.json +0 -13
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useInputText = (): {
|
|
4
|
-
isFocused: boolean;
|
|
5
|
-
handleInputFocus: () => void;
|
|
6
|
-
handleInputBlur: () => void;
|
|
7
|
-
isPasswordVisible: boolean;
|
|
8
|
-
togglePasswordVisibility: () => void;
|
|
9
|
-
} => {
|
|
10
|
-
const [isFocused, setIsFocused] = useState<boolean>(false);
|
|
11
|
-
const [isPasswordVisible, setIsPasswordVisible] = useState<boolean>(false);
|
|
12
|
-
|
|
13
|
-
const handleInputFocus = (): void => setIsFocused(true);
|
|
14
|
-
const handleInputBlur = (): void => setIsFocused(false);
|
|
15
|
-
|
|
16
|
-
const togglePasswordVisibility = (): void => setIsPasswordVisible((isVisible) => !isVisible);
|
|
17
|
-
|
|
18
|
-
return { isFocused, handleInputFocus, handleInputBlur, togglePasswordVisibility, isPasswordVisible };
|
|
19
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from '@storybook/react-native';
|
|
2
|
-
import { Section, Story } from '@ornikar/kitt-universal';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { InputText } from '../InputText/InputText';
|
|
5
|
-
import { Label } from './Label';
|
|
6
|
-
|
|
7
|
-
storiesOf('kitt-universal/Forms', module).add('Label', () => (
|
|
8
|
-
<Story title="Label">
|
|
9
|
-
<Section title="Demo">
|
|
10
|
-
<Label htmlFor="fake-id">Mon adresse</Label>
|
|
11
|
-
<InputText type="text" nativeID="fake-id" />
|
|
12
|
-
</Section>
|
|
13
|
-
</Story>
|
|
14
|
-
));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import { Typography } from '../../typography/Typography';
|
|
5
|
-
|
|
6
|
-
export interface LabelProps {
|
|
7
|
-
htmlFor: string;
|
|
8
|
-
children: NonNullable<ReactNode>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function Label({ htmlFor, children }: LabelProps): ReactElement {
|
|
12
|
-
return (
|
|
13
|
-
<Typography.Text base="body">
|
|
14
|
-
{Platform.OS === 'web' ? <label htmlFor={htmlFor}>{children}</label> : children}
|
|
15
|
-
</Typography.Text>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`kitt-universal/Forms Label 1`] = `
|
|
4
|
-
<RNCSafeAreaProvider
|
|
5
|
-
onInsetsChange={[Function]}
|
|
6
|
-
style={
|
|
7
|
-
Array [
|
|
8
|
-
Object {
|
|
9
|
-
"flex": 1,
|
|
10
|
-
},
|
|
11
|
-
undefined,
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
>
|
|
15
|
-
<RCTScrollView
|
|
16
|
-
style={
|
|
17
|
-
Array [
|
|
18
|
-
Object {
|
|
19
|
-
"paddingBottom": 10,
|
|
20
|
-
"paddingLeft": 10,
|
|
21
|
-
"paddingRight": 10,
|
|
22
|
-
"paddingTop": 10,
|
|
23
|
-
},
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
>
|
|
27
|
-
<View>
|
|
28
|
-
<View
|
|
29
|
-
style={
|
|
30
|
-
Array [
|
|
31
|
-
Object {
|
|
32
|
-
"marginBottom": 30,
|
|
33
|
-
},
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
<Text
|
|
38
|
-
aria-level="1"
|
|
39
|
-
color="black"
|
|
40
|
-
isHeader={true}
|
|
41
|
-
style={
|
|
42
|
-
Array [
|
|
43
|
-
Object {
|
|
44
|
-
"color": "#000000",
|
|
45
|
-
"fontFamily": "Moderat-Extended-Bold",
|
|
46
|
-
"fontSize": 38,
|
|
47
|
-
"fontStyle": "normal",
|
|
48
|
-
"fontWeight": "400",
|
|
49
|
-
"lineHeight": 49,
|
|
50
|
-
"textDecorationColor": "#000000",
|
|
51
|
-
},
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
type="header1"
|
|
55
|
-
variant="bold"
|
|
56
|
-
>
|
|
57
|
-
Label
|
|
58
|
-
</Text>
|
|
59
|
-
</View>
|
|
60
|
-
<View
|
|
61
|
-
style={
|
|
62
|
-
Array [
|
|
63
|
-
Object {
|
|
64
|
-
"marginBottom": 30,
|
|
65
|
-
},
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
>
|
|
69
|
-
<View
|
|
70
|
-
style={
|
|
71
|
-
Array [
|
|
72
|
-
Object {
|
|
73
|
-
"marginBottom": 30,
|
|
74
|
-
},
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
>
|
|
78
|
-
<Text
|
|
79
|
-
aria-level="2"
|
|
80
|
-
color="black"
|
|
81
|
-
isHeader={true}
|
|
82
|
-
style={
|
|
83
|
-
Array [
|
|
84
|
-
Object {
|
|
85
|
-
"color": "#000000",
|
|
86
|
-
"fontFamily": "Moderat-Extended-Bold",
|
|
87
|
-
"fontSize": 32,
|
|
88
|
-
"fontStyle": "normal",
|
|
89
|
-
"fontWeight": "400",
|
|
90
|
-
"lineHeight": 42,
|
|
91
|
-
"textDecorationColor": "#000000",
|
|
92
|
-
},
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
type="header2"
|
|
96
|
-
variant="bold"
|
|
97
|
-
>
|
|
98
|
-
Demo
|
|
99
|
-
</Text>
|
|
100
|
-
</View>
|
|
101
|
-
<Text
|
|
102
|
-
color="black"
|
|
103
|
-
isHeader={false}
|
|
104
|
-
style={
|
|
105
|
-
Array [
|
|
106
|
-
Object {
|
|
107
|
-
"color": "#000000",
|
|
108
|
-
"fontFamily": "NotoSans",
|
|
109
|
-
"fontSize": 16,
|
|
110
|
-
"fontStyle": "normal",
|
|
111
|
-
"fontWeight": "400",
|
|
112
|
-
"lineHeight": 26,
|
|
113
|
-
"textDecorationColor": "#000000",
|
|
114
|
-
},
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
type="body"
|
|
118
|
-
variant="regular"
|
|
119
|
-
>
|
|
120
|
-
Mon adresse
|
|
121
|
-
</Text>
|
|
122
|
-
<View
|
|
123
|
-
style={
|
|
124
|
-
Array [
|
|
125
|
-
Object {
|
|
126
|
-
"marginBottom": 4,
|
|
127
|
-
"marginTop": 2,
|
|
128
|
-
},
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
>
|
|
132
|
-
<TextInput
|
|
133
|
-
allowFontScaling={true}
|
|
134
|
-
autoCompleteType="off"
|
|
135
|
-
autoCorrect={true}
|
|
136
|
-
editable={true}
|
|
137
|
-
keyboardType="default"
|
|
138
|
-
minHeight={0}
|
|
139
|
-
nativeID="fake-id"
|
|
140
|
-
onBlur={[Function]}
|
|
141
|
-
onFocus={[Function]}
|
|
142
|
-
placeholderTextColor="#737373"
|
|
143
|
-
rejectResponderTermination={true}
|
|
144
|
-
secureTextEntry={false}
|
|
145
|
-
selectionColor="#4C34E0"
|
|
146
|
-
state="default"
|
|
147
|
-
style={
|
|
148
|
-
Array [
|
|
149
|
-
Object {
|
|
150
|
-
"backgroundColor": "#FFFFFF",
|
|
151
|
-
"borderColor": "#E5E5E5",
|
|
152
|
-
"borderRadius": 10,
|
|
153
|
-
"borderWidth": 2,
|
|
154
|
-
"color": "#000000",
|
|
155
|
-
"fontFamily": "NotoSans",
|
|
156
|
-
"fontSize": 16,
|
|
157
|
-
"lineHeight": 0,
|
|
158
|
-
"minHeight": 0,
|
|
159
|
-
"paddingBottom": 12,
|
|
160
|
-
"paddingLeft": 16,
|
|
161
|
-
"paddingRight": 16,
|
|
162
|
-
"paddingTop": 12,
|
|
163
|
-
},
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
textContentType="none"
|
|
167
|
-
underlineColorAndroid="transparent"
|
|
168
|
-
/>
|
|
169
|
-
</View>
|
|
170
|
-
</View>
|
|
171
|
-
</View>
|
|
172
|
-
</RCTScrollView>
|
|
173
|
-
</RNCSafeAreaProvider>
|
|
174
|
-
`;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { storiesOf } from '@storybook/react-native';
|
|
3
|
-
import { Section, Story } from '@ornikar/kitt-universal';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { Radio } from './Radio';
|
|
6
|
-
|
|
7
|
-
storiesOf('kitt-universal/Forms', module).add('Radio', () => (
|
|
8
|
-
<Story title="Radio">
|
|
9
|
-
<Section.DemoSection>
|
|
10
|
-
<Radio id="radio-demo" name="radio-demo" value="value" onChange={action('change')}>
|
|
11
|
-
Placeholder
|
|
12
|
-
</Radio>
|
|
13
|
-
</Section.DemoSection>
|
|
14
|
-
|
|
15
|
-
<Section title="Unchecked">
|
|
16
|
-
<Section.SubSection title="default">
|
|
17
|
-
<Radio id="unchecked-default" name="unchecked-default" value="value" onChange={action('change')} />
|
|
18
|
-
</Section.SubSection>
|
|
19
|
-
<Section.SubSection title="with text">
|
|
20
|
-
<Radio id="unchecked-with-text" name="unchecked-with-text" value="value" onChange={action('change')}>
|
|
21
|
-
Placeholder
|
|
22
|
-
</Radio>
|
|
23
|
-
</Section.SubSection>
|
|
24
|
-
</Section>
|
|
25
|
-
|
|
26
|
-
<Section title="Checked">
|
|
27
|
-
<Section.SubSection title="default">
|
|
28
|
-
<Radio checked id="checked-default" name="checked-default" value="value" onChange={action('change')} />
|
|
29
|
-
</Section.SubSection>
|
|
30
|
-
<Section.SubSection title="with text">
|
|
31
|
-
<Radio checked id="checked-with-text" name="checked-with-text" value="value" onChange={action('change')}>
|
|
32
|
-
Placeholder
|
|
33
|
-
</Radio>
|
|
34
|
-
</Section.SubSection>
|
|
35
|
-
</Section>
|
|
36
|
-
|
|
37
|
-
<Section title="Disabled">
|
|
38
|
-
<Section.SubSection title="default">
|
|
39
|
-
<Radio disabled id="disabled-default" name="disabled-default" value="value" onChange={action('change')} />
|
|
40
|
-
</Section.SubSection>
|
|
41
|
-
<Section.SubSection title="with text">
|
|
42
|
-
<Radio disabled id="disabled-with-text" name="disabled-with-text" value="value" onChange={action('change')}>
|
|
43
|
-
Placeholder
|
|
44
|
-
</Radio>
|
|
45
|
-
</Section.SubSection>
|
|
46
|
-
</Section>
|
|
47
|
-
</Story>
|
|
48
|
-
));
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { PressableProps } from 'react-native';
|
|
4
|
-
import styled from 'styled-components/native';
|
|
5
|
-
import { Typography } from '../../typography/Typography';
|
|
6
|
-
|
|
7
|
-
export interface RadioProps {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
checked?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
right?: boolean;
|
|
13
|
-
children?: NonNullable<ReactNode>;
|
|
14
|
-
value: string;
|
|
15
|
-
onChange: (newValue: string) => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface OuterRadioProps {
|
|
19
|
-
disabled: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const OuterRadio = styled.View<OuterRadioProps>`
|
|
23
|
-
background-color: ${({ theme, disabled }) =>
|
|
24
|
-
theme.kitt.forms.radio[disabled ? 'disabled' : 'unchecked'].backgroundColor};
|
|
25
|
-
width: ${({ theme }) => theme.kitt.forms.radio.size}px;
|
|
26
|
-
height: ${({ theme }) => theme.kitt.forms.radio.size}px;
|
|
27
|
-
border-radius: ${({ theme }) => theme.kitt.forms.radio.size / 2}px;
|
|
28
|
-
border-width: ${({ theme }) => theme.kitt.forms.radio.unchecked.borderWidth};
|
|
29
|
-
border-color: ${({ theme, disabled }) => theme.kitt.forms.radio[disabled ? 'disabled' : 'unchecked'].borderColor};
|
|
30
|
-
`;
|
|
31
|
-
const SelectedOuterRadio = styled.View`
|
|
32
|
-
background-color: ${({ theme }) => theme.kitt.forms.radio.checked.backgroundColor};
|
|
33
|
-
width: ${({ theme }) => theme.kitt.forms.radio.size}px;
|
|
34
|
-
height: ${({ theme }) => theme.kitt.forms.radio.size}px;
|
|
35
|
-
border-radius: ${({ theme }) => theme.kitt.forms.radio.size / 2}px;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
align-items: center;
|
|
38
|
-
`;
|
|
39
|
-
const SelectedInnerRadio = styled.View`
|
|
40
|
-
background-color: ${({ theme }) => theme.kitt.forms.radio.checked.innerBackgroundColor};
|
|
41
|
-
width: ${({ theme }) => theme.kitt.forms.radio.checked.innerSize}px;
|
|
42
|
-
height: ${({ theme }) => theme.kitt.forms.radio.checked.innerSize}px;
|
|
43
|
-
border-radius: ${({ theme }) => theme.kitt.forms.radio.checked.innerSize / 2}px;
|
|
44
|
-
`;
|
|
45
|
-
const Container = styled.Pressable`
|
|
46
|
-
flex-direction: row;
|
|
47
|
-
align-items: center;
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
const Text = styled(Typography.Text)`
|
|
51
|
-
margin-left: ${({ theme }) => theme.kitt.spacing * 2}px;
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
export function Radio({ id, checked, onChange, value, disabled = false, children }: RadioProps): ReactElement {
|
|
55
|
-
const handlePress: PressableProps['onPress'] = () => {
|
|
56
|
-
onChange(value);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<Container
|
|
61
|
-
nativeID={id}
|
|
62
|
-
disabled={disabled}
|
|
63
|
-
accessibilityRole="radio"
|
|
64
|
-
aria-checked={checked}
|
|
65
|
-
accessible={checked && !disabled}
|
|
66
|
-
onPress={handlePress}
|
|
67
|
-
>
|
|
68
|
-
{checked && !disabled ? (
|
|
69
|
-
<SelectedOuterRadio>
|
|
70
|
-
<SelectedInnerRadio />
|
|
71
|
-
</SelectedOuterRadio>
|
|
72
|
-
) : (
|
|
73
|
-
<OuterRadio disabled={disabled} />
|
|
74
|
-
)}
|
|
75
|
-
|
|
76
|
-
<Text base="body" color={disabled ? 'black-light' : 'black'}>
|
|
77
|
-
{children}
|
|
78
|
-
</Text>
|
|
79
|
-
</Container>
|
|
80
|
-
);
|
|
81
|
-
}
|