Skip to content

Commit be258b2

Browse files
committed
feat: introduces a date-time-picker component
1 parent 7afd540 commit be258b2

12 files changed

+1824
-29
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"peerDependencies": {
9393
"@vueuse/core": ">13.0.0",
9494
"@vueuse/shared": ">13.0.0",
95+
"dayjs": ">=1.11.13 <12",
9596
"vue": ">=3.5.0"
9697
},
9798
"web-types": "dist/web-types.json",

pnpm-lock.yaml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { type ComponentMountingOptions, mount } from '@vue/test-utils';
2+
import { describe, expect, it } from 'vitest';
3+
import RuiDateTimePicker from './RuiDateTimePicker.vue';
4+
5+
function createWrapper(options: ComponentMountingOptions<typeof RuiDateTimePicker>) {
6+
return mount(RuiDateTimePicker, { ...options });
7+
}
8+
9+
describe('date-time-picker/RuiDateTimePicker', () => {
10+
it('renders properly', () => {
11+
const wrapper = createWrapper({});
12+
13+
expect(wrapper.exists()).toBeTruthy();
14+
});
15+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import type { Meta, StoryFn, StoryObj } from '@storybook/vue3';
2+
import { TimeAccuracy } from '@/consts/time-accuracy';
3+
import RuiDateTimePicker from './RuiDateTimePicker.vue';
4+
5+
const render: StoryFn<typeof RuiDateTimePicker> = args => ({
6+
components: { RuiDateTimePicker },
7+
setup() {
8+
return { args };
9+
},
10+
template: `<RuiDateTimePicker v-bind="args" />`,
11+
});
12+
13+
const meta: Meta<typeof RuiDateTimePicker> = {
14+
argTypes: {
15+
'accuracy': {
16+
control: 'select',
17+
options: [TimeAccuracy.SECOND, TimeAccuracy.MINUTE, TimeAccuracy.MILLISECOND],
18+
table: {
19+
defaultValue: {
20+
summary: TimeAccuracy.MINUTE,
21+
},
22+
},
23+
},
24+
'modelValue': {
25+
control: 'date',
26+
},
27+
'onUpdate:modelValue': {
28+
action: 'update:modelValue',
29+
},
30+
},
31+
component: RuiDateTimePicker,
32+
render,
33+
tags: ['autodocs'],
34+
title: 'Components/DateTimePicker',
35+
};
36+
37+
type Story = StoryObj<typeof RuiDateTimePicker>;
38+
39+
export const Default: Story = {
40+
args: {
41+
modelValue: new Date(),
42+
},
43+
};
44+
45+
export const Outlined: Story = {
46+
args: {
47+
accuracy: TimeAccuracy.SECOND,
48+
modelValue: new Date(),
49+
variant: 'outlined',
50+
},
51+
};
52+
53+
export default meta;

0 commit comments

Comments
 (0)