@coinloger/dev-ui 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/README.md +63 -0
- package/dist/cjs/components/Badge/Badge.cjs +1 -0
- package/dist/cjs/components/Button/Button.cjs +1 -0
- package/dist/cjs/components/Card/Card.cjs +1 -0
- package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -0
- package/dist/cjs/components/Input/Input.cjs +1 -0
- package/dist/cjs/components/Modal/Modal.cjs +1 -0
- package/dist/cjs/components/Radio/Radio.cjs +1 -0
- package/dist/cjs/components/Select/Select.cjs +1 -0
- package/dist/cjs/components/Switch/Switch.cjs +1 -0
- package/dist/cjs/components/Table/Table.cjs +1 -0
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -0
- package/dist/cjs/components/Typography/Heading.cjs +1 -0
- package/dist/cjs/components/Typography/Text.cjs +1 -0
- package/dist/{style.css → cjs/dev-ui.css} +1 -1
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/theme.cjs +1 -0
- package/dist/esm/components/Badge/Badge.d.ts +23 -0
- package/dist/esm/components/Badge/Badge.js +31 -0
- package/dist/esm/components/Button/Button.d.ts +22 -0
- package/dist/esm/components/Button/Button.js +24 -0
- package/dist/esm/components/Card/Card.d.ts +21 -0
- package/dist/esm/components/Card/Card.js +20 -0
- package/dist/esm/components/Checkbox/Checkbox.d.ts +26 -0
- package/dist/esm/components/Checkbox/Checkbox.js +54 -0
- package/dist/esm/components/Input/Input.d.ts +35 -0
- package/dist/esm/components/Input/Input.js +39 -0
- package/dist/esm/components/Modal/Modal.d.ts +123 -0
- package/dist/esm/components/Modal/Modal.js +123 -0
- package/dist/esm/components/Radio/Radio.d.ts +26 -0
- package/dist/esm/components/Radio/Radio.js +43 -0
- package/dist/esm/components/Select/Select.d.ts +76 -0
- package/dist/esm/components/Select/Select.js +110 -0
- package/dist/esm/components/Switch/Switch.d.ts +26 -0
- package/dist/esm/components/Switch/Switch.js +44 -0
- package/dist/esm/components/Table/Table.d.ts +27 -0
- package/dist/esm/components/Table/Table.js +27 -0
- package/dist/esm/components/Tabs/Tabs.d.ts +70 -0
- package/dist/esm/components/Tabs/Tabs.js +87 -0
- package/dist/esm/components/Typography/Heading.d.ts +21 -0
- package/dist/esm/components/Typography/Heading.js +35 -0
- package/dist/esm/components/Typography/Text.d.ts +34 -0
- package/dist/esm/components/Typography/Text.js +40 -0
- package/dist/esm/dev-ui.css +1 -0
- package/dist/esm/index.js +36 -0
- package/dist/esm/theme.d.ts +15 -0
- package/dist/esm/theme.js +32 -0
- package/package.json +18 -18
- package/style.css +1 -0
- package/dist/components/Badge/Badge.d.ts +0 -8
- package/dist/components/Badge/Badge.demo.d.ts +0 -1
- package/dist/components/Button/Button.d.ts +0 -7
- package/dist/components/Button/Button.demo.d.ts +0 -1
- package/dist/components/Card/Card.d.ts +0 -8
- package/dist/components/Card/Card.demo.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts +0 -9
- package/dist/components/Checkbox/Checkbox.demo.d.ts +0 -1
- package/dist/components/Input/Input.d.ts +0 -11
- package/dist/components/Input/Input.demo.d.ts +0 -1
- package/dist/components/Modal/Modal.d.ts +0 -38
- package/dist/components/Modal/Modal.demo.d.ts +0 -1
- package/dist/components/Radio/Radio.d.ts +0 -9
- package/dist/components/Radio/Radio.demo.d.ts +0 -1
- package/dist/components/Select/Select.d.ts +0 -19
- package/dist/components/Select/Select.demo.d.ts +0 -1
- package/dist/components/Switch/Switch.d.ts +0 -9
- package/dist/components/Switch/Switch.demo.d.ts +0 -1
- package/dist/components/Table/Table.d.ts +0 -10
- package/dist/components/Table/Table.demo.d.ts +0 -1
- package/dist/components/Tabs/Tabs.d.ts +0 -26
- package/dist/components/Tabs/Tabs.demo.d.ts +0 -1
- package/dist/components/Typography/Heading.d.ts +0 -8
- package/dist/components/Typography/Text.d.ts +0 -11
- package/dist/components/Typography/Typography.demo.d.ts +0 -1
- package/dist/index.js +0 -488
- package/dist/theme.d.ts +0 -7
- /package/dist/{default-theme.d.ts → esm/default-theme.d.ts} +0 -0
- /package/dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/dist/{types.d.ts → esm/types.d.ts} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h, useId as x } from "react";
|
|
3
|
+
import { clsx as i } from "clsx";
|
|
4
|
+
import * as r from "prop-types";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const s = h(
|
|
7
|
+
({ className: u, label: p, error: t, helperText: l, fullWidth: n, size: m = "md", id: a, ...d }, c) => {
|
|
8
|
+
const o = a || x();
|
|
9
|
+
return /* @__PURE__ */ f("div", { className: i("ui-input-wrapper", n && "ui-input-wrapper-full"), children: [
|
|
10
|
+
p && /* @__PURE__ */ e("label", { htmlFor: o, className: "ui-label", children: p }),
|
|
11
|
+
/* @__PURE__ */ e(
|
|
12
|
+
"input",
|
|
13
|
+
{
|
|
14
|
+
ref: c,
|
|
15
|
+
id: o,
|
|
16
|
+
className: i(
|
|
17
|
+
"ui-input",
|
|
18
|
+
`ui-input-${m}`,
|
|
19
|
+
t && "ui-input-error",
|
|
20
|
+
u
|
|
21
|
+
),
|
|
22
|
+
...d
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
l && /* @__PURE__ */ e("span", { className: i("ui-helper-text", t && "ui-helper-text-error"), children: l })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
s.displayName = "Input";
|
|
30
|
+
s.propTypes = {
|
|
31
|
+
label: r.node,
|
|
32
|
+
error: r.bool,
|
|
33
|
+
helperText: r.string,
|
|
34
|
+
fullWidth: r.bool,
|
|
35
|
+
size: r.oneOf(["sm", "md", "lg", "xl"])
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
s as Input
|
|
39
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import * as PropTypes from 'prop-types';
|
|
4
|
+
export declare const ModalHeader: {
|
|
5
|
+
({ children, className }: {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
propTypes: {
|
|
11
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
12
|
+
className: PropTypes.Requireable<string>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const ModalBody: {
|
|
16
|
+
({ children, className }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
propTypes: {
|
|
22
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
23
|
+
className: PropTypes.Requireable<string>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const ModalFooter: {
|
|
27
|
+
({ children, className }: {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
propTypes: {
|
|
33
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
34
|
+
className: PropTypes.Requireable<string>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Modal component properties.
|
|
39
|
+
*/
|
|
40
|
+
export interface ModalProps {
|
|
41
|
+
/**
|
|
42
|
+
* Controls the visibility of the modal.
|
|
43
|
+
*/
|
|
44
|
+
isOpen: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Callback fired when the modal requests to be closed (e.g., backdrop click, ESC key).
|
|
47
|
+
*/
|
|
48
|
+
onClose: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Content to be displayed in the modal header.
|
|
51
|
+
*/
|
|
52
|
+
title?: ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* The body content of the modal.
|
|
55
|
+
*/
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Content to be displayed in the modal footer.
|
|
59
|
+
*/
|
|
60
|
+
footer?: ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* The width size of the modal.
|
|
63
|
+
* @default 'md'
|
|
64
|
+
*/
|
|
65
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
66
|
+
/**
|
|
67
|
+
* Additional CSS classes.
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
/**
|
|
71
|
+
* If true, clicking on the backdrop closes the modal.
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
closeOnBackdropClick?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export declare const Modal: {
|
|
77
|
+
({ isOpen, onClose, title, children, footer, size, className, closeOnBackdropClick, }: ModalProps): import('react').ReactPortal | null;
|
|
78
|
+
displayName: string;
|
|
79
|
+
propTypes: {
|
|
80
|
+
isOpen: PropTypes.Validator<boolean>;
|
|
81
|
+
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
82
|
+
title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
83
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
84
|
+
footer: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
85
|
+
size: PropTypes.Requireable<string>;
|
|
86
|
+
className: PropTypes.Requireable<string>;
|
|
87
|
+
closeOnBackdropClick: PropTypes.Requireable<boolean>;
|
|
88
|
+
};
|
|
89
|
+
} & {
|
|
90
|
+
Header: {
|
|
91
|
+
({ children, className }: {
|
|
92
|
+
children: ReactNode;
|
|
93
|
+
className?: string;
|
|
94
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
displayName: string;
|
|
96
|
+
propTypes: {
|
|
97
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
98
|
+
className: PropTypes.Requireable<string>;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
Body: {
|
|
102
|
+
({ children, className }: {
|
|
103
|
+
children: ReactNode;
|
|
104
|
+
className?: string;
|
|
105
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
106
|
+
displayName: string;
|
|
107
|
+
propTypes: {
|
|
108
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
109
|
+
className: PropTypes.Requireable<string>;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
Footer: {
|
|
113
|
+
({ children, className }: {
|
|
114
|
+
children: ReactNode;
|
|
115
|
+
className?: string;
|
|
116
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
117
|
+
displayName: string;
|
|
118
|
+
propTypes: {
|
|
119
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
120
|
+
className: PropTypes.Requireable<string>;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as r, jsxs as c, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as E, useRef as B, useState as R, useEffect as h, useContext as T } from "react";
|
|
3
|
+
import { createPortal as j } from "react-dom";
|
|
4
|
+
import { clsx as l } from "clsx";
|
|
5
|
+
import * as o from "prop-types";
|
|
6
|
+
/* empty css */
|
|
7
|
+
const v = E(void 0), F = () => {
|
|
8
|
+
const e = T(v);
|
|
9
|
+
if (!e)
|
|
10
|
+
throw new Error("Modal compound components must be used within a Modal");
|
|
11
|
+
return e;
|
|
12
|
+
}, a = ({ children: e, className: d }) => {
|
|
13
|
+
const { onClose: n } = F();
|
|
14
|
+
return /* @__PURE__ */ c("div", { className: l("ui-modal-header", d), children: [
|
|
15
|
+
/* @__PURE__ */ r("h3", { className: "ui-modal-title", children: e }),
|
|
16
|
+
/* @__PURE__ */ r(
|
|
17
|
+
"button",
|
|
18
|
+
{
|
|
19
|
+
className: "ui-modal-close",
|
|
20
|
+
onClick: n,
|
|
21
|
+
"aria-label": "Close modal",
|
|
22
|
+
children: /* @__PURE__ */ c("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
23
|
+
/* @__PURE__ */ r("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
24
|
+
/* @__PURE__ */ r("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
25
|
+
] })
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
] });
|
|
29
|
+
}, i = ({ children: e, className: d }) => /* @__PURE__ */ r("div", { className: l("ui-modal-body", d), children: e }), s = ({ children: e, className: d }) => /* @__PURE__ */ r("div", { className: l("ui-modal-footer", d), children: e }), m = ({
|
|
30
|
+
isOpen: e,
|
|
31
|
+
onClose: d,
|
|
32
|
+
title: n,
|
|
33
|
+
children: u,
|
|
34
|
+
footer: y,
|
|
35
|
+
size: x = "md",
|
|
36
|
+
className: N,
|
|
37
|
+
closeOnBackdropClick: g = !0
|
|
38
|
+
}) => {
|
|
39
|
+
const p = B(null), [k, f] = R(e);
|
|
40
|
+
h(() => {
|
|
41
|
+
e && f(!0);
|
|
42
|
+
}, [e]);
|
|
43
|
+
const M = () => {
|
|
44
|
+
e || f(!1);
|
|
45
|
+
};
|
|
46
|
+
if (h(() => {
|
|
47
|
+
const t = (w) => {
|
|
48
|
+
w.key === "Escape" && d();
|
|
49
|
+
};
|
|
50
|
+
return e && (document.addEventListener("keydown", t), document.body.style.overflow = "hidden"), () => {
|
|
51
|
+
document.removeEventListener("keydown", t), document.body.style.overflow = "";
|
|
52
|
+
};
|
|
53
|
+
}, [e, d]), !k) return null;
|
|
54
|
+
const b = (t) => {
|
|
55
|
+
g && t.target === p.current && d();
|
|
56
|
+
};
|
|
57
|
+
return j(
|
|
58
|
+
/* @__PURE__ */ r(v.Provider, { value: { onClose: d }, children: /* @__PURE__ */ r(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: l("ui-modal-overlay", !e && "ui-modal-closing"),
|
|
62
|
+
ref: p,
|
|
63
|
+
onClick: b,
|
|
64
|
+
onAnimationEnd: M,
|
|
65
|
+
children: /* @__PURE__ */ r(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
className: l(
|
|
69
|
+
"ui-modal",
|
|
70
|
+
`ui-modal-${x}`,
|
|
71
|
+
!e && "ui-modal-closing",
|
|
72
|
+
N
|
|
73
|
+
),
|
|
74
|
+
role: "dialog",
|
|
75
|
+
"aria-modal": "true",
|
|
76
|
+
children: n ? /* @__PURE__ */ c(C, { children: [
|
|
77
|
+
/* @__PURE__ */ r(a, { children: n }),
|
|
78
|
+
/* @__PURE__ */ r(i, { children: u }),
|
|
79
|
+
y && /* @__PURE__ */ r(s, { children: y })
|
|
80
|
+
] }) : u
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
) }),
|
|
85
|
+
document.body
|
|
86
|
+
);
|
|
87
|
+
}, V = Object.assign(m, {
|
|
88
|
+
Header: a,
|
|
89
|
+
Body: i,
|
|
90
|
+
Footer: s
|
|
91
|
+
});
|
|
92
|
+
m.displayName = "Modal";
|
|
93
|
+
a.displayName = "ModalHeader";
|
|
94
|
+
i.displayName = "ModalBody";
|
|
95
|
+
s.displayName = "ModalFooter";
|
|
96
|
+
m.propTypes = {
|
|
97
|
+
isOpen: o.bool.isRequired,
|
|
98
|
+
onClose: o.func.isRequired,
|
|
99
|
+
title: o.node,
|
|
100
|
+
children: o.node,
|
|
101
|
+
footer: o.node,
|
|
102
|
+
size: o.oneOf(["sm", "md", "lg", "xl"]),
|
|
103
|
+
className: o.string,
|
|
104
|
+
closeOnBackdropClick: o.bool
|
|
105
|
+
};
|
|
106
|
+
a.propTypes = {
|
|
107
|
+
children: o.node,
|
|
108
|
+
className: o.string
|
|
109
|
+
};
|
|
110
|
+
i.propTypes = {
|
|
111
|
+
children: o.node,
|
|
112
|
+
className: o.string
|
|
113
|
+
};
|
|
114
|
+
s.propTypes = {
|
|
115
|
+
children: o.node,
|
|
116
|
+
className: o.string
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
V as Modal,
|
|
120
|
+
i as ModalBody,
|
|
121
|
+
s as ModalFooter,
|
|
122
|
+
a as ModalHeader
|
|
123
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Radio component properties.
|
|
5
|
+
*/
|
|
6
|
+
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
7
|
+
/**
|
|
8
|
+
* Label to display next to the radio button.
|
|
9
|
+
*/
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* If true, the radio will be styled with an error state.
|
|
13
|
+
*/
|
|
14
|
+
error?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The size of the radio button.
|
|
17
|
+
* @default 'md'
|
|
18
|
+
*/
|
|
19
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
20
|
+
/**
|
|
21
|
+
* The visual color variant.
|
|
22
|
+
* @default 'primary'
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'primary' | 'success' | 'warning' | 'danger';
|
|
25
|
+
}
|
|
26
|
+
export declare const Radio: import('react').ForwardRefExoticComponent<RadioProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { clsx as c } from "clsx";
|
|
4
|
+
import * as a from "prop-types";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const s = t(
|
|
7
|
+
({ className: e, label: i, error: u, disabled: o, size: d = "md", variant: m = "primary", ...p }, l) => /* @__PURE__ */ n(
|
|
8
|
+
"label",
|
|
9
|
+
{
|
|
10
|
+
className: c(
|
|
11
|
+
"ui-radio-label",
|
|
12
|
+
`ui-radio-${d}`,
|
|
13
|
+
`ui-radio-${m}`,
|
|
14
|
+
o && "ui-radio-disabled",
|
|
15
|
+
e
|
|
16
|
+
),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ r(
|
|
19
|
+
"input",
|
|
20
|
+
{
|
|
21
|
+
type: "radio",
|
|
22
|
+
className: "ui-radio-input",
|
|
23
|
+
disabled: o,
|
|
24
|
+
ref: l,
|
|
25
|
+
...p
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ r("span", { className: "ui-radio-custom", children: /* @__PURE__ */ r("span", { className: "ui-radio-dot" }) }),
|
|
29
|
+
i && /* @__PURE__ */ r("span", { className: "ui-radio-text", children: i })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
s.displayName = "Radio";
|
|
35
|
+
s.propTypes = {
|
|
36
|
+
label: a.node,
|
|
37
|
+
error: a.bool,
|
|
38
|
+
size: a.oneOf(["sm", "md", "lg", "xl"]),
|
|
39
|
+
variant: a.oneOf(["primary", "success", "warning", "danger"])
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
s as Radio
|
|
43
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as PropTypes from 'prop-types';
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
value: string | number;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Select component properties.
|
|
8
|
+
*/
|
|
9
|
+
export interface SelectProps {
|
|
10
|
+
/**
|
|
11
|
+
* Array of options to display.
|
|
12
|
+
*/
|
|
13
|
+
options: SelectOption[];
|
|
14
|
+
/**
|
|
15
|
+
* The value of the selected option.
|
|
16
|
+
*/
|
|
17
|
+
value?: string | number;
|
|
18
|
+
/**
|
|
19
|
+
* Callback fired when an option is selected.
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (value: string | number) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Placeholder text displayed when no option is selected.
|
|
24
|
+
* @default "Select an option"
|
|
25
|
+
*/
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Label text displayed above the select.
|
|
29
|
+
*/
|
|
30
|
+
label?: string;
|
|
31
|
+
/**
|
|
32
|
+
* If true, the select will be styled with an error state.
|
|
33
|
+
*/
|
|
34
|
+
error?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Helper text displayed below the select.
|
|
37
|
+
*/
|
|
38
|
+
helperText?: string;
|
|
39
|
+
/**
|
|
40
|
+
* If true, the select is disabled.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If true, the select will take up the full width of its container.
|
|
45
|
+
*/
|
|
46
|
+
fullWidth?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The size of the select trigger.
|
|
49
|
+
* @default 'md'
|
|
50
|
+
*/
|
|
51
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
52
|
+
className?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Select/Dropdown component for selecting a value from a list of options.
|
|
56
|
+
*/
|
|
57
|
+
export declare const Select: {
|
|
58
|
+
({ options, value, onChange, placeholder, label, error, helperText, disabled, fullWidth, size, className, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
displayName: string;
|
|
60
|
+
propTypes: {
|
|
61
|
+
options: PropTypes.Validator<(PropTypes.InferProps<{
|
|
62
|
+
value: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
63
|
+
label: PropTypes.Validator<string>;
|
|
64
|
+
}> | null | undefined)[]>;
|
|
65
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
66
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
67
|
+
placeholder: PropTypes.Requireable<string>;
|
|
68
|
+
label: PropTypes.Requireable<string>;
|
|
69
|
+
error: PropTypes.Requireable<boolean>;
|
|
70
|
+
helperText: PropTypes.Requireable<string>;
|
|
71
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
72
|
+
fullWidth: PropTypes.Requireable<boolean>;
|
|
73
|
+
size: PropTypes.Requireable<string>;
|
|
74
|
+
className: PropTypes.Requireable<string>;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as T, useEffect as R } from "react";
|
|
3
|
+
import { clsx as r } from "clsx";
|
|
4
|
+
import * as e from "prop-types";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const b = ({
|
|
7
|
+
options: i,
|
|
8
|
+
value: n,
|
|
9
|
+
onChange: m,
|
|
10
|
+
placeholder: y = "Select an option",
|
|
11
|
+
label: p,
|
|
12
|
+
error: f,
|
|
13
|
+
helperText: h,
|
|
14
|
+
disabled: o,
|
|
15
|
+
fullWidth: g,
|
|
16
|
+
size: v = "md",
|
|
17
|
+
className: x
|
|
18
|
+
}) => {
|
|
19
|
+
const [t, a] = w(!1), c = T(null), u = i.find((l) => l.value === n), N = () => {
|
|
20
|
+
o || a(!t);
|
|
21
|
+
}, k = (l) => {
|
|
22
|
+
m && m(l), a(!1);
|
|
23
|
+
};
|
|
24
|
+
return R(() => {
|
|
25
|
+
const l = (O) => {
|
|
26
|
+
c.current && !c.current.contains(O.target) && a(!1);
|
|
27
|
+
};
|
|
28
|
+
return t && document.addEventListener("mousedown", l), () => {
|
|
29
|
+
document.removeEventListener("mousedown", l);
|
|
30
|
+
};
|
|
31
|
+
}, [t]), /* @__PURE__ */ d(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: r("ui-select-wrapper", g && "ui-w-full", x),
|
|
35
|
+
ref: c,
|
|
36
|
+
style: { width: g ? "100%" : "auto" },
|
|
37
|
+
children: [
|
|
38
|
+
p && /* @__PURE__ */ s("label", { className: "ui-label", style: { marginBottom: "0.375rem", display: "block" }, children: p }),
|
|
39
|
+
/* @__PURE__ */ d(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
className: r(
|
|
44
|
+
"ui-select-trigger",
|
|
45
|
+
`ui-select-${v}`,
|
|
46
|
+
f && "ui-select-error",
|
|
47
|
+
o && "ui-select-disabled",
|
|
48
|
+
t && "ui-select-open"
|
|
49
|
+
),
|
|
50
|
+
onClick: N,
|
|
51
|
+
disabled: o,
|
|
52
|
+
"aria-haspopup": "listbox",
|
|
53
|
+
"aria-expanded": t,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ s("span", { className: r(!u && "ui-select-placeholder"), children: u ? u.label : y }),
|
|
56
|
+
/* @__PURE__ */ s(
|
|
57
|
+
"svg",
|
|
58
|
+
{
|
|
59
|
+
className: "ui-select-icon",
|
|
60
|
+
fill: "none",
|
|
61
|
+
stroke: "currentColor",
|
|
62
|
+
viewBox: "0 0 24 24",
|
|
63
|
+
children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
t && /* @__PURE__ */ d("ul", { className: "ui-select-menu", role: "listbox", children: [
|
|
70
|
+
i.map((l) => /* @__PURE__ */ s(
|
|
71
|
+
"li",
|
|
72
|
+
{
|
|
73
|
+
className: r(
|
|
74
|
+
"ui-select-option",
|
|
75
|
+
l.value === n && "ui-select-selected"
|
|
76
|
+
),
|
|
77
|
+
onClick: () => k(l.value),
|
|
78
|
+
role: "option",
|
|
79
|
+
"aria-selected": l.value === n,
|
|
80
|
+
children: l.label
|
|
81
|
+
},
|
|
82
|
+
l.value
|
|
83
|
+
)),
|
|
84
|
+
i.length === 0 && /* @__PURE__ */ s("li", { className: "ui-select-option", style: { color: "var(--ui-text-muted)", cursor: "default" }, children: "No options" })
|
|
85
|
+
] }),
|
|
86
|
+
h && /* @__PURE__ */ s("span", { className: r("ui-helper-text", f && "ui-helper-text-error"), style: { marginTop: "0.375rem", display: "block" }, children: h })
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
b.displayName = "Select";
|
|
92
|
+
b.propTypes = {
|
|
93
|
+
options: e.arrayOf(e.shape({
|
|
94
|
+
value: e.oneOfType([e.string, e.number]).isRequired,
|
|
95
|
+
label: e.string.isRequired
|
|
96
|
+
})).isRequired,
|
|
97
|
+
value: e.oneOfType([e.string, e.number]),
|
|
98
|
+
onChange: e.func,
|
|
99
|
+
placeholder: e.string,
|
|
100
|
+
label: e.string,
|
|
101
|
+
error: e.bool,
|
|
102
|
+
helperText: e.string,
|
|
103
|
+
disabled: e.bool,
|
|
104
|
+
fullWidth: e.bool,
|
|
105
|
+
size: e.oneOf(["sm", "md", "lg", "xl"]),
|
|
106
|
+
className: e.string
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
b as Select
|
|
110
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Switch toggle component properties.
|
|
5
|
+
*/
|
|
6
|
+
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
7
|
+
/**
|
|
8
|
+
* Label to display next to the switch.
|
|
9
|
+
*/
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* If true, the switch will be styled with an error state.
|
|
13
|
+
*/
|
|
14
|
+
error?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The size of the switch.
|
|
17
|
+
* @default 'md'
|
|
18
|
+
*/
|
|
19
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
20
|
+
/**
|
|
21
|
+
* The visual color variant.
|
|
22
|
+
* @default 'primary'
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'primary' | 'success' | 'warning' | 'danger';
|
|
25
|
+
}
|
|
26
|
+
export declare const Switch: import('react').ForwardRefExoticComponent<SwitchProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as l, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as n } from "react";
|
|
3
|
+
import { clsx as h } from "clsx";
|
|
4
|
+
import * as i from "prop-types";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const t = n(
|
|
7
|
+
({ className: a, label: r, error: u, disabled: e, size: c = "md", variant: o = "primary", ...m }, p) => /* @__PURE__ */ l(
|
|
8
|
+
"label",
|
|
9
|
+
{
|
|
10
|
+
className: h(
|
|
11
|
+
"ui-switch-label",
|
|
12
|
+
`ui-switch-${c}`,
|
|
13
|
+
`ui-switch-${o}`,
|
|
14
|
+
e && "ui-switch-disabled",
|
|
15
|
+
a
|
|
16
|
+
),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ s(
|
|
19
|
+
"input",
|
|
20
|
+
{
|
|
21
|
+
type: "checkbox",
|
|
22
|
+
className: "ui-switch-input",
|
|
23
|
+
disabled: e,
|
|
24
|
+
ref: p,
|
|
25
|
+
role: "switch",
|
|
26
|
+
...m
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ s("span", { className: "ui-switch-track", children: /* @__PURE__ */ s("span", { className: "ui-switch-thumb" }) }),
|
|
30
|
+
r && /* @__PURE__ */ s("span", { className: "ui-switch-text", children: r })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
t.displayName = "Switch";
|
|
36
|
+
t.propTypes = {
|
|
37
|
+
label: i.node,
|
|
38
|
+
error: i.bool,
|
|
39
|
+
size: i.oneOf(["sm", "md", "lg", "xl"]),
|
|
40
|
+
variant: i.oneOf(["primary", "success", "warning", "danger"])
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
t as Switch
|
|
44
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TableHTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Table component properties.
|
|
5
|
+
*/
|
|
6
|
+
interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
7
|
+
/**
|
|
8
|
+
* If true, adds borders to table cells.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
bordered?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* If true, adds alternating background colors to rows.
|
|
14
|
+
*/
|
|
15
|
+
striped?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* If true, adds a hover effect to rows.
|
|
18
|
+
*/
|
|
19
|
+
hover?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The size of the table padding.
|
|
22
|
+
* @default 'md'
|
|
23
|
+
*/
|
|
24
|
+
size?: 'sm' | 'md';
|
|
25
|
+
}
|
|
26
|
+
export declare const Table: import('react').ForwardRefExoticComponent<TableProps & import('react').RefAttributes<HTMLTableElement>>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as n } from "react";
|
|
3
|
+
import * as e from "prop-types";
|
|
4
|
+
/* empty css */
|
|
5
|
+
const r = n(
|
|
6
|
+
({ className: s, bordered: a = !0, striped: i, hover: l, size: t = "md", children: m, ...b }, p) => {
|
|
7
|
+
const d = [
|
|
8
|
+
"ui-table",
|
|
9
|
+
a && "ui-table-bordered",
|
|
10
|
+
i && "ui-table-striped",
|
|
11
|
+
l && "ui-table-hover",
|
|
12
|
+
t === "sm" && "ui-table-sm",
|
|
13
|
+
s
|
|
14
|
+
].filter(Boolean).join(" ");
|
|
15
|
+
return /* @__PURE__ */ o("div", { className: "ui-table-responsive", children: /* @__PURE__ */ o("table", { ref: p, className: d, ...b, children: m }) });
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
r.displayName = "Table";
|
|
19
|
+
r.propTypes = {
|
|
20
|
+
bordered: e.bool,
|
|
21
|
+
striped: e.bool,
|
|
22
|
+
hover: e.bool,
|
|
23
|
+
size: e.oneOf(["sm", "md"])
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
r as Table
|
|
27
|
+
};
|