@cloudscape-design/components-themeable 3.0.1372 → 3.0.1373
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/components/checkbox-icon/motion.scss +35 -0
- package/lib/internal/scss/internal/components/checkbox-icon/styles.scss +2 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/checkbox-icon/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/checkbox-icon/index.js +8 -2
- package/lib/internal/template/internal/components/checkbox-icon/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
@use '../../styles/utils/theming' as theming;
|
|
5
|
+
|
|
6
|
+
// Scopes @content to themes that opted in to $expressive-motion-themes in theming.scss.
|
|
7
|
+
@mixin checkbox-expressive-with-motion {
|
|
8
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
9
|
+
@include theming.expressive-motion-only(':not(.awsui-motion-disabled):not(.awsui-mode-entering)') {
|
|
10
|
+
@content;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Include inside the checkmark line rule. Draws the checkmark in by sliding the dash offset to zero.
|
|
16
|
+
@mixin draw-in {
|
|
17
|
+
&[data-awsui-motion-ready] {
|
|
18
|
+
@include checkbox-expressive-with-motion {
|
|
19
|
+
animation: awsui-checkbox-draw 250ms linear;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@if theming.has-expressive-motion() {
|
|
23
|
+
@keyframes awsui-checkbox-draw {
|
|
24
|
+
from {
|
|
25
|
+
stroke-dasharray: 20;
|
|
26
|
+
stroke-dashoffset: 20px;
|
|
27
|
+
}
|
|
28
|
+
to {
|
|
29
|
+
stroke-dasharray: 20;
|
|
30
|
+
stroke-dashoffset: 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
@use '../../styles' as styles;
|
|
7
7
|
@use '../../styles/tokens' as awsui;
|
|
8
|
+
@use './motion' as motion;
|
|
8
9
|
|
|
9
10
|
.root {
|
|
10
11
|
position: absolute;
|
|
@@ -44,5 +45,6 @@
|
|
|
44
45
|
&-readonly {
|
|
45
46
|
stroke: awsui.$color-foreground-control-read-only;
|
|
46
47
|
}
|
|
48
|
+
@include motion.draw-in;
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMnE,UAAU,iBAAkB,SAAQ,kBAAkB;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE;QACN,GAAG,CAAC,EAAE;YACJ,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,IAAI,CAAC,EAAE;YACL,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH;AAsCD,QAAA,MAAM,YAAY,GAAI,qEAOnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMnE,UAAU,iBAAkB,SAAQ,kBAAkB;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE;QACN,GAAG,CAAC,EAAE;YACJ,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,IAAI,CAAC,EAAE;YACL,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH;AAsCD,QAAA,MAAM,YAAY,GAAI,qEAOnB,iBAAiB,gBA2CnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { getBaseProps } from '../../base-component';
|
|
6
6
|
import { useOneTheme, useVisualRefresh } from '../../hooks/use-visual-mode';
|
|
@@ -38,6 +38,12 @@ const CheckboxIcon = ({ checked, indeterminate, disabled = false, readOnly = fal
|
|
|
38
38
|
const oneTheme = useOneTheme();
|
|
39
39
|
const theme = useVisualRefresh() ? (oneTheme ? 'one' : 'refresh') : 'default';
|
|
40
40
|
const dimensions = dimensionsByTheme[theme];
|
|
41
|
+
// The draw-in animation only plays once the state has changed since mount.
|
|
42
|
+
const [initialState] = useState({ checked: !!checked, indeterminate: !!indeterminate });
|
|
43
|
+
const [hasChanged, setHasChanged] = useState(false);
|
|
44
|
+
if (!hasChanged && (!!checked !== initialState.checked || !!indeterminate !== initialState.indeterminate)) {
|
|
45
|
+
setHasChanged(true);
|
|
46
|
+
}
|
|
41
47
|
return (React.createElement("svg", { className: styles.root, viewBox: dimensions.viewBox, "aria-hidden": "true", focusable: "false", ...baseProps },
|
|
42
48
|
React.createElement("rect", { className: clsx(styles['styled-box'], {
|
|
43
49
|
[styles['styled-box-checked']]: checked,
|
|
@@ -48,7 +54,7 @@ const CheckboxIcon = ({ checked, indeterminate, disabled = false, readOnly = fal
|
|
|
48
54
|
checked || indeterminate ? (React.createElement("polyline", { className: clsx(styles['styled-line'], {
|
|
49
55
|
[styles['styled-line-disabled']]: disabled,
|
|
50
56
|
[styles['styled-line-readonly']]: readOnly,
|
|
51
|
-
}), points: indeterminate ? dimensions.indeterminate : dimensions.checked, style: { stroke: (_c = style === null || style === void 0 ? void 0 : style.line) === null || _c === void 0 ? void 0 : _c.stroke } })) : null));
|
|
57
|
+
}), "data-awsui-motion-ready": hasChanged ? '' : undefined, points: indeterminate ? dimensions.indeterminate : dimensions.checked, style: { stroke: (_c = style === null || style === void 0 ? void 0 : style.line) === null || _c === void 0 ? void 0 : _c.stroke } })) : null));
|
|
52
58
|
};
|
|
53
59
|
export default CheckboxIcon;
|
|
54
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/checkbox-icon/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WA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AAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;gBACrC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,QAAQ;gBAC1C,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,QAAQ;aAC3C,CAAC,6BACuB,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EACpD,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EACrE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,MAAM,EAAE,GACtC,CACH,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { BaseComponentProps } from '../../../types/base-component';\nimport { getBaseProps } from '../../base-component';\nimport { useOneTheme, useVisualRefresh } from '../../hooks/use-visual-mode';\n\nimport styles from './styles.css.js';\n\ninterface CheckboxIconProps extends BaseComponentProps {\n checked?: boolean;\n indeterminate?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n style?: {\n box?: {\n fill?: string;\n stroke?: string;\n };\n line?: {\n stroke?: string;\n };\n };\n}\ninterface Dimension {\n viewBox: string;\n indeterminate: string;\n checked: string;\n xy: number;\n r: number;\n size: number;\n}\n\n// Can't use css variables for svg attributes\nconst dimensionsByTheme: Record<NonNullable<'default' | 'refresh' | 'one'>, Dimension> = {\n default: {\n viewBox: '0 0 14 14',\n indeterminate: '2.5,7 11.5,7',\n checked: '2.5,7 6,10 11,3',\n xy: 0.5,\n r: 1.5,\n size: 13,\n },\n refresh: {\n viewBox: '0 0 16 16',\n indeterminate: '3.5,8 12.5,8',\n checked: '3.5,8 7,11 12,4',\n xy: 0.5,\n r: 3,\n size: 15,\n },\n one: {\n viewBox: '0 0 16 16',\n indeterminate: '3.5,8 12.5,8',\n checked: '3.5,8 7,11 12,4',\n xy: 0.5,\n r: 2,\n size: 15,\n },\n};\n\nconst CheckboxIcon = ({\n checked,\n indeterminate,\n disabled = false,\n readOnly = false,\n style,\n ...restProps\n}: CheckboxIconProps) => {\n const baseProps = getBaseProps(restProps);\n const oneTheme = useOneTheme();\n const theme = useVisualRefresh() ? (oneTheme ? 'one' : 'refresh') : 'default';\n const dimensions = dimensionsByTheme[theme];\n\n // The draw-in animation only plays once the state has changed since mount.\n const [initialState] = useState({ checked: !!checked, indeterminate: !!indeterminate });\n const [hasChanged, setHasChanged] = useState(false);\n if (!hasChanged && (!!checked !== initialState.checked || !!indeterminate !== initialState.indeterminate)) {\n setHasChanged(true);\n }\n\n return (\n <svg className={styles.root} viewBox={dimensions.viewBox} aria-hidden=\"true\" focusable=\"false\" {...baseProps}>\n <rect\n className={clsx(styles['styled-box'], {\n [styles['styled-box-checked']]: checked,\n [styles['styled-box-indeterminate']]: indeterminate,\n [styles['styled-box-disabled']]: disabled,\n [styles['styled-box-readonly']]: readOnly,\n })}\n x={dimensions.xy}\n y={dimensions.xy}\n rx={dimensions.r}\n ry={dimensions.r}\n width={dimensions.size}\n height={dimensions.size}\n style={{ fill: style?.box?.fill, stroke: style?.box?.stroke }}\n />\n {checked || indeterminate ? (\n <polyline\n className={clsx(styles['styled-line'], {\n [styles['styled-line-disabled']]: disabled,\n [styles['styled-line-readonly']]: readOnly,\n })}\n data-awsui-motion-ready={hasChanged ? '' : undefined}\n points={indeterminate ? dimensions.indeterminate : dimensions.checked}\n style={{ stroke: style?.line?.stroke }}\n />\n ) : null}\n </svg>\n );\n};\n\nexport default CheckboxIcon;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (3dc4191d)";
|
|
3
|
+
export var GIT_SHA = "3dc4191d";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "core";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|