Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/fuselage/src/components/InputBox/InputBox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ Default.args = {
onChange: action('change'),
};

export const Date: ComponentStory<typeof InputBox> = Template.bind({});
Date.args = {
defaultValue: 'Value',
onChange: action('change'),
type: 'date',
};

export const Time: ComponentStory<typeof InputBox> = Template.bind({});
Time.args = {
defaultValue: 'Value',
onChange: action('change'),
type: 'time',
};

export const WithAddon: ComponentStory<typeof InputBox> = Template.bind({});
WithAddon.args = {
addon: <Icon name='send' size='x20' />,
Expand Down
20 changes: 20 additions & 0 deletions packages/fuselage/src/components/InputBox/InputBox.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,26 @@
white-space: initial;
}

&--type-date,
&--type-time {
&::-webkit-inner-spin-button,
&::-webkit-calendar-picker-indicator {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;

width: auto;
height: auto;

cursor: pointer;

color: transparent;
background: transparent;
}
}

&--type-select {
@extend %--with-scrollbars;

Expand Down
8 changes: 8 additions & 0 deletions packages/fuselage/src/components/InputBox/InputBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, { forwardRef, useCallback, useLayoutEffect, useRef } from 'react';
import type { InputBoxSkeleton } from '.';
import { Input, Wrapper } from '.';
import type Box from '../Box';
import { Icon } from '../Icon';
import { Addon } from './Addon';
import type { Option } from './Option';
import type { Placeholder } from './Placeholder';
Expand Down Expand Up @@ -107,6 +108,13 @@ export const InputBox = forwardRef(function InputBox(
[addon, onChange]
);

if (type === 'date') {
addon = <Icon name='calendar' size='x20' />;
}
if (type === 'time') {
addon = <Icon name='clock' size='x20' />;
}

if (!addon) {
return (
<Input
Expand Down