Skip to content

Commit

Permalink
feat(FluidNumberInput): add FluidNumberInput variant (#12737)
Browse files Browse the repository at this point in the history
* feat(FluidNumberInput): scaffold out react files

* feat(FluidNumberInput): scaffold out sass files

* style(FluidNumberInput): add initial styles

* style(FluidNumberInput): add initial invalid styles

* style(FluidNumberInput): clean up invalid styles, add warning styles

* style(FluidNumberInput): clean up styles

* test(e2e): add e2e tests for FluidNumberInput

* Update packages/react/src/components/FluidNumberInput/FluidNumberInput.stories.js

Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com>

* chore(Fluid): add fluid skeletons as subcomponents in story files

* fix(FluidNumberInput): adjust label overflow

* style(NumberInput): change from mono code-01 to body-compact-01

* style(NumberInput): use IBM Plex Sans for number inputs

Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 13, 2022
1 parent 4f62459 commit 5426879
Show file tree
Hide file tree
Showing 45 changed files with 1,036 additions and 7 deletions.
37 changes: 37 additions & 0 deletions e2e/components/FluidNumberInput/FluidNumberInput-test.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const { expect, test } = require('@playwright/test');
const { themes } = require('../../test-utils/env');
const { snapshotStory, visitStory } = require('../../test-utils/storybook');

test.describe('FluidNumberInput', () => {
themes.forEach((theme) => {
test.describe(theme, () => {
test('fluid text input @vrt', async ({ page }) => {
await snapshotStory(page, {
component: 'FluidNumberInput',
id: 'experimental-unstable-fluidnumberinput--default',
theme,
});
});
});
});

test('accessibility-checker @avt', async ({ page }) => {
await visitStory(page, {
component: 'FluidNumberInput',
id: 'experimental-unstable-fluidnumberinput--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('FluidNumberInput');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components-react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-combo-box/fluid-combo-box';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components-react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-combo-box';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components-react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-multiselect/fluid-multiselect';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components-react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-multiselect';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components-react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-number-input/fluid-number-input';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components-react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-number-input';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-combo-box/fluid-combo-box';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-combo-box';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-multiselect/fluid-multiselect';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-multiselect';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-number-input/fluid-number-input';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by carbon-components. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-number-input';
94 changes: 94 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9826,6 +9826,100 @@ Map {
},
},
},
"unstable__FluidNumberInput" => Object {
"$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
"allowEmpty": Object {
"type": "bool",
},
"className": Object {
"type": "string",
},
"defaultValue": Object {
"args": Array [
Array [
Object {
"type": "number",
},
Object {
"type": "string",
},
],
],
"type": "oneOfType",
},
"disableWheel": Object {
"type": "bool",
},
"disabled": Object {
"type": "bool",
},
"iconDescription": Object {
"type": "string",
},
"id": Object {
"isRequired": true,
"type": "string",
},
"invalid": Object {
"type": "bool",
},
"invalidText": Object {
"type": "node",
},
"label": Object {
"type": "node",
},
"max": Object {
"type": "number",
},
"min": Object {
"type": "number",
},
"onChange": Object {
"type": "func",
},
"onClick": Object {
"type": "func",
},
"onKeyUp": Object {
"type": "func",
},
"step": Object {
"type": "number",
},
"translateWithId": Object {
"type": "func",
},
"value": Object {
"args": Array [
Array [
Object {
"type": "number",
},
Object {
"type": "string",
},
],
],
"type": "oneOfType",
},
"warn": Object {
"type": "bool",
},
"warnText": Object {
"type": "node",
},
},
"render": [Function],
},
"unstable__FluidNumberInputSkeleton" => Object {
"propTypes": Object {
"className": Object {
"type": "string",
},
},
},
"unstable__FluidSelect" => Object {
"$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by @carbon/react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-combo-box/fluid-combo-box';
9 changes: 9 additions & 0 deletions packages/react/scss/components/fluid-combo-box/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by @carbon/react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-combo-box';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by @carbon/react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-multiselect/fluid-multiselect';
9 changes: 9 additions & 0 deletions packages/react/scss/components/fluid-multiselect/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by @carbon/react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-multiselect';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by @carbon/react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-number-input/fluid-number-input';
9 changes: 9 additions & 0 deletions packages/react/scss/components/fluid-number-input/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by @carbon/react. DO NOT EDIT.
//
// Copyright IBM Corp. 2018, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@forward '@carbon/styles/scss/components/fluid-number-input';
2 changes: 2 additions & 0 deletions packages/react/src/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ describe('Carbon Components React', () => {
"unstable__FluidDropdownSkeleton",
"unstable__FluidMultiSelect",
"unstable__FluidMultiSelectSkeleton",
"unstable__FluidNumberInput",
"unstable__FluidNumberInputSkeleton",
"unstable__FluidSelect",
"unstable__FluidSelectSkeleton",
"unstable__FluidTextArea",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { Information } from '@carbon/icons-react';
export default {
title: 'Experimental/unstable__FluidComboBox',
component: FluidComboBox,
subcomponents: {
FluidComboBoxSkeleton,
},
};

const items = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { Information } from '@carbon/icons-react';
export default {
title: 'Experimental/unstable__FluidDatePicker',
component: FluidDatePicker,
subcomponents: {
FluidDatePickerSkeleton,
},
};

const ToggleTip = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { Information } from '@carbon/icons-react';
export default {
title: 'Experimental/unstable__FluidDropdown',
component: FluidDropdown,
subcomponents: {
FluidDropdownSkeleton,
},
};

const items = [
Expand Down
15 changes: 14 additions & 1 deletion packages/react/src/components/FluidForm/FluidForm.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import FluidTextInput from '../FluidTextInput';
import FluidTextArea from '../FluidTextArea';
import FluidTimePicker from '../FluidTimePicker';
import FluidTimePickerSelect from '../FluidTimePickerSelect';
import FluidNumberInput from '../FluidNumberInput';
import ModalWrapper from '../ModalWrapper';

const additionalProps = {
Expand Down Expand Up @@ -100,7 +101,19 @@ export const Default = () => (
</SelectItemGroup>
</FluidSelect>
</div>
<FluidTextInput {...TextInputProps} />
<div style={{ display: 'flex' }}>
<FluidTextInput {...TextInputProps} />
<FluidNumberInput
label="Number Input Label"
placeholder="Placeholder text"
id="input-default"
step={10}
min={0}
max={100}
defaultValue={50}
/>
</div>

<FluidTextInput
type="password"
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import { Information } from '@carbon/icons-react';
export default {
title: 'Experimental/unstable__FluidMultiSelect',
component: FluidMultiSelect,
subcomponents: {
FluidMultiSelectSkeleton,
},
};

const items = [
Expand Down
Loading

0 comments on commit 5426879

Please sign in to comment.