@ornikar/kitt-universal 7.5.0 → 7.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/dist/definitions/Picker/Picker.d.ts +17 -0
- package/dist/definitions/Picker/Picker.d.ts.map +1 -0
- package/dist/definitions/Picker/Picker.web.d.ts +3 -0
- package/dist/definitions/Picker/Picker.web.d.ts.map +1 -0
- package/dist/definitions/Picker/PickerItem.d.ts +9 -0
- package/dist/definitions/Picker/PickerItem.d.ts.map +1 -0
- package/dist/definitions/TimePicker/useTimePicker.d.ts +2 -2
- package/dist/definitions/TimePicker/useTimePicker.d.ts.map +1 -1
- package/dist/definitions/forms/InputText/InputText.d.ts.map +1 -1
- package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
- package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +2 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/themes/default.d.ts +1 -0
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/picker.d.ts +21 -0
- package/dist/definitions/themes/late-ocean/picker.d.ts.map +1 -0
- package/dist/definitions/typography/Typography.d.ts +3 -2
- package/dist/definitions/typography/Typography.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +175 -37
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +175 -37
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +175 -37
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +74 -38
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +187 -68
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.js +51 -25
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.android.js +26 -0
- package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.ios.js +26 -0
- package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.js +26 -0
- package/dist/linaria-themes-browser-all.es.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.web.js +27 -0
- package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.js +25 -0
- package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.web.js +25 -0
- package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +8 -3
- package/translations/fr-FR.json +2 -1
|
@@ -5,16 +5,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const kittIcons = require('@ornikar/kitt-icons');
|
|
6
6
|
const reactNative = require('react-native');
|
|
7
7
|
const styled = require('styled-components/native');
|
|
8
|
-
const
|
|
8
|
+
const React = require('react');
|
|
9
9
|
const jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
const Animated = require('react-native-reanimated');
|
|
11
11
|
const twemojiParser = require('twemoji-parser');
|
|
12
12
|
const WebBrowser = require('expo-web-browser');
|
|
13
13
|
const DateTimePicker = require('@react-native-community/datetimepicker');
|
|
14
14
|
const reactIntl = require('react-intl');
|
|
15
|
-
const react
|
|
15
|
+
const react = require('@linaria/react');
|
|
16
16
|
const reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
17
17
|
const Svg = require('react-native-svg');
|
|
18
|
+
const picker$1 = require('@react-native-picker/picker');
|
|
18
19
|
const expoLinearGradient = require('expo-linear-gradient');
|
|
19
20
|
const reactNative$1 = require('@floating-ui/react-native');
|
|
20
21
|
const addons = require('@storybook/addons');
|
|
@@ -22,6 +23,7 @@ const addons = require('@storybook/addons');
|
|
|
22
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
23
24
|
|
|
24
25
|
const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
26
|
+
const React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
27
|
const Animated__default = /*#__PURE__*/_interopDefaultLegacy(Animated);
|
|
26
28
|
const DateTimePicker__default = /*#__PURE__*/_interopDefaultLegacy(DateTimePicker);
|
|
27
29
|
const Svg__default = /*#__PURE__*/_interopDefaultLegacy(Svg);
|
|
@@ -45,7 +47,7 @@ function Icon({
|
|
|
45
47
|
align,
|
|
46
48
|
color
|
|
47
49
|
}) {
|
|
48
|
-
const clonedIcon = /*#__PURE__*/
|
|
50
|
+
const clonedIcon = /*#__PURE__*/React.cloneElement(icon, {
|
|
49
51
|
color
|
|
50
52
|
});
|
|
51
53
|
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
|
|
@@ -104,10 +106,10 @@ const KittBreakpointsMax = {
|
|
|
104
106
|
LARGE: KittBreakpoints.WIDE - 1
|
|
105
107
|
};
|
|
106
108
|
|
|
107
|
-
const IsHeaderTypographyContext = /*#__PURE__*/
|
|
108
|
-
const TypographyColorContext = /*#__PURE__*/
|
|
109
|
+
const IsHeaderTypographyContext = /*#__PURE__*/React.createContext(undefined);
|
|
110
|
+
const TypographyColorContext = /*#__PURE__*/React.createContext('black');
|
|
109
111
|
function useTypographyColor() {
|
|
110
|
-
return
|
|
112
|
+
return React.useContext(TypographyColorContext);
|
|
111
113
|
}
|
|
112
114
|
const getTypographyTypeConfigKey = theme => {
|
|
113
115
|
const isMediumOrAbove = theme.responsive.matchWindowSize({
|
|
@@ -133,7 +135,12 @@ function getTypographyTypeConfig(type, theme) {
|
|
|
133
135
|
const StyledTypography = /*#__PURE__*/styled__default.Text.withConfig({
|
|
134
136
|
displayName: "Typography__StyledTypography",
|
|
135
137
|
componentId: "kitt-universal__sc-1dz700q-0"
|
|
136
|
-
})(["", " ", ""], ({
|
|
138
|
+
})(["", ";", " ", ""], ({
|
|
139
|
+
$textAlign
|
|
140
|
+
}) => {
|
|
141
|
+
if (!$textAlign) return undefined;
|
|
142
|
+
return styled.css(["text-align:", ";"], $textAlign);
|
|
143
|
+
}, ({
|
|
137
144
|
theme,
|
|
138
145
|
$isHeader,
|
|
139
146
|
$typeForCurrentWindowSize,
|
|
@@ -144,18 +151,7 @@ const StyledTypography = /*#__PURE__*/styled__default.Text.withConfig({
|
|
|
144
151
|
bodies
|
|
145
152
|
} = theme.kitt.typography.types;
|
|
146
153
|
const typeConfigKey = getTypographyTypeConfigKey(theme);
|
|
147
|
-
return
|
|
148
|
-
/* type */
|
|
149
|
-
${!$typeForCurrentWindowSize ? '' : `
|
|
150
|
-
font-family: ${$isHeader ? headers.fontFamily[$variant] : bodies.fontFamily[$variant]};
|
|
151
|
-
font-size: ${$isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize}px;
|
|
152
|
-
line-height: ${$isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight}px;
|
|
153
|
-
`}
|
|
154
|
-
|
|
155
|
-
/* variant */
|
|
156
|
-
font-weight: ${$isHeader ? headers.fontWeight : bodies.fontWeight[$variant]};
|
|
157
|
-
font-style: ${$isHeader ? headers.fontStyle : bodies.fontStyle[$variant]};
|
|
158
|
-
`;
|
|
154
|
+
return styled.css(["", " font-weight:", ";font-style:", ";"], !$typeForCurrentWindowSize ? '' : styled.css(["font-family:", ";font-size:", "px;line-height:", "px;"], $isHeader ? headers.fontFamily[$variant] : bodies.fontFamily[$variant], $isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize, $isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight), $isHeader ? headers.fontWeight : bodies.fontWeight[$variant], $isHeader ? headers.fontStyle : bodies.fontStyle[$variant]);
|
|
159
155
|
}, ({
|
|
160
156
|
theme,
|
|
161
157
|
$color
|
|
@@ -194,9 +190,10 @@ function Typography({
|
|
|
194
190
|
large,
|
|
195
191
|
variant,
|
|
196
192
|
color,
|
|
193
|
+
textAlign,
|
|
197
194
|
...otherProps
|
|
198
195
|
}) {
|
|
199
|
-
const isHeaderTypographyInContext =
|
|
196
|
+
const isHeaderTypographyInContext = React.useContext(IsHeaderTypographyContext);
|
|
200
197
|
const hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
|
|
201
198
|
const {
|
|
202
199
|
base: baseOrDefaultToBody,
|
|
@@ -208,22 +205,21 @@ function Typography({
|
|
|
208
205
|
const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(baseOrDefaultToBody, small, medium, large);
|
|
209
206
|
const isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
|
|
210
207
|
const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular');
|
|
211
|
-
const
|
|
212
|
-
value: isHeader,
|
|
213
|
-
children: /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
|
|
214
|
-
$color: colorOrDefaultToBlack,
|
|
215
|
-
$isHeader: isHeader,
|
|
216
|
-
$typeForCurrentWindowSize: typeForCurrentWindowSize,
|
|
217
|
-
$variant: nonNullableVariant,
|
|
218
|
-
accessibilityRole: accessibilityRole || undefined,
|
|
219
|
-
...otherProps
|
|
220
|
-
})
|
|
221
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
|
|
208
|
+
const sharedProps = {
|
|
222
209
|
$color: colorOrDefaultToBlack,
|
|
223
210
|
$isHeader: isHeader,
|
|
224
211
|
$variant: nonNullableVariant,
|
|
225
212
|
accessibilityRole: accessibilityRole || undefined,
|
|
213
|
+
$textAlign: textAlign,
|
|
226
214
|
...otherProps
|
|
215
|
+
};
|
|
216
|
+
const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
|
|
217
|
+
value: isHeader,
|
|
218
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledTypography, { ...sharedProps,
|
|
219
|
+
$typeForCurrentWindowSize: typeForCurrentWindowSize,
|
|
220
|
+
...otherProps
|
|
221
|
+
})
|
|
222
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(StyledTypography, { ...sharedProps
|
|
227
223
|
});
|
|
228
224
|
return color ? /*#__PURE__*/jsxRuntime.jsx(TypographyColorContext.Provider, {
|
|
229
225
|
value: color,
|
|
@@ -395,7 +391,7 @@ const StyledAnimatedView = /*#__PURE__*/styled__default(Animated__default.View).
|
|
|
395
391
|
})(["border-radius:", "px;"], ({
|
|
396
392
|
theme
|
|
397
393
|
}) => theme.kitt.button.borderRadius);
|
|
398
|
-
const AnimatedButtonPressable = /*#__PURE__*/
|
|
394
|
+
const AnimatedButtonPressable = /*#__PURE__*/React.forwardRef(({
|
|
399
395
|
children,
|
|
400
396
|
disabled,
|
|
401
397
|
accessibilityRole,
|
|
@@ -747,7 +743,7 @@ const StyledDisabled = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
747
743
|
}) => theme.kitt.button.borderRadius);
|
|
748
744
|
|
|
749
745
|
const allowedGhostTypes = ['primary', 'default'];
|
|
750
|
-
const Button = /*#__PURE__*/
|
|
746
|
+
const Button = /*#__PURE__*/React.forwardRef(({
|
|
751
747
|
children,
|
|
752
748
|
type = 'default',
|
|
753
749
|
variant = 'default',
|
|
@@ -837,7 +833,7 @@ function Emoji({
|
|
|
837
833
|
size,
|
|
838
834
|
style
|
|
839
835
|
}) {
|
|
840
|
-
const [emojiData] =
|
|
836
|
+
const [emojiData] = React.useMemo(() => twemojiParser.parse(emoji, {
|
|
841
837
|
// on native plaforms, you can't display svg as Image
|
|
842
838
|
assetType: reactNative.Platform.OS === 'web' ? 'svg' : 'png'
|
|
843
839
|
}), [emoji]);
|
|
@@ -1371,6 +1367,30 @@ const pageLoader = {
|
|
|
1371
1367
|
}
|
|
1372
1368
|
};
|
|
1373
1369
|
|
|
1370
|
+
const picker = {
|
|
1371
|
+
ios: {
|
|
1372
|
+
default: {
|
|
1373
|
+
fontFamily: typography.types.bodies.fontFamily.regular,
|
|
1374
|
+
...typography.types.bodies.configs.body.baseAndSmall,
|
|
1375
|
+
fontSize: 16,
|
|
1376
|
+
color: typography.colors['black-light']
|
|
1377
|
+
},
|
|
1378
|
+
selected: {
|
|
1379
|
+
color: typography.colors.primary
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
android: {
|
|
1383
|
+
padding: '12px 24px',
|
|
1384
|
+
default: {
|
|
1385
|
+
backgroundColor: colors.transparent
|
|
1386
|
+
},
|
|
1387
|
+
selected: {
|
|
1388
|
+
backgroundColor: colors.primary,
|
|
1389
|
+
color: typography.colors.white
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
|
|
1374
1394
|
const shadows = {
|
|
1375
1395
|
medium: '0px 10px 20px rgba(41, 48, 51, 0.25)'
|
|
1376
1396
|
};
|
|
@@ -1470,6 +1490,7 @@ const theme = {
|
|
|
1470
1490
|
iconButton,
|
|
1471
1491
|
listItem,
|
|
1472
1492
|
pageLoader,
|
|
1493
|
+
picker,
|
|
1473
1494
|
shadows,
|
|
1474
1495
|
skeleton,
|
|
1475
1496
|
tag,
|
|
@@ -1528,7 +1549,7 @@ function createWindowSizeHelper(dimensions) {
|
|
|
1528
1549
|
|
|
1529
1550
|
function useKittTheme() {
|
|
1530
1551
|
const dimensions = reactNative.useWindowDimensions();
|
|
1531
|
-
return
|
|
1552
|
+
return React.useMemo(() => {
|
|
1532
1553
|
return {
|
|
1533
1554
|
kitt: theme,
|
|
1534
1555
|
responsive: createWindowSizeHelper(dimensions)
|
|
@@ -1878,7 +1899,7 @@ function StyleWebWrapper({
|
|
|
1878
1899
|
// }
|
|
1879
1900
|
function withTheme(WrappedComponent) {
|
|
1880
1901
|
// eslint-disable-next-line prefer-arrow-callback
|
|
1881
|
-
return /*#__PURE__*/
|
|
1902
|
+
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1882
1903
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
1883
1904
|
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
|
|
1884
1905
|
ref: ref,
|
|
@@ -1888,7 +1909,7 @@ function withTheme(WrappedComponent) {
|
|
|
1888
1909
|
});
|
|
1889
1910
|
}
|
|
1890
1911
|
|
|
1891
|
-
const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react
|
|
1912
|
+
const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react.styled("div")({
|
|
1892
1913
|
name: "PressableIconButtonWebWrapper",
|
|
1893
1914
|
class: "kitt-u_PressableIconButtonWebWrapper_p1nlccvg",
|
|
1894
1915
|
vars: {
|
|
@@ -2143,7 +2164,7 @@ function IconButton({
|
|
|
2143
2164
|
});
|
|
2144
2165
|
}
|
|
2145
2166
|
|
|
2146
|
-
const OnCloseContext = /*#__PURE__*/
|
|
2167
|
+
const OnCloseContext = /*#__PURE__*/React.createContext(() => {});
|
|
2147
2168
|
|
|
2148
2169
|
const HeaderView = /*#__PURE__*/styled__default.View.withConfig({
|
|
2149
2170
|
displayName: "Header__HeaderView",
|
|
@@ -2177,7 +2198,7 @@ function ModalHeader({
|
|
|
2177
2198
|
right,
|
|
2178
2199
|
children
|
|
2179
2200
|
}) {
|
|
2180
|
-
const onClose =
|
|
2201
|
+
const onClose = React.useContext(OnCloseContext);
|
|
2181
2202
|
const isIconLeft = !!left;
|
|
2182
2203
|
return /*#__PURE__*/jsxRuntime.jsxs(HeaderView, {
|
|
2183
2204
|
children: [isIconLeft && /*#__PURE__*/jsxRuntime.jsx(LeftIconView, {
|
|
@@ -2293,7 +2314,7 @@ function ModalPlatformDateTimePicker({
|
|
|
2293
2314
|
onChange,
|
|
2294
2315
|
...props
|
|
2295
2316
|
}) {
|
|
2296
|
-
const [currentValue, setCurrentValue] =
|
|
2317
|
+
const [currentValue, setCurrentValue] = React.useState(value); // Prevent unsynced value between the modal and its parent state
|
|
2297
2318
|
|
|
2298
2319
|
return /*#__PURE__*/jsxRuntime.jsx(Modal, {
|
|
2299
2320
|
visible: Boolean(isVisible),
|
|
@@ -2342,9 +2363,9 @@ function DatePicker({
|
|
|
2342
2363
|
pickerDefaultDate,
|
|
2343
2364
|
...props
|
|
2344
2365
|
}) {
|
|
2345
|
-
const [isPickerUIVisible, setIsPickerUIVisible] =
|
|
2346
|
-
const [isFocused, setIsFocused] =
|
|
2347
|
-
const [currentValue, setCurrentValue] =
|
|
2366
|
+
const [isPickerUIVisible, setIsPickerUIVisible] = React.useState(false);
|
|
2367
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
2368
|
+
const [currentValue, setCurrentValue] = React.useState(value);
|
|
2348
2369
|
|
|
2349
2370
|
if (reactNative.Platform.OS === 'android') {
|
|
2350
2371
|
return /*#__PURE__*/jsxRuntime.jsx(DatePickerAndroid, {
|
|
@@ -2411,7 +2432,13 @@ const StyledTextInput = /*#__PURE__*/styled__default(reactNative.TextInput).with
|
|
|
2411
2432
|
theme,
|
|
2412
2433
|
multiline
|
|
2413
2434
|
}) => {
|
|
2414
|
-
|
|
2435
|
+
const shouldHandleSingleLineOnIOS = reactNative.Platform.OS === 'ios' && !multiline; // On basic text input, we set the line-height to zero for iOS to fix vertical text alignment
|
|
2436
|
+
// This is a iOS only fix since having 0 as a line-height value breaks text inputs on Android
|
|
2437
|
+
|
|
2438
|
+
if (shouldHandleSingleLineOnIOS) {
|
|
2439
|
+
return 0;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2415
2442
|
const typeConfigKey = getTypographyTypeConfigKey(theme);
|
|
2416
2443
|
return `${theme.kitt.typography.types.bodies.configs.body[typeConfigKey].lineHeight}px`;
|
|
2417
2444
|
}, ({
|
|
@@ -2422,7 +2449,7 @@ const RightInputContainer = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
2422
2449
|
displayName: "InputText__RightInputContainer",
|
|
2423
2450
|
componentId: "kitt-universal__sc-uke279-1"
|
|
2424
2451
|
})(["position:absolute;right:0;top:0;bottom:0;justify-content:center;padding:10px;"]);
|
|
2425
|
-
const InputText = /*#__PURE__*/
|
|
2452
|
+
const InputText = /*#__PURE__*/React.forwardRef(({
|
|
2426
2453
|
id,
|
|
2427
2454
|
right,
|
|
2428
2455
|
minHeight,
|
|
@@ -2440,7 +2467,7 @@ const InputText = /*#__PURE__*/react.forwardRef(({
|
|
|
2440
2467
|
...props
|
|
2441
2468
|
}, ref) => {
|
|
2442
2469
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
2443
|
-
const [isFocused, setIsFocused] =
|
|
2470
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
2444
2471
|
const state = internalForceState || getInputUIState({
|
|
2445
2472
|
isFocused,
|
|
2446
2473
|
isDisabled: disabled,
|
|
@@ -2592,7 +2619,7 @@ function InputPassword({
|
|
|
2592
2619
|
right,
|
|
2593
2620
|
...props
|
|
2594
2621
|
}) {
|
|
2595
|
-
const [isVisible, setIsVisible] =
|
|
2622
|
+
const [isVisible, setIsVisible] = React.useState(Boolean(isPasswordDefaultVisible));
|
|
2596
2623
|
return /*#__PURE__*/jsxRuntime.jsx(InputText, { ...props,
|
|
2597
2624
|
textContentType: "password",
|
|
2598
2625
|
autoCompleteType: "password",
|
|
@@ -2876,8 +2903,8 @@ function FullScreenModalHeader({
|
|
|
2876
2903
|
top
|
|
2877
2904
|
} = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
2878
2905
|
const dimensions = reactNative.useWindowDimensions();
|
|
2879
|
-
const [leftWidth, setLeftWidth] =
|
|
2880
|
-
const [rightWidth, setRightWidth] =
|
|
2906
|
+
const [leftWidth, setLeftWidth] = React.useState(0);
|
|
2907
|
+
const [rightWidth, setRightWidth] = React.useState(0);
|
|
2881
2908
|
|
|
2882
2909
|
const handleLayoutChange = (event, side) => {
|
|
2883
2910
|
// Prevents react to nullify event on rerenders
|
|
@@ -2933,15 +2960,15 @@ function SpinningIcon({
|
|
|
2933
2960
|
throw new Error(`Invalid color passed to SpinningIcon: ${String(color)}`);
|
|
2934
2961
|
}
|
|
2935
2962
|
|
|
2936
|
-
const clonedIcon = /*#__PURE__*/
|
|
2963
|
+
const clonedIcon = /*#__PURE__*/React.cloneElement(icon, {
|
|
2937
2964
|
color
|
|
2938
2965
|
});
|
|
2939
|
-
const animationRef =
|
|
2966
|
+
const animationRef = React.useRef(new reactNative.Animated.Value(0));
|
|
2940
2967
|
const rotation = animationRef.current.interpolate({
|
|
2941
2968
|
inputRange: [0, 1],
|
|
2942
2969
|
outputRange: ['0deg', '360deg']
|
|
2943
2970
|
});
|
|
2944
|
-
|
|
2971
|
+
React.useEffect(() => {
|
|
2945
2972
|
if (process.env.NODE_ENV === 'test') return undefined;
|
|
2946
2973
|
const animation = reactNative.Animated.loop(reactNative.Animated.timing(animationRef.current, {
|
|
2947
2974
|
toValue: 1,
|
|
@@ -3060,7 +3087,7 @@ function ListItem({
|
|
|
3060
3087
|
onPress,
|
|
3061
3088
|
...rest
|
|
3062
3089
|
}) {
|
|
3063
|
-
const Wrapper = onPress ? reactNative.Pressable :
|
|
3090
|
+
const Wrapper = onPress ? reactNative.Pressable : React.Fragment;
|
|
3064
3091
|
const wrapperProps = onPress ? {
|
|
3065
3092
|
accessibilityRole: 'button',
|
|
3066
3093
|
onPress,
|
|
@@ -3333,7 +3360,7 @@ function AnimatedBackgroundCircle() {
|
|
|
3333
3360
|
colors,
|
|
3334
3361
|
size
|
|
3335
3362
|
} = theme.kitt.pageLoader;
|
|
3336
|
-
|
|
3363
|
+
React.useEffect(() => {
|
|
3337
3364
|
const {
|
|
3338
3365
|
delay,
|
|
3339
3366
|
circleBackgroundFillDuration,
|
|
@@ -3366,7 +3393,7 @@ function AnimatedFillCircleContainer({
|
|
|
3366
3393
|
const {
|
|
3367
3394
|
animation
|
|
3368
3395
|
} = theme.kitt.pageLoader;
|
|
3369
|
-
|
|
3396
|
+
React.useEffect(() => {
|
|
3370
3397
|
const {
|
|
3371
3398
|
delay
|
|
3372
3399
|
} = animation;
|
|
@@ -3412,7 +3439,7 @@ function AnimatedFilledCircle() {
|
|
|
3412
3439
|
animation,
|
|
3413
3440
|
colors
|
|
3414
3441
|
} = theme.kitt.pageLoader;
|
|
3415
|
-
|
|
3442
|
+
React.useEffect(() => {
|
|
3416
3443
|
const {
|
|
3417
3444
|
delay,
|
|
3418
3445
|
filledCircleFillDuration,
|
|
@@ -3455,6 +3482,97 @@ function PageLoader() {
|
|
|
3455
3482
|
});
|
|
3456
3483
|
}
|
|
3457
3484
|
|
|
3485
|
+
const ContainerPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
|
|
3486
|
+
displayName: "PickerItem__ContainerPressable",
|
|
3487
|
+
componentId: "kitt-universal__sc-w7n3sn-0"
|
|
3488
|
+
})(["padding:", ";background-color:", ";"], ({
|
|
3489
|
+
theme
|
|
3490
|
+
}) => theme.kitt.picker.android.padding, ({
|
|
3491
|
+
theme,
|
|
3492
|
+
$isSelected
|
|
3493
|
+
}) => $isSelected ? theme.kitt.picker.android.selected.backgroundColor : theme.kitt.picker.android.default.backgroundColor); // This item is for Android only, iOS uses its own implementation and web is not supported yet
|
|
3494
|
+
|
|
3495
|
+
function PickerItem({
|
|
3496
|
+
label,
|
|
3497
|
+
value,
|
|
3498
|
+
isSelected,
|
|
3499
|
+
onPress
|
|
3500
|
+
}) {
|
|
3501
|
+
return /*#__PURE__*/jsxRuntime.jsx(ContainerPressable, {
|
|
3502
|
+
accessibilityRole: "button",
|
|
3503
|
+
accessibilityState: {
|
|
3504
|
+
selected: isSelected
|
|
3505
|
+
},
|
|
3506
|
+
$isSelected: isSelected,
|
|
3507
|
+
onPress: onPress ? () => onPress(value) : undefined,
|
|
3508
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3509
|
+
base: "body",
|
|
3510
|
+
color: isSelected ? 'white' : undefined,
|
|
3511
|
+
children: label
|
|
3512
|
+
})
|
|
3513
|
+
});
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3516
|
+
function Picker({
|
|
3517
|
+
children,
|
|
3518
|
+
isVisible,
|
|
3519
|
+
title,
|
|
3520
|
+
initialValue,
|
|
3521
|
+
validateButtonLabel,
|
|
3522
|
+
testID,
|
|
3523
|
+
onValueSelected,
|
|
3524
|
+
onClose
|
|
3525
|
+
}) {
|
|
3526
|
+
const [value, setValue] = React.useState(initialValue);
|
|
3527
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Modal, {
|
|
3528
|
+
visible: isVisible,
|
|
3529
|
+
onClose: onClose,
|
|
3530
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Header, {
|
|
3531
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3532
|
+
base: "body",
|
|
3533
|
+
variant: "bold",
|
|
3534
|
+
children: title
|
|
3535
|
+
})
|
|
3536
|
+
}), /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
|
|
3537
|
+
children: reactNative.Platform.OS === 'ios' ? /*#__PURE__*/jsxRuntime.jsx(picker$1.Picker, {
|
|
3538
|
+
testID: testID,
|
|
3539
|
+
selectedValue: value,
|
|
3540
|
+
itemStyle: theme.picker.ios.default,
|
|
3541
|
+
onValueChange: itemValue => setValue(itemValue),
|
|
3542
|
+
children: React__default.Children.map(children, child => {
|
|
3543
|
+
const item = child; // iOS Picker doesn't support a custom Item component, we need to override its props manually for the selected one
|
|
3544
|
+
|
|
3545
|
+
return /*#__PURE__*/React.cloneElement(item, {
|
|
3546
|
+
color: item.props.value === value ? theme.picker.ios.selected.color : undefined
|
|
3547
|
+
});
|
|
3548
|
+
})
|
|
3549
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
|
|
3550
|
+
testID: testID,
|
|
3551
|
+
children: React__default.Children.map(children, child => {
|
|
3552
|
+
const item = child;
|
|
3553
|
+
return /*#__PURE__*/React.cloneElement(item, {
|
|
3554
|
+
onPress: newValue => setValue(newValue),
|
|
3555
|
+
isSelected: item.props.value === value
|
|
3556
|
+
});
|
|
3557
|
+
})
|
|
3558
|
+
})
|
|
3559
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Modal.Footer, {
|
|
3560
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
3561
|
+
stretch: true,
|
|
3562
|
+
type: "primary",
|
|
3563
|
+
onPress: () => {
|
|
3564
|
+
onValueSelected(value);
|
|
3565
|
+
onClose();
|
|
3566
|
+
},
|
|
3567
|
+
children: validateButtonLabel || /*#__PURE__*/jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
3568
|
+
id: "kitt-universal.Picker.validate"
|
|
3569
|
+
})
|
|
3570
|
+
})
|
|
3571
|
+
})]
|
|
3572
|
+
});
|
|
3573
|
+
}
|
|
3574
|
+
Picker.Item = PickerItem;
|
|
3575
|
+
|
|
3458
3576
|
const Container$2 = /*#__PURE__*/styled__default.View.withConfig({
|
|
3459
3577
|
displayName: "SkeletonContent__Container",
|
|
3460
3578
|
componentId: "kitt-universal__sc-1u3chjb-0"
|
|
@@ -3470,7 +3588,7 @@ function SkeletonContent({
|
|
|
3470
3588
|
}) {
|
|
3471
3589
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
3472
3590
|
const sharedX = Animated.useSharedValue(0);
|
|
3473
|
-
|
|
3591
|
+
React.useEffect(() => {
|
|
3474
3592
|
if (isLoading) {
|
|
3475
3593
|
sharedX.value = Animated.withRepeat(Animated.withTiming(1, {
|
|
3476
3594
|
duration: theme.kitt.skeleton.animationDuration,
|
|
@@ -3526,7 +3644,7 @@ function Skeleton({
|
|
|
3526
3644
|
isLoading,
|
|
3527
3645
|
style
|
|
3528
3646
|
}) {
|
|
3529
|
-
const [width, setWidth] =
|
|
3647
|
+
const [width, setWidth] = React.useState(0);
|
|
3530
3648
|
return /*#__PURE__*/jsxRuntime.jsx(SkeletonContainer, {
|
|
3531
3649
|
style: style,
|
|
3532
3650
|
onLayout: ({
|
|
@@ -3612,10 +3730,10 @@ const getTypographyColorFromBlockColor = (color = 'transparent') => {
|
|
|
3612
3730
|
}
|
|
3613
3731
|
};
|
|
3614
3732
|
|
|
3615
|
-
const StoryBlockBackgroundContext = /*#__PURE__*/
|
|
3616
|
-
const StoryBlockColorContext = /*#__PURE__*/
|
|
3733
|
+
const StoryBlockBackgroundContext = /*#__PURE__*/React.createContext('transparent');
|
|
3734
|
+
const StoryBlockColorContext = /*#__PURE__*/React.createContext('black');
|
|
3617
3735
|
const useStoryBlockColor = color => {
|
|
3618
|
-
const storyBlockColor =
|
|
3736
|
+
const storyBlockColor = React.useContext(StoryBlockColorContext);
|
|
3619
3737
|
return color || storyBlockColor;
|
|
3620
3738
|
};
|
|
3621
3739
|
const StyledStoryBlockView = /*#__PURE__*/styled__default.View.withConfig({
|
|
@@ -3870,14 +3988,14 @@ function StoryGridRow({
|
|
|
3870
3988
|
|
|
3871
3989
|
if (width < breakpointValue) {
|
|
3872
3990
|
return /*#__PURE__*/jsxRuntime.jsx(SmallScreenRow, {
|
|
3873
|
-
children:
|
|
3991
|
+
children: React.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(SmallScreenCol, {
|
|
3874
3992
|
children: child
|
|
3875
3993
|
}))
|
|
3876
3994
|
});
|
|
3877
3995
|
}
|
|
3878
3996
|
|
|
3879
3997
|
return /*#__PURE__*/jsxRuntime.jsx(FlexRow, {
|
|
3880
|
-
children:
|
|
3998
|
+
children: React.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(FlexCol, {
|
|
3881
3999
|
children: child
|
|
3882
4000
|
}))
|
|
3883
4001
|
});
|
|
@@ -3992,7 +4110,7 @@ function ModalDateTimePicker({
|
|
|
3992
4110
|
onChange,
|
|
3993
4111
|
onClose
|
|
3994
4112
|
}) {
|
|
3995
|
-
const [currentValue, setCurrentValue] =
|
|
4113
|
+
const [currentValue, setCurrentValue] = React.useState(value); // Prevent unsynced value between the modal and its parent state
|
|
3996
4114
|
|
|
3997
4115
|
return /*#__PURE__*/jsxRuntime.jsx(Modal, {
|
|
3998
4116
|
visible: Boolean(visible),
|
|
@@ -4036,8 +4154,8 @@ const timePickerPlaceholder = '--:--';
|
|
|
4036
4154
|
const formatNumberToTimeString = time => `${String(time).padStart(2, '0')}`;
|
|
4037
4155
|
const formatDateToTimeString = date => `${formatNumberToTimeString(date.getHours())}:${formatNumberToTimeString(date.getMinutes())}`;
|
|
4038
4156
|
const useTimePicker = (value, onChange, onBlur, disabled, defaultValue) => {
|
|
4039
|
-
const [isTimePickerModalVisible, setIsTimePickerModalVisible] =
|
|
4040
|
-
const todayAtNoon =
|
|
4157
|
+
const [isTimePickerModalVisible, setIsTimePickerModalVisible] = React.useState(false);
|
|
4158
|
+
const todayAtNoon = React.useMemo(() => {
|
|
4041
4159
|
const now = new Date(2000, 0, 1, 12);
|
|
4042
4160
|
return new Date(now.getFullYear(), now.getMonth(), now.getDay(), 12);
|
|
4043
4161
|
}, []);
|
|
@@ -4229,7 +4347,7 @@ function Tooltip({
|
|
|
4229
4347
|
padding
|
|
4230
4348
|
})]
|
|
4231
4349
|
});
|
|
4232
|
-
|
|
4350
|
+
React.useEffect(() => {
|
|
4233
4351
|
if (!onUpdate) return;
|
|
4234
4352
|
onUpdate({
|
|
4235
4353
|
x,
|
|
@@ -4307,7 +4425,7 @@ function TypographyEmoji({
|
|
|
4307
4425
|
});
|
|
4308
4426
|
}
|
|
4309
4427
|
|
|
4310
|
-
const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react
|
|
4428
|
+
const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react.styled("span")({
|
|
4311
4429
|
name: "TypographyLinkWebWrapper",
|
|
4312
4430
|
class: "kitt-u_TypographyLinkWebWrapper_tcwz3nt",
|
|
4313
4431
|
vars: {
|
|
@@ -4440,6 +4558,7 @@ exports.Modal = Modal;
|
|
|
4440
4558
|
exports.Notification = Notification;
|
|
4441
4559
|
exports.Overlay = Overlay;
|
|
4442
4560
|
exports.PageLoader = PageLoader;
|
|
4561
|
+
exports.Picker = Picker;
|
|
4443
4562
|
exports.Radio = Radio;
|
|
4444
4563
|
exports.Section = DeprecatedSection;
|
|
4445
4564
|
exports.Skeleton = Skeleton;
|