Skip to content

Commit

Permalink
Merge branch 'master' into chore/remove-vendor-folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan authored Mar 3, 2020
2 parents 08eefa5 + 3c69251 commit 62f5a26
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 3 deletions.
55 changes: 55 additions & 0 deletions packages/components/docs/sass.md
Original file line number Diff line number Diff line change
Expand Up @@ -16068,6 +16068,15 @@ Date picker styles
}
}

// Size variant styles
.#{$prefix}--date-picker__input--xl {
height: rem(48px);
}

.#{$prefix}--date-picker__input--sm {
height: rem(32px);
}

.#{$prefix}--date-picker__icon {
position: absolute;
right: 1rem;
Expand Down Expand Up @@ -19550,6 +19559,7 @@ Number input styles
cursor: not-allowed;
background-color: $disabled-background-color;
color: $disabled;
border-bottom-color: transparent;
}

.#{$prefix}--number__input-wrapper {
Expand Down Expand Up @@ -19698,6 +19708,51 @@ Number input styles
}
}

// Size Variant styles
.#{$prefix}--number--xl input[type='number'] {
height: rem(48px);
}

.#{$prefix}--number--xl .#{$prefix}--number__control-btn {
height: rem(24px);
}

.#{$prefix}--number--xl.#{$prefix}--number--mobile
.#{$prefix}--number__control-btn {
height: rem(48px);
width: rem(48px);
}

.#{$prefix}--number--xl .#{$prefix}--number__control-btn.up-icon svg {
top: rem(6.6px); // Needed to maintain arrow spacing between input sizes.
}

.#{$prefix}--number--xl .#{$prefix}--number__control-btn.down-icon svg {
top: rem(-6.6px); // Needed to maintain arrow spacing between input sizes.
}

.#{$prefix}--number--sm input[type='number'] {
height: rem(32px);
}

.#{$prefix}--number--sm .#{$prefix}--number__control-btn {
height: rem(16px);
}

.#{$prefix}--number--sm.#{$prefix}--number--mobile
.#{$prefix}--number__control-btn {
height: rem(32px);
width: rem(32px);
}

.#{$prefix}--number--sm .#{$prefix}--number__control-btn.up-icon svg {
top: rem(3.4px); // Needed to maintain arrow spacing between input sizes.
}

.#{$prefix}--number--sm .#{$prefix}--number__control-btn.down-icon svg {
top: rem(-3.4px); // Needed to maintain arrow spacing between input sizes.
}

//No label positioning adjustment
.#{$prefix}--number--nolabel .bx--label + .bx--form__helper-text {
margin-top: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@
}
}

// Size variant styles
.#{$prefix}--date-picker__input--xl {
height: rem(48px);
}

.#{$prefix}--date-picker__input--sm {
height: rem(32px);
}

.#{$prefix}--date-picker__icon {
position: absolute;
right: 1rem;
Expand Down
46 changes: 46 additions & 0 deletions packages/components/src/components/number-input/_number-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
cursor: not-allowed;
background-color: $disabled-background-color;
color: $disabled;
border-bottom-color: transparent;
}

.#{$prefix}--number__input-wrapper {
Expand Down Expand Up @@ -220,6 +221,51 @@
}
}

// Size Variant styles
.#{$prefix}--number--xl input[type='number'] {
height: rem(48px);
}

.#{$prefix}--number--xl .#{$prefix}--number__control-btn {
height: rem(24px);
}

.#{$prefix}--number--xl.#{$prefix}--number--mobile
.#{$prefix}--number__control-btn {
height: rem(48px);
width: rem(48px);
}

.#{$prefix}--number--xl .#{$prefix}--number__control-btn.up-icon svg {
top: rem(6.6px); // Needed to maintain arrow spacing between input sizes.
}

.#{$prefix}--number--xl .#{$prefix}--number__control-btn.down-icon svg {
top: rem(-6.6px); // Needed to maintain arrow spacing between input sizes.
}

.#{$prefix}--number--sm input[type='number'] {
height: rem(32px);
}

.#{$prefix}--number--sm .#{$prefix}--number__control-btn {
height: rem(16px);
}

.#{$prefix}--number--sm.#{$prefix}--number--mobile
.#{$prefix}--number__control-btn {
height: rem(32px);
width: rem(32px);
}

.#{$prefix}--number--sm .#{$prefix}--number__control-btn.up-icon svg {
top: rem(3.4px); // Needed to maintain arrow spacing between input sizes.
}

.#{$prefix}--number--sm .#{$prefix}--number__control-btn.down-icon svg {
top: rem(-3.4px); // Needed to maintain arrow spacing between input sizes.
}

//No label positioning adjustment
.#{$prefix}--number--nolabel .bx--label + .bx--form__helper-text {
margin-top: 0;
Expand Down
7 changes: 7 additions & 0 deletions packages/react/src/components/DatePicker/DatePicker-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ const patterns = {
'Regular (d{1,2}/d{1,2}/d{4})': '\\d{1,2}/\\d{1,2}/\\d{4}',
};

const sizes = {
'Extra large size (xl)': 'xl',
'Default size': undefined,
'Small size (sm)': 'sm',
};

const props = {
datePicker: () => ({
id: 'date-picker',
Expand All @@ -36,6 +42,7 @@ const props = {
datePickerInput: () => ({
id: 'date-picker-input-id',
className: 'some-class',
size: select('Field size (size)', sizes, undefined) || undefined,
labelText: text(
'Label text (labelText in <DatePickerInput>)',
'Date Picker label'
Expand Down
14 changes: 12 additions & 2 deletions packages/react/src/components/DatePickerInput/DatePickerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export default class DatePickerInput extends Component {
*/
labelText: PropTypes.node.isRequired,

/**
* Specify the size of the Date Picker Input. Currently supports either `sm` or `xl` as an option.
*/
size: PropTypes.oneOf(['sm', 'xl']),

/**
* Provide a regular expression that the input value must match
*/
Expand Down Expand Up @@ -99,6 +104,7 @@ export default class DatePickerInput extends Component {
pattern,
iconDescription,
openCalendar,
size,
...other
} = this.props;

Expand All @@ -124,6 +130,10 @@ export default class DatePickerInput extends Component {
[`${prefix}--label--disabled`]: disabled,
});

const inputClasses = classNames(`${prefix}--date-picker__input`, {
[`${prefix}--date-picker__input--${size}`]: size,
});

const datePickerIcon = (() => {
if (datePickerType === 'simple') {
return;
Expand Down Expand Up @@ -162,7 +172,7 @@ export default class DatePickerInput extends Component {
this.input = input;
}}
data-invalid
className={`${prefix}--date-picker__input`}
className={inputClasses}
/>
) : (
<input
Expand All @@ -172,7 +182,7 @@ export default class DatePickerInput extends Component {
{...other}
{...datePickerInputProps}
disabled={disabled}
className={`${prefix}--date-picker__input`}
className={inputClasses}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ import {
number,
text,
object,
select,
} from '@storybook/addon-knobs';
import NumberInput from '../NumberInput';
import NumberInputSkeleton from '../NumberInput/NumberInput.Skeleton';

const sizes = {
'Extra large size (xl)': 'xl',
'Default size': undefined,
'Small size (sm)': 'sm',
};

const props = () => ({
className: 'some-class',
id: 'tj-input',
Expand All @@ -28,6 +35,7 @@ const props = () => ({
max: number('Maximum value (max)', 100),
value: number('Value (value)', 50),
step: number('Step of up/down arrow (step)', 10),
size: select('Field size (size)', sizes, undefined) || undefined,
disabled: boolean('Disabled (disabled)', false),
readOnly: boolean('Read only (readOnly)', false),
invalid: boolean('Show form validation UI (invalid)', false),
Expand Down
8 changes: 7 additions & 1 deletion packages/react/src/components/NumberInput/NumberInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ class NumberInput extends Component {
* `true` to use the mobile variant.
*/
isMobile: PropTypes.bool,
/**
* Specify the size of the Number Input. Currently supports either `sm` or `xl` as an option.
*/
size: PropTypes.oneOf(['sm', 'xl']),
};

static defaultProps = {
Expand Down Expand Up @@ -176,7 +180,7 @@ class NumberInput extends Component {
}

/**
* The DOM node refernce to the `<input>`.
* The DOM node reference to the `<input>`.
* @type {HTMLInputElement}
*/
_inputRef = null;
Expand Down Expand Up @@ -281,6 +285,7 @@ class NumberInput extends Component {
innerRef: ref,
translateWithId: t,
isMobile,
size,
...other
} = this.props;

Expand All @@ -292,6 +297,7 @@ class NumberInput extends Component {
[`${prefix}--number--light`]: light,
[`${prefix}--number--nolabel`]: hideLabel,
[`${prefix}--number--mobile`]: isMobile,
[`${prefix}--number--${size}`]: size,
}
);

Expand Down

0 comments on commit 62f5a26

Please sign in to comment.