@veeqo/ui 16.1.0 → 16.3.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/dist/components/Avatar/Avatar.cjs +9 -2
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +8 -1
- package/dist/components/Avatar/Avatar.js +9 -2
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/Avatar.module.scss.cjs +2 -2
- package/dist/components/Avatar/Avatar.module.scss.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.module.scss.js +2 -2
- package/dist/components/Avatar/Avatar.module.scss.js.map +1 -1
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/types.cjs +10 -0
- package/dist/components/Avatar/types.cjs.map +1 -0
- package/dist/components/Avatar/types.d.ts +8 -0
- package/dist/components/Avatar/types.js +10 -0
- package/dist/components/Avatar/types.js.map +1 -0
- package/dist/components/IconGroup/IconGroup.cjs +1 -0
- package/dist/components/IconGroup/IconGroup.cjs.map +1 -1
- package/dist/components/IconGroup/IconGroup.js +1 -0
- package/dist/components/IconGroup/IconGroup.js.map +1 -1
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.cjs +37 -15
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.cjs.map +1 -1
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.d.ts +13 -3
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.js +38 -16
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.js.map +1 -1
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss.cjs +2 -2
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss.cjs.map +1 -1
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss.js +2 -2
- package/dist/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss.js.map +1 -1
- package/dist/components/LoginWithAmazonButton/index.d.ts +1 -0
- package/dist/components/LoginWithAmazonButton/types.d.ts +25 -0
- package/dist/components/Skeleton/Skeleton.cjs +11 -0
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +13 -0
- package/dist/components/Skeleton/Skeleton.js +11 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,12 +20,19 @@ const textVariantMapping = {
|
|
|
20
20
|
xl: 'headingSmall',
|
|
21
21
|
xxl: 'headingMedium',
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Avatar displays a user's initials, photo, or an icon inside a circular frame,
|
|
25
|
+
* with an optional error indicator.
|
|
26
|
+
*
|
|
27
|
+
* Initials are derived from `name`. Provide `imageUrl` to render a photo or
|
|
28
|
+
* `iconSlot` to render an icon instead — otherwise the initials are shown.
|
|
29
|
+
*/
|
|
30
|
+
const Avatar = ({ size = 'lg', name, bgColor, textColor, iconSlot, imageUrl, hasIndicator = false, ariaLabel = `Avatar of ${name}`, className, style, ...rest }) => {
|
|
24
31
|
var _a, _b;
|
|
25
32
|
const textVariant = textVariantMapping[size];
|
|
26
33
|
// Check if name contains any letters if so we show initials from text.
|
|
27
34
|
const hasLetters = /[a-zA-Z]/.test(name || '');
|
|
28
|
-
return (React__default.default.createElement(FlexRow.FlexRow, { justifyContent: "center", className: buildClassnames.buildClassnames([Avatar_module.avatar, Avatar_module[`${size}-size`], className]), style: {
|
|
35
|
+
return (React__default.default.createElement(FlexRow.FlexRow, { justifyContent: "center", ...rest, className: buildClassnames.buildClassnames([Avatar_module.avatar, Avatar_module[`${size}-size`], className]), style: {
|
|
29
36
|
...style,
|
|
30
37
|
...assignCssVars.assignCssVars({
|
|
31
38
|
avatarBgColor: iconSlot ? index.theme.colors.neutral.grey.lightest : bgColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.cjs","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React from 'react';\nimport { CriticalFillIcon } from '../../icons';\nimport { assignCssVars, buildClassnames } from '../../utils';\nimport { theme } from '../../theme';\nimport styles from './Avatar.module.scss';\nimport { AvatarProps } from './types';\nimport { Text } from '../Text';\nimport { FlexRow } from '../Flex/FlexRow';\n\nconst textVariantMapping: Record<
|
|
1
|
+
{"version":3,"file":"Avatar.cjs","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React from 'react';\nimport { CriticalFillIcon } from '../../icons';\nimport { assignCssVars, buildClassnames } from '../../utils';\nimport { theme } from '../../theme';\nimport styles from './Avatar.module.scss';\nimport { AvatarProps, AvatarSize } from './types';\nimport { Text, type TextVariant } from '../Text';\nimport { FlexRow } from '../Flex/FlexRow';\n\nconst textVariantMapping: Record<keyof typeof AvatarSize, TextVariant> = {\n md: 'bodySmallBold',\n lg: 'bodySmallBold',\n xl: 'headingSmall',\n xxl: 'headingMedium',\n};\n\n/**\n * Avatar displays a user's initials, photo, or an icon inside a circular frame,\n * with an optional error indicator.\n *\n * Initials are derived from `name`. Provide `imageUrl` to render a photo or\n * `iconSlot` to render an icon instead — otherwise the initials are shown.\n */\nexport const Avatar = ({\n size = 'lg',\n name,\n bgColor,\n textColor,\n iconSlot,\n imageUrl,\n hasIndicator = false,\n ariaLabel = `Avatar of ${name}`,\n className,\n style,\n ...rest\n}: AvatarProps) => {\n const textVariant = textVariantMapping[size];\n\n // Check if name contains any letters if so we show initials from text.\n const hasLetters = /[a-zA-Z]/.test(name || '');\n\n return (\n <FlexRow\n justifyContent=\"center\"\n {...rest}\n className={buildClassnames([styles.avatar, styles[`${size}-size`], className])}\n style={\n {\n ...style,\n ...assignCssVars({\n avatarBgColor: iconSlot ? theme.colors.neutral.grey.lightest : bgColor,\n avatarTextColor: textColor,\n }),\n } as React.CSSProperties\n }\n aria-label={ariaLabel}\n >\n {hasIndicator && (\n <CriticalFillIcon\n className={styles.indicatorIcon}\n color={theme.colors.secondary.red.base}\n fill={theme.colors.neutral.grey.lightest}\n role=\"status\"\n aria-live=\"polite\"\n aria-label=\"Avatar has an error\"\n />\n )}\n {imageUrl && <img src={imageUrl} alt={name} className={styles.avatarImage} />}\n {!!iconSlot && iconSlot}\n {!imageUrl && !iconSlot && (\n <Text variant={textVariant} className={styles.avatarText}>\n {!hasLetters ? name?.toUpperCase() : name?.toUpperCase()?.match(/\\b\\w/g)?.slice(0, 2)}\n </Text>\n )}\n </FlexRow>\n );\n};\n"],"names":["React","FlexRow","buildClassnames","styles","assignCssVars","theme","CriticalFillIcon","Text"],"mappings":";;;;;;;;;;;;;;;;AASA,MAAM,kBAAkB,GAAiD;AACvE,IAAA,EAAE,EAAE,eAAe;AACnB,IAAA,EAAE,EAAE,eAAe;AACnB,IAAA,EAAE,EAAE,cAAc;AAClB,IAAA,GAAG,EAAE,eAAe;CACrB;AAED;;;;;;AAMG;AACI,MAAM,MAAM,GAAG,CAAC,EACrB,IAAI,GAAG,IAAI,EACX,IAAI,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,SAAS,GAAG,aAAa,IAAI,CAAA,CAAE,EAC/B,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACK,KAAI;;AAChB,IAAA,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC;;IAG5C,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AAE9C,IAAA,QACEA,sBAAA,CAAA,aAAA,CAACC,eAAO,EAAA,EACN,cAAc,EAAC,QAAQ,EAAA,GACnB,IAAI,EACR,SAAS,EAAEC,+BAAe,CAAC,CAACC,aAAM,CAAC,MAAM,EAAEA,aAAM,CAAC,GAAG,IAAI,CAAA,KAAA,CAAO,CAAC,EAA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AAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,KAAK,CAAC,OAAO,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAChF,CACR,CACO;AAEd;;;;"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AvatarProps } from './types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Avatar displays a user's initials, photo, or an icon inside a circular frame,
|
|
5
|
+
* with an optional error indicator.
|
|
6
|
+
*
|
|
7
|
+
* Initials are derived from `name`. Provide `imageUrl` to render a photo or
|
|
8
|
+
* `iconSlot` to render an icon instead — otherwise the initials are shown.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Avatar: ({ size, name, bgColor, textColor, iconSlot, imageUrl, hasIndicator, ariaLabel, className, style, ...rest }: AvatarProps) => React.JSX.Element;
|
|
@@ -14,12 +14,19 @@ const textVariantMapping = {
|
|
|
14
14
|
xl: 'headingSmall',
|
|
15
15
|
xxl: 'headingMedium',
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Avatar displays a user's initials, photo, or an icon inside a circular frame,
|
|
19
|
+
* with an optional error indicator.
|
|
20
|
+
*
|
|
21
|
+
* Initials are derived from `name`. Provide `imageUrl` to render a photo or
|
|
22
|
+
* `iconSlot` to render an icon instead — otherwise the initials are shown.
|
|
23
|
+
*/
|
|
24
|
+
const Avatar = ({ size = 'lg', name, bgColor, textColor, iconSlot, imageUrl, hasIndicator = false, ariaLabel = `Avatar of ${name}`, className, style, ...rest }) => {
|
|
18
25
|
var _a, _b;
|
|
19
26
|
const textVariant = textVariantMapping[size];
|
|
20
27
|
// Check if name contains any letters if so we show initials from text.
|
|
21
28
|
const hasLetters = /[a-zA-Z]/.test(name || '');
|
|
22
|
-
return (React__default.createElement(FlexRow, { justifyContent: "center", className: buildClassnames([styles.avatar, styles[`${size}-size`], className]), style: {
|
|
29
|
+
return (React__default.createElement(FlexRow, { justifyContent: "center", ...rest, className: buildClassnames([styles.avatar, styles[`${size}-size`], className]), style: {
|
|
23
30
|
...style,
|
|
24
31
|
...assignCssVars({
|
|
25
32
|
avatarBgColor: iconSlot ? theme.colors.neutral.grey.lightest : bgColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React from 'react';\nimport { CriticalFillIcon } from '../../icons';\nimport { assignCssVars, buildClassnames } from '../../utils';\nimport { theme } from '../../theme';\nimport styles from './Avatar.module.scss';\nimport { AvatarProps } from './types';\nimport { Text } from '../Text';\nimport { FlexRow } from '../Flex/FlexRow';\n\nconst textVariantMapping: Record<
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React from 'react';\nimport { CriticalFillIcon } from '../../icons';\nimport { assignCssVars, buildClassnames } from '../../utils';\nimport { theme } from '../../theme';\nimport styles from './Avatar.module.scss';\nimport { AvatarProps, AvatarSize } from './types';\nimport { Text, type TextVariant } from '../Text';\nimport { FlexRow } from '../Flex/FlexRow';\n\nconst textVariantMapping: Record<keyof typeof AvatarSize, TextVariant> = {\n md: 'bodySmallBold',\n lg: 'bodySmallBold',\n xl: 'headingSmall',\n xxl: 'headingMedium',\n};\n\n/**\n * Avatar displays a user's initials, photo, or an icon inside a circular frame,\n * with an optional error indicator.\n *\n * Initials are derived from `name`. Provide `imageUrl` to render a photo or\n * `iconSlot` to render an icon instead — otherwise the initials are shown.\n */\nexport const Avatar = ({\n size = 'lg',\n name,\n bgColor,\n textColor,\n iconSlot,\n imageUrl,\n hasIndicator = false,\n ariaLabel = `Avatar of ${name}`,\n className,\n style,\n ...rest\n}: AvatarProps) => {\n const textVariant = textVariantMapping[size];\n\n // Check if name contains any letters if so we show initials from text.\n const hasLetters = /[a-zA-Z]/.test(name || '');\n\n return (\n <FlexRow\n justifyContent=\"center\"\n {...rest}\n className={buildClassnames([styles.avatar, styles[`${size}-size`], className])}\n style={\n {\n ...style,\n ...assignCssVars({\n avatarBgColor: iconSlot ? theme.colors.neutral.grey.lightest : bgColor,\n avatarTextColor: textColor,\n }),\n } as React.CSSProperties\n }\n aria-label={ariaLabel}\n >\n {hasIndicator && (\n <CriticalFillIcon\n className={styles.indicatorIcon}\n color={theme.colors.secondary.red.base}\n fill={theme.colors.neutral.grey.lightest}\n role=\"status\"\n aria-live=\"polite\"\n aria-label=\"Avatar has an error\"\n />\n )}\n {imageUrl && <img src={imageUrl} alt={name} className={styles.avatarImage} />}\n {!!iconSlot && iconSlot}\n {!imageUrl && !iconSlot && (\n <Text variant={textVariant} className={styles.avatarText}>\n {!hasLetters ? name?.toUpperCase() : name?.toUpperCase()?.match(/\\b\\w/g)?.slice(0, 2)}\n </Text>\n )}\n </FlexRow>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;AASA,MAAM,kBAAkB,GAAiD;AACvE,IAAA,EAAE,EAAE,eAAe;AACnB,IAAA,EAAE,EAAE,eAAe;AACnB,IAAA,EAAE,EAAE,cAAc;AAClB,IAAA,GAAG,EAAE,eAAe;CACrB;AAED;;;;;;AAMG;AACI,MAAM,MAAM,GAAG,CAAC,EACrB,IAAI,GAAG,IAAI,EACX,IAAI,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,SAAS,GAAG,aAAa,IAAI,CAAA,CAAE,EAC/B,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACK,KAAI;;AAChB,IAAA,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC;;IAG5C,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AAE9C,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EACN,cAAc,EAAC,QA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,CAAA,EAAA,GAAA,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,WAAW,EAAE,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,KAAK,CAAC,OAAO,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAChF,CACR,CACO;AAEd;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
|
-
___$insertStyle(".
|
|
6
|
-
var styles = {"avatar":"
|
|
5
|
+
___$insertStyle("._avatar_1yl95_1 {\n border: var(--sizes-line) solid var(--colors-neutral-grey-base);\n border-radius: var(--radius-full);\n background-size: cover;\n background-color: var(--avatar-bg-color, var(--colors-secondary-blue-base));\n position: relative;\n width: var(--avatar-size, var(--sizes-lg));\n height: var(--avatar-size, var(--sizes-lg));\n}\n\n._avatarImage_1yl95_11 {\n width: 100%;\n height: 100%;\n border-radius: var(--radius-full);\n object-fit: cover;\n}\n\n._avatarText_1yl95_18 {\n color: var(--avatar-text-color, var(--colors-neutral-white)) !important;\n}\n\n._indicatorIcon_1yl95_22 {\n position: absolute;\n /* Calculate offset as roughly 30% of icon size, with fallback */\n top: calc(-0.3 * var(--indicator-icon-size, 16px));\n right: calc(-0.3 * var(--indicator-icon-size, 16px));\n width: var(--indicator-icon-size, var(--sizes-lg));\n height: var(--indicator-icon-size, var(--sizes-lg));\n}\n\n._md-size_1yl95_31 {\n --avatar-size: var(--sizes-md);\n --indicator-icon-size: var(--sizes-3);\n}\n\n._lg-size_1yl95_36 {\n --avatar-size: var(--sizes-lg);\n --indicator-icon-size: var(--sizes-base);\n}\n\n._xl-size_1yl95_41 {\n --avatar-size: var(--sizes-xl);\n --indicator-icon-size: var(--sizes-7);\n}\n\n._xxl-size_1yl95_46 {\n --avatar-size: var(--sizes-xxl);\n --indicator-icon-size: var(--sizes-lg);\n}");
|
|
6
|
+
var styles = {"avatar":"_avatar_1yl95_1","avatarImage":"_avatarImage_1yl95_11","avatarText":"_avatarText_1yl95_18","indicatorIcon":"_indicatorIcon_1yl95_22","md-size":"_md-size_1yl95_31","lg-size":"_lg-size_1yl95_36","xl-size":"_xl-size_1yl95_41","xxl-size":"_xxl-size_1yl95_46"};
|
|
7
7
|
|
|
8
8
|
module.exports = styles;
|
|
9
9
|
//# sourceMappingURL=Avatar.module.scss.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.module.scss.cjs","sources":["../../../src/components/Avatar/Avatar.module.scss"],"sourcesContent":[".avatar {\n border: var(--sizes-line) solid var(--colors-neutral-grey-base);\n border-radius: var(--radius-full);\n background-size: cover;\n background-color: var(--avatar-bg-color, var(--colors-secondary-blue-base));\n position: relative;\n width: var(--avatar-size, var(--sizes-lg));\n height: var(--avatar-size, var(--sizes-lg));\n}\n\n.avatarImage {\n width: 100%;\n height: 100%;\n border-radius: var(--radius-full);\n object-fit: cover;\n}\n\n.avatarText {\n color: var(--avatar-text-color,
|
|
1
|
+
{"version":3,"file":"Avatar.module.scss.cjs","sources":["../../../src/components/Avatar/Avatar.module.scss"],"sourcesContent":[".avatar {\n border: var(--sizes-line) solid var(--colors-neutral-grey-base);\n border-radius: var(--radius-full);\n background-size: cover;\n background-color: var(--avatar-bg-color, var(--colors-secondary-blue-base));\n position: relative;\n width: var(--avatar-size, var(--sizes-lg));\n height: var(--avatar-size, var(--sizes-lg));\n}\n\n.avatarImage {\n width: 100%;\n height: 100%;\n border-radius: var(--radius-full);\n object-fit: cover;\n}\n\n.avatarText {\n color: var(--avatar-text-color, var(--colors-neutral-white)) !important;\n}\n\n.indicatorIcon {\n position: absolute;\n /* Calculate offset as roughly 30% of icon size, with fallback */\n top: calc(-0.3 * var(--indicator-icon-size, 16px));\n right: calc(-0.3 * var(--indicator-icon-size, 16px));\n width: var(--indicator-icon-size, var(--sizes-lg));\n height: var(--indicator-icon-size, var(--sizes-lg));\n}\n\n.md-size {\n --avatar-size: var(--sizes-md);\n --indicator-icon-size: var(--sizes-3);\n}\n\n.lg-size {\n --avatar-size: var(--sizes-lg);\n --indicator-icon-size: var(--sizes-base);\n}\n\n.xl-size {\n --avatar-size: var(--sizes-xl);\n --indicator-icon-size: var(--sizes-7);\n}\n\n.xxl-size {\n --avatar-size: var(--sizes-xxl);\n --indicator-icon-size: var(--sizes-lg);\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,00CAAA;AACA,aAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,aAAA,CAAA,uBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,UAAA,CAAA,oBAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
2
|
|
|
3
|
-
insertStyle(".
|
|
4
|
-
var styles = {"avatar":"
|
|
3
|
+
insertStyle("._avatar_1yl95_1 {\n border: var(--sizes-line) solid var(--colors-neutral-grey-base);\n border-radius: var(--radius-full);\n background-size: cover;\n background-color: var(--avatar-bg-color, var(--colors-secondary-blue-base));\n position: relative;\n width: var(--avatar-size, var(--sizes-lg));\n height: var(--avatar-size, var(--sizes-lg));\n}\n\n._avatarImage_1yl95_11 {\n width: 100%;\n height: 100%;\n border-radius: var(--radius-full);\n object-fit: cover;\n}\n\n._avatarText_1yl95_18 {\n color: var(--avatar-text-color, var(--colors-neutral-white)) !important;\n}\n\n._indicatorIcon_1yl95_22 {\n position: absolute;\n /* Calculate offset as roughly 30% of icon size, with fallback */\n top: calc(-0.3 * var(--indicator-icon-size, 16px));\n right: calc(-0.3 * var(--indicator-icon-size, 16px));\n width: var(--indicator-icon-size, var(--sizes-lg));\n height: var(--indicator-icon-size, var(--sizes-lg));\n}\n\n._md-size_1yl95_31 {\n --avatar-size: var(--sizes-md);\n --indicator-icon-size: var(--sizes-3);\n}\n\n._lg-size_1yl95_36 {\n --avatar-size: var(--sizes-lg);\n --indicator-icon-size: var(--sizes-base);\n}\n\n._xl-size_1yl95_41 {\n --avatar-size: var(--sizes-xl);\n --indicator-icon-size: var(--sizes-7);\n}\n\n._xxl-size_1yl95_46 {\n --avatar-size: var(--sizes-xxl);\n --indicator-icon-size: var(--sizes-lg);\n}");
|
|
4
|
+
var styles = {"avatar":"_avatar_1yl95_1","avatarImage":"_avatarImage_1yl95_11","avatarText":"_avatarText_1yl95_18","indicatorIcon":"_indicatorIcon_1yl95_22","md-size":"_md-size_1yl95_31","lg-size":"_lg-size_1yl95_36","xl-size":"_xl-size_1yl95_41","xxl-size":"_xxl-size_1yl95_46"};
|
|
5
5
|
|
|
6
6
|
export { styles as default };
|
|
7
7
|
//# sourceMappingURL=Avatar.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.module.scss.js","sources":["../../../src/components/Avatar/Avatar.module.scss"],"sourcesContent":[".avatar {\n border: var(--sizes-line) solid var(--colors-neutral-grey-base);\n border-radius: var(--radius-full);\n background-size: cover;\n background-color: var(--avatar-bg-color, var(--colors-secondary-blue-base));\n position: relative;\n width: var(--avatar-size, var(--sizes-lg));\n height: var(--avatar-size, var(--sizes-lg));\n}\n\n.avatarImage {\n width: 100%;\n height: 100%;\n border-radius: var(--radius-full);\n object-fit: cover;\n}\n\n.avatarText {\n color: var(--avatar-text-color,
|
|
1
|
+
{"version":3,"file":"Avatar.module.scss.js","sources":["../../../src/components/Avatar/Avatar.module.scss"],"sourcesContent":[".avatar {\n border: var(--sizes-line) solid var(--colors-neutral-grey-base);\n border-radius: var(--radius-full);\n background-size: cover;\n background-color: var(--avatar-bg-color, var(--colors-secondary-blue-base));\n position: relative;\n width: var(--avatar-size, var(--sizes-lg));\n height: var(--avatar-size, var(--sizes-lg));\n}\n\n.avatarImage {\n width: 100%;\n height: 100%;\n border-radius: var(--radius-full);\n object-fit: cover;\n}\n\n.avatarText {\n color: var(--avatar-text-color, var(--colors-neutral-white)) !important;\n}\n\n.indicatorIcon {\n position: absolute;\n /* Calculate offset as roughly 30% of icon size, with fallback */\n top: calc(-0.3 * var(--indicator-icon-size, 16px));\n right: calc(-0.3 * var(--indicator-icon-size, 16px));\n width: var(--indicator-icon-size, var(--sizes-lg));\n height: var(--indicator-icon-size, var(--sizes-lg));\n}\n\n.md-size {\n --avatar-size: var(--sizes-md);\n --indicator-icon-size: var(--sizes-3);\n}\n\n.lg-size {\n --avatar-size: var(--sizes-lg);\n --indicator-icon-size: var(--sizes-base);\n}\n\n.xl-size {\n --avatar-size: var(--sizes-xl);\n --indicator-icon-size: var(--sizes-7);\n}\n\n.xxl-size {\n --avatar-size: var(--sizes-xxl);\n --indicator-icon-size: var(--sizes-lg);\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,00CAAA;AACA,aAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,aAAA,CAAA,uBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,UAAA,CAAA,oBAAA;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.AvatarSize = void 0;
|
|
4
|
+
(function (AvatarSize) {
|
|
5
|
+
AvatarSize["md"] = "md";
|
|
6
|
+
AvatarSize["lg"] = "lg";
|
|
7
|
+
AvatarSize["xl"] = "xl";
|
|
8
|
+
AvatarSize["xxl"] = "xxl";
|
|
9
|
+
})(exports.AvatarSize || (exports.AvatarSize = {}));
|
|
10
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":["../../../src/components/Avatar/types.ts"],"sourcesContent":["export enum AvatarSize {\n md = 'md',\n lg = 'lg',\n xl = 'xl',\n xxl = 'xxl',\n}\n\nexport type AvatarProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Full name used to derive initials and the default accessible label. */\n name: string;\n /** Overall dimension of the avatar. @default 'lg' */\n size?: keyof typeof AvatarSize;\n /** Background colour of the circle. Ignored when `iconSlot` is set. */\n bgColor?: string;\n /** Colour of the initials text. */\n textColor?: string;\n /** Icon rendered in place of initials (e.g. a channel or brand mark). */\n iconSlot?: React.ReactNode;\n /** Image URL rendered in place of initials. */\n imageUrl?: string;\n /** Accessible label for the avatar. @default `Avatar of ${name}` */\n ariaLabel?: string;\n /** Shows a red error indicator on the avatar. @default false */\n hasIndicator?: boolean;\n};\n"],"names":["AvatarSize"],"mappings":";;AAAYA;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACb,CAAC,EALWA,kBAAU,KAAVA,kBAAU,GAAA,EAAA,CAAA,CAAA;;"}
|
|
@@ -6,12 +6,20 @@ export declare enum AvatarSize {
|
|
|
6
6
|
xxl = "xxl"
|
|
7
7
|
}
|
|
8
8
|
export type AvatarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
/** Full name used to derive initials and the default accessible label. */
|
|
9
10
|
name: string;
|
|
11
|
+
/** Overall dimension of the avatar. @default 'lg' */
|
|
10
12
|
size?: keyof typeof AvatarSize;
|
|
13
|
+
/** Background colour of the circle. Ignored when `iconSlot` is set. */
|
|
11
14
|
bgColor?: string;
|
|
15
|
+
/** Colour of the initials text. */
|
|
12
16
|
textColor?: string;
|
|
17
|
+
/** Icon rendered in place of initials (e.g. a channel or brand mark). */
|
|
13
18
|
iconSlot?: React.ReactNode;
|
|
19
|
+
/** Image URL rendered in place of initials. */
|
|
14
20
|
imageUrl?: string;
|
|
21
|
+
/** Accessible label for the avatar. @default `Avatar of ${name}` */
|
|
15
22
|
ariaLabel?: string;
|
|
23
|
+
/** Shows a red error indicator on the avatar. @default false */
|
|
16
24
|
hasIndicator?: boolean;
|
|
17
25
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/Avatar/types.ts"],"sourcesContent":["export enum AvatarSize {\n md = 'md',\n lg = 'lg',\n xl = 'xl',\n xxl = 'xxl',\n}\n\nexport type AvatarProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Full name used to derive initials and the default accessible label. */\n name: string;\n /** Overall dimension of the avatar. @default 'lg' */\n size?: keyof typeof AvatarSize;\n /** Background colour of the circle. Ignored when `iconSlot` is set. */\n bgColor?: string;\n /** Colour of the initials text. */\n textColor?: string;\n /** Icon rendered in place of initials (e.g. a channel or brand mark). */\n iconSlot?: React.ReactNode;\n /** Image URL rendered in place of initials. */\n imageUrl?: string;\n /** Accessible label for the avatar. @default `Avatar of ${name}` */\n ariaLabel?: string;\n /** Shows a red error indicator on the avatar. @default false */\n hasIndicator?: boolean;\n};\n"],"names":[],"mappings":"IAAY;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACb,CAAC,EALW,UAAU,KAAV,UAAU,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconGroup.cjs","sources":["../../../src/components/IconGroup/IconGroup.tsx"],"sourcesContent":["import React from 'react';\n\n// Renamed existing Avatar component to Icon for code readability\nimport { Avatar as Icon } from '../Avatar';\nimport { theme } from '../../theme';\nimport { buildClassnames } from '../../utils';\nimport { IconGroupProps } from './types';\n\nimport styles from './IconGroup.module.scss';\n\nexport const IconGroup = ({\n icons,\n maxVisible = 3,\n compact = false,\n ariaLabel = 'Group of icons',\n hasIndicator = false,\n className,\n ...listProps\n}: IconGroupProps) => {\n const visibleIcons = icons.slice(\n 0,\n icons.length > maxVisible ? Math.max(0, maxVisible - 1) : maxVisible,\n );\n const hiddenIcons = icons.slice(visibleIcons.length);\n\n return (\n <ul {...listProps} aria-label={ariaLabel} className={buildClassnames([styles.list, className])}>\n {hiddenIcons.length > 0 && (\n <li\n key=\"icon-group-item-remaining-count\"\n className={styles.item}\n aria-label={`${hiddenIcons.length} additional ${hiddenIcons.length === 1 ? 'item' : 'items'}`}\n style={\n {\n '--icon-z-index': maxVisible,\n } as React.CSSProperties\n }\n >\n <Icon\n name={`${hiddenIcons.length}+`}\n size={compact ? 'md' : 'lg'}\n bgColor={theme.colors.secondary.blue.darkest}\n textColor={theme.colors.neutral.grey.lightest}\n ariaLabel=\"Number of additional icons not shown\"\n hasIndicator={hasIndicator}\n />\n </li>\n )}\n {visibleIcons.map((icon, index) => (\n <li\n key={`icon-group-item-${icon.name}`}\n className={styles.item}\n aria-label={`Icon item of ${icon.name}`}\n style={\n {\n '--icon-z-index': visibleIcons.length - index,\n } as React.CSSProperties\n }\n >\n <Icon\n {...icon}\n hasIndicator={false}\n size={compact ? 'md' : 'lg'}\n bgColor={icon?.bgColor ?? theme.colors.neutral.grey.light}\n textColor={icon?.textColor ?? theme.colors.neutral.ink.base}\n />\n </li>\n ))}\n </ul>\n );\n};\n"],"names":["React","buildClassnames","styles","Icon","theme","index"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconGroup.cjs","sources":["../../../src/components/IconGroup/IconGroup.tsx"],"sourcesContent":["import React from 'react';\n\n// Renamed existing Avatar component to Icon for code readability\nimport { Avatar as Icon } from '../Avatar';\nimport { theme } from '../../theme';\nimport { buildClassnames } from '../../utils';\nimport { IconGroupProps } from './types';\n\nimport styles from './IconGroup.module.scss';\n\nexport const IconGroup = ({\n icons,\n maxVisible = 3,\n compact = false,\n ariaLabel = 'Group of icons',\n hasIndicator = false,\n className,\n ...listProps\n}: IconGroupProps) => {\n const visibleIcons = icons.slice(\n 0,\n icons.length > maxVisible ? Math.max(0, maxVisible - 1) : maxVisible,\n );\n const hiddenIcons = icons.slice(visibleIcons.length);\n\n return (\n <ul {...listProps} aria-label={ariaLabel} className={buildClassnames([styles.list, className])}>\n {hiddenIcons.length > 0 && (\n <li\n key=\"icon-group-item-remaining-count\"\n className={styles.item}\n aria-label={`${hiddenIcons.length} additional ${hiddenIcons.length === 1 ? 'item' : 'items'}`}\n style={\n {\n '--icon-z-index': maxVisible,\n } as React.CSSProperties\n }\n >\n <Icon\n name={`${hiddenIcons.length}+`}\n size={compact ? 'md' : 'lg'}\n bgColor={theme.colors.secondary.blue.darkest}\n textColor={theme.colors.neutral.grey.lightest}\n ariaLabel=\"Number of additional icons not shown\"\n hasIndicator={hasIndicator}\n />\n </li>\n )}\n {visibleIcons.map((icon, index) => (\n <li\n key={`icon-group-item-${icon.name}`}\n className={styles.item}\n aria-label={`Icon item of ${icon.name}`}\n style={\n {\n '--icon-z-index': visibleIcons.length - index,\n } as React.CSSProperties\n }\n >\n <Icon\n {...icon}\n hasIndicator={false}\n size={compact ? 'md' : 'lg'}\n bgColor={icon?.bgColor ?? theme.colors.neutral.grey.light}\n textColor={icon?.textColor ?? theme.colors.neutral.ink.base}\n />\n </li>\n ))}\n </ul>\n );\n};\n"],"names":["React","buildClassnames","styles","Icon","theme","index"],"mappings":";;;;;;;;;;;;;;AAUO,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,UAAU,GAAG,CAAC,EACd,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,gBAAgB,E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GAAG,CAAC,CAAC,IAAI,EAAEC,OAAK,KAAI;;YAAC,QACjCL,6CACE,GAAG,EAAE,mBAAmB,IAAI,CAAC,IAAI,CAAA,CAAE,EACnC,SAAS,EAAEE,gBAAM,CAAC,IAAI,EAAA,YAAA,EACV,CAAA,aAAA,EAAgB,IAAI,CAAC,IAAI,CAAA,CAAE,EACvC,KAAK,EACH;AACE,oBAAA,gBAAgB,EAAE,YAAY,CAAC,MAAM,GAAGG,OAAK;AACvB,iBAAA,EAAA;AAG1B,gBAAAL,sBAAA,CAAA,aAAA,CAACG,aAAI,EAAA,EAAA,GACC,IAAI,EACR,YAAY,EAAE,KAAK,EACnB,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,EAC3B,OAAO,EAAE,CAAA,EAAA,GAAA,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAIC,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EACzD,SAAS,EAAE,CAAA,EAAA,GAAA,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,SAAS,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAIA,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAA,CAC3D,CACC;SACN,CAAC,CACC;AAET;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconGroup.js","sources":["../../../src/components/IconGroup/IconGroup.tsx"],"sourcesContent":["import React from 'react';\n\n// Renamed existing Avatar component to Icon for code readability\nimport { Avatar as Icon } from '../Avatar';\nimport { theme } from '../../theme';\nimport { buildClassnames } from '../../utils';\nimport { IconGroupProps } from './types';\n\nimport styles from './IconGroup.module.scss';\n\nexport const IconGroup = ({\n icons,\n maxVisible = 3,\n compact = false,\n ariaLabel = 'Group of icons',\n hasIndicator = false,\n className,\n ...listProps\n}: IconGroupProps) => {\n const visibleIcons = icons.slice(\n 0,\n icons.length > maxVisible ? Math.max(0, maxVisible - 1) : maxVisible,\n );\n const hiddenIcons = icons.slice(visibleIcons.length);\n\n return (\n <ul {...listProps} aria-label={ariaLabel} className={buildClassnames([styles.list, className])}>\n {hiddenIcons.length > 0 && (\n <li\n key=\"icon-group-item-remaining-count\"\n className={styles.item}\n aria-label={`${hiddenIcons.length} additional ${hiddenIcons.length === 1 ? 'item' : 'items'}`}\n style={\n {\n '--icon-z-index': maxVisible,\n } as React.CSSProperties\n }\n >\n <Icon\n name={`${hiddenIcons.length}+`}\n size={compact ? 'md' : 'lg'}\n bgColor={theme.colors.secondary.blue.darkest}\n textColor={theme.colors.neutral.grey.lightest}\n ariaLabel=\"Number of additional icons not shown\"\n hasIndicator={hasIndicator}\n />\n </li>\n )}\n {visibleIcons.map((icon, index) => (\n <li\n key={`icon-group-item-${icon.name}`}\n className={styles.item}\n aria-label={`Icon item of ${icon.name}`}\n style={\n {\n '--icon-z-index': visibleIcons.length - index,\n } as React.CSSProperties\n }\n >\n <Icon\n {...icon}\n hasIndicator={false}\n size={compact ? 'md' : 'lg'}\n bgColor={icon?.bgColor ?? theme.colors.neutral.grey.light}\n textColor={icon?.textColor ?? theme.colors.neutral.ink.base}\n />\n </li>\n ))}\n </ul>\n );\n};\n"],"names":["React","Icon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconGroup.js","sources":["../../../src/components/IconGroup/IconGroup.tsx"],"sourcesContent":["import React from 'react';\n\n// Renamed existing Avatar component to Icon for code readability\nimport { Avatar as Icon } from '../Avatar';\nimport { theme } from '../../theme';\nimport { buildClassnames } from '../../utils';\nimport { IconGroupProps } from './types';\n\nimport styles from './IconGroup.module.scss';\n\nexport const IconGroup = ({\n icons,\n maxVisible = 3,\n compact = false,\n ariaLabel = 'Group of icons',\n hasIndicator = false,\n className,\n ...listProps\n}: IconGroupProps) => {\n const visibleIcons = icons.slice(\n 0,\n icons.length > maxVisible ? Math.max(0, maxVisible - 1) : maxVisible,\n );\n const hiddenIcons = icons.slice(visibleIcons.length);\n\n return (\n <ul {...listProps} aria-label={ariaLabel} className={buildClassnames([styles.list, className])}>\n {hiddenIcons.length > 0 && (\n <li\n key=\"icon-group-item-remaining-count\"\n className={styles.item}\n aria-label={`${hiddenIcons.length} additional ${hiddenIcons.length === 1 ? 'item' : 'items'}`}\n style={\n {\n '--icon-z-index': maxVisible,\n } as React.CSSProperties\n }\n >\n <Icon\n name={`${hiddenIcons.length}+`}\n size={compact ? 'md' : 'lg'}\n bgColor={theme.colors.secondary.blue.darkest}\n textColor={theme.colors.neutral.grey.lightest}\n ariaLabel=\"Number of additional icons not shown\"\n hasIndicator={hasIndicator}\n />\n </li>\n )}\n {visibleIcons.map((icon, index) => (\n <li\n key={`icon-group-item-${icon.name}`}\n className={styles.item}\n aria-label={`Icon item of ${icon.name}`}\n style={\n {\n '--icon-z-index': visibleIcons.length - index,\n } as React.CSSProperties\n }\n >\n <Icon\n {...icon}\n hasIndicator={false}\n size={compact ? 'md' : 'lg'}\n bgColor={icon?.bgColor ?? theme.colors.neutral.grey.light}\n textColor={icon?.textColor ?? theme.colors.neutral.ink.base}\n />\n </li>\n ))}\n </ul>\n );\n};\n"],"names":["React","Icon"],"mappings":";;;;;;;;AAUO,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,UAAU,GAAG,CAAC,EACd,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,gBAAgB,EAC5B,YAAY,GAAG,KAAK,EACpB,SAAS,EACT,GAAG,SAAS,EACG,KAAI;AACnB,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAC9B,CAAC,EACD,KAAK,CAAC,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG,UAAU,CACrE;IACD,MAAM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AAC,MAAM,GAAG,KAAK;AACvB,iBAAA,EAAA;AAG1B,gBAAAA,cAAA,CAAA,aAAA,CAACC,MAAI,EAAA,EAAA,GACC,IAAI,EACR,YAAY,EAAE,KAAK,EACnB,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,EAC3B,OAAO,EAAE,CAAA,EAAA,GAAA,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EACzD,SAAS,EAAE,CAAA,EAAA,GAAA,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,SAAS,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAA,CAC3D,CACC;SACN,CAAC,CACC;AAET;;;;"}
|
|
@@ -2,29 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var LoginWithAmazonButton_module = require('./LoginWithAmazonButton.module.scss.cjs');
|
|
5
|
+
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
6
|
+
require('uid/secure');
|
|
7
|
+
var Action = require('../Action/Action.cjs');
|
|
5
8
|
|
|
6
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
7
10
|
|
|
8
11
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
9
12
|
|
|
10
|
-
const buttonImg = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA_gold_312x64.png';
|
|
11
|
-
const buttonPressedImg = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA_gold_312x64_pressed.png';
|
|
12
13
|
const buttonDescription = 'Log in with Amazon';
|
|
14
|
+
const LWA_IMAGE_BASE = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa';
|
|
15
|
+
/** Amazon's abbreviated colour code used in the button asset filenames. */
|
|
16
|
+
const VARIANT_COLOR = {
|
|
17
|
+
gold: 'gold',
|
|
18
|
+
darkgray: 'drkgry',
|
|
19
|
+
lightgray: 'gry',
|
|
20
|
+
};
|
|
21
|
+
/** Intrinsic pixel dimensions of the button asset for each size. */
|
|
22
|
+
const SIZE_DIMENSIONS = {
|
|
23
|
+
base: '312x64',
|
|
24
|
+
sm: '152x64',
|
|
25
|
+
xs: '64x64',
|
|
26
|
+
};
|
|
27
|
+
/** Rendered size (half the 2x asset). Set on the <img> so the browser reserves space before load (CLS). */
|
|
28
|
+
const RENDERED_SIZE = {
|
|
29
|
+
base: { width: 156, height: 32 },
|
|
30
|
+
sm: { width: 76, height: 32 },
|
|
31
|
+
xs: { width: 32, height: 32 },
|
|
32
|
+
};
|
|
33
|
+
const lwaImageSrc = (variant, size, pressed) => `${LWA_IMAGE_BASE}/btnLWA_${VARIANT_COLOR[variant]}_${SIZE_DIMENSIONS[size]}${pressed ? '_pressed' : ''}.png`;
|
|
13
34
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Amazon button guidelines
|
|
35
|
+
* A "Log in with Amazon" button rendered from Amazon's official button artwork,
|
|
36
|
+
* in line with the [Login with Amazon button guidelines](https://developer.amazon.com/docs/login-with-amazon/button.html).
|
|
37
|
+
*
|
|
38
|
+
* Built on `Action` (`appearance="unstyled"`), so it inherits Action's reset, native
|
|
39
|
+
* `disabled` handling and data-attribute support. The button swaps to its pressed artwork
|
|
40
|
+
* via `:active`, so mouse, touch and keyboard activation all show it. Colour is chosen with
|
|
41
|
+
* `variant` (gold / darkgray / lightgray) and dimensions with `size` (base / sm / xs); the
|
|
42
|
+
* two together select the exact asset. The accessible name defaults to "Log in with Amazon"
|
|
43
|
+
* and can be overridden via `aria-label` for localisation.
|
|
44
|
+
*
|
|
45
|
+
* @summary official Amazon sign-in button
|
|
16
46
|
*/
|
|
17
|
-
const LoginWithAmazonButton = (props) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
setImage(buttonPressedImg);
|
|
21
|
-
};
|
|
22
|
-
const handleMouseUp = () => {
|
|
23
|
-
setImage(buttonImg);
|
|
24
|
-
};
|
|
25
|
-
return (React__default.default.createElement("button", { type: "button", className: LoginWithAmazonButton_module.loginButton, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, "aria-label": buttonDescription, ...props },
|
|
26
|
-
React__default.default.createElement("img", { src: image, alt: buttonDescription })));
|
|
27
|
-
};
|
|
47
|
+
const LoginWithAmazonButton = ({ variant = 'gold', size = 'base', className, ...props }) => (React__default.default.createElement(Action.Action, { "aria-label": buttonDescription, ...props, appearance: "unstyled", className: buildClassnames.buildClassnames([LoginWithAmazonButton_module.loginButton, className]) },
|
|
48
|
+
React__default.default.createElement("img", { className: LoginWithAmazonButton_module['default-state'], src: lwaImageSrc(variant, size, false), alt: "", ...RENDERED_SIZE[size] }),
|
|
49
|
+
React__default.default.createElement("img", { className: LoginWithAmazonButton_module['pressed-state'], src: lwaImageSrc(variant, size, true), alt: "", ...RENDERED_SIZE[size] })));
|
|
28
50
|
|
|
29
51
|
exports.LoginWithAmazonButton = LoginWithAmazonButton;
|
|
30
52
|
exports.buttonDescription = buttonDescription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginWithAmazonButton.cjs","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.tsx"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"LoginWithAmazonButton.cjs","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './LoginWithAmazonButton.module.scss';\nimport { buildClassnames } from '../../utils';\nimport { Action } from '../Action';\nimport type {\n LoginWithAmazonButtonProps,\n LoginWithAmazonButtonSize,\n LoginWithAmazonButtonVariant,\n} from './types';\n\nexport const buttonDescription = 'Log in with Amazon';\n\nconst LWA_IMAGE_BASE = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa';\n\n/** Amazon's abbreviated colour code used in the button asset filenames. */\nconst VARIANT_COLOR: Record<LoginWithAmazonButtonVariant, string> = {\n gold: 'gold',\n darkgray: 'drkgry',\n lightgray: 'gry',\n};\n\n/** Intrinsic pixel dimensions of the button asset for each size. */\nconst SIZE_DIMENSIONS: Record<LoginWithAmazonButtonSize, string> = {\n base: '312x64',\n sm: '152x64',\n xs: '64x64',\n};\n\n/** Rendered size (half the 2x asset). Set on the <img> so the browser reserves space before load (CLS). */\nconst RENDERED_SIZE: Record<LoginWithAmazonButtonSize, { width: number; height: number }> = {\n base: { width: 156, height: 32 },\n sm: { width: 76, height: 32 },\n xs: { width: 32, height: 32 },\n};\n\nconst lwaImageSrc = (\n variant: LoginWithAmazonButtonVariant,\n size: LoginWithAmazonButtonSize,\n pressed: boolean,\n) =>\n `${LWA_IMAGE_BASE}/btnLWA_${VARIANT_COLOR[variant]}_${SIZE_DIMENSIONS[size]}${pressed ? '_pressed' : ''}.png`;\n\n/**\n * A \"Log in with Amazon\" button rendered from Amazon's official button artwork,\n * in line with the [Login with Amazon button guidelines](https://developer.amazon.com/docs/login-with-amazon/button.html).\n *\n * Built on `Action` (`appearance=\"unstyled\"`), so it inherits Action's reset, native\n * `disabled` handling and data-attribute support. The button swaps to its pressed artwork\n * via `:active`, so mouse, touch and keyboard activation all show it. Colour is chosen with\n * `variant` (gold / darkgray / lightgray) and dimensions with `size` (base / sm / xs); the\n * two together select the exact asset. The accessible name defaults to \"Log in with Amazon\"\n * and can be overridden via `aria-label` for localisation.\n *\n * @summary official Amazon sign-in button\n */\nexport const LoginWithAmazonButton = ({\n variant = 'gold',\n size = 'base',\n className,\n ...props\n}: LoginWithAmazonButtonProps) => (\n <Action\n aria-label={buttonDescription}\n {...props}\n appearance=\"unstyled\"\n className={buildClassnames([styles.loginButton, className])}\n >\n {/* Both images are rendered so the pressed artwork is preloaded; CSS shows one at a time.\n They are decorative (alt=\"\") because the button's aria-label carries the accessible name. */}\n <img\n className={styles['default-state']}\n src={lwaImageSrc(variant, size, false)}\n alt=\"\"\n {...RENDERED_SIZE[size]}\n />\n <img\n className={styles['pressed-state']}\n src={lwaImageSrc(variant, size, true)}\n alt=\"\"\n {...RENDERED_SIZE[size]}\n />\n </Action>\n);\n"],"names":["React","Action","buildClassnames","styles"],"mappings":";;;;;;;;;;;;AAUO,MAAM,iBAAiB,GAAG;AAEjC,MAAM,cAAc,GAAG,yDAAyD;AAEhF;AACA,MAAM,aAAa,GAAiD;AAClE,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,SAAS,EAAE,KAAK;CACjB;AAED;AACA,MAAM,eAAe,GAA8C;AACjE,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,EAAE,EAAE,OAAO;CACZ;AAED;AACA,MAAM,aAAa,GAAyE;IAC1F,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IAChC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IAC7B,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;CAC9B;AAED,MAAM,WAAW,GAAG,CAClB,OAAqC,EACrC,IAA+B,EAC/B,OAAgB,KAEhB,CAAA,EAAG,cAAc,CAAA,QAAA,EAAW,aAAa,CAAC,OAAO,CAAC,CAAA,CAAA,EAAI,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,UAAU,GAAG,EAAE,MAAM;AAE/G;;;;;;;;;;;;AAYG;MACU,qBAAqB,GAAG,CAAC,EACpC,OAAO,GAAG,MAAM,EAChB,IAAI,GAAG,MAAM,EACb,SAAS,EACT,GAAG,KAAK,EACmB,MAC3BA,sBAAA,CAAA,aAAA,CAACC,aAAM,kBACO,iBAAiB,EAAA,GACzB,KAAK,EACT,UAAU,EAAC,UAAU,EACrB,SAAS,EAAEC,+BAAe,CAAC,CAACC,4BAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,EAAA;IAI3DH,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEG,4BAAM,CAAC,eAAe,CAAC,EAClC,GAAG,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,EACtC,GAAG,EAAC,EAAE,EAAA,GACF,aAAa,CAAC,IAAI,CAAC,EAAA,CACvB;AACF,IAAAH,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEG,4BAAM,CAAC,eAAe,CAAC,EAClC,GAAG,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EACrC,GAAG,EAAC,EAAE,EAAA,GACF,aAAa,CAAC,IAAI,CAAC,EAAA,CACvB,CACK;;;;;"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { LoginWithAmazonButtonProps } from './types';
|
|
2
3
|
export declare const buttonDescription = "Log in with Amazon";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Amazon button guidelines
|
|
5
|
+
* A "Log in with Amazon" button rendered from Amazon's official button artwork,
|
|
6
|
+
* in line with the [Login with Amazon button guidelines](https://developer.amazon.com/docs/login-with-amazon/button.html).
|
|
7
|
+
*
|
|
8
|
+
* Built on `Action` (`appearance="unstyled"`), so it inherits Action's reset, native
|
|
9
|
+
* `disabled` handling and data-attribute support. The button swaps to its pressed artwork
|
|
10
|
+
* via `:active`, so mouse, touch and keyboard activation all show it. Colour is chosen with
|
|
11
|
+
* `variant` (gold / darkgray / lightgray) and dimensions with `size` (base / sm / xs); the
|
|
12
|
+
* two together select the exact asset. The accessible name defaults to "Log in with Amazon"
|
|
13
|
+
* and can be overridden via `aria-label` for localisation.
|
|
14
|
+
*
|
|
15
|
+
* @summary official Amazon sign-in button
|
|
6
16
|
*/
|
|
7
|
-
export declare const LoginWithAmazonButton: React.
|
|
17
|
+
export declare const LoginWithAmazonButton: ({ variant, size, className, ...props }: LoginWithAmazonButtonProps) => React.JSX.Element;
|
|
@@ -1,24 +1,46 @@
|
|
|
1
|
-
import React__default
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import styles from './LoginWithAmazonButton.module.scss.js';
|
|
3
|
+
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
4
|
+
import 'uid/secure';
|
|
5
|
+
import { Action } from '../Action/Action.js';
|
|
3
6
|
|
|
4
|
-
const buttonImg = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA_gold_312x64.png';
|
|
5
|
-
const buttonPressedImg = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA_gold_312x64_pressed.png';
|
|
6
7
|
const buttonDescription = 'Log in with Amazon';
|
|
8
|
+
const LWA_IMAGE_BASE = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa';
|
|
9
|
+
/** Amazon's abbreviated colour code used in the button asset filenames. */
|
|
10
|
+
const VARIANT_COLOR = {
|
|
11
|
+
gold: 'gold',
|
|
12
|
+
darkgray: 'drkgry',
|
|
13
|
+
lightgray: 'gry',
|
|
14
|
+
};
|
|
15
|
+
/** Intrinsic pixel dimensions of the button asset for each size. */
|
|
16
|
+
const SIZE_DIMENSIONS = {
|
|
17
|
+
base: '312x64',
|
|
18
|
+
sm: '152x64',
|
|
19
|
+
xs: '64x64',
|
|
20
|
+
};
|
|
21
|
+
/** Rendered size (half the 2x asset). Set on the <img> so the browser reserves space before load (CLS). */
|
|
22
|
+
const RENDERED_SIZE = {
|
|
23
|
+
base: { width: 156, height: 32 },
|
|
24
|
+
sm: { width: 76, height: 32 },
|
|
25
|
+
xs: { width: 32, height: 32 },
|
|
26
|
+
};
|
|
27
|
+
const lwaImageSrc = (variant, size, pressed) => `${LWA_IMAGE_BASE}/btnLWA_${VARIANT_COLOR[variant]}_${SIZE_DIMENSIONS[size]}${pressed ? '_pressed' : ''}.png`;
|
|
7
28
|
/**
|
|
8
|
-
*
|
|
9
|
-
* Amazon button guidelines
|
|
29
|
+
* A "Log in with Amazon" button rendered from Amazon's official button artwork,
|
|
30
|
+
* in line with the [Login with Amazon button guidelines](https://developer.amazon.com/docs/login-with-amazon/button.html).
|
|
31
|
+
*
|
|
32
|
+
* Built on `Action` (`appearance="unstyled"`), so it inherits Action's reset, native
|
|
33
|
+
* `disabled` handling and data-attribute support. The button swaps to its pressed artwork
|
|
34
|
+
* via `:active`, so mouse, touch and keyboard activation all show it. Colour is chosen with
|
|
35
|
+
* `variant` (gold / darkgray / lightgray) and dimensions with `size` (base / sm / xs); the
|
|
36
|
+
* two together select the exact asset. The accessible name defaults to "Log in with Amazon"
|
|
37
|
+
* and can be overridden via `aria-label` for localisation.
|
|
38
|
+
*
|
|
39
|
+
* @summary official Amazon sign-in button
|
|
10
40
|
*/
|
|
11
|
-
const LoginWithAmazonButton = (props) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
setImage(buttonPressedImg);
|
|
15
|
-
};
|
|
16
|
-
const handleMouseUp = () => {
|
|
17
|
-
setImage(buttonImg);
|
|
18
|
-
};
|
|
19
|
-
return (React__default.createElement("button", { type: "button", className: styles.loginButton, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, "aria-label": buttonDescription, ...props },
|
|
20
|
-
React__default.createElement("img", { src: image, alt: buttonDescription })));
|
|
21
|
-
};
|
|
41
|
+
const LoginWithAmazonButton = ({ variant = 'gold', size = 'base', className, ...props }) => (React__default.createElement(Action, { "aria-label": buttonDescription, ...props, appearance: "unstyled", className: buildClassnames([styles.loginButton, className]) },
|
|
42
|
+
React__default.createElement("img", { className: styles['default-state'], src: lwaImageSrc(variant, size, false), alt: "", ...RENDERED_SIZE[size] }),
|
|
43
|
+
React__default.createElement("img", { className: styles['pressed-state'], src: lwaImageSrc(variant, size, true), alt: "", ...RENDERED_SIZE[size] })));
|
|
22
44
|
|
|
23
45
|
export { LoginWithAmazonButton, buttonDescription };
|
|
24
46
|
//# sourceMappingURL=LoginWithAmazonButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginWithAmazonButton.js","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.tsx"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"LoginWithAmazonButton.js","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './LoginWithAmazonButton.module.scss';\nimport { buildClassnames } from '../../utils';\nimport { Action } from '../Action';\nimport type {\n LoginWithAmazonButtonProps,\n LoginWithAmazonButtonSize,\n LoginWithAmazonButtonVariant,\n} from './types';\n\nexport const buttonDescription = 'Log in with Amazon';\n\nconst LWA_IMAGE_BASE = 'https://images-na.ssl-images-amazon.com/images/G/01/lwa';\n\n/** Amazon's abbreviated colour code used in the button asset filenames. */\nconst VARIANT_COLOR: Record<LoginWithAmazonButtonVariant, string> = {\n gold: 'gold',\n darkgray: 'drkgry',\n lightgray: 'gry',\n};\n\n/** Intrinsic pixel dimensions of the button asset for each size. */\nconst SIZE_DIMENSIONS: Record<LoginWithAmazonButtonSize, string> = {\n base: '312x64',\n sm: '152x64',\n xs: '64x64',\n};\n\n/** Rendered size (half the 2x asset). Set on the <img> so the browser reserves space before load (CLS). */\nconst RENDERED_SIZE: Record<LoginWithAmazonButtonSize, { width: number; height: number }> = {\n base: { width: 156, height: 32 },\n sm: { width: 76, height: 32 },\n xs: { width: 32, height: 32 },\n};\n\nconst lwaImageSrc = (\n variant: LoginWithAmazonButtonVariant,\n size: LoginWithAmazonButtonSize,\n pressed: boolean,\n) =>\n `${LWA_IMAGE_BASE}/btnLWA_${VARIANT_COLOR[variant]}_${SIZE_DIMENSIONS[size]}${pressed ? '_pressed' : ''}.png`;\n\n/**\n * A \"Log in with Amazon\" button rendered from Amazon's official button artwork,\n * in line with the [Login with Amazon button guidelines](https://developer.amazon.com/docs/login-with-amazon/button.html).\n *\n * Built on `Action` (`appearance=\"unstyled\"`), so it inherits Action's reset, native\n * `disabled` handling and data-attribute support. The button swaps to its pressed artwork\n * via `:active`, so mouse, touch and keyboard activation all show it. Colour is chosen with\n * `variant` (gold / darkgray / lightgray) and dimensions with `size` (base / sm / xs); the\n * two together select the exact asset. The accessible name defaults to \"Log in with Amazon\"\n * and can be overridden via `aria-label` for localisation.\n *\n * @summary official Amazon sign-in button\n */\nexport const LoginWithAmazonButton = ({\n variant = 'gold',\n size = 'base',\n className,\n ...props\n}: LoginWithAmazonButtonProps) => (\n <Action\n aria-label={buttonDescription}\n {...props}\n appearance=\"unstyled\"\n className={buildClassnames([styles.loginButton, className])}\n >\n {/* Both images are rendered so the pressed artwork is preloaded; CSS shows one at a time.\n They are decorative (alt=\"\") because the button's aria-label carries the accessible name. */}\n <img\n className={styles['default-state']}\n src={lwaImageSrc(variant, size, false)}\n alt=\"\"\n {...RENDERED_SIZE[size]}\n />\n <img\n className={styles['pressed-state']}\n src={lwaImageSrc(variant, size, true)}\n alt=\"\"\n {...RENDERED_SIZE[size]}\n />\n </Action>\n);\n"],"names":["React"],"mappings":";;;;;;AAUO,MAAM,iBAAiB,GAAG;AAEjC,MAAM,cAAc,GAAG,yDAAyD;AAEhF;AACA,MAAM,aAAa,GAAiD;AAClE,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,SAAS,EAAE,KAAK;CACjB;AAED;AACA,MAAM,eAAe,GAA8C;AACjE,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,EAAE,EAAE,OAAO;CACZ;AAED;AACA,MAAM,aAAa,GAAyE;IAC1F,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IAChC,EAAE,EAAE,EAA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$insertStyle(".
|
|
6
|
-
var styles = {"loginButton":"
|
|
5
|
+
___$insertStyle("._loginButton_1aojq_1 {\n --lwa-outline-width: var(--sizes-xs);\n --lwa-highlight-color: var(--colors-secondary-blue-light);\n}\n._loginButton_1aojq_1 img {\n display: block;\n}\n._loginButton_1aojq_1:hover:not(:disabled) {\n opacity: 0.9;\n}\n._loginButton_1aojq_1:focus-visible {\n outline: var(--lwa-outline-width) solid var(--lwa-highlight-color);\n}\n._loginButton_1aojq_1:disabled, ._loginButton_1aojq_1:disabled:hover {\n cursor: not-allowed;\n opacity: 0.5;\n}\n._loginButton_1aojq_1 ._pressed-state_1aojq_18, ._loginButton_1aojq_1:active:not(:disabled) ._default-state_1aojq_18 {\n display: none;\n}\n._loginButton_1aojq_1:active:not(:disabled) ._pressed-state_1aojq_18 {\n display: block;\n}");
|
|
6
|
+
var styles = {"loginButton":"_loginButton_1aojq_1","pressed-state":"_pressed-state_1aojq_18","default-state":"_default-state_1aojq_18"};
|
|
7
7
|
|
|
8
8
|
module.exports = styles;
|
|
9
9
|
//# sourceMappingURL=LoginWithAmazonButton.module.scss.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginWithAmazonButton.module.scss.cjs","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss"],"sourcesContent":[".loginButton {\n
|
|
1
|
+
{"version":3,"file":"LoginWithAmazonButton.module.scss.cjs","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss"],"sourcesContent":["// Reset (appearance/border/background/padding/cursor) comes from Action's `unstyled` appearance.\n// Image dimensions are set via width/height attributes on the <img> (see RENDERED_SIZE in the\n// component) so the browser reserves space before load.\n.loginButton {\n --lwa-outline-width: var(--sizes-xs);\n --lwa-highlight-color: var(--colors-secondary-blue-light);\n\n img {\n display: block;\n }\n\n // The fill is fixed raster artwork, so a background hover would be invisible;\n // a slight dim is the treatment Amazon's own LWA guidelines use.\n &:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n &:focus-visible {\n outline: var(--lwa-outline-width) solid var(--lwa-highlight-color);\n }\n\n // `&:disabled:hover` out-specifies Action's reset `:hover { cursor: pointer }`,\n // which would otherwise win depending on stylesheet load order.\n &:disabled,\n &:disabled:hover {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .pressed-state,\n &:active:not(:disabled) .default-state {\n display: none;\n }\n\n &:active:not(:disabled) .pressed-state {\n display: block;\n }\n}\n"],"names":[],"mappings":";;;;AAIE,eAAA,CAAA,wsBAAA;AACA,aAAA,CAAA,aAAA,CAAA,sBAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,eAAA,CAAA,yBAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
2
|
|
|
3
|
-
insertStyle(".
|
|
4
|
-
var styles = {"loginButton":"
|
|
3
|
+
insertStyle("._loginButton_1aojq_1 {\n --lwa-outline-width: var(--sizes-xs);\n --lwa-highlight-color: var(--colors-secondary-blue-light);\n}\n._loginButton_1aojq_1 img {\n display: block;\n}\n._loginButton_1aojq_1:hover:not(:disabled) {\n opacity: 0.9;\n}\n._loginButton_1aojq_1:focus-visible {\n outline: var(--lwa-outline-width) solid var(--lwa-highlight-color);\n}\n._loginButton_1aojq_1:disabled, ._loginButton_1aojq_1:disabled:hover {\n cursor: not-allowed;\n opacity: 0.5;\n}\n._loginButton_1aojq_1 ._pressed-state_1aojq_18, ._loginButton_1aojq_1:active:not(:disabled) ._default-state_1aojq_18 {\n display: none;\n}\n._loginButton_1aojq_1:active:not(:disabled) ._pressed-state_1aojq_18 {\n display: block;\n}");
|
|
4
|
+
var styles = {"loginButton":"_loginButton_1aojq_1","pressed-state":"_pressed-state_1aojq_18","default-state":"_default-state_1aojq_18"};
|
|
5
5
|
|
|
6
6
|
export { styles as default };
|
|
7
7
|
//# sourceMappingURL=LoginWithAmazonButton.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginWithAmazonButton.module.scss.js","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss"],"sourcesContent":[".loginButton {\n
|
|
1
|
+
{"version":3,"file":"LoginWithAmazonButton.module.scss.js","sources":["../../../src/components/LoginWithAmazonButton/LoginWithAmazonButton.module.scss"],"sourcesContent":["// Reset (appearance/border/background/padding/cursor) comes from Action's `unstyled` appearance.\n// Image dimensions are set via width/height attributes on the <img> (see RENDERED_SIZE in the\n// component) so the browser reserves space before load.\n.loginButton {\n --lwa-outline-width: var(--sizes-xs);\n --lwa-highlight-color: var(--colors-secondary-blue-light);\n\n img {\n display: block;\n }\n\n // The fill is fixed raster artwork, so a background hover would be invisible;\n // a slight dim is the treatment Amazon's own LWA guidelines use.\n &:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n &:focus-visible {\n outline: var(--lwa-outline-width) solid var(--lwa-highlight-color);\n }\n\n // `&:disabled:hover` out-specifies Action's reset `:hover { cursor: pointer }`,\n // which would otherwise win depending on stylesheet load order.\n &:disabled,\n &:disabled:hover {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .pressed-state,\n &:active:not(:disabled) .default-state {\n display: none;\n }\n\n &:active:not(:disabled) .pressed-state {\n display: block;\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AAIEA,WAAA,CAAA,wsBAAA;AACA,aAAA,CAAA,aAAA,CAAA,sBAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,eAAA,CAAA,yBAAA;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ActionProps } from '../Action';
|
|
2
|
+
export type LoginWithAmazonButtonVariant = 'gold' | 'darkgray' | 'lightgray';
|
|
3
|
+
export type LoginWithAmazonButtonSize = 'base' | 'sm' | 'xs';
|
|
4
|
+
/**
|
|
5
|
+
* Built on `Action` with the `unstyled` appearance. The Action props that would fight
|
|
6
|
+
* the fixed Amazon artwork are removed: `children`/`iconSlot`/`dropdown` (the artwork IS
|
|
7
|
+
* the content), `href`/`as` (always a `<button>`), Action's own `variant`/`size`/
|
|
8
|
+
* `appearance` (replaced by the artwork-specific ones below), and `loading` (Action's
|
|
9
|
+
* spinner is absolutely positioned against `.base`, which `unstyled` does not apply, so
|
|
10
|
+
* it would render outside the button).
|
|
11
|
+
*/
|
|
12
|
+
export type LoginWithAmazonButtonProps = Omit<ActionProps<'button'>, 'appearance' | 'as' | 'children' | 'dropdown' | 'href' | 'iconSlot' | 'loading' | 'size' | 'variant'> & {
|
|
13
|
+
/**
|
|
14
|
+
* Official Amazon button colour. `gold` is Amazon's recommended default;
|
|
15
|
+
* use `darkgray` on light surfaces and `lightgray` on dark surfaces where
|
|
16
|
+
* gold lacks contrast. Selects the hardcoded Amazon artwork — not themeable.
|
|
17
|
+
*/
|
|
18
|
+
variant?: LoginWithAmazonButtonVariant;
|
|
19
|
+
/**
|
|
20
|
+
* Button size, selecting both the rendered dimensions and the matching artwork.
|
|
21
|
+
* `base` (156×32) and `sm` (76×32) are wide badges; `xs` (32×32) is Amazon's
|
|
22
|
+
* square icon-only mark, so it is a different aspect ratio rather than a smaller badge.
|
|
23
|
+
*/
|
|
24
|
+
size?: LoginWithAmazonButtonSize;
|
|
25
|
+
};
|
|
@@ -10,6 +10,17 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Skeleton is a shimmering placeholder shown while content is loading, giving a
|
|
15
|
+
* consistent sense of where content will appear before it arrives. Size it with
|
|
16
|
+
* `width` and `height` to match the content it stands in for.
|
|
17
|
+
*
|
|
18
|
+
* It is intentionally barebones and is hidden from screen readers
|
|
19
|
+
* (`aria-hidden`). Loading must be communicated to assistive technology at the
|
|
20
|
+
* container or page level using `aria-busy` and a `ScreenReaderOnly` label.
|
|
21
|
+
*
|
|
22
|
+
* @summary loading placeholder for content
|
|
23
|
+
*/
|
|
13
24
|
const Skeleton = ({ width, height, style, className, ...rest }) => {
|
|
14
25
|
return (React__default.default.createElement("div", { "aria-hidden": "true", style: { ...assignCssVars.assignCssVars({ width, height }), ...style }, className: buildClassnames.buildClassnames([Skeleton_module.skeleton, className]), ...rest }));
|
|
15
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.cjs","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React, { HTMLAttributes } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { assignCssVars } from '../../utils/assignCssVars';\n\nimport styles from './Skeleton.module.scss';\n\ntype SkeletonProps = HTMLAttributes<HTMLDivElement> & {\n width?: string;\n height?: string;\n};\n\nexport const Skeleton = ({ width, height, style, className, ...rest }: SkeletonProps) => {\n return (\n <div\n aria-hidden=\"true\"\n style={{ ...assignCssVars({ width, height }), ...style }}\n className={buildClassnames([styles.skeleton, className])}\n {...rest}\n />\n );\n};\n"],"names":["React","assignCssVars","buildClassnames","styles"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Skeleton.cjs","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React, { HTMLAttributes } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { assignCssVars } from '../../utils/assignCssVars';\n\nimport styles from './Skeleton.module.scss';\n\ntype SkeletonProps = HTMLAttributes<HTMLDivElement> & {\n /** Width of the placeholder as any CSS length. Defaults to `100%`. */\n width?: string;\n /** Height of the placeholder as any CSS length. Defaults to `20px`. */\n height?: string;\n};\n\n/**\n * Skeleton is a shimmering placeholder shown while content is loading, giving a\n * consistent sense of where content will appear before it arrives. Size it with\n * `width` and `height` to match the content it stands in for.\n *\n * It is intentionally barebones and is hidden from screen readers\n * (`aria-hidden`). Loading must be communicated to assistive technology at the\n * container or page level using `aria-busy` and a `ScreenReaderOnly` label.\n *\n * @summary loading placeholder for content\n */\nexport const Skeleton = ({ width, height, style, className, ...rest }: SkeletonProps) => {\n return (\n <div\n aria-hidden=\"true\"\n style={{ ...assignCssVars({ width, height }), ...style }}\n className={buildClassnames([styles.skeleton, className])}\n {...rest}\n />\n );\n};\n"],"names":["React","assignCssVars","buildClassnames","styles"],"mappings":";;;;;;;;;;;;AAcA;;;;;;;;;;AAUG;AACI,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAiB,KAAI;AACtF,IAAA,QACEA,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,KAAK,EAAE,EAAE,GAAGC,2BAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,EACxD,SAAS,EAAEC,+BAAe,CAAC,CAACC,eAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,KACpD,IAAI,EAAA,CACR;AAEN;;;;"}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from 'react';
|
|
2
2
|
type SkeletonProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
/** Width of the placeholder as any CSS length. Defaults to `100%`. */
|
|
3
4
|
width?: string;
|
|
5
|
+
/** Height of the placeholder as any CSS length. Defaults to `20px`. */
|
|
4
6
|
height?: string;
|
|
5
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Skeleton is a shimmering placeholder shown while content is loading, giving a
|
|
10
|
+
* consistent sense of where content will appear before it arrives. Size it with
|
|
11
|
+
* `width` and `height` to match the content it stands in for.
|
|
12
|
+
*
|
|
13
|
+
* It is intentionally barebones and is hidden from screen readers
|
|
14
|
+
* (`aria-hidden`). Loading must be communicated to assistive technology at the
|
|
15
|
+
* container or page level using `aria-busy` and a `ScreenReaderOnly` label.
|
|
16
|
+
*
|
|
17
|
+
* @summary loading placeholder for content
|
|
18
|
+
*/
|
|
6
19
|
export declare const Skeleton: ({ width, height, style, className, ...rest }: SkeletonProps) => React.JSX.Element;
|
|
7
20
|
export {};
|
|
@@ -4,6 +4,17 @@ import 'uid/secure';
|
|
|
4
4
|
import { assignCssVars } from '../../utils/assignCssVars.js';
|
|
5
5
|
import styles from './Skeleton.module.scss.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Skeleton is a shimmering placeholder shown while content is loading, giving a
|
|
9
|
+
* consistent sense of where content will appear before it arrives. Size it with
|
|
10
|
+
* `width` and `height` to match the content it stands in for.
|
|
11
|
+
*
|
|
12
|
+
* It is intentionally barebones and is hidden from screen readers
|
|
13
|
+
* (`aria-hidden`). Loading must be communicated to assistive technology at the
|
|
14
|
+
* container or page level using `aria-busy` and a `ScreenReaderOnly` label.
|
|
15
|
+
*
|
|
16
|
+
* @summary loading placeholder for content
|
|
17
|
+
*/
|
|
7
18
|
const Skeleton = ({ width, height, style, className, ...rest }) => {
|
|
8
19
|
return (React__default.createElement("div", { "aria-hidden": "true", style: { ...assignCssVars({ width, height }), ...style }, className: buildClassnames([styles.skeleton, className]), ...rest }));
|
|
9
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React, { HTMLAttributes } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { assignCssVars } from '../../utils/assignCssVars';\n\nimport styles from './Skeleton.module.scss';\n\ntype SkeletonProps = HTMLAttributes<HTMLDivElement> & {\n width?: string;\n height?: string;\n};\n\nexport const Skeleton = ({ width, height, style, className, ...rest }: SkeletonProps) => {\n return (\n <div\n aria-hidden=\"true\"\n style={{ ...assignCssVars({ width, height }), ...style }}\n className={buildClassnames([styles.skeleton, className])}\n {...rest}\n />\n );\n};\n"],"names":["React"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React, { HTMLAttributes } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { assignCssVars } from '../../utils/assignCssVars';\n\nimport styles from './Skeleton.module.scss';\n\ntype SkeletonProps = HTMLAttributes<HTMLDivElement> & {\n /** Width of the placeholder as any CSS length. Defaults to `100%`. */\n width?: string;\n /** Height of the placeholder as any CSS length. Defaults to `20px`. */\n height?: string;\n};\n\n/**\n * Skeleton is a shimmering placeholder shown while content is loading, giving a\n * consistent sense of where content will appear before it arrives. Size it with\n * `width` and `height` to match the content it stands in for.\n *\n * It is intentionally barebones and is hidden from screen readers\n * (`aria-hidden`). Loading must be communicated to assistive technology at the\n * container or page level using `aria-busy` and a `ScreenReaderOnly` label.\n *\n * @summary loading placeholder for content\n */\nexport const Skeleton = ({ width, height, style, className, ...rest }: SkeletonProps) => {\n return (\n <div\n aria-hidden=\"true\"\n style={{ ...assignCssVars({ width, height }), ...style }}\n className={buildClassnames([styles.skeleton, className])}\n {...rest}\n />\n );\n};\n"],"names":["React"],"mappings":";;;;;;AAcA;;;;;;;;;;AAUG;AACI,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAiB,KAAI;AACtF,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,KAAK,EAAE,EAAE,GAAG,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,EACxD,SAAS,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,KACpD,IAAI,EAAA,CACR;AAEN;;;;"}
|
|
@@ -7,6 +7,8 @@ export type { AlertVariants, MiniAlertVariants } from './Alerts/types';
|
|
|
7
7
|
export { Anchor, isAnchorUrl, isRelativeUrl, createContextAwareUrl, addPrefixToUrl, shouldAddPrefix, } from './Anchor';
|
|
8
8
|
export { AnimatedDropdown } from './AnimatedDropdown';
|
|
9
9
|
export { Avatar } from './Avatar';
|
|
10
|
+
export type { AvatarProps } from './Avatar';
|
|
11
|
+
export { AvatarSize } from './Avatar';
|
|
10
12
|
export { IconGroup } from './IconGroup';
|
|
11
13
|
export { Badge } from './Badge';
|
|
12
14
|
export { Banner } from './Banner';
|
|
@@ -39,7 +41,7 @@ export { InputAffix } from './InputAffix';
|
|
|
39
41
|
export { InputGroup, type InputGroupProps } from './InputGroup';
|
|
40
42
|
export { LegacyDataTable } from './LegacyDataTable';
|
|
41
43
|
export { Loader } from './Loader';
|
|
42
|
-
export { LoginWithAmazonButton } from './LoginWithAmazonButton';
|
|
44
|
+
export { LoginWithAmazonButton, type LoginWithAmazonButtonProps, type LoginWithAmazonButtonSize, type LoginWithAmazonButtonVariant, } from './LoginWithAmazonButton';
|
|
43
45
|
export { Modal, type Action as ModalAction, type ModalProps } from './Modal';
|
|
44
46
|
export { Pagination } from './Pagination';
|
|
45
47
|
export { Popover } from './Popover';
|
package/dist/index.cjs
CHANGED
|
@@ -9,6 +9,7 @@ var Anchor = require('./components/Anchor/Anchor.cjs');
|
|
|
9
9
|
var urlUtils = require('./components/Anchor/utils/urlUtils.cjs');
|
|
10
10
|
var AnimatedDropdown = require('./components/AnimatedDropdown/AnimatedDropdown.cjs');
|
|
11
11
|
var Avatar = require('./components/Avatar/Avatar.cjs');
|
|
12
|
+
var types = require('./components/Avatar/types.cjs');
|
|
12
13
|
var IconGroup = require('./components/IconGroup/IconGroup.cjs');
|
|
13
14
|
var Badge = require('./components/Badge/Badge.cjs');
|
|
14
15
|
var Banner = require('./components/Banner/Banner.cjs');
|
|
@@ -419,6 +420,10 @@ exports.isRelativeUrl = urlUtils.isRelativeUrl;
|
|
|
419
420
|
exports.shouldAddPrefix = urlUtils.shouldAddPrefix;
|
|
420
421
|
exports.AnimatedDropdown = AnimatedDropdown.AnimatedDropdown;
|
|
421
422
|
exports.Avatar = Avatar.Avatar;
|
|
423
|
+
Object.defineProperty(exports, "AvatarSize", {
|
|
424
|
+
enumerable: true,
|
|
425
|
+
get: function () { return types.AvatarSize; }
|
|
426
|
+
});
|
|
422
427
|
exports.IconGroup = IconGroup.IconGroup;
|
|
423
428
|
exports.Badge = Badge.Badge;
|
|
424
429
|
exports.Banner = Banner.Banner;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { Anchor } from './components/Anchor/Anchor.js';
|
|
|
7
7
|
export { addPrefixToUrl, createContextAwareUrl, isAnchorUrl, isRelativeUrl, shouldAddPrefix } from './components/Anchor/utils/urlUtils.js';
|
|
8
8
|
export { AnimatedDropdown } from './components/AnimatedDropdown/AnimatedDropdown.js';
|
|
9
9
|
export { Avatar } from './components/Avatar/Avatar.js';
|
|
10
|
+
export { AvatarSize } from './components/Avatar/types.js';
|
|
10
11
|
export { IconGroup } from './components/IconGroup/IconGroup.js';
|
|
11
12
|
export { Badge } from './components/Badge/Badge.js';
|
|
12
13
|
export { Banner } from './components/Banner/Banner.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|