@ornikar/kitt-universal 7.5.0 → 7.6.0
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/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 +168 -36
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +168 -36
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +168 -36
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +72 -35
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +180 -67
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.js +51 -24
- 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 +7 -2
- 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, {
|
|
@@ -2422,7 +2443,7 @@ const RightInputContainer = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
2422
2443
|
displayName: "InputText__RightInputContainer",
|
|
2423
2444
|
componentId: "kitt-universal__sc-uke279-1"
|
|
2424
2445
|
})(["position:absolute;right:0;top:0;bottom:0;justify-content:center;padding:10px;"]);
|
|
2425
|
-
const InputText = /*#__PURE__*/
|
|
2446
|
+
const InputText = /*#__PURE__*/React.forwardRef(({
|
|
2426
2447
|
id,
|
|
2427
2448
|
right,
|
|
2428
2449
|
minHeight,
|
|
@@ -2440,7 +2461,7 @@ const InputText = /*#__PURE__*/react.forwardRef(({
|
|
|
2440
2461
|
...props
|
|
2441
2462
|
}, ref) => {
|
|
2442
2463
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
2443
|
-
const [isFocused, setIsFocused] =
|
|
2464
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
2444
2465
|
const state = internalForceState || getInputUIState({
|
|
2445
2466
|
isFocused,
|
|
2446
2467
|
isDisabled: disabled,
|
|
@@ -2592,7 +2613,7 @@ function InputPassword({
|
|
|
2592
2613
|
right,
|
|
2593
2614
|
...props
|
|
2594
2615
|
}) {
|
|
2595
|
-
const [isVisible, setIsVisible] =
|
|
2616
|
+
const [isVisible, setIsVisible] = React.useState(Boolean(isPasswordDefaultVisible));
|
|
2596
2617
|
return /*#__PURE__*/jsxRuntime.jsx(InputText, { ...props,
|
|
2597
2618
|
textContentType: "password",
|
|
2598
2619
|
autoCompleteType: "password",
|
|
@@ -2876,8 +2897,8 @@ function FullScreenModalHeader({
|
|
|
2876
2897
|
top
|
|
2877
2898
|
} = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
2878
2899
|
const dimensions = reactNative.useWindowDimensions();
|
|
2879
|
-
const [leftWidth, setLeftWidth] =
|
|
2880
|
-
const [rightWidth, setRightWidth] =
|
|
2900
|
+
const [leftWidth, setLeftWidth] = React.useState(0);
|
|
2901
|
+
const [rightWidth, setRightWidth] = React.useState(0);
|
|
2881
2902
|
|
|
2882
2903
|
const handleLayoutChange = (event, side) => {
|
|
2883
2904
|
// Prevents react to nullify event on rerenders
|
|
@@ -2933,15 +2954,15 @@ function SpinningIcon({
|
|
|
2933
2954
|
throw new Error(`Invalid color passed to SpinningIcon: ${String(color)}`);
|
|
2934
2955
|
}
|
|
2935
2956
|
|
|
2936
|
-
const clonedIcon = /*#__PURE__*/
|
|
2957
|
+
const clonedIcon = /*#__PURE__*/React.cloneElement(icon, {
|
|
2937
2958
|
color
|
|
2938
2959
|
});
|
|
2939
|
-
const animationRef =
|
|
2960
|
+
const animationRef = React.useRef(new reactNative.Animated.Value(0));
|
|
2940
2961
|
const rotation = animationRef.current.interpolate({
|
|
2941
2962
|
inputRange: [0, 1],
|
|
2942
2963
|
outputRange: ['0deg', '360deg']
|
|
2943
2964
|
});
|
|
2944
|
-
|
|
2965
|
+
React.useEffect(() => {
|
|
2945
2966
|
if (process.env.NODE_ENV === 'test') return undefined;
|
|
2946
2967
|
const animation = reactNative.Animated.loop(reactNative.Animated.timing(animationRef.current, {
|
|
2947
2968
|
toValue: 1,
|
|
@@ -3060,7 +3081,7 @@ function ListItem({
|
|
|
3060
3081
|
onPress,
|
|
3061
3082
|
...rest
|
|
3062
3083
|
}) {
|
|
3063
|
-
const Wrapper = onPress ? reactNative.Pressable :
|
|
3084
|
+
const Wrapper = onPress ? reactNative.Pressable : React.Fragment;
|
|
3064
3085
|
const wrapperProps = onPress ? {
|
|
3065
3086
|
accessibilityRole: 'button',
|
|
3066
3087
|
onPress,
|
|
@@ -3333,7 +3354,7 @@ function AnimatedBackgroundCircle() {
|
|
|
3333
3354
|
colors,
|
|
3334
3355
|
size
|
|
3335
3356
|
} = theme.kitt.pageLoader;
|
|
3336
|
-
|
|
3357
|
+
React.useEffect(() => {
|
|
3337
3358
|
const {
|
|
3338
3359
|
delay,
|
|
3339
3360
|
circleBackgroundFillDuration,
|
|
@@ -3366,7 +3387,7 @@ function AnimatedFillCircleContainer({
|
|
|
3366
3387
|
const {
|
|
3367
3388
|
animation
|
|
3368
3389
|
} = theme.kitt.pageLoader;
|
|
3369
|
-
|
|
3390
|
+
React.useEffect(() => {
|
|
3370
3391
|
const {
|
|
3371
3392
|
delay
|
|
3372
3393
|
} = animation;
|
|
@@ -3412,7 +3433,7 @@ function AnimatedFilledCircle() {
|
|
|
3412
3433
|
animation,
|
|
3413
3434
|
colors
|
|
3414
3435
|
} = theme.kitt.pageLoader;
|
|
3415
|
-
|
|
3436
|
+
React.useEffect(() => {
|
|
3416
3437
|
const {
|
|
3417
3438
|
delay,
|
|
3418
3439
|
filledCircleFillDuration,
|
|
@@ -3455,6 +3476,97 @@ function PageLoader() {
|
|
|
3455
3476
|
});
|
|
3456
3477
|
}
|
|
3457
3478
|
|
|
3479
|
+
const ContainerPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
|
|
3480
|
+
displayName: "PickerItem__ContainerPressable",
|
|
3481
|
+
componentId: "kitt-universal__sc-w7n3sn-0"
|
|
3482
|
+
})(["padding:", ";background-color:", ";"], ({
|
|
3483
|
+
theme
|
|
3484
|
+
}) => theme.kitt.picker.android.padding, ({
|
|
3485
|
+
theme,
|
|
3486
|
+
$isSelected
|
|
3487
|
+
}) => $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
|
|
3488
|
+
|
|
3489
|
+
function PickerItem({
|
|
3490
|
+
label,
|
|
3491
|
+
value,
|
|
3492
|
+
isSelected,
|
|
3493
|
+
onPress
|
|
3494
|
+
}) {
|
|
3495
|
+
return /*#__PURE__*/jsxRuntime.jsx(ContainerPressable, {
|
|
3496
|
+
accessibilityRole: "button",
|
|
3497
|
+
accessibilityState: {
|
|
3498
|
+
selected: isSelected
|
|
3499
|
+
},
|
|
3500
|
+
$isSelected: isSelected,
|
|
3501
|
+
onPress: onPress ? () => onPress(value) : undefined,
|
|
3502
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3503
|
+
base: "body",
|
|
3504
|
+
color: isSelected ? 'white' : undefined,
|
|
3505
|
+
children: label
|
|
3506
|
+
})
|
|
3507
|
+
});
|
|
3508
|
+
}
|
|
3509
|
+
|
|
3510
|
+
function Picker({
|
|
3511
|
+
children,
|
|
3512
|
+
isVisible,
|
|
3513
|
+
title,
|
|
3514
|
+
initialValue,
|
|
3515
|
+
validateButtonLabel,
|
|
3516
|
+
testID,
|
|
3517
|
+
onValueSelected,
|
|
3518
|
+
onClose
|
|
3519
|
+
}) {
|
|
3520
|
+
const [value, setValue] = React.useState(initialValue);
|
|
3521
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Modal, {
|
|
3522
|
+
visible: isVisible,
|
|
3523
|
+
onClose: onClose,
|
|
3524
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Header, {
|
|
3525
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3526
|
+
base: "body",
|
|
3527
|
+
variant: "bold",
|
|
3528
|
+
children: title
|
|
3529
|
+
})
|
|
3530
|
+
}), /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
|
|
3531
|
+
children: reactNative.Platform.OS === 'ios' ? /*#__PURE__*/jsxRuntime.jsx(picker$1.Picker, {
|
|
3532
|
+
testID: testID,
|
|
3533
|
+
selectedValue: value,
|
|
3534
|
+
itemStyle: theme.picker.ios.default,
|
|
3535
|
+
onValueChange: itemValue => setValue(itemValue),
|
|
3536
|
+
children: React__default.Children.map(children, child => {
|
|
3537
|
+
const item = child; // iOS Picker doesn't support a custom Item component, we need to override its props manually for the selected one
|
|
3538
|
+
|
|
3539
|
+
return /*#__PURE__*/React.cloneElement(item, {
|
|
3540
|
+
color: item.props.value === value ? theme.picker.ios.selected.color : undefined
|
|
3541
|
+
});
|
|
3542
|
+
})
|
|
3543
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
|
|
3544
|
+
testID: testID,
|
|
3545
|
+
children: React__default.Children.map(children, child => {
|
|
3546
|
+
const item = child;
|
|
3547
|
+
return /*#__PURE__*/React.cloneElement(item, {
|
|
3548
|
+
onPress: newValue => setValue(newValue),
|
|
3549
|
+
isSelected: item.props.value === value
|
|
3550
|
+
});
|
|
3551
|
+
})
|
|
3552
|
+
})
|
|
3553
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Modal.Footer, {
|
|
3554
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
3555
|
+
stretch: true,
|
|
3556
|
+
type: "primary",
|
|
3557
|
+
onPress: () => {
|
|
3558
|
+
onValueSelected(value);
|
|
3559
|
+
onClose();
|
|
3560
|
+
},
|
|
3561
|
+
children: validateButtonLabel || /*#__PURE__*/jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
3562
|
+
id: "kitt-universal.Picker.validate"
|
|
3563
|
+
})
|
|
3564
|
+
})
|
|
3565
|
+
})]
|
|
3566
|
+
});
|
|
3567
|
+
}
|
|
3568
|
+
Picker.Item = PickerItem;
|
|
3569
|
+
|
|
3458
3570
|
const Container$2 = /*#__PURE__*/styled__default.View.withConfig({
|
|
3459
3571
|
displayName: "SkeletonContent__Container",
|
|
3460
3572
|
componentId: "kitt-universal__sc-1u3chjb-0"
|
|
@@ -3470,7 +3582,7 @@ function SkeletonContent({
|
|
|
3470
3582
|
}) {
|
|
3471
3583
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
3472
3584
|
const sharedX = Animated.useSharedValue(0);
|
|
3473
|
-
|
|
3585
|
+
React.useEffect(() => {
|
|
3474
3586
|
if (isLoading) {
|
|
3475
3587
|
sharedX.value = Animated.withRepeat(Animated.withTiming(1, {
|
|
3476
3588
|
duration: theme.kitt.skeleton.animationDuration,
|
|
@@ -3526,7 +3638,7 @@ function Skeleton({
|
|
|
3526
3638
|
isLoading,
|
|
3527
3639
|
style
|
|
3528
3640
|
}) {
|
|
3529
|
-
const [width, setWidth] =
|
|
3641
|
+
const [width, setWidth] = React.useState(0);
|
|
3530
3642
|
return /*#__PURE__*/jsxRuntime.jsx(SkeletonContainer, {
|
|
3531
3643
|
style: style,
|
|
3532
3644
|
onLayout: ({
|
|
@@ -3612,10 +3724,10 @@ const getTypographyColorFromBlockColor = (color = 'transparent') => {
|
|
|
3612
3724
|
}
|
|
3613
3725
|
};
|
|
3614
3726
|
|
|
3615
|
-
const StoryBlockBackgroundContext = /*#__PURE__*/
|
|
3616
|
-
const StoryBlockColorContext = /*#__PURE__*/
|
|
3727
|
+
const StoryBlockBackgroundContext = /*#__PURE__*/React.createContext('transparent');
|
|
3728
|
+
const StoryBlockColorContext = /*#__PURE__*/React.createContext('black');
|
|
3617
3729
|
const useStoryBlockColor = color => {
|
|
3618
|
-
const storyBlockColor =
|
|
3730
|
+
const storyBlockColor = React.useContext(StoryBlockColorContext);
|
|
3619
3731
|
return color || storyBlockColor;
|
|
3620
3732
|
};
|
|
3621
3733
|
const StyledStoryBlockView = /*#__PURE__*/styled__default.View.withConfig({
|
|
@@ -3870,14 +3982,14 @@ function StoryGridRow({
|
|
|
3870
3982
|
|
|
3871
3983
|
if (width < breakpointValue) {
|
|
3872
3984
|
return /*#__PURE__*/jsxRuntime.jsx(SmallScreenRow, {
|
|
3873
|
-
children:
|
|
3985
|
+
children: React.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(SmallScreenCol, {
|
|
3874
3986
|
children: child
|
|
3875
3987
|
}))
|
|
3876
3988
|
});
|
|
3877
3989
|
}
|
|
3878
3990
|
|
|
3879
3991
|
return /*#__PURE__*/jsxRuntime.jsx(FlexRow, {
|
|
3880
|
-
children:
|
|
3992
|
+
children: React.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(FlexCol, {
|
|
3881
3993
|
children: child
|
|
3882
3994
|
}))
|
|
3883
3995
|
});
|
|
@@ -3992,7 +4104,7 @@ function ModalDateTimePicker({
|
|
|
3992
4104
|
onChange,
|
|
3993
4105
|
onClose
|
|
3994
4106
|
}) {
|
|
3995
|
-
const [currentValue, setCurrentValue] =
|
|
4107
|
+
const [currentValue, setCurrentValue] = React.useState(value); // Prevent unsynced value between the modal and its parent state
|
|
3996
4108
|
|
|
3997
4109
|
return /*#__PURE__*/jsxRuntime.jsx(Modal, {
|
|
3998
4110
|
visible: Boolean(visible),
|
|
@@ -4036,8 +4148,8 @@ const timePickerPlaceholder = '--:--';
|
|
|
4036
4148
|
const formatNumberToTimeString = time => `${String(time).padStart(2, '0')}`;
|
|
4037
4149
|
const formatDateToTimeString = date => `${formatNumberToTimeString(date.getHours())}:${formatNumberToTimeString(date.getMinutes())}`;
|
|
4038
4150
|
const useTimePicker = (value, onChange, onBlur, disabled, defaultValue) => {
|
|
4039
|
-
const [isTimePickerModalVisible, setIsTimePickerModalVisible] =
|
|
4040
|
-
const todayAtNoon =
|
|
4151
|
+
const [isTimePickerModalVisible, setIsTimePickerModalVisible] = React.useState(false);
|
|
4152
|
+
const todayAtNoon = React.useMemo(() => {
|
|
4041
4153
|
const now = new Date(2000, 0, 1, 12);
|
|
4042
4154
|
return new Date(now.getFullYear(), now.getMonth(), now.getDay(), 12);
|
|
4043
4155
|
}, []);
|
|
@@ -4229,7 +4341,7 @@ function Tooltip({
|
|
|
4229
4341
|
padding
|
|
4230
4342
|
})]
|
|
4231
4343
|
});
|
|
4232
|
-
|
|
4344
|
+
React.useEffect(() => {
|
|
4233
4345
|
if (!onUpdate) return;
|
|
4234
4346
|
onUpdate({
|
|
4235
4347
|
x,
|
|
@@ -4307,7 +4419,7 @@ function TypographyEmoji({
|
|
|
4307
4419
|
});
|
|
4308
4420
|
}
|
|
4309
4421
|
|
|
4310
|
-
const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react
|
|
4422
|
+
const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react.styled("span")({
|
|
4311
4423
|
name: "TypographyLinkWebWrapper",
|
|
4312
4424
|
class: "kitt-u_TypographyLinkWebWrapper_tcwz3nt",
|
|
4313
4425
|
vars: {
|
|
@@ -4440,6 +4552,7 @@ exports.Modal = Modal;
|
|
|
4440
4552
|
exports.Notification = Notification;
|
|
4441
4553
|
exports.Overlay = Overlay;
|
|
4442
4554
|
exports.PageLoader = PageLoader;
|
|
4555
|
+
exports.Picker = Picker;
|
|
4443
4556
|
exports.Radio = Radio;
|
|
4444
4557
|
exports.Section = DeprecatedSection;
|
|
4445
4558
|
exports.Skeleton = Skeleton;
|