@ornikar/bumper 3.13.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 +6 -143
- package/dist/definitions/index.d.ts +2 -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 +141 -9
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +141 -9
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.22.cjs.js +140 -7
- package/dist/index-node-22.22.cjs.js.map +1 -1
- package/dist/index-node-22.22.cjs.web.js +140 -7
- package/dist/index-node-22.22.cjs.web.js.map +1 -1
- package/dist/index-node-22.22.es.mjs +140 -9
- package/dist/index-node-22.22.es.mjs.map +1 -1
- package/dist/index-node-22.22.es.web.mjs +140 -9
- package/dist/index-node-22.22.es.web.mjs.map +1 -1
- package/dist/index.es.js +140 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +140 -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 +2 -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
|
@@ -7,6 +7,8 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
const react = require('react');
|
|
8
8
|
const Animated = require('react-native-reanimated');
|
|
9
9
|
const Svg = require('react-native-svg');
|
|
10
|
+
const AvatarPlaceholderDisabledImage = require('./system/dataDisplays/Avatar/assets/avatar-placeholder-disabled.webp');
|
|
11
|
+
const AvatarPlaceholderImage = require('./system/dataDisplays/Avatar/assets/avatar-placeholder.webp');
|
|
10
12
|
const image = require('@tamagui/image');
|
|
11
13
|
const scrollView = require('@tamagui/scroll-view');
|
|
12
14
|
const reactNative = require('react-native');
|
|
@@ -15,6 +17,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
17
|
|
|
16
18
|
const Animated__default = /*#__PURE__*/_interopDefaultLegacy(Animated);
|
|
17
19
|
const Svg__default = /*#__PURE__*/_interopDefaultLegacy(Svg);
|
|
20
|
+
const AvatarPlaceholderDisabledImage__default = /*#__PURE__*/_interopDefaultLegacy(AvatarPlaceholderDisabledImage);
|
|
21
|
+
const AvatarPlaceholderImage__default = /*#__PURE__*/_interopDefaultLegacy(AvatarPlaceholderImage);
|
|
18
22
|
|
|
19
23
|
const createColorScale = colorScale => colorScale;
|
|
20
24
|
|
|
@@ -215,7 +219,9 @@ const light = {
|
|
|
215
219
|
'button.bg.danger.default': deepPurpleColorPalette['palette.transparent'],
|
|
216
220
|
'button.bg.danger.pressed': deepPurpleColorPalette['palette.red.1'],
|
|
217
221
|
'button.bg.danger.onContrasted.default': deepPurpleColorPalette['palette.white'],
|
|
218
|
-
'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1']
|
|
222
|
+
'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1'],
|
|
223
|
+
// Avatar
|
|
224
|
+
'avatar.bg': deepPurpleColorPalette['palette.beige.3']
|
|
219
225
|
};
|
|
220
226
|
|
|
221
227
|
const themes = {
|
|
@@ -854,7 +860,7 @@ function Icon(props) {
|
|
|
854
860
|
});
|
|
855
861
|
}
|
|
856
862
|
|
|
857
|
-
const context$
|
|
863
|
+
const context$2 = core.createStyledContext({
|
|
858
864
|
size: 'large',
|
|
859
865
|
type: 'secondary',
|
|
860
866
|
isOnContrasted: false,
|
|
@@ -886,7 +892,7 @@ function ButtonIcon({
|
|
|
886
892
|
type,
|
|
887
893
|
disabled,
|
|
888
894
|
isOnContrasted
|
|
889
|
-
} = context$
|
|
895
|
+
} = context$2.useStyledContext();
|
|
890
896
|
const color = getButtonContentColor(type, disabled, isOnContrasted);
|
|
891
897
|
return /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
892
898
|
icon: icon,
|
|
@@ -979,7 +985,7 @@ function ButtonText({
|
|
|
979
985
|
size,
|
|
980
986
|
disabled,
|
|
981
987
|
isOnContrasted
|
|
982
|
-
} = context$
|
|
988
|
+
} = context$2.useStyledContext();
|
|
983
989
|
const color = getButtonContentColor(type, disabled, isOnContrasted);
|
|
984
990
|
return /*#__PURE__*/jsxRuntime.jsxs(VStack, {
|
|
985
991
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
@@ -996,7 +1002,7 @@ function ButtonText({
|
|
|
996
1002
|
|
|
997
1003
|
const InternalButtonFrame = core.styled(HStack, {
|
|
998
1004
|
name: 'Button',
|
|
999
|
-
context: context$
|
|
1005
|
+
context: context$2,
|
|
1000
1006
|
role: 'button',
|
|
1001
1007
|
alignItems: 'center',
|
|
1002
1008
|
justifyContent: 'center',
|
|
@@ -1017,7 +1023,7 @@ const InternalButtonFrame = core.styled(HStack, {
|
|
|
1017
1023
|
const {
|
|
1018
1024
|
isOnContrasted,
|
|
1019
1025
|
disabled
|
|
1020
|
-
} = context$
|
|
1026
|
+
} = context$2.useStyledContext();
|
|
1021
1027
|
const commonTypeStyle = {
|
|
1022
1028
|
backgroundColor: `$button.bg.${type}${isOnContrasted ? '.onContrasted' : ''}.default`,
|
|
1023
1029
|
hoverStyle: {
|
|
@@ -1143,7 +1149,7 @@ const Button = core.withStaticProperties(InternalButton, {
|
|
|
1143
1149
|
|
|
1144
1150
|
const InternalIconButtonFrame = core.styled(InternalButton, {
|
|
1145
1151
|
name: 'IconButton',
|
|
1146
|
-
context: context$
|
|
1152
|
+
context: context$2,
|
|
1147
1153
|
variants: {
|
|
1148
1154
|
size: {
|
|
1149
1155
|
small: {
|
|
@@ -1171,6 +1177,132 @@ const IconButton = core.withStaticProperties(InternalIconButton, {
|
|
|
1171
1177
|
Badge: ButtonBadge
|
|
1172
1178
|
});
|
|
1173
1179
|
|
|
1180
|
+
const context$1 = core.createStyledContext({
|
|
1181
|
+
size: 'large',
|
|
1182
|
+
shape: 'square',
|
|
1183
|
+
disabled: false
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
const StyledAvatarImage = core.styled(image.Image, {
|
|
1187
|
+
width: '100%',
|
|
1188
|
+
height: '100%',
|
|
1189
|
+
objectFit: 'contain',
|
|
1190
|
+
alt: ''
|
|
1191
|
+
});
|
|
1192
|
+
const DisabledOverlay = core.styled(core.View, {
|
|
1193
|
+
position: 'absolute',
|
|
1194
|
+
width: '100%',
|
|
1195
|
+
height: '100%',
|
|
1196
|
+
backgroundColor: '$bg.base.mid.default',
|
|
1197
|
+
opacity: 0.5
|
|
1198
|
+
});
|
|
1199
|
+
function AvatarImage({
|
|
1200
|
+
src
|
|
1201
|
+
}) {
|
|
1202
|
+
const {
|
|
1203
|
+
disabled
|
|
1204
|
+
} = context$1.useStyledContext();
|
|
1205
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1206
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(StyledAvatarImage, {
|
|
1207
|
+
src: src
|
|
1208
|
+
}), disabled ? /*#__PURE__*/jsxRuntime.jsx(DisabledOverlay, {}) : null]
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
function extractInitial({
|
|
1213
|
+
firstname,
|
|
1214
|
+
lastname
|
|
1215
|
+
}) {
|
|
1216
|
+
return `${firstname[0]}${lastname[0]}`.toUpperCase();
|
|
1217
|
+
}
|
|
1218
|
+
const StyledAvatarInitial = core.styled(InternalTypography, {
|
|
1219
|
+
context: context$1,
|
|
1220
|
+
variants: {
|
|
1221
|
+
size: size => ({
|
|
1222
|
+
variant: size === 'small' ? 'label-m' : 'label-l'
|
|
1223
|
+
}),
|
|
1224
|
+
disabled: {
|
|
1225
|
+
true: {
|
|
1226
|
+
color: '$content.disabled.onContrasted'
|
|
1227
|
+
},
|
|
1228
|
+
false: {
|
|
1229
|
+
color: '$content.accent'
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
function AvatarInitial(props) {
|
|
1235
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarInitial, {
|
|
1236
|
+
children: extractInitial(props)
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
const InternalAvatarFrame = core.styled(Center, {
|
|
1241
|
+
name: 'Avatar',
|
|
1242
|
+
context: context$1,
|
|
1243
|
+
overflow: 'hidden',
|
|
1244
|
+
variants: {
|
|
1245
|
+
size: {
|
|
1246
|
+
small: {
|
|
1247
|
+
width: 32,
|
|
1248
|
+
height: 32
|
|
1249
|
+
},
|
|
1250
|
+
medium: {
|
|
1251
|
+
width: 40,
|
|
1252
|
+
height: 40
|
|
1253
|
+
},
|
|
1254
|
+
large: {
|
|
1255
|
+
width: 48,
|
|
1256
|
+
height: 48
|
|
1257
|
+
},
|
|
1258
|
+
xlarge: {
|
|
1259
|
+
width: 64,
|
|
1260
|
+
height: 64
|
|
1261
|
+
}
|
|
1262
|
+
},
|
|
1263
|
+
shape: {
|
|
1264
|
+
square: {
|
|
1265
|
+
borderRadius: '$radius.m'
|
|
1266
|
+
},
|
|
1267
|
+
circle: {
|
|
1268
|
+
borderRadius: '$radius.circle'
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1271
|
+
disabled: {
|
|
1272
|
+
true: {
|
|
1273
|
+
backgroundColor: '$bg.disabled.hi'
|
|
1274
|
+
},
|
|
1275
|
+
false: {
|
|
1276
|
+
backgroundColor: '$avatar.bg'
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
const Avatar = InternalAvatarFrame.styleable((props, ref) => {
|
|
1282
|
+
const flattenProps = useProps(props);
|
|
1283
|
+
const children = react.useMemo(() => {
|
|
1284
|
+
if (!flattenProps.src && !flattenProps.firstname && !flattenProps.lastname) {
|
|
1285
|
+
return /*#__PURE__*/jsxRuntime.jsx(AvatarImage, {
|
|
1286
|
+
src: flattenProps.disabled ? AvatarPlaceholderDisabledImage__default : AvatarPlaceholderImage__default
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
if (flattenProps.src) {
|
|
1290
|
+
return /*#__PURE__*/jsxRuntime.jsx(AvatarImage, {
|
|
1291
|
+
src: flattenProps.src
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
return /*#__PURE__*/jsxRuntime.jsx(AvatarInitial, {
|
|
1295
|
+
firstname: flattenProps.firstname ?? '',
|
|
1296
|
+
lastname: flattenProps.lastname ?? ''
|
|
1297
|
+
});
|
|
1298
|
+
}, [flattenProps.src, flattenProps.firstname, flattenProps.lastname, flattenProps.disabled]);
|
|
1299
|
+
return /*#__PURE__*/jsxRuntime.jsx(InternalAvatarFrame, {
|
|
1300
|
+
ref: ref,
|
|
1301
|
+
...props,
|
|
1302
|
+
children: children
|
|
1303
|
+
});
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1174
1306
|
const context = core.createStyledContext({
|
|
1175
1307
|
color: 'green',
|
|
1176
1308
|
size: 'small',
|
|
@@ -1417,6 +1549,7 @@ exports.View = core.View;
|
|
|
1417
1549
|
exports.Image = image.Image;
|
|
1418
1550
|
exports.ScrollView = scrollView.ScrollView;
|
|
1419
1551
|
exports.useWindowSize = reactNative.useWindowDimensions;
|
|
1552
|
+
exports.Avatar = Avatar;
|
|
1420
1553
|
exports.Badge = Badge;
|
|
1421
1554
|
exports.BumperProvider = BumperProvider;
|
|
1422
1555
|
exports.Button = Button;
|