@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
@@ -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$1 = core.createStyledContext({
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$1.useStyledContext();
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$1.useStyledContext();
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$1,
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$1.useStyledContext();
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$1,
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',
@@ -1360,15 +1492,69 @@ function SwitchBreakpoints(values) {
1360
1492
  return getValueForBreakpoint(breakpoint, values);
1361
1493
  }
1362
1494
 
1495
+ const InternalDividerFrame = core.styled(core.View, {
1496
+ name: 'Divider',
1497
+ alignSelf: 'stretch',
1498
+ variants: {
1499
+ type: {
1500
+ subtle: {},
1501
+ strong: {}
1502
+ },
1503
+ isVertical: {
1504
+ true: (_, {
1505
+ props
1506
+ }) => ({
1507
+ width: props.type === 'strong' ? 8 : 1
1508
+ }),
1509
+ false: (_, {
1510
+ props
1511
+ }) => ({
1512
+ height: props.type === 'strong' ? 8 : 1
1513
+ })
1514
+ },
1515
+ isOnContrasted: {
1516
+ true: (_, {
1517
+ props
1518
+ }) => ({
1519
+ backgroundColor: props.type === 'strong' ? '$divider.border.strong.onContrasted' : '$divider.border.subtle.onContrasted'
1520
+ }),
1521
+ false: (_, {
1522
+ props
1523
+ }) => ({
1524
+ backgroundColor: props.type === 'strong' ? '$divider.border.strong' : '$divider.border.subtle'
1525
+ })
1526
+ }
1527
+ },
1528
+ defaultVariants: {
1529
+ type: 'subtle',
1530
+ isVertical: false,
1531
+ isOnContrasted: false
1532
+ }
1533
+ });
1534
+ const InternalDivider = InternalDividerFrame.styleable((props, ref) => {
1535
+ const flattenProps = useProps(props);
1536
+ return /*#__PURE__*/jsxRuntime.jsx(InternalDividerFrame, {
1537
+ ref: ref,
1538
+ ...flattenProps
1539
+ });
1540
+ });
1541
+ function Divider(props) {
1542
+ return /*#__PURE__*/jsxRuntime.jsx(InternalDivider, {
1543
+ ...props
1544
+ });
1545
+ }
1546
+
1363
1547
  exports.Stack = core.Stack;
1364
1548
  exports.View = core.View;
1365
1549
  exports.Image = image.Image;
1366
1550
  exports.ScrollView = scrollView.ScrollView;
1367
1551
  exports.useWindowSize = reactNative.useWindowDimensions;
1552
+ exports.Avatar = Avatar;
1368
1553
  exports.Badge = Badge;
1369
1554
  exports.BumperProvider = BumperProvider;
1370
1555
  exports.Button = Button;
1371
1556
  exports.Center = Center;
1557
+ exports.Divider = Divider;
1372
1558
  exports.HStack = HStack;
1373
1559
  exports.IconButton = IconButton;
1374
1560
  exports.Loader = Loader;