@ornikar/kitt-universal 23.2.7 → 23.4.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 (58) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/definitions/BottomSheet/useStaticBottomSheet.d.ts +3 -3
  3. package/dist/definitions/BottomSheet/useStaticBottomSheet.d.ts.map +1 -1
  4. package/dist/definitions/Tag/Tag.d.ts +10 -6
  5. package/dist/definitions/Tag/Tag.d.ts.map +1 -1
  6. package/dist/definitions/forms/DocumentPicker/DocumentPicker.d.ts +15 -0
  7. package/dist/definitions/forms/DocumentPicker/DocumentPicker.d.ts.map +1 -0
  8. package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActions.d.ts +13 -0
  9. package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActions.d.ts.map +1 -0
  10. package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActionsItem.d.ts +7 -0
  11. package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActionsItem.d.ts.map +1 -0
  12. package/dist/definitions/forms/FilePicker/FilePicker.d.ts +17 -0
  13. package/dist/definitions/forms/FilePicker/FilePicker.d.ts.map +1 -0
  14. package/dist/definitions/forms/FilePicker/FilePicker.web.d.ts +4 -0
  15. package/dist/definitions/forms/FilePicker/FilePicker.web.d.ts.map +1 -0
  16. package/dist/definitions/forms/ImagePicker/ImagePicker.d.ts +15 -0
  17. package/dist/definitions/forms/ImagePicker/ImagePicker.d.ts.map +1 -0
  18. package/dist/definitions/index.d.ts +7 -2
  19. package/dist/definitions/index.d.ts.map +1 -1
  20. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +43 -78
  21. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  22. package/dist/definitions/themes/late-ocean/tag.d.ts +22 -14
  23. package/dist/definitions/themes/late-ocean/tag.d.ts.map +1 -1
  24. package/dist/index-metro.es.android.js +463 -319
  25. package/dist/index-metro.es.android.js.map +1 -1
  26. package/dist/index-metro.es.ios.js +463 -319
  27. package/dist/index-metro.es.ios.js.map +1 -1
  28. package/dist/index-node-20.10.cjs.js +383 -238
  29. package/dist/index-node-20.10.cjs.js.map +1 -1
  30. package/dist/index-node-20.10.cjs.web.js +214 -155
  31. package/dist/index-node-20.10.cjs.web.js.map +1 -1
  32. package/dist/index-node-20.10.es.mjs +383 -241
  33. package/dist/index-node-20.10.es.mjs.map +1 -1
  34. package/dist/index-node-20.10.es.web.mjs +212 -156
  35. package/dist/index-node-20.10.es.web.mjs.map +1 -1
  36. package/dist/index.es.js +496 -314
  37. package/dist/index.es.js.map +1 -1
  38. package/dist/index.es.web.js +257 -157
  39. package/dist/index.es.web.js.map +1 -1
  40. package/dist/linaria-themes-metro.es.android.js +38 -44
  41. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  42. package/dist/linaria-themes-metro.es.ios.js +38 -44
  43. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  44. package/dist/linaria-themes-node-20.10.cjs.js +38 -44
  45. package/dist/linaria-themes-node-20.10.cjs.js.map +1 -1
  46. package/dist/linaria-themes-node-20.10.cjs.web.js +38 -44
  47. package/dist/linaria-themes-node-20.10.cjs.web.js.map +1 -1
  48. package/dist/linaria-themes-node-20.10.es.mjs +38 -44
  49. package/dist/linaria-themes-node-20.10.es.mjs.map +1 -1
  50. package/dist/linaria-themes-node-20.10.es.web.mjs +38 -44
  51. package/dist/linaria-themes-node-20.10.es.web.mjs.map +1 -1
  52. package/dist/linaria-themes.es.js +38 -44
  53. package/dist/linaria-themes.es.js.map +1 -1
  54. package/dist/linaria-themes.es.web.js +38 -44
  55. package/dist/linaria-themes.es.web.js.map +1 -1
  56. package/dist/tsbuildinfo +1 -1
  57. package/package.json +5 -2
  58. package/translations/fr-FR.json +2 -0
@@ -12,6 +12,8 @@ const reactNative = require('react-native');
12
12
  const twemojiParser = require('twemoji-parser');
13
13
  const phosphor = require('@ornikar/kitt-icons/phosphor');
14
14
  const Downshift = require('downshift');
15
+ const expoDocumentPicker = require('expo-document-picker');
16
+ const expoImagePicker = require('expo-image-picker');
15
17
  const useDebounce = require('use-debounce');
16
18
  const jsApiLoader = require('@googlemaps/js-api-loader');
17
19
  const libphonenumberJs = require('libphonenumber-js');
@@ -1636,57 +1638,51 @@ const skeleton$1 = {
1636
1638
  };
1637
1639
 
1638
1640
  const tag = {
1639
- borderRadius: 10,
1640
- padding: '2px 12px',
1641
- verticalPadding: 2,
1642
- horizontalPadding: 12,
1643
- primary: {
1644
- fill: {
1645
- backgroundColor: lateOceanColorPalette.moonPurpleLight1,
1646
- borderWidth: 0,
1647
- borderColor: colors.transparent
1648
- },
1649
- outline: {
1650
- backgroundColor: colors.transparent,
1651
- borderWidth: 1,
1652
- borderColor: colors.primary
1653
- }
1641
+ borderRadius: 16,
1642
+ icon: {
1643
+ small: 16,
1644
+ medium: 16,
1645
+ large: 20
1654
1646
  },
1655
- default: {
1656
- fill: {
1657
- backgroundColor: lateOceanColorPalette.black50,
1658
- borderWidth: 0,
1659
- borderColor: colors.transparent
1647
+ withIcon: {
1648
+ small: {
1649
+ paddingLeft: 2,
1650
+ paddingRight: 8,
1651
+ height: 20
1660
1652
  },
1661
- outline: {
1662
- backgroundColor: colors.transparent,
1663
- borderWidth: 1,
1664
- borderColor: colors.black
1665
- }
1666
- },
1667
- danger: {
1668
- fill: {
1669
- backgroundColor: colors.danger,
1670
- borderWidth: 0,
1671
- borderColor: colors.transparent
1653
+ medium: {
1654
+ paddingLeft: 4,
1655
+ paddingRight: 8,
1656
+ height: 24
1672
1657
  },
1673
- outline: {
1674
- backgroundColor: colors.transparent,
1675
- borderWidth: 1,
1676
- borderColor: colors.danger
1658
+ large: {
1659
+ paddingLeft: 6,
1660
+ paddingRight: 8,
1661
+ height: 32
1677
1662
  }
1678
1663
  },
1679
- warn: {
1680
- fill: {
1681
- backgroundColor: colors.warning,
1682
- borderWidth: 0,
1683
- borderColor: colors.transparent
1664
+ withoutIcon: {
1665
+ small: {
1666
+ paddingLeft: 8,
1667
+ paddingRight: 8,
1668
+ height: 20
1684
1669
  },
1685
- outline: {
1686
- backgroundColor: colors.transparent,
1687
- borderWidth: 1,
1688
- borderColor: colors.warning
1670
+ medium: {
1671
+ paddingLeft: 8,
1672
+ paddingRight: 8,
1673
+ height: 22
1674
+ },
1675
+ large: {
1676
+ paddingLeft: 8,
1677
+ paddingRight: 8,
1678
+ height: 28
1689
1679
  }
1680
+ },
1681
+ fill: {
1682
+ borderWidth: 0
1683
+ },
1684
+ outline: {
1685
+ borderWidth: 1
1690
1686
  }
1691
1687
  };
1692
1688
 
@@ -4754,6 +4750,63 @@ const DatePicker = /*#__PURE__*/react.forwardRef(({
4754
4750
  });
4755
4751
  });
4756
4752
 
4753
+ function DocumentPicker({
4754
+ onDocumentUpload,
4755
+ children,
4756
+ disabled,
4757
+ documentPickerOptions
4758
+ }) {
4759
+ const childElement = react.Children.only(children);
4760
+ return /*#__PURE__*/react.cloneElement(childElement, {
4761
+ // ensure that the press event is not prevented by Button component
4762
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
4763
+ onPress: async () => {
4764
+ if (disabled) return;
4765
+ childElement.props.onPress?.();
4766
+ const result = await expoDocumentPicker.getDocumentAsync({
4767
+ ...documentPickerOptions,
4768
+ multiple: false
4769
+ });
4770
+ if (!result.canceled && result.assets[0].file) {
4771
+ onDocumentUpload(result.assets[0].file);
4772
+ }
4773
+ },
4774
+ disabled
4775
+ });
4776
+ }
4777
+
4778
+ function FilePicker() {
4779
+ throw new Error('FilePicker only works on native');
4780
+ }
4781
+
4782
+ function ImagePicker({
4783
+ onImageSelected,
4784
+ children,
4785
+ disabled,
4786
+ imagePickerOptions
4787
+ }) {
4788
+ const childElement = react.Children.only(children);
4789
+ return /*#__PURE__*/jsxRuntime.jsx(View, {
4790
+ children: /*#__PURE__*/react.cloneElement(childElement, {
4791
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
4792
+ onPress: async () => {
4793
+ if (disabled) return;
4794
+ childElement.props.onPress?.();
4795
+
4796
+ // No permissions request is necessary for launching the image library
4797
+ const result = await expoImagePicker.launchImageLibraryAsync({
4798
+ ...imagePickerOptions,
4799
+ allowsMultipleSelection: false
4800
+ });
4801
+ if (!result.canceled) {
4802
+ onImageSelected(result.assets[0]);
4803
+ }
4804
+ },
4805
+ disabled
4806
+ })
4807
+ });
4808
+ }
4809
+
4757
4810
  const GoogleMapsApiKeyContext = /*#__PURE__*/react.createContext(undefined);
4758
4811
  function GoogleMapsApiKeyProvider({
4759
4812
  children,
@@ -7065,48 +7118,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
7065
7118
  }
7066
7119
  }
7067
7120
  },
7068
- tag: {
7069
- primary: {
7070
- fill: {
7071
- backgroundColor: theme.tag.primary.fill.backgroundColor,
7072
- borderColor: theme.tag.primary.fill.borderColor
7073
- },
7074
- outline: {
7075
- backgroundColor: theme.tag.primary.outline.backgroundColor,
7076
- borderColor: theme.tag.primary.outline.borderColor
7077
- }
7078
- },
7079
- default: {
7080
- fill: {
7081
- backgroundColor: theme.tag.default.fill.backgroundColor,
7082
- borderColor: theme.tag.default.fill.borderColor
7083
- },
7084
- outline: {
7085
- backgroundColor: theme.tag.default.outline.backgroundColor,
7086
- borderColor: theme.tag.default.outline.borderColor
7087
- }
7088
- },
7089
- danger: {
7090
- fill: {
7091
- backgroundColor: theme.tag.danger.fill.backgroundColor,
7092
- borderColor: theme.tag.danger.fill.borderColor
7093
- },
7094
- outline: {
7095
- backgroundColor: theme.tag.danger.outline.backgroundColor,
7096
- borderColor: theme.tag.danger.outline.borderColor
7097
- }
7098
- },
7099
- warn: {
7100
- fill: {
7101
- backgroundColor: theme.tag.warn.fill.backgroundColor,
7102
- borderColor: theme.tag.warn.fill.borderColor
7103
- },
7104
- outline: {
7105
- backgroundColor: theme.tag.warn.outline.backgroundColor,
7106
- borderColor: theme.tag.warn.outline.borderColor
7107
- }
7108
- }
7109
- },
7110
7121
  tooltip: {
7111
7122
  backgroundColor: theme.tooltip.backgroundColor
7112
7123
  },
@@ -7595,37 +7606,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
7595
7606
  borderWidth: theme.listItem.borderWidth
7596
7607
  },
7597
7608
  tag: {
7598
- primary: {
7599
- fill: {
7600
- borderWidth: theme.tag.primary.fill.borderWidth
7601
- },
7602
- outline: {
7603
- borderWidth: theme.tag.primary.outline.borderWidth
7604
- }
7605
- },
7606
- default: {
7607
- fill: {
7608
- borderWidth: theme.tag.default.fill.borderWidth
7609
- },
7610
- outline: {
7611
- borderWidth: theme.tag.default.outline.borderWidth
7612
- }
7613
- },
7614
- danger: {
7615
- fill: {
7616
- borderWidth: theme.tag.danger.fill.borderWidth
7617
- },
7618
- outline: {
7619
- borderWidth: theme.tag.danger.outline.borderWidth
7620
- }
7609
+ fill: {
7610
+ borderWidth: theme.tag.fill.borderWidth
7621
7611
  },
7622
- warn: {
7623
- fill: {
7624
- borderWidth: theme.tag.warn.fill.borderWidth
7625
- },
7626
- outline: {
7627
- borderWidth: theme.tag.warn.outline.borderWidth
7628
- }
7612
+ outline: {
7613
+ borderWidth: theme.tag.outline.borderWidth
7629
7614
  }
7630
7615
  }
7631
7616
  },
@@ -7723,6 +7708,39 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
7723
7708
  pageLoader: {
7724
7709
  size: theme.pageLoader.size
7725
7710
  },
7711
+ tag: {
7712
+ small: {
7713
+ iconSize: theme.tag.icon.small
7714
+ },
7715
+ medium: {
7716
+ iconSize: theme.tag.icon.medium
7717
+ },
7718
+ large: {
7719
+ iconSize: theme.tag.icon.large
7720
+ },
7721
+ withIcon: {
7722
+ small: {
7723
+ height: theme.tag.withIcon.small.height
7724
+ },
7725
+ medium: {
7726
+ height: theme.tag.withIcon.medium.height
7727
+ },
7728
+ large: {
7729
+ height: theme.tag.withIcon.large.height
7730
+ }
7731
+ },
7732
+ withoutIcon: {
7733
+ small: {
7734
+ height: theme.tag.withoutIcon.small.height
7735
+ },
7736
+ medium: {
7737
+ height: theme.tag.withoutIcon.medium.height
7738
+ },
7739
+ large: {
7740
+ height: theme.tag.withoutIcon.large.height
7741
+ }
7742
+ }
7743
+ },
7726
7744
  tooltip: {
7727
7745
  maxWidth: theme.tooltip.maxWidth,
7728
7746
  arrow: {
@@ -7815,8 +7833,34 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
7815
7833
  horizontalPadding: theme.listItem.horizontalPadding
7816
7834
  },
7817
7835
  tag: {
7818
- verticalPadding: theme.tag.verticalPadding,
7819
- horizontalPadding: theme.tag.horizontalPadding
7836
+ withoutIcon: {
7837
+ small: {
7838
+ paddingLeft: theme.tag.withoutIcon.small.paddingLeft,
7839
+ paddingRight: theme.tag.withoutIcon.small.paddingRight
7840
+ },
7841
+ medium: {
7842
+ paddingLeft: theme.tag.withoutIcon.medium.paddingLeft,
7843
+ paddingRight: theme.tag.withoutIcon.medium.paddingRight
7844
+ },
7845
+ large: {
7846
+ paddingLeft: theme.tag.withoutIcon.large.paddingLeft,
7847
+ paddingRight: theme.tag.withoutIcon.large.paddingRight
7848
+ }
7849
+ },
7850
+ withIcon: {
7851
+ small: {
7852
+ paddingLeft: theme.tag.withIcon.small.paddingLeft,
7853
+ paddingRight: theme.tag.withIcon.small.paddingRight
7854
+ },
7855
+ medium: {
7856
+ paddingLeft: theme.tag.withIcon.medium.paddingLeft,
7857
+ paddingRight: theme.tag.withIcon.medium.paddingRight
7858
+ },
7859
+ large: {
7860
+ paddingLeft: theme.tag.withIcon.large.paddingLeft,
7861
+ paddingRight: theme.tag.withIcon.large.paddingRight
7862
+ }
7863
+ }
7820
7864
  },
7821
7865
  tooltip: {
7822
7866
  horizontalPadding: theme.tooltip.horizontalPadding,
@@ -9746,48 +9790,68 @@ const StoryGrid = {
9746
9790
  Col: StoryGridCol
9747
9791
  };
9748
9792
 
9749
- const getLabelColor = (type, variant) => {
9793
+ function useKittTheme() {
9794
+ return react.useMemo(() => {
9795
+ return {
9796
+ kitt: theme
9797
+ };
9798
+ }, []);
9799
+ }
9800
+
9801
+ const getTypography = size => {
9802
+ switch (size) {
9803
+ case 'small':
9804
+ return 'body-xs';
9805
+ case 'medium':
9806
+ return 'body-s';
9807
+ case 'large':
9808
+ default:
9809
+ return 'body-m';
9810
+ }
9811
+ };
9812
+ const typeToColor = (color, type) => {
9813
+ if (color) return color;
9750
9814
  switch (type) {
9751
- case 'danger':
9752
- {
9753
- return variant === 'outline' ? 'danger' : 'black';
9754
- }
9755
- case 'warn':
9756
- {
9757
- return variant === 'outline' ? 'warning' : 'black';
9758
- }
9759
9815
  case 'primary':
9760
- {
9761
- return 'primary';
9762
- }
9816
+ return 'violine';
9817
+ case 'warn':
9818
+ return 'sun';
9819
+ case 'danger':
9820
+ return 'coral';
9763
9821
  case 'default':
9764
- {
9765
- return 'black';
9766
- }
9767
9822
  default:
9768
- {
9769
- return 'black';
9770
- }
9823
+ return 'eggshell';
9771
9824
  }
9772
9825
  };
9773
9826
  function Tag({
9774
9827
  label,
9775
- type = 'default',
9828
+ icon,
9829
+ color,
9830
+ type,
9831
+ size = 'medium',
9776
9832
  variant = 'fill'
9777
9833
  }) {
9778
- return /*#__PURE__*/jsxRuntime.jsx(View, {
9834
+ const kittTheme = useKittTheme();
9835
+ const tagColor = typeToColor(color, type);
9836
+ return /*#__PURE__*/jsxRuntime.jsxs(HStack, {
9779
9837
  alignSelf: "flex-start",
9780
9838
  borderRadius: "kitt.tag.borderRadius",
9781
- paddingX: "kitt.tag.horizontalPadding",
9782
- paddingY: "kitt.tag.verticalPadding",
9783
- backgroundColor: `kitt.tag.${type}.${variant}.backgroundColor`,
9784
- borderColor: `kitt.tag.${type}.${variant}.borderColor`,
9785
- borderWidth: `kitt.tag.${type}.${variant}.borderWidth`,
9786
- children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
9787
- base: "body-xsmall",
9788
- color: getLabelColor(type, variant),
9839
+ height: `kitt.tag.${icon ? 'withIcon' : 'withoutIcon'}.${size}.height`,
9840
+ paddingLeft: `kitt.tag.${icon ? 'withIcon' : 'withoutIcon'}.${size}.paddingLeft`,
9841
+ paddingRight: `kitt.tag.${icon ? 'withIcon' : 'withoutIcon'}.${size}.paddingRight`,
9842
+ backgroundColor: variant === 'fill' ? kittTheme.kitt.palettes.lateOcean[`${tagColor}.4`] : 'kitt.transparent',
9843
+ borderColor: kittTheme.kitt.palettes.lateOcean[`${tagColor}.6`],
9844
+ borderWidth: `kitt.tag.${variant}.borderWidth`,
9845
+ space: "kitt.1",
9846
+ alignItems: "center",
9847
+ children: [icon ? /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
9848
+ icon: icon,
9849
+ size: `kitt.tag.${size}.iconSize`
9850
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
9851
+ base: getTypography(size),
9852
+ color: "black",
9789
9853
  children: label
9790
- })
9854
+ })]
9791
9855
  });
9792
9856
  }
9793
9857
 
@@ -10325,14 +10389,6 @@ function TypographyLink({
10325
10389
  });
10326
10390
  }
10327
10391
 
10328
- function useKittTheme() {
10329
- return react.useMemo(() => {
10330
- return {
10331
- kitt: theme
10332
- };
10333
- }, []);
10334
- }
10335
-
10336
10392
  function KittThemeProvider({
10337
10393
  isSSR,
10338
10394
  children,
@@ -10577,9 +10633,11 @@ exports.ChoicesElements = ChoicesElements;
10577
10633
  exports.CloseIconButton = CloseIconButton;
10578
10634
  exports.DatePicker = DatePicker;
10579
10635
  exports.DialogModal = DialogModal;
10636
+ exports.DocumentPicker = DocumentPicker;
10580
10637
  exports.Emoji = Emoji;
10581
10638
  exports.ExternalAppLink = ExternalAppLink;
10582
10639
  exports.ExternalLink = ExternalLink;
10640
+ exports.FilePicker = FilePicker;
10583
10641
  exports.FlatList = FlatList;
10584
10642
  exports.Flex = Flex;
10585
10643
  exports.FullscreenModal = FullscreenModal;
@@ -10590,6 +10648,7 @@ exports.Highlight = Highlight;
10590
10648
  exports.Icon = Icon;
10591
10649
  exports.IconButton = IconButton;
10592
10650
  exports.Image = Image;
10651
+ exports.ImagePicker = ImagePicker;
10593
10652
  exports.InputAddress = InputAddress;
10594
10653
  exports.InputEmail = InputEmail;
10595
10654
  exports.InputFeedback = InputFeedback;