@veeqo/ui 16.0.0 → 16.2.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/DimensionsInput/DimensionsInput.cjs +22 -21
- package/dist/components/DimensionsInput/DimensionsInput.cjs.map +1 -1
- package/dist/components/DimensionsInput/DimensionsInput.d.ts +1 -0
- package/dist/components/DimensionsInput/DimensionsInput.js +22 -21
- package/dist/components/DimensionsInput/DimensionsInput.js.map +1 -1
- package/dist/components/DimensionsInput/types.d.ts +2 -0
- 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/WeightInput/WeightInput.cjs +2 -7
- package/dist/components/WeightInput/WeightInput.cjs.map +1 -1
- package/dist/components/WeightInput/WeightInput.js +2 -7
- package/dist/components/WeightInput/WeightInput.js.map +1 -1
- package/dist/components/WeightInput/WeightInput.module.scss.cjs +2 -2
- package/dist/components/WeightInput/WeightInput.module.scss.cjs.map +1 -1
- package/dist/components/WeightInput/WeightInput.module.scss.js +2 -2
- package/dist/components/WeightInput/WeightInput.module.scss.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var withLabels = require('../../hoc/withLabels/withLabels.cjs');
|
|
5
|
-
var
|
|
5
|
+
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
6
|
+
require('uid/secure');
|
|
6
7
|
var blockInvalidCharacters = require('../../utils/blockInvalidCharacters.cjs');
|
|
8
|
+
var invalidCharactersNumeric = require('../../utils/invalidCharactersNumeric.cjs');
|
|
9
|
+
var WeightInput_module = require('../WeightInput/WeightInput.module.scss.cjs');
|
|
7
10
|
var InputAffix = require('../InputAffix/InputAffix.cjs');
|
|
8
|
-
var index = require('../TextField/index.cjs');
|
|
9
|
-
var Stack = require('../Stack/Stack.cjs');
|
|
10
11
|
var InputGroup = require('../InputGroup/InputGroup.cjs');
|
|
12
|
+
var FlexRow = require('../Flex/FlexRow/FlexRow.cjs');
|
|
13
|
+
var index = require('../TextField/index.cjs');
|
|
11
14
|
|
|
12
15
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
16
|
|
|
14
17
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
18
|
|
|
16
19
|
const blockInvalidChars = (e) => blockInvalidCharacters.blockInvalidCharacters(e, invalidCharactersNumeric.invalidCharsList);
|
|
17
|
-
const
|
|
18
|
-
inputGroup: {
|
|
19
|
-
flex: 1,
|
|
20
|
-
},
|
|
21
|
-
textField: {
|
|
22
|
-
flex: 1,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
const DimensionsInput = withLabels.withLabels(({ size = 'base', handleChangeHeight, handleChangeWidth, handleChangeLength, className, height, width, length, unit = 'cm', hasError, ...rest }) => {
|
|
20
|
+
const DimensionsInput = withLabels.withLabels(({ size = 'base', handleChangeHeight, handleChangeWidth, handleChangeLength, className, height, width, length, unit = 'cm', hasError, placeholder = '0', ...rest }) => {
|
|
26
21
|
const compact = size === 'sm';
|
|
22
|
+
// Default (grey-base) outline for both field + affix; omitted on error so the
|
|
23
|
+
// error/focus border colours take over. Matches WeightInput exactly.
|
|
24
|
+
const defaultBorder = hasError ? undefined : WeightInput_module.defaultBorder;
|
|
25
|
+
// Group gets an error modifier so the focus-within ring turns red on error.
|
|
26
|
+
const groupClass = buildClassnames.buildClassnames([WeightInput_module.group, hasError && WeightInput_module.groupError]);
|
|
27
27
|
const childProps = {
|
|
28
28
|
inputGroup: {
|
|
29
29
|
hasError,
|
|
30
30
|
compact,
|
|
31
|
-
|
|
31
|
+
className: groupClass,
|
|
32
32
|
},
|
|
33
33
|
textField: {
|
|
34
34
|
type: 'number',
|
|
@@ -37,25 +37,26 @@ const DimensionsInput = withLabels.withLabels(({ size = 'base', handleChangeHeig
|
|
|
37
37
|
onKeyDown: blockInvalidChars,
|
|
38
38
|
size,
|
|
39
39
|
hasError,
|
|
40
|
-
|
|
40
|
+
className: buildClassnames.buildClassnames([WeightInput_module.field, defaultBorder]),
|
|
41
41
|
...rest,
|
|
42
42
|
},
|
|
43
43
|
inputAffix: {
|
|
44
44
|
compact,
|
|
45
|
+
className: buildClassnames.buildClassnames([WeightInput_module.affix, defaultBorder]),
|
|
45
46
|
},
|
|
46
47
|
};
|
|
47
|
-
return (React__default.default.createElement(
|
|
48
|
-
React__default.default.createElement(InputGroup.InputGroup, { ...childProps.inputGroup
|
|
48
|
+
return (React__default.default.createElement(FlexRow.FlexRow, { alignItems: "center", gap: 3, className: className },
|
|
49
|
+
React__default.default.createElement(InputGroup.InputGroup, { ...childProps.inputGroup },
|
|
49
50
|
React__default.default.createElement(InputAffix.InputAffix, { ...childProps.inputAffix }, "L"),
|
|
50
|
-
React__default.default.createElement(index.TextField, { ...childProps.textField, name: "length", value: length, "aria-label": "Length", "aria-describedby": "length-unit", onChange: handleChangeLength, placeholder:
|
|
51
|
+
React__default.default.createElement(index.TextField, { ...childProps.textField, name: "length", value: length, "aria-label": "Length", "aria-describedby": "length-unit", onChange: handleChangeLength, placeholder: placeholder }),
|
|
51
52
|
React__default.default.createElement(InputAffix.InputAffix, { id: "length-unit", ...childProps.inputAffix }, unit)),
|
|
52
|
-
React__default.default.createElement(InputGroup.InputGroup, { ...childProps.inputGroup
|
|
53
|
+
React__default.default.createElement(InputGroup.InputGroup, { ...childProps.inputGroup },
|
|
53
54
|
React__default.default.createElement(InputAffix.InputAffix, { ...childProps.inputAffix }, "W"),
|
|
54
|
-
React__default.default.createElement(index.TextField, { ...childProps.textField, name: "width", value: width, "aria-label": "Width", "aria-describedby": "width-unit", onChange: handleChangeWidth, placeholder:
|
|
55
|
+
React__default.default.createElement(index.TextField, { ...childProps.textField, name: "width", value: width, "aria-label": "Width", "aria-describedby": "width-unit", onChange: handleChangeWidth, placeholder: placeholder }),
|
|
55
56
|
React__default.default.createElement(InputAffix.InputAffix, { id: "width-unit", ...childProps.inputAffix }, unit)),
|
|
56
|
-
React__default.default.createElement(InputGroup.InputGroup, { ...childProps.inputGroup
|
|
57
|
+
React__default.default.createElement(InputGroup.InputGroup, { ...childProps.inputGroup },
|
|
57
58
|
React__default.default.createElement(InputAffix.InputAffix, { ...childProps.inputAffix }, "H"),
|
|
58
|
-
React__default.default.createElement(index.TextField, { ...childProps.textField, name: "height", value: height, "aria-label": "Height", "aria-describedby": "height-unit", onChange: handleChangeHeight, placeholder:
|
|
59
|
+
React__default.default.createElement(index.TextField, { ...childProps.textField, name: "height", value: height, "aria-label": "Height", "aria-describedby": "height-unit", onChange: handleChangeHeight, placeholder: placeholder }),
|
|
59
60
|
React__default.default.createElement(InputAffix.InputAffix, { id: "height-unit", ...childProps.inputAffix }, unit))));
|
|
60
61
|
});
|
|
61
62
|
DimensionsInput.displayName = 'DimensionsInput';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DimensionsInput.cjs","sources":["../../../src/components/DimensionsInput/DimensionsInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport {
|
|
1
|
+
{"version":3,"file":"DimensionsInput.cjs","sources":["../../../src/components/DimensionsInput/DimensionsInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\nimport { blockInvalidCharacters } from '../../utils/blockInvalidCharacters';\nimport { invalidCharsList } from '../../utils/invalidCharactersNumeric';\n// Share WeightInput's module so both inputs use one source of truth for the\n// group/field/affix border + affix text treatment.\nimport styles from '../WeightInput/WeightInput.module.scss';\n\nimport { InputAffix, InputAffixProps } from '../InputAffix';\nimport { InputGroup, InputGroupProps } from '../InputGroup';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { TextField, TextFieldProps } from '../TextField';\n\nimport { DimensionsProps } from './types';\n\ntype ChildComponentProps = {\n inputGroup: Partial<InputGroupProps>;\n textField: Partial<TextFieldProps>;\n inputAffix: Partial<InputAffixProps>;\n};\n\nconst blockInvalidChars = (e: React.KeyboardEvent) => blockInvalidCharacters(e, invalidCharsList);\n\nexport const DimensionsInput = withLabels<DimensionsProps>(\n ({\n size = 'base',\n handleChangeHeight,\n handleChangeWidth,\n handleChangeLength,\n className,\n height,\n width,\n length,\n unit = 'cm',\n hasError,\n placeholder = '0',\n ...rest\n }) => {\n const compact = size === 'sm';\n\n // Default (grey-base) outline for both field + affix; omitted on error so the\n // error/focus border colours take over. Matches WeightInput exactly.\n const defaultBorder = hasError ? undefined : styles.defaultBorder;\n\n // Group gets an error modifier so the focus-within ring turns red on error.\n const groupClass = buildClassnames([styles.group, hasError && styles.groupError]);\n\n const childProps: ChildComponentProps = {\n inputGroup: {\n hasError,\n compact,\n className: groupClass,\n },\n textField: {\n type: 'number',\n min: '0',\n step: 'any',\n onKeyDown: blockInvalidChars,\n size,\n hasError,\n className: buildClassnames([styles.field, defaultBorder]),\n ...rest,\n },\n inputAffix: {\n compact,\n className: buildClassnames([styles.affix, defaultBorder]),\n },\n };\n\n return (\n <FlexRow alignItems=\"center\" gap={3} className={className}>\n <InputGroup {...childProps.inputGroup}>\n <InputAffix {...childProps.inputAffix}>L</InputAffix>\n <TextField\n {...childProps.textField}\n name=\"length\"\n value={length}\n aria-label=\"Length\"\n aria-describedby=\"length-unit\"\n onChange={handleChangeLength}\n placeholder={placeholder}\n />\n <InputAffix id=\"length-unit\" {...childProps.inputAffix}>\n {unit}\n </InputAffix>\n </InputGroup>\n <InputGroup {...childProps.inputGroup}>\n <InputAffix {...childProps.inputAffix}>W</InputAffix>\n <TextField\n {...childProps.textField}\n name=\"width\"\n value={width}\n aria-label=\"Width\"\n aria-describedby=\"width-unit\"\n onChange={handleChangeWidth}\n placeholder={placeholder}\n />\n <InputAffix id=\"width-unit\" {...childProps.inputAffix}>\n {unit}\n </InputAffix>\n </InputGroup>\n <InputGroup {...childProps.inputGroup}>\n <InputAffix {...childProps.inputAffix}>H</InputAffix>\n <TextField\n {...childProps.textField}\n name=\"height\"\n value={height}\n aria-label=\"Height\"\n aria-describedby=\"height-unit\"\n onChange={handleChangeHeight}\n placeholder={placeholder}\n />\n <InputAffix id=\"height-unit\" {...childProps.inputAffix}>\n {unit}\n </InputAffix>\n </InputGroup>\n </FlexRow>\n );\n },\n);\n\nDimensionsInput.displayName = 'DimensionsInput';\n"],"names":["blockInvalidCharacters","invalidCharsList","withLabels","styles","buildClassnames","React","FlexRow","InputGroup","InputAffix","TextField"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAM,iBAAiB,GAAG,CAAC,CAAsB,KAAKA,6CAAsB,CAAC,CAAC,EAAEC,yCAAgB,CAAC;AAE1F,MAAM,eAAe,GAAGC,qBAAU,CACvC,CAAC,EACC,IAAI,GAAG,MAAM,EACb,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,K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AM,EAAA,YAAA,EACF,QAAQ,EAAA,kBAAA,EACF,aAAa,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,WAAW,EAAE,WAAW,EAAA,CACxB;AACF,YAAAJ,sBAAA,CAAA,aAAA,CAACG,qBAAU,EAAA,EAAC,EAAE,EAAC,aAAa,EAAA,GAAK,UAAU,CAAC,UAAU,IACnD,IAAI,CACM,CACF,CACL;AAEd,CAAC;AAGH,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;;"}
|
|
@@ -328,4 +328,5 @@ export declare const DimensionsInput: React.ForwardRefExoticComponent<{
|
|
|
328
328
|
unit?: string | undefined;
|
|
329
329
|
className?: string | undefined;
|
|
330
330
|
hasError?: boolean | undefined;
|
|
331
|
+
placeholder?: string | undefined;
|
|
331
332
|
} & import("../../hoc/withLabels/withLabels").WithLabelsProps & React.RefAttributes<unknown>>;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { withLabels } from '../../hoc/withLabels/withLabels.js';
|
|
3
|
-
import {
|
|
3
|
+
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
4
|
+
import 'uid/secure';
|
|
4
5
|
import { blockInvalidCharacters } from '../../utils/blockInvalidCharacters.js';
|
|
6
|
+
import { invalidCharsList } from '../../utils/invalidCharactersNumeric.js';
|
|
7
|
+
import styles from '../WeightInput/WeightInput.module.scss.js';
|
|
5
8
|
import { InputAffix } from '../InputAffix/InputAffix.js';
|
|
6
|
-
import { TextField } from '../TextField/index.js';
|
|
7
|
-
import { Stack } from '../Stack/Stack.js';
|
|
8
9
|
import { InputGroup } from '../InputGroup/InputGroup.js';
|
|
10
|
+
import { FlexRow } from '../Flex/FlexRow/FlexRow.js';
|
|
11
|
+
import { TextField } from '../TextField/index.js';
|
|
9
12
|
|
|
10
13
|
const blockInvalidChars = (e) => blockInvalidCharacters(e, invalidCharsList);
|
|
11
|
-
const
|
|
12
|
-
inputGroup: {
|
|
13
|
-
flex: 1,
|
|
14
|
-
},
|
|
15
|
-
textField: {
|
|
16
|
-
flex: 1,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const DimensionsInput = withLabels(({ size = 'base', handleChangeHeight, handleChangeWidth, handleChangeLength, className, height, width, length, unit = 'cm', hasError, ...rest }) => {
|
|
14
|
+
const DimensionsInput = withLabels(({ size = 'base', handleChangeHeight, handleChangeWidth, handleChangeLength, className, height, width, length, unit = 'cm', hasError, placeholder = '0', ...rest }) => {
|
|
20
15
|
const compact = size === 'sm';
|
|
16
|
+
// Default (grey-base) outline for both field + affix; omitted on error so the
|
|
17
|
+
// error/focus border colours take over. Matches WeightInput exactly.
|
|
18
|
+
const defaultBorder = hasError ? undefined : styles.defaultBorder;
|
|
19
|
+
// Group gets an error modifier so the focus-within ring turns red on error.
|
|
20
|
+
const groupClass = buildClassnames([styles.group, hasError && styles.groupError]);
|
|
21
21
|
const childProps = {
|
|
22
22
|
inputGroup: {
|
|
23
23
|
hasError,
|
|
24
24
|
compact,
|
|
25
|
-
|
|
25
|
+
className: groupClass,
|
|
26
26
|
},
|
|
27
27
|
textField: {
|
|
28
28
|
type: 'number',
|
|
@@ -31,25 +31,26 @@ const DimensionsInput = withLabels(({ size = 'base', handleChangeHeight, handleC
|
|
|
31
31
|
onKeyDown: blockInvalidChars,
|
|
32
32
|
size,
|
|
33
33
|
hasError,
|
|
34
|
-
|
|
34
|
+
className: buildClassnames([styles.field, defaultBorder]),
|
|
35
35
|
...rest,
|
|
36
36
|
},
|
|
37
37
|
inputAffix: {
|
|
38
38
|
compact,
|
|
39
|
+
className: buildClassnames([styles.affix, defaultBorder]),
|
|
39
40
|
},
|
|
40
41
|
};
|
|
41
|
-
return (React__default.createElement(
|
|
42
|
-
React__default.createElement(InputGroup, { ...childProps.inputGroup
|
|
42
|
+
return (React__default.createElement(FlexRow, { alignItems: "center", gap: 3, className: className },
|
|
43
|
+
React__default.createElement(InputGroup, { ...childProps.inputGroup },
|
|
43
44
|
React__default.createElement(InputAffix, { ...childProps.inputAffix }, "L"),
|
|
44
|
-
React__default.createElement(TextField, { ...childProps.textField, name: "length", value: length, "aria-label": "Length", "aria-describedby": "length-unit", onChange: handleChangeLength, placeholder:
|
|
45
|
+
React__default.createElement(TextField, { ...childProps.textField, name: "length", value: length, "aria-label": "Length", "aria-describedby": "length-unit", onChange: handleChangeLength, placeholder: placeholder }),
|
|
45
46
|
React__default.createElement(InputAffix, { id: "length-unit", ...childProps.inputAffix }, unit)),
|
|
46
|
-
React__default.createElement(InputGroup, { ...childProps.inputGroup
|
|
47
|
+
React__default.createElement(InputGroup, { ...childProps.inputGroup },
|
|
47
48
|
React__default.createElement(InputAffix, { ...childProps.inputAffix }, "W"),
|
|
48
|
-
React__default.createElement(TextField, { ...childProps.textField, name: "width", value: width, "aria-label": "Width", "aria-describedby": "width-unit", onChange: handleChangeWidth, placeholder:
|
|
49
|
+
React__default.createElement(TextField, { ...childProps.textField, name: "width", value: width, "aria-label": "Width", "aria-describedby": "width-unit", onChange: handleChangeWidth, placeholder: placeholder }),
|
|
49
50
|
React__default.createElement(InputAffix, { id: "width-unit", ...childProps.inputAffix }, unit)),
|
|
50
|
-
React__default.createElement(InputGroup, { ...childProps.inputGroup
|
|
51
|
+
React__default.createElement(InputGroup, { ...childProps.inputGroup },
|
|
51
52
|
React__default.createElement(InputAffix, { ...childProps.inputAffix }, "H"),
|
|
52
|
-
React__default.createElement(TextField, { ...childProps.textField, name: "height", value: height, "aria-label": "Height", "aria-describedby": "height-unit", onChange: handleChangeHeight, placeholder:
|
|
53
|
+
React__default.createElement(TextField, { ...childProps.textField, name: "height", value: height, "aria-label": "Height", "aria-describedby": "height-unit", onChange: handleChangeHeight, placeholder: placeholder }),
|
|
53
54
|
React__default.createElement(InputAffix, { id: "height-unit", ...childProps.inputAffix }, unit))));
|
|
54
55
|
});
|
|
55
56
|
DimensionsInput.displayName = 'DimensionsInput';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DimensionsInput.js","sources":["../../../src/components/DimensionsInput/DimensionsInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport {
|
|
1
|
+
{"version":3,"file":"DimensionsInput.js","sources":["../../../src/components/DimensionsInput/DimensionsInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\nimport { blockInvalidCharacters } from '../../utils/blockInvalidCharacters';\nimport { invalidCharsList } from '../../utils/invalidCharactersNumeric';\n// Share WeightInput's module so both inputs use one source of truth for the\n// group/field/affix border + affix text treatment.\nimport styles from '../WeightInput/WeightInput.module.scss';\n\nimport { InputAffix, InputAffixProps } from '../InputAffix';\nimport { InputGroup, InputGroupProps } from '../InputGroup';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { TextField, TextFieldProps } from '../TextField';\n\nimport { DimensionsProps } from './types';\n\ntype ChildComponentProps = {\n inputGroup: Partial<InputGroupProps>;\n textField: Partial<TextFieldProps>;\n inputAffix: Partial<InputAffixProps>;\n};\n\nconst blockInvalidChars = (e: React.KeyboardEvent) => blockInvalidCharacters(e, invalidCharsList);\n\nexport const DimensionsInput = withLabels<DimensionsProps>(\n ({\n size = 'base',\n handleChangeHeight,\n handleChangeWidth,\n handleChangeLength,\n className,\n height,\n width,\n length,\n unit = 'cm',\n hasError,\n placeholder = '0',\n ...rest\n }) => {\n const compact = size === 'sm';\n\n // Default (grey-base) outline for both field + affix; omitted on error so the\n // error/focus border colours take over. Matches WeightInput exactly.\n const defaultBorder = hasError ? undefined : styles.defaultBorder;\n\n // Group gets an error modifier so the focus-within ring turns red on error.\n const groupClass = buildClassnames([styles.group, hasError && styles.groupError]);\n\n const childProps: ChildComponentProps = {\n inputGroup: {\n hasError,\n compact,\n className: groupClass,\n },\n textField: {\n type: 'number',\n min: '0',\n step: 'any',\n onKeyDown: blockInvalidChars,\n size,\n hasError,\n className: buildClassnames([styles.field, defaultBorder]),\n ...rest,\n },\n inputAffix: {\n compact,\n className: buildClassnames([styles.affix, defaultBorder]),\n },\n };\n\n return (\n <FlexRow alignItems=\"center\" gap={3} className={className}>\n <InputGroup {...childProps.inputGroup}>\n <InputAffix {...childProps.inputAffix}>L</InputAffix>\n <TextField\n {...childProps.textField}\n name=\"length\"\n value={length}\n aria-label=\"Length\"\n aria-describedby=\"length-unit\"\n onChange={handleChangeLength}\n placeholder={placeholder}\n />\n <InputAffix id=\"length-unit\" {...childProps.inputAffix}>\n {unit}\n </InputAffix>\n </InputGroup>\n <InputGroup {...childProps.inputGroup}>\n <InputAffix {...childProps.inputAffix}>W</InputAffix>\n <TextField\n {...childProps.textField}\n name=\"width\"\n value={width}\n aria-label=\"Width\"\n aria-describedby=\"width-unit\"\n onChange={handleChangeWidth}\n placeholder={placeholder}\n />\n <InputAffix id=\"width-unit\" {...childProps.inputAffix}>\n {unit}\n </InputAffix>\n </InputGroup>\n <InputGroup {...childProps.inputGroup}>\n <InputAffix {...childProps.inputAffix}>H</InputAffix>\n <TextField\n {...childProps.textField}\n name=\"height\"\n value={height}\n aria-label=\"Height\"\n aria-describedby=\"height-unit\"\n onChange={handleChangeHeight}\n placeholder={placeholder}\n />\n <InputAffix id=\"height-unit\" {...childProps.inputAffix}>\n {unit}\n </InputAffix>\n </InputGroup>\n </FlexRow>\n );\n },\n);\n\nDimensionsInput.displayName = 'DimensionsInput';\n"],"names":["React"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,iBAAiB,GAAG,CAAC,CAAsB,KAAK,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,CAAC;AAE1F,MAAM,eAAe,GAAG,UAAU,CACvC,CAAC,EACC,IAAI,GAAG,MAAM,EACb,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,WAAW,GAAG,GAAG,EACjB,GAAG,IAAI,EACR,KAAI;AACH,IAAA,MAAM,OAAO,GAAG,IAAI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EAAC,aAAa,EAAA,GAAK,UAAU,CAAC,UAAU,IACnD,IAAI,CACM,CACF,CACL;AAEd,CAAC;AAGH,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;;"}
|
|
@@ -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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C,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,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,cAAA,CAAA,aAAA,CAAC,MAAM,kBACO,iBAAiB,EAAA,GACzB,KAAK,EACT,UAAU,EAAC,UAAU,EACrB,SAAS,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,EAAA;IAI3DA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,MAAM,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,IAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,MAAM,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;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
|
-
___$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;;;;"}
|
|
@@ -9,8 +9,8 @@ var invalidCharactersNumeric = require('../../utils/invalidCharactersNumeric.cjs
|
|
|
9
9
|
var WeightInput_module = require('./WeightInput.module.scss.cjs');
|
|
10
10
|
var InputAffix = require('../InputAffix/InputAffix.cjs');
|
|
11
11
|
var InputGroup = require('../InputGroup/InputGroup.cjs');
|
|
12
|
-
var Stack = require('../Stack/Stack.cjs');
|
|
13
12
|
var index = require('../TextField/index.cjs');
|
|
13
|
+
var FlexRow = require('../Flex/FlexRow/FlexRow.cjs');
|
|
14
14
|
var types = require('./types.cjs');
|
|
15
15
|
|
|
16
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -27,11 +27,6 @@ const WeightInput = withLabels.withLabels((props) => {
|
|
|
27
27
|
// Group gets an error modifier so the focus-within ring turns red on error.
|
|
28
28
|
const groupClass = buildClassnames.buildClassnames([WeightInput_module.group, hasError && WeightInput_module.groupError]);
|
|
29
29
|
const childProps = {
|
|
30
|
-
stack: {
|
|
31
|
-
direction: 'horizontal',
|
|
32
|
-
alignY: 'center',
|
|
33
|
-
spacing: 'base',
|
|
34
|
-
},
|
|
35
30
|
inputGroup: {
|
|
36
31
|
className: groupClass,
|
|
37
32
|
hasError,
|
|
@@ -60,7 +55,7 @@ const WeightInput = withLabels.withLabels((props) => {
|
|
|
60
55
|
}
|
|
61
56
|
// If the weight is imperial, render pounds and ounces
|
|
62
57
|
if (types.isWeightImperial(props)) {
|
|
63
|
-
return (React__default.default.createElement(
|
|
58
|
+
return (React__default.default.createElement(FlexRow.FlexRow, { alignItems: "center", gap: "base", className: className },
|
|
64
59
|
React__default.default.createElement(InputGroup.InputGroup, { ...childProps.inputGroup },
|
|
65
60
|
React__default.default.createElement(index.TextField, { ...childProps.textField, name: "pound", value: props.pound, "aria-label": "Pounds", onChange: props.handleChangePound }),
|
|
66
61
|
React__default.default.createElement(InputAffix.InputAffix, { ...childProps.inputAffix }, "lb")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeightInput.cjs","sources":["../../../src/components/WeightInput/WeightInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\nimport { blockInvalidCharacters } from '../../utils/blockInvalidCharacters';\nimport { invalidCharsList } from '../../utils/invalidCharactersNumeric';\nimport styles from './WeightInput.module.scss';\n\nimport { InputAffix, InputAffixProps } from '../InputAffix';\nimport { InputGroup, InputGroupProps } from '../InputGroup';\nimport {
|
|
1
|
+
{"version":3,"file":"WeightInput.cjs","sources":["../../../src/components/WeightInput/WeightInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\nimport { blockInvalidCharacters } from '../../utils/blockInvalidCharacters';\nimport { invalidCharsList } from '../../utils/invalidCharactersNumeric';\nimport styles from './WeightInput.module.scss';\n\nimport { InputAffix, InputAffixProps } from '../InputAffix';\nimport { InputGroup, InputGroupProps } from '../InputGroup';\nimport { TextField, TextFieldProps } from '../TextField';\n\nimport { FlexRow } from '../Flex/FlexRow';\nimport { WeightProps, isWeightImperial, isWeightMetric } from './types';\n\ntype ChildComponentProps = {\n inputGroup: Partial<InputGroupProps>;\n textField: Partial<TextFieldProps>;\n inputAffix: Partial<InputAffixProps>;\n};\n\nconst blockInvalidChars = (e: React.KeyboardEvent) => blockInvalidCharacters(e, invalidCharsList);\n\nexport const WeightInput = withLabels<WeightProps>((props) => {\n const { size = 'base', hasError, disabled, className } = props;\n\n const compact = size === 'sm';\n\n // Default (#CDD1D5) outline for both field + affix; omitted on error so the\n // error/focus border colours take over.\n const defaultBorder = hasError ? undefined : styles.defaultBorder;\n\n // Group gets an error modifier so the focus-within ring turns red on error.\n const groupClass = buildClassnames([styles.group, hasError && styles.groupError]);\n\n const childProps: ChildComponentProps = {\n inputGroup: {\n className: groupClass,\n hasError,\n },\n textField: {\n type: 'number',\n placeholder: '0.00',\n min: '0',\n step: 'any',\n size,\n disabled,\n hasError,\n onKeyDown: blockInvalidChars,\n className: buildClassnames([styles.field, defaultBorder]),\n },\n inputAffix: {\n compact,\n className: buildClassnames([styles.affix, defaultBorder]),\n },\n };\n\n // If the weight is metric, render grams\n if (isWeightMetric(props)) {\n return (\n <InputGroup {...childProps.inputGroup} className={buildClassnames([groupClass, className])}>\n <TextField\n {...childProps.textField}\n name=\"gram\"\n value={props.gram}\n aria-label=\"Grams\"\n onChange={props.handleChangeGram}\n />\n <InputAffix {...childProps.inputAffix}>g</InputAffix>\n </InputGroup>\n );\n }\n\n // If the weight is imperial, render pounds and ounces\n if (isWeightImperial(props)) {\n return (\n <FlexRow alignItems=\"center\" gap=\"base\" className={className}>\n <InputGroup {...childProps.inputGroup}>\n <TextField\n {...childProps.textField}\n name=\"pound\"\n value={props.pound}\n aria-label=\"Pounds\"\n onChange={props.handleChangePound}\n />\n <InputAffix {...childProps.inputAffix}>lb</InputAffix>\n </InputGroup>\n <InputGroup {...childProps.inputGroup}>\n <TextField\n {...childProps.textField}\n name=\"ounce\"\n value={props.ounce}\n aria-label=\"Ounces\"\n onChange={props.handleChangeOunce}\n />\n <InputAffix {...childProps.inputAffix}>oz</InputAffix>\n </InputGroup>\n </FlexRow>\n );\n }\n\n // If neither metric nor imperial, return null or handle as needed\n return null;\n});\n\nWeightInput.displayName = 'WeightInput';\n"],"names":["blockInvalidCharacters","invalidCharsList","withLabels","styles","buildClassnames","isWeightMetric","React","InputGroup","TextField","InputAffix","isWeightImperial","FlexRow"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAM,iBAAiB,GAAG,CAAC,CAAsB,KAAKA,6CAAsB,CAAC,CAAC,EAAEC,yCAAgB,CAAC;MAEpF,WAAW,GAAGC,qBAAU,CAAc,CAAC,KAAK,KAAI;AAC3D,IAAA,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK;AAE9D,IAAA,MAAM,OAAO,GAAG,IAAI,KAAK,IAAI;;;AAI7B,IAAA,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAGC,kBAAM,CAAC,aAAa;;AAGjE,IAAA,MAAM,UAAU,GAAGC,+BAAe,CAAC,CAACD,kBAAM,CAAC,KAAK,EAAE,QAAQ,IAAIA,kBAAM,CAAC,UAAU,CAAC,CAAC;AAEjF,IAAA,MAAM,UAAU,GAAwB;AACtC,QAAA,UAAU,EAAE;AACV,YAAA,SAAS,EAAE,UAAU;YACrB,QAAQ;AACT,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,WAAW,EAAE,MAAM;AACnB,YAAA,GAAG,EAAE,GAAG;AACR,YAAA,IAAI,EAAE,KAAK;YACX,IAAI;YACJ,QAAQ;YACR,QAAQ;AACR,YAAA,SAAS,EAAE,iBAAiB;YAC5B,SAAS,EAAEC,+BAAe,CAAC,CAACD,kBAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;AAC1D,SAAA;AACD,QAAA,UAAU,EAAE;YACV,OAAO;YACP,SAAS,EAAEC,+BAAe,CAAC,CAACD,kBAAM,CAAC,KAAK,EAAE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CAAA,aAAA,CAACE,eAAS,OACJ,UAAU,CAAC,SAAS,EACxB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,CAAC,KAAK,EAAA,YAAA,EACP,QAAQ,EACnB,QAAQ,EAAE,KAAK,CAAC,iBAAiB,EAAA,CACjC;gBACFF,sBAAA,CAAA,aAAA,CAACG,qBAAU,OAAK,UAAU,CAAC,UAAU,EAAA,EAAA,IAAA,CAAiB,CAC3C,CACL;AAEb,IAAA;;AAGD,IAAA,OAAO,IAAI;AACb,CAAC;AAED,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
|
|
@@ -7,8 +7,8 @@ import { invalidCharsList } from '../../utils/invalidCharactersNumeric.js';
|
|
|
7
7
|
import styles from './WeightInput.module.scss.js';
|
|
8
8
|
import { InputAffix } from '../InputAffix/InputAffix.js';
|
|
9
9
|
import { InputGroup } from '../InputGroup/InputGroup.js';
|
|
10
|
-
import { Stack } from '../Stack/Stack.js';
|
|
11
10
|
import { TextField } from '../TextField/index.js';
|
|
11
|
+
import { FlexRow } from '../Flex/FlexRow/FlexRow.js';
|
|
12
12
|
import { isWeightMetric, isWeightImperial } from './types.js';
|
|
13
13
|
|
|
14
14
|
const blockInvalidChars = (e) => blockInvalidCharacters(e, invalidCharsList);
|
|
@@ -21,11 +21,6 @@ const WeightInput = withLabels((props) => {
|
|
|
21
21
|
// Group gets an error modifier so the focus-within ring turns red on error.
|
|
22
22
|
const groupClass = buildClassnames([styles.group, hasError && styles.groupError]);
|
|
23
23
|
const childProps = {
|
|
24
|
-
stack: {
|
|
25
|
-
direction: 'horizontal',
|
|
26
|
-
alignY: 'center',
|
|
27
|
-
spacing: 'base',
|
|
28
|
-
},
|
|
29
24
|
inputGroup: {
|
|
30
25
|
className: groupClass,
|
|
31
26
|
hasError,
|
|
@@ -54,7 +49,7 @@ const WeightInput = withLabels((props) => {
|
|
|
54
49
|
}
|
|
55
50
|
// If the weight is imperial, render pounds and ounces
|
|
56
51
|
if (isWeightImperial(props)) {
|
|
57
|
-
return (React__default.createElement(
|
|
52
|
+
return (React__default.createElement(FlexRow, { alignItems: "center", gap: "base", className: className },
|
|
58
53
|
React__default.createElement(InputGroup, { ...childProps.inputGroup },
|
|
59
54
|
React__default.createElement(TextField, { ...childProps.textField, name: "pound", value: props.pound, "aria-label": "Pounds", onChange: props.handleChangePound }),
|
|
60
55
|
React__default.createElement(InputAffix, { ...childProps.inputAffix }, "lb")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeightInput.js","sources":["../../../src/components/WeightInput/WeightInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\nimport { blockInvalidCharacters } from '../../utils/blockInvalidCharacters';\nimport { invalidCharsList } from '../../utils/invalidCharactersNumeric';\nimport styles from './WeightInput.module.scss';\n\nimport { InputAffix, InputAffixProps } from '../InputAffix';\nimport { InputGroup, InputGroupProps } from '../InputGroup';\nimport {
|
|
1
|
+
{"version":3,"file":"WeightInput.js","sources":["../../../src/components/WeightInput/WeightInput.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\nimport { blockInvalidCharacters } from '../../utils/blockInvalidCharacters';\nimport { invalidCharsList } from '../../utils/invalidCharactersNumeric';\nimport styles from './WeightInput.module.scss';\n\nimport { InputAffix, InputAffixProps } from '../InputAffix';\nimport { InputGroup, InputGroupProps } from '../InputGroup';\nimport { TextField, TextFieldProps } from '../TextField';\n\nimport { FlexRow } from '../Flex/FlexRow';\nimport { WeightProps, isWeightImperial, isWeightMetric } from './types';\n\ntype ChildComponentProps = {\n inputGroup: Partial<InputGroupProps>;\n textField: Partial<TextFieldProps>;\n inputAffix: Partial<InputAffixProps>;\n};\n\nconst blockInvalidChars = (e: React.KeyboardEvent) => blockInvalidCharacters(e, invalidCharsList);\n\nexport const WeightInput = withLabels<WeightProps>((props) => {\n const { size = 'base', hasError, disabled, className } = props;\n\n const compact = size === 'sm';\n\n // Default (#CDD1D5) outline for both field + affix; omitted on error so the\n // error/focus border colours take over.\n const defaultBorder = hasError ? undefined : styles.defaultBorder;\n\n // Group gets an error modifier so the focus-within ring turns red on error.\n const groupClass = buildClassnames([styles.group, hasError && styles.groupError]);\n\n const childProps: ChildComponentProps = {\n inputGroup: {\n className: groupClass,\n hasError,\n },\n textField: {\n type: 'number',\n placeholder: '0.00',\n min: '0',\n step: 'any',\n size,\n disabled,\n hasError,\n onKeyDown: blockInvalidChars,\n className: buildClassnames([styles.field, defaultBorder]),\n },\n inputAffix: {\n compact,\n className: buildClassnames([styles.affix, defaultBorder]),\n },\n };\n\n // If the weight is metric, render grams\n if (isWeightMetric(props)) {\n return (\n <InputGroup {...childProps.inputGroup} className={buildClassnames([groupClass, className])}>\n <TextField\n {...childProps.textField}\n name=\"gram\"\n value={props.gram}\n aria-label=\"Grams\"\n onChange={props.handleChangeGram}\n />\n <InputAffix {...childProps.inputAffix}>g</InputAffix>\n </InputGroup>\n );\n }\n\n // If the weight is imperial, render pounds and ounces\n if (isWeightImperial(props)) {\n return (\n <FlexRow alignItems=\"center\" gap=\"base\" className={className}>\n <InputGroup {...childProps.inputGroup}>\n <TextField\n {...childProps.textField}\n name=\"pound\"\n value={props.pound}\n aria-label=\"Pounds\"\n onChange={props.handleChangePound}\n />\n <InputAffix {...childProps.inputAffix}>lb</InputAffix>\n </InputGroup>\n <InputGroup {...childProps.inputGroup}>\n <TextField\n {...childProps.textField}\n name=\"ounce\"\n value={props.ounce}\n aria-label=\"Ounces\"\n onChange={props.handleChangeOunce}\n />\n <InputAffix {...childProps.inputAffix}>oz</InputAffix>\n </InputGroup>\n </FlexRow>\n );\n }\n\n // If neither metric nor imperial, return null or handle as needed\n return null;\n});\n\nWeightInput.displayName = 'WeightInput';\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAqBA,MAAM,iBAAiB,GAAG,CAAC,CAAsB,KAAK,sBAAsB,CAAC,CAAC,EAAE,gBA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AW,GAAG,aAAa;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
|
-
___$insertStyle(".
|
|
6
|
-
var styles = {"group":"
|
|
5
|
+
___$insertStyle("._group_5x4fb_1 {\n flex: 1;\n --interactive-border: var(--colors-secondary-blue-base);\n --focus-ring: var(--colors-secondary-blue-light);\n /* Only focus/active states additionally get the outer focus ring. */\n}\n._group_5x4fb_1 ._defaultBorder_5x4fb_7 {\n --border-color: var(--colors-neutral-grey-base);\n}\n._group_5x4fb_1:not(:has(:disabled)):hover, ._group_5x4fb_1:focus-within, ._group_5x4fb_1:not(:has(:disabled)):active {\n border-radius: var(--radius-base);\n}\n._group_5x4fb_1:not(:has(:disabled)):hover > ._field_5x4fb_13,\n._group_5x4fb_1:not(:has(:disabled)):hover > ._affix_5x4fb_14, ._group_5x4fb_1:focus-within > ._field_5x4fb_13,\n._group_5x4fb_1:focus-within > ._affix_5x4fb_14, ._group_5x4fb_1:not(:has(:disabled)):active > ._field_5x4fb_13,\n._group_5x4fb_1:not(:has(:disabled)):active > ._affix_5x4fb_14 {\n outline: none;\n border-color: var(--interactive-border);\n}\n._group_5x4fb_1:focus-within, ._group_5x4fb_1:not(:has(:disabled)):active {\n outline: var(--sizes-xs) solid var(--focus-ring);\n}\n\n._field_5x4fb_13 {\n flex: 1;\n}\n\n._affix_5x4fb_14 {\n flex: 0;\n --text-hint-text-color: var(--colors-neutral-ink-lightest);\n --text-hint-text-line-height: var(--text-body-line-height);\n}\n\n._groupError_5x4fb_34 {\n --interactive-border: var(--colors-secondary-red-base);\n --focus-ring: var(--colors-secondary-red-light);\n}\n._groupError_5x4fb_34 > ._field_5x4fb_13,\n._groupError_5x4fb_34 > ._affix_5x4fb_14 {\n outline: none;\n border-color: var(--colors-secondary-red-base);\n}");
|
|
6
|
+
var styles = {"group":"_group_5x4fb_1","defaultBorder":"_defaultBorder_5x4fb_7","field":"_field_5x4fb_13","affix":"_affix_5x4fb_14","groupError":"_groupError_5x4fb_34"};
|
|
7
7
|
|
|
8
8
|
module.exports = styles;
|
|
9
9
|
//# sourceMappingURL=WeightInput.module.scss.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeightInput.module.scss.cjs","sources":["../../../src/components/WeightInput/WeightInput.module.scss"],"sourcesContent":[".group {\n flex: 1;\n\n --interactive-border: var(--colors-secondary-blue-base);\n --focus-ring: var(--colors-secondary-blue-light);\n .defaultBorder {\n --border-color: var(--colors-neutral-grey-
|
|
1
|
+
{"version":3,"file":"WeightInput.module.scss.cjs","sources":["../../../src/components/WeightInput/WeightInput.module.scss"],"sourcesContent":[".group {\n flex: 1;\n\n --interactive-border: var(--colors-secondary-blue-base);\n --focus-ring: var(--colors-secondary-blue-light);\n .defaultBorder {\n --border-color: var(--colors-neutral-grey-base);\n }\n\n &:not(:has(:disabled)):hover,\n &:focus-within,\n &:not(:has(:disabled)):active {\n border-radius: var(--radius-base);\n > .field,\n > .affix {\n outline: none;\n border-color: var(--interactive-border);\n }\n }\n\n /* Only focus/active states additionally get the outer focus ring. */\n &:focus-within,\n &:not(:has(:disabled)):active {\n outline: var(--sizes-xs) solid var(--focus-ring);\n }\n}\n\n.field {\n flex: 1;\n}\n\n.affix {\n flex: 0;\n\n --text-hint-text-color: var(--colors-neutral-ink-lightest);\n --text-hint-text-line-height: var(--text-body-line-height);\n}\n\n.groupError {\n --interactive-border: var(--colors-secondary-red-base);\n --focus-ring: var(--colors-secondary-red-light);\n\n > .field,\n > .affix {\n outline: none;\n border-color: var(--colors-secondary-red-base);\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,+/CAAA;AAEA,aAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,eAAA,CAAA,wBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,YAAA,CAAA,sBAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
2
|
|
|
3
|
-
insertStyle(".
|
|
4
|
-
var styles = {"group":"
|
|
3
|
+
insertStyle("._group_5x4fb_1 {\n flex: 1;\n --interactive-border: var(--colors-secondary-blue-base);\n --focus-ring: var(--colors-secondary-blue-light);\n /* Only focus/active states additionally get the outer focus ring. */\n}\n._group_5x4fb_1 ._defaultBorder_5x4fb_7 {\n --border-color: var(--colors-neutral-grey-base);\n}\n._group_5x4fb_1:not(:has(:disabled)):hover, ._group_5x4fb_1:focus-within, ._group_5x4fb_1:not(:has(:disabled)):active {\n border-radius: var(--radius-base);\n}\n._group_5x4fb_1:not(:has(:disabled)):hover > ._field_5x4fb_13,\n._group_5x4fb_1:not(:has(:disabled)):hover > ._affix_5x4fb_14, ._group_5x4fb_1:focus-within > ._field_5x4fb_13,\n._group_5x4fb_1:focus-within > ._affix_5x4fb_14, ._group_5x4fb_1:not(:has(:disabled)):active > ._field_5x4fb_13,\n._group_5x4fb_1:not(:has(:disabled)):active > ._affix_5x4fb_14 {\n outline: none;\n border-color: var(--interactive-border);\n}\n._group_5x4fb_1:focus-within, ._group_5x4fb_1:not(:has(:disabled)):active {\n outline: var(--sizes-xs) solid var(--focus-ring);\n}\n\n._field_5x4fb_13 {\n flex: 1;\n}\n\n._affix_5x4fb_14 {\n flex: 0;\n --text-hint-text-color: var(--colors-neutral-ink-lightest);\n --text-hint-text-line-height: var(--text-body-line-height);\n}\n\n._groupError_5x4fb_34 {\n --interactive-border: var(--colors-secondary-red-base);\n --focus-ring: var(--colors-secondary-red-light);\n}\n._groupError_5x4fb_34 > ._field_5x4fb_13,\n._groupError_5x4fb_34 > ._affix_5x4fb_14 {\n outline: none;\n border-color: var(--colors-secondary-red-base);\n}");
|
|
4
|
+
var styles = {"group":"_group_5x4fb_1","defaultBorder":"_defaultBorder_5x4fb_7","field":"_field_5x4fb_13","affix":"_affix_5x4fb_14","groupError":"_groupError_5x4fb_34"};
|
|
5
5
|
|
|
6
6
|
export { styles as default };
|
|
7
7
|
//# sourceMappingURL=WeightInput.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeightInput.module.scss.js","sources":["../../../src/components/WeightInput/WeightInput.module.scss"],"sourcesContent":[".group {\n flex: 1;\n\n --interactive-border: var(--colors-secondary-blue-base);\n --focus-ring: var(--colors-secondary-blue-light);\n .defaultBorder {\n --border-color: var(--colors-neutral-grey-
|
|
1
|
+
{"version":3,"file":"WeightInput.module.scss.js","sources":["../../../src/components/WeightInput/WeightInput.module.scss"],"sourcesContent":[".group {\n flex: 1;\n\n --interactive-border: var(--colors-secondary-blue-base);\n --focus-ring: var(--colors-secondary-blue-light);\n .defaultBorder {\n --border-color: var(--colors-neutral-grey-base);\n }\n\n &:not(:has(:disabled)):hover,\n &:focus-within,\n &:not(:has(:disabled)):active {\n border-radius: var(--radius-base);\n > .field,\n > .affix {\n outline: none;\n border-color: var(--interactive-border);\n }\n }\n\n /* Only focus/active states additionally get the outer focus ring. */\n &:focus-within,\n &:not(:has(:disabled)):active {\n outline: var(--sizes-xs) solid var(--focus-ring);\n }\n}\n\n.field {\n flex: 1;\n}\n\n.affix {\n flex: 0;\n\n --text-hint-text-color: var(--colors-neutral-ink-lightest);\n --text-hint-text-line-height: var(--text-body-line-height);\n}\n\n.groupError {\n --interactive-border: var(--colors-secondary-red-base);\n --focus-ring: var(--colors-secondary-red-light);\n\n > .field,\n > .affix {\n outline: none;\n border-color: var(--colors-secondary-red-base);\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,+/CAAA;AAEA,aAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,eAAA,CAAA,wBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,YAAA,CAAA,sBAAA;;;;"}
|
|
@@ -39,7 +39,7 @@ export { InputAffix } from './InputAffix';
|
|
|
39
39
|
export { InputGroup, type InputGroupProps } from './InputGroup';
|
|
40
40
|
export { LegacyDataTable } from './LegacyDataTable';
|
|
41
41
|
export { Loader } from './Loader';
|
|
42
|
-
export { LoginWithAmazonButton } from './LoginWithAmazonButton';
|
|
42
|
+
export { LoginWithAmazonButton, type LoginWithAmazonButtonProps, type LoginWithAmazonButtonSize, type LoginWithAmazonButtonVariant, } from './LoginWithAmazonButton';
|
|
43
43
|
export { Modal, type Action as ModalAction, type ModalProps } from './Modal';
|
|
44
44
|
export { Pagination } from './Pagination';
|
|
45
45
|
export { Popover } from './Popover';
|