@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.
Files changed (68) hide show
  1. package/CHANGELOG.md +12 -140
  2. package/dist/definitions/index.d.ts +4 -0
  3. package/dist/definitions/index.d.ts.map +1 -1
  4. package/dist/definitions/system/core/themes/light/light.d.ts.map +1 -1
  5. package/dist/definitions/system/core/themes/types.d.ts +3 -1
  6. package/dist/definitions/system/core/themes/types.d.ts.map +1 -1
  7. package/dist/definitions/system/dataDisplays/Avatar/Avatar.d.ts +52 -0
  8. package/dist/definitions/system/dataDisplays/Avatar/Avatar.d.ts.map +1 -0
  9. package/dist/definitions/system/dataDisplays/Avatar/components/AvatarImage.d.ts +5 -0
  10. package/dist/definitions/system/dataDisplays/Avatar/components/AvatarImage.d.ts.map +1 -0
  11. package/dist/definitions/system/dataDisplays/Avatar/components/AvatarInitial.d.ts +6 -0
  12. package/dist/definitions/system/dataDisplays/Avatar/components/AvatarInitial.d.ts.map +1 -0
  13. package/dist/definitions/system/dataDisplays/Avatar/context.d.ts +3 -0
  14. package/dist/definitions/system/dataDisplays/Avatar/context.d.ts.map +1 -0
  15. package/dist/index-metro.es.android.js +190 -9
  16. package/dist/index-metro.es.android.js.map +1 -1
  17. package/dist/index-metro.es.ios.js +190 -9
  18. package/dist/index-metro.es.ios.js.map +1 -1
  19. package/dist/index-node-22.22.cjs.js +193 -7
  20. package/dist/index-node-22.22.cjs.js.map +1 -1
  21. package/dist/index-node-22.22.cjs.web.js +193 -7
  22. package/dist/index-node-22.22.cjs.web.js.map +1 -1
  23. package/dist/index-node-22.22.es.mjs +192 -9
  24. package/dist/index-node-22.22.es.mjs.map +1 -1
  25. package/dist/index-node-22.22.es.web.mjs +192 -9
  26. package/dist/index-node-22.22.es.web.mjs.map +1 -1
  27. package/dist/index.es.js +193 -9
  28. package/dist/index.es.js.map +1 -1
  29. package/dist/index.es.web.js +193 -9
  30. package/dist/index.es.web.js.map +1 -1
  31. package/dist/storybook-metro.es.android.js +3 -1
  32. package/dist/storybook-metro.es.android.js.map +1 -1
  33. package/dist/storybook-metro.es.ios.js +3 -1
  34. package/dist/storybook-metro.es.ios.js.map +1 -1
  35. package/dist/storybook-node-22.22.cjs.js +3 -1
  36. package/dist/storybook-node-22.22.cjs.js.map +1 -1
  37. package/dist/storybook-node-22.22.cjs.web.js +3 -1
  38. package/dist/storybook-node-22.22.cjs.web.js.map +1 -1
  39. package/dist/storybook-node-22.22.es.mjs +3 -1
  40. package/dist/storybook-node-22.22.es.mjs.map +1 -1
  41. package/dist/storybook-node-22.22.es.web.mjs +3 -1
  42. package/dist/storybook-node-22.22.es.web.mjs.map +1 -1
  43. package/dist/storybook.es.js +3 -1
  44. package/dist/storybook.es.js.map +1 -1
  45. package/dist/storybook.es.web.js +3 -1
  46. package/dist/storybook.es.web.js.map +1 -1
  47. package/dist/tsbuildinfo +1 -1
  48. package/docs/migration/Avatar.md +228 -0
  49. package/package.json +1 -1
  50. package/src/Bumper.mdx +1 -0
  51. package/src/index.ts +6 -0
  52. package/src/system/core/themes/light/__snapshots__/light.stories.tsx.snap +73 -0
  53. package/src/system/core/themes/light/__snapshots_web__/light.stories.tsx.snap +21 -0
  54. package/src/system/core/themes/light/light.ts +3 -0
  55. package/src/system/core/themes/types.ts +5 -1
  56. package/src/system/dataDisplays/Avatar/Avatar.features.stories.tsx +110 -0
  57. package/src/system/dataDisplays/Avatar/Avatar.mdx +73 -0
  58. package/src/system/dataDisplays/Avatar/Avatar.stories.tsx +47 -0
  59. package/src/system/dataDisplays/Avatar/Avatar.tsx +124 -0
  60. package/src/system/dataDisplays/Avatar/__snapshots__/Avatar.features.stories.tsx.snap +891 -0
  61. package/src/system/dataDisplays/Avatar/__snapshots__/Avatar.stories.tsx.snap +50 -0
  62. package/src/system/dataDisplays/Avatar/__snapshots_web__/Avatar.features.stories.tsx.snap +545 -0
  63. package/src/system/dataDisplays/Avatar/__snapshots_web__/Avatar.stories.tsx.snap +37 -0
  64. package/src/system/dataDisplays/Avatar/assets/avatar-placeholder-disabled.webp +0 -0
  65. package/src/system/dataDisplays/Avatar/assets/avatar-placeholder.webp +0 -0
  66. package/src/system/dataDisplays/Avatar/components/AvatarImage.tsx +34 -0
  67. package/src/system/dataDisplays/Avatar/components/AvatarInitial.tsx +30 -0
  68. package/src/system/dataDisplays/Avatar/context.ts +10 -0
@@ -1,11 +1,14 @@
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
3
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
4
- import { jsx, jsxs } from 'react/jsx-runtime';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
6
  import { useEffect, cloneElement, useMemo } from 'react';
7
7
  import Animated, { Easing, useAnimatedProps, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
8
8
  import Svg, { Circle } from 'react-native-svg';
9
+ import AvatarPlaceholderDisabledImage from './system/dataDisplays/Avatar/assets/avatar-placeholder-disabled.webp';
10
+ import AvatarPlaceholderImage from './system/dataDisplays/Avatar/assets/avatar-placeholder.webp';
11
+ import { Image } from '@tamagui/image';
9
12
  export { Image } from '@tamagui/image';
10
13
  export { ScrollView } from '@tamagui/scroll-view';
11
14
  export { useWindowDimensions as useWindowSize } from 'react-native';
@@ -208,7 +211,9 @@ const light = {
208
211
  'button.bg.danger.default': deepPurpleColorPalette['palette.transparent'],
209
212
  'button.bg.danger.pressed': deepPurpleColorPalette['palette.red.1'],
210
213
  'button.bg.danger.onContrasted.default': deepPurpleColorPalette['palette.white'],
211
- 'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1']
214
+ 'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1'],
215
+ // Avatar
216
+ 'avatar.bg': deepPurpleColorPalette['palette.beige.3']
212
217
  };
213
218
 
214
219
  const themes = {
@@ -834,7 +839,7 @@ function Icon(props) {
834
839
  return /*#__PURE__*/jsx(InternalIcon, _objectSpread({}, props));
835
840
  }
836
841
 
837
- const context$1 = createStyledContext({
842
+ const context$2 = createStyledContext({
838
843
  size: 'large',
839
844
  type: 'secondary',
840
845
  isOnContrasted: false,
@@ -866,7 +871,7 @@ function ButtonIcon({
866
871
  type,
867
872
  disabled,
868
873
  isOnContrasted
869
- } = context$1.useStyledContext();
874
+ } = context$2.useStyledContext();
870
875
  const color = getButtonContentColor(type, disabled, isOnContrasted);
871
876
  return /*#__PURE__*/jsx(Icon, {
872
877
  icon: icon,
@@ -953,7 +958,7 @@ function ButtonText({
953
958
  size,
954
959
  disabled,
955
960
  isOnContrasted
956
- } = context$1.useStyledContext();
961
+ } = context$2.useStyledContext();
957
962
  const color = getButtonContentColor(type, disabled, isOnContrasted);
958
963
  return /*#__PURE__*/jsxs(VStack, {
959
964
  children: [/*#__PURE__*/jsx(Typography.Text, {
@@ -970,7 +975,7 @@ function ButtonText({
970
975
 
971
976
  const InternalButtonFrame = styled(HStack, {
972
977
  name: 'Button',
973
- context: context$1,
978
+ context: context$2,
974
979
  role: 'button',
975
980
  alignItems: 'center',
976
981
  justifyContent: 'center',
@@ -991,7 +996,7 @@ const InternalButtonFrame = styled(HStack, {
991
996
  const {
992
997
  isOnContrasted,
993
998
  disabled
994
- } = context$1.useStyledContext();
999
+ } = context$2.useStyledContext();
995
1000
  const commonTypeStyle = {
996
1001
  backgroundColor: `$button.bg.${type}${isOnContrasted ? '.onContrasted' : ''}.default`,
997
1002
  hoverStyle: {
@@ -1112,7 +1117,7 @@ const Button = withStaticProperties(InternalButton, {
1112
1117
 
1113
1118
  const InternalIconButtonFrame = styled(InternalButton, {
1114
1119
  name: 'IconButton',
1115
- context: context$1,
1120
+ context: context$2,
1116
1121
  variants: {
1117
1122
  size: {
1118
1123
  small: {
@@ -1138,6 +1143,133 @@ const IconButton = withStaticProperties(InternalIconButton, {
1138
1143
  Badge: ButtonBadge
1139
1144
  });
1140
1145
 
1146
+ const context$1 = createStyledContext({
1147
+ size: 'large',
1148
+ shape: 'square',
1149
+ disabled: false
1150
+ });
1151
+
1152
+ const StyledAvatarImage = styled(Image, {
1153
+ width: '100%',
1154
+ height: '100%',
1155
+ objectFit: 'contain',
1156
+ alt: ''
1157
+ });
1158
+ const DisabledOverlay = styled(View, {
1159
+ position: 'absolute',
1160
+ width: '100%',
1161
+ height: '100%',
1162
+ backgroundColor: '$bg.base.mid.default',
1163
+ opacity: 0.5
1164
+ });
1165
+ function AvatarImage({
1166
+ src
1167
+ }) {
1168
+ const {
1169
+ disabled
1170
+ } = context$1.useStyledContext();
1171
+ return /*#__PURE__*/jsxs(Fragment, {
1172
+ children: [/*#__PURE__*/jsx(StyledAvatarImage, {
1173
+ src: src
1174
+ }), disabled ? /*#__PURE__*/jsx(DisabledOverlay, {}) : null]
1175
+ });
1176
+ }
1177
+
1178
+ function extractInitial({
1179
+ firstname,
1180
+ lastname
1181
+ }) {
1182
+ return `${firstname[0]}${lastname[0]}`.toUpperCase();
1183
+ }
1184
+ const StyledAvatarInitial = styled(InternalTypography, {
1185
+ context: context$1,
1186
+ variants: {
1187
+ size: size => ({
1188
+ variant: size === 'small' ? 'label-m' : 'label-l'
1189
+ }),
1190
+ disabled: {
1191
+ true: {
1192
+ color: '$content.disabled.onContrasted'
1193
+ },
1194
+ false: {
1195
+ color: '$content.accent'
1196
+ }
1197
+ }
1198
+ }
1199
+ });
1200
+ function AvatarInitial(props) {
1201
+ return /*#__PURE__*/jsx(StyledAvatarInitial, {
1202
+ children: extractInitial(props)
1203
+ });
1204
+ }
1205
+
1206
+ const InternalAvatarFrame = styled(Center, {
1207
+ name: 'Avatar',
1208
+ context: context$1,
1209
+ overflow: 'hidden',
1210
+ variants: {
1211
+ size: {
1212
+ small: {
1213
+ width: 32,
1214
+ height: 32
1215
+ },
1216
+ medium: {
1217
+ width: 40,
1218
+ height: 40
1219
+ },
1220
+ large: {
1221
+ width: 48,
1222
+ height: 48
1223
+ },
1224
+ xlarge: {
1225
+ width: 64,
1226
+ height: 64
1227
+ }
1228
+ },
1229
+ shape: {
1230
+ square: {
1231
+ borderRadius: '$radius.m'
1232
+ },
1233
+ circle: {
1234
+ borderRadius: '$radius.circle'
1235
+ }
1236
+ },
1237
+ disabled: {
1238
+ true: {
1239
+ backgroundColor: '$bg.disabled.hi'
1240
+ },
1241
+ false: {
1242
+ backgroundColor: '$avatar.bg'
1243
+ }
1244
+ }
1245
+ }
1246
+ });
1247
+ const Avatar = InternalAvatarFrame.styleable((props, ref) => {
1248
+ const flattenProps = useProps(props);
1249
+ const children = useMemo(() => {
1250
+ var _flattenProps$firstna, _flattenProps$lastnam;
1251
+ if (!flattenProps.src && !flattenProps.firstname && !flattenProps.lastname) {
1252
+ return /*#__PURE__*/jsx(AvatarImage, {
1253
+ src: flattenProps.disabled ? AvatarPlaceholderDisabledImage : AvatarPlaceholderImage
1254
+ });
1255
+ }
1256
+ if (flattenProps.src) {
1257
+ return /*#__PURE__*/jsx(AvatarImage, {
1258
+ src: flattenProps.src
1259
+ });
1260
+ }
1261
+ return /*#__PURE__*/jsx(AvatarInitial, {
1262
+ firstname: (_flattenProps$firstna = flattenProps.firstname) !== null && _flattenProps$firstna !== void 0 ? _flattenProps$firstna : '',
1263
+ lastname: (_flattenProps$lastnam = flattenProps.lastname) !== null && _flattenProps$lastnam !== void 0 ? _flattenProps$lastnam : ''
1264
+ });
1265
+ }, [flattenProps.src, flattenProps.firstname, flattenProps.lastname, flattenProps.disabled]);
1266
+ return /*#__PURE__*/jsx(InternalAvatarFrame, _objectSpread(_objectSpread({
1267
+ ref: ref
1268
+ }, props), {}, {
1269
+ children: children
1270
+ }));
1271
+ });
1272
+
1141
1273
  const context = createStyledContext({
1142
1274
  color: 'green',
1143
1275
  size: 'small',
@@ -1327,5 +1459,54 @@ function SwitchBreakpoints(values) {
1327
1459
  return getValueForBreakpoint(breakpoint, values);
1328
1460
  }
1329
1461
 
1330
- export { Badge, BumperProvider, Button, Center, HStack, IconButton, Loader, Pressable, Sticker, SwitchBreakpoints, Typography, VStack, getValueForBreakpoint, useBreakpointValue, useCurrentBreakpointName };
1462
+ const InternalDividerFrame = styled(View, {
1463
+ name: 'Divider',
1464
+ alignSelf: 'stretch',
1465
+ variants: {
1466
+ type: {
1467
+ subtle: {},
1468
+ strong: {}
1469
+ },
1470
+ isVertical: {
1471
+ true: (_, {
1472
+ props
1473
+ }) => ({
1474
+ width: props.type === 'strong' ? 8 : 1
1475
+ }),
1476
+ false: (_, {
1477
+ props
1478
+ }) => ({
1479
+ height: props.type === 'strong' ? 8 : 1
1480
+ })
1481
+ },
1482
+ isOnContrasted: {
1483
+ true: (_, {
1484
+ props
1485
+ }) => ({
1486
+ backgroundColor: props.type === 'strong' ? '$divider.border.strong.onContrasted' : '$divider.border.subtle.onContrasted'
1487
+ }),
1488
+ false: (_, {
1489
+ props
1490
+ }) => ({
1491
+ backgroundColor: props.type === 'strong' ? '$divider.border.strong' : '$divider.border.subtle'
1492
+ })
1493
+ }
1494
+ },
1495
+ defaultVariants: {
1496
+ type: 'subtle',
1497
+ isVertical: false,
1498
+ isOnContrasted: false
1499
+ }
1500
+ });
1501
+ const InternalDivider = InternalDividerFrame.styleable((props, ref) => {
1502
+ const flattenProps = useProps(props);
1503
+ return /*#__PURE__*/jsx(InternalDividerFrame, _objectSpread({
1504
+ ref: ref
1505
+ }, flattenProps));
1506
+ });
1507
+ function Divider(props) {
1508
+ return /*#__PURE__*/jsx(InternalDivider, _objectSpread({}, props));
1509
+ }
1510
+
1511
+ export { Avatar, Badge, BumperProvider, Button, Center, Divider, HStack, IconButton, Loader, Pressable, Sticker, SwitchBreakpoints, Typography, VStack, getValueForBreakpoint, useBreakpointValue, useCurrentBreakpointName };
1331
1512
  //# sourceMappingURL=index-metro.es.ios.js.map