@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
@@ -3,11 +3,14 @@ export { Stack, View } from '@tamagui/core';
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
5
5
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
6
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
8
8
  import { useEffect, cloneElement, useMemo } from 'react';
9
9
  import Animated, { Easing, useAnimatedProps, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
10
10
  import Svg, { Circle } from 'react-native-svg';
11
+ import AvatarPlaceholderDisabledImage from './system/dataDisplays/Avatar/assets/avatar-placeholder-disabled.webp';
12
+ import AvatarPlaceholderImage from './system/dataDisplays/Avatar/assets/avatar-placeholder.webp';
13
+ import { Image } from '@tamagui/image';
11
14
  export { Image } from '@tamagui/image';
12
15
  export { ScrollView } from '@tamagui/scroll-view';
13
16
  export { useWindowDimensions as useWindowSize } from 'react-native';
@@ -218,7 +221,9 @@ var light = {
218
221
  'button.bg.danger.default': deepPurpleColorPalette['palette.transparent'],
219
222
  'button.bg.danger.pressed': deepPurpleColorPalette['palette.red.1'],
220
223
  'button.bg.danger.onContrasted.default': deepPurpleColorPalette['palette.white'],
221
- 'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1']
224
+ 'button.bg.danger.onContrasted.pressed': deepPurpleColorPalette['palette.red.1'],
225
+ // Avatar
226
+ 'avatar.bg': deepPurpleColorPalette['palette.beige.3']
222
227
  };
223
228
 
224
229
  var themes = {
@@ -823,7 +828,7 @@ function Icon(props) {
823
828
  return /*#__PURE__*/jsx(InternalIcon, _objectSpread({}, props));
824
829
  }
825
830
 
826
- var context$1 = createStyledContext({
831
+ var context$2 = createStyledContext({
827
832
  size: 'large',
828
833
  type: 'secondary',
829
834
  isOnContrasted: false,
@@ -850,7 +855,7 @@ function getButtonContentColor(type, disabled, isOnContrasted) {
850
855
 
851
856
  function ButtonIcon(_ref) {
852
857
  var icon = _ref.icon;
853
- var _context$useStyledCon = context$1.useStyledContext(),
858
+ var _context$useStyledCon = context$2.useStyledContext(),
854
859
  type = _context$useStyledCon.type,
855
860
  disabled = _context$useStyledCon.disabled,
856
861
  isOnContrasted = _context$useStyledCon.isOnContrasted;
@@ -934,7 +939,7 @@ var Typography = {
934
939
 
935
940
  function ButtonText(_ref) {
936
941
  var children = _ref.children;
937
- var _context$useStyledCon = context$1.useStyledContext(),
942
+ var _context$useStyledCon = context$2.useStyledContext(),
938
943
  type = _context$useStyledCon.type,
939
944
  size = _context$useStyledCon.size,
940
945
  disabled = _context$useStyledCon.disabled,
@@ -955,7 +960,7 @@ function ButtonText(_ref) {
955
960
 
956
961
  var InternalButtonFrame = styled(HStack, {
957
962
  name: 'Button',
958
- context: context$1,
963
+ context: context$2,
959
964
  role: 'button',
960
965
  alignItems: 'center',
961
966
  justifyContent: 'center',
@@ -973,7 +978,7 @@ var InternalButtonFrame = styled(HStack, {
973
978
  },
974
979
  variants: {
975
980
  type: function (_type) {
976
- var _context$useStyledCon = context$1.useStyledContext(),
981
+ var _context$useStyledCon = context$2.useStyledContext(),
977
982
  isOnContrasted = _context$useStyledCon.isOnContrasted,
978
983
  disabled = _context$useStyledCon.disabled;
979
984
  var commonTypeStyle = {
@@ -1096,7 +1101,7 @@ var Button = withStaticProperties(InternalButton, {
1096
1101
 
1097
1102
  var InternalIconButtonFrame = styled(InternalButton, {
1098
1103
  name: 'IconButton',
1099
- context: context$1,
1104
+ context: context$2,
1100
1105
  variants: {
1101
1106
  size: {
1102
1107
  small: {
@@ -1122,6 +1127,132 @@ var IconButton = withStaticProperties(InternalIconButton, {
1122
1127
  Badge: ButtonBadge
1123
1128
  });
1124
1129
 
1130
+ var context$1 = createStyledContext({
1131
+ size: 'large',
1132
+ shape: 'square',
1133
+ disabled: false
1134
+ });
1135
+
1136
+ var StyledAvatarImage = styled(Image, {
1137
+ width: '100%',
1138
+ height: '100%',
1139
+ objectFit: 'contain',
1140
+ alt: ''
1141
+ });
1142
+ var DisabledOverlay = styled(View, {
1143
+ position: 'absolute',
1144
+ width: '100%',
1145
+ height: '100%',
1146
+ backgroundColor: '$bg.base.mid.default',
1147
+ opacity: 0.5
1148
+ });
1149
+ function AvatarImage(_ref) {
1150
+ var src = _ref.src;
1151
+ var _context$useStyledCon = context$1.useStyledContext(),
1152
+ disabled = _context$useStyledCon.disabled;
1153
+ return /*#__PURE__*/jsxs(Fragment, {
1154
+ children: [/*#__PURE__*/jsx(StyledAvatarImage, {
1155
+ src: src
1156
+ }), disabled ? /*#__PURE__*/jsx(DisabledOverlay, {}) : null]
1157
+ });
1158
+ }
1159
+
1160
+ function extractInitial(_ref) {
1161
+ var firstname = _ref.firstname,
1162
+ lastname = _ref.lastname;
1163
+ return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
1164
+ }
1165
+ var StyledAvatarInitial = styled(InternalTypography, {
1166
+ context: context$1,
1167
+ variants: {
1168
+ size: function (_size) {
1169
+ return {
1170
+ variant: _size === 'small' ? 'label-m' : 'label-l'
1171
+ };
1172
+ },
1173
+ disabled: {
1174
+ "true": {
1175
+ color: '$content.disabled.onContrasted'
1176
+ },
1177
+ "false": {
1178
+ color: '$content.accent'
1179
+ }
1180
+ }
1181
+ }
1182
+ });
1183
+ function AvatarInitial(props) {
1184
+ return /*#__PURE__*/jsx(StyledAvatarInitial, {
1185
+ children: extractInitial(props)
1186
+ });
1187
+ }
1188
+
1189
+ var InternalAvatarFrame = styled(Center, {
1190
+ name: 'Avatar',
1191
+ context: context$1,
1192
+ overflow: 'hidden',
1193
+ variants: {
1194
+ size: {
1195
+ small: {
1196
+ width: 32,
1197
+ height: 32
1198
+ },
1199
+ medium: {
1200
+ width: 40,
1201
+ height: 40
1202
+ },
1203
+ large: {
1204
+ width: 48,
1205
+ height: 48
1206
+ },
1207
+ xlarge: {
1208
+ width: 64,
1209
+ height: 64
1210
+ }
1211
+ },
1212
+ shape: {
1213
+ square: {
1214
+ borderRadius: '$radius.m'
1215
+ },
1216
+ circle: {
1217
+ borderRadius: '$radius.circle'
1218
+ }
1219
+ },
1220
+ disabled: {
1221
+ "true": {
1222
+ backgroundColor: '$bg.disabled.hi'
1223
+ },
1224
+ "false": {
1225
+ backgroundColor: '$avatar.bg'
1226
+ }
1227
+ }
1228
+ }
1229
+ });
1230
+ var Avatar = InternalAvatarFrame.styleable(function (props, ref) {
1231
+ var flattenProps = useProps(props);
1232
+ var children = useMemo(function () {
1233
+ var _flattenProps$firstna, _flattenProps$lastnam;
1234
+ if (!flattenProps.src && !flattenProps.firstname && !flattenProps.lastname) {
1235
+ return /*#__PURE__*/jsx(AvatarImage, {
1236
+ src: flattenProps.disabled ? AvatarPlaceholderDisabledImage : AvatarPlaceholderImage
1237
+ });
1238
+ }
1239
+ if (flattenProps.src) {
1240
+ return /*#__PURE__*/jsx(AvatarImage, {
1241
+ src: flattenProps.src
1242
+ });
1243
+ }
1244
+ return /*#__PURE__*/jsx(AvatarInitial, {
1245
+ firstname: (_flattenProps$firstna = flattenProps.firstname) !== null && _flattenProps$firstna !== void 0 ? _flattenProps$firstna : '',
1246
+ lastname: (_flattenProps$lastnam = flattenProps.lastname) !== null && _flattenProps$lastnam !== void 0 ? _flattenProps$lastnam : ''
1247
+ });
1248
+ }, [flattenProps.src, flattenProps.firstname, flattenProps.lastname, flattenProps.disabled]);
1249
+ return /*#__PURE__*/jsx(InternalAvatarFrame, _objectSpread(_objectSpread({
1250
+ ref: ref
1251
+ }, props), {}, {
1252
+ children: children
1253
+ }));
1254
+ });
1255
+
1125
1256
  var context = createStyledContext({
1126
1257
  color: 'green',
1127
1258
  size: 'small',
@@ -1305,5 +1436,58 @@ function SwitchBreakpoints(values) {
1305
1436
  return getValueForBreakpoint(breakpoint, values);
1306
1437
  }
1307
1438
 
1308
- export { Badge, BumperProvider, Button, Center, HStack, IconButton, Loader, Pressable, Sticker, SwitchBreakpoints, Typography, VStack, getValueForBreakpoint, useBreakpointValue, useCurrentBreakpointName };
1439
+ var InternalDividerFrame = styled(View, {
1440
+ name: 'Divider',
1441
+ alignSelf: 'stretch',
1442
+ variants: {
1443
+ type: {
1444
+ subtle: {},
1445
+ strong: {}
1446
+ },
1447
+ isVertical: {
1448
+ "true": function (_, _ref) {
1449
+ var props = _ref.props;
1450
+ return {
1451
+ width: props.type === 'strong' ? 8 : 1
1452
+ };
1453
+ },
1454
+ "false": function (_, _ref2) {
1455
+ var props = _ref2.props;
1456
+ return {
1457
+ height: props.type === 'strong' ? 8 : 1
1458
+ };
1459
+ }
1460
+ },
1461
+ isOnContrasted: {
1462
+ "true": function (_, _ref3) {
1463
+ var props = _ref3.props;
1464
+ return {
1465
+ backgroundColor: props.type === 'strong' ? '$divider.border.strong.onContrasted' : '$divider.border.subtle.onContrasted'
1466
+ };
1467
+ },
1468
+ "false": function (_, _ref4) {
1469
+ var props = _ref4.props;
1470
+ return {
1471
+ backgroundColor: props.type === 'strong' ? '$divider.border.strong' : '$divider.border.subtle'
1472
+ };
1473
+ }
1474
+ }
1475
+ },
1476
+ defaultVariants: {
1477
+ type: 'subtle',
1478
+ isVertical: false,
1479
+ isOnContrasted: false
1480
+ }
1481
+ });
1482
+ var InternalDivider = InternalDividerFrame.styleable(function (props, ref) {
1483
+ var flattenProps = useProps(props);
1484
+ return /*#__PURE__*/jsx(InternalDividerFrame, _objectSpread({
1485
+ ref: ref
1486
+ }, flattenProps));
1487
+ });
1488
+ function Divider(props) {
1489
+ return /*#__PURE__*/jsx(InternalDivider, _objectSpread({}, props));
1490
+ }
1491
+
1492
+ export { Avatar, Badge, BumperProvider, Button, Center, Divider, HStack, IconButton, Loader, Pressable, Sticker, SwitchBreakpoints, Typography, VStack, getValueForBreakpoint, useBreakpointValue, useCurrentBreakpointName };
1309
1493
  //# sourceMappingURL=index.es.web.js.map