@pezeshk-book/modules 0.2.5 → 0.2.7
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/.eslintrc.json +133 -0
- package/calendar/calendar.props.ts +25 -0
- package/calendar/calendar.tsx +185 -0
- package/calendar/config/chunk.ts +42 -0
- package/calendar/config/create-date-range.ts +14 -0
- package/calendar/config/days-in-month.en.ts +47 -0
- package/calendar/config/days-in-month.fa.ts +37 -0
- package/calendar/config/index.ts +16 -0
- package/calendar/config/months.ts +29 -0
- package/calendar/config/week-day.ts +19 -0
- package/calendar/icons/arrow-left-icon.tsx +14 -0
- package/calendar/icons/arrow-right-icon.tsx +14 -0
- package/calendar/icons/index.ts +7 -0
- package/calendar/index.ts +3 -0
- package/calendar/shared/formatDate.tsx +12 -0
- package/calendar/sub-components/day/day.props.ts +27 -0
- package/calendar/sub-components/day/day.tsx +31 -0
- package/calendar/sub-components/days/days.props.ts +51 -0
- package/calendar/sub-components/days/days.tsx +142 -0
- package/calendar/sub-components/days-head/days-head.props.ts +27 -0
- package/calendar/sub-components/days-head/days-head.tsx +122 -0
- package/countdown-timer/countdown.props.ts +18 -0
- package/countdown-timer/countdown.tsx +79 -0
- package/countdown-timer/index.ts +3 -0
- package/data-table/data-table.props.ts +7 -0
- package/data-table/data-table.tsx +17 -0
- package/data-table/default/default-data-table.props.ts +47 -0
- package/data-table/default/default-data-table.tsx +427 -0
- package/data-table/default/index.ts +3 -0
- package/data-table/hooks/use-window-dimensions.tsx +33 -0
- package/data-table/icons/add.tsx +10 -0
- package/data-table/icons/arrow-down.tsx +11 -0
- package/data-table/icons/index.ts +9 -0
- package/data-table/icons/sort.tsx +16 -0
- package/data-table/index.ts +3 -0
- package/data-table/simple/index.ts +3 -0
- package/data-table/simple/simple-data-table.props.ts +23 -0
- package/data-table/simple/simple-data-table.tsx +258 -0
- package/dist/{modules/calendar → calendar}/calendar.js +1 -0
- package/dist/calendar/calendar.js.map +1 -0
- package/dist/calendar/calendar.props.js.map +1 -0
- package/dist/calendar/config/chunk.js.map +1 -0
- package/dist/calendar/config/create-date-range.js.map +1 -0
- package/dist/calendar/config/days-in-month.en.js.map +1 -0
- package/dist/calendar/config/days-in-month.fa.js.map +1 -0
- package/dist/calendar/config/index.js.map +1 -0
- package/dist/calendar/config/months.js.map +1 -0
- package/dist/calendar/config/week-day.js.map +1 -0
- package/dist/calendar/icons/arrow-left-icon.js.map +1 -0
- package/dist/calendar/icons/arrow-right-icon.js.map +1 -0
- package/dist/calendar/icons/index.js.map +1 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/calendar/shared/formatDate.js.map +1 -0
- package/dist/{modules/calendar → calendar}/sub-components/day/day.js +1 -1
- package/dist/calendar/sub-components/day/day.js.map +1 -0
- package/dist/calendar/sub-components/day/day.props.js.map +1 -0
- package/dist/calendar/sub-components/days/days.js.map +1 -0
- package/dist/calendar/sub-components/days/days.props.js.map +1 -0
- package/dist/{modules/calendar → calendar}/sub-components/days-head/days-head.js +2 -2
- package/dist/calendar/sub-components/days-head/days-head.js.map +1 -0
- package/dist/calendar/sub-components/days-head/days-head.props.js.map +1 -0
- package/dist/countdown-timer/countdown.js.map +1 -0
- package/dist/countdown-timer/countdown.props.js.map +1 -0
- package/dist/countdown-timer/index.js.map +1 -0
- package/dist/{modules/data-table → data-table}/data-table.js +1 -0
- package/dist/data-table/data-table.js.map +1 -0
- package/dist/data-table/data-table.props.js.map +1 -0
- package/dist/data-table/default/default-data-table.js.map +1 -0
- package/dist/data-table/default/default-data-table.props.js.map +1 -0
- package/dist/data-table/default/index.js.map +1 -0
- package/dist/data-table/hooks/use-window-dimensions.js.map +1 -0
- package/dist/data-table/icons/add.js.map +1 -0
- package/dist/data-table/icons/arrow-down.js.map +1 -0
- package/dist/data-table/icons/index.js.map +1 -0
- package/dist/data-table/icons/sort.js.map +1 -0
- package/dist/data-table/index.js.map +1 -0
- package/dist/data-table/simple/index.js.map +1 -0
- package/dist/data-table/simple/simple-data-table.js.map +1 -0
- package/dist/data-table/simple/simple-data-table.props.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/pagination/icons/arrow-Right.js.map +1 -0
- package/dist/pagination/icons/arrow-left.js.map +1 -0
- package/dist/pagination/icons/index.js.map +1 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/{modules/pagination → pagination}/pagination.js +1 -0
- package/dist/pagination/pagination.js.map +1 -0
- package/dist/pagination/pagination.props.js.map +1 -0
- package/dist/pagination/use-pagination.js.map +1 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/{modules/slider → slider}/slider.js +2 -1
- package/dist/slider/slider.js.map +1 -0
- package/dist/slider/slider.props.js.map +1 -0
- package/dist/stories/calendar/calendar.d.ts +1 -1
- package/dist/stories/calendar/calendar.js +1 -1
- package/dist/stories/calendar/calendar.js.map +1 -1
- package/dist/stories/count-down/count-down.d.ts +1 -1
- package/dist/stories/count-down/count-down.js +1 -1
- package/dist/stories/count-down/count-down.js.map +1 -1
- package/dist/stories/data-table/default-data-table.d.ts +1 -1
- package/dist/stories/data-table/default-data-table.js +1 -1
- package/dist/stories/data-table/default-data-table.js.map +1 -1
- package/dist/stories/data-table/simple-data-table.d.ts +1 -1
- package/dist/stories/data-table/simple-data-table.js +1 -1
- package/dist/stories/data-table/simple-data-table.js.map +1 -1
- package/dist/stories/pagination/pagination.d.ts +1 -1
- package/dist/stories/pagination/pagination.js +1 -1
- package/dist/stories/pagination/pagination.js.map +1 -1
- package/dist/stories/slider/slider.d.ts +1 -1
- package/dist/stories/slider/slider.js +1 -1
- package/dist/stories/slider/slider.js.map +1 -1
- package/index.ts +13 -0
- package/package.json +5 -10
- package/pagination/icons/arrow-Right.tsx +22 -0
- package/pagination/icons/arrow-left.tsx +22 -0
- package/pagination/icons/index.ts +7 -0
- package/pagination/index.ts +3 -0
- package/pagination/pagination.props.ts +33 -0
- package/pagination/pagination.tsx +135 -0
- package/pagination/use-pagination.ts +49 -0
- package/react-app-env.d.ts +1 -0
- package/slider/index.ts +3 -0
- package/slider/slider.props.ts +39 -0
- package/slider/slider.tsx +292 -0
- package/stories/calendar/calendar.stories.tsx +25 -0
- package/stories/calendar/calendar.tsx +11 -0
- package/stories/count-down/count-down.stories.tsx +19 -0
- package/stories/count-down/count-down.tsx +11 -0
- package/stories/data-table/data-table-columns.tsx +70 -0
- package/stories/data-table/default-data-table.stories.tsx +22 -0
- package/stories/data-table/default-data-table.tsx +18 -0
- package/stories/data-table/dummy-data.ts +204 -0
- package/stories/data-table/simple-data-table.stories.tsx +22 -0
- package/stories/data-table/simple-data-table.tsx +18 -0
- package/stories/pagination/pagination.stories.tsx +35 -0
- package/stories/pagination/pagination.tsx +11 -0
- package/stories/slider/slider.stories.tsx +19 -0
- package/stories/slider/slider.tsx +45 -0
- package/stories/wrapper.tsx +11 -0
- package/styles.css +28 -0
- package/utils/class-names.ts +5 -0
- package/utils/persian-to-english-number.ts +4 -0
- package/dist/modules/calendar/calendar.js.map +0 -1
- package/dist/modules/calendar/calendar.props.js.map +0 -1
- package/dist/modules/calendar/config/chunk.js.map +0 -1
- package/dist/modules/calendar/config/create-date-range.js.map +0 -1
- package/dist/modules/calendar/config/days-in-month.en.js.map +0 -1
- package/dist/modules/calendar/config/days-in-month.fa.js.map +0 -1
- package/dist/modules/calendar/config/index.js.map +0 -1
- package/dist/modules/calendar/config/months.js.map +0 -1
- package/dist/modules/calendar/config/week-day.js.map +0 -1
- package/dist/modules/calendar/icons/arrow-left-icon.js.map +0 -1
- package/dist/modules/calendar/icons/arrow-right-icon.js.map +0 -1
- package/dist/modules/calendar/icons/index.js.map +0 -1
- package/dist/modules/calendar/index.js.map +0 -1
- package/dist/modules/calendar/shared/formatDate.js.map +0 -1
- package/dist/modules/calendar/sub-components/day/day.js.map +0 -1
- package/dist/modules/calendar/sub-components/day/day.props.js.map +0 -1
- package/dist/modules/calendar/sub-components/days/days.js.map +0 -1
- package/dist/modules/calendar/sub-components/days/days.props.js.map +0 -1
- package/dist/modules/calendar/sub-components/days-head/days-head.js.map +0 -1
- package/dist/modules/calendar/sub-components/days-head/days-head.props.js.map +0 -1
- package/dist/modules/countdown-timer/countdown.js.map +0 -1
- package/dist/modules/countdown-timer/countdown.props.js.map +0 -1
- package/dist/modules/countdown-timer/index.js.map +0 -1
- package/dist/modules/data-table/data-table.js.map +0 -1
- package/dist/modules/data-table/data-table.props.js.map +0 -1
- package/dist/modules/data-table/default/default-data-table.js.map +0 -1
- package/dist/modules/data-table/default/default-data-table.props.js.map +0 -1
- package/dist/modules/data-table/default/index.js.map +0 -1
- package/dist/modules/data-table/hooks/use-window-dimensions.js.map +0 -1
- package/dist/modules/data-table/icons/add.js.map +0 -1
- package/dist/modules/data-table/icons/arrow-down.js.map +0 -1
- package/dist/modules/data-table/icons/index.js.map +0 -1
- package/dist/modules/data-table/icons/sort.js.map +0 -1
- package/dist/modules/data-table/index.js.map +0 -1
- package/dist/modules/data-table/simple/index.js.map +0 -1
- package/dist/modules/data-table/simple/simple-data-table.js.map +0 -1
- package/dist/modules/data-table/simple/simple-data-table.props.js.map +0 -1
- package/dist/modules/pagination/icons/arrow-Right.js.map +0 -1
- package/dist/modules/pagination/icons/arrow-left.js.map +0 -1
- package/dist/modules/pagination/icons/index.js.map +0 -1
- package/dist/modules/pagination/index.js.map +0 -1
- package/dist/modules/pagination/pagination.js.map +0 -1
- package/dist/modules/pagination/pagination.props.js.map +0 -1
- package/dist/modules/pagination/use-pagination.js.map +0 -1
- package/dist/modules/slider/index.js.map +0 -1
- package/dist/modules/slider/slider.js.map +0 -1
- package/dist/modules/slider/slider.props.js.map +0 -1
- /package/dist/{modules/calendar → calendar}/calendar.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/calendar.props.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/calendar.props.js +0 -0
- /package/dist/{modules/calendar → calendar}/config/chunk.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/config/chunk.js +0 -0
- /package/dist/{modules/calendar → calendar}/config/create-date-range.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/config/create-date-range.js +0 -0
- /package/dist/{modules/calendar → calendar}/config/days-in-month.en.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/config/days-in-month.en.js +0 -0
- /package/dist/{modules/calendar → calendar}/config/days-in-month.fa.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/config/days-in-month.fa.js +0 -0
- /package/dist/{modules/calendar → calendar}/config/index.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/config/index.js +0 -0
- /package/dist/{modules/calendar → calendar}/config/months.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/config/months.js +0 -0
- /package/dist/{modules/calendar → calendar}/config/week-day.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/config/week-day.js +0 -0
- /package/dist/{modules/calendar → calendar}/icons/arrow-left-icon.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/icons/arrow-left-icon.js +0 -0
- /package/dist/{modules/calendar → calendar}/icons/arrow-right-icon.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/icons/arrow-right-icon.js +0 -0
- /package/dist/{modules/calendar → calendar}/icons/index.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/icons/index.js +0 -0
- /package/dist/{modules/calendar → calendar}/index.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/index.js +0 -0
- /package/dist/{modules/calendar → calendar}/shared/formatDate.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/shared/formatDate.js +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/day/day.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/day/day.props.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/day/day.props.js +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/days/days.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/days/days.js +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/days/days.props.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/days/days.props.js +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/days-head/days-head.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/days-head/days-head.props.d.ts +0 -0
- /package/dist/{modules/calendar → calendar}/sub-components/days-head/days-head.props.js +0 -0
- /package/dist/{modules/countdown-timer → countdown-timer}/countdown.d.ts +0 -0
- /package/dist/{modules/countdown-timer → countdown-timer}/countdown.js +0 -0
- /package/dist/{modules/countdown-timer → countdown-timer}/countdown.props.d.ts +0 -0
- /package/dist/{modules/countdown-timer → countdown-timer}/countdown.props.js +0 -0
- /package/dist/{modules/countdown-timer → countdown-timer}/index.d.ts +0 -0
- /package/dist/{modules/countdown-timer → countdown-timer}/index.js +0 -0
- /package/dist/{modules/data-table → data-table}/data-table.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/data-table.props.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/data-table.props.js +0 -0
- /package/dist/{modules/data-table → data-table}/default/default-data-table.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/default/default-data-table.js +0 -0
- /package/dist/{modules/data-table → data-table}/default/default-data-table.props.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/default/default-data-table.props.js +0 -0
- /package/dist/{modules/data-table → data-table}/default/index.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/default/index.js +0 -0
- /package/dist/{modules/data-table → data-table}/hooks/use-window-dimensions.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/hooks/use-window-dimensions.js +0 -0
- /package/dist/{modules/data-table → data-table}/icons/add.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/icons/add.js +0 -0
- /package/dist/{modules/data-table → data-table}/icons/arrow-down.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/icons/arrow-down.js +0 -0
- /package/dist/{modules/data-table → data-table}/icons/index.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/icons/index.js +0 -0
- /package/dist/{modules/data-table → data-table}/icons/sort.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/icons/sort.js +0 -0
- /package/dist/{modules/data-table → data-table}/index.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/index.js +0 -0
- /package/dist/{modules/data-table → data-table}/simple/index.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/simple/index.js +0 -0
- /package/dist/{modules/data-table → data-table}/simple/simple-data-table.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/simple/simple-data-table.js +0 -0
- /package/dist/{modules/data-table → data-table}/simple/simple-data-table.props.d.ts +0 -0
- /package/dist/{modules/data-table → data-table}/simple/simple-data-table.props.js +0 -0
- /package/dist/{modules/pagination → pagination}/icons/arrow-Right.d.ts +0 -0
- /package/dist/{modules/pagination → pagination}/icons/arrow-Right.js +0 -0
- /package/dist/{modules/pagination → pagination}/icons/arrow-left.d.ts +0 -0
- /package/dist/{modules/pagination → pagination}/icons/arrow-left.js +0 -0
- /package/dist/{modules/pagination → pagination}/icons/index.d.ts +0 -0
- /package/dist/{modules/pagination → pagination}/icons/index.js +0 -0
- /package/dist/{modules/pagination → pagination}/index.d.ts +0 -0
- /package/dist/{modules/pagination → pagination}/index.js +0 -0
- /package/dist/{modules/pagination → pagination}/pagination.d.ts +0 -0
- /package/dist/{modules/pagination → pagination}/pagination.props.d.ts +0 -0
- /package/dist/{modules/pagination → pagination}/pagination.props.js +0 -0
- /package/dist/{modules/pagination → pagination}/use-pagination.d.ts +0 -0
- /package/dist/{modules/pagination → pagination}/use-pagination.js +0 -0
- /package/dist/{modules/slider → slider}/index.d.ts +0 -0
- /package/dist/{modules/slider → slider}/index.js +0 -0
- /package/dist/{modules/slider → slider}/slider.d.ts +0 -0
- /package/dist/{modules/slider → slider}/slider.props.d.ts +0 -0
- /package/dist/{modules/slider → slider}/slider.props.js +0 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { SliderProps } from './slider.props';
|
|
5
|
+
import { Div, Button } from '@pezeshk-book/ui-kit';
|
|
6
|
+
import classNames from '../utils/class-names';
|
|
7
|
+
|
|
8
|
+
const Slider = (
|
|
9
|
+
{
|
|
10
|
+
children,
|
|
11
|
+
delay = 2500,
|
|
12
|
+
spaceBetween = 0,
|
|
13
|
+
slides = 1,
|
|
14
|
+
infiniteLoop = false,
|
|
15
|
+
pauseOnMouseOver = false,
|
|
16
|
+
autoMove = true,
|
|
17
|
+
indicatorActiveColor = 'primary',
|
|
18
|
+
indicator = true,
|
|
19
|
+
navigation = true,
|
|
20
|
+
prevNavigation,
|
|
21
|
+
nextNavigation,
|
|
22
|
+
direction = 'rtl',
|
|
23
|
+
rows = 1,
|
|
24
|
+
navigationColor = 'primary',
|
|
25
|
+
tabletSlides = 1,
|
|
26
|
+
mobileSlides = 1,
|
|
27
|
+
indicatorClassName,
|
|
28
|
+
}: SliderProps) => {
|
|
29
|
+
const [showSlides, setShowSlides] = useState<number>(1);
|
|
30
|
+
const [currentIndex, setCurrentIndex] = React.useState(0);
|
|
31
|
+
const [length, setLength] = useState(Math.round(children.length / rows));
|
|
32
|
+
const [transitionEnabled, setTransitionEnabled] = useState(true);
|
|
33
|
+
const [touchPosition, setTouchPosition] = useState(null);
|
|
34
|
+
const [pause, setPause] = useState(false);
|
|
35
|
+
const [sliders, setSliders] = useState<any>([]);
|
|
36
|
+
|
|
37
|
+
const timeoutRef = React.useRef<any>(null);
|
|
38
|
+
const ref = React.useRef<any>(null);
|
|
39
|
+
|
|
40
|
+
const dir = React.useMemo(() => {
|
|
41
|
+
if (direction === 'rtl') {
|
|
42
|
+
return '+';
|
|
43
|
+
}
|
|
44
|
+
return '-';
|
|
45
|
+
}, [direction]);
|
|
46
|
+
const limit = React.useMemo(() => {
|
|
47
|
+
if (rows !== 1) {
|
|
48
|
+
return showSlides * rows >= children.length + 1;
|
|
49
|
+
}
|
|
50
|
+
return showSlides >= children.length;
|
|
51
|
+
}, [showSlides, rows, children]);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (window && window.screen) {
|
|
55
|
+
if (window.screen.width > 1024) {
|
|
56
|
+
setShowSlides(slides);
|
|
57
|
+
} else if (window.screen.width < 640) {
|
|
58
|
+
setShowSlides(mobileSlides);
|
|
59
|
+
} else { setShowSlides(tabletSlides); }
|
|
60
|
+
}
|
|
61
|
+
}, [slides, tabletSlides, mobileSlides]);
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
let final = [];
|
|
65
|
+
for (let i = 0; i < length; i++) {
|
|
66
|
+
let output = [];
|
|
67
|
+
for (let index = i * rows; index < rows * (i + 1); index++) {
|
|
68
|
+
output.push(children[index]);
|
|
69
|
+
}
|
|
70
|
+
final.push(output);
|
|
71
|
+
}
|
|
72
|
+
setSliders(final);
|
|
73
|
+
}, [children, length, rows]);
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
setLength(Math.round(children.length / rows));
|
|
77
|
+
}, [children, infiniteLoop, showSlides]);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (currentIndex === length - 1 || currentIndex === 0) {
|
|
81
|
+
setTransitionEnabled(true);
|
|
82
|
+
}
|
|
83
|
+
}, [currentIndex, showSlides, length]);
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!pause && autoMove) {
|
|
87
|
+
resetTimeout();
|
|
88
|
+
timeoutRef.current = setTimeout(
|
|
89
|
+
() => next(), delay,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return () => {
|
|
93
|
+
resetTimeout();
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}, [currentIndex, delay, pause]);
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (ref.current) {
|
|
100
|
+
for (const arg of ref.current.children) {
|
|
101
|
+
arg.style.width = `calc((100% / ${showSlides}) - (${spaceBetween}px))`;
|
|
102
|
+
arg.style.gap = `${spaceBetween}px`;
|
|
103
|
+
arg.style.marginLeft = `${spaceBetween / 2}px`;
|
|
104
|
+
arg.style.marginRight = `${spaceBetween / 2}px`;
|
|
105
|
+
arg.style.flexShrink = 0;
|
|
106
|
+
arg.style.flexGrow = 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, [showSlides, spaceBetween]);
|
|
110
|
+
|
|
111
|
+
const resetTimeout = () => {
|
|
112
|
+
if (timeoutRef.current) {
|
|
113
|
+
clearTimeout(timeoutRef.current);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const next = () => {
|
|
118
|
+
if ((currentIndex < (length - showSlides) + 1) && currentIndex !== length) {
|
|
119
|
+
setCurrentIndex(prevState => prevState + 1);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const prev = () => {
|
|
124
|
+
if ((currentIndex > 0) && currentIndex !== showSlides) {
|
|
125
|
+
setCurrentIndex(prevState => prevState - 1);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handleTouchStart = (e: any) => {
|
|
130
|
+
const touchDown = e.touches[0].clientX;
|
|
131
|
+
setTouchPosition(touchDown);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const handleTouchMove = (e: any) => {
|
|
135
|
+
const touchDown = touchPosition;
|
|
136
|
+
|
|
137
|
+
if (touchDown === null) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const currentTouch = e.touches[0].clientX;
|
|
142
|
+
const diff = touchDown - currentTouch;
|
|
143
|
+
|
|
144
|
+
if (diff > 5) {
|
|
145
|
+
next();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (diff < -5) {
|
|
149
|
+
prev();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
setTouchPosition(null);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const handleTransitionEnd = () => {
|
|
156
|
+
if (currentIndex === length - showSlides) {
|
|
157
|
+
setTimeout(
|
|
158
|
+
() => {
|
|
159
|
+
setTransitionEnabled(false);
|
|
160
|
+
setCurrentIndex(0);
|
|
161
|
+
}, delay / 2,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const handlePauseAutoMove = (state: boolean) => {
|
|
167
|
+
if (pauseOnMouseOver) {
|
|
168
|
+
setPause(state);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<Div dir={direction} className={'w-full flex-col'} onMouseOver={() => handlePauseAutoMove(true)} onMouseLeave={() => handlePauseAutoMove(false)}>
|
|
174
|
+
<Div className={'w-full relative'}>
|
|
175
|
+
{navigation && !limit ? (
|
|
176
|
+
<Button ariaLabel={'previousNavigation'} startAdornment={<ArrowIcon className={'rotate-180'}/>} disabled={direction === 'rtl' ? currentIndex === length - showSlides : currentIndex === 0} onClick={direction === 'rtl' ? next : prev} color={navigationColor} rounded={'full'} shape={'square'} className={'absolute flex self-center items-center justify-center z-10 left-2'}/>
|
|
177
|
+
) : null}
|
|
178
|
+
{prevNavigation && currentIndex > 0 ? (
|
|
179
|
+
<>
|
|
180
|
+
{prevNavigation(prev)}
|
|
181
|
+
</>
|
|
182
|
+
) : null}
|
|
183
|
+
{limit ? (
|
|
184
|
+
<div ref={ref} className={'flex shrink-0 grow w-full'}>
|
|
185
|
+
{sliders.map((item: any, itemIndex: number) => (
|
|
186
|
+
<Div className={'flex-col w-1/2'} key={itemIndex}>
|
|
187
|
+
{item}
|
|
188
|
+
</Div>
|
|
189
|
+
))}
|
|
190
|
+
</div>
|
|
191
|
+
) : (
|
|
192
|
+
<div className={'overflow-hidden w-full h-full'}
|
|
193
|
+
onTouchStart={handleTouchStart}
|
|
194
|
+
onTouchMove={handleTouchMove}
|
|
195
|
+
>
|
|
196
|
+
<div className={`flex transition ease-linear duration-300 shrink-0 grow w-full`}
|
|
197
|
+
style={{
|
|
198
|
+
transform: `translateX(${dir}${currentIndex * (100 / showSlides)}%)`,
|
|
199
|
+
transition: !transitionEnabled ? 'none' : undefined,
|
|
200
|
+
}}
|
|
201
|
+
onTransitionEnd={handleTransitionEnd}
|
|
202
|
+
ref={ref}
|
|
203
|
+
>
|
|
204
|
+
{sliders.map((item: any, itemIndex: number) => (
|
|
205
|
+
<Div className={'flex-col w-full shrink-0'} key={itemIndex}>
|
|
206
|
+
{item}
|
|
207
|
+
</Div>
|
|
208
|
+
))}
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
)}
|
|
212
|
+
{navigation && !limit ? (
|
|
213
|
+
<Button ariaLabel={'nextNavigation'} startAdornment={<ArrowIcon/>} color={navigationColor} disabled={direction === 'rtl' ? currentIndex === 0 : currentIndex === length - showSlides} onClick={direction === 'rtl' ? prev : next} rounded={'full'} shape={'square'} className={'absolute flex self-center items-center justify-center right-2'}/>
|
|
214
|
+
) : null}
|
|
215
|
+
{nextNavigation && currentIndex < length ? (
|
|
216
|
+
<>
|
|
217
|
+
{nextNavigation(next)}
|
|
218
|
+
</>
|
|
219
|
+
) : null}
|
|
220
|
+
</Div>
|
|
221
|
+
{indicator && !limit ? (
|
|
222
|
+
<Div className={'self-center items-center justify-center'}>
|
|
223
|
+
{children.length > 1 ? (
|
|
224
|
+
<div className={`flex w-[96px] justify-start gap-x-1 mt-20 pr-11 overflow-hidden ${indicatorClassName}`}>
|
|
225
|
+
{[...new Array(length - showSlides + 1)].map((_: any, idx: number) => {
|
|
226
|
+
return (
|
|
227
|
+
<Div
|
|
228
|
+
style={{
|
|
229
|
+
transform: `translateX(${dir}${currentIndex * (130)}%)`,
|
|
230
|
+
transition: !transitionEnabled ? 'none' : undefined,
|
|
231
|
+
}}
|
|
232
|
+
key={idx}
|
|
233
|
+
className={classNames(
|
|
234
|
+
'w-4 h-4 min-h-4 min-w-4 rounded-full mb-0 transition-all duration-500 justify-center items-center',
|
|
235
|
+
currentIndex === idx ? `bg-${indicatorActiveColor}` : 'bg-transparent',
|
|
236
|
+
)}
|
|
237
|
+
onClick={() => {
|
|
238
|
+
setCurrentIndex(idx);
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
<Div className={classNames(
|
|
242
|
+
currentIndex === idx ? `bg-${indicatorActiveColor}` : 'bg-grey-100',
|
|
243
|
+
`rounded-full transition-all duration-500 justify-center items-center`,
|
|
244
|
+
BulletWidth(Math.abs(4 - Math.abs(currentIndex - idx))),
|
|
245
|
+
)}
|
|
246
|
+
/>
|
|
247
|
+
</Div>
|
|
248
|
+
);
|
|
249
|
+
})}
|
|
250
|
+
</div>
|
|
251
|
+
) : null}
|
|
252
|
+
</Div>
|
|
253
|
+
) : null}
|
|
254
|
+
</Div>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const ArrowIcon = ({ className }: { className?: string }) => {
|
|
259
|
+
return (
|
|
260
|
+
<svg
|
|
261
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
262
|
+
width="256"
|
|
263
|
+
height="256"
|
|
264
|
+
viewBox="0 0 256 256"
|
|
265
|
+
fill={'currentColor'}
|
|
266
|
+
className={`h-3 w-3 ${className}`}
|
|
267
|
+
>
|
|
268
|
+
<path
|
|
269
|
+
fill={'currentColor'}
|
|
270
|
+
strokeMiterlimit="10"
|
|
271
|
+
strokeWidth="0"
|
|
272
|
+
d="M24.64 90L20.36 85.72 61.08 45 20.36 4.28 24.64 0 69.64 45z"
|
|
273
|
+
transform="matrix(2.81 0 0 2.81 1.407 1.407)"
|
|
274
|
+
/>
|
|
275
|
+
</svg>
|
|
276
|
+
);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export default Slider;
|
|
280
|
+
|
|
281
|
+
const BulletWidth = (w: any) => {
|
|
282
|
+
switch (w) {
|
|
283
|
+
case 4:
|
|
284
|
+
return '!w-4 !h-4 !min-w-4 !min-h-4';
|
|
285
|
+
case 3:
|
|
286
|
+
return '!w-3 !h-3 !min-w-3 !min-h-3';
|
|
287
|
+
case 2:
|
|
288
|
+
return '!w-2 !h-2 !min-w-2 !min-h-2';
|
|
289
|
+
default:
|
|
290
|
+
return 'w-0 h-0';
|
|
291
|
+
}
|
|
292
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { Calendar } from './calendar';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Calendar> = {
|
|
6
|
+
title: 'Calendar',
|
|
7
|
+
component: Calendar,
|
|
8
|
+
argTypes: {
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof Calendar>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: (args) => {
|
|
17
|
+
const [selectedDate, setSelectedDate] = useState<string>('');
|
|
18
|
+
|
|
19
|
+
const handleChange = (e: any) => {
|
|
20
|
+
setSelectedDate(e.jalaliDate);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return <Calendar {...args} selected={selectedDate} onChange={handleChange} />;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CustomCalendar from '../../calendar';
|
|
2
|
+
import { CalendarProps } from '../../calendar/calendar.props';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Primary UI component for user interaction
|
|
6
|
+
*/
|
|
7
|
+
export const Calendar = ({ ...props }: CalendarProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<CustomCalendar {...props}/>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CountDown } from './count-down';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof CountDown> = {
|
|
5
|
+
title: 'CountDownTimer',
|
|
6
|
+
component: CountDown,
|
|
7
|
+
argTypes: {
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof CountDown>;
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: (args) => {
|
|
16
|
+
return <CountDown {...args} />;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CustomCountDown from '../../countdown-timer';
|
|
2
|
+
import { CountdownProps } from '../../countdown-timer/countdown.props';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Primary UI component for user interaction
|
|
6
|
+
*/
|
|
7
|
+
export const CountDown = ({ ...props }: CountdownProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<CustomCountDown {...props} />
|
|
10
|
+
);
|
|
11
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { Chip, Text } from '@pezeshk-book/ui-kit';
|
|
3
|
+
|
|
4
|
+
export const header = {
|
|
5
|
+
id: 'ID',
|
|
6
|
+
category_id: 'categoryId',
|
|
7
|
+
title: 'Title',
|
|
8
|
+
code: 'Code',
|
|
9
|
+
environment: 'Environment',
|
|
10
|
+
type: 'Type',
|
|
11
|
+
status: 'Status',
|
|
12
|
+
created_at: 'CreatedAt',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const columns: ColumnDef<any>[] = [
|
|
16
|
+
{
|
|
17
|
+
id: 'id',
|
|
18
|
+
accessorKey: 'id',
|
|
19
|
+
header: header.id,
|
|
20
|
+
cell: info => <Text typography={'sm'}>{info.row.original.id || '-'}</Text>,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'category_id',
|
|
24
|
+
accessorKey: 'category_id',
|
|
25
|
+
header: header.category_id,
|
|
26
|
+
cell: info => <Text typography={'sm'}>{info.row.original.category_id || '-'}</Text>,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'title',
|
|
30
|
+
accessorKey: 'title',
|
|
31
|
+
header: header.title,
|
|
32
|
+
cell: info => <Text typography={'sm'}>{info.row.original.title || '-'}</Text>,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'code',
|
|
36
|
+
accessorKey: 'code',
|
|
37
|
+
header: header.code,
|
|
38
|
+
cell: info => <Text typography={'sm'}>{info.row.original.code || '-'}</Text>,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'environment',
|
|
42
|
+
accessorKey: 'environment',
|
|
43
|
+
header: header.environment,
|
|
44
|
+
cell: info => {
|
|
45
|
+
return <Text typography={'sm'} >{info.row.original.environment || '-'}</Text>;
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'type',
|
|
50
|
+
accessorKey: 'type',
|
|
51
|
+
header: header.type,
|
|
52
|
+
cell: info => {
|
|
53
|
+
return <Chip size={'small'} variant={'reverse'} color={info.row.original.type === 'Hardware' ? 'info' : 'secondary'} value={info.row.original.type}/>;
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'status',
|
|
58
|
+
accessorKey: 'status',
|
|
59
|
+
header: header.status,
|
|
60
|
+
cell: info => {
|
|
61
|
+
return <Chip size={'small'} variant={'reverse'} color={info.row.original.status === 'Active' ? 'green' : 'red'} value={info.row.original.status}/>;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'created_at',
|
|
66
|
+
accessorKey: 'created_at',
|
|
67
|
+
header: header.created_at,
|
|
68
|
+
cell: info => <Text typography={'sm'}>{info.row.original.created_at}</Text>,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { DefaultDataTableProps } from '../../data-table/default/default-data-table.props';
|
|
3
|
+
import { DefaultDataTable } from './default-data-table';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof DefaultDataTable> = {
|
|
6
|
+
title: 'DataTable',
|
|
7
|
+
component: DefaultDataTable,
|
|
8
|
+
argTypes: {
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof DefaultDataTable>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: (args : { variant: 'default' } & DefaultDataTableProps) => {
|
|
17
|
+
return <DefaultDataTable {...args} />;
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
variant: 'default',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import CustomDataTable from '../../data-table';
|
|
2
|
+
import dummyData from './dummy-data';
|
|
3
|
+
import { columns, header } from './data-table-columns';
|
|
4
|
+
import { DefaultDataTableProps } from '../../data-table/default/default-data-table.props';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Primary UI component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
export const DefaultDataTable = (props: { variant: 'default' } & DefaultDataTableProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<CustomDataTable
|
|
12
|
+
{...props}
|
|
13
|
+
data={dummyData}
|
|
14
|
+
header={header}
|
|
15
|
+
column={columns}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
const dummyData = [
|
|
2
|
+
{
|
|
3
|
+
id: 1,
|
|
4
|
+
category_id: 101,
|
|
5
|
+
title: 'Item One',
|
|
6
|
+
code: 'X123A',
|
|
7
|
+
environment: 'Production',
|
|
8
|
+
type: 'Hardware',
|
|
9
|
+
status: 'Active',
|
|
10
|
+
created_at: '2024-02-01T10:15:30Z',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 2,
|
|
14
|
+
category_id: 102,
|
|
15
|
+
title: 'Item Two',
|
|
16
|
+
code: 'Y456B',
|
|
17
|
+
environment: 'Staging',
|
|
18
|
+
type: 'Software',
|
|
19
|
+
status: 'Inactive',
|
|
20
|
+
created_at: '2024-01-25T09:00:00Z',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 3,
|
|
24
|
+
category_id: 103,
|
|
25
|
+
title: 'Item Three',
|
|
26
|
+
code: 'Z789C',
|
|
27
|
+
environment: 'Development',
|
|
28
|
+
type: 'Network',
|
|
29
|
+
status: 'Pending',
|
|
30
|
+
created_at: '2024-02-10T14:30:15Z',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 4,
|
|
34
|
+
category_id: 101,
|
|
35
|
+
title: 'Item Four',
|
|
36
|
+
code: 'A111D',
|
|
37
|
+
environment: 'Production',
|
|
38
|
+
type: 'Hardware',
|
|
39
|
+
status: 'Active',
|
|
40
|
+
created_at: '2024-02-12T12:45:00Z',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 5,
|
|
44
|
+
category_id: 102,
|
|
45
|
+
title: 'Item Five',
|
|
46
|
+
code: 'B222E',
|
|
47
|
+
environment: 'Staging',
|
|
48
|
+
type: 'Software',
|
|
49
|
+
status: 'Inactive',
|
|
50
|
+
created_at: '2024-02-15T08:20:45Z',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 6,
|
|
54
|
+
category_id: 103,
|
|
55
|
+
title: 'Item Six',
|
|
56
|
+
code: 'C333F',
|
|
57
|
+
environment: 'Development',
|
|
58
|
+
type: 'Network',
|
|
59
|
+
status: 'Pending',
|
|
60
|
+
created_at: '2024-02-18T16:10:30Z',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 7,
|
|
64
|
+
category_id: 104,
|
|
65
|
+
title: 'Item Seven',
|
|
66
|
+
code: 'D444G',
|
|
67
|
+
environment: 'Production',
|
|
68
|
+
type: 'Hardware',
|
|
69
|
+
status: 'Active',
|
|
70
|
+
created_at: '2024-02-20T11:05:00Z',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 8,
|
|
74
|
+
category_id: 105,
|
|
75
|
+
title: 'Item Eight',
|
|
76
|
+
code: 'E555H',
|
|
77
|
+
environment: 'Staging',
|
|
78
|
+
type: 'Software',
|
|
79
|
+
status: 'Inactive',
|
|
80
|
+
created_at: '2024-02-22T14:50:25Z',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 9,
|
|
84
|
+
category_id: 106,
|
|
85
|
+
title: 'Item Nine',
|
|
86
|
+
code: 'F666I',
|
|
87
|
+
environment: 'Development',
|
|
88
|
+
type: 'Network',
|
|
89
|
+
status: 'Pending',
|
|
90
|
+
created_at: '2024-02-24T09:30:15Z',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 10,
|
|
94
|
+
category_id: 107,
|
|
95
|
+
title: 'Item Ten',
|
|
96
|
+
code: 'G777J',
|
|
97
|
+
environment: 'Production',
|
|
98
|
+
type: 'Hardware',
|
|
99
|
+
status: 'Active',
|
|
100
|
+
created_at: '2024-02-26T13:25:45Z',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 11,
|
|
104
|
+
category_id: 108,
|
|
105
|
+
title: 'Item Eleven',
|
|
106
|
+
code: 'H888K',
|
|
107
|
+
environment: 'Staging',
|
|
108
|
+
type: 'Software',
|
|
109
|
+
status: 'Inactive',
|
|
110
|
+
created_at: '2024-02-28T10:40:30Z',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 12,
|
|
114
|
+
category_id: 109,
|
|
115
|
+
title: 'Item Twelve',
|
|
116
|
+
code: 'I999L',
|
|
117
|
+
environment: 'Development',
|
|
118
|
+
type: 'Network',
|
|
119
|
+
status: 'Pending',
|
|
120
|
+
created_at: '2024-03-01T15:55:00Z',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: 13,
|
|
124
|
+
category_id: 110,
|
|
125
|
+
title: 'Item Thirteen',
|
|
126
|
+
code: 'J000M',
|
|
127
|
+
environment: 'Production',
|
|
128
|
+
type: 'Hardware',
|
|
129
|
+
status: 'Active',
|
|
130
|
+
created_at: '2024-03-03T08:10:45Z',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 14,
|
|
134
|
+
category_id: 111,
|
|
135
|
+
title: 'Item Fourteen',
|
|
136
|
+
code: 'K111N',
|
|
137
|
+
environment: 'Staging',
|
|
138
|
+
type: 'Software',
|
|
139
|
+
status: 'Inactive',
|
|
140
|
+
created_at: '2024-03-05T12:20:30Z',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 15,
|
|
144
|
+
category_id: 112,
|
|
145
|
+
title: 'Item Fifteen',
|
|
146
|
+
code: 'L222O',
|
|
147
|
+
environment: 'Development',
|
|
148
|
+
type: 'Network',
|
|
149
|
+
status: 'Pending',
|
|
150
|
+
created_at: '2024-03-07T14:45:15Z',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 16,
|
|
154
|
+
category_id: 113,
|
|
155
|
+
title: 'Item Sixteen',
|
|
156
|
+
code: 'M333P',
|
|
157
|
+
environment: 'Production',
|
|
158
|
+
type: 'Hardware',
|
|
159
|
+
status: 'Active',
|
|
160
|
+
created_at: '2024-03-09T09:30:00Z',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: 17,
|
|
164
|
+
category_id: 114,
|
|
165
|
+
title: 'Item Seventeen',
|
|
166
|
+
code: 'N444Q',
|
|
167
|
+
environment: 'Staging',
|
|
168
|
+
type: 'Software',
|
|
169
|
+
status: 'Inactive',
|
|
170
|
+
created_at: '2024-03-11T11:50:45Z',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: 18,
|
|
174
|
+
category_id: 115,
|
|
175
|
+
title: 'Item Eighteen',
|
|
176
|
+
code: 'O555R',
|
|
177
|
+
environment: 'Development',
|
|
178
|
+
type: 'Network',
|
|
179
|
+
status: 'Pending',
|
|
180
|
+
created_at: '2024-03-13T16:40:30Z',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 19,
|
|
184
|
+
category_id: 116,
|
|
185
|
+
title: 'Item Nineteen',
|
|
186
|
+
code: 'P666S',
|
|
187
|
+
environment: 'Production',
|
|
188
|
+
type: 'Hardware',
|
|
189
|
+
status: 'Active',
|
|
190
|
+
created_at: '2024-03-15T10:05:15Z',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: 20,
|
|
194
|
+
category_id: 117,
|
|
195
|
+
title: 'Item Twenty',
|
|
196
|
+
code: 'Q777T',
|
|
197
|
+
environment: 'Staging',
|
|
198
|
+
type: 'Software',
|
|
199
|
+
status: 'Inactive',
|
|
200
|
+
created_at: '2024-03-17T14:15:00Z',
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
export default dummyData;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SimpleDataTable } from './simple-data-table';
|
|
3
|
+
import { SimpleDataTableProps } from '../../data-table/simple/simple-data-table.props';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof SimpleDataTable> = {
|
|
6
|
+
title: 'DataTable',
|
|
7
|
+
component: SimpleDataTable,
|
|
8
|
+
argTypes: {
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof SimpleDataTable>;
|
|
14
|
+
|
|
15
|
+
export const Simple: Story = {
|
|
16
|
+
render: (args : {variant: 'simple'} & SimpleDataTableProps) => {
|
|
17
|
+
return <SimpleDataTable {...args} />;
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
variant: 'simple',
|
|
21
|
+
},
|
|
22
|
+
};
|