@dgshahr/ui-kit 0.0.1

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.
Files changed (89) hide show
  1. package/dist/Accordion/AccordionGroup.d.ts +8 -0
  2. package/dist/Accordion/AccordionGroup.d.ts.map +1 -0
  3. package/dist/Accordion/AccordionItem.d.ts +10 -0
  4. package/dist/Accordion/AccordionItem.d.ts.map +1 -0
  5. package/dist/Accordion/context.d.ts +8 -0
  6. package/dist/Accordion/context.d.ts.map +1 -0
  7. package/dist/Accordion/index.cjs +11 -0
  8. package/dist/Accordion/index.d.ts +3 -0
  9. package/dist/Accordion/index.d.ts.map +1 -0
  10. package/dist/Accordion/index.js +2 -0
  11. package/dist/AccordionItem-BBbE__nk.js +103 -0
  12. package/dist/AccordionItem-BOXOB5GK.cjs +106 -0
  13. package/dist/Alert/index.cjs +242 -0
  14. package/dist/Alert/index.d.ts +17 -0
  15. package/dist/Alert/index.d.ts.map +1 -0
  16. package/dist/Alert/index.js +240 -0
  17. package/dist/Alert/variants.d.ts +14 -0
  18. package/dist/Alert/variants.d.ts.map +1 -0
  19. package/dist/ArrowLeft2-BURhvXT2.js +22 -0
  20. package/dist/ArrowLeft2-iZ0Au6Fn.cjs +24 -0
  21. package/dist/ArrowRight2-DCxJPvNC.js +25 -0
  22. package/dist/ArrowRight2-DTuru_sP.cjs +27 -0
  23. package/dist/Badge/index.cjs +72 -0
  24. package/dist/Badge/index.d.ts +21 -0
  25. package/dist/Badge/index.d.ts.map +1 -0
  26. package/dist/Badge/index.js +70 -0
  27. package/dist/Breadcrumb/index.cjs +34 -0
  28. package/dist/Breadcrumb/index.d.ts +13 -0
  29. package/dist/Breadcrumb/index.d.ts.map +1 -0
  30. package/dist/Breadcrumb/index.js +32 -0
  31. package/dist/Button/index.cjs +119 -0
  32. package/dist/Button/index.d.ts +13 -0
  33. package/dist/Button/index.d.ts.map +1 -0
  34. package/dist/Button/index.js +117 -0
  35. package/dist/Button/variants.d.ts +5 -0
  36. package/dist/Button/variants.d.ts.map +1 -0
  37. package/dist/Divider/index.cjs +25 -0
  38. package/dist/Divider/index.d.ts +9 -0
  39. package/dist/Divider/index.d.ts.map +1 -0
  40. package/dist/Divider/index.js +23 -0
  41. package/dist/Form/Checkbox/index.cjs +72 -0
  42. package/dist/Form/Checkbox/index.d.ts +8 -0
  43. package/dist/Form/Checkbox/index.d.ts.map +1 -0
  44. package/dist/Form/Checkbox/index.js +70 -0
  45. package/dist/Form/Input/index.cjs +182 -0
  46. package/dist/Form/Input/index.d.ts +12 -0
  47. package/dist/Form/Input/index.d.ts.map +1 -0
  48. package/dist/Form/Input/index.js +180 -0
  49. package/dist/Form/RadioButton/index.cjs +22 -0
  50. package/dist/Form/RadioButton/index.d.ts +6 -0
  51. package/dist/Form/RadioButton/index.d.ts.map +1 -0
  52. package/dist/Form/RadioButton/index.js +20 -0
  53. package/dist/Form/Textarea/index.cjs +27 -0
  54. package/dist/Form/Textarea/index.d.ts +7 -0
  55. package/dist/Form/Textarea/index.d.ts.map +1 -0
  56. package/dist/Form/Textarea/index.js +25 -0
  57. package/dist/Pagination/index.cjs +119 -0
  58. package/dist/Pagination/index.d.ts +13 -0
  59. package/dist/Pagination/index.d.ts.map +1 -0
  60. package/dist/Pagination/index.js +117 -0
  61. package/dist/Pagination/utils.d.ts +8 -0
  62. package/dist/Pagination/utils.d.ts.map +1 -0
  63. package/dist/SelectableInputWrapper-D2aYQb9J.cjs +71 -0
  64. package/dist/SelectableInputWrapper-DAj8v1nv.js +69 -0
  65. package/dist/Slide-6SD8mElS.js +198 -0
  66. package/dist/Slide-BiCQh7AV.cjs +201 -0
  67. package/dist/Slider/NavigationDot.d.ts +11 -0
  68. package/dist/Slider/NavigationDot.d.ts.map +1 -0
  69. package/dist/Slider/Slide.d.ts +7 -0
  70. package/dist/Slider/Slide.d.ts.map +1 -0
  71. package/dist/Slider/Slider.d.ts +25 -0
  72. package/dist/Slider/Slider.d.ts.map +1 -0
  73. package/dist/Slider/context.d.ts +8 -0
  74. package/dist/Slider/context.d.ts.map +1 -0
  75. package/dist/Slider/index.cjs +11 -0
  76. package/dist/Slider/index.d.ts +3 -0
  77. package/dist/Slider/index.d.ts.map +1 -0
  78. package/dist/Slider/index.js +2 -0
  79. package/dist/TextFieldWrapper-C80myx6j.cjs +169 -0
  80. package/dist/TextFieldWrapper-D3oaEPmc.js +167 -0
  81. package/dist/assets/Button.css +1675 -0
  82. package/dist/assets/styles.css +1611 -0
  83. package/dist/clsx-BtxeOLZW.cjs +5 -0
  84. package/dist/clsx-ChV9xqsO.js +3 -0
  85. package/dist/index.cjs +34 -0
  86. package/dist/index.d.ts +13 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +13 -0
  89. package/package.json +83 -0
@@ -0,0 +1,12 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ import { TextFieldBaseProps } from '../Wrappers/TextFieldWrapper/TextFieldWrapper';
3
+ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dir'>, TextFieldBaseProps {
4
+ leftIcon?: JSX.Element;
5
+ prefix?: string;
6
+ postfix?: string;
7
+ isClearOption?: boolean;
8
+ onClear?: () => void;
9
+ }
10
+ declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
11
+ export default Input;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Input/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,mBAAmB,EAAwB,MAAM,OAAO,CAAC;AAC1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAMxF,UAAU,UACR,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,EACxD,kBAAkB;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,KAAK,yGA8ET,CAAC;AACH,eAAe,KAAK,CAAC"}
@@ -0,0 +1,180 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { c as clsx } from '../../clsx-ChV9xqsO.js';
3
+ import { forwardRef, useState } from 'react';
4
+ import { T as TextFieldWrapper } from '../../TextFieldWrapper-D3oaEPmc.js';
5
+
6
+ const CloseSquareIcon = (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: "m15.456 9.595-5.852 5.852-1.061-1.06 5.853-5.853z",
22
+ clipRule: "evenodd"
23
+ }
24
+ ),
25
+ /* @__PURE__ */ jsx(
26
+ "path",
27
+ {
28
+ fill: "currentColor",
29
+ fillRule: "evenodd",
30
+ d: "m9.6 8.532 5.856 5.858-1.06 1.06-5.857-5.857z",
31
+ clipRule: "evenodd"
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsx(
35
+ "path",
36
+ {
37
+ fill: "currentColor",
38
+ fillRule: "evenodd",
39
+ d: "M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12m10-8.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17",
40
+ clipRule: "evenodd"
41
+ }
42
+ )
43
+ ]
44
+ }
45
+ );
46
+
47
+ const EyeIcon = (props) => /* @__PURE__ */ jsxs(
48
+ "svg",
49
+ {
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ width: "1em",
52
+ height: "1em",
53
+ fill: "none",
54
+ viewBox: "0 0 24 24",
55
+ ...props,
56
+ children: [
57
+ /* @__PURE__ */ jsx(
58
+ "path",
59
+ {
60
+ fill: "currentColor",
61
+ d: "M12.247 20.812c-4.033 0-7.654-2.828-9.686-7.558a.75.75 0 0 1 0-.592c2.034-4.732 5.655-7.557 9.687-7.557s7.657 2.825 9.69 7.557a.75.75 0 0 1 0 .592c-2.032 4.73-5.653 7.554-9.685 7.557zm-8.182-7.853c1.806 3.983 4.846 6.352 8.18 6.352 3.334.002 6.373-2.369 8.18-6.352-1.808-3.986-4.848-6.354-8.182-6.354s-6.37 2.368-8.176 6.354z"
62
+ }
63
+ ),
64
+ /* @__PURE__ */ jsx(
65
+ "path",
66
+ {
67
+ fill: "currentColor",
68
+ d: "M12.247 16.789a3.825 3.825 0 1 1 0-7.651 3.825 3.825 0 0 1 0 7.65m0-6.152a2.326 2.326 0 1 0 0 4.651 2.326 2.326 0 0 0 0-4.651"
69
+ }
70
+ )
71
+ ]
72
+ }
73
+ );
74
+
75
+ const HideIcon = (props) => /* @__PURE__ */ jsx(
76
+ "svg",
77
+ {
78
+ xmlns: "http://www.w3.org/2000/svg",
79
+ width: "1em",
80
+ height: "1em",
81
+ fill: "none",
82
+ viewBox: "0 0 24 24",
83
+ ...props,
84
+ children: /* @__PURE__ */ jsx(
85
+ "path",
86
+ {
87
+ fill: "currentColor",
88
+ fillRule: "evenodd",
89
+ d: "M20.417 3.22a.75.75 0 0 1 0 1.06L4.643 20.055a.744.744 0 0 1-1.06 0 .75.75 0 0 1 0-1.06l1.972-1.971c-1.413-1.293-2.613-3.036-3.493-5.089a.75.75 0 0 1 0-.593C3.082 8.977 4.52 7.02 6.22 5.683c3.292-2.606 7.621-2.744 11.048-.375l2.088-2.088a.75.75 0 0 1 1.06 0m-.37 4.82c.724.962 1.36 2.073 1.891 3.299a.74.74 0 0 1 0 .595C19.842 16.79 16.128 19.69 12 19.69a8.8 8.8 0 0 1-2.769-.451.75.75 0 0 1 .474-1.424A7.3 7.3 0 0 0 12 18.19c3.428 0 6.561-2.442 8.43-6.553a14.5 14.5 0 0 0-1.58-2.694.75.75 0 0 1 1.197-.902M7.15 6.862c-1.437 1.13-2.67 2.776-3.58 4.778.794 1.752 1.836 3.23 3.047 4.322l2.138-2.138a3.87 3.87 0 0 1-.67-2.184A3.92 3.92 0 0 1 12 7.722a3.9 3.9 0 0 1 2.187.669l2.001-2.002c-2.853-1.844-6.325-1.676-9.038.472m8.088 4.6a.75.75 0 0 1 .606.872 3.92 3.92 0 0 1-3.141 3.147.75.75 0 0 1-.268-1.476 2.41 2.41 0 0 0 1.932-1.937.754.754 0 0 1 .87-.606M12 9.221a2.418 2.418 0 0 0-2.152 3.509l3.245-3.246A2.4 2.4 0 0 0 12 9.222",
90
+ clipRule: "evenodd"
91
+ }
92
+ )
93
+ }
94
+ );
95
+
96
+ const Input = forwardRef(function Input2(props, ref) {
97
+ const {
98
+ dir = "rtl",
99
+ placeholderDir = dir,
100
+ containerClassName,
101
+ leftIcon,
102
+ prefix,
103
+ postfix,
104
+ isClearOption,
105
+ onClear,
106
+ ...restProps
107
+ } = props;
108
+ const [type, setType] = useState(restProps.type);
109
+ return /* @__PURE__ */ jsx(
110
+ TextFieldWrapper,
111
+ {
112
+ ...props,
113
+ containerClassName: clsx("items-center", containerClassName),
114
+ children: ({ handleChangeField, value, setValue }) => /* @__PURE__ */ jsxs(Fragment, { children: [
115
+ prefix && /* @__PURE__ */ jsx("span", { className: "font-p1-regular text-gray-500", children: prefix }),
116
+ /* @__PURE__ */ jsx(
117
+ "input",
118
+ {
119
+ ...restProps,
120
+ ref,
121
+ className: clsx(
122
+ "bg-transparent focus:outline-none flex-1",
123
+ dir === "rtl" ? "text-right" : "!text-left",
124
+ placeholderDir === "rtl" ? "placeholder:text-right" : "placeholder:text-left",
125
+ {
126
+ ss02: restProps.type != "password"
127
+ },
128
+ props.className
129
+ ),
130
+ ...dir === "ltr" ? { style: { direction: "ltr" } } : {},
131
+ value,
132
+ onChange: handleChangeField,
133
+ type
134
+ }
135
+ ),
136
+ isClearOption && value && value.length > 0 && /* @__PURE__ */ jsx(
137
+ "button",
138
+ {
139
+ onClick: () => {
140
+ setValue("");
141
+ if (typeof onClear === "function") onClear();
142
+ },
143
+ children: /* @__PURE__ */ jsx(
144
+ CloseSquareIcon,
145
+ {
146
+ className: "text-gray-600",
147
+ width: 20,
148
+ height: 20
149
+ }
150
+ )
151
+ }
152
+ ),
153
+ postfix && /* @__PURE__ */ jsx("span", { className: "font-p1-regular text-gray-500", children: postfix }),
154
+ leftIcon && /* @__PURE__ */ jsx("div", { className: "text-gray-600", children: leftIcon }),
155
+ restProps.type === "password" && /* @__PURE__ */ jsx(
156
+ "button",
157
+ {
158
+ onClick: () => setType((prv) => prv === "text" ? "password" : "text"),
159
+ className: "text-gray-600",
160
+ children: type === "password" ? /* @__PURE__ */ jsx(
161
+ EyeIcon,
162
+ {
163
+ width: 20,
164
+ height: 20
165
+ }
166
+ ) : /* @__PURE__ */ jsx(
167
+ HideIcon,
168
+ {
169
+ width: 20,
170
+ height: 20
171
+ }
172
+ )
173
+ }
174
+ )
175
+ ] })
176
+ }
177
+ );
178
+ });
179
+
180
+ export { Input as default };
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const jsxRuntime = require('react/jsx-runtime');
4
+ const clsx = require('../../clsx-BtxeOLZW.cjs');
5
+ const SelectableInputWrapper = require('../../SelectableInputWrapper-D2aYQb9J.cjs');
6
+
7
+ const RadioButton = (props) => {
8
+ const { className, ...rest } = props;
9
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectableInputWrapper.SelectableInputWrapper, { ...rest, children: ({ inputClassName, checkedInputClassName }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10
+ /* @__PURE__ */ jsxRuntime.jsx(
11
+ "input",
12
+ {
13
+ type: "radio",
14
+ className: clsx.clsx("rounded-full", inputClassName, className),
15
+ ...rest
16
+ }
17
+ ),
18
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: checkedInputClassName, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-full w-2 h-2" }) })
19
+ ] }) });
20
+ };
21
+
22
+ module.exports = RadioButton;
@@ -0,0 +1,6 @@
1
+ import { SelectableInputBaseUnionProps } from '../Wrappers/SelectableInputWrapper/SelectableInputWrapper';
2
+ import { DetailedHTMLProps, InputHTMLAttributes } from 'react';
3
+ type RadioButtonProps = SelectableInputBaseUnionProps & Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'type'>;
4
+ declare const RadioButton: (props: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default RadioButton;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/RadioButton/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC/G,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAGpE,KAAK,gBAAgB,GAAG,6BAA6B,GACnD,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAE3F,QAAA,MAAM,WAAW,UAAW,gBAAgB,4CAmB3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { c as clsx } from '../../clsx-ChV9xqsO.js';
3
+ import { S as SelectableInputWrapper } from '../../SelectableInputWrapper-DAj8v1nv.js';
4
+
5
+ const RadioButton = (props) => {
6
+ const { className, ...rest } = props;
7
+ return /* @__PURE__ */ jsx(SelectableInputWrapper, { ...rest, children: ({ inputClassName, checkedInputClassName }) => /* @__PURE__ */ jsxs(Fragment, { children: [
8
+ /* @__PURE__ */ jsx(
9
+ "input",
10
+ {
11
+ type: "radio",
12
+ className: clsx("rounded-full", inputClassName, className),
13
+ ...rest
14
+ }
15
+ ),
16
+ /* @__PURE__ */ jsx("div", { className: checkedInputClassName, children: /* @__PURE__ */ jsx("div", { className: "bg-white rounded-full w-2 h-2" }) })
17
+ ] }) });
18
+ };
19
+
20
+ export { RadioButton as default };
@@ -0,0 +1,27 @@
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 TextFieldWrapper = require('../../TextFieldWrapper-C80myx6j.cjs');
7
+
8
+ const Textarea = react.forwardRef(function Textarea2(props, ref) {
9
+ const { dir = "rtl", placeholderDir = dir, ...restProps } = props;
10
+ return /* @__PURE__ */ jsxRuntime.jsx(TextFieldWrapper.TextFieldWrapper, { ...props, children: ({ handleChangeField }) => /* @__PURE__ */ jsxRuntime.jsx(
11
+ "textarea",
12
+ {
13
+ ...restProps,
14
+ ref,
15
+ className: clsx.clsx(
16
+ "text-gray-800 bg-transparent w-full h-full focus:outline-none ss02 flex-1 resize-none",
17
+ dir === "rtl" ? "text-right" : "!text-left",
18
+ placeholderDir === "rtl" ? "placeholder:text-right" : "placeholder:text-left",
19
+ restProps.className
20
+ ),
21
+ onChange: handleChangeField,
22
+ rows: restProps.rows ?? 5
23
+ }
24
+ ) });
25
+ });
26
+
27
+ module.exports = Textarea;
@@ -0,0 +1,7 @@
1
+ import { DetailedHTMLProps, TextareaHTMLAttributes } from 'react';
2
+ import { TextFieldBaseProps } from '../Wrappers/TextFieldWrapper/TextFieldWrapper';
3
+ interface TextareaProps extends Omit<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'dir'>, TextFieldBaseProps {
4
+ }
5
+ declare const Textarea: import('react').ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
6
+ export default Textarea;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Textarea/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGxF,UAAU,aACR,SAAQ,IAAI,CACR,iBAAiB,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC,EACnF,KAAK,CACN,EACD,kBAAkB;CAAG;AAEzB,QAAA,MAAM,QAAQ,4HAwBZ,CAAC;AAEH,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { c as clsx } from '../../clsx-ChV9xqsO.js';
3
+ import { forwardRef } from 'react';
4
+ import { T as TextFieldWrapper } from '../../TextFieldWrapper-D3oaEPmc.js';
5
+
6
+ const Textarea = forwardRef(function Textarea2(props, ref) {
7
+ const { dir = "rtl", placeholderDir = dir, ...restProps } = props;
8
+ return /* @__PURE__ */ jsx(TextFieldWrapper, { ...props, children: ({ handleChangeField }) => /* @__PURE__ */ jsx(
9
+ "textarea",
10
+ {
11
+ ...restProps,
12
+ ref,
13
+ className: clsx(
14
+ "text-gray-800 bg-transparent w-full h-full focus:outline-none ss02 flex-1 resize-none",
15
+ dir === "rtl" ? "text-right" : "!text-left",
16
+ placeholderDir === "rtl" ? "placeholder:text-right" : "placeholder:text-left",
17
+ restProps.className
18
+ ),
19
+ onChange: handleChangeField,
20
+ rows: restProps.rows ?? 5
21
+ }
22
+ ) });
23
+ });
24
+
25
+ export { Textarea as default };
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ require('../assets/styles.css');const jsxRuntime = require('react/jsx-runtime');
4
+ const react = require('react');
5
+ const clsx = require('../clsx-BtxeOLZW.cjs');
6
+ const Button = require('../Button/index.cjs');
7
+ const ArrowRight2 = require('../ArrowRight2-DTuru_sP.cjs');
8
+ const ArrowLeft2 = require('../ArrowLeft2-iZ0Au6Fn.cjs');
9
+ ;/* empty css */
10
+
11
+ const DOTS = "...";
12
+ function range(start, end) {
13
+ const length = end - start + 1;
14
+ return Array.from({ length }, (_, idx) => idx + start);
15
+ }
16
+ function getPaginationRange({
17
+ totalCount,
18
+ pageSize,
19
+ siblingCount,
20
+ currentPage
21
+ }) {
22
+ const totalPageCount = Math.ceil(totalCount / pageSize);
23
+ const totalPageNumbers = siblingCount + 5;
24
+ if (totalPageNumbers >= totalPageCount) {
25
+ return range(1, totalPageCount);
26
+ }
27
+ const rightSiblingIndex = Math.max(currentPage - siblingCount, 1);
28
+ const leftSiblingIndex = Math.min(currentPage + siblingCount, totalPageCount);
29
+ const shouldShowRightDots = rightSiblingIndex > 2;
30
+ const shouldShowLeftDots = leftSiblingIndex < totalPageCount - 1;
31
+ const firstPageIndex = 1;
32
+ const lastPageIndex = totalPageCount;
33
+ if (!shouldShowRightDots && shouldShowLeftDots) {
34
+ let rightItemCount = 2 + siblingCount;
35
+ if (rightSiblingIndex > 1) rightItemCount += 1;
36
+ const rightRange = range(1, rightItemCount);
37
+ return [...rightRange, DOTS, totalPageCount];
38
+ }
39
+ if (shouldShowRightDots && !shouldShowLeftDots) {
40
+ let leftItemCount = 2 + siblingCount;
41
+ if (leftSiblingIndex < totalPageCount) leftItemCount += 1;
42
+ const leftRange = range(totalPageCount - leftItemCount + 1, totalPageCount);
43
+ return [firstPageIndex, DOTS, ...leftRange];
44
+ }
45
+ const middleRange = range(rightSiblingIndex, leftSiblingIndex);
46
+ return [firstPageIndex, DOTS, ...middleRange, DOTS, lastPageIndex];
47
+ }
48
+
49
+ const Pagination = (props) => {
50
+ const {
51
+ totalCount,
52
+ pageSize,
53
+ onPageChange,
54
+ siblingCount = 1,
55
+ defaultCurrent = 1,
56
+ navigationButtonsWithText = true,
57
+ hideOnSinglePage,
58
+ className
59
+ } = props;
60
+ const [currentPage, setCurrentPage] = react.useState(defaultCurrent);
61
+ const paginationRange = getPaginationRange({
62
+ totalCount,
63
+ pageSize,
64
+ siblingCount,
65
+ currentPage
66
+ });
67
+ const lastPage = paginationRange[paginationRange.length - 1];
68
+ if (hideOnSinglePage && paginationRange.length < 2) {
69
+ return null;
70
+ }
71
+ function handlePageChange(page) {
72
+ if (typeof onPageChange === "function") onPageChange(page);
73
+ setCurrentPage(page);
74
+ }
75
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex justify-between w-full px-4 text-gray-600", className), children: [
76
+ /* @__PURE__ */ jsxRuntime.jsx(
77
+ Button,
78
+ {
79
+ disabled: currentPage === 1,
80
+ onClick: () => handlePageChange(currentPage - 1),
81
+ rightIcon: /* @__PURE__ */ jsxRuntime.jsx(ArrowRight2.ArrowRight2Icon, {}),
82
+ variant: navigationButtonsWithText ? "text" : "secondary",
83
+ size: navigationButtonsWithText ? "medium" : "small",
84
+ children: navigationButtonsWithText && "صفحه قبل"
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-1 tablet:gap-x-4", children: paginationRange.map((pageNumber) => {
88
+ if (typeof pageNumber === "string") {
89
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: DOTS }, pageNumber);
90
+ }
91
+ return /* @__PURE__ */ jsxRuntime.jsx(
92
+ "button",
93
+ {
94
+ className: clsx.clsx(
95
+ "ss02 w-9 h-9 tablet:w-11 tablet:h-11 flex justify-center items-center font-h6-bold tablet:font-h5-bold transition border border-solid border-transparent rounded-lg",
96
+ pageNumber === currentPage ? "bg-primary-500 text-white" : "hover:text-primary-500 hover:border-primary-200",
97
+ className
98
+ ),
99
+ onClick: () => handlePageChange(pageNumber),
100
+ children: pageNumber
101
+ },
102
+ pageNumber
103
+ );
104
+ }) }),
105
+ /* @__PURE__ */ jsxRuntime.jsx(
106
+ Button,
107
+ {
108
+ disabled: currentPage === lastPage,
109
+ onClick: () => handlePageChange(currentPage + 1),
110
+ leftIcon: /* @__PURE__ */ jsxRuntime.jsx(ArrowLeft2.ArrowLeft2Icon, {}),
111
+ variant: navigationButtonsWithText ? "text" : "secondary",
112
+ size: navigationButtonsWithText ? "medium" : "small",
113
+ children: navigationButtonsWithText && "صفحه بعد"
114
+ }
115
+ )
116
+ ] });
117
+ };
118
+
119
+ module.exports = Pagination;
@@ -0,0 +1,13 @@
1
+ export interface PaginationProps {
2
+ totalCount: number;
3
+ pageSize: number;
4
+ onPageChange?: (page: number) => void;
5
+ siblingCount?: number;
6
+ defaultCurrent?: number;
7
+ navigationButtonsWithText?: boolean;
8
+ hideOnSinglePage?: boolean;
9
+ className?: string;
10
+ }
11
+ declare const Pagination: (props: PaginationProps) => import("react/jsx-runtime").JSX.Element | null;
12
+ export default Pagination;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Pagination/index.tsx"],"names":[],"mappings":"AAOA,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,UAAW,eAAe,mDAyEzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,117 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
3
+ import { c as clsx } from '../clsx-ChV9xqsO.js';
4
+ import Button from '../Button/index.js';
5
+ import { A as ArrowRight2Icon } from '../ArrowRight2-DCxJPvNC.js';
6
+ import { A as ArrowLeft2Icon } from '../ArrowLeft2-BURhvXT2.js';
7
+ import '../assets/styles.css';/* empty css */
8
+
9
+ const DOTS = "...";
10
+ function range(start, end) {
11
+ const length = end - start + 1;
12
+ return Array.from({ length }, (_, idx) => idx + start);
13
+ }
14
+ function getPaginationRange({
15
+ totalCount,
16
+ pageSize,
17
+ siblingCount,
18
+ currentPage
19
+ }) {
20
+ const totalPageCount = Math.ceil(totalCount / pageSize);
21
+ const totalPageNumbers = siblingCount + 5;
22
+ if (totalPageNumbers >= totalPageCount) {
23
+ return range(1, totalPageCount);
24
+ }
25
+ const rightSiblingIndex = Math.max(currentPage - siblingCount, 1);
26
+ const leftSiblingIndex = Math.min(currentPage + siblingCount, totalPageCount);
27
+ const shouldShowRightDots = rightSiblingIndex > 2;
28
+ const shouldShowLeftDots = leftSiblingIndex < totalPageCount - 1;
29
+ const firstPageIndex = 1;
30
+ const lastPageIndex = totalPageCount;
31
+ if (!shouldShowRightDots && shouldShowLeftDots) {
32
+ let rightItemCount = 2 + siblingCount;
33
+ if (rightSiblingIndex > 1) rightItemCount += 1;
34
+ const rightRange = range(1, rightItemCount);
35
+ return [...rightRange, DOTS, totalPageCount];
36
+ }
37
+ if (shouldShowRightDots && !shouldShowLeftDots) {
38
+ let leftItemCount = 2 + siblingCount;
39
+ if (leftSiblingIndex < totalPageCount) leftItemCount += 1;
40
+ const leftRange = range(totalPageCount - leftItemCount + 1, totalPageCount);
41
+ return [firstPageIndex, DOTS, ...leftRange];
42
+ }
43
+ const middleRange = range(rightSiblingIndex, leftSiblingIndex);
44
+ return [firstPageIndex, DOTS, ...middleRange, DOTS, lastPageIndex];
45
+ }
46
+
47
+ const Pagination = (props) => {
48
+ const {
49
+ totalCount,
50
+ pageSize,
51
+ onPageChange,
52
+ siblingCount = 1,
53
+ defaultCurrent = 1,
54
+ navigationButtonsWithText = true,
55
+ hideOnSinglePage,
56
+ className
57
+ } = props;
58
+ const [currentPage, setCurrentPage] = useState(defaultCurrent);
59
+ const paginationRange = getPaginationRange({
60
+ totalCount,
61
+ pageSize,
62
+ siblingCount,
63
+ currentPage
64
+ });
65
+ const lastPage = paginationRange[paginationRange.length - 1];
66
+ if (hideOnSinglePage && paginationRange.length < 2) {
67
+ return null;
68
+ }
69
+ function handlePageChange(page) {
70
+ if (typeof onPageChange === "function") onPageChange(page);
71
+ setCurrentPage(page);
72
+ }
73
+ return /* @__PURE__ */ jsxs("div", { className: clsx("flex justify-between w-full px-4 text-gray-600", className), children: [
74
+ /* @__PURE__ */ jsx(
75
+ Button,
76
+ {
77
+ disabled: currentPage === 1,
78
+ onClick: () => handlePageChange(currentPage - 1),
79
+ rightIcon: /* @__PURE__ */ jsx(ArrowRight2Icon, {}),
80
+ variant: navigationButtonsWithText ? "text" : "secondary",
81
+ size: navigationButtonsWithText ? "medium" : "small",
82
+ children: navigationButtonsWithText && "صفحه قبل"
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-1 tablet:gap-x-4", children: paginationRange.map((pageNumber) => {
86
+ if (typeof pageNumber === "string") {
87
+ return /* @__PURE__ */ jsx("div", { children: DOTS }, pageNumber);
88
+ }
89
+ return /* @__PURE__ */ jsx(
90
+ "button",
91
+ {
92
+ className: clsx(
93
+ "ss02 w-9 h-9 tablet:w-11 tablet:h-11 flex justify-center items-center font-h6-bold tablet:font-h5-bold transition border border-solid border-transparent rounded-lg",
94
+ pageNumber === currentPage ? "bg-primary-500 text-white" : "hover:text-primary-500 hover:border-primary-200",
95
+ className
96
+ ),
97
+ onClick: () => handlePageChange(pageNumber),
98
+ children: pageNumber
99
+ },
100
+ pageNumber
101
+ );
102
+ }) }),
103
+ /* @__PURE__ */ jsx(
104
+ Button,
105
+ {
106
+ disabled: currentPage === lastPage,
107
+ onClick: () => handlePageChange(currentPage + 1),
108
+ leftIcon: /* @__PURE__ */ jsx(ArrowLeft2Icon, {}),
109
+ variant: navigationButtonsWithText ? "text" : "secondary",
110
+ size: navigationButtonsWithText ? "medium" : "small",
111
+ children: navigationButtonsWithText && "صفحه بعد"
112
+ }
113
+ )
114
+ ] });
115
+ };
116
+
117
+ export { Pagination as default };
@@ -0,0 +1,8 @@
1
+ import { PaginationProps } from '.';
2
+ export declare const DOTS = "...";
3
+ interface GetPaginationRangeArguments extends Required<Pick<PaginationProps, 'totalCount' | 'pageSize' | 'siblingCount'>> {
4
+ currentPage: number;
5
+ }
6
+ export declare function getPaginationRange({ totalCount, pageSize, siblingCount, currentPage, }: GetPaginationRangeArguments): (string | number)[];
7
+ export {};
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/components/Pagination/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAEzC,eAAO,MAAM,IAAI,QAAQ,CAAC;AAO1B,UAAU,2BACR,SAAQ,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,UAAU,GAAG,cAAc,CAAC,CAAC;IACnF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,GACZ,EAAE,2BAA2B,uBA2D7B"}
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ require('./assets/styles.css');const jsxRuntime = require('react/jsx-runtime');
4
+ const clsx = require('./clsx-BtxeOLZW.cjs');
5
+ ;/* empty css */
6
+
7
+ const SelectableInputWrapper = (props) => {
8
+ const {
9
+ children,
10
+ containerClassName,
11
+ errorMessage,
12
+ helperMessage,
13
+ isError,
14
+ label,
15
+ variant = "default"
16
+ } = props;
17
+ const icon = props.icon;
18
+ return /* @__PURE__ */ jsxRuntime.jsxs(
19
+ "label",
20
+ {
21
+ className: clsx.clsx(
22
+ "flex w-fit justify-between items-center group has-[:disabled]:opacity-40 has-[:disabled]:cursor-not-allowed transition",
23
+ {
24
+ "p-3 border w-full border-solid rounded-xl bg-white has-[:checked]:bg-primary-50": variant === "bordered",
25
+ "has-[:checked]:border-primary-500 border-gray-200 hover:ring-4 hover:ring-gray-100 has-[:focus]:ring has-[:focus]:ring-primary-300 has-[:focus]:ring-offset-1 has-[:focus]:ring-offset-white": variant === "bordered" && !isError,
26
+ "border-error-500 hover:ring-4 hover:ring-error-50 has-[:focus]:ring has-[:focus]:ring-error-300 has-[:focus]:ring-offset-1 has-[:focus]:ring-offset-white": variant === "bordered" && isError
27
+ },
28
+ containerClassName
29
+ ),
30
+ children: [
31
+ /* @__PURE__ */ jsxRuntime.jsxs(
32
+ "div",
33
+ {
34
+ className: clsx.clsx(
35
+ "flex space-x-2 space-x-reverse",
36
+ errorMessage ?? helperMessage ? "items-start" : "items-center"
37
+ ),
38
+ children: [
39
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx.clsx("relative h-[18px] w-[18px]", { "mt-1": label }), children: children({
40
+ inputClassName: clsx.clsx(
41
+ "peer w-full h-full disabled:bg-gray-200 appearance-none border border-gray-300 group-hover:border-primary-500 checked:bg-primary-500 checked:border-transparent transition-all",
42
+ {
43
+ "group-hover:ring-4 group-hover:ring-gray-100 focus:!ring focus:!ring-primary-300 focus:ring-offset-1 focus:ring-offset-white": variant !== "bordered" && !isError,
44
+ "!border-error-500 group-hover:ring-4 group-hover:ring-error-50 focus:!ring focus:!ring-error-300 focus:ring-offset-1 focus:ring-offset-white": variant !== "bordered" && isError
45
+ }
46
+ ),
47
+ checkedInputClassName: "absolute top-0 left-0 w-full h-full flex items-center justify-center text-white opacity-0 peer-checked:opacity-100 transition-opacity"
48
+ }) }),
49
+ Boolean(label) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
50
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-p2-medium text-gray-700 transition group-hover:text-primary-500", children: label }),
51
+ Boolean(errorMessage ?? helperMessage) && /* @__PURE__ */ jsxRuntime.jsx(
52
+ "div",
53
+ {
54
+ className: clsx.clsx(
55
+ "font-p3-regular",
56
+ errorMessage && isError ? "text-error-500" : "text-gray-500"
57
+ ),
58
+ children: isError && errorMessage ? errorMessage : helperMessage
59
+ }
60
+ )
61
+ ] })
62
+ ]
63
+ }
64
+ ),
65
+ variant === "bordered" && icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-600 group-hover:text-primary-500 group-checked:text-primary-500", children: icon }) : null
66
+ ]
67
+ }
68
+ );
69
+ };
70
+
71
+ exports.SelectableInputWrapper = SelectableInputWrapper;