@dgshahr/ui-kit 0.0.5 → 0.0.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/dist/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/Accordion/index.cjs +1 -11
- package/dist/Accordion/index.js +5 -1
- package/dist/AccordionItem-eMnIUJ1V.cjs +1 -0
- package/dist/AccordionItem-tKSPLNKs.js +91 -0
- package/dist/Alert/index.cjs +1 -242
- package/dist/Alert/index.d.ts.map +1 -1
- package/dist/Alert/index.js +141 -144
- package/dist/ArrowLeft2-B76dkC-C.cjs +1 -0
- package/dist/{ArrowLeft2-BURhvXT2.js → ArrowLeft2-jP2w1vwt.js} +7 -7
- package/dist/ArrowRight2-CYowPzS8.cjs +1 -0
- package/dist/{ArrowRight2-DCxJPvNC.js → ArrowRight2-CcHdxGRE.js} +7 -7
- package/dist/Badge/index.cjs +1 -72
- package/dist/Badge/index.d.ts.map +1 -1
- package/dist/Badge/index.js +46 -52
- package/dist/Breadcrumb/index.cjs +1 -34
- package/dist/Breadcrumb/index.d.ts.map +1 -1
- package/dist/Breadcrumb/index.js +39 -30
- package/dist/Button/index.cjs +1 -119
- package/dist/Button/index.d.ts.map +1 -1
- package/dist/Button/index.js +97 -104
- package/dist/Button/variants.d.ts.map +1 -1
- package/dist/Divider/index.cjs +1 -25
- package/dist/Divider/index.js +12 -16
- package/dist/Form/Checkbox/index.cjs +1 -72
- package/dist/Form/Checkbox/index.js +22 -26
- package/dist/Form/Input/index.cjs +1 -182
- package/dist/Form/Input/index.d.ts.map +1 -1
- package/dist/Form/Input/index.js +63 -71
- package/dist/Form/RadioButton/index.cjs +1 -22
- package/dist/Form/RadioButton/index.js +13 -13
- package/dist/Form/Textarea/index.cjs +1 -27
- package/dist/Form/Textarea/index.d.ts.map +1 -1
- package/dist/Form/Textarea/index.js +19 -19
- package/dist/Form/Wrappers/SelectableInputWrapper/SelectableInputWrapper.d.ts.map +1 -1
- package/dist/Pagination/index.cjs +1 -119
- package/dist/Pagination/index.d.ts.map +1 -1
- package/dist/Pagination/index.js +96 -107
- package/dist/SelectableInputWrapper-B3ylMTsl.js +76 -0
- package/dist/SelectableInputWrapper-C9x3IShC.cjs +1 -0
- package/dist/Slide-C506y48c.js +233 -0
- package/dist/Slide-Zmb0vKbn.cjs +1 -0
- package/dist/Slider/Navigation.d.ts +9 -0
- package/dist/Slider/Navigation.d.ts.map +1 -0
- package/dist/Slider/NavigationDot.d.ts +0 -3
- package/dist/Slider/NavigationDot.d.ts.map +1 -1
- package/dist/Slider/Slider.d.ts +2 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/context.d.ts +3 -7
- package/dist/Slider/context.d.ts.map +1 -1
- package/dist/Slider/index.cjs +1 -11
- package/dist/Slider/index.js +5 -1
- package/dist/TextFieldWrapper-Cg4f8_zY.js +151 -0
- package/dist/TextFieldWrapper-Ci0-vx4J.cjs +1 -0
- package/dist/assets/Button.css +1 -1681
- package/dist/assets/styles.css +1 -1617
- package/dist/clsx-C11secjj.cjs +1 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/index.cjs +1 -34
- package/dist/index.js +28 -12
- package/package.json +5 -4
- package/dist/AccordionItem-DN7bi5kw.js +0 -103
- package/dist/AccordionItem-lq6ehxKe.cjs +0 -106
- package/dist/ArrowLeft2-iZ0Au6Fn.cjs +0 -24
- package/dist/ArrowRight2-DTuru_sP.cjs +0 -27
- package/dist/SelectableInputWrapper-D2aYQb9J.cjs +0 -71
- package/dist/SelectableInputWrapper-DAj8v1nv.js +0 -69
- package/dist/Slide-BDD1_RXD.js +0 -215
- package/dist/Slide-Q5_7SCZR.cjs +0 -218
- package/dist/TextFieldWrapper--hxpmYuz.js +0 -167
- package/dist/TextFieldWrapper-DaoZxs1E.cjs +0 -169
- package/dist/clsx-BtxeOLZW.cjs +0 -5
- package/dist/clsx-ChV9xqsO.js +0 -3
package/dist/Slide-BDD1_RXD.js
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { c as clsx } from './clsx-ChV9xqsO.js';
|
|
3
|
-
import { createContext, useContext, useState, useEffect, useRef, Children } from 'react';
|
|
4
|
-
import { A as ArrowLeft2Icon } from './ArrowLeft2-BURhvXT2.js';
|
|
5
|
-
import { A as ArrowRight2Icon } from './ArrowRight2-DCxJPvNC.js';
|
|
6
|
-
import Button from './Button/index.js';
|
|
7
|
-
|
|
8
|
-
const sliderContext = createContext({
|
|
9
|
-
slidesPerView: 1,
|
|
10
|
-
spaceBetween: 0
|
|
11
|
-
});
|
|
12
|
-
const useSliderContext = () => useContext(sliderContext);
|
|
13
|
-
|
|
14
|
-
function styleNavigationDot({ active, autoplay, variant }) {
|
|
15
|
-
const variantClassName = {
|
|
16
|
-
inside: "bg-gray-500/50 hover:bg-gray-500/80",
|
|
17
|
-
outside: "bg-gray-200 hover:bg-gray-300"
|
|
18
|
-
};
|
|
19
|
-
return [variantClassName[variant], active ? "w-[22px]" : "w-[6px]", autoplay ? "p-[1px]" : ""];
|
|
20
|
-
}
|
|
21
|
-
const NavigationDot = (props) => {
|
|
22
|
-
const { active, autoplay, variant, onClick, onNavigateToNext } = props;
|
|
23
|
-
const [fillPercentage, setFillPercentage] = useState(0);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (!active || !autoplay) return;
|
|
26
|
-
const autoplayTime = typeof autoplay === "boolean" ? 7e3 : autoplay?.delay ?? 7e3;
|
|
27
|
-
let startTime = Date.now();
|
|
28
|
-
const autoplayInterval = setInterval(() => {
|
|
29
|
-
const elapsed = Date.now() - startTime;
|
|
30
|
-
const percentage = elapsed / autoplayTime * 100;
|
|
31
|
-
setFillPercentage(Math.min(percentage, 100));
|
|
32
|
-
if (elapsed >= autoplayTime && typeof onNavigateToNext === "function") {
|
|
33
|
-
onNavigateToNext();
|
|
34
|
-
}
|
|
35
|
-
}, 100);
|
|
36
|
-
return function cleanup() {
|
|
37
|
-
setFillPercentage(0);
|
|
38
|
-
startTime = Date.now();
|
|
39
|
-
return clearInterval(autoplayInterval);
|
|
40
|
-
};
|
|
41
|
-
}, [active, autoplay, onNavigateToNext]);
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
-
"button",
|
|
44
|
-
{
|
|
45
|
-
className: clsx(
|
|
46
|
-
"rounded-full overflow-hidden transition-all h-[6px]",
|
|
47
|
-
styleNavigationDot({ active, autoplay, variant })
|
|
48
|
-
),
|
|
49
|
-
onClick,
|
|
50
|
-
children: active && /* @__PURE__ */ jsx(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
className: clsx("h-full rounded-full", {
|
|
54
|
-
"bg-white": variant === "inside",
|
|
55
|
-
"bg-gray-700": variant === "outside"
|
|
56
|
-
}),
|
|
57
|
-
style: { width: autoplay ? `${fillPercentage}%` : "100%" }
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const Slider = (props) => {
|
|
65
|
-
const {
|
|
66
|
-
className = "",
|
|
67
|
-
containerClassName = "",
|
|
68
|
-
showNavigationDots = true,
|
|
69
|
-
dotsClassName = "",
|
|
70
|
-
slidesPerView = 1,
|
|
71
|
-
autoplay,
|
|
72
|
-
navigationButtonsShowType = "hide",
|
|
73
|
-
spaceBetween = 0,
|
|
74
|
-
navigationVariant = "outside",
|
|
75
|
-
showPaginationText = false
|
|
76
|
-
} = props;
|
|
77
|
-
const [slideIndex, setSlideIndex] = useState(0);
|
|
78
|
-
const containerRef = useRef(null);
|
|
79
|
-
const childsCount = Children.count(props.children);
|
|
80
|
-
const slidesCount = Math.ceil(childsCount / slidesPerView);
|
|
81
|
-
const haveNavigation = showNavigationDots || navigationButtonsShowType && navigationButtonsShowType !== "hide" || showPaginationText;
|
|
82
|
-
function detectCarouselPosition(e) {
|
|
83
|
-
const itemsWidth = e.currentTarget.scrollWidth / slidesCount;
|
|
84
|
-
const position = (e.currentTarget.scrollWidth - e.currentTarget.scrollLeft) / itemsWidth;
|
|
85
|
-
setSlideIndex(Math.round(position % slidesCount));
|
|
86
|
-
}
|
|
87
|
-
function navigate(target) {
|
|
88
|
-
if (!containerRef.current) return;
|
|
89
|
-
const slideWidth = containerRef.current.offsetWidth;
|
|
90
|
-
let nextSlideScroll = -(slideWidth * target);
|
|
91
|
-
if (target < 0) nextSlideScroll = -(slideWidth * slidesCount);
|
|
92
|
-
else if (target >= slidesCount) nextSlideScroll = 0;
|
|
93
|
-
containerRef.current.scrollTo({
|
|
94
|
-
left: nextSlideScroll,
|
|
95
|
-
behavior: "smooth"
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return /* @__PURE__ */ jsxs(
|
|
99
|
-
"div",
|
|
100
|
-
{
|
|
101
|
-
className: clsx("overflow-hidden relative group", className),
|
|
102
|
-
style: { direction: "rtl" },
|
|
103
|
-
children: [
|
|
104
|
-
/* @__PURE__ */ jsx(
|
|
105
|
-
"div",
|
|
106
|
-
{
|
|
107
|
-
className: clsx(
|
|
108
|
-
"flex snap-x snap-mandatory overflow-x-auto no-scrollbar",
|
|
109
|
-
containerClassName
|
|
110
|
-
),
|
|
111
|
-
style: { marginLeft: -spaceBetween },
|
|
112
|
-
onScroll: detectCarouselPosition,
|
|
113
|
-
ref: containerRef,
|
|
114
|
-
children: /* @__PURE__ */ jsx(sliderContext.Provider, { value: { slidesPerView, spaceBetween }, children: props.children })
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
haveNavigation && /* @__PURE__ */ jsxs(
|
|
118
|
-
"div",
|
|
119
|
-
{
|
|
120
|
-
className: clsx("flex", {
|
|
121
|
-
"items-center mt-2": navigationVariant === "outside",
|
|
122
|
-
"absolute bottom-4 w-full justify-center": navigationVariant === "inside",
|
|
123
|
-
"justify-between": navigationVariant === "outside" && navigationButtonsShowType !== "hide",
|
|
124
|
-
"justify-center": navigationVariant === "outside" && navigationButtonsShowType === "hide"
|
|
125
|
-
}),
|
|
126
|
-
children: [
|
|
127
|
-
navigationButtonsShowType && navigationButtonsShowType !== "hide" && /* @__PURE__ */ jsxs(
|
|
128
|
-
"div",
|
|
129
|
-
{
|
|
130
|
-
className: clsx("flex gap-2", {
|
|
131
|
-
"absolute bottom-0 left-[5.5%]": navigationVariant === "inside",
|
|
132
|
-
"opacity-0 group-hover:opacity-100 transition": navigationButtonsShowType === "hover"
|
|
133
|
-
}),
|
|
134
|
-
children: [
|
|
135
|
-
/* @__PURE__ */ jsx(
|
|
136
|
-
Button,
|
|
137
|
-
{
|
|
138
|
-
type: "button",
|
|
139
|
-
variant: "secondary",
|
|
140
|
-
onClick: () => navigate(slideIndex - 1),
|
|
141
|
-
rightIcon: /* @__PURE__ */ jsx(ArrowRight2Icon, {})
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
/* @__PURE__ */ jsx(
|
|
145
|
-
Button,
|
|
146
|
-
{
|
|
147
|
-
type: "button",
|
|
148
|
-
variant: "secondary",
|
|
149
|
-
onClick: () => navigate(slideIndex + 1),
|
|
150
|
-
rightIcon: /* @__PURE__ */ jsx(ArrowLeft2Icon, {})
|
|
151
|
-
}
|
|
152
|
-
)
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
(showNavigationDots || showPaginationText) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
157
|
-
showPaginationText && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 font-caption-regular text-gray-400 ss02", children: [
|
|
158
|
-
/* @__PURE__ */ jsx(
|
|
159
|
-
"span",
|
|
160
|
-
{
|
|
161
|
-
className: clsx("font-bold", {
|
|
162
|
-
"text-gray-600": navigationVariant === "outside",
|
|
163
|
-
"text-white": navigationVariant === "inside"
|
|
164
|
-
}),
|
|
165
|
-
children: slideIndex + 1
|
|
166
|
-
}
|
|
167
|
-
),
|
|
168
|
-
/* @__PURE__ */ jsx("span", { children: "از" }),
|
|
169
|
-
/* @__PURE__ */ jsx("span", { children: slidesCount })
|
|
170
|
-
] }),
|
|
171
|
-
showNavigationDots && /* @__PURE__ */ jsx("div", { className: clsx("flex items-center justify-center gap-2", dotsClassName), children: Array.from(Array(slidesCount).keys()).map((item, index) => /* @__PURE__ */ jsx(
|
|
172
|
-
NavigationDot,
|
|
173
|
-
{
|
|
174
|
-
active: slideIndex === index,
|
|
175
|
-
autoplay: autoplay ?? false,
|
|
176
|
-
variant: navigationVariant,
|
|
177
|
-
onClick: () => navigate(index),
|
|
178
|
-
onNavigateToNext: () => navigate(slideIndex + 1)
|
|
179
|
-
},
|
|
180
|
-
item + slidesCount
|
|
181
|
-
)) })
|
|
182
|
-
] })
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const Slide = (props) => {
|
|
192
|
-
const { children, className } = props;
|
|
193
|
-
const { slidesPerView, spaceBetween } = useSliderContext();
|
|
194
|
-
const ref = useRef(null);
|
|
195
|
-
const [childIndex, setChildIndex] = useState(0);
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
if (!ref.current) return;
|
|
198
|
-
setChildIndex(Array.prototype.indexOf.call(ref.current.parentNode?.children, ref.current));
|
|
199
|
-
}, [ref]);
|
|
200
|
-
return /* @__PURE__ */ jsx(
|
|
201
|
-
"div",
|
|
202
|
-
{
|
|
203
|
-
ref,
|
|
204
|
-
className: clsx("shrink-0 snap-always", className),
|
|
205
|
-
style: {
|
|
206
|
-
width: 100 / (slidesPerView ?? 1) + "%",
|
|
207
|
-
paddingLeft: spaceBetween,
|
|
208
|
-
scrollSnapAlign: childIndex % slidesPerView === 0 ? "start" : "none"
|
|
209
|
-
},
|
|
210
|
-
children
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
export { Slider as S, Slide as a };
|
package/dist/Slide-Q5_7SCZR.cjs
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
const clsx = require('./clsx-BtxeOLZW.cjs');
|
|
5
|
-
const react = require('react');
|
|
6
|
-
const ArrowLeft2 = require('./ArrowLeft2-iZ0Au6Fn.cjs');
|
|
7
|
-
const ArrowRight2 = require('./ArrowRight2-DTuru_sP.cjs');
|
|
8
|
-
const Button = require('./Button/index.cjs');
|
|
9
|
-
|
|
10
|
-
const sliderContext = react.createContext({
|
|
11
|
-
slidesPerView: 1,
|
|
12
|
-
spaceBetween: 0
|
|
13
|
-
});
|
|
14
|
-
const useSliderContext = () => react.useContext(sliderContext);
|
|
15
|
-
|
|
16
|
-
function styleNavigationDot({ active, autoplay, variant }) {
|
|
17
|
-
const variantClassName = {
|
|
18
|
-
inside: "bg-gray-500/50 hover:bg-gray-500/80",
|
|
19
|
-
outside: "bg-gray-200 hover:bg-gray-300"
|
|
20
|
-
};
|
|
21
|
-
return [variantClassName[variant], active ? "w-[22px]" : "w-[6px]", autoplay ? "p-[1px]" : ""];
|
|
22
|
-
}
|
|
23
|
-
const NavigationDot = (props) => {
|
|
24
|
-
const { active, autoplay, variant, onClick, onNavigateToNext } = props;
|
|
25
|
-
const [fillPercentage, setFillPercentage] = react.useState(0);
|
|
26
|
-
react.useEffect(() => {
|
|
27
|
-
if (!active || !autoplay) return;
|
|
28
|
-
const autoplayTime = typeof autoplay === "boolean" ? 7e3 : autoplay?.delay ?? 7e3;
|
|
29
|
-
let startTime = Date.now();
|
|
30
|
-
const autoplayInterval = setInterval(() => {
|
|
31
|
-
const elapsed = Date.now() - startTime;
|
|
32
|
-
const percentage = elapsed / autoplayTime * 100;
|
|
33
|
-
setFillPercentage(Math.min(percentage, 100));
|
|
34
|
-
if (elapsed >= autoplayTime && typeof onNavigateToNext === "function") {
|
|
35
|
-
onNavigateToNext();
|
|
36
|
-
}
|
|
37
|
-
}, 100);
|
|
38
|
-
return function cleanup() {
|
|
39
|
-
setFillPercentage(0);
|
|
40
|
-
startTime = Date.now();
|
|
41
|
-
return clearInterval(autoplayInterval);
|
|
42
|
-
};
|
|
43
|
-
}, [active, autoplay, onNavigateToNext]);
|
|
44
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
-
"button",
|
|
46
|
-
{
|
|
47
|
-
className: clsx.clsx(
|
|
48
|
-
"rounded-full overflow-hidden transition-all h-[6px]",
|
|
49
|
-
styleNavigationDot({ active, autoplay, variant })
|
|
50
|
-
),
|
|
51
|
-
onClick,
|
|
52
|
-
children: active && /* @__PURE__ */ jsxRuntime.jsx(
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
className: clsx.clsx("h-full rounded-full", {
|
|
56
|
-
"bg-white": variant === "inside",
|
|
57
|
-
"bg-gray-700": variant === "outside"
|
|
58
|
-
}),
|
|
59
|
-
style: { width: autoplay ? `${fillPercentage}%` : "100%" }
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const Slider = (props) => {
|
|
67
|
-
const {
|
|
68
|
-
className = "",
|
|
69
|
-
containerClassName = "",
|
|
70
|
-
showNavigationDots = true,
|
|
71
|
-
dotsClassName = "",
|
|
72
|
-
slidesPerView = 1,
|
|
73
|
-
autoplay,
|
|
74
|
-
navigationButtonsShowType = "hide",
|
|
75
|
-
spaceBetween = 0,
|
|
76
|
-
navigationVariant = "outside",
|
|
77
|
-
showPaginationText = false
|
|
78
|
-
} = props;
|
|
79
|
-
const [slideIndex, setSlideIndex] = react.useState(0);
|
|
80
|
-
const containerRef = react.useRef(null);
|
|
81
|
-
const childsCount = react.Children.count(props.children);
|
|
82
|
-
const slidesCount = Math.ceil(childsCount / slidesPerView);
|
|
83
|
-
const haveNavigation = showNavigationDots || navigationButtonsShowType && navigationButtonsShowType !== "hide" || showPaginationText;
|
|
84
|
-
function detectCarouselPosition(e) {
|
|
85
|
-
const itemsWidth = e.currentTarget.scrollWidth / slidesCount;
|
|
86
|
-
const position = (e.currentTarget.scrollWidth - e.currentTarget.scrollLeft) / itemsWidth;
|
|
87
|
-
setSlideIndex(Math.round(position % slidesCount));
|
|
88
|
-
}
|
|
89
|
-
function navigate(target) {
|
|
90
|
-
if (!containerRef.current) return;
|
|
91
|
-
const slideWidth = containerRef.current.offsetWidth;
|
|
92
|
-
let nextSlideScroll = -(slideWidth * target);
|
|
93
|
-
if (target < 0) nextSlideScroll = -(slideWidth * slidesCount);
|
|
94
|
-
else if (target >= slidesCount) nextSlideScroll = 0;
|
|
95
|
-
containerRef.current.scrollTo({
|
|
96
|
-
left: nextSlideScroll,
|
|
97
|
-
behavior: "smooth"
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
className: clsx.clsx("overflow-hidden relative group", className),
|
|
104
|
-
style: { direction: "rtl" },
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
className: clsx.clsx(
|
|
110
|
-
"flex snap-x snap-mandatory overflow-x-auto no-scrollbar",
|
|
111
|
-
containerClassName
|
|
112
|
-
),
|
|
113
|
-
style: { marginLeft: -spaceBetween },
|
|
114
|
-
onScroll: detectCarouselPosition,
|
|
115
|
-
ref: containerRef,
|
|
116
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(sliderContext.Provider, { value: { slidesPerView, spaceBetween }, children: props.children })
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
haveNavigation && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
120
|
-
"div",
|
|
121
|
-
{
|
|
122
|
-
className: clsx.clsx("flex", {
|
|
123
|
-
"items-center mt-2": navigationVariant === "outside",
|
|
124
|
-
"absolute bottom-4 w-full justify-center": navigationVariant === "inside",
|
|
125
|
-
"justify-between": navigationVariant === "outside" && navigationButtonsShowType !== "hide",
|
|
126
|
-
"justify-center": navigationVariant === "outside" && navigationButtonsShowType === "hide"
|
|
127
|
-
}),
|
|
128
|
-
children: [
|
|
129
|
-
navigationButtonsShowType && navigationButtonsShowType !== "hide" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
130
|
-
"div",
|
|
131
|
-
{
|
|
132
|
-
className: clsx.clsx("flex gap-2", {
|
|
133
|
-
"absolute bottom-0 left-[5.5%]": navigationVariant === "inside",
|
|
134
|
-
"opacity-0 group-hover:opacity-100 transition": navigationButtonsShowType === "hover"
|
|
135
|
-
}),
|
|
136
|
-
children: [
|
|
137
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
-
Button,
|
|
139
|
-
{
|
|
140
|
-
type: "button",
|
|
141
|
-
variant: "secondary",
|
|
142
|
-
onClick: () => navigate(slideIndex - 1),
|
|
143
|
-
rightIcon: /* @__PURE__ */ jsxRuntime.jsx(ArrowRight2.ArrowRight2Icon, {})
|
|
144
|
-
}
|
|
145
|
-
),
|
|
146
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
-
Button,
|
|
148
|
-
{
|
|
149
|
-
type: "button",
|
|
150
|
-
variant: "secondary",
|
|
151
|
-
onClick: () => navigate(slideIndex + 1),
|
|
152
|
-
rightIcon: /* @__PURE__ */ jsxRuntime.jsx(ArrowLeft2.ArrowLeft2Icon, {})
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
),
|
|
158
|
-
(showNavigationDots || showPaginationText) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
159
|
-
showPaginationText && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 font-caption-regular text-gray-400 ss02", children: [
|
|
160
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
161
|
-
"span",
|
|
162
|
-
{
|
|
163
|
-
className: clsx.clsx("font-bold", {
|
|
164
|
-
"text-gray-600": navigationVariant === "outside",
|
|
165
|
-
"text-white": navigationVariant === "inside"
|
|
166
|
-
}),
|
|
167
|
-
children: slideIndex + 1
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "از" }),
|
|
171
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: slidesCount })
|
|
172
|
-
] }),
|
|
173
|
-
showNavigationDots && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx.clsx("flex items-center justify-center gap-2", dotsClassName), children: Array.from(Array(slidesCount).keys()).map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
174
|
-
NavigationDot,
|
|
175
|
-
{
|
|
176
|
-
active: slideIndex === index,
|
|
177
|
-
autoplay: autoplay ?? false,
|
|
178
|
-
variant: navigationVariant,
|
|
179
|
-
onClick: () => navigate(index),
|
|
180
|
-
onNavigateToNext: () => navigate(slideIndex + 1)
|
|
181
|
-
},
|
|
182
|
-
item + slidesCount
|
|
183
|
-
)) })
|
|
184
|
-
] })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
const Slide = (props) => {
|
|
194
|
-
const { children, className } = props;
|
|
195
|
-
const { slidesPerView, spaceBetween } = useSliderContext();
|
|
196
|
-
const ref = react.useRef(null);
|
|
197
|
-
const [childIndex, setChildIndex] = react.useState(0);
|
|
198
|
-
react.useEffect(() => {
|
|
199
|
-
if (!ref.current) return;
|
|
200
|
-
setChildIndex(Array.prototype.indexOf.call(ref.current.parentNode?.children, ref.current));
|
|
201
|
-
}, [ref]);
|
|
202
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
203
|
-
"div",
|
|
204
|
-
{
|
|
205
|
-
ref,
|
|
206
|
-
className: clsx.clsx("shrink-0 snap-always", className),
|
|
207
|
-
style: {
|
|
208
|
-
width: 100 / (slidesPerView ?? 1) + "%",
|
|
209
|
-
paddingLeft: spaceBetween,
|
|
210
|
-
scrollSnapAlign: childIndex % slidesPerView === 0 ? "start" : "none"
|
|
211
|
-
},
|
|
212
|
-
children
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
exports.Slide = Slide;
|
|
218
|
-
exports.Slider = Slider;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { c as clsx } from './clsx-ChV9xqsO.js';
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
|
-
import './assets/styles.css';/* empty css */
|
|
5
|
-
|
|
6
|
-
const InfoCircleOutlineIcon = (props) => /* @__PURE__ */ jsxs(
|
|
7
|
-
"svg",
|
|
8
|
-
{
|
|
9
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
-
width: "1em",
|
|
11
|
-
height: "1em",
|
|
12
|
-
fill: "none",
|
|
13
|
-
viewBox: "0 0 24 24",
|
|
14
|
-
...props,
|
|
15
|
-
children: [
|
|
16
|
-
/* @__PURE__ */ jsx(
|
|
17
|
-
"path",
|
|
18
|
-
{
|
|
19
|
-
fill: "currentColor",
|
|
20
|
-
fillRule: "evenodd",
|
|
21
|
-
d: "M12.25 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5M2.5 12a9.75 9.75 0 0 1 9.75-9.75A9.75 9.75 0 0 1 22 12c0 5.384-4.365 9.75-9.75 9.75S2.5 17.384 2.5 12",
|
|
22
|
-
clipRule: "evenodd"
|
|
23
|
-
}
|
|
24
|
-
),
|
|
25
|
-
/* @__PURE__ */ jsx(
|
|
26
|
-
"path",
|
|
27
|
-
{
|
|
28
|
-
fill: "currentColor",
|
|
29
|
-
fillRule: "evenodd",
|
|
30
|
-
d: "M12.25 7.541a.75.75 0 0 1 .75.75v.063a.75.75 0 0 1-1.5 0v-.063a.75.75 0 0 1 .75-.75m.006 3.103a.75.75 0 0 1 .75.75v4.3a.75.75 0 0 1-1.5 0v-4.3a.75.75 0 0 1 .75-.75",
|
|
31
|
-
clipRule: "evenodd"
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const FieldBottomInfo = (props) => {
|
|
39
|
-
const { errorMessage, hintMessage, maxLength, value } = props;
|
|
40
|
-
const showInfo = Boolean(errorMessage || hintMessage || maxLength);
|
|
41
|
-
if (showInfo)
|
|
42
|
-
return /* @__PURE__ */ jsxs(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
className: clsx(
|
|
46
|
-
"flex font-p3-regular",
|
|
47
|
-
{
|
|
48
|
-
"justify-between": (errorMessage || hintMessage) && maxLength,
|
|
49
|
-
"justify-start": (errorMessage || hintMessage) && !maxLength,
|
|
50
|
-
"justify-end": !(errorMessage || hintMessage) && maxLength
|
|
51
|
-
},
|
|
52
|
-
errorMessage ? "text-error-500" : "text-gray-500"
|
|
53
|
-
),
|
|
54
|
-
children: [
|
|
55
|
-
(errorMessage || hintMessage) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
InfoCircleOutlineIcon,
|
|
58
|
-
{
|
|
59
|
-
width: 16,
|
|
60
|
-
height: 16
|
|
61
|
-
}
|
|
62
|
-
),
|
|
63
|
-
/* @__PURE__ */ jsx("span", { children: errorMessage || hintMessage })
|
|
64
|
-
] }),
|
|
65
|
-
maxLength && /* @__PURE__ */ jsxs("span", { className: "ss02", children: [
|
|
66
|
-
value?.length ?? 0,
|
|
67
|
-
"/",
|
|
68
|
-
maxLength
|
|
69
|
-
] })
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
return null;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const FieldLabel = (props) => {
|
|
77
|
-
const { link, labelContent, required } = props;
|
|
78
|
-
const showLabel = Boolean(labelContent || link?.href);
|
|
79
|
-
if (showLabel)
|
|
80
|
-
return /* @__PURE__ */ jsxs(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
className: clsx("flex mb-2", {
|
|
84
|
-
"justify-between": labelContent && link?.href,
|
|
85
|
-
"justify-start": labelContent && !link?.href,
|
|
86
|
-
"justify-end": !labelContent && link?.href
|
|
87
|
-
}),
|
|
88
|
-
children: [
|
|
89
|
-
labelContent && /* @__PURE__ */ jsxs("label", { className: "px-0 text-sm font-bold text-right md:mx-0", children: [
|
|
90
|
-
labelContent,
|
|
91
|
-
required && /* @__PURE__ */ jsx("span", { className: "ms-2 text-error-500", children: "*" })
|
|
92
|
-
] }),
|
|
93
|
-
link?.href && /* @__PURE__ */ jsx(
|
|
94
|
-
"a",
|
|
95
|
-
{
|
|
96
|
-
href: link.href,
|
|
97
|
-
className: "font-button-small text-primary-400",
|
|
98
|
-
children: link.cnotent
|
|
99
|
-
}
|
|
100
|
-
)
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
return null;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const TextFieldWrapper = (props) => {
|
|
108
|
-
const {
|
|
109
|
-
labelContent,
|
|
110
|
-
link,
|
|
111
|
-
containerClassName,
|
|
112
|
-
rightIcon,
|
|
113
|
-
isError,
|
|
114
|
-
errorMessage,
|
|
115
|
-
hintMessage,
|
|
116
|
-
required,
|
|
117
|
-
maxLength,
|
|
118
|
-
value: initialValue,
|
|
119
|
-
onChange,
|
|
120
|
-
children
|
|
121
|
-
} = props;
|
|
122
|
-
const [value, setValue] = useState(initialValue?.toString());
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
setValue(initialValue?.toString());
|
|
125
|
-
}, [initialValue]);
|
|
126
|
-
const handleChangeField = (e) => {
|
|
127
|
-
setValue(e.currentTarget.value);
|
|
128
|
-
if (onChange) {
|
|
129
|
-
onChange(e);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
133
|
-
/* @__PURE__ */ jsx(
|
|
134
|
-
FieldLabel,
|
|
135
|
-
{
|
|
136
|
-
labelContent,
|
|
137
|
-
link,
|
|
138
|
-
required
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
/* @__PURE__ */ jsxs(
|
|
142
|
-
"div",
|
|
143
|
-
{
|
|
144
|
-
className: clsx(
|
|
145
|
-
"relative cursor-text border border-solid rounded-lg ring-4 flex justify-between gap-x-3 p-3 bg-gray-100 transition-all ring-transparent hover:ring-gray-50 has-[:focus]:bg-white",
|
|
146
|
-
isError || errorMessage ? "border-error-500 has-[:focus]:ring-error-50" : "border-transparent hover:border-gray-300 has-[:focus]:border-primary-500 has-[:focus]:ring-primary-50",
|
|
147
|
-
containerClassName
|
|
148
|
-
),
|
|
149
|
-
children: [
|
|
150
|
-
rightIcon && /* @__PURE__ */ jsx("div", { className: "text-gray-600", children: rightIcon }),
|
|
151
|
-
children({ handleChangeField, setValue, value })
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
),
|
|
155
|
-
/* @__PURE__ */ jsx(
|
|
156
|
-
FieldBottomInfo,
|
|
157
|
-
{
|
|
158
|
-
errorMessage,
|
|
159
|
-
hintMessage,
|
|
160
|
-
maxLength,
|
|
161
|
-
value
|
|
162
|
-
}
|
|
163
|
-
)
|
|
164
|
-
] });
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export { TextFieldWrapper as T };
|