@cloudscape-design/components-themeable 3.0.730 → 3.0.731
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/property-filter/styles.scss +13 -23
- package/lib/internal/scss/tiles/analytics-metadata/styles.scss +8 -0
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/property-filter/styles.css.js +38 -46
- package/lib/internal/template/property-filter/styles.scoped.css +44 -60
- package/lib/internal/template/property-filter/styles.selectors.js +38 -46
- package/lib/internal/template/property-filter/token-editor-inputs.d.ts +37 -0
- package/lib/internal/template/property-filter/token-editor-inputs.d.ts.map +1 -0
- package/lib/internal/template/property-filter/token-editor-inputs.js +59 -0
- package/lib/internal/template/property-filter/token-editor-inputs.js.map +1 -0
- package/lib/internal/template/property-filter/token-editor.d.ts +18 -39
- package/lib/internal/template/property-filter/token-editor.d.ts.map +1 -1
- package/lib/internal/template/property-filter/token-editor.js +106 -88
- package/lib/internal/template/property-filter/token-editor.js.map +1 -1
- package/lib/internal/template/property-filter/token.d.ts.map +1 -1
- package/lib/internal/template/property-filter/token.js +9 -1
- package/lib/internal/template/property-filter/token.js.map +1 -1
- package/lib/internal/template/radio-group/radio-button.d.ts +1 -0
- package/lib/internal/template/radio-group/radio-button.d.ts.map +1 -1
- package/lib/internal/template/radio-group/radio-button.js +2 -2
- package/lib/internal/template/radio-group/radio-button.js.map +1 -1
- package/lib/internal/template/tiles/analytics-metadata/interfaces.d.ts +14 -0
- package/lib/internal/template/tiles/analytics-metadata/interfaces.d.ts.map +1 -0
- package/lib/internal/template/tiles/analytics-metadata/interfaces.js +4 -0
- package/lib/internal/template/tiles/analytics-metadata/interfaces.js.map +1 -0
- package/lib/internal/template/tiles/analytics-metadata/styles.css.js +6 -0
- package/lib/internal/template/tiles/analytics-metadata/styles.scoped.css +7 -0
- package/lib/internal/template/tiles/analytics-metadata/styles.selectors.js +7 -0
- package/lib/internal/template/tiles/index.d.ts.map +1 -1
- package/lib/internal/template/tiles/index.js +8 -1
- package/lib/internal/template/tiles/index.js.map +1 -1
- package/lib/internal/template/tiles/internal.d.ts.map +1 -1
- package/lib/internal/template/tiles/internal.js +12 -1
- package/lib/internal/template/tiles/internal.js.map +1 -1
- package/lib/internal/template/tiles/tile.d.ts.map +1 -1
- package/lib/internal/template/tiles/tile.js +8 -4
- package/lib/internal/template/tiles/tile.js.map +1 -1
- package/lib/internal/template/toggle/analytics-metadata/interfaces.d.ts +13 -0
- package/lib/internal/template/toggle/analytics-metadata/interfaces.d.ts.map +1 -0
- package/lib/internal/template/toggle/analytics-metadata/interfaces.js +4 -0
- package/lib/internal/template/toggle/analytics-metadata/interfaces.js.map +1 -0
- package/lib/internal/template/toggle/index.js +1 -1
- package/lib/internal/template/toggle/index.js.map +1 -1
- package/lib/internal/template/toggle/internal.d.ts +4 -1
- package/lib/internal/template/toggle/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle/internal.js +16 -2
- package/lib/internal/template/toggle/internal.js.map +1 -1
- package/package.json +1 -1
- package/lib/internal/template/property-filter/token-editor-grouped.d.ts +0 -32
- package/lib/internal/template/property-filter/token-editor-grouped.d.ts.map +0 -1
- package/lib/internal/template/property-filter/token-editor-grouped.js +0 -114
- package/lib/internal/template/property-filter/token-editor-grouped.js.map +0 -1
|
@@ -11,12 +11,12 @@ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
|
11
11
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
12
12
|
import styles from './styles.css.js';
|
|
13
13
|
export default React.forwardRef(function RadioButton(_a, ref) {
|
|
14
|
-
var { name, label, value, checked, description, disabled, controlId, onChange, readOnly } = _a, rest = __rest(_a, ["name", "label", "value", "checked", "description", "disabled", "controlId", "onChange", "readOnly"]);
|
|
14
|
+
var { name, label, value, checked, description, disabled, controlId, onChange, readOnly, className } = _a, rest = __rest(_a, ["name", "label", "value", "checked", "description", "disabled", "controlId", "onChange", "readOnly", "className"]);
|
|
15
15
|
const isVisualRefresh = useVisualRefresh();
|
|
16
16
|
const radioButtonRef = useRef(null);
|
|
17
17
|
const mergedRefs = useMergeRefs(radioButtonRef, ref);
|
|
18
18
|
const { tabIndex } = useSingleTabStopNavigation(radioButtonRef);
|
|
19
|
-
return (React.createElement(AbstractSwitch, Object.assign({ className: clsx(styles.radio, description && styles['radio--has-description']), controlClassName: styles['radio-control'], outlineClassName: styles.outline, label: label, description: description, disabled: disabled, readOnly: readOnly, controlId: controlId }, copyAnalyticsMetadataAttribute(rest), { nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { tabIndex: tabIndex, type: "radio", ref: mergedRefs, name: name, value: value, checked: checked, "aria-disabled": readOnly && !disabled ? 'true' : undefined,
|
|
19
|
+
return (React.createElement(AbstractSwitch, Object.assign({ className: clsx(styles.radio, description && styles['radio--has-description'], className), controlClassName: styles['radio-control'], outlineClassName: styles.outline, label: label, description: description, disabled: disabled, readOnly: readOnly, controlId: controlId }, copyAnalyticsMetadataAttribute(rest), { nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { tabIndex: tabIndex, type: "radio", ref: mergedRefs, name: name, value: value, checked: checked, "aria-disabled": readOnly && !disabled ? 'true' : undefined,
|
|
20
20
|
// empty handler to suppress React controllability warning
|
|
21
21
|
onChange: () => { } }))), onClick: () => {
|
|
22
22
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-button.js","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kEAAkE,CAAC;AAElH,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACp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CAAC,EAAE,QAAQ;iBAC7C,CAAC,EACF,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EACrC,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAC5B;YACF,gCACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE;oBAC5C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;oBAC5C,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,OAAO;oBAC1C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;iBAC7C,CAAC,EACF,WAAW,EAAE,EAAE,EACf,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,CAAC,EAAE,EAAE,GACL,CACE,IAER,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { RadioGroupProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface RadioButtonProps extends RadioGroupProps.RadioButtonDefinition {\n name: string;\n checked: boolean;\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n readOnly?: boolean;\n className?: string;\n}\n\nexport default React.forwardRef(function RadioButton(\n {\n name,\n label,\n value,\n checked,\n description,\n disabled,\n controlId,\n onChange,\n readOnly,\n className,\n ...rest\n }: RadioButtonProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const isVisualRefresh = useVisualRefresh();\n const radioButtonRef = useRef<HTMLInputElement>(null);\n const mergedRefs = useMergeRefs(radioButtonRef, ref);\n\n const { tabIndex } = useSingleTabStopNavigation(radioButtonRef);\n\n return (\n <AbstractSwitch\n className={clsx(styles.radio, description && styles['radio--has-description'], className)}\n controlClassName={styles['radio-control']}\n outlineClassName={styles.outline}\n label={label}\n description={description}\n disabled={disabled}\n readOnly={readOnly}\n controlId={controlId}\n {...copyAnalyticsMetadataAttribute(rest)}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n tabIndex={tabIndex}\n type=\"radio\"\n ref={mergedRefs}\n name={name}\n value={value}\n checked={checked}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n radioButtonRef.current?.focus();\n if (checked) {\n return;\n }\n fireNonCancelableEvent(onChange, { value });\n }}\n styledControl={\n <svg viewBox=\"0 0 100 100\" focusable=\"false\" aria-hidden=\"true\">\n <circle\n className={clsx(styles['styled-circle-border'], {\n [styles['styled-circle-disabled']]: disabled,\n [styles['styled-circle-readonly']]: readOnly,\n })}\n strokeWidth={isVisualRefresh ? 12 : 8}\n cx={50}\n cy={50}\n r={isVisualRefresh ? 44 : 46}\n />\n <circle\n className={clsx(styles['styled-circle-fill'], {\n [styles['styled-circle-disabled']]: disabled,\n [styles['styled-circle-checked']]: checked,\n [styles['styled-circle-readonly']]: readOnly,\n })}\n strokeWidth={30}\n cx={50}\n cy={50}\n r={35}\n />\n </svg>\n }\n />\n );\n});\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
2
|
+
export interface GeneratedAnalyticsMetadataTilesSelect {
|
|
3
|
+
action: 'click';
|
|
4
|
+
detail: {
|
|
5
|
+
label: string;
|
|
6
|
+
position: string;
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface GeneratedAnalyticsMetadataTilesComponent {
|
|
11
|
+
name: 'awsui.Tiles';
|
|
12
|
+
label: string | LabelIdentifier;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/tiles/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AAEnG,MAAM,WAAW,qCAAqC;IACpD,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,wCAAwC;IACvD,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/tiles/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nexport interface GeneratedAnalyticsMetadataTilesSelect {\n action: 'click';\n detail: {\n label: string;\n position: string;\n value: string;\n };\n}\n\nexport interface GeneratedAnalyticsMetadataTilesComponent {\n name: 'awsui.Tiles';\n label: string | LabelIdentifier;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tiles/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tiles/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,mFAkBT,CAAC;AAGH,eAAe,KAAK,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
4
5
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
5
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
6
7
|
import InternalTiles from './internal';
|
|
@@ -8,7 +9,13 @@ const Tiles = React.forwardRef((props, ref) => {
|
|
|
8
9
|
const baseComponentProps = useBaseComponent('Tiles', {
|
|
9
10
|
props: { columns: props.columns },
|
|
10
11
|
});
|
|
11
|
-
|
|
12
|
+
const componentAnalyticsMetadata = {
|
|
13
|
+
name: 'awsui.Tiles',
|
|
14
|
+
label: '',
|
|
15
|
+
};
|
|
16
|
+
return (React.createElement(InternalTiles, Object.assign({ ref: ref }, props, baseComponentProps, getAnalyticsMetadataAttribute({
|
|
17
|
+
component: componentAnalyticsMetadata,
|
|
18
|
+
}))));
|
|
12
19
|
});
|
|
13
20
|
applyDisplayName(Tiles, 'Tiles');
|
|
14
21
|
export default Tiles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tiles/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tiles/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,aAAa,MAAM,YAAY,CAAC;AAIvC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAiB,EAAE,GAA8B,EAAE,EAAE;IACnF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,OAAO,EAAE;QACnD,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;KAClC,CAAC,CAAC;IACH,MAAM,0BAA0B,GAA6C;QAC3E,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,EAAE;KACV,CAAC;IACF,OAAO,CACL,oBAAC,aAAa,kBACZ,GAAG,EAAE,GAAG,IACJ,KAAK,EACL,kBAAkB,EAClB,6BAA6B,CAAC;QAChC,SAAS,EAAE,0BAA0B;KACtC,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjC,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { GeneratedAnalyticsMetadataTilesComponent } from './analytics-metadata/interfaces';\nimport { TilesProps } from './interfaces';\nimport InternalTiles from './internal';\n\nexport { TilesProps };\n\nconst Tiles = React.forwardRef((props: TilesProps, ref: React.Ref<TilesProps.Ref>) => {\n const baseComponentProps = useBaseComponent('Tiles', {\n props: { columns: props.columns },\n });\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataTilesComponent = {\n name: 'awsui.Tiles',\n label: '',\n };\n return (\n <InternalTiles\n ref={ref}\n {...props}\n {...baseComponentProps}\n {...getAnalyticsMetadataAttribute({\n component: componentAnalyticsMetadata,\n })}\n />\n );\n});\n\napplyDisplayName(Tiles, 'Tiles');\nexport default Tiles;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C,QAAA,MAAM,aAAa,qHAoElB,CAAC;AAqBF,eAAe,aAAa,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
7
|
import { getBaseProps } from '../internal/base-component';
|
|
7
8
|
import { useFormFieldContext } from '../internal/context/form-field-context';
|
|
8
9
|
import { useContainerBreakpoints } from '../internal/hooks/container-queries';
|
|
@@ -10,6 +11,7 @@ import useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-gro
|
|
|
10
11
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
11
12
|
import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
12
13
|
import { Tile } from './tile';
|
|
14
|
+
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
13
15
|
import styles from './styles.css.js';
|
|
14
16
|
const COLUMN_TRIGGERS = ['default', 'xxs', 'xs'];
|
|
15
17
|
const InternalTiles = React.forwardRef((_a, ref) => {
|
|
@@ -23,7 +25,16 @@ const InternalTiles = React.forwardRef((_a, ref) => {
|
|
|
23
25
|
const columnCount = getColumnCount(items, columns);
|
|
24
26
|
return (React.createElement("div", Object.assign({ role: "radiogroup", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls, "aria-readonly": readOnly ? 'true' : undefined }, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef }),
|
|
25
27
|
React.createElement("div", { className: clsx(styles.columns, styles[`column-${columnCount}`]) }, items &&
|
|
26
|
-
items.map((item, index) => (React.createElement(Tile, { ref: index === tileRefIndex ? tileRef : undefined, key: item.value, item: item, selected: item.value === value, name: name || generatedName, breakpoint: breakpoint, onChange: onChange, readOnly: readOnly }
|
|
28
|
+
items.map((item, index) => (React.createElement(Tile, Object.assign({ ref: index === tileRefIndex ? tileRef : undefined, key: item.value, item: item, selected: item.value === value, name: name || generatedName, breakpoint: breakpoint, onChange: onChange, readOnly: readOnly }, (!item.disabled && !readOnly
|
|
29
|
+
? getAnalyticsMetadataAttribute({
|
|
30
|
+
action: 'select',
|
|
31
|
+
detail: {
|
|
32
|
+
position: `${index + 1}`,
|
|
33
|
+
value: item.value,
|
|
34
|
+
label: `.${analyticsSelectors['radio-button']}`,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
: {}))))))));
|
|
27
38
|
});
|
|
28
39
|
function getColumnCount(items, columns) {
|
|
29
40
|
if (columns) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,yBAAyB,MAAM,6CAA6C,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,yBAAyB,MAAM,6CAA6C,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,eAAe,GAA4B,CAAC,SAAS,E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or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { GeneratedAnalyticsMetadataTilesSelect } from './analytics-metadata/interfaces';\nimport { TilesProps } from './interfaces';\nimport { Tile } from './tile';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst COLUMN_TRIGGERS: TilesProps.Breakpoint[] = ['default', 'xxs', 'xs'];\n\ntype InternalTilesProps = TilesProps & InternalBaseComponentProps;\n\nconst InternalTiles = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n columns,\n onChange,\n readOnly,\n __internalRootRef = null,\n ...rest\n }: InternalTilesProps,\n ref: React.Ref<TilesProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const generatedName = useUniqueId('awsui-tiles-');\n\n const [tileRef, tileRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n const [breakpoint, breakpointRef] = useContainerBreakpoints(COLUMN_TRIGGERS);\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const columnCount = getColumnCount(items, columns);\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n aria-readonly={readOnly ? 'true' : undefined}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={mergedRef}\n >\n <div className={clsx(styles.columns, styles[`column-${columnCount}`])}>\n {items &&\n items.map((item, index) => (\n <Tile\n ref={index === tileRefIndex ? tileRef : undefined}\n key={item.value}\n item={item}\n selected={item.value === value}\n name={name || generatedName}\n breakpoint={breakpoint}\n onChange={onChange}\n readOnly={readOnly}\n {...(!item.disabled && !readOnly\n ? getAnalyticsMetadataAttribute({\n action: 'select',\n detail: {\n position: `${index + 1}`,\n value: item.value,\n label: `.${analyticsSelectors['radio-button']}`,\n } as Partial<GeneratedAnalyticsMetadataTilesSelect['detail']>,\n })\n : {})}\n />\n ))}\n </div>\n </div>\n );\n }\n);\n\nfunction getColumnCount(\n items: ReadonlyArray<TilesProps.TilesDefinition> | undefined,\n columns: number | undefined\n): number {\n if (columns) {\n return columns;\n }\n\n const nItems = items ? items.length : 0;\n const columnsLookup: Record<number, number> = {\n 0: 1,\n 1: 1,\n 2: 2,\n 4: 2,\n 8: 2,\n };\n return columnsLookup[nItems] || 3;\n}\n\nexport default InternalTiles;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../../src/tiles/tile.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../../src/tiles/tile.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAMtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,UAAU,SAAS;IACjB,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,IAAI,oFAmDhB,CAAC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
4
|
import React, { useRef } from 'react';
|
|
4
5
|
import clsx from 'clsx';
|
|
6
|
+
import { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
5
7
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
6
8
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
7
9
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
8
10
|
import RadioButton from '../radio-group/radio-button';
|
|
11
|
+
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
9
12
|
import styles from './styles.css.js';
|
|
10
|
-
export const Tile = React.forwardRef((
|
|
13
|
+
export const Tile = React.forwardRef((_a, forwardedRef) => {
|
|
14
|
+
var { item, selected, name, breakpoint, onChange, readOnly } = _a, rest = __rest(_a, ["item", "selected", "name", "breakpoint", "onChange", "readOnly"]);
|
|
11
15
|
const internalRef = useRef(null);
|
|
12
16
|
const isVisualRefresh = useVisualRefresh();
|
|
13
17
|
const mergedRef = useMergeRefs(internalRef, forwardedRef);
|
|
14
|
-
return (React.createElement("div", { className: clsx(styles['tile-container'], { [styles['has-metadata']]: item.description || item.image }, { [styles.selected]: selected }, { [styles.disabled]: !!item.disabled }, { [styles.readonly]: readOnly }, { [styles.refresh]: isVisualRefresh }, styles[`breakpoint-${breakpoint}`]), "data-value": item.value, onClick: () => {
|
|
18
|
+
return (React.createElement("div", Object.assign({ className: clsx(styles['tile-container'], { [styles['has-metadata']]: item.description || item.image }, { [styles.selected]: selected }, { [styles.disabled]: !!item.disabled }, { [styles.readonly]: readOnly }, { [styles.refresh]: isVisualRefresh }, styles[`breakpoint-${breakpoint}`]), "data-value": item.value, onClick: () => {
|
|
15
19
|
var _a;
|
|
16
20
|
if (item.disabled || readOnly) {
|
|
17
21
|
return;
|
|
@@ -20,9 +24,9 @@ export const Tile = React.forwardRef(({ item, selected, name, breakpoint, onChan
|
|
|
20
24
|
if (!selected) {
|
|
21
25
|
fireNonCancelableEvent(onChange, { value: item.value });
|
|
22
26
|
}
|
|
23
|
-
} },
|
|
27
|
+
} }, copyAnalyticsMetadataAttribute(rest)),
|
|
24
28
|
React.createElement("div", { className: clsx(styles.control, { [styles['no-image']]: !item.image }) },
|
|
25
|
-
React.createElement(RadioButton, { checked: selected, ref: mergedRef, name: name, value: item.value, label: item.label, description: item.description, disabled: item.disabled, controlId: item.controlId, readOnly: readOnly })),
|
|
29
|
+
React.createElement(RadioButton, { checked: selected, ref: mergedRef, name: name, value: item.value, label: item.label, description: item.description, disabled: item.disabled, controlId: item.controlId, readOnly: readOnly, className: analyticsSelectors['radio-button'] })),
|
|
26
30
|
item.image && React.createElement("div", { className: clsx(styles.image, { [styles.disabled]: !!item.disabled }) }, item.image)));
|
|
27
31
|
});
|
|
28
32
|
//# sourceMappingURL=tile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.js","sourceRoot":"","sources":["../../../src/tiles/tile.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,WAAW,MAAM,6BAA6B,CAAC;AAGtD,OAAO,MAAM,MAAM,iBA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CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAG,IAAI,CAAC,KAAK,CAAO,CACzG,CACP,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport RadioButton from '../radio-group/radio-button';\nimport { TilesProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface TileProps {\n item: TilesProps.TilesDefinition;\n selected: boolean;\n name: string;\n breakpoint: ReturnType<typeof useContainerBreakpoints>[0];\n onChange: TilesProps['onChange'];\n readOnly?: boolean;\n}\n\nexport const Tile = React.forwardRef(\n (\n { item, selected, name, breakpoint, onChange, readOnly, ...rest }: TileProps,\n forwardedRef: React.Ref<HTMLInputElement>\n ) => {\n const internalRef = useRef<HTMLInputElement>(null);\n const isVisualRefresh = useVisualRefresh();\n\n const mergedRef = useMergeRefs(internalRef, forwardedRef);\n\n return (\n <div\n className={clsx(\n styles['tile-container'],\n { [styles['has-metadata']]: item.description || item.image },\n { [styles.selected]: selected },\n { [styles.disabled]: !!item.disabled },\n { [styles.readonly]: readOnly },\n { [styles.refresh]: isVisualRefresh },\n styles[`breakpoint-${breakpoint}`]\n )}\n data-value={item.value}\n onClick={() => {\n if (item.disabled || readOnly) {\n return;\n }\n internalRef.current?.focus();\n if (!selected) {\n fireNonCancelableEvent(onChange, { value: item.value });\n }\n }}\n {...copyAnalyticsMetadataAttribute(rest)}\n >\n <div className={clsx(styles.control, { [styles['no-image']]: !item.image })}>\n <RadioButton\n checked={selected}\n ref={mergedRef}\n name={name}\n value={item.value}\n label={item.label}\n description={item.description}\n disabled={item.disabled}\n controlId={item.controlId}\n readOnly={readOnly}\n className={analyticsSelectors['radio-button']}\n />\n </div>\n {item.image && <div className={clsx(styles.image, { [styles.disabled]: !!item.disabled })}>{item.image}</div>}\n </div>\n );\n }\n);\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
2
|
+
export interface GeneratedAnalyticsMetadataToggleSelect {
|
|
3
|
+
action: 'select';
|
|
4
|
+
detail: {
|
|
5
|
+
label: string;
|
|
6
|
+
selected: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface GeneratedAnalyticsMetadataToggleComponent {
|
|
10
|
+
name: 'awsui.Toggle';
|
|
11
|
+
label: string | LabelIdentifier;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/toggle/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AAEnG,MAAM,WAAW,sCAAsC;IACrD,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,yCAAyC;IACxD,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/toggle/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nexport interface GeneratedAnalyticsMetadataToggleSelect {\n action: 'select';\n detail: {\n label: string;\n selected: string;\n };\n}\n\nexport interface GeneratedAnalyticsMetadataToggleComponent {\n name: 'awsui.Toggle';\n label: string | LabelIdentifier;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
|
6
6
|
import InternalToggle from './internal';
|
|
7
7
|
const Toggle = React.forwardRef((props, ref) => {
|
|
8
8
|
const baseComponentProps = useBaseComponent('Toggle');
|
|
9
|
-
return React.createElement(InternalToggle, Object.assign({}, props, baseComponentProps, { ref: ref }));
|
|
9
|
+
return React.createElement(InternalToggle, Object.assign({}, props, baseComponentProps, { ref: ref, __injectAnalyticsComponentMetadata: true }));
|
|
10
10
|
});
|
|
11
11
|
applyDisplayName(Toggle, 'Toggle');
|
|
12
12
|
export default Toggle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/toggle/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,cAAc,MAAM,YAAY,CAAC;AAIxC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC3E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACtD,OAAO,oBAAC,cAAc,oBAAK,KAAK,EAAM,kBAAkB,IAAE,GAAG,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/toggle/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,cAAc,MAAM,YAAY,CAAC;AAIxC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC3E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACtD,OAAO,oBAAC,cAAc,oBAAK,KAAK,EAAM,kBAAkB,IAAE,GAAG,EAAE,GAAG,EAAE,kCAAkC,EAAE,IAAI,IAAI,CAAC;AACnH,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACnC,eAAe,MAAM,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ToggleProps } from './interfaces';\nimport InternalToggle from './internal';\n\nexport { ToggleProps };\n\nconst Toggle = React.forwardRef<ToggleProps.Ref, ToggleProps>((props, ref) => {\n const baseComponentProps = useBaseComponent('Toggle');\n return <InternalToggle {...props} {...baseComponentProps} ref={ref} __injectAnalyticsComponentMetadata={true} />;\n});\n\napplyDisplayName(Toggle, 'Toggle');\nexport default Toggle;\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
3
3
|
import { ToggleProps } from './interfaces';
|
|
4
|
-
|
|
4
|
+
interface InternalToggleProps extends ToggleProps, InternalBaseComponentProps {
|
|
5
|
+
__injectAnalyticsComponentMetadata?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const InternalToggle: React.ForwardRefExoticComponent<InternalToggleProps & React.RefAttributes<ToggleProps.Ref>>;
|
|
5
8
|
export default InternalToggle;
|
|
6
9
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/toggle/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/toggle/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAatC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,UAAU,mBAAoB,SAAQ,WAAW,EAAE,0BAA0B;IAC3E,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,QAAA,MAAM,cAAc,6FA+FnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React, { useRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { getAnalyticsMetadataAttribute, } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
7
|
import { getBaseProps } from '../internal/base-component';
|
|
7
8
|
import AbstractSwitch from '../internal/components/abstract-switch';
|
|
8
9
|
import { useFormFieldContext } from '../internal/context/form-field-context';
|
|
@@ -10,10 +11,23 @@ import { fireNonCancelableEvent } from '../internal/events';
|
|
|
10
11
|
import useForwardFocus from '../internal/hooks/forward-focus';
|
|
11
12
|
import styles from './styles.css.js';
|
|
12
13
|
const InternalToggle = React.forwardRef((_a, ref) => {
|
|
13
|
-
var { controlId, checked, name, disabled, readOnly, children, description, ariaLabel, ariaControls, onFocus, onBlur, onChange, __internalRootRef = null } = _a, rest = __rest(_a, ["controlId", "checked", "name", "disabled", "readOnly", "children", "description", "ariaLabel", "ariaControls", "onFocus", "onBlur", "onChange", "__internalRootRef"]);
|
|
14
|
+
var { controlId, checked, name, disabled, readOnly, children, description, ariaLabel, ariaControls, onFocus, onBlur, onChange, __internalRootRef = null, __injectAnalyticsComponentMetadata } = _a, rest = __rest(_a, ["controlId", "checked", "name", "disabled", "readOnly", "children", "description", "ariaLabel", "ariaControls", "onFocus", "onBlur", "onChange", "__internalRootRef", "__injectAnalyticsComponentMetadata"]);
|
|
14
15
|
const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);
|
|
15
16
|
const baseProps = getBaseProps(rest);
|
|
16
17
|
const checkboxRef = useRef(null);
|
|
18
|
+
const analyticsMetadata = {};
|
|
19
|
+
const analyticsComponentMetadata = {
|
|
20
|
+
name: 'awsui.Toggle',
|
|
21
|
+
label: { root: 'self' },
|
|
22
|
+
};
|
|
23
|
+
if (__injectAnalyticsComponentMetadata) {
|
|
24
|
+
analyticsMetadata.component = analyticsComponentMetadata;
|
|
25
|
+
}
|
|
26
|
+
if (!disabled && !readOnly) {
|
|
27
|
+
analyticsMetadata.detail = {
|
|
28
|
+
selected: `${!checked}`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
17
31
|
useForwardFocus(ref, checkboxRef);
|
|
18
32
|
return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: clsx(styles['toggle-control'], {
|
|
19
33
|
[styles['toggle-control-checked']]: checked,
|
|
@@ -31,7 +45,7 @@ const InternalToggle = React.forwardRef((_a, ref) => {
|
|
|
31
45
|
[styles['toggle-handle-checked']]: checked,
|
|
32
46
|
[styles['toggle-handle-disabled']]: disabled,
|
|
33
47
|
[styles['toggle-handle-readonly']]: readOnly,
|
|
34
|
-
}) }), __internalRootRef: __internalRootRef })));
|
|
48
|
+
}) }), __internalRootRef: __internalRootRef }, getAnalyticsMetadataAttribute(analyticsMetadata))));
|
|
35
49
|
});
|
|
36
50
|
export default InternalToggle;
|
|
37
51
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/toggle/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/toggle/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAQ9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EAgBC,EACD,GAAG,EACH,EAAE;QAlBF,EACE,SAAS,EACT,OAAO,EACP,IAAI,EACJ,Q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AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport {\n GeneratedAnalyticsMetadataToggleComponent,\n GeneratedAnalyticsMetadataToggleSelect,\n} from './analytics-metadata/interfaces';\nimport { ToggleProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalToggleProps extends ToggleProps, InternalBaseComponentProps {\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalToggle = React.forwardRef<ToggleProps.Ref, InternalToggleProps>(\n (\n {\n controlId,\n checked,\n name,\n disabled,\n readOnly,\n children,\n description,\n ariaLabel,\n ariaControls,\n onFocus,\n onBlur,\n onChange,\n __internalRootRef = null,\n __injectAnalyticsComponentMetadata,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = {};\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataToggleComponent = {\n name: 'awsui.Toggle',\n label: { root: 'self' },\n };\n\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = analyticsComponentMetadata;\n }\n\n if (!disabled && !readOnly) {\n analyticsMetadata.detail = {\n selected: `${!checked}`,\n } as Partial<GeneratedAnalyticsMetadataToggleSelect['detail']>;\n }\n useForwardFocus(ref, checkboxRef);\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={clsx(styles['toggle-control'], {\n [styles['toggle-control-checked']]: checked,\n [styles['toggle-control-disabled']]: disabled,\n [styles['toggle-control-readonly']]: readOnly,\n })}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n readOnly={readOnly}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(onChange, { checked: !checked });\n }}\n styledControl={\n /*Using span, not div for HTML validity*/\n <span\n className={clsx(styles['toggle-handle'], {\n [styles['toggle-handle-checked']]: checked,\n [styles['toggle-handle-disabled']]: disabled,\n [styles['toggle-handle-readonly']]: readOnly,\n })}\n />\n }\n __internalRootRef={__internalRootRef}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n />\n );\n }\n);\n\nexport default InternalToggle;\n"]}
|
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';
|
|
3
|
-
import { NonCancelableEventHandler } from '../internal/events';
|
|
4
|
-
import { FormattedToken, GroupText, I18nStrings, InternalFilteringOption, InternalFilteringProperty, InternalFreeTextFiltering, InternalToken, LoadItemsDetail } from './interfaces';
|
|
5
|
-
interface I18nStringsExt {
|
|
6
|
-
tokenEditorTokenActionsLabel: (token: FormattedToken) => string;
|
|
7
|
-
tokenEditorTokenRemoveLabel: (token: FormattedToken) => string;
|
|
8
|
-
tokenEditorTokenRemoveFromGroupLabel: (token: FormattedToken) => string;
|
|
9
|
-
tokenEditorAddNewTokenLabel: string;
|
|
10
|
-
tokenEditorAddTokenActionsLabel: string;
|
|
11
|
-
tokenEditorAddExistingTokenLabel: (token: FormattedToken) => string;
|
|
12
|
-
}
|
|
13
|
-
export interface TokenEditorProps {
|
|
14
|
-
supportsGroups: boolean;
|
|
15
|
-
asyncProperties?: boolean;
|
|
16
|
-
asyncProps: DropdownStatusProps;
|
|
17
|
-
customGroupsText: readonly GroupText[];
|
|
18
|
-
freeTextFiltering: InternalFreeTextFiltering;
|
|
19
|
-
filteringProperties: readonly InternalFilteringProperty[];
|
|
20
|
-
filteringOptions: readonly InternalFilteringOption[];
|
|
21
|
-
i18nStrings: I18nStrings & I18nStringsExt;
|
|
22
|
-
onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;
|
|
23
|
-
onSubmit: () => void;
|
|
24
|
-
onDismiss: () => void;
|
|
25
|
-
standaloneTokens: InternalToken[];
|
|
26
|
-
onChangeStandalone: (newStandalone: InternalToken[]) => void;
|
|
27
|
-
tempGroup: InternalToken[];
|
|
28
|
-
onChangeTempGroup: (token: InternalToken[]) => void;
|
|
29
|
-
}
|
|
30
|
-
export declare function TokenEditor({ supportsGroups, asyncProperties, asyncProps, customGroupsText, freeTextFiltering, filteringProperties, filteringOptions, i18nStrings, onLoadItems, onSubmit, onDismiss, standaloneTokens, onChangeStandalone, tempGroup, onChangeTempGroup, }: TokenEditorProps): JSX.Element;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=token-editor-grouped.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-editor-grouped.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor-grouped.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AA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