@k3-universe/react-kit 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1303 -75
- package/dist/kit/builder/form/components/FormBuilder.d.ts +5 -1
- package/dist/kit/builder/form/components/FormBuilder.d.ts.map +1 -1
- package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DateTimePickerField.d.ts +4 -0
- package/dist/kit/builder/form/components/fields/DateTimePickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/DateTimeRangePickerField.d.ts +4 -0
- package/dist/kit/builder/form/components/fields/DateTimeRangePickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/TimePickerField.d.ts +4 -0
- package/dist/kit/builder/form/components/fields/TimePickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/TimeRangePickerField.d.ts +4 -0
- package/dist/kit/builder/form/components/fields/TimeRangePickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/index.d.ts +4 -0
- package/dist/kit/builder/form/components/fields/index.d.ts.map +1 -1
- package/dist/kit/components/datetimepicker/DateTimePicker.d.ts +32 -0
- package/dist/kit/components/datetimepicker/DateTimePicker.d.ts.map +1 -0
- package/dist/kit/components/datetimepicker/DateTimeRangePicker.d.ts +39 -0
- package/dist/kit/components/datetimepicker/DateTimeRangePicker.d.ts.map +1 -0
- package/dist/kit/components/datetimepicker/index.d.ts +5 -0
- package/dist/kit/components/datetimepicker/index.d.ts.map +1 -0
- package/dist/kit/components/timepicker/TimePicker.d.ts +26 -0
- package/dist/kit/components/timepicker/TimePicker.d.ts.map +1 -0
- package/dist/kit/components/timepicker/TimeRangePicker.d.ts +31 -0
- package/dist/kit/components/timepicker/TimeRangePicker.d.ts.map +1 -0
- package/dist/kit/components/timepicker/index.d.ts +5 -0
- package/dist/kit/components/timepicker/index.d.ts.map +1 -0
- package/dist/kit/themes/clean-slate.css +16 -0
- package/dist/kit/themes/default.css +16 -0
- package/dist/kit/themes/minimal-modern.css +16 -0
- package/dist/kit/themes/spotify.css +16 -0
- package/package.json +1 -1
- package/src/kit/builder/form/components/FormBuilder.tsx +17 -0
- package/src/kit/builder/form/components/FormBuilderField.tsx +48 -0
- package/src/kit/builder/form/components/fields/DateTimePickerField.tsx +33 -0
- package/src/kit/builder/form/components/fields/DateTimeRangePickerField.tsx +42 -0
- package/src/kit/builder/form/components/fields/TimePickerField.tsx +30 -0
- package/src/kit/builder/form/components/fields/TimeRangePickerField.tsx +37 -0
- package/src/kit/builder/form/components/fields/index.ts +4 -0
- package/src/kit/components/datetimepicker/DateTimePicker.tsx +314 -0
- package/src/kit/components/datetimepicker/DateTimeRangePicker.tsx +486 -0
- package/src/kit/components/datetimepicker/index.ts +3 -0
- package/src/kit/components/timepicker/TimePicker.tsx +311 -0
- package/src/kit/components/timepicker/TimeRangePicker.tsx +291 -0
- package/src/kit/components/timepicker/index.ts +3 -0
- package/src/stories/kit/builder/Form.DateTime.stories.tsx +66 -0
- package/src/stories/kit/builder/Form.Time.stories.tsx +64 -0
- package/src/stories/kit/components/TimePicker.stories.tsx +69 -0
- package/src/stories/kit/components/TimeRangePicker.stories.tsx +37 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { FormBuilder, type FormBuilderProps } from '../../../kit/builder/form/components/FormBuilder'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FormBuilder> = {
|
|
5
|
+
title: 'Kit/Builder/Form (Time)',
|
|
6
|
+
component: FormBuilder,
|
|
7
|
+
parameters: {
|
|
8
|
+
controls: { expanded: true },
|
|
9
|
+
backgrounds: { disable: true },
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof FormBuilder>
|
|
16
|
+
|
|
17
|
+
export const TimeFields: Story = {
|
|
18
|
+
name: 'Time fields (12/24h, precision)',
|
|
19
|
+
args: {
|
|
20
|
+
sections: [
|
|
21
|
+
{
|
|
22
|
+
title: 'Time',
|
|
23
|
+
description: 'TimePicker fields with different precisions and hour cycles',
|
|
24
|
+
variant: 'card',
|
|
25
|
+
layout: 'grid',
|
|
26
|
+
grid: { cols: 1, mdCols: 2, gap: 'gap-4' },
|
|
27
|
+
fields: [
|
|
28
|
+
{
|
|
29
|
+
name: 'time24h',
|
|
30
|
+
label: 'Time (24h HH:mm)',
|
|
31
|
+
type: 'time',
|
|
32
|
+
timePrecision: 'minute',
|
|
33
|
+
hourCycle: 24,
|
|
34
|
+
minuteStep: 5,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'time12h',
|
|
38
|
+
label: 'Time (12h hour only)',
|
|
39
|
+
type: 'time',
|
|
40
|
+
timePrecision: 'hour',
|
|
41
|
+
hourCycle: 12,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'timeWithSeconds',
|
|
45
|
+
label: 'Time (24h HH:mm:ss)',
|
|
46
|
+
type: 'time',
|
|
47
|
+
timePrecision: 'second',
|
|
48
|
+
hourCycle: 24,
|
|
49
|
+
secondStep: 10,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
onSubmit: (data: unknown) => {
|
|
55
|
+
console.log('Submit (time):', data)
|
|
56
|
+
},
|
|
57
|
+
showActions: true,
|
|
58
|
+
} satisfies Partial<FormBuilderProps>,
|
|
59
|
+
render: (args) => (
|
|
60
|
+
<div className="max-w-4xl mx-auto p-6">
|
|
61
|
+
<FormBuilder {...(args as FormBuilderProps)} />
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { TimePicker } from '../../../kit/components/timepicker/TimePicker'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof TimePicker> = {
|
|
6
|
+
title: 'Kit/Components/TimePicker',
|
|
7
|
+
component: TimePicker,
|
|
8
|
+
parameters: {
|
|
9
|
+
controls: { expanded: true },
|
|
10
|
+
backgrounds: { disable: true },
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof TimePicker>
|
|
17
|
+
|
|
18
|
+
export const Basic: Story = {
|
|
19
|
+
name: 'Basic (HH:mm, 24h)',
|
|
20
|
+
args: {
|
|
21
|
+
precision: 'minute',
|
|
22
|
+
hourCycle: 24,
|
|
23
|
+
},
|
|
24
|
+
render: (args) => {
|
|
25
|
+
const [value, setValue] = React.useState<Date | null>(new Date())
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className="p-6 space-y-4">
|
|
29
|
+
<div>
|
|
30
|
+
<div className="text-sm text-muted-foreground">Selected</div>
|
|
31
|
+
<div className="font-medium">{value?.toLocaleTimeString?.() ?? '—'}</div>
|
|
32
|
+
</div>
|
|
33
|
+
<TimePicker {...args} value={value} onChange={setValue} />
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const HourOnly12h: Story = {
|
|
40
|
+
name: 'Hour only (12h)',
|
|
41
|
+
args: {
|
|
42
|
+
precision: 'hour',
|
|
43
|
+
hourCycle: 12,
|
|
44
|
+
},
|
|
45
|
+
render: (args) => {
|
|
46
|
+
const [value, setValue] = React.useState<Date | null>(new Date())
|
|
47
|
+
return (
|
|
48
|
+
<div className="p-6 space-y-4">
|
|
49
|
+
<TimePicker {...args} value={value} onChange={setValue} />
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const WithSeconds: Story = {
|
|
56
|
+
name: 'With seconds (HH:mm:ss, 24h)',
|
|
57
|
+
args: {
|
|
58
|
+
precision: 'second',
|
|
59
|
+
hourCycle: 24,
|
|
60
|
+
},
|
|
61
|
+
render: (args) => {
|
|
62
|
+
const [value, setValue] = React.useState<Date | null>(new Date())
|
|
63
|
+
return (
|
|
64
|
+
<div className="p-6 space-y-4">
|
|
65
|
+
<TimePicker {...args} value={value} onChange={setValue} />
|
|
66
|
+
</div>
|
|
67
|
+
)
|
|
68
|
+
},
|
|
69
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { TimeRangePicker } from '../../../kit/components/timepicker/TimeRangePicker'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof TimeRangePicker> = {
|
|
6
|
+
title: 'Kit/Components/TimeRangePicker',
|
|
7
|
+
component: TimeRangePicker,
|
|
8
|
+
parameters: {
|
|
9
|
+
controls: { expanded: true },
|
|
10
|
+
backgrounds: { disable: true },
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof TimeRangePicker>
|
|
17
|
+
|
|
18
|
+
export const Basic: Story = {
|
|
19
|
+
name: 'Basic (HH:mm – HH:mm, 24h)',
|
|
20
|
+
args: {
|
|
21
|
+
precision: 'minute',
|
|
22
|
+
hourCycle: 24,
|
|
23
|
+
},
|
|
24
|
+
render: (args) => {
|
|
25
|
+
const [value, setValue] = React.useState<{ from?: Date | null; to?: Date | null } | null>({
|
|
26
|
+
from: new Date(),
|
|
27
|
+
to: new Date(new Date().getTime() + 60 * 60 * 1000),
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className="p-6 space-y-4">
|
|
32
|
+
<TimeRangePicker {...args} value={value} onChange={setValue} />
|
|
33
|
+
<div className="text-xs text-muted-foreground">Value: {value?.from?.toLocaleTimeString?.()} – {value?.to?.toLocaleTimeString?.()}</div>
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
}
|