@hero-design/rn 8.82.2-alpha.2 → 8.83.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/.turbo/turbo-build.log +7 -0
- package/CHANGELOG.md +20 -0
- package/es/index.js +491 -21
- package/lib/index.js +490 -18
- package/package.json +6 -4
- package/rollup.config.mjs +1 -0
- package/src/components/AppCue/StyledAppCue.tsx +46 -0
- package/src/components/AppCue/__tests__/StyledAppCue.tsx +18 -0
- package/src/components/AppCue/__tests__/__snapshots__/StyledAppCue.tsx.snap +200 -0
- package/src/components/AppCue/__tests__/__snapshots__/index.spec.tsx.snap +391 -0
- package/src/components/AppCue/__tests__/index.spec.tsx +61 -0
- package/src/components/AppCue/__tests__/utils.spec.ts +90 -0
- package/src/components/AppCue/index.tsx +188 -0
- package/src/components/AppCue/utils.ts +122 -0
- package/src/components/Chip/StyledChip.tsx +9 -9
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +434 -0
- package/src/components/Chip/__tests__/index.spec.tsx +4 -0
- package/src/components/Chip/index.tsx +32 -5
- package/src/components/Slider/RangeSlider.tsx +187 -0
- package/src/components/Slider/SingleSlider.tsx +89 -0
- package/src/components/Slider/StyledRangeSlider.tsx +16 -0
- package/src/components/Slider/__tests__/RangeSlider.spec.tsx +119 -0
- package/src/components/Slider/__tests__/{index.spec.tsx → SingleSlider.spec.tsx} +1 -1
- package/src/components/Slider/__tests__/__snapshots__/RangeSlider.spec.tsx.snap +252 -0
- package/src/components/Slider/index.tsx +8 -83
- package/src/components/Tabs/StyledScrollableTabs.tsx +2 -1
- package/src/components/Tabs/StyledTabs.tsx +1 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +3 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +2 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +39 -0
- package/src/theme/components/appCue.ts +22 -0
- package/src/theme/components/slider.ts +19 -1
- package/src/theme/components/tabs.ts +1 -0
- package/src/theme/getTheme.ts +3 -0
- package/src/types.ts +2 -0
- package/stats/8.83.0/rn-stats.html +4844 -0
- package/testUtils/setup.tsx +17 -0
- package/types/components/AppCue/StyledAppCue.d.ts +20 -0
- package/types/components/AppCue/__tests__/StyledAppCue.d.ts +1 -0
- package/types/components/AppCue/index.d.ts +21 -0
- package/types/components/AppCue/utils.d.ts +63 -0
- package/types/components/Chip/StyledChip.d.ts +1 -1
- package/types/components/Chip/index.d.ts +2 -2
- package/types/components/Slider/RangeSlider.d.ts +60 -0
- package/types/components/Slider/SingleSlider.d.ts +53 -0
- package/types/components/Slider/StyledRangeSlider.d.ts +10 -0
- package/types/components/Slider/index.d.ts +6 -51
- package/types/index.d.ts +2 -1
- package/types/theme/components/appCue.d.ts +16 -0
- package/types/theme/components/slider.d.ts +24 -0
- package/types/theme/components/tabs.d.ts +1 -0
- package/types/theme/getTheme.d.ts +2 -0
- package/types/types.d.ts +2 -1
- /package/src/components/Slider/__tests__/__snapshots__/{index.spec.tsx.snap → SingleSlider.spec.tsx.snap} +0 -0
package/lib/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
|
7
7
|
var reactNativeMonthYearPicker = require('@hero-design/react-native-month-year-picker');
|
|
8
8
|
var DateTimePicker = require('@react-native-community/datetimepicker');
|
|
9
9
|
var RnSlider = require('@react-native-community/slider');
|
|
10
|
+
var MultiSlider = require('@ptomasroos/react-native-multi-slider');
|
|
10
11
|
var reactNativeGestureHandler = require('react-native-gesture-handler');
|
|
11
12
|
var LinearGradient = require('react-native-linear-gradient');
|
|
12
13
|
var PagerView = require('react-native-pager-view');
|
|
@@ -37,6 +38,7 @@ var reactNative__namespace = /*#__PURE__*/_interopNamespaceCompat(reactNative);
|
|
|
37
38
|
var React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);
|
|
38
39
|
var DateTimePicker__default = /*#__PURE__*/_interopDefaultCompat(DateTimePicker);
|
|
39
40
|
var RnSlider__default = /*#__PURE__*/_interopDefaultCompat(RnSlider);
|
|
41
|
+
var MultiSlider__default = /*#__PURE__*/_interopDefaultCompat(MultiSlider);
|
|
40
42
|
var LinearGradient__default = /*#__PURE__*/_interopDefaultCompat(LinearGradient);
|
|
41
43
|
var PagerView__default = /*#__PURE__*/_interopDefaultCompat(PagerView);
|
|
42
44
|
|
|
@@ -3331,10 +3333,28 @@ var getSliderTheme = function getSliderTheme(theme) {
|
|
|
3331
3333
|
var colors = {
|
|
3332
3334
|
minimumTrackTint: theme.colors.primary,
|
|
3333
3335
|
thumbTint: theme.colors.primary,
|
|
3334
|
-
maximumTrackTint: theme.colors.highlightedSurface
|
|
3336
|
+
maximumTrackTint: theme.colors.highlightedSurface,
|
|
3337
|
+
trackBackground: theme.colors.highlightedSurface,
|
|
3338
|
+
disabledThumbTint: theme.colors.disabledOnDefaultGlobalSurface,
|
|
3339
|
+
disabledTrackBackground: theme.colors.neutralGlobalSurface
|
|
3340
|
+
};
|
|
3341
|
+
var shadows = {
|
|
3342
|
+
marker: theme.shadows["default"]
|
|
3343
|
+
};
|
|
3344
|
+
var sizes = {
|
|
3345
|
+
trackHeight: theme.sizes.xsmall,
|
|
3346
|
+
markerWidth: theme.sizes.large,
|
|
3347
|
+
markerHeight: theme.sizes.large,
|
|
3348
|
+
markerBorderRadius: theme.radii.rounded
|
|
3349
|
+
};
|
|
3350
|
+
var radii = {
|
|
3351
|
+
marker: theme.radii.rounded
|
|
3335
3352
|
};
|
|
3336
3353
|
return {
|
|
3337
|
-
colors: colors
|
|
3354
|
+
colors: colors,
|
|
3355
|
+
shadows: shadows,
|
|
3356
|
+
sizes: sizes,
|
|
3357
|
+
radii: radii
|
|
3338
3358
|
};
|
|
3339
3359
|
};
|
|
3340
3360
|
|
|
@@ -3477,7 +3497,8 @@ var getTabsTheme = function getTabsTheme(theme) {
|
|
|
3477
3497
|
activeBackground: theme.colors.decorativePrimarySurface,
|
|
3478
3498
|
headerBottom: theme.colors.secondaryOutline,
|
|
3479
3499
|
indicator: theme.colors.primary,
|
|
3480
|
-
text: theme.colors.onDefaultGlobalSurface
|
|
3500
|
+
text: theme.colors.onDefaultGlobalSurface,
|
|
3501
|
+
headerBackground: theme.colors.defaultGlobalSurface
|
|
3481
3502
|
};
|
|
3482
3503
|
var space = {
|
|
3483
3504
|
flatListHorizontalPadding: theme.space.small,
|
|
@@ -4080,6 +4101,26 @@ var getFloatingIslandTheme = function getFloatingIslandTheme(theme) {
|
|
|
4080
4101
|
};
|
|
4081
4102
|
};
|
|
4082
4103
|
|
|
4104
|
+
var getAppCueTheme = function getAppCueTheme(theme) {
|
|
4105
|
+
var colors = {
|
|
4106
|
+
background: theme.colors.darkGlobalSurface,
|
|
4107
|
+
backdropColor: 'rgba(0, 0, 0, 0.5)'
|
|
4108
|
+
};
|
|
4109
|
+
var space = {
|
|
4110
|
+
padding: theme.space.medium,
|
|
4111
|
+
offset: theme.space.small,
|
|
4112
|
+
arrowOffset: theme.space.smallMedium
|
|
4113
|
+
};
|
|
4114
|
+
var radii = {
|
|
4115
|
+
container: theme.radii.large
|
|
4116
|
+
};
|
|
4117
|
+
return {
|
|
4118
|
+
colors: colors,
|
|
4119
|
+
space: space,
|
|
4120
|
+
radii: radii
|
|
4121
|
+
};
|
|
4122
|
+
};
|
|
4123
|
+
|
|
4083
4124
|
var getTheme$1 = function getTheme() {
|
|
4084
4125
|
var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : scale$1;
|
|
4085
4126
|
var systemPallete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : swagSystemPalette$1;
|
|
@@ -4088,6 +4129,7 @@ var getTheme$1 = function getTheme() {
|
|
|
4088
4129
|
__hd__: {
|
|
4089
4130
|
accordion: getAccordionTheme(globalTheme),
|
|
4090
4131
|
alert: getAlertTheme(globalTheme),
|
|
4132
|
+
appCue: getAppCueTheme(globalTheme),
|
|
4091
4133
|
attachment: getAttachmentTheme(globalTheme),
|
|
4092
4134
|
avatar: getAvatarTheme(globalTheme),
|
|
4093
4135
|
badge: getBadgeTheme(globalTheme),
|
|
@@ -8233,6 +8275,288 @@ var Alert = function Alert(_ref2) {
|
|
|
8233
8275
|
})) : null);
|
|
8234
8276
|
};
|
|
8235
8277
|
|
|
8278
|
+
var StyledContent$1 = index$a(reactNative.View)(function (_ref) {
|
|
8279
|
+
var theme = _ref.theme;
|
|
8280
|
+
return {
|
|
8281
|
+
padding: theme.__hd__.appCue.space.padding,
|
|
8282
|
+
backgroundColor: theme.__hd__.appCue.colors.background,
|
|
8283
|
+
borderRadius: theme.__hd__.appCue.radii.container,
|
|
8284
|
+
alignSelf: 'center'
|
|
8285
|
+
};
|
|
8286
|
+
});
|
|
8287
|
+
var StyledContainer$9 = index$a(reactNative.View)(function (_ref2) {
|
|
8288
|
+
var theme = _ref2.theme;
|
|
8289
|
+
return {
|
|
8290
|
+
width: '100%',
|
|
8291
|
+
height: '100%',
|
|
8292
|
+
backgroundColor: theme.__hd__.appCue.colors.backdropColor
|
|
8293
|
+
};
|
|
8294
|
+
});
|
|
8295
|
+
var StyledIconContainer$1 = index$a(reactNative.Animated.View)(function (_ref3) {
|
|
8296
|
+
var theme = _ref3.theme,
|
|
8297
|
+
themePlacement = _ref3.themePlacement;
|
|
8298
|
+
return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
8299
|
+
position: 'absolute',
|
|
8300
|
+
color: theme.__hd__.appCue.colors.background,
|
|
8301
|
+
display: 'flex',
|
|
8302
|
+
alignItems: 'center',
|
|
8303
|
+
justifyContent: 'center'
|
|
8304
|
+
}, themePlacement === 'top' && {
|
|
8305
|
+
bottom: -theme.__hd__.appCue.space.arrowOffset,
|
|
8306
|
+
width: '100%'
|
|
8307
|
+
}), themePlacement === 'bottom' && {
|
|
8308
|
+
top: -theme.__hd__.appCue.space.arrowOffset,
|
|
8309
|
+
transform: [{
|
|
8310
|
+
rotate: '180deg'
|
|
8311
|
+
}],
|
|
8312
|
+
width: '100%'
|
|
8313
|
+
}), themePlacement === 'right' && {
|
|
8314
|
+
left: -theme.__hd__.appCue.space.arrowOffset,
|
|
8315
|
+
transform: [{
|
|
8316
|
+
rotate: '90deg'
|
|
8317
|
+
}],
|
|
8318
|
+
height: '100%'
|
|
8319
|
+
}), themePlacement === 'left' && {
|
|
8320
|
+
right: -theme.__hd__.appCue.space.arrowOffset,
|
|
8321
|
+
transform: [{
|
|
8322
|
+
rotate: '-90deg'
|
|
8323
|
+
}],
|
|
8324
|
+
height: '100%'
|
|
8325
|
+
});
|
|
8326
|
+
});
|
|
8327
|
+
|
|
8328
|
+
/**
|
|
8329
|
+
* Calculates the position of an element based on its placement relative to a reference position.
|
|
8330
|
+
*
|
|
8331
|
+
* @param {Object} params - The parameters for calculating the position.
|
|
8332
|
+
* @param {Object} params.position - The position and size of target element.
|
|
8333
|
+
* @param {number} params.position.pageX - The X coordinate of the target position.
|
|
8334
|
+
* @param {number} params.position.pageY - The Y coordinate of the target position.
|
|
8335
|
+
* @param {number} params.position.width - The width of the reference element.
|
|
8336
|
+
* @param {number} params.position.height - The height of the reference element.
|
|
8337
|
+
* @param {Object} params.contentSize - The size of the App Cue content.
|
|
8338
|
+
* @param {number} params.contentSize.width - The width of the content.
|
|
8339
|
+
* @param {number} params.contentSize.height - The height of the content.
|
|
8340
|
+
* @param {Placement} params.placement - The placement of the content relative to the reference position ('top', 'bottom', 'right', 'left').
|
|
8341
|
+
* @param {number} params.offset - The offset distance to display an arrow.
|
|
8342
|
+
*
|
|
8343
|
+
* @returns {Object} The calculated position of the App Cue.
|
|
8344
|
+
* @returns {number} return.x - The X coordinate of the App Cue.
|
|
8345
|
+
* @returns {number} return.y - The Y coordinate of the App Cue.
|
|
8346
|
+
*/
|
|
8347
|
+
var calculatePosition = function calculatePosition(_ref) {
|
|
8348
|
+
var placement = _ref.placement,
|
|
8349
|
+
position = _ref.position,
|
|
8350
|
+
contentSize = _ref.contentSize,
|
|
8351
|
+
offset = _ref.offset;
|
|
8352
|
+
switch (placement) {
|
|
8353
|
+
case 'top':
|
|
8354
|
+
{
|
|
8355
|
+
return {
|
|
8356
|
+
// The X coordinate is calculated by adding the half of the width of the target element to the X coordinate of the target element.
|
|
8357
|
+
x: position.pageX + (position.width - contentSize.width) / 2,
|
|
8358
|
+
// The Y coordinate is calculated by subtracting the height of the content and the offset from the Y coordinate of the target element
|
|
8359
|
+
y: position.pageY - contentSize.height - offset
|
|
8360
|
+
};
|
|
8361
|
+
}
|
|
8362
|
+
case 'bottom':
|
|
8363
|
+
{
|
|
8364
|
+
return {
|
|
8365
|
+
// The X coordinate is calculated by adding the half of the width of the target element to the X coordinate of the target element.
|
|
8366
|
+
x: position.pageX + (position.width - contentSize.width) / 2,
|
|
8367
|
+
// The Y coordinate is calculated by adding the height of the target element and the offset to the Y coordinate of the target element.
|
|
8368
|
+
y: position.pageY + position.height + offset
|
|
8369
|
+
};
|
|
8370
|
+
}
|
|
8371
|
+
case 'right':
|
|
8372
|
+
{
|
|
8373
|
+
return {
|
|
8374
|
+
// The X coordinate is calculated by adding the width of the target element and the offset to the X coordinate of the target element.
|
|
8375
|
+
x: position.pageX + position.width + offset,
|
|
8376
|
+
// The Y coordinate is calculated by adding half of the height of the target element to the Y coordinate of the target element.
|
|
8377
|
+
y: position.pageY + (position.height - contentSize.height) / 2
|
|
8378
|
+
};
|
|
8379
|
+
}
|
|
8380
|
+
case 'left':
|
|
8381
|
+
{
|
|
8382
|
+
return {
|
|
8383
|
+
// The X coordinate is calculated by subtracting the width of the content and the offset from the X coordinate of the target element.
|
|
8384
|
+
x: position.pageX - contentSize.width - offset,
|
|
8385
|
+
// The Y coordinate is calculated by adding half of the height of the target element to the Y coordinate of the target element.
|
|
8386
|
+
y: position.pageY + (position.height - contentSize.height) / 2
|
|
8387
|
+
};
|
|
8388
|
+
}
|
|
8389
|
+
}
|
|
8390
|
+
};
|
|
8391
|
+
/**
|
|
8392
|
+
* Calculates the maximum width of the content based on its position, offset, placement, and window width.
|
|
8393
|
+
*
|
|
8394
|
+
* @param {Object} params - The parameters for the calculation.
|
|
8395
|
+
* @param {Object} params.position - The position and dimensions of the target element.
|
|
8396
|
+
* @param {number} params.position.pageX - The X coordinate of the target element.
|
|
8397
|
+
* @param {number} params.position.pageY - The Y coordinate of the target element.
|
|
8398
|
+
* @param {number} params.position.width - The width of the target element.
|
|
8399
|
+
* @param {number} params.position.height - The height of the target element.
|
|
8400
|
+
* @param {number} params.offset - The offset value to display an arrow.
|
|
8401
|
+
* @param {Placement} params.placement - The placement of the content relative to the element.
|
|
8402
|
+
* @param {number} params.windowWidth - The width of the window.
|
|
8403
|
+
*
|
|
8404
|
+
* @returns {number | undefined} The maximum width of the content.
|
|
8405
|
+
*/
|
|
8406
|
+
var calulateContentMaxWidth = function calulateContentMaxWidth(_ref2) {
|
|
8407
|
+
var position = _ref2.position,
|
|
8408
|
+
offset = _ref2.offset,
|
|
8409
|
+
placement = _ref2.placement,
|
|
8410
|
+
windowWidth = _ref2.windowWidth;
|
|
8411
|
+
switch (placement) {
|
|
8412
|
+
case 'top':
|
|
8413
|
+
{
|
|
8414
|
+
return undefined;
|
|
8415
|
+
}
|
|
8416
|
+
case 'bottom':
|
|
8417
|
+
{
|
|
8418
|
+
return undefined;
|
|
8419
|
+
}
|
|
8420
|
+
case 'right':
|
|
8421
|
+
{
|
|
8422
|
+
return windowWidth - position.pageX - position.width - offset;
|
|
8423
|
+
}
|
|
8424
|
+
case 'left':
|
|
8425
|
+
{
|
|
8426
|
+
return position.pageX - offset;
|
|
8427
|
+
}
|
|
8428
|
+
}
|
|
8429
|
+
};
|
|
8430
|
+
|
|
8431
|
+
var AppCue = function AppCue(_ref) {
|
|
8432
|
+
var target = _ref.target,
|
|
8433
|
+
content = _ref.content,
|
|
8434
|
+
_ref$placement = _ref.placement,
|
|
8435
|
+
placement = _ref$placement === void 0 ? 'top' : _ref$placement,
|
|
8436
|
+
style = _ref.style,
|
|
8437
|
+
testID = _ref.testID;
|
|
8438
|
+
var targetContainerRef = React.useRef(null);
|
|
8439
|
+
var _React$useState = React__namespace.default.useState(false),
|
|
8440
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
8441
|
+
visible = _React$useState2[0],
|
|
8442
|
+
setVisible = _React$useState2[1];
|
|
8443
|
+
var theme = useTheme();
|
|
8444
|
+
var offset = theme.__hd__.appCue.space.offset;
|
|
8445
|
+
var _React$useState3 = React__namespace.default.useState({
|
|
8446
|
+
pageX: 0,
|
|
8447
|
+
pageY: 0,
|
|
8448
|
+
width: 0,
|
|
8449
|
+
height: 0
|
|
8450
|
+
}),
|
|
8451
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
8452
|
+
position = _React$useState4[0],
|
|
8453
|
+
setPosition = _React$useState4[1];
|
|
8454
|
+
var _React$useState5 = React__namespace.default.useState({
|
|
8455
|
+
width: 0,
|
|
8456
|
+
height: 0
|
|
8457
|
+
}),
|
|
8458
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
8459
|
+
contentSize = _React$useState6[0],
|
|
8460
|
+
setContentSize = _React$useState6[1];
|
|
8461
|
+
var doMeasure = React.useCallback(function (cb) {
|
|
8462
|
+
var _targetContainerRef$c;
|
|
8463
|
+
(_targetContainerRef$c = targetContainerRef.current) === null || _targetContainerRef$c === void 0 || _targetContainerRef$c.measure(function (_, __, width, height, pageX, pageY) {
|
|
8464
|
+
setPosition({
|
|
8465
|
+
pageX: pageX,
|
|
8466
|
+
pageY: pageY,
|
|
8467
|
+
width: width,
|
|
8468
|
+
height: height
|
|
8469
|
+
});
|
|
8470
|
+
cb === null || cb === void 0 || cb();
|
|
8471
|
+
});
|
|
8472
|
+
}, []);
|
|
8473
|
+
var handleOpen = function handleOpen() {
|
|
8474
|
+
doMeasure(function () {
|
|
8475
|
+
return setVisible(true);
|
|
8476
|
+
});
|
|
8477
|
+
};
|
|
8478
|
+
React.useLayoutEffect(function () {
|
|
8479
|
+
doMeasure();
|
|
8480
|
+
}, [doMeasure]);
|
|
8481
|
+
var enhancedTarget = /*#__PURE__*/React__namespace.default.cloneElement(target, {
|
|
8482
|
+
onPress: function onPress() {
|
|
8483
|
+
var _target$props, _target$props$onPress;
|
|
8484
|
+
handleOpen();
|
|
8485
|
+
(_target$props = target.props) === null || _target$props === void 0 || (_target$props$onPress = _target$props.onPress) === null || _target$props$onPress === void 0 || _target$props$onPress.call(_target$props);
|
|
8486
|
+
}
|
|
8487
|
+
}, target.props.children);
|
|
8488
|
+
var measureContent = function measureContent(event) {
|
|
8489
|
+
setContentSize({
|
|
8490
|
+
width: event.nativeEvent.layout.width,
|
|
8491
|
+
height: event.nativeEvent.layout.height
|
|
8492
|
+
});
|
|
8493
|
+
};
|
|
8494
|
+
var pos = calculatePosition({
|
|
8495
|
+
position: position,
|
|
8496
|
+
contentSize: contentSize,
|
|
8497
|
+
placement: placement,
|
|
8498
|
+
offset: offset
|
|
8499
|
+
});
|
|
8500
|
+
var _useWindowDimensions = reactNative.useWindowDimensions(),
|
|
8501
|
+
windowWidth = _useWindowDimensions.width;
|
|
8502
|
+
var maxWidth = calulateContentMaxWidth({
|
|
8503
|
+
position: position,
|
|
8504
|
+
offset: offset,
|
|
8505
|
+
placement: placement,
|
|
8506
|
+
windowWidth: windowWidth
|
|
8507
|
+
});
|
|
8508
|
+
var renderContent = function renderContent() {
|
|
8509
|
+
if (typeof content === 'string') {
|
|
8510
|
+
return /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
8511
|
+
intent: "inverted"
|
|
8512
|
+
}, content);
|
|
8513
|
+
}
|
|
8514
|
+
return content;
|
|
8515
|
+
};
|
|
8516
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
|
|
8517
|
+
onPress: handleOpen
|
|
8518
|
+
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
8519
|
+
collapsable: false,
|
|
8520
|
+
ref: targetContainerRef,
|
|
8521
|
+
style: {
|
|
8522
|
+
alignSelf: 'center'
|
|
8523
|
+
}
|
|
8524
|
+
}, enhancedTarget)), /*#__PURE__*/React__namespace.default.createElement(reactNative.Modal, {
|
|
8525
|
+
animationType: "fade",
|
|
8526
|
+
visible: visible,
|
|
8527
|
+
onDismiss: function onDismiss() {
|
|
8528
|
+
return setVisible(false);
|
|
8529
|
+
},
|
|
8530
|
+
transparent: true,
|
|
8531
|
+
presentationStyle: "overFullScreen",
|
|
8532
|
+
statusBarTranslucent: true
|
|
8533
|
+
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
|
|
8534
|
+
testID: testID && "".concat(testID, "-backdrop"),
|
|
8535
|
+
onPress: function onPress() {
|
|
8536
|
+
return setVisible(false);
|
|
8537
|
+
}
|
|
8538
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledContainer$9, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
8539
|
+
style: reactNative.StyleSheet.flatten([{
|
|
8540
|
+
position: 'absolute',
|
|
8541
|
+
top: pos.y,
|
|
8542
|
+
left: pos.x
|
|
8543
|
+
}, style]),
|
|
8544
|
+
onLayout: measureContent,
|
|
8545
|
+
testID: testID
|
|
8546
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledContent$1, {
|
|
8547
|
+
style: {
|
|
8548
|
+
maxWidth: maxWidth
|
|
8549
|
+
},
|
|
8550
|
+
testID: testID && "".concat(testID, "-content")
|
|
8551
|
+
}, renderContent()), /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer$1, {
|
|
8552
|
+
themePlacement: placement,
|
|
8553
|
+
testID: testID && "".concat(testID, "-arrow")
|
|
8554
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Icon, {
|
|
8555
|
+
icon: "caret-down",
|
|
8556
|
+
size: "small"
|
|
8557
|
+
})))))));
|
|
8558
|
+
};
|
|
8559
|
+
|
|
8236
8560
|
var StyledContainer$8 = index$a(reactNative.View)({
|
|
8237
8561
|
alignItems: 'center',
|
|
8238
8562
|
flexDirection: 'row'
|
|
@@ -13175,16 +13499,16 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
13175
13499
|
var getShadowStyles = function getShadowStyles() {
|
|
13176
13500
|
switch (themeVariant) {
|
|
13177
13501
|
case 'compact':
|
|
13178
|
-
case '
|
|
13502
|
+
case 'filter':
|
|
13179
13503
|
return _objectSpread2({}, theme.__hd__.chip.shadows.filledWrapper);
|
|
13180
|
-
case '
|
|
13504
|
+
case 'selection':
|
|
13181
13505
|
case 'compact-outlined':
|
|
13182
13506
|
return undefined;
|
|
13183
13507
|
}
|
|
13184
13508
|
};
|
|
13185
13509
|
var getBorderStyles = function getBorderStyles() {
|
|
13186
13510
|
switch (themeVariant) {
|
|
13187
|
-
case '
|
|
13511
|
+
case 'selection':
|
|
13188
13512
|
case 'compact-outlined':
|
|
13189
13513
|
{
|
|
13190
13514
|
return {
|
|
@@ -13193,7 +13517,7 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
13193
13517
|
};
|
|
13194
13518
|
}
|
|
13195
13519
|
case 'compact':
|
|
13196
|
-
case '
|
|
13520
|
+
case 'filter':
|
|
13197
13521
|
{
|
|
13198
13522
|
return {
|
|
13199
13523
|
borderColor: theme.__hd__.chip.colors.wrapperSelectedBorder
|
|
@@ -13204,14 +13528,14 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
13204
13528
|
var getBackgroundStyles = function getBackgroundStyles() {
|
|
13205
13529
|
if (themeSelected) {
|
|
13206
13530
|
switch (themeVariant) {
|
|
13207
|
-
case '
|
|
13531
|
+
case 'selection':
|
|
13208
13532
|
case 'compact-outlined':
|
|
13209
13533
|
{
|
|
13210
13534
|
return {
|
|
13211
13535
|
backgroundColor: themeSelected ? theme.__hd__.chip.colors.outlinedSelectedBackground : theme.__hd__.chip.colors.outlinedDefaultBackground
|
|
13212
13536
|
};
|
|
13213
13537
|
}
|
|
13214
|
-
case '
|
|
13538
|
+
case 'filter':
|
|
13215
13539
|
case 'compact':
|
|
13216
13540
|
{
|
|
13217
13541
|
return {
|
|
@@ -13221,14 +13545,14 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
13221
13545
|
}
|
|
13222
13546
|
} else {
|
|
13223
13547
|
switch (themeVariant) {
|
|
13224
|
-
case '
|
|
13548
|
+
case 'selection':
|
|
13225
13549
|
case 'compact-outlined':
|
|
13226
13550
|
{
|
|
13227
13551
|
return {
|
|
13228
13552
|
backgroundColor: theme.__hd__.chip.colors.outlinedDefaultBackground
|
|
13229
13553
|
};
|
|
13230
13554
|
}
|
|
13231
|
-
case '
|
|
13555
|
+
case 'filter':
|
|
13232
13556
|
case 'compact':
|
|
13233
13557
|
{
|
|
13234
13558
|
return {
|
|
@@ -13281,10 +13605,24 @@ var getChipLabel = function getChipLabel(label) {
|
|
|
13281
13605
|
}
|
|
13282
13606
|
return label;
|
|
13283
13607
|
};
|
|
13608
|
+
var getChipVariant = function getChipVariant() {
|
|
13609
|
+
var variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'selection';
|
|
13610
|
+
switch (variant) {
|
|
13611
|
+
case 'selection':
|
|
13612
|
+
case 'filter':
|
|
13613
|
+
case 'compact':
|
|
13614
|
+
case 'compact-outlined':
|
|
13615
|
+
return variant;
|
|
13616
|
+
case 'outlined':
|
|
13617
|
+
return 'selection';
|
|
13618
|
+
case 'filled':
|
|
13619
|
+
return 'filter';
|
|
13620
|
+
}
|
|
13621
|
+
};
|
|
13284
13622
|
var Chip = function Chip(_ref) {
|
|
13285
13623
|
var label = _ref.label,
|
|
13286
13624
|
_ref$variant = _ref.variant,
|
|
13287
|
-
variant = _ref$variant === void 0 ? '
|
|
13625
|
+
variant = _ref$variant === void 0 ? 'selection' : _ref$variant,
|
|
13288
13626
|
_ref$selected = _ref.selected,
|
|
13289
13627
|
selected = _ref$selected === void 0 ? false : _ref$selected,
|
|
13290
13628
|
icon = _ref.icon,
|
|
@@ -13292,13 +13630,15 @@ var Chip = function Chip(_ref) {
|
|
|
13292
13630
|
_ref$showSelectedIcon = _ref.showSelectedIcon,
|
|
13293
13631
|
showSelectedIcon = _ref$showSelectedIcon === void 0 ? true : _ref$showSelectedIcon,
|
|
13294
13632
|
otherProps = _objectWithoutProperties(_ref, _excluded$s);
|
|
13295
|
-
|
|
13633
|
+
useDeprecation('Chip variant `outlined` and `filled` are deprecated.', variant === 'outlined' || variant === 'filled');
|
|
13634
|
+
var renamedVariant = getChipVariant(variant);
|
|
13635
|
+
var shouldShowSelectedIcon = (renamedVariant === 'selection' || renamedVariant === 'compact-outlined') && selected && showSelectedIcon;
|
|
13296
13636
|
var chipLabel = React.useMemo(function () {
|
|
13297
13637
|
return getChipLabel(label);
|
|
13298
13638
|
}, [label]);
|
|
13299
13639
|
return /*#__PURE__*/React__namespace.default.createElement(StyledChipWrapper, _extends$1({
|
|
13300
13640
|
onPress: onPress,
|
|
13301
|
-
themeVariant:
|
|
13641
|
+
themeVariant: renamedVariant,
|
|
13302
13642
|
themeSelected: selected
|
|
13303
13643
|
}, otherProps), icon && /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13304
13644
|
marginRight: "small"
|
|
@@ -16900,7 +17240,7 @@ var Progress = {
|
|
|
16900
17240
|
Step: ProgressStep
|
|
16901
17241
|
};
|
|
16902
17242
|
|
|
16903
|
-
var Slider = function Slider(_ref) {
|
|
17243
|
+
var Slider$2 = function Slider(_ref) {
|
|
16904
17244
|
var _ref$minimumValue = _ref.minimumValue,
|
|
16905
17245
|
minimumValue = _ref$minimumValue === void 0 ? 0 : _ref$minimumValue,
|
|
16906
17246
|
_ref$maximumValue = _ref.maximumValue,
|
|
@@ -16934,6 +17274,134 @@ var Slider = function Slider(_ref) {
|
|
|
16934
17274
|
});
|
|
16935
17275
|
};
|
|
16936
17276
|
|
|
17277
|
+
var StyledMarker = index$a(reactNative.View)(function (_ref) {
|
|
17278
|
+
var themeDisabled = _ref.themeDisabled,
|
|
17279
|
+
theme = _ref.theme;
|
|
17280
|
+
return _objectSpread2({
|
|
17281
|
+
height: theme.__hd__.slider.sizes.markerHeight,
|
|
17282
|
+
width: theme.__hd__.slider.sizes.markerWidth,
|
|
17283
|
+
borderRadius: theme.__hd__.slider.radii.marker,
|
|
17284
|
+
backgroundColor: themeDisabled ? theme.__hd__.slider.colors.disabledThumbTint : theme.__hd__.slider.colors.thumbTint
|
|
17285
|
+
}, theme.__hd__.slider.shadows.marker);
|
|
17286
|
+
});
|
|
17287
|
+
|
|
17288
|
+
var Slider$1 = function Slider(_ref) {
|
|
17289
|
+
var minimumValue = _ref.minimumValue,
|
|
17290
|
+
maximumValue = _ref.maximumValue,
|
|
17291
|
+
_ref$step = _ref.step,
|
|
17292
|
+
step = _ref$step === void 0 ? 1 : _ref$step,
|
|
17293
|
+
value = _ref.value,
|
|
17294
|
+
onValueChange = _ref.onValueChange,
|
|
17295
|
+
onSlidingStart = _ref.onSlidingStart,
|
|
17296
|
+
onSlidingComplete = _ref.onSlidingComplete,
|
|
17297
|
+
_ref$disabled = _ref.disabled,
|
|
17298
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
17299
|
+
style = _ref.style,
|
|
17300
|
+
testID = _ref.testID,
|
|
17301
|
+
_ref$allowOverlap = _ref.allowOverlap,
|
|
17302
|
+
allowOverlap = _ref$allowOverlap === void 0 ? false : _ref$allowOverlap;
|
|
17303
|
+
var theme = useTheme();
|
|
17304
|
+
var handleTwoWaySliderChange = React__namespace.default.useCallback(function (values) {
|
|
17305
|
+
if (onValueChange) {
|
|
17306
|
+
onValueChange({
|
|
17307
|
+
start: values[0],
|
|
17308
|
+
end: values[1]
|
|
17309
|
+
});
|
|
17310
|
+
}
|
|
17311
|
+
}, [onValueChange]);
|
|
17312
|
+
var _useState = React.useState({
|
|
17313
|
+
width: 0,
|
|
17314
|
+
height: 0
|
|
17315
|
+
}),
|
|
17316
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17317
|
+
layoutSize = _useState2[0],
|
|
17318
|
+
setLayoutSize = _useState2[1];
|
|
17319
|
+
var nativeValue = React.useMemo(function () {
|
|
17320
|
+
var _value$start, _value$end;
|
|
17321
|
+
return [(_value$start = value === null || value === void 0 ? void 0 : value.start) !== null && _value$start !== void 0 ? _value$start : minimumValue, (_value$end = value === null || value === void 0 ? void 0 : value.end) !== null && _value$end !== void 0 ? _value$end : maximumValue];
|
|
17322
|
+
}, [value === null || value === void 0 ? void 0 : value.start, value === null || value === void 0 ? void 0 : value.end, minimumValue, maximumValue]);
|
|
17323
|
+
var _theme$__hd__$slider$ = theme.__hd__.slider.colors,
|
|
17324
|
+
trackBackground = _theme$__hd__$slider$.trackBackground,
|
|
17325
|
+
disabledTrackBackground = _theme$__hd__$slider$.disabledTrackBackground,
|
|
17326
|
+
thumbTint = _theme$__hd__$slider$.thumbTint,
|
|
17327
|
+
disabledThumbTint = _theme$__hd__$slider$.disabledThumbTint;
|
|
17328
|
+
var trackHeight = theme.__hd__.slider.sizes.trackHeight;
|
|
17329
|
+
// Define styles for disabled and enabled states
|
|
17330
|
+
var disabledStyles = {
|
|
17331
|
+
track: {
|
|
17332
|
+
backgroundColor: disabledTrackBackground,
|
|
17333
|
+
height: trackHeight
|
|
17334
|
+
},
|
|
17335
|
+
selected: {
|
|
17336
|
+
backgroundColor: disabledThumbTint
|
|
17337
|
+
}
|
|
17338
|
+
};
|
|
17339
|
+
var enabledStyles = {
|
|
17340
|
+
track: {
|
|
17341
|
+
backgroundColor: trackBackground,
|
|
17342
|
+
height: trackHeight
|
|
17343
|
+
},
|
|
17344
|
+
selected: {
|
|
17345
|
+
backgroundColor: thumbTint
|
|
17346
|
+
}
|
|
17347
|
+
};
|
|
17348
|
+
// Use styles based on the `disabled` state
|
|
17349
|
+
var trackStyle = disabled ? disabledStyles.track : enabledStyles.track;
|
|
17350
|
+
var selectedStyle = disabled ? disabledStyles.selected : enabledStyles.selected;
|
|
17351
|
+
var handleOnValueChangeStart = React.useCallback(function () {
|
|
17352
|
+
if (onSlidingStart) {
|
|
17353
|
+
onSlidingStart();
|
|
17354
|
+
}
|
|
17355
|
+
}, [onSlidingStart]);
|
|
17356
|
+
var handleOnValueChangeFinish = React.useCallback(function (values) {
|
|
17357
|
+
if (onSlidingComplete) {
|
|
17358
|
+
onSlidingComplete({
|
|
17359
|
+
start: values[0],
|
|
17360
|
+
end: values[1]
|
|
17361
|
+
});
|
|
17362
|
+
}
|
|
17363
|
+
}, [onSlidingComplete]);
|
|
17364
|
+
var onLayoutCallback = React.useCallback(function (event) {
|
|
17365
|
+
setLayoutSize({
|
|
17366
|
+
width: event.nativeEvent.layout.width,
|
|
17367
|
+
height: event.nativeEvent.layout.height
|
|
17368
|
+
});
|
|
17369
|
+
}, []);
|
|
17370
|
+
var CustomMarker = React.useMemo(function () {
|
|
17371
|
+
return function () {
|
|
17372
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledMarker, {
|
|
17373
|
+
themeDisabled: disabled
|
|
17374
|
+
});
|
|
17375
|
+
};
|
|
17376
|
+
}, [disabled]);
|
|
17377
|
+
return /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
17378
|
+
onLayout: onLayoutCallback,
|
|
17379
|
+
style: style,
|
|
17380
|
+
testID: testID,
|
|
17381
|
+
accessibilityState: {
|
|
17382
|
+
disabled: disabled
|
|
17383
|
+
}
|
|
17384
|
+
}, /*#__PURE__*/React__namespace.default.createElement(MultiSlider__default.default, {
|
|
17385
|
+
values: nativeValue,
|
|
17386
|
+
onValuesChange: handleTwoWaySliderChange,
|
|
17387
|
+
onValuesChangeStart: handleOnValueChangeStart,
|
|
17388
|
+
onValuesChangeFinish: handleOnValueChangeFinish,
|
|
17389
|
+
sliderLength: layoutSize.width,
|
|
17390
|
+
min: minimumValue,
|
|
17391
|
+
max: maximumValue,
|
|
17392
|
+
step: step,
|
|
17393
|
+
enabledOne: !disabled,
|
|
17394
|
+
enabledTwo: !disabled,
|
|
17395
|
+
allowOverlap: allowOverlap,
|
|
17396
|
+
trackStyle: trackStyle,
|
|
17397
|
+
selectedStyle: selectedStyle,
|
|
17398
|
+
customMarker: CustomMarker
|
|
17399
|
+
}));
|
|
17400
|
+
};
|
|
17401
|
+
|
|
17402
|
+
var Slider = Slider$2;
|
|
17403
|
+
Slider.Range = Slider$1;
|
|
17404
|
+
|
|
16937
17405
|
var StyledView$1 = index$a(reactNative.View)();
|
|
16938
17406
|
var StyledSpinnerContainer = index$a(reactNative.View)({
|
|
16939
17407
|
height: '100%',
|
|
@@ -18409,7 +18877,8 @@ var HeaderTabWrapper$1 = index$a(reactNative.View)(function (_ref) {
|
|
|
18409
18877
|
return {
|
|
18410
18878
|
paddingHorizontal: Math.max(themeInsets.left, themeInsets.right),
|
|
18411
18879
|
borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
|
|
18412
|
-
borderBottomWidth: theme.__hd__.tabs.borderWidths.headerBottom
|
|
18880
|
+
borderBottomWidth: theme.__hd__.tabs.borderWidths.headerBottom,
|
|
18881
|
+
backgroundColor: theme.__hd__.tabs.colors.headerBackground
|
|
18413
18882
|
};
|
|
18414
18883
|
});
|
|
18415
18884
|
var HeaderTab = index$a(reactNative.View)({
|
|
@@ -18471,9 +18940,11 @@ var TabContainer = index$a(reactNative.View)({
|
|
|
18471
18940
|
overflow: 'hidden'
|
|
18472
18941
|
});
|
|
18473
18942
|
var HeaderTabWrapper = index$a(reactNative.View)(function (_ref) {
|
|
18474
|
-
var themeInsets = _ref.themeInsets
|
|
18943
|
+
var themeInsets = _ref.themeInsets,
|
|
18944
|
+
theme = _ref.theme;
|
|
18475
18945
|
return {
|
|
18476
|
-
paddingHorizontal: Math.max(themeInsets.left, themeInsets.right)
|
|
18946
|
+
paddingHorizontal: Math.max(themeInsets.left, themeInsets.right),
|
|
18947
|
+
backgroundColor: theme.__hd__.tabs.colors.headerBackground
|
|
18477
18948
|
};
|
|
18478
18949
|
});
|
|
18479
18950
|
var HeaderTabItem = index$a(reactNative.Animated.View)(function (_ref2) {
|
|
@@ -37457,6 +37928,7 @@ var FloatingIsland = function FloatingIsland(_ref2) {
|
|
|
37457
37928
|
|
|
37458
37929
|
exports.Accordion = Accordion;
|
|
37459
37930
|
exports.Alert = Alert;
|
|
37931
|
+
exports.AppCue = AppCue;
|
|
37460
37932
|
exports.Attachment = Attachment;
|
|
37461
37933
|
exports.Avatar = index$9;
|
|
37462
37934
|
exports.Badge = Badge$1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.83.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -22,13 +22,14 @@
|
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/primitives-core": "11.0.0",
|
|
24
24
|
"@emotion/react": "^11.9.3",
|
|
25
|
-
"@hero-design/colors": "8.45.
|
|
25
|
+
"@hero-design/colors": "8.45.2",
|
|
26
26
|
"date-fns": "^2.16.1",
|
|
27
27
|
"hero-editor": "^1.9.21",
|
|
28
28
|
"nanoid": "^5.0.9"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@hero-design/react-native-month-year-picker": "^8.42.
|
|
31
|
+
"@hero-design/react-native-month-year-picker": "^8.42.11",
|
|
32
|
+
"@ptomasroos/react-native-multi-slider": "^2.2.2",
|
|
32
33
|
"@react-native-community/datetimepicker": "^3.5.2 || ^7.6.1",
|
|
33
34
|
"@react-native-community/slider": "^4.5.1",
|
|
34
35
|
"react": "18.2.0",
|
|
@@ -51,7 +52,8 @@
|
|
|
51
52
|
"@eslint/eslintrc": "^3.1.0",
|
|
52
53
|
"@eslint/js": "^9.8.0",
|
|
53
54
|
"@hero-design/eslint-plugin": "9.2.0",
|
|
54
|
-
"@hero-design/react-native-month-year-picker": "^8.42.
|
|
55
|
+
"@hero-design/react-native-month-year-picker": "^8.42.11",
|
|
56
|
+
"@ptomasroos/react-native-multi-slider": "^2.2.2",
|
|
55
57
|
"@react-native-community/datetimepicker": "7.6.1",
|
|
56
58
|
"@react-native-community/slider": "^4.5.1",
|
|
57
59
|
"@rollup/plugin-babel": "^6.0.4",
|