@ornikar/bumper 3.12.0 → 3.14.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 +12 -140
- package/dist/definitions/index.d.ts +4 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/system/core/themes/light/light.d.ts.map +1 -1
- package/dist/definitions/system/core/themes/types.d.ts +3 -1
- package/dist/definitions/system/core/themes/types.d.ts.map +1 -1
- package/dist/definitions/system/dataDisplays/Avatar/Avatar.d.ts +52 -0
- package/dist/definitions/system/dataDisplays/Avatar/Avatar.d.ts.map +1 -0
- package/dist/definitions/system/dataDisplays/Avatar/components/AvatarImage.d.ts +5 -0
- package/dist/definitions/system/dataDisplays/Avatar/components/AvatarImage.d.ts.map +1 -0
- package/dist/definitions/system/dataDisplays/Avatar/components/AvatarInitial.d.ts +6 -0
- package/dist/definitions/system/dataDisplays/Avatar/components/AvatarInitial.d.ts.map +1 -0
- package/dist/definitions/system/dataDisplays/Avatar/context.d.ts +3 -0
- package/dist/definitions/system/dataDisplays/Avatar/context.d.ts.map +1 -0
- package/dist/index-metro.es.android.js +190 -9
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +190 -9
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.22.cjs.js +193 -7
- package/dist/index-node-22.22.cjs.js.map +1 -1
- package/dist/index-node-22.22.cjs.web.js +193 -7
- package/dist/index-node-22.22.cjs.web.js.map +1 -1
- package/dist/index-node-22.22.es.mjs +192 -9
- package/dist/index-node-22.22.es.mjs.map +1 -1
- package/dist/index-node-22.22.es.web.mjs +192 -9
- package/dist/index-node-22.22.es.web.mjs.map +1 -1
- package/dist/index.es.js +193 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +193 -9
- package/dist/index.es.web.js.map +1 -1
- package/dist/storybook-metro.es.android.js +3 -1
- package/dist/storybook-metro.es.android.js.map +1 -1
- package/dist/storybook-metro.es.ios.js +3 -1
- package/dist/storybook-metro.es.ios.js.map +1 -1
- package/dist/storybook-node-22.22.cjs.js +3 -1
- package/dist/storybook-node-22.22.cjs.js.map +1 -1
- package/dist/storybook-node-22.22.cjs.web.js +3 -1
- package/dist/storybook-node-22.22.cjs.web.js.map +1 -1
- package/dist/storybook-node-22.22.es.mjs +3 -1
- package/dist/storybook-node-22.22.es.mjs.map +1 -1
- package/dist/storybook-node-22.22.es.web.mjs +3 -1
- package/dist/storybook-node-22.22.es.web.mjs.map +1 -1
- package/dist/storybook.es.js +3 -1
- package/dist/storybook.es.js.map +1 -1
- package/dist/storybook.es.web.js +3 -1
- package/dist/storybook.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/docs/migration/Avatar.md +228 -0
- package/package.json +1 -1
- package/src/Bumper.mdx +1 -0
- package/src/index.ts +6 -0
- package/src/system/core/themes/light/__snapshots__/light.stories.tsx.snap +73 -0
- package/src/system/core/themes/light/__snapshots_web__/light.stories.tsx.snap +21 -0
- package/src/system/core/themes/light/light.ts +3 -0
- package/src/system/core/themes/types.ts +5 -1
- package/src/system/dataDisplays/Avatar/Avatar.features.stories.tsx +110 -0
- package/src/system/dataDisplays/Avatar/Avatar.mdx +73 -0
- package/src/system/dataDisplays/Avatar/Avatar.stories.tsx +47 -0
- package/src/system/dataDisplays/Avatar/Avatar.tsx +124 -0
- package/src/system/dataDisplays/Avatar/__snapshots__/Avatar.features.stories.tsx.snap +891 -0
- package/src/system/dataDisplays/Avatar/__snapshots__/Avatar.stories.tsx.snap +50 -0
- package/src/system/dataDisplays/Avatar/__snapshots_web__/Avatar.features.stories.tsx.snap +545 -0
- package/src/system/dataDisplays/Avatar/__snapshots_web__/Avatar.stories.tsx.snap +37 -0
- package/src/system/dataDisplays/Avatar/assets/avatar-placeholder-disabled.webp +0 -0
- package/src/system/dataDisplays/Avatar/assets/avatar-placeholder.webp +0 -0
- package/src/system/dataDisplays/Avatar/components/AvatarImage.tsx +34 -0
- package/src/system/dataDisplays/Avatar/components/AvatarInitial.tsx +30 -0
- package/src/system/dataDisplays/Avatar/context.ts +10 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { px, createFont, createTokens, createTamagui, TamaguiProvider, styled, View, Stack, useProps as useProps$1, useStyle, createStyledContext, Text, withStaticProperties, useMedia } from '@tamagui/core';
|
|
2
2
|
export { Stack, View } from '@tamagui/core';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useEffect, cloneElement, useMemo } from 'react';
|
|
5
5
|
import Animated, { Easing, useAnimatedProps, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
|
6
6
|
import Svg, { Circle } from 'react-native-svg';
|
|
7
|
+
import AvatarPlaceholderDisabledImage from './system/dataDisplays/Avatar/assets/avatar-placeholder-disabled.webp';
|
|
8
|
+
import AvatarPlaceholderImage from './system/dataDisplays/Avatar/assets/avatar-placeholder.webp';
|
|
9
|
+
import { Image } from '@tamagui/image';
|
|
7
10
|
export { Image } from '@tamagui/image';
|
|
8
11
|
export { ScrollView } from '@tamagui/scroll-view';
|
|
9
12
|
export { useWindowDimensions as useWindowSize } from 'react-native';
|
|
@@ -207,7 +210,9 @@ const light = {
|
|
|
207
210
|
'button.bg.danger.default': deepPurpleColorPalette['palette.transparent'],
|
|
208
211
|
'button.bg.danger.pressed': deepPurpleColorPalette['palette.red.1'],
|
|
209
212
|
'button.bg.danger.onContrasted.default': deepPurpleColorPalette['palette.white'],
|
|
210
|
-
'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1']
|
|
213
|
+
'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1'],
|
|
214
|
+
// Avatar
|
|
215
|
+
'avatar.bg': deepPurpleColorPalette['palette.beige.3']
|
|
211
216
|
};
|
|
212
217
|
|
|
213
218
|
const themes = {
|
|
@@ -846,7 +851,7 @@ function Icon(props) {
|
|
|
846
851
|
});
|
|
847
852
|
}
|
|
848
853
|
|
|
849
|
-
const context$
|
|
854
|
+
const context$2 = createStyledContext({
|
|
850
855
|
size: 'large',
|
|
851
856
|
type: 'secondary',
|
|
852
857
|
isOnContrasted: false,
|
|
@@ -878,7 +883,7 @@ function ButtonIcon({
|
|
|
878
883
|
type,
|
|
879
884
|
disabled,
|
|
880
885
|
isOnContrasted
|
|
881
|
-
} = context$
|
|
886
|
+
} = context$2.useStyledContext();
|
|
882
887
|
const color = getButtonContentColor(type, disabled, isOnContrasted);
|
|
883
888
|
return /*#__PURE__*/jsx(Icon, {
|
|
884
889
|
icon: icon,
|
|
@@ -971,7 +976,7 @@ function ButtonText({
|
|
|
971
976
|
size,
|
|
972
977
|
disabled,
|
|
973
978
|
isOnContrasted
|
|
974
|
-
} = context$
|
|
979
|
+
} = context$2.useStyledContext();
|
|
975
980
|
const color = getButtonContentColor(type, disabled, isOnContrasted);
|
|
976
981
|
return /*#__PURE__*/jsxs(VStack, {
|
|
977
982
|
children: [/*#__PURE__*/jsx(Typography.Text, {
|
|
@@ -988,7 +993,7 @@ function ButtonText({
|
|
|
988
993
|
|
|
989
994
|
const InternalButtonFrame = styled(HStack, {
|
|
990
995
|
name: 'Button',
|
|
991
|
-
context: context$
|
|
996
|
+
context: context$2,
|
|
992
997
|
role: 'button',
|
|
993
998
|
alignItems: 'center',
|
|
994
999
|
justifyContent: 'center',
|
|
@@ -1009,7 +1014,7 @@ const InternalButtonFrame = styled(HStack, {
|
|
|
1009
1014
|
const {
|
|
1010
1015
|
isOnContrasted,
|
|
1011
1016
|
disabled
|
|
1012
|
-
} = context$
|
|
1017
|
+
} = context$2.useStyledContext();
|
|
1013
1018
|
const commonTypeStyle = {
|
|
1014
1019
|
backgroundColor: `$button.bg.${type}${isOnContrasted ? '.onContrasted' : ''}.default`,
|
|
1015
1020
|
hoverStyle: {
|
|
@@ -1135,7 +1140,7 @@ const Button = withStaticProperties(InternalButton, {
|
|
|
1135
1140
|
|
|
1136
1141
|
const InternalIconButtonFrame = styled(InternalButton, {
|
|
1137
1142
|
name: 'IconButton',
|
|
1138
|
-
context: context$
|
|
1143
|
+
context: context$2,
|
|
1139
1144
|
variants: {
|
|
1140
1145
|
size: {
|
|
1141
1146
|
small: {
|
|
@@ -1163,6 +1168,132 @@ const IconButton = withStaticProperties(InternalIconButton, {
|
|
|
1163
1168
|
Badge: ButtonBadge
|
|
1164
1169
|
});
|
|
1165
1170
|
|
|
1171
|
+
const context$1 = createStyledContext({
|
|
1172
|
+
size: 'large',
|
|
1173
|
+
shape: 'square',
|
|
1174
|
+
disabled: false
|
|
1175
|
+
});
|
|
1176
|
+
|
|
1177
|
+
const StyledAvatarImage = styled(Image, {
|
|
1178
|
+
width: '100%',
|
|
1179
|
+
height: '100%',
|
|
1180
|
+
objectFit: 'contain',
|
|
1181
|
+
alt: ''
|
|
1182
|
+
});
|
|
1183
|
+
const DisabledOverlay = styled(View, {
|
|
1184
|
+
position: 'absolute',
|
|
1185
|
+
width: '100%',
|
|
1186
|
+
height: '100%',
|
|
1187
|
+
backgroundColor: '$bg.base.mid.default',
|
|
1188
|
+
opacity: 0.5
|
|
1189
|
+
});
|
|
1190
|
+
function AvatarImage({
|
|
1191
|
+
src
|
|
1192
|
+
}) {
|
|
1193
|
+
const {
|
|
1194
|
+
disabled
|
|
1195
|
+
} = context$1.useStyledContext();
|
|
1196
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
1197
|
+
children: [/*#__PURE__*/jsx(StyledAvatarImage, {
|
|
1198
|
+
src: src
|
|
1199
|
+
}), disabled ? /*#__PURE__*/jsx(DisabledOverlay, {}) : null]
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
function extractInitial({
|
|
1204
|
+
firstname,
|
|
1205
|
+
lastname
|
|
1206
|
+
}) {
|
|
1207
|
+
return `${firstname[0]}${lastname[0]}`.toUpperCase();
|
|
1208
|
+
}
|
|
1209
|
+
const StyledAvatarInitial = styled(InternalTypography, {
|
|
1210
|
+
context: context$1,
|
|
1211
|
+
variants: {
|
|
1212
|
+
size: size => ({
|
|
1213
|
+
variant: size === 'small' ? 'label-m' : 'label-l'
|
|
1214
|
+
}),
|
|
1215
|
+
disabled: {
|
|
1216
|
+
true: {
|
|
1217
|
+
color: '$content.disabled.onContrasted'
|
|
1218
|
+
},
|
|
1219
|
+
false: {
|
|
1220
|
+
color: '$content.accent'
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
function AvatarInitial(props) {
|
|
1226
|
+
return /*#__PURE__*/jsx(StyledAvatarInitial, {
|
|
1227
|
+
children: extractInitial(props)
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
const InternalAvatarFrame = styled(Center, {
|
|
1232
|
+
name: 'Avatar',
|
|
1233
|
+
context: context$1,
|
|
1234
|
+
overflow: 'hidden',
|
|
1235
|
+
variants: {
|
|
1236
|
+
size: {
|
|
1237
|
+
small: {
|
|
1238
|
+
width: 32,
|
|
1239
|
+
height: 32
|
|
1240
|
+
},
|
|
1241
|
+
medium: {
|
|
1242
|
+
width: 40,
|
|
1243
|
+
height: 40
|
|
1244
|
+
},
|
|
1245
|
+
large: {
|
|
1246
|
+
width: 48,
|
|
1247
|
+
height: 48
|
|
1248
|
+
},
|
|
1249
|
+
xlarge: {
|
|
1250
|
+
width: 64,
|
|
1251
|
+
height: 64
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
shape: {
|
|
1255
|
+
square: {
|
|
1256
|
+
borderRadius: '$radius.m'
|
|
1257
|
+
},
|
|
1258
|
+
circle: {
|
|
1259
|
+
borderRadius: '$radius.circle'
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
disabled: {
|
|
1263
|
+
true: {
|
|
1264
|
+
backgroundColor: '$bg.disabled.hi'
|
|
1265
|
+
},
|
|
1266
|
+
false: {
|
|
1267
|
+
backgroundColor: '$avatar.bg'
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
const Avatar = InternalAvatarFrame.styleable((props, ref) => {
|
|
1273
|
+
const flattenProps = useProps(props);
|
|
1274
|
+
const children = useMemo(() => {
|
|
1275
|
+
if (!flattenProps.src && !flattenProps.firstname && !flattenProps.lastname) {
|
|
1276
|
+
return /*#__PURE__*/jsx(AvatarImage, {
|
|
1277
|
+
src: flattenProps.disabled ? AvatarPlaceholderDisabledImage : AvatarPlaceholderImage
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
if (flattenProps.src) {
|
|
1281
|
+
return /*#__PURE__*/jsx(AvatarImage, {
|
|
1282
|
+
src: flattenProps.src
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
return /*#__PURE__*/jsx(AvatarInitial, {
|
|
1286
|
+
firstname: flattenProps.firstname ?? '',
|
|
1287
|
+
lastname: flattenProps.lastname ?? ''
|
|
1288
|
+
});
|
|
1289
|
+
}, [flattenProps.src, flattenProps.firstname, flattenProps.lastname, flattenProps.disabled]);
|
|
1290
|
+
return /*#__PURE__*/jsx(InternalAvatarFrame, {
|
|
1291
|
+
ref: ref,
|
|
1292
|
+
...props,
|
|
1293
|
+
children: children
|
|
1294
|
+
});
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1166
1297
|
const context = createStyledContext({
|
|
1167
1298
|
color: 'green',
|
|
1168
1299
|
size: 'small',
|
|
@@ -1352,5 +1483,57 @@ function SwitchBreakpoints(values) {
|
|
|
1352
1483
|
return getValueForBreakpoint(breakpoint, values);
|
|
1353
1484
|
}
|
|
1354
1485
|
|
|
1355
|
-
|
|
1486
|
+
const InternalDividerFrame = styled(View, {
|
|
1487
|
+
name: 'Divider',
|
|
1488
|
+
alignSelf: 'stretch',
|
|
1489
|
+
variants: {
|
|
1490
|
+
type: {
|
|
1491
|
+
subtle: {},
|
|
1492
|
+
strong: {}
|
|
1493
|
+
},
|
|
1494
|
+
isVertical: {
|
|
1495
|
+
true: (_, {
|
|
1496
|
+
props
|
|
1497
|
+
}) => ({
|
|
1498
|
+
width: props.type === 'strong' ? 8 : 1
|
|
1499
|
+
}),
|
|
1500
|
+
false: (_, {
|
|
1501
|
+
props
|
|
1502
|
+
}) => ({
|
|
1503
|
+
height: props.type === 'strong' ? 8 : 1
|
|
1504
|
+
})
|
|
1505
|
+
},
|
|
1506
|
+
isOnContrasted: {
|
|
1507
|
+
true: (_, {
|
|
1508
|
+
props
|
|
1509
|
+
}) => ({
|
|
1510
|
+
backgroundColor: props.type === 'strong' ? '$divider.border.strong.onContrasted' : '$divider.border.subtle.onContrasted'
|
|
1511
|
+
}),
|
|
1512
|
+
false: (_, {
|
|
1513
|
+
props
|
|
1514
|
+
}) => ({
|
|
1515
|
+
backgroundColor: props.type === 'strong' ? '$divider.border.strong' : '$divider.border.subtle'
|
|
1516
|
+
})
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
defaultVariants: {
|
|
1520
|
+
type: 'subtle',
|
|
1521
|
+
isVertical: false,
|
|
1522
|
+
isOnContrasted: false
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
const InternalDivider = InternalDividerFrame.styleable((props, ref) => {
|
|
1526
|
+
const flattenProps = useProps(props);
|
|
1527
|
+
return /*#__PURE__*/jsx(InternalDividerFrame, {
|
|
1528
|
+
ref: ref,
|
|
1529
|
+
...flattenProps
|
|
1530
|
+
});
|
|
1531
|
+
});
|
|
1532
|
+
function Divider(props) {
|
|
1533
|
+
return /*#__PURE__*/jsx(InternalDivider, {
|
|
1534
|
+
...props
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
export { Avatar, Badge, BumperProvider, Button, Center, Divider, HStack, IconButton, Loader, Pressable, Sticker, SwitchBreakpoints, Typography, VStack, getValueForBreakpoint, useBreakpointValue, useCurrentBreakpointName };
|
|
1356
1539
|
//# sourceMappingURL=index-node-22.22.es.mjs.map
|