analytica-frontend-lib 1.0.22 → 1.0.23
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/Alert/Alert.d.mts +13 -0
- package/dist/Alert/Alert.d.ts +13 -0
- package/dist/Alert/Alert.js +158 -0
- package/dist/Alert/Alert.mjs +85 -0
- package/dist/Badge/Badge.d.mts +47 -0
- package/dist/Badge/Badge.d.ts +47 -0
- package/dist/Badge/Badge.js +117 -0
- package/dist/Badge/Badge.mjs +92 -0
- package/dist/Button/Button.d.mts +46 -0
- package/dist/Button/Button.d.ts +46 -0
- package/dist/Button/Button.js +84 -0
- package/dist/Button/Button.mjs +59 -0
- package/dist/CheckBox/CheckBox.d.mts +74 -0
- package/dist/CheckBox/CheckBox.d.ts +74 -0
- package/dist/CheckBox/CheckBox.js +264 -0
- package/dist/CheckBox/CheckBox.mjs +195 -0
- package/dist/DropdownMenu/DropdownMenu.d.mts +29 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts +29 -0
- package/dist/DropdownMenu/DropdownMenu.js +262 -0
- package/dist/DropdownMenu/DropdownMenu.mjs +242 -0
- package/dist/IconButton/IconButton.d.mts +77 -0
- package/dist/IconButton/IconButton.d.ts +77 -0
- package/dist/IconButton/IconButton.js +79 -0
- package/dist/IconButton/IconButton.mjs +54 -0
- package/dist/IconRoundedButton/IconRoundedButton.d.mts +35 -0
- package/dist/IconRoundedButton/IconRoundedButton.d.ts +35 -0
- package/dist/IconRoundedButton/IconRoundedButton.js +68 -0
- package/dist/IconRoundedButton/IconRoundedButton.mjs +43 -0
- package/dist/NavButton/NavButton.d.mts +58 -0
- package/dist/NavButton/NavButton.d.ts +58 -0
- package/dist/NavButton/NavButton.js +76 -0
- package/dist/NavButton/NavButton.mjs +51 -0
- package/dist/SelectionButton/SelectionButton.d.mts +58 -0
- package/dist/SelectionButton/SelectionButton.d.ts +58 -0
- package/dist/SelectionButton/SelectionButton.js +81 -0
- package/dist/SelectionButton/SelectionButton.mjs +56 -0
- package/dist/Table/Table.d.mts +17 -0
- package/dist/Table/Table.d.ts +17 -0
- package/dist/Table/Table.js +139 -0
- package/dist/Table/Table.mjs +107 -0
- package/dist/Text/Text.d.mts +59 -0
- package/dist/Text/Text.d.ts +59 -0
- package/dist/Text/Text.js +77 -0
- package/dist/Text/Text.mjs +6 -0
- package/dist/TextArea/TextArea.d.mts +69 -0
- package/dist/TextArea/TextArea.d.ts +69 -0
- package/dist/TextArea/TextArea.js +211 -0
- package/dist/TextArea/TextArea.mjs +142 -0
- package/dist/Toast/Toast.d.mts +17 -0
- package/dist/Toast/Toast.d.ts +17 -0
- package/dist/Toast/Toast.js +100 -0
- package/dist/Toast/Toast.mjs +7 -0
- package/dist/Toast/utils/ToastStore.d.mts +19 -0
- package/dist/Toast/utils/ToastStore.d.ts +19 -0
- package/dist/Toast/utils/ToastStore.js +44 -0
- package/dist/Toast/utils/ToastStore.mjs +6 -0
- package/dist/Toast/utils/Toaster.d.mts +11 -0
- package/dist/Toast/utils/Toaster.d.ts +11 -0
- package/dist/Toast/utils/Toaster.js +145 -0
- package/dist/Toast/utils/Toaster.mjs +35 -0
- package/dist/chunk-MI5FIRHM.mjs +75 -0
- package/dist/chunk-TT3VCQGR.mjs +53 -0
- package/dist/chunk-WIOCQOM7.mjs +20 -0
- package/package.json +71 -3
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Table/Table.tsx
|
|
21
|
+
var Table_exports = {};
|
|
22
|
+
__export(Table_exports, {
|
|
23
|
+
Table: () => Table,
|
|
24
|
+
TableBody: () => TableBody,
|
|
25
|
+
TableCaption: () => TableCaption,
|
|
26
|
+
TableCell: () => TableCell,
|
|
27
|
+
TableFooter: () => TableFooter,
|
|
28
|
+
TableHead: () => TableHead,
|
|
29
|
+
TableHeader: () => TableHeader,
|
|
30
|
+
TableRow: () => TableRow
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Table_exports);
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var Table = (0, import_react.forwardRef)(
|
|
36
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
37
|
+
"table",
|
|
38
|
+
{
|
|
39
|
+
ref,
|
|
40
|
+
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
41
|
+
...props,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
44
|
+
children
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
);
|
|
49
|
+
Table.displayName = "Table";
|
|
50
|
+
var TableHeader = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
"thead",
|
|
52
|
+
{
|
|
53
|
+
ref,
|
|
54
|
+
className: `[&_tr:first-child]:border-0 ${className}`,
|
|
55
|
+
...props
|
|
56
|
+
}
|
|
57
|
+
));
|
|
58
|
+
TableHeader.displayName = "TableHeader";
|
|
59
|
+
var TableBody = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
"tbody",
|
|
61
|
+
{
|
|
62
|
+
ref,
|
|
63
|
+
className: `[&_tr:last-child]:border-0 border-t border-border-200 ${className}`,
|
|
64
|
+
...props
|
|
65
|
+
}
|
|
66
|
+
));
|
|
67
|
+
TableBody.displayName = "TableBody";
|
|
68
|
+
var TableFooter = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
"tfoot",
|
|
70
|
+
{
|
|
71
|
+
ref,
|
|
72
|
+
className: `border-t bg-background-50 border-border-200 font-medium [&>tr]:last:border-b-0 px-6 py-3.5 ${className}`,
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
));
|
|
76
|
+
TableFooter.displayName = "TableFooter";
|
|
77
|
+
var VARIANT_STATES_ROW = {
|
|
78
|
+
default: "border-b border-border-200",
|
|
79
|
+
selected: "border-b-2 border-indicator-primary",
|
|
80
|
+
invalid: "border-b-2 border-indicator-error",
|
|
81
|
+
disabled: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed"
|
|
82
|
+
};
|
|
83
|
+
var TableRow = (0, import_react.forwardRef)(
|
|
84
|
+
({ state = "default", className, ...props }, ref) => {
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
"tr",
|
|
87
|
+
{
|
|
88
|
+
ref,
|
|
89
|
+
className: `
|
|
90
|
+
transition-colors
|
|
91
|
+
${state !== "disabled" ? "hover:bg-muted/50" : ""}
|
|
92
|
+
${VARIANT_STATES_ROW[state]}
|
|
93
|
+
${className}
|
|
94
|
+
`,
|
|
95
|
+
"aria-disabled": state === "disabled",
|
|
96
|
+
...props
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
TableRow.displayName = "TableRow";
|
|
102
|
+
var TableHead = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
|
+
"th",
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
className: `h-10 px-6 py-3.5 bg-bg-secondary bg-muted/50 text-left align-middle font-bold text-text-800 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] ${className}`,
|
|
107
|
+
...props
|
|
108
|
+
}
|
|
109
|
+
));
|
|
110
|
+
TableHead.displayName = "TableHead";
|
|
111
|
+
var TableCell = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
"td",
|
|
113
|
+
{
|
|
114
|
+
ref,
|
|
115
|
+
className: `p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-md text-text-800 px-6 py-3.5 ${className}`,
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
));
|
|
119
|
+
TableCell.displayName = "TableCell";
|
|
120
|
+
var TableCaption = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
+
"caption",
|
|
122
|
+
{
|
|
123
|
+
ref,
|
|
124
|
+
className: `border-t border-border-200 text-sm text-text-800 px-6 py-3.5 ${className}`,
|
|
125
|
+
...props
|
|
126
|
+
}
|
|
127
|
+
));
|
|
128
|
+
TableCaption.displayName = "TableCaption";
|
|
129
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
+
0 && (module.exports = {
|
|
131
|
+
Table,
|
|
132
|
+
TableBody,
|
|
133
|
+
TableCaption,
|
|
134
|
+
TableCell,
|
|
135
|
+
TableFooter,
|
|
136
|
+
TableHead,
|
|
137
|
+
TableHeader,
|
|
138
|
+
TableRow
|
|
139
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// src/components/Table/Table.tsx
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var Table = forwardRef(
|
|
5
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ jsxs(
|
|
6
|
+
"table",
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
10
|
+
...props,
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ jsx("caption", { className: "sr-only", children: "My Table" }),
|
|
13
|
+
children
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
) })
|
|
17
|
+
);
|
|
18
|
+
Table.displayName = "Table";
|
|
19
|
+
var TableHeader = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
20
|
+
"thead",
|
|
21
|
+
{
|
|
22
|
+
ref,
|
|
23
|
+
className: `[&_tr:first-child]:border-0 ${className}`,
|
|
24
|
+
...props
|
|
25
|
+
}
|
|
26
|
+
));
|
|
27
|
+
TableHeader.displayName = "TableHeader";
|
|
28
|
+
var TableBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
29
|
+
"tbody",
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
className: `[&_tr:last-child]:border-0 border-t border-border-200 ${className}`,
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
));
|
|
36
|
+
TableBody.displayName = "TableBody";
|
|
37
|
+
var TableFooter = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
38
|
+
"tfoot",
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
className: `border-t bg-background-50 border-border-200 font-medium [&>tr]:last:border-b-0 px-6 py-3.5 ${className}`,
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
));
|
|
45
|
+
TableFooter.displayName = "TableFooter";
|
|
46
|
+
var VARIANT_STATES_ROW = {
|
|
47
|
+
default: "border-b border-border-200",
|
|
48
|
+
selected: "border-b-2 border-indicator-primary",
|
|
49
|
+
invalid: "border-b-2 border-indicator-error",
|
|
50
|
+
disabled: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed"
|
|
51
|
+
};
|
|
52
|
+
var TableRow = forwardRef(
|
|
53
|
+
({ state = "default", className, ...props }, ref) => {
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"tr",
|
|
56
|
+
{
|
|
57
|
+
ref,
|
|
58
|
+
className: `
|
|
59
|
+
transition-colors
|
|
60
|
+
${state !== "disabled" ? "hover:bg-muted/50" : ""}
|
|
61
|
+
${VARIANT_STATES_ROW[state]}
|
|
62
|
+
${className}
|
|
63
|
+
`,
|
|
64
|
+
"aria-disabled": state === "disabled",
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
TableRow.displayName = "TableRow";
|
|
71
|
+
var TableHead = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
72
|
+
"th",
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
className: `h-10 px-6 py-3.5 bg-bg-secondary bg-muted/50 text-left align-middle font-bold text-text-800 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] ${className}`,
|
|
76
|
+
...props
|
|
77
|
+
}
|
|
78
|
+
));
|
|
79
|
+
TableHead.displayName = "TableHead";
|
|
80
|
+
var TableCell = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
81
|
+
"td",
|
|
82
|
+
{
|
|
83
|
+
ref,
|
|
84
|
+
className: `p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-md text-text-800 px-6 py-3.5 ${className}`,
|
|
85
|
+
...props
|
|
86
|
+
}
|
|
87
|
+
));
|
|
88
|
+
TableCell.displayName = "TableCell";
|
|
89
|
+
var TableCaption = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
90
|
+
"caption",
|
|
91
|
+
{
|
|
92
|
+
ref,
|
|
93
|
+
className: `border-t border-border-200 text-sm text-text-800 px-6 py-3.5 ${className}`,
|
|
94
|
+
...props
|
|
95
|
+
}
|
|
96
|
+
));
|
|
97
|
+
TableCaption.displayName = "TableCaption";
|
|
98
|
+
export {
|
|
99
|
+
Table,
|
|
100
|
+
TableBody,
|
|
101
|
+
TableCaption,
|
|
102
|
+
TableCell,
|
|
103
|
+
TableFooter,
|
|
104
|
+
TableHead,
|
|
105
|
+
TableHeader,
|
|
106
|
+
TableRow
|
|
107
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ElementType, ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base text component props
|
|
6
|
+
*/
|
|
7
|
+
type BaseTextProps = {
|
|
8
|
+
/** Content to be displayed */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Text size variant */
|
|
11
|
+
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl';
|
|
12
|
+
/** Font weight variant */
|
|
13
|
+
weight?: 'hairline' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
|
|
14
|
+
/** Color variant - white for light backgrounds, black for dark backgrounds */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** Additional CSS classes to apply */
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Polymorphic text component props that ensures type safety based on the 'as' prop
|
|
21
|
+
*/
|
|
22
|
+
type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
|
|
23
|
+
/** HTML tag to render */
|
|
24
|
+
as?: T;
|
|
25
|
+
} & Omit<ComponentPropsWithoutRef<T>, keyof BaseTextProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Text component for Analytica Ensino platforms
|
|
28
|
+
*
|
|
29
|
+
* A flexible polymorphic text component with multiple sizes, weights, and colors.
|
|
30
|
+
* Automatically adapts to dark and light themes with full type safety.
|
|
31
|
+
* Fully compatible with Next.js 15 and React 19.
|
|
32
|
+
*
|
|
33
|
+
* @param children - The content to display
|
|
34
|
+
* @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)
|
|
35
|
+
* @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)
|
|
36
|
+
* @param color - The color variant - adapts to theme
|
|
37
|
+
* @param as - The HTML tag to render - determines allowed attributes via TypeScript
|
|
38
|
+
* @param className - Additional CSS classes
|
|
39
|
+
* @param props - HTML attributes valid for the chosen tag only
|
|
40
|
+
* @returns A styled text element with type-safe attributes
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Text size="lg" weight="bold" color="text-info-800">
|
|
45
|
+
* This is a large, bold text
|
|
46
|
+
* </Text>
|
|
47
|
+
*
|
|
48
|
+
* <Text as="a" href="/link" target="_blank">
|
|
49
|
+
* Link with type-safe anchor attributes
|
|
50
|
+
* </Text>
|
|
51
|
+
*
|
|
52
|
+
* <Text as="button" onClick={handleClick} disabled>
|
|
53
|
+
* Button with type-safe button attributes
|
|
54
|
+
* </Text>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const Text: <T extends ElementType = "p">({ children, size, weight, color, as, className, ...props }: TextProps<T>) => react_jsx_runtime.JSX.Element;
|
|
58
|
+
|
|
59
|
+
export { Text };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ElementType, ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base text component props
|
|
6
|
+
*/
|
|
7
|
+
type BaseTextProps = {
|
|
8
|
+
/** Content to be displayed */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Text size variant */
|
|
11
|
+
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl';
|
|
12
|
+
/** Font weight variant */
|
|
13
|
+
weight?: 'hairline' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
|
|
14
|
+
/** Color variant - white for light backgrounds, black for dark backgrounds */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** Additional CSS classes to apply */
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Polymorphic text component props that ensures type safety based on the 'as' prop
|
|
21
|
+
*/
|
|
22
|
+
type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
|
|
23
|
+
/** HTML tag to render */
|
|
24
|
+
as?: T;
|
|
25
|
+
} & Omit<ComponentPropsWithoutRef<T>, keyof BaseTextProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Text component for Analytica Ensino platforms
|
|
28
|
+
*
|
|
29
|
+
* A flexible polymorphic text component with multiple sizes, weights, and colors.
|
|
30
|
+
* Automatically adapts to dark and light themes with full type safety.
|
|
31
|
+
* Fully compatible with Next.js 15 and React 19.
|
|
32
|
+
*
|
|
33
|
+
* @param children - The content to display
|
|
34
|
+
* @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)
|
|
35
|
+
* @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)
|
|
36
|
+
* @param color - The color variant - adapts to theme
|
|
37
|
+
* @param as - The HTML tag to render - determines allowed attributes via TypeScript
|
|
38
|
+
* @param className - Additional CSS classes
|
|
39
|
+
* @param props - HTML attributes valid for the chosen tag only
|
|
40
|
+
* @returns A styled text element with type-safe attributes
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Text size="lg" weight="bold" color="text-info-800">
|
|
45
|
+
* This is a large, bold text
|
|
46
|
+
* </Text>
|
|
47
|
+
*
|
|
48
|
+
* <Text as="a" href="/link" target="_blank">
|
|
49
|
+
* Link with type-safe anchor attributes
|
|
50
|
+
* </Text>
|
|
51
|
+
*
|
|
52
|
+
* <Text as="button" onClick={handleClick} disabled>
|
|
53
|
+
* Button with type-safe button attributes
|
|
54
|
+
* </Text>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const Text: <T extends ElementType = "p">({ children, size, weight, color, as, className, ...props }: TextProps<T>) => react_jsx_runtime.JSX.Element;
|
|
58
|
+
|
|
59
|
+
export { Text };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Text/Text.tsx
|
|
21
|
+
var Text_exports = {};
|
|
22
|
+
__export(Text_exports, {
|
|
23
|
+
Text: () => Text
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Text_exports);
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var Text = ({
|
|
28
|
+
children,
|
|
29
|
+
size = "md",
|
|
30
|
+
weight = "normal",
|
|
31
|
+
color = "text-text-950",
|
|
32
|
+
as,
|
|
33
|
+
className = "",
|
|
34
|
+
...props
|
|
35
|
+
}) => {
|
|
36
|
+
let sizeClasses = "";
|
|
37
|
+
let weightClasses = "";
|
|
38
|
+
const sizeClassMap = {
|
|
39
|
+
"2xs": "text-2xs",
|
|
40
|
+
xs: "text-xs",
|
|
41
|
+
sm: "text-sm",
|
|
42
|
+
md: "text-md",
|
|
43
|
+
lg: "text-lg",
|
|
44
|
+
xl: "text-xl",
|
|
45
|
+
"2xl": "text-2xl",
|
|
46
|
+
"3xl": "text-3xl",
|
|
47
|
+
"4xl": "text-4xl",
|
|
48
|
+
"5xl": "text-5xl",
|
|
49
|
+
"6xl": "text-6xl"
|
|
50
|
+
};
|
|
51
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
52
|
+
const weightClassMap = {
|
|
53
|
+
hairline: "font-hairline",
|
|
54
|
+
light: "font-light",
|
|
55
|
+
normal: "font-normal",
|
|
56
|
+
medium: "font-medium",
|
|
57
|
+
semibold: "font-semibold",
|
|
58
|
+
bold: "font-bold",
|
|
59
|
+
extrabold: "font-extrabold",
|
|
60
|
+
black: "font-black"
|
|
61
|
+
};
|
|
62
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
63
|
+
const baseClasses = "font-primary";
|
|
64
|
+
const Component = as ?? "p";
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
Component,
|
|
67
|
+
{
|
|
68
|
+
className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
|
|
69
|
+
...props,
|
|
70
|
+
children
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
Text
|
|
77
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import react__default, { ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TextArea size variants
|
|
5
|
+
*/
|
|
6
|
+
type TextAreaSize = 'small' | 'medium' | 'large' | 'extraLarge';
|
|
7
|
+
/**
|
|
8
|
+
* TextArea visual state
|
|
9
|
+
*/
|
|
10
|
+
type TextAreaState = 'default' | 'hovered' | 'focused' | 'invalid' | 'disabled';
|
|
11
|
+
/**
|
|
12
|
+
* TextArea component props interface
|
|
13
|
+
*/
|
|
14
|
+
type TextAreaProps = {
|
|
15
|
+
/** Label text to display above the textarea */
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
/** Size variant of the textarea */
|
|
18
|
+
size?: TextAreaSize;
|
|
19
|
+
/** Visual state of the textarea */
|
|
20
|
+
state?: TextAreaState;
|
|
21
|
+
/** Error message to display */
|
|
22
|
+
errorMessage?: string;
|
|
23
|
+
/** Helper text to display */
|
|
24
|
+
helperMessage?: string;
|
|
25
|
+
/** Additional CSS classes */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Label CSS classes */
|
|
28
|
+
labelClassName?: string;
|
|
29
|
+
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>;
|
|
30
|
+
/**
|
|
31
|
+
* TextArea component for Analytica Ensino platforms
|
|
32
|
+
*
|
|
33
|
+
* A textarea component with essential states, sizes and themes.
|
|
34
|
+
* Uses exact design specifications with 288px width, 96px height, and specific
|
|
35
|
+
* color values. Includes Text component integration for consistent typography.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* // Basic textarea
|
|
40
|
+
* <TextArea label="Description" placeholder="Enter description..." />
|
|
41
|
+
*
|
|
42
|
+
* // Small size
|
|
43
|
+
* <TextArea size="small" label="Comment" />
|
|
44
|
+
*
|
|
45
|
+
* // Invalid state
|
|
46
|
+
* <TextArea state="invalid" label="Required field" errorMessage="This field is required" />
|
|
47
|
+
*
|
|
48
|
+
* // Disabled state
|
|
49
|
+
* <TextArea disabled label="Read-only field" />
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare const TextArea: react__default.ForwardRefExoticComponent<{
|
|
53
|
+
/** Label text to display above the textarea */
|
|
54
|
+
label?: ReactNode;
|
|
55
|
+
/** Size variant of the textarea */
|
|
56
|
+
size?: TextAreaSize;
|
|
57
|
+
/** Visual state of the textarea */
|
|
58
|
+
state?: TextAreaState;
|
|
59
|
+
/** Error message to display */
|
|
60
|
+
errorMessage?: string;
|
|
61
|
+
/** Helper text to display */
|
|
62
|
+
helperMessage?: string;
|
|
63
|
+
/** Additional CSS classes */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Label CSS classes */
|
|
66
|
+
labelClassName?: string;
|
|
67
|
+
} & Omit<react__default.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & react__default.RefAttributes<HTMLTextAreaElement>>;
|
|
68
|
+
|
|
69
|
+
export { TextArea, type TextAreaProps };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import react__default, { ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TextArea size variants
|
|
5
|
+
*/
|
|
6
|
+
type TextAreaSize = 'small' | 'medium' | 'large' | 'extraLarge';
|
|
7
|
+
/**
|
|
8
|
+
* TextArea visual state
|
|
9
|
+
*/
|
|
10
|
+
type TextAreaState = 'default' | 'hovered' | 'focused' | 'invalid' | 'disabled';
|
|
11
|
+
/**
|
|
12
|
+
* TextArea component props interface
|
|
13
|
+
*/
|
|
14
|
+
type TextAreaProps = {
|
|
15
|
+
/** Label text to display above the textarea */
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
/** Size variant of the textarea */
|
|
18
|
+
size?: TextAreaSize;
|
|
19
|
+
/** Visual state of the textarea */
|
|
20
|
+
state?: TextAreaState;
|
|
21
|
+
/** Error message to display */
|
|
22
|
+
errorMessage?: string;
|
|
23
|
+
/** Helper text to display */
|
|
24
|
+
helperMessage?: string;
|
|
25
|
+
/** Additional CSS classes */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Label CSS classes */
|
|
28
|
+
labelClassName?: string;
|
|
29
|
+
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>;
|
|
30
|
+
/**
|
|
31
|
+
* TextArea component for Analytica Ensino platforms
|
|
32
|
+
*
|
|
33
|
+
* A textarea component with essential states, sizes and themes.
|
|
34
|
+
* Uses exact design specifications with 288px width, 96px height, and specific
|
|
35
|
+
* color values. Includes Text component integration for consistent typography.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* // Basic textarea
|
|
40
|
+
* <TextArea label="Description" placeholder="Enter description..." />
|
|
41
|
+
*
|
|
42
|
+
* // Small size
|
|
43
|
+
* <TextArea size="small" label="Comment" />
|
|
44
|
+
*
|
|
45
|
+
* // Invalid state
|
|
46
|
+
* <TextArea state="invalid" label="Required field" errorMessage="This field is required" />
|
|
47
|
+
*
|
|
48
|
+
* // Disabled state
|
|
49
|
+
* <TextArea disabled label="Read-only field" />
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare const TextArea: react__default.ForwardRefExoticComponent<{
|
|
53
|
+
/** Label text to display above the textarea */
|
|
54
|
+
label?: ReactNode;
|
|
55
|
+
/** Size variant of the textarea */
|
|
56
|
+
size?: TextAreaSize;
|
|
57
|
+
/** Visual state of the textarea */
|
|
58
|
+
state?: TextAreaState;
|
|
59
|
+
/** Error message to display */
|
|
60
|
+
errorMessage?: string;
|
|
61
|
+
/** Helper text to display */
|
|
62
|
+
helperMessage?: string;
|
|
63
|
+
/** Additional CSS classes */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Label CSS classes */
|
|
66
|
+
labelClassName?: string;
|
|
67
|
+
} & Omit<react__default.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & react__default.RefAttributes<HTMLTextAreaElement>>;
|
|
68
|
+
|
|
69
|
+
export { TextArea, type TextAreaProps };
|