@ornikar/kitt-universal 23.3.0 → 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.
- package/CHANGELOG.md +9 -0
- package/dist/definitions/BottomSheet/useStaticBottomSheet.d.ts +3 -3
- package/dist/definitions/BottomSheet/useStaticBottomSheet.d.ts.map +1 -1
- package/dist/definitions/forms/DocumentPicker/DocumentPicker.d.ts +15 -0
- package/dist/definitions/forms/DocumentPicker/DocumentPicker.d.ts.map +1 -0
- package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActions.d.ts +13 -0
- package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActions.d.ts.map +1 -0
- package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActionsItem.d.ts +7 -0
- package/dist/definitions/forms/FilePicker/BottomSheetActions/BottomSheetActionsItem.d.ts.map +1 -0
- package/dist/definitions/forms/FilePicker/FilePicker.d.ts +17 -0
- package/dist/definitions/forms/FilePicker/FilePicker.d.ts.map +1 -0
- package/dist/definitions/forms/FilePicker/FilePicker.web.d.ts +4 -0
- package/dist/definitions/forms/FilePicker/FilePicker.web.d.ts.map +1 -0
- package/dist/definitions/forms/ImagePicker/ImagePicker.d.ts +15 -0
- package/dist/definitions/forms/ImagePicker/ImagePicker.d.ts.map +1 -0
- package/dist/definitions/index.d.ts +7 -2
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +311 -164
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +311 -164
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-20.10.cjs.js +231 -83
- package/dist/index-node-20.10.cjs.js.map +1 -1
- package/dist/index-node-20.10.cjs.web.js +62 -0
- package/dist/index-node-20.10.cjs.web.js.map +1 -1
- package/dist/index-node-20.10.es.mjs +231 -86
- package/dist/index-node-20.10.es.mjs.map +1 -1
- package/dist/index-node-20.10.es.web.mjs +60 -1
- package/dist/index-node-20.10.es.web.mjs.map +1 -1
- package/dist/index.es.js +343 -158
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +104 -1
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +4 -1
- package/translations/fr-FR.json +2 -0
|
@@ -16,6 +16,8 @@ const phosphor = require('@ornikar/kitt-icons/phosphor');
|
|
|
16
16
|
const Downshift = require('downshift');
|
|
17
17
|
const DateTimePicker = require('@react-native-community/datetimepicker');
|
|
18
18
|
const reactIntl = require('react-intl');
|
|
19
|
+
const expoDocumentPicker = require('expo-document-picker');
|
|
20
|
+
const expoImagePicker = require('expo-image-picker');
|
|
19
21
|
const useDebounce = require('use-debounce');
|
|
20
22
|
const libphonenumberJs = require('libphonenumber-js');
|
|
21
23
|
const Svg = require('react-native-svg');
|
|
@@ -5330,6 +5332,232 @@ const DatePicker = /*#__PURE__*/React.forwardRef(({
|
|
|
5330
5332
|
});
|
|
5331
5333
|
});
|
|
5332
5334
|
|
|
5335
|
+
function DocumentPicker({
|
|
5336
|
+
onDocumentUpload,
|
|
5337
|
+
children,
|
|
5338
|
+
disabled,
|
|
5339
|
+
documentPickerOptions
|
|
5340
|
+
}) {
|
|
5341
|
+
const childElement = React.Children.only(children);
|
|
5342
|
+
return /*#__PURE__*/React.cloneElement(childElement, {
|
|
5343
|
+
// ensure that the press event is not prevented by Button component
|
|
5344
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
5345
|
+
onPress: async () => {
|
|
5346
|
+
if (disabled) return;
|
|
5347
|
+
childElement.props.onPress?.();
|
|
5348
|
+
const result = await expoDocumentPicker.getDocumentAsync({
|
|
5349
|
+
...documentPickerOptions,
|
|
5350
|
+
multiple: false
|
|
5351
|
+
});
|
|
5352
|
+
if (!result.canceled && result.assets[0].file) {
|
|
5353
|
+
onDocumentUpload(result.assets[0].file);
|
|
5354
|
+
}
|
|
5355
|
+
},
|
|
5356
|
+
disabled
|
|
5357
|
+
});
|
|
5358
|
+
}
|
|
5359
|
+
|
|
5360
|
+
function ImagePicker({
|
|
5361
|
+
onImageSelected,
|
|
5362
|
+
children,
|
|
5363
|
+
disabled,
|
|
5364
|
+
imagePickerOptions
|
|
5365
|
+
}) {
|
|
5366
|
+
const childElement = React.Children.only(children);
|
|
5367
|
+
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
5368
|
+
children: /*#__PURE__*/React.cloneElement(childElement, {
|
|
5369
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
5370
|
+
onPress: async () => {
|
|
5371
|
+
if (disabled) return;
|
|
5372
|
+
childElement.props.onPress?.();
|
|
5373
|
+
|
|
5374
|
+
// No permissions request is necessary for launching the image library
|
|
5375
|
+
const result = await expoImagePicker.launchImageLibraryAsync({
|
|
5376
|
+
...imagePickerOptions,
|
|
5377
|
+
allowsMultipleSelection: false
|
|
5378
|
+
});
|
|
5379
|
+
if (!result.canceled) {
|
|
5380
|
+
onImageSelected(result.assets[0]);
|
|
5381
|
+
}
|
|
5382
|
+
},
|
|
5383
|
+
disabled
|
|
5384
|
+
})
|
|
5385
|
+
});
|
|
5386
|
+
}
|
|
5387
|
+
|
|
5388
|
+
function ListItemContent({
|
|
5389
|
+
children,
|
|
5390
|
+
...rest
|
|
5391
|
+
}) {
|
|
5392
|
+
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
5393
|
+
alignSelf: "center",
|
|
5394
|
+
flexBasis: "0%",
|
|
5395
|
+
flexGrow: 1,
|
|
5396
|
+
flexShrink: 0,
|
|
5397
|
+
...rest,
|
|
5398
|
+
children: children
|
|
5399
|
+
});
|
|
5400
|
+
}
|
|
5401
|
+
|
|
5402
|
+
// Handles the vertical alignment of the side elements of the list item
|
|
5403
|
+
function ListItemSideContainer({
|
|
5404
|
+
children,
|
|
5405
|
+
side = 'left',
|
|
5406
|
+
...rest
|
|
5407
|
+
}) {
|
|
5408
|
+
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
5409
|
+
flexDirection: "row",
|
|
5410
|
+
marginLeft: side === 'right' ? 'kitt.2' : undefined,
|
|
5411
|
+
marginRight: side === 'left' ? 'kitt.2' : undefined,
|
|
5412
|
+
...rest,
|
|
5413
|
+
children: children
|
|
5414
|
+
});
|
|
5415
|
+
}
|
|
5416
|
+
function ListItemSideContent({
|
|
5417
|
+
children,
|
|
5418
|
+
align = 'auto',
|
|
5419
|
+
...rest
|
|
5420
|
+
}) {
|
|
5421
|
+
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
5422
|
+
alignSelf: align,
|
|
5423
|
+
...rest,
|
|
5424
|
+
children: children
|
|
5425
|
+
});
|
|
5426
|
+
}
|
|
5427
|
+
|
|
5428
|
+
function ListItem({
|
|
5429
|
+
children,
|
|
5430
|
+
withPadding,
|
|
5431
|
+
borders,
|
|
5432
|
+
left,
|
|
5433
|
+
right,
|
|
5434
|
+
onPress,
|
|
5435
|
+
...rest
|
|
5436
|
+
}) {
|
|
5437
|
+
const Wrapper = onPress ? reactNative.Pressable : React.Fragment;
|
|
5438
|
+
const wrapperProps = onPress ? {
|
|
5439
|
+
accessibilityRole: 'button',
|
|
5440
|
+
onPress,
|
|
5441
|
+
...rest
|
|
5442
|
+
} : undefined;
|
|
5443
|
+
const containerProps = onPress ? undefined : rest;
|
|
5444
|
+
return /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
|
|
5445
|
+
...wrapperProps,
|
|
5446
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(View, {
|
|
5447
|
+
flexDirection: "row",
|
|
5448
|
+
paddingX: withPadding ? 'kitt.listItem.horizontalPadding' : undefined,
|
|
5449
|
+
paddingY: withPadding ? 'kitt.listItem.verticalPadding' : undefined,
|
|
5450
|
+
borderColor: "kitt.listItem.borderColor",
|
|
5451
|
+
backgroundColor: "kitt.uiBackgroundLight",
|
|
5452
|
+
borderTopWidth: borders === 'top' || borders === 'both' ? 'kitt.listItem.borderWidth' : undefined,
|
|
5453
|
+
borderBottomWidth: borders === 'bottom' || borders === 'both' ? 'kitt.listItem.borderWidth' : undefined,
|
|
5454
|
+
...containerProps,
|
|
5455
|
+
children: [left ? /*#__PURE__*/jsxRuntime.jsx(ListItemSideContainer, {
|
|
5456
|
+
side: "left",
|
|
5457
|
+
children: left
|
|
5458
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(ListItemContent, {
|
|
5459
|
+
children: children
|
|
5460
|
+
}), right ? /*#__PURE__*/jsxRuntime.jsx(ListItemSideContainer, {
|
|
5461
|
+
side: "right",
|
|
5462
|
+
children: right
|
|
5463
|
+
}) : null]
|
|
5464
|
+
})
|
|
5465
|
+
});
|
|
5466
|
+
}
|
|
5467
|
+
ListItem.Content = ListItemContent;
|
|
5468
|
+
ListItem.SideContent = ListItemSideContent;
|
|
5469
|
+
ListItem.SideContainer = ListItemSideContainer;
|
|
5470
|
+
|
|
5471
|
+
function BottomSheetActionsItem({
|
|
5472
|
+
title,
|
|
5473
|
+
...props
|
|
5474
|
+
}) {
|
|
5475
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.Pressable, {
|
|
5476
|
+
...props,
|
|
5477
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ListItem, {
|
|
5478
|
+
withPadding: true,
|
|
5479
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
5480
|
+
variant: "bold",
|
|
5481
|
+
base: "body",
|
|
5482
|
+
children: title
|
|
5483
|
+
})
|
|
5484
|
+
})
|
|
5485
|
+
});
|
|
5486
|
+
}
|
|
5487
|
+
|
|
5488
|
+
function BottomSheetActions({
|
|
5489
|
+
onBottomSheetActionsChange,
|
|
5490
|
+
imagePickerOptions,
|
|
5491
|
+
documentPickerOptions,
|
|
5492
|
+
disabled
|
|
5493
|
+
}) {
|
|
5494
|
+
const isPlatformIOS = reactNative.Platform.OS === 'ios';
|
|
5495
|
+
return /*#__PURE__*/jsxRuntime.jsxs(VStack, {
|
|
5496
|
+
marginBottom: "kitt.8",
|
|
5497
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ImagePicker, {
|
|
5498
|
+
imagePickerOptions: imagePickerOptions,
|
|
5499
|
+
disabled: disabled,
|
|
5500
|
+
onImageSelected: onBottomSheetActionsChange,
|
|
5501
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BottomSheetActionsItem, {
|
|
5502
|
+
title: /*#__PURE__*/jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
5503
|
+
id: "account.BottomSheetActions.openLibrary",
|
|
5504
|
+
values: {
|
|
5505
|
+
isPlatformIOS
|
|
5506
|
+
}
|
|
5507
|
+
})
|
|
5508
|
+
})
|
|
5509
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DocumentPicker, {
|
|
5510
|
+
disabled: disabled,
|
|
5511
|
+
documentPickerOptions: documentPickerOptions,
|
|
5512
|
+
onDocumentUpload: onBottomSheetActionsChange,
|
|
5513
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BottomSheetActionsItem, {
|
|
5514
|
+
title: /*#__PURE__*/jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
5515
|
+
id: "account.BottomSheetActions.openFileExplorer",
|
|
5516
|
+
values: {
|
|
5517
|
+
isPlatformIOS
|
|
5518
|
+
}
|
|
5519
|
+
})
|
|
5520
|
+
})
|
|
5521
|
+
})]
|
|
5522
|
+
});
|
|
5523
|
+
}
|
|
5524
|
+
|
|
5525
|
+
function FilePicker({
|
|
5526
|
+
onFileSelected,
|
|
5527
|
+
children,
|
|
5528
|
+
disabled,
|
|
5529
|
+
imagePickerOptions,
|
|
5530
|
+
documentPickerOptions
|
|
5531
|
+
}) {
|
|
5532
|
+
const childElement = React.Children.only(children);
|
|
5533
|
+
const {
|
|
5534
|
+
bottomSheetRef,
|
|
5535
|
+
BottomSheet
|
|
5536
|
+
} = useStaticBottomSheet(BottomSheetActions);
|
|
5537
|
+
const {
|
|
5538
|
+
dismissAll
|
|
5539
|
+
} = bottomSheet$1.useBottomSheetModal();
|
|
5540
|
+
const handleBottomSheetActionsChange = file => {
|
|
5541
|
+
dismissAll();
|
|
5542
|
+
onFileSelected(file);
|
|
5543
|
+
};
|
|
5544
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
5545
|
+
children: [/*#__PURE__*/React.cloneElement(childElement, {
|
|
5546
|
+
// ensure that the press event is not prevented by Button component
|
|
5547
|
+
onPress: () => {
|
|
5548
|
+
if (disabled) return;
|
|
5549
|
+
childElement.props.onPress?.();
|
|
5550
|
+
bottomSheetRef.current?.present({
|
|
5551
|
+
onBottomSheetActionsChange: handleBottomSheetActionsChange,
|
|
5552
|
+
imagePickerOptions,
|
|
5553
|
+
documentPickerOptions
|
|
5554
|
+
});
|
|
5555
|
+
},
|
|
5556
|
+
disabled
|
|
5557
|
+
}), /*#__PURE__*/jsxRuntime.jsx(BottomSheet, {})]
|
|
5558
|
+
});
|
|
5559
|
+
}
|
|
5560
|
+
|
|
5333
5561
|
const GoogleMapsApiKeyContext = /*#__PURE__*/React.createContext(undefined);
|
|
5334
5562
|
function GoogleMapsApiKeyProvider({
|
|
5335
5563
|
children,
|
|
@@ -7122,89 +7350,6 @@ function useKittMapConfig() {
|
|
|
7122
7350
|
return context;
|
|
7123
7351
|
}
|
|
7124
7352
|
|
|
7125
|
-
function ListItemContent({
|
|
7126
|
-
children,
|
|
7127
|
-
...rest
|
|
7128
|
-
}) {
|
|
7129
|
-
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
7130
|
-
alignSelf: "center",
|
|
7131
|
-
flexBasis: "0%",
|
|
7132
|
-
flexGrow: 1,
|
|
7133
|
-
flexShrink: 0,
|
|
7134
|
-
...rest,
|
|
7135
|
-
children: children
|
|
7136
|
-
});
|
|
7137
|
-
}
|
|
7138
|
-
|
|
7139
|
-
// Handles the vertical alignment of the side elements of the list item
|
|
7140
|
-
function ListItemSideContainer({
|
|
7141
|
-
children,
|
|
7142
|
-
side = 'left',
|
|
7143
|
-
...rest
|
|
7144
|
-
}) {
|
|
7145
|
-
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
7146
|
-
flexDirection: "row",
|
|
7147
|
-
marginLeft: side === 'right' ? 'kitt.2' : undefined,
|
|
7148
|
-
marginRight: side === 'left' ? 'kitt.2' : undefined,
|
|
7149
|
-
...rest,
|
|
7150
|
-
children: children
|
|
7151
|
-
});
|
|
7152
|
-
}
|
|
7153
|
-
function ListItemSideContent({
|
|
7154
|
-
children,
|
|
7155
|
-
align = 'auto',
|
|
7156
|
-
...rest
|
|
7157
|
-
}) {
|
|
7158
|
-
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
7159
|
-
alignSelf: align,
|
|
7160
|
-
...rest,
|
|
7161
|
-
children: children
|
|
7162
|
-
});
|
|
7163
|
-
}
|
|
7164
|
-
|
|
7165
|
-
function ListItem({
|
|
7166
|
-
children,
|
|
7167
|
-
withPadding,
|
|
7168
|
-
borders,
|
|
7169
|
-
left,
|
|
7170
|
-
right,
|
|
7171
|
-
onPress,
|
|
7172
|
-
...rest
|
|
7173
|
-
}) {
|
|
7174
|
-
const Wrapper = onPress ? reactNative.Pressable : React.Fragment;
|
|
7175
|
-
const wrapperProps = onPress ? {
|
|
7176
|
-
accessibilityRole: 'button',
|
|
7177
|
-
onPress,
|
|
7178
|
-
...rest
|
|
7179
|
-
} : undefined;
|
|
7180
|
-
const containerProps = onPress ? undefined : rest;
|
|
7181
|
-
return /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
|
|
7182
|
-
...wrapperProps,
|
|
7183
|
-
children: /*#__PURE__*/jsxRuntime.jsxs(View, {
|
|
7184
|
-
flexDirection: "row",
|
|
7185
|
-
paddingX: withPadding ? 'kitt.listItem.horizontalPadding' : undefined,
|
|
7186
|
-
paddingY: withPadding ? 'kitt.listItem.verticalPadding' : undefined,
|
|
7187
|
-
borderColor: "kitt.listItem.borderColor",
|
|
7188
|
-
backgroundColor: "kitt.uiBackgroundLight",
|
|
7189
|
-
borderTopWidth: borders === 'top' || borders === 'both' ? 'kitt.listItem.borderWidth' : undefined,
|
|
7190
|
-
borderBottomWidth: borders === 'bottom' || borders === 'both' ? 'kitt.listItem.borderWidth' : undefined,
|
|
7191
|
-
...containerProps,
|
|
7192
|
-
children: [left ? /*#__PURE__*/jsxRuntime.jsx(ListItemSideContainer, {
|
|
7193
|
-
side: "left",
|
|
7194
|
-
children: left
|
|
7195
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx(ListItemContent, {
|
|
7196
|
-
children: children
|
|
7197
|
-
}), right ? /*#__PURE__*/jsxRuntime.jsx(ListItemSideContainer, {
|
|
7198
|
-
side: "right",
|
|
7199
|
-
children: right
|
|
7200
|
-
}) : null]
|
|
7201
|
-
})
|
|
7202
|
-
});
|
|
7203
|
-
}
|
|
7204
|
-
ListItem.Content = ListItemContent;
|
|
7205
|
-
ListItem.SideContent = ListItemSideContent;
|
|
7206
|
-
ListItem.SideContainer = ListItemSideContainer;
|
|
7207
|
-
|
|
7208
7353
|
const SvgMarkerLargeinline = props => /*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
7209
7354
|
fill: "currentColor",
|
|
7210
7355
|
viewBox: "0 0 54 56",
|
|
@@ -11321,9 +11466,11 @@ exports.ChoicesElements = ChoicesElements;
|
|
|
11321
11466
|
exports.CloseIconButton = CloseIconButton;
|
|
11322
11467
|
exports.DatePicker = DatePicker;
|
|
11323
11468
|
exports.DialogModal = DialogModal;
|
|
11469
|
+
exports.DocumentPicker = DocumentPicker;
|
|
11324
11470
|
exports.Emoji = Emoji;
|
|
11325
11471
|
exports.ExternalAppLink = ExternalAppLink;
|
|
11326
11472
|
exports.ExternalLink = ExternalLink;
|
|
11473
|
+
exports.FilePicker = FilePicker;
|
|
11327
11474
|
exports.FlatList = FlatList;
|
|
11328
11475
|
exports.Flex = Flex;
|
|
11329
11476
|
exports.FullscreenModal = FullscreenModal;
|
|
@@ -11334,6 +11481,7 @@ exports.Highlight = Highlight;
|
|
|
11334
11481
|
exports.Icon = Icon;
|
|
11335
11482
|
exports.IconButton = IconButton;
|
|
11336
11483
|
exports.Image = Image;
|
|
11484
|
+
exports.ImagePicker = ImagePicker;
|
|
11337
11485
|
exports.InputAddress = InputAddress;
|
|
11338
11486
|
exports.InputEmail = InputEmail;
|
|
11339
11487
|
exports.InputFeedback = InputFeedback;
|