Skip to content

Commit

Permalink
chore: Update label syntax for analytics metadata (#2519)
Browse files Browse the repository at this point in the history
Co-authored-by: Francesco Longo <[email protected]>
  • Loading branch information
fralongo and Francesco Longo committed Jul 26, 2024
1 parent cf0f2b0 commit 89f643f
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 23 deletions.
4 changes: 3 additions & 1 deletion src/button-dropdown/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

export interface GeneratedAnalyticsMetadataButtonDropdownClick {
action: 'click';
detail: {
Expand All @@ -13,7 +15,7 @@ export interface GeneratedAnalyticsMetadataButtonDropdownClick {
export interface GeneratedAnalyticsMetadataButtonDropdownExpand {
action: 'expand';
detail: {
label: string;
label: string | LabelIdentifier;
expanded: string;
position?: string;
id?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const ExpandableCategoryElement = ({
action: 'expand',
detail: {
position: position || '0',
label: '',
label: { root: 'self' },
id: item.id || '',
expanded: `${!expanded}`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const MobileExpandableCategoryElement = ({
action: 'expand',
detail: {
position: position || '0',
label: '',
label: { root: 'self' },
id: item.id || '',
expanded: `${!expanded}`,
},
Expand Down
6 changes: 4 additions & 2 deletions src/button/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

interface GeneratedAnalyticsMetadataButtonClick {
action: 'click';
detail: {
label: string;
label: string | LabelIdentifier;
};
}

interface GeneratedAnalyticsMetadataButtonComponent {
name: 'awsui.Button';
label: string;
label: string | LabelIdentifier;
properties: {
variant: string;
disabled: string;
Expand Down
4 changes: 2 additions & 2 deletions src/button/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ export const InternalButton = React.forwardRef(
? {}
: {
action: 'click',
detail: { label: '' },
detail: { label: { root: 'self' } },
};
if (__injectAnalyticsComponentMetadata) {
analyticsMetadata.component = {
name: 'awsui.Button',
label: '',
label: { root: 'self' },
properties: { variant, disabled: `${disabled}` },
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata/interfaces';
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

export interface GeneratedAnalyticsMetadataCheckboxSelect {
action: 'select';
Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(
const analyticsMetadata: GeneratedAnalyticsMetadataFragment = {};
const analyticsComponentMetadata: GeneratedAnalyticsMetadataCheckboxComponent = {
name: 'awsui.Checkbox',
label: '',
label: { root: 'self' },
};
if (__injectAnalyticsComponentMetadata) {
analyticsMetadata.component = analyticsComponentMetadata;
Expand Down
4 changes: 3 additions & 1 deletion src/container/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

export interface GeneratedAnalyticsMetadataContainerComponent {
name: 'awsui.Container';
label: string;
label: string | LabelIdentifier;
}
2 changes: 1 addition & 1 deletion src/container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function Container({

const analyticsComponentMetadata: GeneratedAnalyticsMetadataContainerComponent = {
name: 'awsui.Container',
label: '',
label: { root: 'self' },
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/form/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata/interfaces';
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

interface GeneratedAnalyticsMetadataFormComponent {
name: 'awsui.Form';
Expand Down
2 changes: 1 addition & 1 deletion src/link/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata/interfaces';
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

interface GeneratedAnalyticsMetadataLinkClick {
action: 'click';
Expand Down
4 changes: 2 additions & 2 deletions src/link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ const Link = React.forwardRef(
const analyticsMetadata: GeneratedAnalyticsMetadataLinkFragment = {
action: 'click',
detail: {
label: '',
label: { root: 'self' },
external: `${external}`,
},
component: {
name: 'awsui.Link',
label: '',
label: { root: 'self' },
properties: { variant: props.variant || 'secondary' },
},
};
Expand Down
6 changes: 4 additions & 2 deletions src/pagination/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

export interface GeneratedAnalyticsMetadataPaginationClick {
action: 'click';
detail: {
label: string;
label: string | LabelIdentifier;
position?: string;
};
}

export interface GeneratedAnalyticsMetadataPaginationComponent {
name: 'awsui.Pagination';
label: string;
label: string | LabelIdentifier;
properties: {
openEnd: string;
pagesCount: string;
Expand Down
2 changes: 1 addition & 1 deletion src/pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function Pagination(props: PaginationProps) {
{...getAnalyticsMetadataAttribute({
component: {
name: 'awsui.Pagination',
label: '',
label: { root: 'self' },
properties: {
openEnd: `${!!props.openEnd}`,
pagesCount: `${props.pagesCount || ''}`,
Expand Down
2 changes: 1 addition & 1 deletion src/pagination/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function PageButton({
: getAnalyticsMetadataAttribute({
action: 'click',
detail: {
label: '',
label: { root: 'self' },
},
} as GeneratedAnalyticsMetadataPaginationClick))}
>
Expand Down
2 changes: 1 addition & 1 deletion src/radio-group/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata/interfaces';
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

export interface GeneratedAnalyticsMetadataRadioGroupSelect {
action: 'click';
Expand Down
2 changes: 1 addition & 1 deletion src/radio-group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const RadioGroup = React.forwardRef((props: RadioGroupProps, ref: React.Ref<Radi
{...getAnalyticsMetadataAttribute({
component: {
name: 'awsui.RadioGroup',
label: '',
label: { root: 'self' },
} as GeneratedAnalyticsMetadataRadioGroupComponent,
})}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/table/analytics-metadata/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata/interfaces';
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';

export interface GeneratedAnalyticsMetadataTableSelect {
action: 'select';
Expand Down
2 changes: 1 addition & 1 deletion src/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Table = React.forwardRef(

const analyticsComponentMetadata: GeneratedAnalyticsMetadataTableComponent = {
name: 'awsui.Table',
label: '',
label: { root: 'self' },
properties: {
selectionType: props.selectionType || 'none',
itemsCount: `${items.length}`,
Expand Down

0 comments on commit 89f643f

Please sign in to comment.