@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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { styled } from '@tamagui/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { TypographyTextProps } from '../../../content/typography/Typography';
|
|
4
|
+
import { InternalTypography } from '../../../content/typography/Typography';
|
|
5
|
+
import type { PropsToTamaguiVariants } from '../../../types';
|
|
6
|
+
import type { AvatarProps, AvatarSize } from '../Avatar';
|
|
7
|
+
import { context } from '../context';
|
|
8
|
+
|
|
9
|
+
export type AvatarInitialProps = Required<Pick<AvatarProps, 'firstname' | 'lastname'>>;
|
|
10
|
+
|
|
11
|
+
export function extractInitial({ firstname, lastname }: AvatarInitialProps): string {
|
|
12
|
+
return `${firstname[0]}${lastname[0]}`.toUpperCase();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const StyledAvatarInitial = styled(InternalTypography, {
|
|
16
|
+
context,
|
|
17
|
+
variants: {
|
|
18
|
+
size: (size: AvatarSize) => ({
|
|
19
|
+
variant: size === 'small' ? 'label-m' : 'label-l',
|
|
20
|
+
}),
|
|
21
|
+
disabled: {
|
|
22
|
+
true: { color: '$content.disabled.onContrasted' },
|
|
23
|
+
false: { color: '$content.accent' },
|
|
24
|
+
},
|
|
25
|
+
} as const satisfies PropsToTamaguiVariants<AvatarProps, TypographyTextProps>,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function AvatarInitial(props: AvatarInitialProps): ReactNode {
|
|
29
|
+
return <StyledAvatarInitial>{extractInitial(props)}</StyledAvatarInitial>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createStyledContext } from '@tamagui/core';
|
|
2
|
+
import type { AvatarProps } from './Avatar';
|
|
3
|
+
|
|
4
|
+
type AvatarContextProps = Required<Pick<AvatarProps, 'disabled' | 'size' | 'shape'>>;
|
|
5
|
+
|
|
6
|
+
export const context = createStyledContext<AvatarContextProps>({
|
|
7
|
+
size: 'large',
|
|
8
|
+
shape: 'square',
|
|
9
|
+
disabled: false,
|
|
10
|
+
});
|