Skip to content

Commit 2017294

Browse files
authored
Merge pull request #33 from Teradata/feat/dropdown
Feat/dropdown
2 parents e5c5a20 + bc03f9a commit 2017294

File tree

8 files changed

+295
-8
lines changed

8 files changed

+295
-8
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import CvListItem from './index';
3+
4+
const meta = {
5+
title: 'Components/CvListItem',
6+
component: CvListItem,
7+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
8+
tags: ['autodocs'],
9+
parameters: {
10+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
11+
layout: 'fullscreen',
12+
},
13+
14+
args: {
15+
/**
16+
* Value associated with this list item
17+
*/
18+
value: '',
19+
/**
20+
* Used to group items together
21+
*/
22+
group: '',
23+
/**
24+
* Reflects tabindex and sets internal tab indices.
25+
*/
26+
tabindex: 1,
27+
/**
28+
* Reflects disabled and sets internal disabled attributes.
29+
*/
30+
disabled: false,
31+
/**
32+
* Activates the two-line variant and enables the secondary slot.
33+
*/
34+
twoline: false,
35+
/**
36+
* Activates focus-persistent ripple.
37+
*/
38+
activated: false,
39+
/**
40+
* Determines which graphic layout to show and enables the graphic slot.
41+
*/
42+
graphic: '',
43+
/**
44+
* Allows arbitrary width for multiple slotted graphics.
45+
*/
46+
multipleGraphics: false,
47+
/**
48+
* Activates the meta layout tile and enables the meta slot.
49+
*/
50+
hasMeta: false,
51+
/**
52+
* Disables focus and pointer events for the list item.
53+
*/
54+
noninteractive: false,
55+
/**
56+
* Denotes that the list item is selected.
57+
*/
58+
selected: false,
59+
/**
60+
* Content to be rendered in the list item.
61+
*/
62+
children: <span>List Item</span>,
63+
},
64+
} satisfies Meta<typeof CvListItem>;
65+
66+
export default meta;
67+
type Story = StoryObj<typeof meta>;
68+
69+
export const Basic: Story = {
70+
render: (args) => {
71+
return <CvListItem {...args}>{args.children}</CvListItem>;
72+
},
73+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { CovalentListItem } from '@covalent/components/list/list-item';
2+
import { createComponent } from '@lit/react';
3+
import React from 'react';
4+
import '@covalent/components/icon';
5+
6+
interface ListItemProps {
7+
/**
8+
* Value associated with this list item
9+
*/
10+
value?: string;
11+
/**
12+
* Used to group items together
13+
*/
14+
group?: string;
15+
/**
16+
* Reflects tabindex and sets internal tab indices.
17+
*/
18+
tabindex?: number;
19+
/**
20+
* Reflects disabled and sets internal disabled attributes.
21+
*/
22+
disabled?: boolean;
23+
/**
24+
* Activates the two-line variant and enables the secondary slot.
25+
*/
26+
twoline?: boolean;
27+
/**
28+
* Activates focus-persistent ripple.
29+
*/
30+
activated?: boolean;
31+
/**
32+
* Determines which graphic layout to show and enables the graphic slot.
33+
*/
34+
graphic?: string;
35+
/**
36+
* Allows arbitrary width for multiple slotted graphics.
37+
*/
38+
multipleGraphics?: boolean;
39+
/**
40+
* Activates the meta layout tile and enables the meta slot.
41+
*/
42+
hasMeta?: boolean;
43+
/**
44+
* Disables focus and pointer events for the list item.
45+
*/
46+
noninteractive?: boolean;
47+
/**
48+
* Denotes that the list item is selected.
49+
*/
50+
selected?: boolean;
51+
children?: React.ReactNode;
52+
}
53+
const ListItemComponent = createComponent({
54+
tagName: 'cv-list-item',
55+
elementClass: CovalentListItem as never,
56+
react: React,
57+
});
58+
59+
const CvListItem: React.FC<ListItemProps> = (props) => {
60+
return <ListItemComponent {...props}></ListItemComponent>;
61+
};
62+
63+
CvListItem.displayName = 'CvListItem';
64+
export default CvListItem;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import List from './index';
3+
import CvListItem from '../CvListItem';
4+
5+
const meta = {
6+
title: 'Components/List',
7+
component: List,
8+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
9+
tags: ['autodocs'],
10+
parameters: {
11+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
12+
layout: 'fullscreen',
13+
},
14+
15+
args: {
16+
activatible: true,
17+
rootTabbable: false,
18+
multi: false,
19+
wrapFocus: false,
20+
noninteractive: false,
21+
itemRoles: '',
22+
innerAriaLabel: '',
23+
innerRole: '',
24+
},
25+
} satisfies Meta<typeof List>;
26+
27+
export default meta;
28+
type Story = StoryObj<typeof meta>;
29+
30+
export const Basic: Story = {
31+
render: (args) => {
32+
return (
33+
<List {...args}>
34+
<CvListItem>sub item</CvListItem>
35+
<CvListItem>sub item</CvListItem>
36+
<CvListItem>sub item</CvListItem>
37+
</List>
38+
);
39+
},
40+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { CovalentList } from '@covalent/components/list/list';
2+
import { createComponent } from '@lit/react';
3+
import React from 'react';
4+
import '@covalent/components/icon';
5+
6+
interface ListProps {
7+
/**
8+
* Whether the list items are activatable
9+
*/
10+
activatible: boolean;
11+
/**
12+
* When true, sets tabindex=0 on the internal list
13+
*/
14+
rootTabbable: boolean;
15+
/**
16+
* When true, enables selection of multiple items
17+
*/
18+
multi: boolean;
19+
/**
20+
* When true, wraps focus between the first and last list item
21+
*/
22+
wrapFocus: boolean;
23+
/**
24+
* When true, disables interaction on the list
25+
*/
26+
noninteractive: boolean;
27+
/**
28+
* Role for the list items
29+
*/
30+
itemRoles: string;
31+
/**
32+
* aria-label for the internal list element
33+
*/
34+
innerAriaLabel: string;
35+
/**
36+
* Role for the internal list element
37+
*/
38+
innerRole: string;
39+
/**
40+
* Children elements to be rendered inside the list
41+
*/
42+
children?: React.ReactNode;
43+
}
44+
45+
const ListComponent = createComponent({
46+
tagName: 'cv-list',
47+
elementClass: CovalentList as never,
48+
react: React,
49+
});
50+
51+
const List: React.FC<ListProps> = (props) => {
52+
return <ListComponent {...props} />;
53+
};
54+
55+
List.displayName = 'List';
56+
export default List;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import Select from './index';
3+
import CvListItem from '../CvListItem';
4+
5+
const meta = {
6+
title: 'Components/Select',
7+
component: Select,
8+
tags: ['autodocs'],
9+
parameters: {
10+
layout: 'fullscreen',
11+
},
12+
args: {
13+
icon: 'info',
14+
titleText: 'Select title',
15+
descriptionText: 'Select description',
16+
state: 'active',
17+
inline: false,
18+
},
19+
} satisfies Meta<typeof Select>;
20+
21+
export default meta;
22+
type Story = StoryObj<typeof meta>;
23+
24+
export const Basic: Story = {
25+
render: (args) => {
26+
return (
27+
<Select {...args}>
28+
<CvListItem>sub item</CvListItem>
29+
<CvListItem>sub item</CvListItem>
30+
<CvListItem>sub item</CvListItem>
31+
</Select>
32+
);
33+
},
34+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { CovalentSelect } from '@covalent/components/select';
2+
import { createComponent } from '@lit/react';
3+
import React, { ReactNode } from 'react';
4+
import '@covalent/components/icon';
5+
6+
interface SelectProps {
7+
icon: string;
8+
titleText: string;
9+
descriptionText: string;
10+
state: string;
11+
inline: boolean;
12+
children?: ReactNode;
13+
}
14+
15+
const SelectComponent = createComponent({
16+
tagName: 'cv-select',
17+
elementClass: CovalentSelect as never,
18+
react: React,
19+
});
20+
21+
const Select: React.FC<SelectProps> = (props) => {
22+
return <SelectComponent {...props}>{props.children}</SelectComponent>;
23+
};
24+
25+
Select.displayName = 'Select';
26+
export default Select;

libs/react-components/src/lib/components/Typography/Typography.stories.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ export const LeftAlignedEyebrow: Story = {
7373
'story--components-typography--left-aligned-eyebrow-inner'
7474
);
7575
element?.style.setProperty('--td-web-typography-eyebrow-alignment', 'left');
76-
return (
77-
<Typography scale="eyebrow">
78-
Left aligned eyebrow
79-
</Typography>
80-
);
76+
return <Typography scale="eyebrow">Left aligned eyebrow</Typography>;
8177
},
82-
};
78+
};

libs/react-components/src/lib/components/Typography/styles.module.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
line-height: var(--td-web-typography-caption-line-height);
8080
}
8181

82-
8382
.eyebrow {
8483
align-items: var(--td-web-typography-eyebrow-alignment, 'center');
8584
display: flex;
@@ -95,7 +94,6 @@
9594
}
9695
}
9796

98-
9997
/* Mobile styles */
10098
@media only screen and (max-width: 768px) {
10199
.headline1 {

0 commit comments

Comments
 (0)