@ornikar/kitt-universal 7.3.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.
Files changed (43) hide show
  1. package/dist/definitions/Picker/Picker.d.ts +17 -0
  2. package/dist/definitions/Picker/Picker.d.ts.map +1 -0
  3. package/dist/definitions/Picker/Picker.web.d.ts +3 -0
  4. package/dist/definitions/Picker/Picker.web.d.ts.map +1 -0
  5. package/dist/definitions/Picker/PickerItem.d.ts +9 -0
  6. package/dist/definitions/Picker/PickerItem.d.ts.map +1 -0
  7. package/dist/definitions/TimePicker/useTimePicker.d.ts +2 -2
  8. package/dist/definitions/TimePicker/useTimePicker.d.ts.map +1 -1
  9. package/dist/definitions/index.d.ts +2 -0
  10. package/dist/definitions/index.d.ts.map +1 -1
  11. package/dist/definitions/themes/default.d.ts +1 -0
  12. package/dist/definitions/themes/default.d.ts.map +1 -1
  13. package/dist/definitions/themes/late-ocean/picker.d.ts +21 -0
  14. package/dist/definitions/themes/late-ocean/picker.d.ts.map +1 -0
  15. package/dist/definitions/typography/Typography.d.ts +3 -2
  16. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  17. package/dist/index-browser-all.es.android.js +169 -36
  18. package/dist/index-browser-all.es.android.js.map +1 -1
  19. package/dist/index-browser-all.es.ios.js +169 -36
  20. package/dist/index-browser-all.es.ios.js.map +1 -1
  21. package/dist/index-browser-all.es.js +169 -36
  22. package/dist/index-browser-all.es.js.map +1 -1
  23. package/dist/index-browser-all.es.web.js +73 -35
  24. package/dist/index-browser-all.es.web.js.map +1 -1
  25. package/dist/index-node-14.17.cjs.js +181 -67
  26. package/dist/index-node-14.17.cjs.js.map +1 -1
  27. package/dist/index-node-14.17.cjs.web.js +52 -24
  28. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  29. package/dist/linaria-themes-browser-all.es.android.js +26 -0
  30. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  31. package/dist/linaria-themes-browser-all.es.ios.js +26 -0
  32. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  33. package/dist/linaria-themes-browser-all.es.js +26 -0
  34. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  35. package/dist/linaria-themes-browser-all.es.web.js +27 -0
  36. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  37. package/dist/linaria-themes-node-14.17.cjs.js +25 -0
  38. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  39. package/dist/linaria-themes-node-14.17.cjs.web.js +25 -0
  40. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  41. package/dist/tsbuildinfo +1 -1
  42. package/package.json +8 -3
  43. package/translations/fr-FR.json +2 -1
@@ -5,7 +5,7 @@ export * from '@ornikar/kitt-icons';
5
5
  import { useWindowDimensions, Platform, Image, Linking, Pressable, StyleSheet, ScrollView, Modal as Modal$1, Text as Text$1, TextInput, View, Animated as Animated$1, Easing } from 'react-native';
6
6
  export { useWindowDimensions as useWindowSize } from 'react-native';
7
7
  import styled, { css, useTheme, ThemeProvider } from 'styled-components/native';
8
- import { cloneElement, useContext, createContext, forwardRef, useMemo, useState, useRef, useEffect, Fragment as Fragment$1, Children } from 'react';
8
+ import React, { cloneElement, useContext, createContext, forwardRef, useMemo, useState, useRef, useEffect, Fragment as Fragment$1, Children } from 'react';
9
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
10
  import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring, useAnimatedProps, withDelay, withTiming, Easing as Easing$1, withRepeat, interpolate } from 'react-native-reanimated';
11
11
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
@@ -17,6 +17,7 @@ import { styled as styled$1 } from '@linaria/react';
17
17
  import _extends from '@babel/runtime/helpers/extends';
18
18
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
19
19
  import Svg, { Circle as Circle$1 } from 'react-native-svg';
20
+ import { Picker as Picker$1 } from '@react-native-picker/picker';
20
21
  import { LinearGradient } from 'expo-linear-gradient';
21
22
  import { useFloating, offset, shift, flip } from '@floating-ui/react-native';
22
23
  import { makeDecorator } from '@storybook/addons';
@@ -103,7 +104,7 @@ var KittBreakpointsMax = {
103
104
  LARGE: KittBreakpoints.WIDE - 1
104
105
  };
105
106
 
106
- var _excluded$h = ["accessibilityRole", "base", "small", "medium", "large", "variant", "color"];
107
+ var _excluded$h = ["accessibilityRole", "base", "small", "medium", "large", "variant", "color", "textAlign"];
107
108
  var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
108
109
  var TypographyColorContext = /*#__PURE__*/createContext('black');
109
110
  function useTypographyColor() {
@@ -134,19 +135,23 @@ function getTypographyTypeConfig(type, theme) {
134
135
  }
135
136
  var StyledTypography = /*#__PURE__*/styled.Text.withConfig({
136
137
  displayName: "Typography__StyledTypography"
137
- })(["", " ", ""], function (_ref) {
138
- var theme = _ref.theme,
139
- $isHeader = _ref.$isHeader,
140
- $typeForCurrentWindowSize = _ref.$typeForCurrentWindowSize,
141
- $variant = _ref.$variant;
138
+ })(["", ";", " ", ""], function (_ref) {
139
+ var $textAlign = _ref.$textAlign;
140
+ if (!$textAlign) return undefined;
141
+ return css(["text-align:", ";"], $textAlign);
142
+ }, function (_ref2) {
143
+ var theme = _ref2.theme,
144
+ $isHeader = _ref2.$isHeader,
145
+ $typeForCurrentWindowSize = _ref2.$typeForCurrentWindowSize,
146
+ $variant = _ref2.$variant;
142
147
  var _theme$kitt$typograph = theme.kitt.typography.types,
143
148
  headers = _theme$kitt$typograph.headers,
144
149
  bodies = _theme$kitt$typograph.bodies;
145
150
  var typeConfigKey = getTypographyTypeConfigKey(theme);
146
- return "\n /* type */\n ".concat(!$typeForCurrentWindowSize ? '' : "\n font-family: ".concat($isHeader ? headers.fontFamily[$variant] : bodies.fontFamily[$variant], ";\n font-size: ").concat($isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize, "px;\n line-height: ").concat($isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight, "px;\n "), "\n\n /* variant */\n font-weight: ").concat($isHeader ? headers.fontWeight : bodies.fontWeight[$variant], ";\n font-style: ").concat($isHeader ? headers.fontStyle : bodies.fontStyle[$variant], ";\n ");
147
- }, function (_ref2) {
148
- var theme = _ref2.theme,
149
- $color = _ref2.$color;
151
+ return css(["", " font-weight:", ";font-style:", ";"], !$typeForCurrentWindowSize ? '' : 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]);
152
+ }, function (_ref3) {
153
+ var theme = _ref3.theme,
154
+ $color = _ref3.$color;
150
155
  if (!$color) return '';
151
156
  return css(["color:", ";text-decoration-color:", ";"], theme.kitt.typography.colors[$color], theme.kitt.typography.colors[$color]);
152
157
  });
@@ -159,9 +164,9 @@ function useTypographyTypeForCurrentWindowSize(base, small, medium, large) {
159
164
  if (small && width >= KittBreakpoints.SMALL) return small;
160
165
  return base;
161
166
  }
162
- function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, _ref3) {
163
- var base = _ref3.base,
164
- color = _ref3.color;
167
+ function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, _ref4) {
168
+ var base = _ref4.base,
169
+ color = _ref4.color;
165
170
  // return the props set or undefined. In case of undefined, the value will be inherited from its parents.
166
171
  if (hasTypographyAncestor) return {
167
172
  base: base,
@@ -172,15 +177,16 @@ function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypogr
172
177
  color: color !== null && color !== void 0 ? color : 'black'
173
178
  };
174
179
  }
175
- function Typography(_ref4) {
176
- var accessibilityRole = _ref4.accessibilityRole,
177
- base = _ref4.base,
178
- small = _ref4.small,
179
- medium = _ref4.medium,
180
- large = _ref4.large,
181
- variant = _ref4.variant,
182
- color = _ref4.color,
183
- otherProps = _objectWithoutProperties(_ref4, _excluded$h);
180
+ function Typography(_ref5) {
181
+ var accessibilityRole = _ref5.accessibilityRole,
182
+ base = _ref5.base,
183
+ small = _ref5.small,
184
+ medium = _ref5.medium,
185
+ large = _ref5.large,
186
+ variant = _ref5.variant,
187
+ color = _ref5.color,
188
+ textAlign = _ref5.textAlign,
189
+ otherProps = _objectWithoutProperties(_ref5, _excluded$h);
184
190
 
185
191
  var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
186
192
  var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
@@ -195,21 +201,21 @@ function Typography(_ref4) {
195
201
  var typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(baseOrDefaultToBody, small, medium, large);
196
202
  var isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
197
203
  var nonNullableVariant = variant !== null && variant !== void 0 ? variant : isHeader ? 'bold' : 'regular';
198
- var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
199
- value: isHeader,
200
- children: /*#__PURE__*/jsx(StyledTypography, _objectSpread({
201
- $color: colorOrDefaultToBlack,
202
- $isHeader: isHeader,
203
- $typeForCurrentWindowSize: typeForCurrentWindowSize,
204
- $variant: nonNullableVariant,
205
- accessibilityRole: accessibilityRole || undefined
206
- }, otherProps))
207
- }) : /*#__PURE__*/jsx(StyledTypography, _objectSpread({
204
+
205
+ var sharedProps = _objectSpread({
208
206
  $color: colorOrDefaultToBlack,
209
207
  $isHeader: isHeader,
210
208
  $variant: nonNullableVariant,
211
- accessibilityRole: accessibilityRole || undefined
212
- }, otherProps));
209
+ accessibilityRole: accessibilityRole || undefined,
210
+ $textAlign: textAlign
211
+ }, otherProps);
212
+
213
+ var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
214
+ value: isHeader,
215
+ children: /*#__PURE__*/jsx(StyledTypography, _objectSpread(_objectSpread({}, sharedProps), {}, {
216
+ $typeForCurrentWindowSize: typeForCurrentWindowSize
217
+ }, otherProps))
218
+ }) : /*#__PURE__*/jsx(StyledTypography, _objectSpread({}, sharedProps));
213
219
  return color ? /*#__PURE__*/jsx(TypographyColorContext.Provider, {
214
220
  value: color,
215
221
  children: content
@@ -1363,6 +1369,30 @@ var pageLoader = {
1363
1369
  }
1364
1370
  };
1365
1371
 
1372
+ var picker = {
1373
+ ios: {
1374
+ "default": _objectSpread(_objectSpread({
1375
+ fontFamily: typography.types.bodies.fontFamily.regular
1376
+ }, typography.types.bodies.configs.body.baseAndSmall), {}, {
1377
+ fontSize: 16,
1378
+ color: typography.colors['black-light']
1379
+ }),
1380
+ selected: {
1381
+ color: typography.colors.primary
1382
+ }
1383
+ },
1384
+ android: {
1385
+ padding: '12px 24px',
1386
+ "default": {
1387
+ backgroundColor: colors.transparent
1388
+ },
1389
+ selected: {
1390
+ backgroundColor: colors.primary,
1391
+ color: typography.colors.white
1392
+ }
1393
+ }
1394
+ };
1395
+
1366
1396
  var shadows = {
1367
1397
  medium: '0px 10px 20px rgba(41, 48, 51, 0.25)'
1368
1398
  };
@@ -1462,6 +1492,7 @@ var theme = {
1462
1492
  iconButton: iconButton,
1463
1493
  listItem: listItem,
1464
1494
  pageLoader: pageLoader,
1495
+ picker: picker,
1465
1496
  shadows: shadows,
1466
1497
  skeleton: skeleton,
1467
1498
  tag: tag,
@@ -2628,6 +2659,7 @@ function InputPassword(_ref) {
2628
2659
  autoCorrect: false,
2629
2660
  secureTextEntry: !isVisible,
2630
2661
  right: right || /*#__PURE__*/jsx(InputPressable, {
2662
+ hitSlop: 20,
2631
2663
  accessibilityRole: "button",
2632
2664
  onPress: function onPress() {
2633
2665
  return setIsVisible(function (prev) {
@@ -3500,6 +3532,107 @@ function PageLoader() {
3500
3532
  });
3501
3533
  }
3502
3534
 
3535
+ var ContainerPressable = /*#__PURE__*/styled.Pressable.withConfig({
3536
+ displayName: "PickerItem__ContainerPressable"
3537
+ })(["padding:", ";background-color:", ";"], function (_ref) {
3538
+ var theme = _ref.theme;
3539
+ return theme.kitt.picker.android.padding;
3540
+ }, function (_ref2) {
3541
+ var theme = _ref2.theme,
3542
+ $isSelected = _ref2.$isSelected;
3543
+ return $isSelected ? theme.kitt.picker.android.selected.backgroundColor : theme.kitt.picker.android["default"].backgroundColor;
3544
+ }); // This item is for Android only, iOS uses its own implementation and web is not supported yet
3545
+
3546
+ function PickerItem(_ref3) {
3547
+ var label = _ref3.label,
3548
+ value = _ref3.value,
3549
+ isSelected = _ref3.isSelected,
3550
+ onPress = _ref3.onPress;
3551
+ return /*#__PURE__*/jsx(ContainerPressable, {
3552
+ accessibilityRole: "button",
3553
+ accessibilityState: {
3554
+ selected: isSelected
3555
+ },
3556
+ $isSelected: isSelected,
3557
+ onPress: onPress ? function () {
3558
+ return onPress(value);
3559
+ } : undefined,
3560
+ children: /*#__PURE__*/jsx(Typography.Text, {
3561
+ base: "body",
3562
+ color: isSelected ? 'white' : undefined,
3563
+ children: label
3564
+ })
3565
+ });
3566
+ }
3567
+
3568
+ function Picker(_ref) {
3569
+ var children = _ref.children,
3570
+ isVisible = _ref.isVisible,
3571
+ title = _ref.title,
3572
+ initialValue = _ref.initialValue,
3573
+ validateButtonLabel = _ref.validateButtonLabel,
3574
+ testID = _ref.testID,
3575
+ onValueSelected = _ref.onValueSelected,
3576
+ onClose = _ref.onClose;
3577
+
3578
+ var _useState = useState(initialValue),
3579
+ _useState2 = _slicedToArray(_useState, 2),
3580
+ value = _useState2[0],
3581
+ setValue = _useState2[1];
3582
+
3583
+ return /*#__PURE__*/jsxs(Modal, {
3584
+ visible: isVisible,
3585
+ onClose: onClose,
3586
+ children: [/*#__PURE__*/jsx(Modal.Header, {
3587
+ children: /*#__PURE__*/jsx(Typography.Text, {
3588
+ base: "body",
3589
+ variant: "bold",
3590
+ children: title
3591
+ })
3592
+ }), /*#__PURE__*/jsx(View, {
3593
+ children: Platform.OS === 'ios' ? /*#__PURE__*/jsx(Picker$1, {
3594
+ testID: testID,
3595
+ selectedValue: value,
3596
+ itemStyle: theme.picker.ios["default"],
3597
+ onValueChange: function onValueChange(itemValue) {
3598
+ return setValue(itemValue);
3599
+ },
3600
+ children: React.Children.map(children, function (child) {
3601
+ var item = child; // iOS Picker doesn't support a custom Item component, we need to override its props manually for the selected one
3602
+
3603
+ return /*#__PURE__*/cloneElement(item, {
3604
+ color: item.props.value === value ? theme.picker.ios.selected.color : undefined
3605
+ });
3606
+ })
3607
+ }) : /*#__PURE__*/jsx(ScrollView, {
3608
+ testID: testID,
3609
+ children: React.Children.map(children, function (child) {
3610
+ var item = child;
3611
+ return /*#__PURE__*/cloneElement(item, {
3612
+ onPress: function onPress(newValue) {
3613
+ return setValue(newValue);
3614
+ },
3615
+ isSelected: item.props.value === value
3616
+ });
3617
+ })
3618
+ })
3619
+ }), /*#__PURE__*/jsx(Modal.Footer, {
3620
+ children: /*#__PURE__*/jsx(Button, {
3621
+ stretch: true,
3622
+ type: "primary",
3623
+ onPress: function handleValueSelected() {
3624
+ onValueSelected(value);
3625
+ onClose();
3626
+ },
3627
+ children: validateButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
3628
+ id: "kitt-universal.Picker.validate"
3629
+ })
3630
+ })
3631
+ })]
3632
+ });
3633
+ }
3634
+ Picker.Item = PickerItem;
3635
+
3503
3636
  var Container$2 = /*#__PURE__*/styled.View.withConfig({
3504
3637
  displayName: "SkeletonContent__Container"
3505
3638
  })(["background-color:", ";border-color:", ";height:100%;width:100%;"], function (_ref) {
@@ -4472,5 +4605,5 @@ function MatchWindowSize(_ref) {
4472
4605
  return children;
4473
4606
  }
4474
4607
 
4475
- export { Avatar, Button, Card, Checkbox, DatePicker, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MatchWindowSize, Message, Modal, Notification, Overlay, PageLoader, Radio, DeprecatedSection as Section, Skeleton, SpinningIcon, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor, withTheme };
4608
+ export { Avatar, Button, Card, Checkbox, DatePicker, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MatchWindowSize, Message, Modal, Notification, Overlay, PageLoader, Picker, Radio, DeprecatedSection as Section, Skeleton, SpinningIcon, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor, withTheme };
4476
4609
  //# sourceMappingURL=index-browser-all.es.js.map