analytica-frontend-lib 1.0.91 → 1.0.93
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/Accordation/index.d.mts +12 -0
- package/dist/Accordation/index.d.ts +12 -1
- package/dist/Accordation/index.js +1 -0
- package/dist/Accordation/index.js.map +1 -0
- package/dist/Accordation/index.mjs +1 -0
- package/dist/Accordation/index.mjs.map +1 -0
- package/dist/Alert/index.d.mts +13 -0
- package/dist/Alert/index.d.ts +13 -1
- package/dist/Alert/index.js +1 -0
- package/dist/Alert/index.js.map +1 -0
- package/dist/Alert/index.mjs +1 -0
- package/dist/Alert/index.mjs.map +1 -0
- package/dist/AlertDialog/index.d.mts +36 -0
- package/dist/AlertDialog/index.d.ts +36 -1
- package/dist/AlertDialog/index.js +1 -0
- package/dist/AlertDialog/index.js.map +1 -0
- package/dist/AlertDialog/index.mjs +1 -0
- package/dist/AlertDialog/index.mjs.map +1 -0
- package/dist/Alternative/index.d.mts +81 -0
- package/dist/Alternative/index.d.ts +81 -1
- package/dist/Alternative/index.js +1 -0
- package/dist/Alternative/index.js.map +1 -0
- package/dist/Alternative/index.mjs +1 -0
- package/dist/Alternative/index.mjs.map +1 -0
- package/dist/Auth/AuthProvider/index.d.mts +3 -0
- package/dist/Auth/AuthProvider/index.d.ts +3 -1
- package/dist/Auth/AuthProvider/index.js +1 -0
- package/dist/Auth/AuthProvider/index.js.map +1 -0
- package/dist/Auth/AuthProvider/index.mjs +1 -0
- package/dist/Auth/AuthProvider/index.mjs.map +1 -0
- package/dist/Auth/ProtectedRoute/index.d.mts +3 -0
- package/dist/Auth/ProtectedRoute/index.d.ts +3 -1
- package/dist/Auth/ProtectedRoute/index.js +1 -0
- package/dist/Auth/ProtectedRoute/index.js.map +1 -0
- package/dist/Auth/ProtectedRoute/index.mjs +1 -0
- package/dist/Auth/ProtectedRoute/index.mjs.map +1 -0
- package/dist/Auth/PublicRoute/index.d.mts +3 -0
- package/dist/Auth/PublicRoute/index.d.ts +3 -1
- package/dist/Auth/PublicRoute/index.js +1 -0
- package/dist/Auth/PublicRoute/index.js.map +1 -0
- package/dist/Auth/PublicRoute/index.mjs +1 -0
- package/dist/Auth/PublicRoute/index.mjs.map +1 -0
- package/dist/Auth/getRootDomain/index.d.mts +3 -0
- package/dist/Auth/getRootDomain/index.d.ts +3 -1
- package/dist/Auth/getRootDomain/index.js +1 -0
- package/dist/Auth/getRootDomain/index.js.map +1 -0
- package/dist/Auth/getRootDomain/index.mjs +1 -0
- package/dist/Auth/getRootDomain/index.mjs.map +1 -0
- package/dist/Auth/index.d.mts +312 -0
- package/dist/Auth/index.d.ts +312 -1
- package/dist/Auth/index.js +1 -0
- package/dist/Auth/index.js.map +1 -0
- package/dist/Auth/index.mjs +1 -0
- package/dist/Auth/index.mjs.map +1 -0
- package/dist/Auth/useApiConfig/index.d.mts +43 -0
- package/dist/Auth/useApiConfig/index.d.ts +43 -1
- package/dist/Auth/useApiConfig/index.js +1 -0
- package/dist/Auth/useApiConfig/index.js.map +1 -0
- package/dist/Auth/useApiConfig/index.mjs +1 -0
- package/dist/Auth/useApiConfig/index.mjs.map +1 -0
- package/dist/Auth/useAuth/index.d.mts +3 -0
- package/dist/Auth/useAuth/index.d.ts +3 -1
- package/dist/Auth/useAuth/index.js +1 -0
- package/dist/Auth/useAuth/index.js.map +1 -0
- package/dist/Auth/useAuth/index.mjs +1 -0
- package/dist/Auth/useAuth/index.mjs.map +1 -0
- package/dist/Auth/useAuthGuard/index.d.mts +3 -0
- package/dist/Auth/useAuthGuard/index.d.ts +3 -1
- package/dist/Auth/useAuthGuard/index.js +1 -0
- package/dist/Auth/useAuthGuard/index.js.map +1 -0
- package/dist/Auth/useAuthGuard/index.mjs +1 -0
- package/dist/Auth/useAuthGuard/index.mjs.map +1 -0
- package/dist/Auth/useRouteAuth/index.d.mts +3 -0
- package/dist/Auth/useRouteAuth/index.d.ts +3 -1
- package/dist/Auth/useRouteAuth/index.js +1 -0
- package/dist/Auth/useRouteAuth/index.js.map +1 -0
- package/dist/Auth/useRouteAuth/index.mjs +1 -0
- package/dist/Auth/useRouteAuth/index.mjs.map +1 -0
- package/dist/Auth/useUrlAuthentication/index.d.mts +58 -0
- package/dist/Auth/useUrlAuthentication/index.d.ts +58 -1
- package/dist/Auth/useUrlAuthentication/index.js +1 -0
- package/dist/Auth/useUrlAuthentication/index.js.map +1 -0
- package/dist/Auth/useUrlAuthentication/index.mjs +1 -0
- package/dist/Auth/useUrlAuthentication/index.mjs.map +1 -0
- package/dist/Auth/withAuth/index.d.mts +3 -0
- package/dist/Auth/withAuth/index.d.ts +3 -1
- package/dist/Auth/withAuth/index.js +1 -0
- package/dist/Auth/withAuth/index.js.map +1 -0
- package/dist/Auth/withAuth/index.mjs +1 -0
- package/dist/Auth/withAuth/index.mjs.map +1 -0
- package/dist/Auth/zustandAuthAdapter/index.d.mts +75 -0
- package/dist/Auth/zustandAuthAdapter/index.d.ts +75 -1
- package/dist/Auth/zustandAuthAdapter/index.js +1 -0
- package/dist/Auth/zustandAuthAdapter/index.js.map +1 -0
- package/dist/Auth/zustandAuthAdapter/index.mjs +1 -0
- package/dist/Auth/zustandAuthAdapter/index.mjs.map +1 -0
- package/dist/Badge/index.d.mts +46 -0
- package/dist/Badge/index.d.ts +46 -1
- package/dist/Badge/index.js +1 -0
- package/dist/Badge/index.js.map +1 -0
- package/dist/Badge/index.mjs +1 -0
- package/dist/Badge/index.mjs.map +1 -0
- package/dist/Button/index.d.mts +45 -0
- package/dist/Button/index.d.ts +45 -1
- package/dist/Button/index.js +1 -0
- package/dist/Button/index.js.map +1 -0
- package/dist/Button/index.mjs +1 -0
- package/dist/Button/index.mjs.map +1 -0
- package/dist/Calendar/index.d.mts +60 -0
- package/dist/Calendar/index.d.ts +60 -1
- package/dist/Calendar/index.js +1 -0
- package/dist/Calendar/index.js.map +1 -0
- package/dist/Calendar/index.mjs +1 -0
- package/dist/Calendar/index.mjs.map +1 -0
- package/dist/Card/index.d.mts +150 -0
- package/dist/Card/index.d.ts +150 -1
- package/dist/Card/index.js +1 -0
- package/dist/Card/index.js.map +1 -0
- package/dist/Card/index.mjs +1 -0
- package/dist/Card/index.mjs.map +1 -0
- package/dist/CheckBox/index.d.mts +74 -0
- package/dist/CheckBox/index.d.ts +74 -1
- package/dist/CheckBox/index.js +1 -0
- package/dist/CheckBox/index.js.map +1 -0
- package/dist/CheckBox/index.mjs +1 -0
- package/dist/CheckBox/index.mjs.map +1 -0
- package/dist/Chips/index.d.mts +41 -0
- package/dist/Chips/index.d.ts +41 -1
- package/dist/Chips/index.js +1 -0
- package/dist/Chips/index.js.map +1 -0
- package/dist/Chips/index.mjs +1 -0
- package/dist/Chips/index.mjs.map +1 -0
- package/dist/Divider/index.d.mts +32 -0
- package/dist/Divider/index.d.ts +32 -1
- package/dist/Divider/index.js +1 -0
- package/dist/Divider/index.js.map +1 -0
- package/dist/Divider/index.mjs +1 -0
- package/dist/Divider/index.mjs.map +1 -0
- package/dist/DropdownMenu/index.d.mts +68 -0
- package/dist/DropdownMenu/index.d.ts +68 -1
- package/dist/DropdownMenu/index.js +1 -0
- package/dist/DropdownMenu/index.js.map +1 -0
- package/dist/DropdownMenu/index.mjs +1 -0
- package/dist/DropdownMenu/index.mjs.map +1 -0
- package/dist/IconButton/index.d.mts +76 -0
- package/dist/IconButton/index.d.ts +76 -1
- package/dist/IconButton/index.js +1 -0
- package/dist/IconButton/index.js.map +1 -0
- package/dist/IconButton/index.mjs +1 -0
- package/dist/IconButton/index.mjs.map +1 -0
- package/dist/IconRoundedButton/index.d.mts +34 -0
- package/dist/IconRoundedButton/index.d.ts +34 -1
- package/dist/IconRoundedButton/index.js +1 -0
- package/dist/IconRoundedButton/index.js.map +1 -0
- package/dist/IconRoundedButton/index.mjs +1 -0
- package/dist/IconRoundedButton/index.mjs.map +1 -0
- package/dist/Input/index.d.mts +27 -0
- package/dist/Input/index.d.ts +27 -1
- package/dist/Input/index.js +1 -0
- package/dist/Input/index.js.map +1 -0
- package/dist/Input/index.mjs +1 -0
- package/dist/Input/index.mjs.map +1 -0
- package/dist/Menu/index.d.mts +48 -0
- package/dist/Menu/index.d.ts +48 -1
- package/dist/Menu/index.js +1 -0
- package/dist/Menu/index.js.map +1 -0
- package/dist/Menu/index.mjs +1 -0
- package/dist/Menu/index.mjs.map +1 -0
- package/dist/Modal/index.d.mts +66 -0
- package/dist/Modal/index.d.ts +66 -1
- package/dist/Modal/index.js +1 -0
- package/dist/Modal/index.js.map +1 -0
- package/dist/Modal/index.mjs +1 -0
- package/dist/Modal/index.mjs.map +1 -0
- package/dist/MultipleChoice/index.d.mts +20 -0
- package/dist/MultipleChoice/index.d.ts +20 -1
- package/dist/MultipleChoice/index.js +1 -0
- package/dist/MultipleChoice/index.js.map +1 -0
- package/dist/MultipleChoice/index.mjs +1 -0
- package/dist/MultipleChoice/index.mjs.map +1 -0
- package/dist/NavButton/index.d.mts +57 -0
- package/dist/NavButton/index.d.ts +57 -1
- package/dist/NavButton/index.js +1 -0
- package/dist/NavButton/index.js.map +1 -0
- package/dist/NavButton/index.mjs +1 -0
- package/dist/NavButton/index.mjs.map +1 -0
- package/dist/NotFound/index.d.mts +58 -0
- package/dist/NotFound/index.d.ts +58 -1
- package/dist/NotFound/index.js +1 -0
- package/dist/NotFound/index.js.map +1 -0
- package/dist/NotFound/index.mjs +1 -0
- package/dist/NotFound/index.mjs.map +1 -0
- package/dist/ProgressBar/index.d.mts +95 -0
- package/dist/ProgressBar/index.d.ts +95 -1
- package/dist/ProgressBar/index.js +1 -0
- package/dist/ProgressBar/index.js.map +1 -0
- package/dist/ProgressBar/index.mjs +1 -0
- package/dist/ProgressBar/index.mjs.map +1 -0
- package/dist/ProgressCircle/index.d.mts +60 -0
- package/dist/ProgressCircle/index.d.ts +60 -1
- package/dist/ProgressCircle/index.js +1 -0
- package/dist/ProgressCircle/index.js.map +1 -0
- package/dist/ProgressCircle/index.mjs +1 -0
- package/dist/ProgressCircle/index.mjs.map +1 -0
- package/dist/Quiz/index.d.mts +57 -0
- package/dist/Quiz/index.d.ts +57 -1
- package/dist/Quiz/index.js +3 -2
- package/dist/Quiz/index.js.map +1 -0
- package/dist/Quiz/index.mjs +3 -2
- package/dist/Quiz/index.mjs.map +1 -0
- package/dist/Quiz/useQuizStore/index.d.mts +139 -0
- package/dist/Quiz/useQuizStore/index.d.ts +139 -1
- package/dist/Quiz/useQuizStore/index.js +1 -0
- package/dist/Quiz/useQuizStore/index.js.map +1 -0
- package/dist/Quiz/useQuizStore/index.mjs +1 -0
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
- package/dist/Radio/index.d.mts +203 -0
- package/dist/Radio/index.d.ts +203 -1
- package/dist/Radio/index.js +1 -0
- package/dist/Radio/index.js.map +1 -0
- package/dist/Radio/index.mjs +1 -0
- package/dist/Radio/index.mjs.map +1 -0
- package/dist/Select/index.d.mts +58 -0
- package/dist/Select/index.d.ts +58 -1
- package/dist/Select/index.js +1 -0
- package/dist/Select/index.js.map +1 -0
- package/dist/Select/index.mjs +1 -0
- package/dist/Select/index.mjs.map +1 -0
- package/dist/SelectionButton/index.d.mts +57 -0
- package/dist/SelectionButton/index.d.ts +57 -1
- package/dist/SelectionButton/index.js +1 -0
- package/dist/SelectionButton/index.js.map +1 -0
- package/dist/SelectionButton/index.mjs +1 -0
- package/dist/SelectionButton/index.mjs.map +1 -0
- package/dist/Skeleton/index.d.mts +40 -0
- package/dist/Skeleton/index.d.ts +40 -1
- package/dist/Skeleton/index.js +1 -0
- package/dist/Skeleton/index.js.map +1 -0
- package/dist/Skeleton/index.mjs +1 -0
- package/dist/Skeleton/index.mjs.map +1 -0
- package/dist/Stepper/index.d.mts +169 -0
- package/dist/Stepper/index.d.ts +169 -1
- package/dist/Stepper/index.js +1 -0
- package/dist/Stepper/index.js.map +1 -0
- package/dist/Stepper/index.mjs +1 -0
- package/dist/Stepper/index.mjs.map +1 -0
- package/dist/Table/index.d.mts +17 -0
- package/dist/Table/index.d.ts +17 -1
- package/dist/Table/index.js +1 -0
- package/dist/Table/index.js.map +1 -0
- package/dist/Table/index.mjs +1 -0
- package/dist/Table/index.mjs.map +1 -0
- package/dist/Text/index.d.mts +58 -0
- package/dist/Text/index.d.ts +58 -1
- package/dist/Text/index.js +1 -0
- package/dist/Text/index.js.map +1 -0
- package/dist/Text/index.mjs +1 -0
- package/dist/Text/index.mjs.map +1 -0
- package/dist/TextArea/index.d.mts +70 -0
- package/dist/TextArea/index.d.ts +70 -1
- package/dist/TextArea/index.js +1 -0
- package/dist/TextArea/index.js.map +1 -0
- package/dist/TextArea/index.mjs +1 -0
- package/dist/TextArea/index.mjs.map +1 -0
- package/dist/Toast/ToastStore/index.d.mts +19 -0
- package/dist/Toast/ToastStore/index.d.ts +19 -1
- package/dist/Toast/ToastStore/index.js +1 -0
- package/dist/Toast/ToastStore/index.js.map +1 -0
- package/dist/Toast/ToastStore/index.mjs +1 -0
- package/dist/Toast/ToastStore/index.mjs.map +1 -0
- package/dist/Toast/Toaster/index.d.mts +16 -0
- package/dist/Toast/Toaster/index.d.ts +16 -1
- package/dist/Toast/Toaster/index.js +1 -0
- package/dist/Toast/Toaster/index.js.map +1 -0
- package/dist/Toast/Toaster/index.mjs +1 -0
- package/dist/Toast/Toaster/index.mjs.map +1 -0
- package/dist/Toast/index.d.mts +17 -0
- package/dist/Toast/index.d.ts +17 -1
- package/dist/Toast/index.js +1 -0
- package/dist/Toast/index.js.map +1 -0
- package/dist/Toast/index.mjs +1 -0
- package/dist/Toast/index.mjs.map +1 -0
- package/dist/index.css +5 -4
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +42 -2142
- package/dist/index.d.ts +42 -2142
- package/dist/index.js +3 -23
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -20
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +5 -4
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.mts +2 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +4 -5
- package/dist/CheckBox/CheckboxList/index.d.ts +0 -1
- package/dist/CheckBox/CheckboxList/index.js +0 -429
- package/dist/CheckBox/CheckboxList/index.mjs +0 -415
package/dist/styles.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "analytica-frontend-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.93",
|
|
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",
|
|
@@ -64,14 +64,13 @@
|
|
|
64
64
|
"test:watch": "jest --watch",
|
|
65
65
|
"test:coverage": "jest --coverage",
|
|
66
66
|
"test:sonar": "SONAR_REPORTER=true jest --coverage",
|
|
67
|
-
"build": "tsup
|
|
68
|
-
"build:
|
|
69
|
-
"build:clean": "rm -rf dist && npm run build && npm run build:types",
|
|
67
|
+
"build": "tsup",
|
|
68
|
+
"build:clean": "rm -rf dist && npm run build",
|
|
70
69
|
"ladle": "ladle serve",
|
|
71
70
|
"ladle:build": "ladle build",
|
|
72
71
|
"add:exports": "node scripts/add-exports.mjs",
|
|
73
72
|
"remove:exports": "node scripts/remove-exports.mjs",
|
|
74
|
-
"prepack": "npm run add:exports && npm run build",
|
|
73
|
+
"prepack": "npm run add:exports && npm run build:clean",
|
|
75
74
|
"postpack": "npm run remove:exports",
|
|
76
75
|
"publish:dry": "npm run prepack && npm publish --dry-run && npm run postpack"
|
|
77
76
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../index';
|
|
@@ -1,429 +0,0 @@
|
|
|
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/CheckBox/CheckboxList.tsx
|
|
21
|
-
var CheckboxList_exports = {};
|
|
22
|
-
__export(CheckboxList_exports, {
|
|
23
|
-
CheckboxListItem: () => CheckboxListItem,
|
|
24
|
-
default: () => CheckboxList_default,
|
|
25
|
-
useCheckboxListStore: () => useCheckboxListStore
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(CheckboxList_exports);
|
|
28
|
-
var import_react2 = require("react");
|
|
29
|
-
var import_zustand = require("zustand");
|
|
30
|
-
|
|
31
|
-
// src/components/CheckBox/CheckBox.tsx
|
|
32
|
-
var import_react = require("react");
|
|
33
|
-
|
|
34
|
-
// src/utils/utils.ts
|
|
35
|
-
var import_clsx = require("clsx");
|
|
36
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
37
|
-
function cn(...inputs) {
|
|
38
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// src/components/Text/Text.tsx
|
|
42
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
-
var Text = ({
|
|
44
|
-
children,
|
|
45
|
-
size = "md",
|
|
46
|
-
weight = "normal",
|
|
47
|
-
color = "text-text-950",
|
|
48
|
-
as,
|
|
49
|
-
className = "",
|
|
50
|
-
...props
|
|
51
|
-
}) => {
|
|
52
|
-
let sizeClasses = "";
|
|
53
|
-
let weightClasses = "";
|
|
54
|
-
const sizeClassMap = {
|
|
55
|
-
"2xs": "text-2xs",
|
|
56
|
-
xs: "text-xs",
|
|
57
|
-
sm: "text-sm",
|
|
58
|
-
md: "text-md",
|
|
59
|
-
lg: "text-lg",
|
|
60
|
-
xl: "text-xl",
|
|
61
|
-
"2xl": "text-2xl",
|
|
62
|
-
"3xl": "text-3xl",
|
|
63
|
-
"4xl": "text-4xl",
|
|
64
|
-
"5xl": "text-5xl",
|
|
65
|
-
"6xl": "text-6xl"
|
|
66
|
-
};
|
|
67
|
-
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
68
|
-
const weightClassMap = {
|
|
69
|
-
hairline: "font-hairline",
|
|
70
|
-
light: "font-light",
|
|
71
|
-
normal: "font-normal",
|
|
72
|
-
medium: "font-medium",
|
|
73
|
-
semibold: "font-semibold",
|
|
74
|
-
bold: "font-bold",
|
|
75
|
-
extrabold: "font-extrabold",
|
|
76
|
-
black: "font-black"
|
|
77
|
-
};
|
|
78
|
-
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
79
|
-
const baseClasses = "font-primary";
|
|
80
|
-
const Component = as ?? "p";
|
|
81
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
-
Component,
|
|
83
|
-
{
|
|
84
|
-
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
85
|
-
...props,
|
|
86
|
-
children
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
var Text_default = Text;
|
|
91
|
-
|
|
92
|
-
// src/components/CheckBox/CheckBox.tsx
|
|
93
|
-
var import_phosphor_react = require("phosphor-react");
|
|
94
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
95
|
-
var SIZE_CLASSES = {
|
|
96
|
-
small: {
|
|
97
|
-
checkbox: "w-4 h-4",
|
|
98
|
-
// 16px x 16px
|
|
99
|
-
textSize: "sm",
|
|
100
|
-
spacing: "gap-1.5",
|
|
101
|
-
// 6px
|
|
102
|
-
borderWidth: "border-2",
|
|
103
|
-
iconSize: 14,
|
|
104
|
-
// pixels for Phosphor icons
|
|
105
|
-
labelHeight: "h-[21px]"
|
|
106
|
-
},
|
|
107
|
-
medium: {
|
|
108
|
-
checkbox: "w-5 h-5",
|
|
109
|
-
// 20px x 20px
|
|
110
|
-
textSize: "md",
|
|
111
|
-
spacing: "gap-2",
|
|
112
|
-
// 8px
|
|
113
|
-
borderWidth: "border-2",
|
|
114
|
-
iconSize: 16,
|
|
115
|
-
// pixels for Phosphor icons
|
|
116
|
-
labelHeight: "h-6"
|
|
117
|
-
},
|
|
118
|
-
large: {
|
|
119
|
-
checkbox: "w-6 h-6",
|
|
120
|
-
// 24px x 24px
|
|
121
|
-
textSize: "lg",
|
|
122
|
-
spacing: "gap-2",
|
|
123
|
-
// 8px
|
|
124
|
-
borderWidth: "border-[3px]",
|
|
125
|
-
// 3px border
|
|
126
|
-
iconSize: 20,
|
|
127
|
-
// pixels for Phosphor icons
|
|
128
|
-
labelHeight: "h-[27px]"
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
132
|
-
var STATE_CLASSES = {
|
|
133
|
-
default: {
|
|
134
|
-
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
135
|
-
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
136
|
-
},
|
|
137
|
-
hovered: {
|
|
138
|
-
unchecked: "border-border-500 bg-background",
|
|
139
|
-
checked: "border-primary-800 bg-primary-800 text-text"
|
|
140
|
-
},
|
|
141
|
-
focused: {
|
|
142
|
-
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
143
|
-
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
144
|
-
},
|
|
145
|
-
invalid: {
|
|
146
|
-
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
147
|
-
checked: "border-error-700 bg-primary-950 text-text"
|
|
148
|
-
},
|
|
149
|
-
disabled: {
|
|
150
|
-
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
151
|
-
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
var CheckBox = (0, import_react.forwardRef)(
|
|
155
|
-
({
|
|
156
|
-
label,
|
|
157
|
-
size = "medium",
|
|
158
|
-
state = "default",
|
|
159
|
-
indeterminate = false,
|
|
160
|
-
errorMessage,
|
|
161
|
-
helperText,
|
|
162
|
-
className = "",
|
|
163
|
-
labelClassName = "",
|
|
164
|
-
checked: checkedProp,
|
|
165
|
-
disabled,
|
|
166
|
-
id,
|
|
167
|
-
onChange,
|
|
168
|
-
...props
|
|
169
|
-
}, ref) => {
|
|
170
|
-
const generatedId = (0, import_react.useId)();
|
|
171
|
-
const inputId = id ?? `checkbox-${generatedId}`;
|
|
172
|
-
const [internalChecked, setInternalChecked] = (0, import_react.useState)(false);
|
|
173
|
-
const isControlled = checkedProp !== void 0;
|
|
174
|
-
const checked = isControlled ? checkedProp : internalChecked;
|
|
175
|
-
const handleChange = (event) => {
|
|
176
|
-
if (!isControlled) {
|
|
177
|
-
setInternalChecked(event.target.checked);
|
|
178
|
-
}
|
|
179
|
-
onChange?.(event);
|
|
180
|
-
};
|
|
181
|
-
const currentState = disabled ? "disabled" : state;
|
|
182
|
-
const sizeClasses = SIZE_CLASSES[size];
|
|
183
|
-
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
184
|
-
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
185
|
-
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
186
|
-
const checkboxClasses = cn(
|
|
187
|
-
BASE_CHECKBOX_CLASSES,
|
|
188
|
-
sizeClasses.checkbox,
|
|
189
|
-
borderWidthClass,
|
|
190
|
-
stylingClasses,
|
|
191
|
-
className
|
|
192
|
-
);
|
|
193
|
-
const renderIcon = () => {
|
|
194
|
-
if (indeterminate) {
|
|
195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
196
|
-
import_phosphor_react.Minus,
|
|
197
|
-
{
|
|
198
|
-
size: sizeClasses.iconSize,
|
|
199
|
-
weight: "bold",
|
|
200
|
-
color: "currentColor"
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
if (checked) {
|
|
205
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
206
|
-
import_phosphor_react.Check,
|
|
207
|
-
{
|
|
208
|
-
size: sizeClasses.iconSize,
|
|
209
|
-
weight: "bold",
|
|
210
|
-
color: "currentColor"
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
return null;
|
|
215
|
-
};
|
|
216
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col", children: [
|
|
217
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
218
|
-
"div",
|
|
219
|
-
{
|
|
220
|
-
className: cn(
|
|
221
|
-
"flex flex-row items-center",
|
|
222
|
-
sizeClasses.spacing,
|
|
223
|
-
disabled ? "opacity-40" : ""
|
|
224
|
-
),
|
|
225
|
-
children: [
|
|
226
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
227
|
-
"input",
|
|
228
|
-
{
|
|
229
|
-
ref,
|
|
230
|
-
type: "checkbox",
|
|
231
|
-
id: inputId,
|
|
232
|
-
checked,
|
|
233
|
-
disabled,
|
|
234
|
-
onChange: handleChange,
|
|
235
|
-
className: "sr-only",
|
|
236
|
-
...props
|
|
237
|
-
}
|
|
238
|
-
),
|
|
239
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
240
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
241
|
-
"div",
|
|
242
|
-
{
|
|
243
|
-
className: cn(
|
|
244
|
-
"flex flex-row items-center",
|
|
245
|
-
sizeClasses.labelHeight
|
|
246
|
-
),
|
|
247
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
248
|
-
Text_default,
|
|
249
|
-
{
|
|
250
|
-
as: "label",
|
|
251
|
-
htmlFor: inputId,
|
|
252
|
-
size: sizeClasses.textSize,
|
|
253
|
-
weight: "normal",
|
|
254
|
-
className: cn(
|
|
255
|
-
"cursor-pointer select-none leading-[150%] flex items-center font-roboto",
|
|
256
|
-
labelClassName
|
|
257
|
-
),
|
|
258
|
-
children: label
|
|
259
|
-
}
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
|
-
)
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
267
|
-
Text_default,
|
|
268
|
-
{
|
|
269
|
-
size: "sm",
|
|
270
|
-
weight: "normal",
|
|
271
|
-
className: "mt-1.5",
|
|
272
|
-
color: "text-error-600",
|
|
273
|
-
children: errorMessage
|
|
274
|
-
}
|
|
275
|
-
),
|
|
276
|
-
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
277
|
-
Text_default,
|
|
278
|
-
{
|
|
279
|
-
size: "sm",
|
|
280
|
-
weight: "normal",
|
|
281
|
-
className: "mt-1.5",
|
|
282
|
-
color: "text-text-500",
|
|
283
|
-
children: helperText
|
|
284
|
-
}
|
|
285
|
-
)
|
|
286
|
-
] });
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
CheckBox.displayName = "CheckBox";
|
|
290
|
-
var CheckBox_default = CheckBox;
|
|
291
|
-
|
|
292
|
-
// src/components/CheckBox/CheckboxList.tsx
|
|
293
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
294
|
-
var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => (0, import_zustand.create)((set, get) => ({
|
|
295
|
-
values: defaultValues,
|
|
296
|
-
setValues: (values) => {
|
|
297
|
-
if (!get().disabled) {
|
|
298
|
-
set({ values });
|
|
299
|
-
get().onValuesChange?.(values);
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
toggleValue: (value) => {
|
|
303
|
-
if (!get().disabled) {
|
|
304
|
-
const currentValues = get().values;
|
|
305
|
-
const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
|
|
306
|
-
set({ values: newValues });
|
|
307
|
-
get().onValuesChange?.(newValues);
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
onValuesChange,
|
|
311
|
-
disabled,
|
|
312
|
-
name
|
|
313
|
-
}));
|
|
314
|
-
var useCheckboxListStore = (externalStore) => {
|
|
315
|
-
if (!externalStore) {
|
|
316
|
-
throw new Error("CheckboxListItem must be used within a CheckboxList");
|
|
317
|
-
}
|
|
318
|
-
return externalStore;
|
|
319
|
-
};
|
|
320
|
-
var injectStore = (children, store) => import_react2.Children.map(children, (child) => {
|
|
321
|
-
if (!(0, import_react2.isValidElement)(child)) return child;
|
|
322
|
-
const typedChild = child;
|
|
323
|
-
const shouldInject = typedChild.type === CheckboxListItem;
|
|
324
|
-
return (0, import_react2.cloneElement)(typedChild, {
|
|
325
|
-
...shouldInject ? { store } : {},
|
|
326
|
-
...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
var CheckboxList = (0, import_react2.forwardRef)(
|
|
330
|
-
({
|
|
331
|
-
values: propValues,
|
|
332
|
-
defaultValues = [],
|
|
333
|
-
onValuesChange,
|
|
334
|
-
name: propName,
|
|
335
|
-
disabled = false,
|
|
336
|
-
className = "",
|
|
337
|
-
children,
|
|
338
|
-
...props
|
|
339
|
-
}, ref) => {
|
|
340
|
-
const generatedId = (0, import_react2.useId)();
|
|
341
|
-
const name = propName || `checkbox-list-${generatedId}`;
|
|
342
|
-
const storeRef = (0, import_react2.useRef)(null);
|
|
343
|
-
storeRef.current ??= createCheckboxListStore(
|
|
344
|
-
name,
|
|
345
|
-
defaultValues,
|
|
346
|
-
disabled,
|
|
347
|
-
onValuesChange
|
|
348
|
-
);
|
|
349
|
-
const store = storeRef.current;
|
|
350
|
-
const { setValues } = (0, import_zustand.useStore)(store, (s) => s);
|
|
351
|
-
(0, import_react2.useEffect)(() => {
|
|
352
|
-
const currentValues = store.getState().values;
|
|
353
|
-
if (currentValues.length > 0 && onValuesChange) {
|
|
354
|
-
onValuesChange(currentValues);
|
|
355
|
-
}
|
|
356
|
-
}, []);
|
|
357
|
-
(0, import_react2.useEffect)(() => {
|
|
358
|
-
if (propValues !== void 0) {
|
|
359
|
-
setValues(propValues);
|
|
360
|
-
}
|
|
361
|
-
}, [propValues, setValues]);
|
|
362
|
-
(0, import_react2.useEffect)(() => {
|
|
363
|
-
store.setState({ disabled });
|
|
364
|
-
}, [disabled, store]);
|
|
365
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
366
|
-
"div",
|
|
367
|
-
{
|
|
368
|
-
ref,
|
|
369
|
-
className: cn("flex flex-col gap-2 w-full", className),
|
|
370
|
-
"aria-label": name,
|
|
371
|
-
...props,
|
|
372
|
-
children: injectStore(children, store)
|
|
373
|
-
}
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
);
|
|
377
|
-
CheckboxList.displayName = "CheckboxList";
|
|
378
|
-
var CheckboxListItem = (0, import_react2.forwardRef)(
|
|
379
|
-
({
|
|
380
|
-
value,
|
|
381
|
-
store: externalStore,
|
|
382
|
-
disabled: itemDisabled,
|
|
383
|
-
size = "medium",
|
|
384
|
-
state = "default",
|
|
385
|
-
className = "",
|
|
386
|
-
id,
|
|
387
|
-
...props
|
|
388
|
-
}, ref) => {
|
|
389
|
-
const store = useCheckboxListStore(externalStore);
|
|
390
|
-
const {
|
|
391
|
-
values: groupValues,
|
|
392
|
-
toggleValue,
|
|
393
|
-
disabled: groupDisabled,
|
|
394
|
-
name
|
|
395
|
-
} = (0, import_zustand.useStore)(store);
|
|
396
|
-
const generatedId = (0, import_react2.useId)();
|
|
397
|
-
const inputId = id ?? `checkbox-item-${generatedId}`;
|
|
398
|
-
const isChecked = groupValues.includes(value);
|
|
399
|
-
const isDisabled = groupDisabled || itemDisabled;
|
|
400
|
-
const currentState = isDisabled ? "disabled" : state;
|
|
401
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
402
|
-
CheckBox_default,
|
|
403
|
-
{
|
|
404
|
-
ref,
|
|
405
|
-
id: inputId,
|
|
406
|
-
name,
|
|
407
|
-
value,
|
|
408
|
-
checked: isChecked,
|
|
409
|
-
disabled: isDisabled,
|
|
410
|
-
size,
|
|
411
|
-
state: currentState,
|
|
412
|
-
className,
|
|
413
|
-
onChange: () => {
|
|
414
|
-
if (!isDisabled) {
|
|
415
|
-
toggleValue(value);
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
...props
|
|
419
|
-
}
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
);
|
|
423
|
-
CheckboxListItem.displayName = "CheckboxListItem";
|
|
424
|
-
var CheckboxList_default = CheckboxList;
|
|
425
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
426
|
-
0 && (module.exports = {
|
|
427
|
-
CheckboxListItem,
|
|
428
|
-
useCheckboxListStore
|
|
429
|
-
});
|