Skip to content

Commit 30cc810

Browse files
feat(FluidSelect): adds in FluidSelect component (#12290)
* feat(FluidSelect): scaffold out react files * feat(FluidSelect): scaffold out sass files * chore(FluidSelect): update snapshots, add initial tests * chore(FluidSelect): clean up stories * feat(FluidSelect): add styles, useContext hooks * test(e2e): add e2e tests for FluidSelect * fix(FluidSelect): fix disabled state Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 2ad25f8 commit 30cc810

File tree

21 files changed

+722
-2
lines changed

21 files changed

+722
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright IBM Corp. 2022
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
'use strict';
9+
10+
const { expect, test } = require('@playwright/test');
11+
const { themes } = require('../../test-utils/env');
12+
const { snapshotStory, visitStory } = require('../../test-utils/storybook');
13+
14+
test.describe('FluidSelect', () => {
15+
themes.forEach((theme) => {
16+
test.describe(theme, () => {
17+
test('fluid select @vrt', async ({ page }) => {
18+
await snapshotStory(page, {
19+
component: 'FluidSelect',
20+
id: 'experimental-unstable-fluidselect--default',
21+
theme,
22+
});
23+
});
24+
});
25+
});
26+
27+
test('accessibility-checker @avt', async ({ page }) => {
28+
await visitStory(page, {
29+
component: 'FluidSelect',
30+
id: 'experimental-unstable-fluidselect--default',
31+
globals: {
32+
theme: 'white',
33+
},
34+
});
35+
await expect(page).toHaveNoACViolations('FluidSelect');
36+
});
37+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Code generated by carbon-components-react. DO NOT EDIT.
2+
//
3+
// Copyright IBM Corp. 2018, 2018
4+
//
5+
// This source code is licensed under the Apache-2.0 license found in the
6+
// LICENSE file in the root directory of this source tree.
7+
//
8+
9+
@forward '@carbon/styles/scss/components/fluid-select/fluid-select';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Code generated by carbon-components-react. DO NOT EDIT.
2+
//
3+
// Copyright IBM Corp. 2018, 2018
4+
//
5+
// This source code is licensed under the Apache-2.0 license found in the
6+
// LICENSE file in the root directory of this source tree.
7+
//
8+
9+
@forward '@carbon/styles/scss/components/fluid-select';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Code generated by carbon-components. DO NOT EDIT.
2+
//
3+
// Copyright IBM Corp. 2018, 2018
4+
//
5+
// This source code is licensed under the Apache-2.0 license found in the
6+
// LICENSE file in the root directory of this source tree.
7+
//
8+
9+
@forward '@carbon/styles/scss/components/fluid-select/fluid-select';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Code generated by carbon-components. DO NOT EDIT.
2+
//
3+
// Copyright IBM Corp. 2018, 2018
4+
//
5+
// This source code is licensed under the Apache-2.0 license found in the
6+
// LICENSE file in the root directory of this source tree.
7+
//
8+
9+
@forward '@carbon/styles/scss/components/fluid-select';

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9308,6 +9308,53 @@ Map {
93089308
},
93099309
},
93109310
},
9311+
"unstable__FluidSelect" => Object {
9312+
"$$typeof": Symbol(react.forward_ref),
9313+
"propTypes": Object {
9314+
"children": Object {
9315+
"type": "node",
9316+
},
9317+
"className": Object {
9318+
"type": "string",
9319+
},
9320+
"defaultValue": Object {
9321+
"type": "any",
9322+
},
9323+
"disabled": Object {
9324+
"type": "bool",
9325+
},
9326+
"id": Object {
9327+
"isRequired": true,
9328+
"type": "string",
9329+
},
9330+
"invalid": Object {
9331+
"type": "bool",
9332+
},
9333+
"invalidText": Object {
9334+
"type": "node",
9335+
},
9336+
"labelText": Object {
9337+
"type": "node",
9338+
},
9339+
"onChange": Object {
9340+
"type": "func",
9341+
},
9342+
"warn": Object {
9343+
"type": "bool",
9344+
},
9345+
"warnText": Object {
9346+
"type": "node",
9347+
},
9348+
},
9349+
"render": [Function],
9350+
},
9351+
"unstable__FluidSelectSkeleton" => Object {
9352+
"propTypes": Object {
9353+
"className": Object {
9354+
"type": "string",
9355+
},
9356+
},
9357+
},
93119358
"unstable__FluidTextArea" => Object {
93129359
"propTypes": Object {
93139360
"className": Object {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Code generated by @carbon/react. DO NOT EDIT.
2+
//
3+
// Copyright IBM Corp. 2018, 2018
4+
//
5+
// This source code is licensed under the Apache-2.0 license found in the
6+
// LICENSE file in the root directory of this source tree.
7+
//
8+
9+
@forward '@carbon/styles/scss/components/fluid-select/fluid-select';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Code generated by @carbon/react. DO NOT EDIT.
2+
//
3+
// Copyright IBM Corp. 2018, 2018
4+
//
5+
// This source code is licensed under the Apache-2.0 license found in the
6+
// LICENSE file in the root directory of this source tree.
7+
//
8+
9+
@forward '@carbon/styles/scss/components/fluid-select';

packages/react/src/__tests__/index-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ describe('Carbon Components React', () => {
231231
"unstable_TextDirection",
232232
"unstable__FluidDropdown",
233233
"unstable__FluidDropdownSkeleton",
234+
"unstable__FluidSelect",
235+
"unstable__FluidSelectSkeleton",
234236
"unstable__FluidTextArea",
235237
"unstable__FluidTextAreaSkeleton",
236238
"unstable__FluidTextInput",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright IBM Corp. 2022
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import PropTypes from 'prop-types';
9+
import React from 'react';
10+
import cx from 'classnames';
11+
import { usePrefix } from '../../internal/usePrefix';
12+
13+
const FluidSelectSkeleton = ({ className, ...rest }) => {
14+
const prefix = usePrefix();
15+
const wrapperClasses = cx(
16+
className,
17+
`${prefix}--skeleton`,
18+
`${prefix}--list-box`
19+
);
20+
21+
return (
22+
<div className={`${prefix}--list-box__wrapper--fluid`}>
23+
<div className={wrapperClasses} {...rest}>
24+
<span className={`${prefix}--list-box__label`} />
25+
<div className={`${prefix}--list-box__field`} />
26+
</div>
27+
</div>
28+
);
29+
};
30+
31+
FluidSelectSkeleton.propTypes = {
32+
/**
33+
* Specify an optional className to add.
34+
*/
35+
className: PropTypes.string,
36+
};
37+
38+
export default FluidSelectSkeleton;

0 commit comments

Comments
 (0)