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.
Files changed (64) hide show
  1. package/dist/Alert/Alert.d.mts +13 -0
  2. package/dist/Alert/Alert.d.ts +13 -0
  3. package/dist/Alert/Alert.js +158 -0
  4. package/dist/Alert/Alert.mjs +85 -0
  5. package/dist/Badge/Badge.d.mts +47 -0
  6. package/dist/Badge/Badge.d.ts +47 -0
  7. package/dist/Badge/Badge.js +117 -0
  8. package/dist/Badge/Badge.mjs +92 -0
  9. package/dist/Button/Button.d.mts +46 -0
  10. package/dist/Button/Button.d.ts +46 -0
  11. package/dist/Button/Button.js +84 -0
  12. package/dist/Button/Button.mjs +59 -0
  13. package/dist/CheckBox/CheckBox.d.mts +74 -0
  14. package/dist/CheckBox/CheckBox.d.ts +74 -0
  15. package/dist/CheckBox/CheckBox.js +264 -0
  16. package/dist/CheckBox/CheckBox.mjs +195 -0
  17. package/dist/DropdownMenu/DropdownMenu.d.mts +29 -0
  18. package/dist/DropdownMenu/DropdownMenu.d.ts +29 -0
  19. package/dist/DropdownMenu/DropdownMenu.js +262 -0
  20. package/dist/DropdownMenu/DropdownMenu.mjs +242 -0
  21. package/dist/IconButton/IconButton.d.mts +77 -0
  22. package/dist/IconButton/IconButton.d.ts +77 -0
  23. package/dist/IconButton/IconButton.js +79 -0
  24. package/dist/IconButton/IconButton.mjs +54 -0
  25. package/dist/IconRoundedButton/IconRoundedButton.d.mts +35 -0
  26. package/dist/IconRoundedButton/IconRoundedButton.d.ts +35 -0
  27. package/dist/IconRoundedButton/IconRoundedButton.js +68 -0
  28. package/dist/IconRoundedButton/IconRoundedButton.mjs +43 -0
  29. package/dist/NavButton/NavButton.d.mts +58 -0
  30. package/dist/NavButton/NavButton.d.ts +58 -0
  31. package/dist/NavButton/NavButton.js +76 -0
  32. package/dist/NavButton/NavButton.mjs +51 -0
  33. package/dist/SelectionButton/SelectionButton.d.mts +58 -0
  34. package/dist/SelectionButton/SelectionButton.d.ts +58 -0
  35. package/dist/SelectionButton/SelectionButton.js +81 -0
  36. package/dist/SelectionButton/SelectionButton.mjs +56 -0
  37. package/dist/Table/Table.d.mts +17 -0
  38. package/dist/Table/Table.d.ts +17 -0
  39. package/dist/Table/Table.js +139 -0
  40. package/dist/Table/Table.mjs +107 -0
  41. package/dist/Text/Text.d.mts +59 -0
  42. package/dist/Text/Text.d.ts +59 -0
  43. package/dist/Text/Text.js +77 -0
  44. package/dist/Text/Text.mjs +6 -0
  45. package/dist/TextArea/TextArea.d.mts +69 -0
  46. package/dist/TextArea/TextArea.d.ts +69 -0
  47. package/dist/TextArea/TextArea.js +211 -0
  48. package/dist/TextArea/TextArea.mjs +142 -0
  49. package/dist/Toast/Toast.d.mts +17 -0
  50. package/dist/Toast/Toast.d.ts +17 -0
  51. package/dist/Toast/Toast.js +100 -0
  52. package/dist/Toast/Toast.mjs +7 -0
  53. package/dist/Toast/utils/ToastStore.d.mts +19 -0
  54. package/dist/Toast/utils/ToastStore.d.ts +19 -0
  55. package/dist/Toast/utils/ToastStore.js +44 -0
  56. package/dist/Toast/utils/ToastStore.mjs +6 -0
  57. package/dist/Toast/utils/Toaster.d.mts +11 -0
  58. package/dist/Toast/utils/Toaster.d.ts +11 -0
  59. package/dist/Toast/utils/Toaster.js +145 -0
  60. package/dist/Toast/utils/Toaster.mjs +35 -0
  61. package/dist/chunk-MI5FIRHM.mjs +75 -0
  62. package/dist/chunk-TT3VCQGR.mjs +53 -0
  63. package/dist/chunk-WIOCQOM7.mjs +20 -0
  64. package/package.json +71 -3
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/Toast/utils/Toaster.tsx
22
+ var Toaster_exports = {};
23
+ __export(Toaster_exports, {
24
+ Toaster: () => Toaster,
25
+ useToast: () => useToast
26
+ });
27
+ module.exports = __toCommonJS(Toaster_exports);
28
+
29
+ // src/components/Toast/utils/ToastStore.ts
30
+ var import_zustand = require("zustand");
31
+ var useToastStore = (0, import_zustand.create)((set) => ({
32
+ toasts: [],
33
+ addToast: (toast) => {
34
+ const id = crypto.randomUUID();
35
+ set((state) => ({
36
+ toasts: [...state.toasts, { id, ...toast }]
37
+ }));
38
+ },
39
+ removeToast: (id) => {
40
+ set((state) => ({
41
+ toasts: state.toasts.filter((t) => t.id !== id)
42
+ }));
43
+ }
44
+ }));
45
+
46
+ // src/components/Toast/Toast.tsx
47
+ var import_phosphor_react = require("phosphor-react");
48
+ var import_jsx_runtime = require("react/jsx-runtime");
49
+ var VARIANT_ACTION_CLASSES = {
50
+ solid: {
51
+ warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
52
+ success: "bg-success text-success-800 border-none focus-visible:outline-none",
53
+ info: "bg-info text-info-800 border-none focus-visible:outline-none"
54
+ },
55
+ outlined: {
56
+ warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
57
+ success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
58
+ info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
59
+ }
60
+ };
61
+ var iconMap = {
62
+ success: import_phosphor_react.CheckCircle,
63
+ info: import_phosphor_react.Info,
64
+ warning: import_phosphor_react.WarningCircle
65
+ };
66
+ var Toast = ({
67
+ variant = "outlined",
68
+ action = "success",
69
+ className = "",
70
+ onClose,
71
+ title,
72
+ description,
73
+ position = "default",
74
+ ...props
75
+ }) => {
76
+ const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
77
+ const positionClasses = {
78
+ "top-left": "fixed top-4 left-4",
79
+ "top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
80
+ "top-right": "fixed top-4 right-4",
81
+ "bottom-left": "fixed bottom-4 left-4",
82
+ "bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
83
+ "bottom-right": "fixed bottom-4 right-4",
84
+ default: ""
85
+ };
86
+ const IconAction = iconMap[action] || iconMap["success"];
87
+ const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
89
+ "div",
90
+ {
91
+ role: "alert",
92
+ "aria-live": "assertive",
93
+ "aria-atomic": "true",
94
+ className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
95
+ ...props,
96
+ children: [
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-row items-start gap-3", children: [
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, {}) }),
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-start justify-start", children: [
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold text-md", children: title }),
101
+ description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-md text-text-900", children: description })
102
+ ] })
103
+ ] }),
104
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
+ "button",
106
+ {
107
+ onClick: onClose,
108
+ "aria-label": "Dismiss notification",
109
+ className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
110
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_phosphor_react.X, {})
111
+ }
112
+ )
113
+ ]
114
+ }
115
+ );
116
+ };
117
+
118
+ // src/components/Toast/utils/Toaster.tsx
119
+ var import_jsx_runtime2 = require("react/jsx-runtime");
120
+ var Toaster = () => {
121
+ const toasts = useToastStore((state) => state.toasts);
122
+ const removeToast = useToastStore((state) => state.removeToast);
123
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
124
+ Toast,
125
+ {
126
+ title: toast.title,
127
+ description: toast.description,
128
+ variant: toast.variant,
129
+ action: toast.action,
130
+ position: toast.position,
131
+ onClose: () => removeToast(toast.id)
132
+ },
133
+ toast.id
134
+ )) });
135
+ };
136
+ var useToast = () => {
137
+ const addToast = useToastStore((state) => state.addToast);
138
+ const removeToast = useToastStore((state) => state.removeToast);
139
+ return { addToast, removeToast };
140
+ };
141
+ // Annotate the CommonJS export names for ESM import in node:
142
+ 0 && (module.exports = {
143
+ Toaster,
144
+ useToast
145
+ });
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import {
3
+ Toast
4
+ } from "../../chunk-MI5FIRHM.mjs";
5
+ import {
6
+ useToastStore
7
+ } from "../../chunk-WIOCQOM7.mjs";
8
+
9
+ // src/components/Toast/utils/Toaster.tsx
10
+ import { Fragment, jsx } from "react/jsx-runtime";
11
+ var Toaster = () => {
12
+ const toasts = useToastStore((state) => state.toasts);
13
+ const removeToast = useToastStore((state) => state.removeToast);
14
+ return /* @__PURE__ */ jsx(Fragment, { children: toasts.map((toast) => /* @__PURE__ */ jsx(
15
+ Toast,
16
+ {
17
+ title: toast.title,
18
+ description: toast.description,
19
+ variant: toast.variant,
20
+ action: toast.action,
21
+ position: toast.position,
22
+ onClose: () => removeToast(toast.id)
23
+ },
24
+ toast.id
25
+ )) });
26
+ };
27
+ var useToast = () => {
28
+ const addToast = useToastStore((state) => state.addToast);
29
+ const removeToast = useToastStore((state) => state.removeToast);
30
+ return { addToast, removeToast };
31
+ };
32
+ export {
33
+ Toaster,
34
+ useToast
35
+ };
@@ -0,0 +1,75 @@
1
+ // src/components/Toast/Toast.tsx
2
+ import { CheckCircle, WarningCircle, Info, X } from "phosphor-react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var VARIANT_ACTION_CLASSES = {
5
+ solid: {
6
+ warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
7
+ success: "bg-success text-success-800 border-none focus-visible:outline-none",
8
+ info: "bg-info text-info-800 border-none focus-visible:outline-none"
9
+ },
10
+ outlined: {
11
+ warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
12
+ success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
13
+ info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
14
+ }
15
+ };
16
+ var iconMap = {
17
+ success: CheckCircle,
18
+ info: Info,
19
+ warning: WarningCircle
20
+ };
21
+ var Toast = ({
22
+ variant = "outlined",
23
+ action = "success",
24
+ className = "",
25
+ onClose,
26
+ title,
27
+ description,
28
+ position = "default",
29
+ ...props
30
+ }) => {
31
+ const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
32
+ const positionClasses = {
33
+ "top-left": "fixed top-4 left-4",
34
+ "top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
35
+ "top-right": "fixed top-4 right-4",
36
+ "bottom-left": "fixed bottom-4 left-4",
37
+ "bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
38
+ "bottom-right": "fixed bottom-4 right-4",
39
+ default: ""
40
+ };
41
+ const IconAction = iconMap[action] || iconMap["success"];
42
+ const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
43
+ return /* @__PURE__ */ jsxs(
44
+ "div",
45
+ {
46
+ role: "alert",
47
+ "aria-live": "assertive",
48
+ "aria-atomic": "true",
49
+ className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
50
+ ...props,
51
+ children: [
52
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-start gap-3", children: [
53
+ /* @__PURE__ */ jsx("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ jsx(IconAction, {}) }),
54
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start justify-start", children: [
55
+ /* @__PURE__ */ jsx("p", { className: "font-semibold text-md", children: title }),
56
+ description && /* @__PURE__ */ jsx("p", { className: "text-md text-text-900", children: description })
57
+ ] })
58
+ ] }),
59
+ /* @__PURE__ */ jsx(
60
+ "button",
61
+ {
62
+ onClick: onClose,
63
+ "aria-label": "Dismiss notification",
64
+ className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
65
+ children: /* @__PURE__ */ jsx(X, {})
66
+ }
67
+ )
68
+ ]
69
+ }
70
+ );
71
+ };
72
+
73
+ export {
74
+ Toast
75
+ };
@@ -0,0 +1,53 @@
1
+ // src/components/Text/Text.tsx
2
+ import { jsx } from "react/jsx-runtime";
3
+ var Text = ({
4
+ children,
5
+ size = "md",
6
+ weight = "normal",
7
+ color = "text-text-950",
8
+ as,
9
+ className = "",
10
+ ...props
11
+ }) => {
12
+ let sizeClasses = "";
13
+ let weightClasses = "";
14
+ const sizeClassMap = {
15
+ "2xs": "text-2xs",
16
+ xs: "text-xs",
17
+ sm: "text-sm",
18
+ md: "text-md",
19
+ lg: "text-lg",
20
+ xl: "text-xl",
21
+ "2xl": "text-2xl",
22
+ "3xl": "text-3xl",
23
+ "4xl": "text-4xl",
24
+ "5xl": "text-5xl",
25
+ "6xl": "text-6xl"
26
+ };
27
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
28
+ const weightClassMap = {
29
+ hairline: "font-hairline",
30
+ light: "font-light",
31
+ normal: "font-normal",
32
+ medium: "font-medium",
33
+ semibold: "font-semibold",
34
+ bold: "font-bold",
35
+ extrabold: "font-extrabold",
36
+ black: "font-black"
37
+ };
38
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
39
+ const baseClasses = "font-primary";
40
+ const Component = as ?? "p";
41
+ return /* @__PURE__ */ jsx(
42
+ Component,
43
+ {
44
+ className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
45
+ ...props,
46
+ children
47
+ }
48
+ );
49
+ };
50
+
51
+ export {
52
+ Text
53
+ };
@@ -0,0 +1,20 @@
1
+ // src/components/Toast/utils/ToastStore.ts
2
+ import { create } from "zustand";
3
+ var useToastStore = create((set) => ({
4
+ toasts: [],
5
+ addToast: (toast) => {
6
+ const id = crypto.randomUUID();
7
+ set((state) => ({
8
+ toasts: [...state.toasts, { id, ...toast }]
9
+ }));
10
+ },
11
+ removeToast: (id) => {
12
+ set((state) => ({
13
+ toasts: state.toasts.filter((t) => t.id !== id)
14
+ }));
15
+ }
16
+ }));
17
+
18
+ export {
19
+ useToastStore
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analytica-frontend-lib",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Repositório público dos componentes utilizados nas plataformas da Analytica Ensino",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -13,7 +13,72 @@
13
13
  "import": "./dist/index.js",
14
14
  "require": "./dist/index.cjs"
15
15
  },
16
- "./styles.css": "./dist/index.css"
16
+ "./styles.css": "./dist/index.css",
17
+ "./Alert": {
18
+ "types": "./dist/components/Alert/Alert.d.ts",
19
+ "import": "./dist/components/Alert/Alert.js",
20
+ "require": "./dist/components/Alert/Alert.cjs"
21
+ },
22
+ "./Badge": {
23
+ "types": "./dist/components/Badge/Badge.d.ts",
24
+ "import": "./dist/components/Badge/Badge.js",
25
+ "require": "./dist/components/Badge/Badge.cjs"
26
+ },
27
+ "./Button": {
28
+ "types": "./dist/components/Button/Button.d.ts",
29
+ "import": "./dist/components/Button/Button.js",
30
+ "require": "./dist/components/Button/Button.cjs"
31
+ },
32
+ "./CheckBox": {
33
+ "types": "./dist/components/CheckBox/CheckBox.d.ts",
34
+ "import": "./dist/components/CheckBox/CheckBox.js",
35
+ "require": "./dist/components/CheckBox/CheckBox.cjs"
36
+ },
37
+ "./DropdownMenu": {
38
+ "types": "./dist/components/DropdownMenu/DropdownMenu.d.ts",
39
+ "import": "./dist/components/DropdownMenu/DropdownMenu.js",
40
+ "require": "./dist/components/DropdownMenu/DropdownMenu.cjs"
41
+ },
42
+ "./IconButton": {
43
+ "types": "./dist/components/IconButton/IconButton.d.ts",
44
+ "import": "./dist/components/IconButton/IconButton.js",
45
+ "require": "./dist/components/IconButton/IconButton.cjs"
46
+ },
47
+ "./IconRoundedButton": {
48
+ "types": "./dist/components/IconRoundedButton/IconRoundedButton.d.ts",
49
+ "import": "./dist/components/IconRoundedButton/IconRoundedButton.js",
50
+ "require": "./dist/components/IconRoundedButton/IconRoundedButton.cjs"
51
+ },
52
+ "./NavButton": {
53
+ "types": "./dist/components/NavButton/NavButton.d.ts",
54
+ "import": "./dist/components/NavButton/NavButton.js",
55
+ "require": "./dist/components/NavButton/NavButton.cjs"
56
+ },
57
+ "./SelectionButton": {
58
+ "types": "./dist/components/SelectionButton/SelectionButton.d.ts",
59
+ "import": "./dist/components/SelectionButton/SelectionButton.js",
60
+ "require": "./dist/components/SelectionButton/SelectionButton.cjs"
61
+ },
62
+ "./Table": {
63
+ "types": "./dist/components/Table/Table.d.ts",
64
+ "import": "./dist/components/Table/Table.js",
65
+ "require": "./dist/components/Table/Table.cjs"
66
+ },
67
+ "./Text": {
68
+ "types": "./dist/components/Text/Text.d.ts",
69
+ "import": "./dist/components/Text/Text.js",
70
+ "require": "./dist/components/Text/Text.cjs"
71
+ },
72
+ "./TextArea": {
73
+ "types": "./dist/components/TextArea/TextArea.d.ts",
74
+ "import": "./dist/components/TextArea/TextArea.js",
75
+ "require": "./dist/components/TextArea/TextArea.cjs"
76
+ },
77
+ "./Toast": {
78
+ "types": "./dist/components/Toast/Toast.d.ts",
79
+ "import": "./dist/components/Toast/Toast.js",
80
+ "require": "./dist/components/Toast/Toast.cjs"
81
+ }
17
82
  },
18
83
  "scripts": {
19
84
  "lint": "npx eslint \"{src,app}/**/*.{js,jsx,ts,tsx}\" --fix",
@@ -23,7 +88,10 @@
23
88
  "test:watch": "jest --watch",
24
89
  "test:coverage": "jest --coverage",
25
90
  "test:sonar": "jest --coverage --testResultsProcessor=jest-sonar-reporter",
26
- "build": "tsup src/index.ts --dts --format esm,cjs --out-dir dist --clean",
91
+ "generate:exports": "node scripts/generate-exports.mjs",
92
+ "build": "npm run build:main && npm run build:components",
93
+ "build:main": "tsup src/index.ts --dts --format esm,cjs --out-dir dist --clean",
94
+ "build:components": "node scripts/build-components.mjs",
27
95
  "build:check": "npm run typecheck && npm run build",
28
96
  "dev": "tsup src/index.ts --dts --format esm,cjs --out-dir dist --watch",
29
97
  "prepack": "npm run build:check",