@oneplatformdev/ui 0.0.1-beta.6 → 0.0.1-beta.60
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/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.mjs +23 -20
- package/Button/buttonVariants.mjs +5 -5
- package/Calendar/Calendar.mjs +3 -2
- package/Combobox/Combobox.mjs +124 -86
- package/Combobox/Combobox.types.d.ts +13 -1
- package/Command/Command.d.ts +1 -1
- package/DataTable/DataTable.d.ts +10 -3
- package/DataTable/DataTable.mjs +33 -33
- package/DataTable/DataTableColumnFilter.d.ts +4 -0
- package/DataTable/DataTableColumnFilter.mjs +31 -0
- package/DatePicker/DatePicker.mjs +2 -2
- package/Dropzone/Dropzone.d.ts +22 -0
- package/Dropzone/Dropzone.mjs +151 -0
- package/Dropzone/Dropzone.types.d.ts +38 -0
- package/Dropzone/DropzoneFilePreview.d.ts +4 -0
- package/Dropzone/DropzoneFilePreview.mjs +9 -0
- package/Dropzone/DropzoneSinglePickPreview.d.ts +9 -0
- package/Dropzone/DropzoneSinglePickPreview.mjs +38 -0
- package/Dropzone/DropzoneUtils.d.ts +5 -0
- package/Dropzone/DropzoneUtils.mjs +24 -0
- package/Dropzone/index.d.ts +2 -0
- package/Dropzone/index.mjs +7 -0
- package/Dropzone/package.json +7 -0
- package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
- package/Form/FormRenderControl.d.ts +1 -2
- package/Form/FormRenderControl.mjs +10 -10
- package/Form/FormRenderControl.types.d.ts +4 -3
- package/FormCheckbox/FormCheckbox.d.ts +1 -2
- package/FormCheckbox/FormCheckbox.types.d.ts +1 -2
- package/FormCombobox/FormCombobox.d.ts +2 -2
- package/FormCombobox/FormCombobox.types.d.ts +1 -2
- package/FormDatePicker/FormDatePicker.d.ts +2 -2
- package/FormDatePicker/FormDatePicker.mjs +20 -18
- package/FormDatePicker/FormDatePicker.types.d.ts +1 -2
- package/FormDropzone/FormDropzone.d.ts +4 -0
- package/FormDropzone/FormDropzone.mjs +19 -0
- package/FormDropzone/FormDropzone.types.d.ts +6 -0
- package/FormDropzone/index.d.ts +2 -0
- package/FormDropzone/index.mjs +4 -0
- package/FormDropzone/package.json +7 -0
- package/FormInput/FormInput.d.ts +1 -2
- package/FormInput/FormInput.types.d.ts +1 -2
- package/FormSelect/FormSelect.d.ts +1 -2
- package/FormSelect/FormSelect.mjs +19 -17
- package/FormSelect/FormSelect.types.d.ts +1 -2
- package/FormTextarea/FormTextarea.d.ts +1 -2
- package/FormTextarea/FormTextarea.mjs +13 -12
- package/FormTextarea/FormTextarea.types.d.ts +1 -2
- package/Input/Input.mjs +42 -37
- package/Input/Input.types.d.ts +3 -1
- package/Select/Select.mjs +93 -63
- package/Select/Select.types.d.ts +9 -2
- package/Select/SelectRoot.d.ts +2 -2
- package/Select/SelectRoot.mjs +1 -0
- package/TablePagination/TablePagination.d.ts +16 -0
- package/TablePagination/TablePagination.mjs +74 -0
- package/TablePagination/index.d.ts +1 -0
- package/TablePagination/index.mjs +4 -0
- package/TablePagination/package.json +7 -0
- package/Tabs/Tabs.d.ts +3 -2
- package/Tabs/Tabs.mjs +20 -6
- package/Tabs/Tabs.types.d.ts +5 -2
- package/Tabs/index.mjs +8 -7
- package/Textarea/Textarea.d.ts +1 -1
- package/Textarea/Textarea.mjs +71 -15
- package/Textarea/Textarea.types.d.ts +16 -2
- package/Textarea/useAutosizeTextArea.d.ts +3 -0
- package/Textarea/useAutosizeTextArea.mjs +20 -0
- package/Toast/toastVariants.mjs +3 -3
- package/index.css +1 -1
- package/index.d.ts +3 -0
- package/index.mjs +235 -225
- package/package.json +9 -8
@@ -1,38 +1,40 @@
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
2
|
-
import { FormControl as
|
3
|
-
import { FormRenderControl as
|
2
|
+
import { FormControl as f } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as d } from "../Form/FormRenderControl.mjs";
|
4
4
|
import "../Select/SelectRoot.mjs";
|
5
|
-
import { Select as
|
6
|
-
const
|
5
|
+
import { Select as g } from "../Select/Select.mjs";
|
6
|
+
const S = (n) => {
|
7
7
|
const {
|
8
|
-
form:
|
8
|
+
form: m,
|
9
9
|
label: i,
|
10
|
-
name:
|
11
|
-
options:
|
10
|
+
name: p,
|
11
|
+
options: l = [],
|
12
12
|
onChange: r,
|
13
|
-
|
14
|
-
|
13
|
+
containerProps: c,
|
14
|
+
...s
|
15
|
+
} = n;
|
15
16
|
return /* @__PURE__ */ e(
|
16
|
-
|
17
|
+
d,
|
17
18
|
{
|
18
|
-
form:
|
19
|
-
name:
|
19
|
+
form: m,
|
20
|
+
name: p,
|
20
21
|
label: i,
|
22
|
+
containerProps: c,
|
21
23
|
render: ({ field: t }) => /* @__PURE__ */ e(
|
22
|
-
|
24
|
+
g,
|
23
25
|
{
|
24
26
|
value: t.value,
|
25
|
-
options:
|
27
|
+
options: l,
|
26
28
|
onChange: (o) => {
|
27
29
|
t.onChange(o), r == null || r(o);
|
28
30
|
},
|
29
|
-
renderTrigger: (o,
|
30
|
-
...
|
31
|
+
renderTrigger: (o, a) => /* @__PURE__ */ e(f, { children: a }),
|
32
|
+
...s
|
31
33
|
}
|
32
34
|
)
|
33
35
|
}
|
34
36
|
);
|
35
37
|
};
|
36
38
|
export {
|
37
|
-
|
39
|
+
S as FormSelect
|
38
40
|
};
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { SelectProps } from '../Select';
|
2
2
|
import { FormRenderControlExtendProps } from '../Form';
|
3
|
-
import { UseFormReturn } from 'react-hook-form';
|
4
3
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
4
|
|
6
|
-
export interface FormSelectProps<Data extends FieldValues,
|
5
|
+
export interface FormSelectProps<Data extends FieldValues, ExtendOptionData> extends FormRenderControlExtendProps<Data>, Omit<SelectProps<ExtendOptionData>, 'onChange'>, Partial<Pick<SelectProps<ExtendOptionData>, 'onChange'>> {
|
7
6
|
}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
2
1
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
2
|
import { FormTextareaProps } from './FormTextarea.types';
|
4
3
|
|
5
|
-
export declare const FormTextarea: <Data extends FieldValues
|
4
|
+
export declare const FormTextarea: <Data extends FieldValues>(props: FormTextareaProps<Data>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,26 +1,27 @@
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
2
|
-
import { FormControl as
|
3
|
-
import { FormRenderControl as
|
4
|
-
import { Textarea as
|
5
|
-
const
|
6
|
-
const { form:
|
2
|
+
import { FormControl as p } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as i } from "../Form/FormRenderControl.mjs";
|
4
|
+
import { Textarea as s } from "../Textarea/Textarea.mjs";
|
5
|
+
const F = (e) => {
|
6
|
+
const { form: t, label: m, name: n, containerProps: a, ...l } = e;
|
7
7
|
return /* @__PURE__ */ r(
|
8
|
-
|
8
|
+
i,
|
9
9
|
{
|
10
|
-
form:
|
10
|
+
form: t,
|
11
11
|
name: n,
|
12
|
-
label:
|
13
|
-
|
14
|
-
|
12
|
+
label: m,
|
13
|
+
containerProps: a,
|
14
|
+
render: ({ field: o }) => /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r(
|
15
|
+
s,
|
15
16
|
{
|
16
17
|
...o,
|
17
18
|
value: o.value || "",
|
18
|
-
...
|
19
|
+
...l
|
19
20
|
}
|
20
21
|
) })
|
21
22
|
}
|
22
23
|
);
|
23
24
|
};
|
24
25
|
export {
|
25
|
-
|
26
|
+
F as FormTextarea
|
26
27
|
};
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { TextareaProps } from '../Textarea';
|
2
2
|
import { FormRenderControlExtendProps } from '../Form';
|
3
|
-
import { UseFormReturn } from 'react-hook-form';
|
4
3
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
4
|
|
6
|
-
export interface FormTextareaProps<Data extends FieldValues
|
5
|
+
export interface FormTextareaProps<Data extends FieldValues> extends FormRenderControlExtendProps<Data>, Omit<TextareaProps, 'form' | 'name'> {
|
7
6
|
}
|
package/Input/Input.mjs
CHANGED
@@ -1,61 +1,66 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import
|
3
|
-
import { Eye as
|
4
|
-
import { inputVariants as
|
5
|
-
import { cn as
|
6
|
-
const
|
7
|
-
(t,
|
1
|
+
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
2
|
+
import u, { useState as N } from "react";
|
3
|
+
import { Eye as g, EyeOff as b } from "lucide-react";
|
4
|
+
import { inputVariants as v } from "./inputVariants.mjs";
|
5
|
+
import { cn as h } from "@oneplatformdev/utils";
|
6
|
+
const c = u.forwardRef(
|
7
|
+
(t, a) => {
|
8
8
|
const {
|
9
|
-
className:
|
10
|
-
variant:
|
11
|
-
type:
|
12
|
-
slotProps: { input:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
className: e,
|
10
|
+
variant: o,
|
11
|
+
type: i,
|
12
|
+
slotProps: { input: l } = {},
|
13
|
+
onChange: m,
|
14
|
+
onTransform: n,
|
15
|
+
...y
|
16
|
+
} = t, { startAdornment: p } = l || {};
|
17
|
+
return /* @__PURE__ */ f("div", { className: "relative", children: [
|
18
|
+
!!p && /* @__PURE__ */ s("span", { className: "absolute left-[10px] top-1/2 -translate-y-1/2", children: p }),
|
17
19
|
/* @__PURE__ */ s(
|
18
20
|
"input",
|
19
21
|
{
|
20
|
-
type:
|
21
|
-
className:
|
22
|
-
|
23
|
-
!!
|
22
|
+
type: i,
|
23
|
+
className: h(
|
24
|
+
v({ variant: o, className: e }),
|
25
|
+
!!p && "pl-8"
|
24
26
|
),
|
25
|
-
ref:
|
26
|
-
...
|
27
|
+
ref: a,
|
28
|
+
...y,
|
29
|
+
onChange: (r) => {
|
30
|
+
typeof (n == null ? void 0 : n(r.target.value, r)) == "string" && (r.target.value = n(r.target.value, r)), m && m(r);
|
31
|
+
}
|
27
32
|
}
|
28
33
|
)
|
29
34
|
] });
|
30
35
|
}
|
31
36
|
);
|
32
|
-
|
33
|
-
const
|
34
|
-
(t,
|
35
|
-
const [
|
36
|
-
|
37
|
+
c.displayName = "Input";
|
38
|
+
const d = u.forwardRef(
|
39
|
+
(t, a) => {
|
40
|
+
const [e, o] = N(!1), i = e ? "text" : "password", l = () => {
|
41
|
+
o(!e);
|
37
42
|
};
|
38
|
-
return /* @__PURE__ */
|
39
|
-
/* @__PURE__ */ s(
|
40
|
-
/* @__PURE__ */ s(w, { isVisible:
|
43
|
+
return /* @__PURE__ */ f("div", { className: "relative", children: [
|
44
|
+
/* @__PURE__ */ s(c, { ...t, type: i, className: "pr-8", ref: a }),
|
45
|
+
/* @__PURE__ */ s(w, { isVisible: e, onClick: l })
|
41
46
|
] });
|
42
47
|
}
|
43
48
|
);
|
44
|
-
|
45
|
-
const w = ({ isVisible: t, onClick:
|
49
|
+
d.displayName = "PasswordInput";
|
50
|
+
const w = ({ isVisible: t, onClick: a }) => /* @__PURE__ */ s(
|
46
51
|
"button",
|
47
52
|
{
|
48
53
|
type: "button",
|
49
|
-
onClick:
|
54
|
+
onClick: a,
|
50
55
|
className: "absolute top-1/2 right-3 transform -translate-y-1/2",
|
51
|
-
children: t ? /* @__PURE__ */ s(
|
56
|
+
children: t ? /* @__PURE__ */ s(g, { size: 16 }) : /* @__PURE__ */ s(b, { size: 16 })
|
52
57
|
}
|
53
|
-
), I =
|
54
|
-
({ type: t, ...
|
58
|
+
), I = u.forwardRef(
|
59
|
+
({ type: t, ...a }, e) => t === "password" ? /* @__PURE__ */ s(d, { type: t, ...a, ref: e }) : /* @__PURE__ */ s(c, { type: t, ...a, ref: e })
|
55
60
|
);
|
56
61
|
I.displayName = "Input";
|
57
62
|
export {
|
58
|
-
|
63
|
+
c as BaseInput,
|
59
64
|
I as Input,
|
60
|
-
|
65
|
+
d as PasswordInput
|
61
66
|
};
|
package/Input/Input.types.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { inputVariants } from './inputVariants';
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
3
|
-
import { default as React, ReactNode } from 'react';
|
3
|
+
import { default as React, ChangeEvent, ReactNode } from 'react';
|
4
4
|
|
5
5
|
export interface InputSlotInputProps {
|
6
6
|
startAdornment?: ReactNode;
|
@@ -10,4 +10,6 @@ export interface InputSlotProps {
|
|
10
10
|
}
|
11
11
|
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {
|
12
12
|
slotProps?: InputSlotProps;
|
13
|
+
/** func transform event.target.value before onChange event call*/
|
14
|
+
onTransform?: (value: string, event: ChangeEvent<HTMLInputElement>) => string;
|
13
15
|
}
|
package/Select/Select.mjs
CHANGED
@@ -1,72 +1,102 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import {
|
1
|
+
import { jsxs as u, jsx as i, Fragment as x } from "react/jsx-runtime";
|
2
|
+
import { createElement as s, isValidElement as S } from "react";
|
3
|
+
import { Button as y } from "../Button/Button.mjs";
|
3
4
|
import "../Button/buttonVariants.mjs";
|
4
|
-
import { SelectRoot as
|
5
|
-
import { isValidReactElement as
|
6
|
-
const
|
7
|
-
const { placeholder:
|
8
|
-
return e && typeof e == "function" &&
|
9
|
-
},
|
10
|
-
const {
|
11
|
-
return
|
12
|
-
e,
|
13
|
-
n,
|
14
|
-
l,
|
15
|
-
{ ...c, options: l },
|
16
|
-
r
|
17
|
-
)) ? i(t(
|
18
|
-
e,
|
19
|
-
n,
|
20
|
-
l,
|
21
|
-
{ ...c, options: l },
|
22
|
-
r
|
23
|
-
), u) ? i(t(
|
24
|
-
e,
|
25
|
-
n,
|
26
|
-
l,
|
27
|
-
{ ...c, options: l },
|
28
|
-
r
|
29
|
-
)) : /* @__PURE__ */ a(u, { value: e.value, children: t(
|
30
|
-
e,
|
31
|
-
n,
|
32
|
-
l,
|
33
|
-
{ ...c, options: l },
|
34
|
-
r
|
35
|
-
) }, e.value) : r;
|
36
|
-
}, T = (o) => {
|
37
|
-
const {
|
38
|
-
value: t,
|
39
|
-
options: e,
|
40
|
-
onChange: n,
|
41
|
-
nullable: l = !1,
|
42
|
-
clearLabel: c = "Clear",
|
43
|
-
disabled: r
|
44
|
-
} = o;
|
45
|
-
return /* @__PURE__ */ d(
|
5
|
+
import { SelectRoot as R, SelectContent as b, SelectTrigger as C, SelectValue as V, SelectItem as p } from "./SelectRoot.mjs";
|
6
|
+
import { isValidReactElement as k } from "@oneplatformdev/utils";
|
7
|
+
const B = (t) => {
|
8
|
+
const { placeholder: n, renderTrigger: e, slotProps: l } = t, r = /* @__PURE__ */ i(C, { ...(l == null ? void 0 : l.triggerProps) || {}, children: /* @__PURE__ */ i(V, { placeholder: n }) });
|
9
|
+
return e && typeof e == "function" && k(e(t, r)) ? e(t, r) : r;
|
10
|
+
}, d = (t) => {
|
11
|
+
const { children: n, option: e, deep: l = 0 } = t;
|
12
|
+
return /* @__PURE__ */ u(
|
46
13
|
p,
|
47
14
|
{
|
48
|
-
value:
|
49
|
-
|
50
|
-
|
15
|
+
value: e.value,
|
16
|
+
className: "cursor-pointer",
|
17
|
+
style: { paddingLeft: `calc(8px + ${(l || 0) * 8}px)` },
|
51
18
|
children: [
|
52
|
-
|
53
|
-
/* @__PURE__ */
|
54
|
-
l && /* @__PURE__ */ a(f, { className: "w-full px-2", variant: "secondary", size: "sm", onClick: () => {
|
55
|
-
n("");
|
56
|
-
}, children: c }),
|
57
|
-
e.map((s, m) => /* @__PURE__ */ a(
|
58
|
-
C,
|
59
|
-
{
|
60
|
-
...o,
|
61
|
-
option: s,
|
62
|
-
index: m
|
63
|
-
}
|
64
|
-
))
|
65
|
-
] })
|
19
|
+
!n && e.label,
|
20
|
+
n && /* @__PURE__ */ i(x, { children: typeof n == "function" ? n({ ...t }) : n })
|
66
21
|
]
|
67
|
-
}
|
22
|
+
},
|
23
|
+
e.value
|
68
24
|
);
|
25
|
+
}, g = (t) => {
|
26
|
+
var c, o;
|
27
|
+
const { renderOption: n, option: e, index: l, options: r, deep: m = 0, ...a } = t;
|
28
|
+
return n && typeof n == "function" && S(
|
29
|
+
n(
|
30
|
+
e,
|
31
|
+
l,
|
32
|
+
r,
|
33
|
+
{ ...a, options: r },
|
34
|
+
/* @__PURE__ */ i(d, { ...t })
|
35
|
+
)
|
36
|
+
) ? /* @__PURE__ */ i(p, { value: e.value, children: n(
|
37
|
+
e,
|
38
|
+
l,
|
39
|
+
r,
|
40
|
+
{ ...a, options: r },
|
41
|
+
/* @__PURE__ */ i(d, { ...t })
|
42
|
+
) }, e.value) : (c = e.children) != null && c.length ? /* @__PURE__ */ u(
|
43
|
+
"div",
|
44
|
+
{
|
45
|
+
className: "flex flex-col gap-1 truncate line-clamp-2",
|
46
|
+
children: [
|
47
|
+
/* @__PURE__ */ i(d, { ...t }),
|
48
|
+
(o = e.children) == null ? void 0 : o.map((f, h, v) => /* @__PURE__ */ s(
|
49
|
+
g,
|
50
|
+
{
|
51
|
+
...t,
|
52
|
+
key: f.value,
|
53
|
+
option: f,
|
54
|
+
options: v,
|
55
|
+
index: h,
|
56
|
+
deep: (m || 0) + 1
|
57
|
+
}
|
58
|
+
))
|
59
|
+
]
|
60
|
+
},
|
61
|
+
e.value
|
62
|
+
) : /* @__PURE__ */ i(d, { ...t });
|
63
|
+
}, w = (t) => {
|
64
|
+
const {
|
65
|
+
value: n,
|
66
|
+
options: e,
|
67
|
+
onChange: l,
|
68
|
+
nullable: r = !1,
|
69
|
+
clearLabel: m = "Clear",
|
70
|
+
disabled: a
|
71
|
+
} = t;
|
72
|
+
return /* @__PURE__ */ u(R, { value: n, onValueChange: l, disabled: a, children: [
|
73
|
+
/* @__PURE__ */ i(B, { ...t }),
|
74
|
+
/* @__PURE__ */ u(b, { children: [
|
75
|
+
r && /* @__PURE__ */ i(
|
76
|
+
y,
|
77
|
+
{
|
78
|
+
className: "w-full px-2",
|
79
|
+
variant: "secondary",
|
80
|
+
size: "sm",
|
81
|
+
onClick: () => {
|
82
|
+
l == null || l("");
|
83
|
+
},
|
84
|
+
children: m
|
85
|
+
}
|
86
|
+
),
|
87
|
+
e.map((c, o) => /* @__PURE__ */ s(
|
88
|
+
g,
|
89
|
+
{
|
90
|
+
...t,
|
91
|
+
key: c.value,
|
92
|
+
option: c,
|
93
|
+
index: o,
|
94
|
+
deep: 0
|
95
|
+
}
|
96
|
+
))
|
97
|
+
] })
|
98
|
+
] });
|
69
99
|
};
|
70
100
|
export {
|
71
|
-
|
101
|
+
w as Select
|
72
102
|
};
|
package/Select/Select.types.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
import { ReactNode } from 'react';
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
2
2
|
|
3
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
3
4
|
export interface SelectOption<ExtendOptionData> {
|
4
5
|
value: string;
|
5
6
|
label?: ReactNode;
|
6
7
|
data?: ExtendOptionData;
|
8
|
+
children?: SelectOption<ExtendOptionData>[];
|
7
9
|
}
|
8
10
|
export type SelectRenderTrigger<ExtendOptionData> = (props: Omit<SelectProps<ExtendOptionData>, 'renderTrigger'>, defaultComponent: ReactNode) => ReactNode;
|
9
11
|
export type SelectRenderOption<ExtendOptionData> = (option: SelectOption<ExtendOptionData>, index: number, options: SelectOption<ExtendOptionData>[], props: Omit<SelectProps<ExtendOptionData>, 'renderOption'>, defaultComponent: ReactNode) => ReactNode;
|
@@ -15,7 +17,7 @@ export interface SelectProps<ExtendOptionData> {
|
|
15
17
|
/** Select placeholder string. */
|
16
18
|
placeholder?: string;
|
17
19
|
/** Select Root onValueChange handler. */
|
18
|
-
onChange
|
20
|
+
onChange?: (value: SelectOption<ExtendOptionData>['value']) => void;
|
19
21
|
/** Show reset select item button. */
|
20
22
|
disabled?: boolean;
|
21
23
|
/** Show reset select item button. */
|
@@ -26,4 +28,9 @@ export interface SelectProps<ExtendOptionData> {
|
|
26
28
|
renderTrigger?: SelectRenderTrigger<ExtendOptionData>;
|
27
29
|
/** Render custom option. */
|
28
30
|
renderOption?: SelectRenderOption<ExtendOptionData>;
|
31
|
+
/** Select Slot props */
|
32
|
+
slotProps?: {
|
33
|
+
/** Select Default Trigger Props */
|
34
|
+
triggerProps?: ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>;
|
35
|
+
};
|
29
36
|
}
|
package/Select/SelectRoot.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as React from
|
2
|
-
import * as SelectPrimitive from
|
1
|
+
import * as React from 'react';
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
3
3
|
declare const SelectRoot: React.FC<SelectPrimitive.SelectProps>;
|
4
4
|
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
5
5
|
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
package/Select/SelectRoot.mjs
CHANGED
@@ -9,6 +9,7 @@ const v = e.Root, R = e.Group, C = e.Value, h = l.forwardRef(({ className: o, ch
|
|
9
9
|
ref: d,
|
10
10
|
className: s(
|
11
11
|
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
12
|
+
"[&>svg]:disabled:hidden",
|
12
13
|
o
|
13
14
|
),
|
14
15
|
...a,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
|
3
|
+
interface IProps {
|
4
|
+
limit: number;
|
5
|
+
offset: number;
|
6
|
+
totalRows: number;
|
7
|
+
setLimit: (limit: number) => void;
|
8
|
+
setOffset: (offset: number) => void;
|
9
|
+
tRowsPerPage?: string;
|
10
|
+
tPrevious?: string;
|
11
|
+
tPage?: string;
|
12
|
+
tNext?: string;
|
13
|
+
tOf?: string;
|
14
|
+
}
|
15
|
+
export declare const TablePagination: FC<IProps>;
|
16
|
+
export {};
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
2
|
+
import { Button as i } from "../Button/Button.mjs";
|
3
|
+
import "../Button/buttonVariants.mjs";
|
4
|
+
import "../Select/SelectRoot.mjs";
|
5
|
+
import { Select as P } from "../Select/Select.mjs";
|
6
|
+
const y = ({
|
7
|
+
offset: l,
|
8
|
+
limit: a,
|
9
|
+
totalRows: s,
|
10
|
+
setLimit: p,
|
11
|
+
setOffset: t,
|
12
|
+
tRowsPerPage: d = "Rows per page",
|
13
|
+
tPrevious: u = "Previous",
|
14
|
+
tPage: x = "Page",
|
15
|
+
tNext: v = "Next",
|
16
|
+
tOf: h = "Of"
|
17
|
+
}) => {
|
18
|
+
const r = Math.ceil(l / a) + 1, o = Math.ceil(s / a), m = r === o, b = (e) => {
|
19
|
+
t(0), p(parseInt(e));
|
20
|
+
}, g = () => {
|
21
|
+
let e = l - a;
|
22
|
+
e < 0 && (e = 0), t(e);
|
23
|
+
}, N = () => {
|
24
|
+
let e = l + a;
|
25
|
+
e > s && (e = s - a), t(e);
|
26
|
+
};
|
27
|
+
return /* @__PURE__ */ c("div", { className: "flex items-center justify-end space-x-2 py-4", children: [
|
28
|
+
/* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
29
|
+
/* @__PURE__ */ n("span", { className: "text-sm text-nowrap", children: d }),
|
30
|
+
/* @__PURE__ */ n(
|
31
|
+
P,
|
32
|
+
{
|
33
|
+
value: a == null ? void 0 : a.toString(),
|
34
|
+
options: [
|
35
|
+
{ value: "5", label: "5" },
|
36
|
+
{ value: "10", label: "10" },
|
37
|
+
{ value: "20", label: "20" },
|
38
|
+
{ value: "30", label: "30" },
|
39
|
+
{ value: "50", label: "50" }
|
40
|
+
],
|
41
|
+
onChange: b,
|
42
|
+
placeholder: "6",
|
43
|
+
nullable: !1
|
44
|
+
}
|
45
|
+
)
|
46
|
+
] }),
|
47
|
+
/* @__PURE__ */ c("div", { className: "space-x-2", children: [
|
48
|
+
/* @__PURE__ */ n(
|
49
|
+
i,
|
50
|
+
{
|
51
|
+
variant: "outline",
|
52
|
+
size: "sm",
|
53
|
+
disabled: !l,
|
54
|
+
onClick: g,
|
55
|
+
children: u
|
56
|
+
}
|
57
|
+
),
|
58
|
+
/* @__PURE__ */ n("span", { className: "text-sm", children: `${x} ${r} ${h} ${o}` }),
|
59
|
+
/* @__PURE__ */ n(
|
60
|
+
i,
|
61
|
+
{
|
62
|
+
variant: "outline",
|
63
|
+
size: "sm",
|
64
|
+
disabled: m,
|
65
|
+
onClick: N,
|
66
|
+
children: v
|
67
|
+
}
|
68
|
+
)
|
69
|
+
] })
|
70
|
+
] });
|
71
|
+
};
|
72
|
+
export {
|
73
|
+
y as TablePagination
|
74
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './TablePagination';
|
package/Tabs/Tabs.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { TabsProps } from './Tabs.types';
|
2
|
-
import { FC } from 'react';
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
3
3
|
|
4
|
-
export declare const
|
4
|
+
export declare const TabRender: FC<TabsProps>;
|
5
|
+
export declare const Tabs: FC<PropsWithChildren<TabsProps>>;
|
package/Tabs/Tabs.mjs
CHANGED
@@ -1,9 +1,23 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
2
|
+
import { Children as p } from "react";
|
3
|
+
import { TabsContent as m, TabsRoot as b, TabsList as i, TabsTrigger as h } from "./TabsRoot.mjs";
|
4
|
+
const T = (a) => {
|
5
|
+
const { tabs: s = [], contents: t } = a;
|
6
|
+
return p.map(t, (n, r) => {
|
7
|
+
var l;
|
8
|
+
if (!n || !s[r]) return null;
|
9
|
+
const e = (l = s[r]) == null ? void 0 : l.value, u = n.props || {};
|
10
|
+
return /* @__PURE__ */ o(m, { value: e, ...u, children: n }, e);
|
11
|
+
});
|
12
|
+
}, f = (a) => {
|
13
|
+
const { tab: s, tabs: t = [], onChange: n, children: r } = a;
|
14
|
+
return /* @__PURE__ */ c(b, { value: s, onValueChange: n, children: [
|
15
|
+
/* @__PURE__ */ o(i, { className: "px-2 py-6 bg-[#E0E7FF] rounded-[6px]", children: t.map((e) => /* @__PURE__ */ o(h, { value: e.value, className: "h-8", children: e.label }, e.value)) }),
|
16
|
+
r,
|
17
|
+
!r && /* @__PURE__ */ o(T, { ...a })
|
18
|
+
] });
|
6
19
|
};
|
7
20
|
export {
|
8
|
-
|
21
|
+
T as TabRender,
|
22
|
+
f as Tabs
|
9
23
|
};
|
package/Tabs/Tabs.types.d.ts
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
|
1
3
|
export interface TabItemProps {
|
2
4
|
value: string;
|
3
5
|
label: string;
|
4
6
|
}
|
5
7
|
export interface TabsProps {
|
6
8
|
tabs: TabItemProps[];
|
7
|
-
tab
|
8
|
-
onChange
|
9
|
+
tab?: string;
|
10
|
+
onChange?: (value: string) => void;
|
11
|
+
contents?: ReactElement[];
|
9
12
|
}
|
package/Tabs/index.mjs
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
import { TabsContent as
|
2
|
-
import { Tabs as
|
1
|
+
import { TabsContent as T, TabsList as a, TabsRoot as b, TabsTrigger as e } from "./TabsRoot.mjs";
|
2
|
+
import { TabRender as t, Tabs as n } from "./Tabs.mjs";
|
3
3
|
export {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
t as TabRender,
|
5
|
+
n as Tabs,
|
6
|
+
T as TabsContent,
|
7
|
+
a as TabsList,
|
8
|
+
b as TabsRoot,
|
9
|
+
e as TabsTrigger
|
9
10
|
};
|
package/Textarea/Textarea.d.ts
CHANGED